From: Jose Abreu Date: Sun, 6 Oct 2019 11:08:56 +0000 (+0200) Subject: net: stmmac: gmac4+: Not all Unicast addresses may be available X-Git-Tag: v5.4-rc4~6^2~85^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25683bab09a70542b9f8e3e28f79b3369e56701f;p=thirdparty%2Fkernel%2Flinux.git net: stmmac: gmac4+: Not all Unicast addresses may be available Some setups may not have all Unicast addresses filters available. Check the number of available filters before trying to setup it. Fixes: 477286b53f55 ("stmmac: add GMAC4 core support") Signed-off-by: Jose Abreu Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 2cb9c53f93b84..5a7b0aca1d31a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -448,7 +448,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, value |= GMAC_PACKET_FILTER_HPF; /* Handle multiple unicast addresses */ - if (netdev_uc_count(dev) > GMAC_MAX_PERFECT_ADDRESSES) { + if (netdev_uc_count(dev) > hw->unicast_filter_entries) { /* Switch to promiscuous mode if more than 128 addrs * are required */