All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	aelior@marvell.com, skalluru@marvell.com,
	GR-everest-linux-l2@marvell.com
Subject: [PATCH net-next 06/12] ethernet: bnx2x: use eth_hw_addr_set()
Date: Fri, 15 Oct 2021 15:16:46 -0700	[thread overview]
Message-ID: <20211015221652.827253-7-kuba@kernel.org> (raw)
In-Reply-To: <20211015221652.827253-1-kuba@kernel.org>

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Read the address into an array on the stack, then call
eth_hw_addr_set().

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: aelior@marvell.com
CC: skalluru@marvell.com
CC: GR-everest-linux-l2@marvell.com
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 27e712178f95..aec666e97683 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -11823,9 +11823,10 @@ static void bnx2x_get_mac_hwinfo(struct bnx2x *bp)
 	u32 val, val2;
 	int func = BP_ABS_FUNC(bp);
 	int port = BP_PORT(bp);
+	u8 addr[ETH_ALEN] = {};
 
 	/* Zero primary MAC configuration */
-	eth_zero_addr(bp->dev->dev_addr);
+	eth_hw_addr_set(bp->dev, addr);
 
 	if (BP_NOMCP(bp)) {
 		BNX2X_ERROR("warning: random MAC workaround active\n");
@@ -11834,8 +11835,10 @@ static void bnx2x_get_mac_hwinfo(struct bnx2x *bp)
 		val2 = MF_CFG_RD(bp, func_mf_config[func].mac_upper);
 		val = MF_CFG_RD(bp, func_mf_config[func].mac_lower);
 		if ((val2 != FUNC_MF_CFG_UPPERMAC_DEFAULT) &&
-		    (val != FUNC_MF_CFG_LOWERMAC_DEFAULT))
-			bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2);
+		    (val != FUNC_MF_CFG_LOWERMAC_DEFAULT)) {
+			bnx2x_set_mac_buf(addr, val, val2);
+			eth_hw_addr_set(bp->dev, addr);
+		}
 
 		if (CNIC_SUPPORT(bp))
 			bnx2x_get_cnic_mac_hwinfo(bp);
@@ -11843,7 +11846,8 @@ static void bnx2x_get_mac_hwinfo(struct bnx2x *bp)
 		/* in SF read MACs from port configuration */
 		val2 = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_upper);
 		val = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_lower);
-		bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2);
+		bnx2x_set_mac_buf(addr, val, val2);
+		eth_hw_addr_set(bp->dev, addr);
 
 		if (CNIC_SUPPORT(bp))
 			bnx2x_get_cnic_mac_hwinfo(bp);
@@ -12291,7 +12295,9 @@ static int bnx2x_init_bp(struct bnx2x *bp)
 		if (rc)
 			return rc;
 	} else {
-		eth_zero_addr(bp->dev->dev_addr);
+		static const u8 zero_addr[ETH_ALEN] = {};
+
+		eth_hw_addr_set(bp->dev, zero_addr);
 	}
 
 	bnx2x_set_modes_bitmap(bp);
-- 
2.31.1


  parent reply	other threads:[~2021-10-15 22:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 22:16 [PATCH net-next 00/12] ethernet: manual netdev->dev_addr conversions (part 1) Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 01/12] ethernet: adaptec: use eth_hw_addr_set() Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 02/12] ethernet: aeroflex: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 03/12] ethernet: alteon: " Jakub Kicinski
2021-10-19  7:49   ` jes
2021-10-15 22:16 ` [PATCH net-next 04/12] ethernet: amd: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 05/12] ethernet: aquantia: " Jakub Kicinski
2021-10-15 22:16 ` Jakub Kicinski [this message]
2021-10-15 22:16 ` [PATCH net-next 07/12] ethernet: bcmgenet: " Jakub Kicinski
2021-10-19 22:02   ` Florian Fainelli
2021-10-15 22:16 ` [PATCH net-next 08/12] ethernet: enic: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 09/12] ethernet: ec_bhf: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 10/12] ethernet: enetc: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 11/12] ethernet: ibmveth: use ether_addr_to_u64() Jakub Kicinski
2021-10-15 22:16   ` Jakub Kicinski
2021-10-15 22:28   ` Tyrel Datwyler
2021-10-15 22:28     ` Tyrel Datwyler
2021-10-15 22:16 ` [PATCH net-next 12/12] ethernet: ixgb: use eth_hw_addr_set() Jakub Kicinski
2021-10-16  8:00 ` [PATCH net-next 00/12] ethernet: manual netdev->dev_addr conversions (part 1) patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211015221652.827253-7-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=GR-everest-linux-l2@marvell.com \
    --cc=aelior@marvell.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=skalluru@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.