]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: wilc1000: Set MAC after operation mode
authorMarek Vasut <marex@denx.de>
Thu, 3 Oct 2024 13:24:17 +0000 (15:24 +0200)
committerKalle Valo <kvalo@kernel.org>
Thu, 17 Oct 2024 16:48:55 +0000 (19:48 +0300)
It seems it is necessary to set WILC MAC address after operation mode,
otherwise the MAC address of the WILC MAC is reset back to what is in
nvmem. This causes a failure to associate with AP after the WILC MAC
address was overridden by userspace.

Test case:
"
ap$ cat << EOF > hostap.conf
interface=wlan0
ssid=ssid
hw_mode=g
channel=6
wpa=2
wpa_passphrase=pass
wpa_key_mgmt=WPA-PSK
EOF
ap$ hostapd -d hostap.conf
ap$ ifconfig wlan0 10.0.0.1
"

"
sta$ ifconfig wlan0 hw ether 00:11:22:33:44:55
sta$ wpa_supplicant -i wlan0 -c <(wpa_passphrase ssid pass)
sta$ ifconfig wlan0 10.0.0.2
sta$ ping 10.0.0.1 # fails without this patch
"

AP still indicates SA with original MAC address from nvmem without this patch:
"
nl80211: RX frame da=ff:ff:ff:ff:ff:ff sa=60:01:23:45:67:89 bssid=ff:ff:ff:ff:ff:ff ...
                                          ^^^^^^^^^^^^^^^^^
"

Fixes: 83d9b54ee5d4 ("wifi: wilc1000: read MAC address from fuse at probe")
Tested-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241003132504.52233-1-marex@denx.de
drivers/net/wireless/microchip/wilc1000/netdev.c

index 3bb13aa33413a37920ef9260bd52fcd16ed38869..7e84fc0fd91188b411863b9de647b6d182c6c187 100644 (file)
@@ -618,6 +618,9 @@ static int wilc_mac_open(struct net_device *ndev)
                return ret;
        }
 
+       wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), vif->iftype,
+                               vif->idx);
+
        netdev_dbg(ndev, "Mac address: %pM\n", ndev->dev_addr);
        ret = wilc_set_mac_address(vif, ndev->dev_addr);
        if (ret) {
@@ -628,9 +631,6 @@ static int wilc_mac_open(struct net_device *ndev)
                return ret;
        }
 
-       wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), vif->iftype,
-                               vif->idx);
-
        mgmt_regs.interface_stypes = vif->mgmt_reg_stypes;
        /* so we detect a change */
        vif->mgmt_reg_stypes = 0;