diff mbox series

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

Message ID 20210204113121.29786-5-john.efstathiades@pebblebay.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series LAN7800 USB network interface driver NAPI support | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 3 maintainers not CCed: woojung.huh@microchip.com kuba@kernel.org linux-usb@vger.kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 13 this patch: 14
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 13 this patch: 14
netdev/header_inline success Link
netdev/stable success Stable not CCed

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;
 }