net/mrvl: support for promiscuous and allmulticast
authorTomasz Duszynski <tdu@semihalf.com>
Mon, 9 Oct 2017 15:00:36 +0000 (17:00 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 12 Oct 2017 00:36:58 +0000 (01:36 +0100)
Add support for promiscuous and allmulticast modes.

Signed-off-by: Jacek Siuda <jck@semihalf.com>
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
doc/guides/nics/features/mrvl.ini
drivers/net/mrvl/mrvl_ethdev.c

index 2ddabfb..c2df525 100644 (file)
@@ -8,3 +8,5 @@ Speed capabilities   = Y
 Link status          = Y
 MTU update           = Y
 Jumbo frame          = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
index 3a5f6a0..519aa19 100644 (file)
@@ -588,6 +588,74 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
        return 0;
 }
 
+/**
+ * DPDK callback to enable promiscuous mode.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ */
+static void
+mrvl_promiscuous_enable(struct rte_eth_dev *dev)
+{
+       struct mrvl_priv *priv = dev->data->dev_private;
+       int ret;
+
+       ret = pp2_ppio_set_uc_promisc(priv->ppio, 1);
+       if (ret)
+               RTE_LOG(ERR, PMD, "Failed to enable promiscuous mode\n");
+}
+
+/**
+ * DPDK callback to enable allmulti mode.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ */
+static void
+mrvl_allmulticast_enable(struct rte_eth_dev *dev)
+{
+       struct mrvl_priv *priv = dev->data->dev_private;
+       int ret;
+
+       ret = pp2_ppio_set_mc_promisc(priv->ppio, 1);
+       if (ret)
+               RTE_LOG(ERR, PMD, "Failed enable all-multicast mode\n");
+}
+
+/**
+ * DPDK callback to disable promiscuous mode.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ */
+static void
+mrvl_promiscuous_disable(struct rte_eth_dev *dev)
+{
+       struct mrvl_priv *priv = dev->data->dev_private;
+       int ret;
+
+       ret = pp2_ppio_set_uc_promisc(priv->ppio, 0);
+       if (ret)
+               RTE_LOG(ERR, PMD, "Failed to disable promiscuous mode\n");
+}
+
+/**
+ * DPDK callback to disable allmulticast mode.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ */
+static void
+mrvl_allmulticast_disable(struct rte_eth_dev *dev)
+{
+       struct mrvl_priv *priv = dev->data->dev_private;
+       int ret;
+
+       ret = pp2_ppio_set_mc_promisc(priv->ppio, 0);
+       if (ret)
+               RTE_LOG(ERR, PMD, "Failed to disable all-multicast mode\n");
+}
+
 /**
  * DPDK callback to set the primary MAC address.
  *
@@ -934,6 +1002,10 @@ static const struct eth_dev_ops mrvl_ops = {
        .dev_set_link_down = mrvl_dev_set_link_down,
        .dev_close = mrvl_dev_close,
        .link_update = mrvl_link_update,
+       .promiscuous_enable = mrvl_promiscuous_enable,
+       .allmulticast_enable = mrvl_allmulticast_enable,
+       .promiscuous_disable = mrvl_promiscuous_disable,
+       .allmulticast_disable = mrvl_allmulticast_disable,
        .mac_addr_set = mrvl_mac_addr_set,
        .mtu_set = mrvl_mtu_set,
        .dev_infos_get = mrvl_dev_infos_get,