[v2,09/20] net/bnxt: fix an issue in setting default MAC address
diff mbox series

Message ID 20191002232601.22715-10-ajit.khaparde@broadcom.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
  • bnxt patchset to improve rte flow support
Related show


Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Ajit Khaparde Oct. 2, 2019, 11:25 p.m. UTC
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Driver was incorrectly programming the MAC with the already
configured one instead of the newly requested MAC by user.

Also, fix to restore the old mac address back to the default
vnic filter if the mac update operation fails.

Fixes: 68f589f2c728e ("net/bnxt: fix setting primary MAC address")

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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff mbox series

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7cd3213558..2c9eaaa2ef 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1904,7 +1904,7 @@  bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev,
 		if (filter->mac_index != 0)
-		memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN);
+		memcpy(filter->l2_addr, addr, RTE_ETHER_ADDR_LEN);
 		memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN);
@@ -1913,8 +1913,11 @@  bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev,
 		rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter);
-		if (rc)
+		if (rc) {
+			memcpy(filter->l2_addr, bp->mac_addr,
+			       RTE_ETHER_ADDR_LEN);
 			return rc;
+		}
 		memcpy(bp->mac_addr, addr, RTE_ETHER_ADDR_LEN);
 		PMD_DRV_LOG(DEBUG, "Set MAC addr\n");