wifi: brcmfmac: fix allmulti fallback when mcast_list is rejected
PATCH 1/1 wifi: brcmfmac: fix allmulti fallback when mcast_list is rejected
_brcmf_set_multicast_list() uses cnt as both the multicast address count and the number of addresses left to copy into mcast_list. After a complete copy, cnt is zero. If the firmware then rejects the nonempty list, the error path checks this exhausted counter and fails to enable allmulti as a fallback. Multicast traffic for some joined groups can then be lost.
Keep the original count for the fallback decision. A rejected empty list still leaves allmulti unchanged.
On a Raspberry Pi CM4 (BCM4345/6 SDIO, firmware 7.45.265) running Ubuntu 7.0.0-1023-raspi, the driver reported -EBADE for a 33-address mcast_list update. The last joined group received 0/3 packets with the original module and 3/3 with the patched module, although the list update still failed. The first group received 3/3 in both runs, with IFF_ALLMULTI clear.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +4 -3
@@ -142,7 +142,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)struct brcmf_pub *drvr = ifp->drvr;struct net_device *ndev;struct netdev_hw_addr *ha; -u32 cmd_value, cnt; +u32 cmd_value, cnt, mc_count;__le32 cnt_le;char *buf, *bufp;u32 buflen;
@@ -156,7 +156,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work) cmd_value = (ndev->flags &IFF_ALLMULTI ) ? true : false;/* Send down the multicast list first. */ - cnt =netdev_mc_count (ndev); + mc_count =netdev_mc_count (ndev); + cnt = mc_count; buflen =sizeof (cnt) + (cnt *ETH_ALEN ); buf =kmalloc (buflen,GFP_KERNEL );if (!buf)
@@ -178,7 +179,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work) err =brcmf_fil_iovar_data_set (ifp,"mcast_list" , buf, buflen);if (err <0 ) {bphy_err (drvr,"Setting mcast_list failed, %d\n" , err); - cmd_value = cnt ? true : cmd_value; + cmd_value = mc_count ? true : cmd_value; }kfree (buf);
Signature · 1 line
2.50.1 (Apple Git-155)