]> git.droids-corp.org - dpdk.git/commitdiff
kni: check error code of allmulticast mode switch
authorChengwen Feng <fengchengwen@huawei.com>
Fri, 23 Apr 2021 08:12:42 +0000 (16:12 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 8 Nov 2021 10:56:13 +0000 (11:56 +0100)
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/kni/rte_kni.c

index d3e236005ed59b6234bd723143dab37e2ab440d6..fc8f0e7b5a336f159eda7bf526f30a13fbb5662d 100644 (file)
@@ -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