ethdev: change promiscuous callbacks to return status
[dpdk.git] / drivers / net / liquidio / lio_ethdev.c
index c25dab0..e1eaf9e 100644 (file)
@@ -367,7 +367,7 @@ lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
        }
 }
 
-static void
+static int
 lio_dev_info_get(struct rte_eth_dev *eth_dev,
                 struct rte_eth_dev_info *devinfo)
 {
@@ -393,6 +393,7 @@ lio_dev_info_get(struct rte_eth_dev *eth_dev,
                devinfo->speed_capa = ETH_LINK_SPEED_10G;
                lio_dev_err(lio_dev,
                            "Unknown CN23XX subsystem device id. Setting 10G as default link speed.\n");
+               return -EINVAL;
        }
 
        devinfo->max_rx_queues = lio_dev->max_rx_queues;
@@ -423,6 +424,7 @@ lio_dev_info_get(struct rte_eth_dev *eth_dev,
                                           ETH_RSS_NONFRAG_IPV6_TCP     |
                                           ETH_RSS_IPV6_EX              |
                                           ETH_RSS_IPV6_TCP_EX);
+       return 0;
 }
 
 static int
@@ -959,8 +961,12 @@ lio_dev_link_update(struct rte_eth_dev *eth_dev,
 /**
  * \brief Net device enable, disable allmulticast
  * @param eth_dev Pointer to the structure rte_eth_dev
+ *
+ * @return
+ *  On success return 0
+ *  On failure return negative errno
  */
-static void
+static int
 lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 {
        struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -985,14 +991,18 @@ lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 
        if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
                lio_dev_err(lio_dev, "Failed to send change flag message\n");
-               return;
+               return -EAGAIN;
        }
 
-       if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd))
+       if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
                lio_dev_err(lio_dev, "Change dev flag command timed out\n");
+               return -ETIMEDOUT;
+       }
+
+       return 0;
 }
 
-static void
+static int
 lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
        struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1000,20 +1010,20 @@ lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
        if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
                lio_dev_err(lio_dev, "Require firmware version >= %s\n",
                            LIO_VF_TRUST_MIN_VERSION);
-               return;
+               return -EAGAIN;
        }
 
        if (!lio_dev->intf_open) {
                lio_dev_err(lio_dev, "Port %d down, can't enable promiscuous\n",
                            lio_dev->port_id);
-               return;
+               return -EAGAIN;
        }
 
        lio_dev->ifflags |= LIO_IFFLAG_PROMISC;
-       lio_change_dev_flag(eth_dev);
+       return lio_change_dev_flag(eth_dev);
 }
 
-static void
+static int
 lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
        struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1021,17 +1031,17 @@ lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
        if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
                lio_dev_err(lio_dev, "Require firmware version >= %s\n",
                            LIO_VF_TRUST_MIN_VERSION);
-               return;
+               return -EAGAIN;
        }
 
        if (!lio_dev->intf_open) {
                lio_dev_err(lio_dev, "Port %d down, can't disable promiscuous\n",
                            lio_dev->port_id);
-               return;
+               return -EAGAIN;
        }
 
        lio_dev->ifflags &= ~LIO_IFFLAG_PROMISC;
-       lio_change_dev_flag(eth_dev);
+       return lio_change_dev_flag(eth_dev);
 }
 
 static void