代码拉取完成,页面将自动刷新
From 7d721f7c7e5b1ac5265a8a7a30158e81f0e45b9b Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Mon, 4 Dec 2023 20:28:41 +0800
Subject: [PATCH] add struct gz_addr_t
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
日期: Tue Dec 5 9:30:41 2023 +0800
---
src/lstack/core/lstack_dpdk.c | 14 ++++++--------
src/lstack/include/lstack_dpdk.h | 4 ++--
src/ltran/ltran_timer.c | 8 --------
3 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index 839516e..a742335 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -766,7 +766,7 @@ int32_t init_dpdk_ethdev(void)
return 0;
}
-bool port_in_stack_queue(ip_addr_t src_ip, ip_addr_t dst_ip, uint16_t src_port, uint16_t dst_port)
+bool port_in_stack_queue(gz_addr_t *src_ip, gz_addr_t *dst_ip, uint16_t src_port, uint16_t dst_port)
{
struct protocol_stack_group *stack_group = get_protocol_stack_group();
if (stack_group->reta_mask == 0 || stack_group->nb_queues <= 1) {
@@ -775,19 +775,17 @@ bool port_in_stack_queue(ip_addr_t src_ip, ip_addr_t dst_ip, uint16_t src_port,
union rte_thash_tuple tuple;
uint32_t hash = 0;
- if (IP_IS_V4_VAL(src_ip)) {
- tuple.v4.src_addr = rte_be_to_cpu_32(ip_2_ip4(&src_ip)->addr);
- tuple.v4.dst_addr = rte_be_to_cpu_32(ip_2_ip4(&dst_ip)->addr);
+ if (IP_IS_V4_VAL(*src_ip)) {
+ tuple.v4.src_addr = rte_be_to_cpu_32(src_ip->u_addr.ip4.addr);
+ tuple.v4.dst_addr = rte_be_to_cpu_32(dst_ip->u_addr.ip4.addr);
tuple.v4.sport = src_port;
tuple.v4.dport = dst_port;
hash = rte_softrss((uint32_t *)&tuple, RTE_THASH_V4_L4_LEN, g_default_rss_key);
} else {
int i;
for (i = 0; i < 4; i++) {
- *((uint32_t *)tuple.v6.src_addr + i) =
- rte_be_to_cpu_32(*((const uint32_t *)src_ip.u_addr.ip6.addr + i));
- *((uint32_t *)tuple.v6.dst_addr + i) =
- rte_be_to_cpu_32(*((const uint32_t *)dst_ip.u_addr.ip6.addr + i));
+ *((uint32_t *)tuple.v6.src_addr + i) = rte_be_to_cpu_32(*(src_ip->u_addr.ip6.addr + i));
+ *((uint32_t *)tuple.v6.dst_addr + i) = rte_be_to_cpu_32(*(dst_ip->u_addr.ip6.addr + i));
}
tuple.v6.sport = src_port;
tuple.v6.dport = dst_port;
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
index 6554a7e..724ab24 100644
--- a/src/lstack/include/lstack_dpdk.h
+++ b/src/lstack/include/lstack_dpdk.h
@@ -13,7 +13,7 @@
#ifndef _GAZELLE_DPDK_H_
#define _GAZELLE_DPDK_H_
-#include <lwip/ip_addr.h>
+#include <lwip/reg_sock.h>
#include "gazelle_opt.h"
#include "gazelle_dfx_msg.h"
@@ -54,7 +54,7 @@ int dpdk_ethdev_start(void);
void dpdk_skip_nic_init(void);
int32_t dpdk_init_lstack_kni(void);
void dpdk_restore_pci(void);
-bool port_in_stack_queue(ip_addr_t src_ip, ip_addr_t dst_ip, uint16_t src_port, uint16_t dst_port);
+bool port_in_stack_queue(gz_addr_t *src_ip, gz_addr_t *dst_ip, uint16_t src_port, uint16_t dst_port);
struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
uint32_t mbuf_cache_size, uint16_t queue_id, unsigned numa_id);
diff --git a/src/ltran/ltran_timer.c b/src/ltran/ltran_timer.c
index 749b8e0..85ea324 100644
--- a/src/ltran/ltran_timer.c
+++ b/src/ltran/ltran_timer.c
@@ -24,14 +24,6 @@
#include "ltran_tcp_conn.h"
#include "ltran_instance.h"
#include "ltran_timer.h"
-/* undefine lwip_ntohs in lwip/def.h */
-#ifdef ntohs
-#undef ntohs
-#endif
-#ifdef htons
-#undef htons
-#endif
-
static uint64_t g_cycles_per_us = 0;
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。