net/bnxt: fix MAC address setting when port is stopped
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Thu, 27 Feb 2020 08:18:51 +0000 (13:48 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 18 Mar 2020 09:21:41 +0000 (10:21 +0100)
Driver destroys the VNIC when the port is brought down.
Port HW filter setting such as default MAC address and
unicast MAC filters will be applied when port is started.

Fixed to return success silently for these callbacks
when port is stopped.

Fixes: 39b88344e364 ("net/bnxt: fix enable/disable VLAN filtering")
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index b8b30ed..93d0062 100644 (file)
@@ -1108,6 +1108,10 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
                return -EINVAL;
        }
 
+       /* Filter settings will get applied when port is started */
+       if (!eth_dev->data->dev_started)
+               return 0;
+
        rc = bnxt_add_mac_filter(bp, vnic, mac_addr, index, pool);
 
        return rc;
@@ -2099,6 +2103,10 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev,
        if (rte_is_zero_ether_addr(addr))
                return -EINVAL;
 
+       /* Filter settings will get applied when port is started */
+       if (!dev->data->dev_started)
+               return 0;
+
        /* Check if the requested MAC is already added */
        if (memcmp(addr, bp->mac_addr, RTE_ETHER_ADDR_LEN) == 0)
                return 0;