From 480d1a29f522f8159c89f95aa5b459049503cd7b Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 2 Dec 2022 11:42:40 +0100 Subject: net: bcmgenet: Fix MAC address setting bcmgenet_set_hwaddr() only copies the MAC address only into internal state, but not into hardware. Copying to hardware is done in __bcmgenet_set_hwaddr() called during open time. Depending on nv.dev.eth0.ethaddr being set the order in which both functions are called changes. Copy the state into hardware as well in bcmgenet_set_hwaddr(). This fixes sending packets when nv.dev.eth0.ethaddr is not set. Signed-off-by: Sascha Hauer --- drivers/net/bcmgenet.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c index 79514dfa69..8df5fd5dea 100644 --- a/drivers/net/bcmgenet.c +++ b/drivers/net/bcmgenet.c @@ -215,15 +215,6 @@ static void bcmgenet_umac_reset(struct bcmgenet_eth_priv *priv) writel(1, (priv->mac_reg + RBUF_TBUF_SIZE_CTRL)); } -static int bcmgenet_set_hwaddr(struct eth_device *dev, const unsigned char *addr) -{ - struct bcmgenet_eth_priv *priv = dev->priv; - - memcpy(priv->addr, addr, 6); - - return 0; -} - static int __bcmgenet_set_hwaddr(struct bcmgenet_eth_priv *priv) { const unsigned char *addr = priv->addr; @@ -238,6 +229,17 @@ static int __bcmgenet_set_hwaddr(struct bcmgenet_eth_priv *priv) return 0; } +static int bcmgenet_set_hwaddr(struct eth_device *dev, const unsigned char *addr) +{ + struct bcmgenet_eth_priv *priv = dev->priv; + + memcpy(priv->addr, addr, 6); + + __bcmgenet_set_hwaddr(priv); + + return 0; +} + static int bcmgenet_get_hwaddr(struct eth_device *edev, unsigned char *mac) { return -1; -- cgit v1.2.3