1 Star 0 Fork 96

sky/gazelle_kylin_src

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0262-bond4-add-dpdk-return-value-check.patch 1.96 KB
一键复制 编辑 原始数据 按行查看 历史
compile_success 提交于 2023-12-04 02:54 . add select and timeout for kylin
From 4667dcdd7c262d7789b74eb4fb0675af4e0fbf7c Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Wed, 28 Jun 2023 09:08:53 +0000
Subject: [PATCH] bond4 add dpdk return value check
---
src/lstack/core/lstack_dpdk.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index f6cabf8..cd42047 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -490,7 +490,16 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
int slave_num = 2;
int32_t slave_port_id[2];
slave_port_id[0] = ethdev_port_id(get_global_cfg_params()->bond4_slave1_mac_addr);
+ if (slave_port_id[0] < 0) {
+ LSTACK_LOG(ERR, LSTACK, "get slave port id failed port = %d\n", slave_port_id[0]);
+ return slave_port_id[0];
+ }
+
slave_port_id[1] = ethdev_port_id(get_global_cfg_params()->bond4_slave2_mac_addr);
+ if (slave_port_id[1] < 0) {
+ LSTACK_LOG(ERR, LSTACK, "get slave port id failed port = %d\n", slave_port_id[1]);
+ return slave_port_id[1];
+ }
for (int i = 0; i < slave_num; i++) {
ret = dpdk_ethdev_init(slave_port_id[i], 0);
@@ -532,7 +541,15 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
if (bond_port) {
struct rte_eth_dev_info slave_dev_info;
int slave_id = rte_eth_bond_primary_get(port_id);
- rte_eth_dev_info_get(slave_id, &slave_dev_info);
+ if (slave_id < 0) {
+ LSTACK_LOG(ERR, LSTACK, "dpdk get bond primary port failed port = %d\n", slave_id);
+ 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);
+ return ret;
+ }
dev_info.rx_offload_capa = slave_dev_info.rx_offload_capa;
dev_info.tx_offload_capa = slave_dev_info.tx_offload_capa;
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/gazelle_kylin_src.git
git@gitee.com:nlgwcy/gazelle_kylin_src.git
nlgwcy
gazelle_kylin_src
gazelle_kylin_src
master

搜索帮助