ethdev: change promiscuous callbacks to return status
[dpdk.git] / drivers / net / virtio / virtio_ethdev.c
index 8fe9dce..1ba4aa3 100644 (file)
@@ -41,8 +41,8 @@ static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
 static int  virtio_dev_configure(struct rte_eth_dev *dev);
 static int  virtio_dev_start(struct rte_eth_dev *dev);
 static void virtio_dev_stop(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int virtio_dev_info_get(struct rte_eth_dev *dev,
@@ -746,7 +746,7 @@ virtio_dev_close(struct rte_eth_dev *dev)
        }
 }
 
-static void
+static int
 virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
        struct virtio_hw *hw = dev->data->dev_private;
@@ -756,7 +756,7 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
        if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
                PMD_INIT_LOG(INFO, "host does not support rx control");
-               return;
+               return -ENOTSUP;
        }
 
        ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -765,11 +765,15 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
        dlen[0] = 1;
 
        ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-       if (ret)
+       if (ret) {
                PMD_INIT_LOG(ERR, "Failed to enable promisc");
+               return -EAGAIN;
+       }
+
+       return 0;
 }
 
-static void
+static int
 virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
        struct virtio_hw *hw = dev->data->dev_private;
@@ -779,7 +783,7 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
        if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
                PMD_INIT_LOG(INFO, "host does not support rx control");
-               return;
+               return -ENOTSUP;
        }
 
        ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -788,8 +792,12 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
        dlen[0] = 1;
 
        ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-       if (ret)
+       if (ret) {
                PMD_INIT_LOG(ERR, "Failed to disable promisc");
+               return -EAGAIN;
+       }
+
+       return 0;
 }
 
 static void