From: Kishore Padmanabha <[email protected]>

The truflow application support promiscuous mode to enable
or disable receiving the packets with unknown destination mac addresses.

Signed-off-by: Kishore Padmanabha <[email protected]>
Reviewed-by: Shuanglin Wang <[email protected]>
---
 drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7a2dd08951..3c618c6e82 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2161,9 +2161,15 @@ static int bnxt_promiscuous_enable_op(struct rte_eth_dev 
*eth_dev)
        old_flags = vnic->flags;
        vnic->flags |= BNXT_VNIC_INFO_PROMISC;
        rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
-       if (rc != 0)
+       if (rc != 0) {
                vnic->flags = old_flags;
-
+               return rc;
+       }
+       rc = bnxt_ulp_promisc_mode_set(bp, 1);
+       if (rc != 0) {
+               vnic->flags = old_flags;
+               rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+       }
        return rc;
 }
 
@@ -2185,6 +2191,11 @@ static int bnxt_promiscuous_disable_op(struct 
rte_eth_dev *eth_dev)
        if (bp->vnic_info == NULL)
                return 0;
 
+       if (bnxt_ulp_promisc_mode_set(bp, 0)) {
+               PMD_DRV_LOG_LINE(ERR, "Unable to disable promiscuous mode");
+               return -EINVAL;
+       }
+
        vnic = bnxt_get_default_vnic(bp);
 
        old_flags = vnic->flags;
-- 
2.39.5 (Apple Git-154)

Reply via email to