net/octeontx: add promiscuous mode ops
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Sun, 8 Oct 2017 12:44:20 +0000 (18:14 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 12 Oct 2017 00:36:58 +0000 (01:36 +0100)
Mark Promiscuous mode in features.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
doc/guides/nics/features/octeontx.ini
drivers/net/octeontx/octeontx_ethdev.c

index 56b1350..ed5de9a 100644 (file)
@@ -8,6 +8,7 @@ Speed capabilities   = Y
 Link status          = Y
 Lock-free Tx queue   = Y
 Jumbo frame          = Y
+Promiscuous mode     = Y
 CRC offload          = Y
 Linux VFIO           = Y
 ARMv8                = Y
index 2c39d55..e71a0cb 100644 (file)
@@ -160,6 +160,28 @@ octeontx_port_close(struct octeontx_nic *nic)
        octeontx_log_dbg("port closed %d", nic->port_id);
 }
 
+static void
+octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
+{
+       struct rte_eth_dev *dev;
+       int res;
+
+       res = 0;
+       PMD_INIT_FUNC_TRACE();
+       dev = nic->dev;
+
+       res = octeontx_bgx_port_promisc_set(nic->port_id, en);
+       if (res < 0)
+               octeontx_log_err("failed to set promiscuous mode %d",
+                               nic->port_id);
+
+       /* Set proper flag for the mode */
+       dev->data->promiscuous = (en != 0) ? 1 : 0;
+
+       octeontx_log_dbg("port %d : promiscuous mode %s",
+                       nic->port_id, en ? "set" : "unset");
+}
+
 static inline void
 devconf_set_default_sane_values(struct rte_event_dev_config *dev_conf,
                                struct rte_event_dev_info *info)
@@ -273,6 +295,24 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
        return 0;
 }
 
+static void
+octeontx_dev_promisc_enable(struct rte_eth_dev *dev)
+{
+       struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+
+       PMD_INIT_FUNC_TRACE();
+       octeontx_port_promisc_set(nic, 1);
+}
+
+static void
+octeontx_dev_promisc_disable(struct rte_eth_dev *dev)
+{
+       struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+
+       PMD_INIT_FUNC_TRACE();
+       octeontx_port_promisc_set(nic, 0);
+}
+
 static inline int
 octeontx_atomic_write_link_status(struct rte_eth_dev *dev,
                                  struct rte_eth_link *link)
@@ -401,6 +441,8 @@ octeontx_dev_info(struct rte_eth_dev *dev,
 static const struct eth_dev_ops octeontx_dev_ops = {
        .dev_configure           = octeontx_dev_configure,
        .dev_infos_get           = octeontx_dev_info,
+       .promiscuous_enable      = octeontx_dev_promisc_enable,
+       .promiscuous_disable     = octeontx_dev_promisc_disable,
        .link_update             = octeontx_dev_link_update,
 };