net/bnxt: fix to handle default mac address setting when port is stopped

Message ID 20200227081851.2938-1-kalesh-anakkur.purayil@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series net/bnxt: fix to handle default mac address setting when port is stopped |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Kalesh A P Feb. 27, 2020, 8:18 a.m. UTC
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

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 Kumar Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Ajit Khaparde March 3, 2020, 4:01 a.m. UTC | #1
On Thu, Feb 27, 2020 at 12:02 AM Kalesh A P <
kalesh-anakkur.purayil@broadcom.com> wrote:

> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> 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 Kumar Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
>

Patch applied to dpdk-next-net-brcm

> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c
> b/drivers/net/bnxt/bnxt_ethdev.c
> index 18aa313..3c50c2e 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -1103,6 +1103,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;
> @@ -2094,6 +2098,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;
> --
> 2.10.1
>
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 18aa313..3c50c2e 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1103,6 +1103,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;
@@ -2094,6 +2098,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;