net/hns3: support flow director
[dpdk.git] / drivers / net / af_packet / rte_eth_af_packet.c
index 6df09f2..dce76b0 100644 (file)
@@ -299,7 +299,7 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
        return 0;
 }
 
-static void
+static int
 eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct pmd_internals *internals = dev->data->dev_private;
@@ -310,6 +310,8 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->max_rx_queues = (uint16_t)internals->nb_queues;
        dev_info->max_tx_queues = (uint16_t)internals->nb_queues;
        dev_info->min_rx_bufsize = 0;
+
+       return 0;
 }
 
 static int
@@ -347,7 +349,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
        return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
        unsigned i;
@@ -363,6 +365,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
                internal->tx_queue[i].err_pkts = 0;
                internal->tx_queue[i].tx_bytes = 0;
        }
+
+       return 0;
 }
 
 static void
@@ -456,41 +460,47 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
        return 0;
 }
 
-static void
+static int
 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
 {
        struct ifreq ifr;
+       int ret = 0;
        int s;
 
        s = socket(PF_INET, SOCK_DGRAM, 0);
        if (s < 0)
-               return;
+               return -errno;
 
        strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
-       if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
+       if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+               ret = -errno;
                goto out;
+       }
        ifr.ifr_flags &= mask;
        ifr.ifr_flags |= flags;
-       if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
+       if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
+               ret = -errno;
                goto out;
+       }
 out:
        close(s);
+       return ret;
 }
 
-static void
+static int
 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
        struct pmd_internals *internals = dev->data->dev_private;
 
-       eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
+       return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
 }
 
-static void
+static int
 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
        struct pmd_internals *internals = dev->data->dev_private;
 
-       eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
+       return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
 }
 
 static const struct eth_dev_ops ops = {