net/bnxt: add promiscuous mode
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Wed, 15 Jun 2016 21:23:31 +0000 (14:23 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Mon, 20 Jun 2016 15:21:53 +0000 (17:21 +0200)
This patch adds the promiscuous mode enable and disable dev_ops.
Uses the bnxt_hwrm_cfa_l2_set_rx_mask() API added in an earlier commit.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index ac82876..3fce540 100644 (file)
@@ -437,6 +437,34 @@ out:
        return rc;
 }
 
+static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
+{
+       struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+       struct bnxt_vnic_info *vnic;
+
+       if (bp->vnic_info == NULL)
+               return;
+
+       vnic = &bp->vnic_info[0];
+
+       vnic->flags |= BNXT_VNIC_INFO_PROMISC;
+       bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+}
+
+static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
+{
+       struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+       struct bnxt_vnic_info *vnic;
+
+       if (bp->vnic_info == NULL)
+               return;
+
+       vnic = &bp->vnic_info[0];
+
+       vnic->flags &= ~BNXT_VNIC_INFO_PROMISC;
+       bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+}
+
 /*
  * Initialization
  */
@@ -454,6 +482,8 @@ static struct eth_dev_ops bnxt_dev_ops = {
        .tx_queue_setup = bnxt_tx_queue_setup_op,
        .tx_queue_release = bnxt_tx_queue_release_op,
        .link_update = bnxt_link_update_op,
+       .promiscuous_enable = bnxt_promiscuous_enable_op,
+       .promiscuous_disable = bnxt_promiscuous_disable_op,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)