13 Star 5 Fork 32

src-openEuler/gazelle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0070-add-struct-gz_addr_t.patch 3.69 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2023-12-09 23:07 . sync upstream patch
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gazelle.git
git@gitee.com:src-openeuler/gazelle.git
src-openeuler
gazelle
gazelle
master

搜索帮助