1 Star 0 Fork 32

LemmyHuang/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0155-dpdk-add-vlan-filter.patch 3.33 KB
一键复制 编辑 原始数据 按行查看 历史
From 3d8a848dde959ef95796e8215cdb1882a3496ce4 Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Thu, 21 Mar 2024 11:24:26 +0800
Subject: [PATCH] dpdk add vlan filter
---
src/common/dpdk_common.c | 6 ++++++
src/lstack/core/lstack_dpdk.c | 19 +++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/common/dpdk_common.c b/src/common/dpdk_common.c
index c0c4f63..c03b2ec 100644
--- a/src/common/dpdk_common.c
+++ b/src/common/dpdk_common.c
@@ -223,6 +223,12 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev
COMMON_INFO("RTE_ETH_RX_OFFLOAD_VLAN_STRIP\n");
}
+ // rx vlan filter
+ if (rx_ol_capa & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) {
+ rx_ol |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER;
+ COMMON_INFO("RTE_ETH_RX_OFFLOAD_VLAN_STRIP\n");
+ }
+
// tx ip
if (tx_ol_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
tx_ol |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index a774d45..42981f4 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -572,13 +572,13 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
int slave_id = rte_eth_bond_primary_get(port_id);
if (slave_id < 0) {
LSTACK_LOG(ERR, LSTACK, "dpdk get bond primary port failed port = %d\n", slave_id);
- free(eth_params);
+ free(eth_params);
return slave_id;
}
ret = rte_eth_dev_info_get(slave_id, &slave_dev_info);
if (ret != 0) {
LSTACK_LOG(ERR, LSTACK, "dpdk get bond dev info failed ret = %d\n", ret);
- free(eth_params);
+ free(eth_params);
return ret;
}
dev_info.rx_offload_capa = slave_dev_info.rx_offload_capa;
@@ -623,6 +623,13 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
}
}
+ /* after rte_eth_dev_configure */
+ ret = rte_eth_dev_vlan_filter(port_id, get_global_cfg_params()->nic.vlan_mode, 1);
+ if (ret != 0) {
+ LSTACK_LOG(ERR, LSTACK, "dpdk add vlan filter failed ret = %d\n", ret);
+ return -1;
+ }
+
rte_eth_allmulticast_enable(port_id);
return 0;
@@ -733,7 +740,7 @@ int32_t init_dpdk_ethdev(void)
}
ret = dpdk_ethdev_init(bond_port_id, 1);
- if (ret != 0) {
+ if (ret != 0) {
LSTACK_LOG(ERR, LSTACK, "dpdk_ethdev_init failed ret = %d\n", ret);
return -1;
}
@@ -765,18 +772,18 @@ int32_t init_dpdk_ethdev(void)
ret = rte_eth_promiscuous_enable(bond_port_id);
if (ret < 0) {
- LSTACK_LOG(ERR, LSTACK, "dpdk enable promiscuous failed ret = %d\n", ret);
+ LSTACK_LOG(ERR, LSTACK, "dpdk enable promiscuous failed ret = %d\n", ret);
return -1;
}
ret = rte_eth_allmulticast_enable(bond_port_id);
if (ret < 0) {
- LSTACK_LOG(ERR, LSTACK, "dpdk enable allmulticast failed ret = %d\n", ret);
+ LSTACK_LOG(ERR, LSTACK, "dpdk enable allmulticast failed ret = %d\n", ret);
return -1;
}
ret = rte_eth_dev_start(bond_port_id);
- if (ret < 0) {
+ if (ret < 0) {
LSTACK_LOG(ERR, LSTACK, "dpdk start bond port failed ret = %d\n", ret);
return -1;
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/LemmyHuang/gazelle_1.git
git@gitee.com:LemmyHuang/gazelle_1.git
LemmyHuang
gazelle_1
gazelle_1
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385