net/avp: add device promiscuous functions
authorAllain Legacy <allain.legacy@windriver.com>
Tue, 28 Mar 2017 11:54:06 +0000 (07:54 -0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:19 +0000 (19:02 +0200)
Adds support for setting and clearing promiscuous mode on an AVP device.
When enabled the _mac_filter function will allow packets destined to any
MAC address to be processed by the receive functions.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
doc/guides/nics/features/avp.ini
drivers/net/avp/avp_ethdev.c

index 0de761c..ceb6993 100644 (file)
@@ -7,6 +7,7 @@
 Link status          = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
+Promiscuous mode     = Y
 Unicast MAC filter   = Y
 VLAN offload         = Y
 Basic stats          = Y
index e2119df..b37b31a 100644 (file)
@@ -66,6 +66,9 @@ static void avp_dev_info_get(struct rte_eth_dev *dev,
 static void avp_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static int avp_dev_link_update(struct rte_eth_dev *dev,
                               __rte_unused int wait_to_complete);
+static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static void avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
+
 static int avp_dev_rx_queue_setup(struct rte_eth_dev *dev,
                                  uint16_t rx_queue_id,
                                  uint16_t nb_rx_desc,
@@ -152,6 +155,8 @@ static const struct eth_dev_ops avp_eth_dev_ops = {
        .stats_get           = avp_dev_stats_get,
        .stats_reset         = avp_dev_stats_reset,
        .link_update         = avp_dev_link_update,
+       .promiscuous_enable  = avp_dev_promiscuous_enable,
+       .promiscuous_disable = avp_dev_promiscuous_disable,
        .rx_queue_setup      = avp_dev_rx_queue_setup,
        .rx_queue_release    = avp_dev_rx_queue_release,
        .tx_queue_setup      = avp_dev_tx_queue_setup,
@@ -1677,6 +1682,29 @@ avp_dev_link_update(struct rte_eth_dev *eth_dev,
        return -1;
 }
 
+static void
+avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+{
+       struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+       if ((avp->flags & AVP_F_PROMISC) == 0) {
+               avp->flags |= AVP_F_PROMISC;
+               PMD_DRV_LOG(DEBUG, "Promiscuous mode enabled on %u\n",
+                           eth_dev->data->port_id);
+       }
+}
+
+static void
+avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+{
+       struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+       if ((avp->flags & AVP_F_PROMISC) != 0) {
+               avp->flags &= ~AVP_F_PROMISC;
+               PMD_DRV_LOG(DEBUG, "Promiscuous mode disabled on %u\n",
+                           eth_dev->data->port_id);
+       }
+}
 
 static void
 avp_dev_info_get(struct rte_eth_dev *eth_dev,