kni: check code of promiscuous mode switch
[dpdk.git] / lib / librte_kni / rte_kni.c
index 4b51fb4..04806eb 100644 (file)
@@ -472,6 +472,8 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
 static int
 kni_config_promiscusity(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;
@@ -481,11 +483,17 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
                port_id, to_on);
 
        if (to_on)
-               rte_eth_promiscuous_enable(port_id);
+               ret = rte_eth_promiscuous_enable(port_id);
        else
-               rte_eth_promiscuous_disable(port_id);
+               ret = rte_eth_promiscuous_disable(port_id);
 
-       return 0;
+       if (ret != 0)
+               RTE_LOG(ERR, KNI,
+                       "Failed to %s promiscuous mode for port %u: %s\n",
+                       to_on ? "enable" : "disable", port_id,
+                       rte_strerror(-ret));
+
+       return ret;
 }
 
 int