Skip to contentSkip to conversation

kni: check code of allmulticast mode switch

PATCH Applied Min Hu (Connor) 3 participants 4 messages Apr 23, 2021 – Nov 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kni: check code of allmulticast mode switch

From: Chengwen Feng <[email protected]>

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")
---
 lib/kni/rte_kni.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
lib/kni/rte_kni.c +10 -3
index 9dae6a8..aa9b5b7 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw

Waiting for review

23/04/2021 10:12, Min Hu (Connor):

Quoted 45 lines

From: Chengwen Feng <[email protected]>

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")
---
 lib/kni/rte_kni.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
lib/kni/rte_kni.c +10 -3
index 9dae6a8..aa9b5b7 100644
@@ -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;
 }
#3 lore raw

24/06/2021 13:33, Ferruh Yigit:

Quoted 6 lines · Min Hu (Connor)
Quoted 5 lines

From: Chengwen Feng <[email protected]>

Some drivers may return errcode when switch allmulticast mode, so it's necessary to check the return code.

Quoted 7 lines
Quoted 5 lines
Fixes b34801d1aa2e ("kni: support allmulticast mode set")

Applied, thanks.
Sorry for the delay, it has been forgotten.