summaryrefslogtreecommitdiff
path: root/drivers/net/mvneta/mvneta_ethdev.c
diff options
context:
space:
mode:
authorZyta Szpak <zr@semihalf.com>2018-10-03 09:22:13 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-11 18:53:48 +0200
commitcf9ccda917bffc197ea4b3b5b4a848c0e947cd9b (patch)
treebc02a93d66cc9ae1633b87cbba253baa0a7b2f67 /drivers/net/mvneta/mvneta_ethdev.c
parent88d3cb3c038ce310da4b2277150e372a6db05698 (diff)
downloaddpdk-cf9ccda917bffc197ea4b3b5b4a848c0e947cd9b.zip
dpdk-cf9ccda917bffc197ea4b3b5b4a848c0e947cd9b.tar.gz
dpdk-cf9ccda917bffc197ea4b3b5b4a848c0e947cd9b.tar.xz
net/mvneta: support promiscuous mode
Add callbacks for enabling/disabling of promiscuous mode. Signed-off-by: Yelena Krivosheev <yelena@marvell.com> Signed-off-by: Zyta Szpak <zr@semihalf.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'drivers/net/mvneta/mvneta_ethdev.c')
-rw-r--r--drivers/net/mvneta/mvneta_ethdev.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 052e97f..a3dbe56 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -522,6 +522,58 @@ mvneta_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
}
/**
+ * DPDK callback to enable promiscuous mode.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ */
+static void
+mvneta_promiscuous_enable(struct rte_eth_dev *dev)
+{
+ struct mvneta_priv *priv = dev->data->dev_private;
+ int ret, en;
+
+ if (!priv->ppio)
+ return;
+
+ neta_ppio_get_promisc(priv->ppio, &en);
+ if (en) {
+ MVNETA_LOG(INFO, "Promiscuous already enabled");
+ return;
+ }
+
+ ret = neta_ppio_set_promisc(priv->ppio, 1);
+ if (ret)
+ MVNETA_LOG(ERR, "Failed to enable promiscuous mode");
+}
+
+/**
+ * DPDK callback to disable allmulticast mode.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ */
+static void
+mvneta_promiscuous_disable(struct rte_eth_dev *dev)
+{
+ struct mvneta_priv *priv = dev->data->dev_private;
+ int ret, en;
+
+ if (!priv->ppio)
+ return;
+
+ neta_ppio_get_promisc(priv->ppio, &en);
+ if (!en) {
+ MVNETA_LOG(INFO, "Promiscuous already disabled");
+ return;
+ }
+
+ ret = neta_ppio_set_promisc(priv->ppio, 0);
+ if (ret)
+ MVNETA_LOG(ERR, "Failed to disable promiscuous mode");
+}
+
+/**
* DPDK callback to set the primary MAC address.
*
* @param dev
@@ -555,6 +607,8 @@ static const struct eth_dev_ops mvneta_ops = {
.dev_set_link_down = mvneta_dev_set_link_down,
.dev_close = mvneta_dev_close,
.link_update = mvneta_link_update,
+ .promiscuous_enable = mvneta_promiscuous_enable,
+ .promiscuous_disable = mvneta_promiscuous_disable,
.mac_addr_set = mvneta_mac_addr_set,
.mtu_set = mvneta_mtu_set,
.dev_infos_get = mvneta_dev_infos_get,