net/cnxk: support promiscuous mode
authorSunil Kumar Kori <skori@marvell.com>
Wed, 23 Jun 2021 04:46:34 +0000 (10:16 +0530)
committerJerin Jacob <jerinj@marvell.com>
Tue, 29 Jun 2021 22:16:23 +0000 (00:16 +0200)
Add device operations to enable and disable promisc mode
for cn9k and cn10k.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
doc/guides/nics/cnxk.rst
doc/guides/nics/features/cnxk.ini
doc/guides/nics/features/cnxk_vec.ini
drivers/net/cnxk/cnxk_ethdev.c
drivers/net/cnxk/cnxk_ethdev.h
drivers/net/cnxk/cnxk_ethdev_ops.c

index 6377200..8a8402b 100644 (file)
@@ -17,6 +17,7 @@ Features
 Features of the CNXK Ethdev PMD are:
 
 - Packet type information
+- Promiscuous mode
 - Jumbo frames
 - SR-IOV VF
 - Lock-free Tx queue
index 6fef725..9b2e163 100644 (file)
@@ -17,6 +17,7 @@ Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 MTU update           = Y
 TSO                  = Y
+Promiscuous mode     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
index 79cb1e2..31471e0 100644 (file)
@@ -16,6 +16,7 @@ Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 MTU update           = Y
+Promiscuous mode     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
index 3f92780..e5590a0 100644 (file)
@@ -1107,6 +1107,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
        .rx_queue_start = cnxk_nix_rx_queue_start,
        .rx_queue_stop = cnxk_nix_rx_queue_stop,
        .dev_supported_ptypes_get = cnxk_nix_supported_ptypes_get,
+       .promiscuous_enable = cnxk_nix_promisc_enable,
+       .promiscuous_disable = cnxk_nix_promisc_disable,
 };
 
 static int
index c216dd5..2fce20e 100644 (file)
@@ -223,6 +223,8 @@ int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
 int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
                          struct rte_ether_addr *addr);
+int cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev);
+int cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
                      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
index 21b55c4..6feb3a9 100644 (file)
@@ -173,3 +173,59 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 exit:
        return rc;
 }
+
+int
+cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev)
+{
+       struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+       struct roc_nix *nix = &dev->nix;
+       int rc = 0;
+
+       if (roc_nix_is_vf_or_sdp(nix))
+               return rc;
+
+       rc = roc_nix_npc_promisc_ena_dis(nix, true);
+       if (rc) {
+               plt_err("Failed to setup promisc mode in npc, rc=%d(%s)", rc,
+                       roc_error_msg_get(rc));
+               return rc;
+       }
+
+       rc = roc_nix_mac_promisc_mode_enable(nix, true);
+       if (rc) {
+               plt_err("Failed to setup promisc mode in mac, rc=%d(%s)", rc,
+                       roc_error_msg_get(rc));
+               roc_nix_npc_promisc_ena_dis(nix, false);
+               return rc;
+       }
+
+       return 0;
+}
+
+int
+cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev)
+{
+       struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+       struct roc_nix *nix = &dev->nix;
+       int rc = 0;
+
+       if (roc_nix_is_vf_or_sdp(nix))
+               return rc;
+
+       rc = roc_nix_npc_promisc_ena_dis(nix, false);
+       if (rc < 0) {
+               plt_err("Failed to setup promisc mode in npc, rc=%d(%s)", rc,
+                       roc_error_msg_get(rc));
+               return rc;
+       }
+
+       rc = roc_nix_mac_promisc_mode_enable(nix, false);
+       if (rc) {
+               plt_err("Failed to setup promisc mode in mac, rc=%d(%s)", rc,
+                       roc_error_msg_get(rc));
+               roc_nix_npc_promisc_ena_dis(nix, true);
+               return rc;
+       }
+
+       return 0;
+}