net: stmmac: dwmac1000: Clear unused address entries [Linux 4.9.187]

This Linux kernel change "net: stmmac: dwmac1000: Clear unused address entries" is included in the Linux 4.9.187 release. This change is authored by Jose Abreu <Jose.Abreu [at] synopsys.com> on Fri May 24 10:20:21 2019 +0200. The commit for this change in Linux stable tree is c66c5da (patch) which is from upstream commit 9463c44. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 9463c44.

net: stmmac: dwmac1000: Clear unused address entries

[ Upstream commit 9463c445590091202659cdfdd44b236acadfbd84 ]

In case we don't use a given address entry we need to clear it because
it could contain previous values that are no longer valid.

Found out while running stmmac selftests.

Signed-off-by: Jose Abreu <[email protected]>
Cc: Joao Pinto <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 7d19029..093e58e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -213,6 +213,12 @@ static void dwmac1000_set_filter(struct mac_device_info *hw,
                        GMAC_ADDR_LOW(reg));
            reg++;
        }
+
+       while (reg <= perfect_addr_number) {
+           writel(0, ioaddr + GMAC_ADDR_HIGH(reg));
+           writel(0, ioaddr + GMAC_ADDR_LOW(reg));
+           reg++;
+       }
    }

 #ifdef FRAME_FILTER_DEBUG

Leave a Reply

Your email address will not be published. Required fields are marked *