diff mbox series

[net-next,4/9] lan78xx: disable MAC address filter before updating entry

Message ID 20210204113121.29786-5-john.efstathiades@pebblebay.com
State New
Headers show
Series [net-next,1/9] lan78xx: add NAPI interface support | expand

Commit Message

John Efstathiades Feb. 4, 2021, 11:31 a.m. UTC
Disable the station MAC address entry in the perfect address filter
table before updating the table entry with a new MAC address.

Signed-off-by: John Efstathiades <john.efstathiades@pebblebay.com>
---
 drivers/net/usb/lan78xx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

John Efstathiades Feb. 10, 2021, 3:33 p.m. UTC | #1
> -----Original Message-----

> From: Andrew Lunn <andrew@lunn.ch>

> Sent: 04 February 2021 13:46

> 

> On Thu, Feb 04, 2021 at 11:31:16AM +0000, John Efstathiades wrote:

> > Disable the station MAC address entry in the perfect address filter

> > table before updating the table entry with a new MAC address.

> 

> This seems like a real fix. Please base this on net, not net-next, and

> add a Fixes: tag.


Thanks, I'll do that.

> > -	/* Added to support MAC address changes */

> > -	lan78xx_write_reg(dev, MAF_LO(0), addr_lo);

> > -	lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);

> > +	/* The station MAC address in the perfect address filter table

> > +	 * must also be updated to ensure frames are received

> > +	 */

> > +	ret = lan78xx_write_reg(dev, MAF_HI(0), 0);

> > +	ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);

> > +	ret = lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);

> 

> Why bother with ret is you are going to 1) overwrite it, 2) ignore it!


This is a side-effect of my rebase on the latest net-next tree and linked to
patch 9/9 in this set, which you also commented on.

I need to change the way I rebased my work on the latest driver code so this
goes away.

John
diff mbox series

Patch

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 776d84d2b513..d2fcc3c5eff2 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2493,9 +2493,12 @@  static int lan78xx_set_mac_addr(struct net_device *netdev, void *p)
 	lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
 	lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
 
-	/* Added to support MAC address changes */
-	lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
-	lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
+	/* The station MAC address in the perfect address filter table
+	 * must also be updated to ensure frames are received
+	 */
+	ret = lan78xx_write_reg(dev, MAF_HI(0), 0);
+	ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
+	ret = lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
 
 	return 0;
 }