dpdk/0256-kni-check-error-code-of-allmulticast-mode-switch.patch
speech_white 1c77287214 sync to master branch
sync patches ranges from versoin 9 t0 17 from master branch

Signed-off-by: speech_white <humin29@huawei.com>
2021-12-17 10:45:19 +08:00

55 lines
1.6 KiB
Diff

From 72387188c6847df9a88d77c5428604db88441617 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Fri, 23 Apr 2021 16:12:42 +0800
Subject: [PATCH 23/33] kni: check error code of allmulticast mode switch
Some drivers may return errcode when switch allmulticast mode,
so it's necessary to check the return code.
Fixes: b34801d1aa2e ("kni: support allmulticast mode set")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
lib/librte_kni/rte_kni.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 837d0217d..54ea792fc 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -514,6 +514,8 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
static int
kni_config_allmulticast(uint16_t port_id, uint8_t to_on)
{
+ int ret;
+
if (!rte_eth_dev_is_valid_port(port_id)) {
RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id);
return -EINVAL;
@@ -523,11 +525,16 @@ kni_config_allmulticast(uint16_t port_id, uint8_t to_on)
port_id, to_on);
if (to_on)
- rte_eth_allmulticast_enable(port_id);
+ ret = rte_eth_allmulticast_enable(port_id);
else
- rte_eth_allmulticast_disable(port_id);
+ ret = rte_eth_allmulticast_disable(port_id);
+ if (ret != 0)
+ RTE_LOG(ERR, KNI,
+ "Failed to %s allmulticast mode for port %u: %s\n",
+ to_on ? "enable" : "disable", port_id,
+ rte_strerror(-ret));
- return 0;
+ return ret;
}
int
--
2.33.0