In AP mode the firmware builds the beacon and the probe response, RSN IE included. hostapd builds its own RSN IE for message 3 of the 4-way handshake. With WMM enabled hostapd announces 16 PTKSA replay counters in the RSN capabilities (0x000c), the AR6006 firmware puts 0x0000 into its beacon, and a station drops the connection because the two IEs differ: WPA: IE in 3/4 msg does not match with IE in Beacon/ProbeResp ath6kl already passes the capability field of the beacon's RSN IE to firmware that has the RSN_CAP_OVERRIDE capability. The AR6006 firmware 5.x does not announce it. Qualcomm's ath6kl-3.5 driver sets the field with WMI_SET_RSN_CAP_CMDID on this firmware, which is 0xf082 in its WMI layout and 0xf085 in mainline. Send the field with that command when an AP starts on the vendor WMI layout, and set it back to 0 when the AP stops or fails to start. ath6kl-3.5 reads the old value first and restores that one. The firmware's own value is 0, as its beacon shows before the command, so the read is left out. The resend on a channel change that the RSN_CAP_OVERRIDE path has is left out as well. It only runs with a second interface, and this firmware has one. The station path is not touched. ath6kl-3.5 sets the field there too, where it carries the management frame protection bits, and ath6kl does not support that. Signed-off-by: Josef Schlehofer --- This goes on top of the AR6006 series: https://lore.kernel.org/linux-wireless/20261130095042.41330-1-pepe.schlehofer@gmail.com/ Tested on a Xiaomi AIoT AC2350 (QCA9563, big endian) with OpenWrt 25.12 and backports 6.18.55. The test tree also had "wifi: ath6kl: set the permanent MAC address of the wiphy" [1] and a backport of 97aab70a03df ("wifi: ath6kl: don't take RTNL in del_virtual_intf"). With WMM enabled the beacon now carries 0x000c and a WPA2 station completes the 4-way handshake. That also holds after hostapd reloads the BSS for a new SSID, after it restarts the AP on another channel, and with the AP in a bridge. In these tests OpenWrt's scripts started the AP. On ath6kl that needs a hostapd patch, "nl80211: Do not set a MAC address the interface already has", which is on the hostap list [2]. The reset also ran on a build with a test switch that makes the AP start fail, once with a failing profile commit and once with an AP that the firmware never reported as started. The reset went out in both. One thing I cannot explain. With this patch as posted I connected the radio as a station once after an AP had been stopped. The first 4-way handshake did not complete, the firmware associated again by itself and the second one completed. In 27 other station connections of this radio the first handshake completed, 12 of them after an AP, with and without this patch. Those 12 ran on builds with extra log lines, which put about 5 ms between the RSN command and the command after it. I do not know whether that matters. [1] https://lore.kernel.org/linux-wireless/20261130121620.27137-1-pepe.schlehofer@gmail.com/ [2] https://lists.infradead.org/pipermail/hostap/2026-December/046151.html drivers/net/wireless/ath/ath6kl/cfg80211.c | 61 ++++++++++++++++++---- drivers/net/wireless/ath/ath6kl/wmi.c | 27 ++++++++++ drivers/net/wireless/ath/ath6kl/wmi.h | 5 ++ 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 97107510b..13d2aacf1 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -2776,6 +2776,29 @@ static int ath6kl_get_rsn_capab(struct cfg80211_beacon_data *beacon, return 0; } +/* like the vendor driver, do not leave the RSN capabilities set */ +static void ath6kl_ap_reset_rsn_capab(struct ath6kl_vif *vif) +{ + struct ath6kl *ar = vif->ar; + u16 rsn_capab = 0; + int res; + + /* only what the vendor command in ath6kl_start_ap() has set */ + if (!(ar->hw.flags & ATH6KL_HW_VENDOR_WMI) || !vif->rsn_capab || + test_bit(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, + ar->fw_capabilities)) + return; + + res = ath6kl_wmi_set_rsn_cap_cmd(ar->wmi, vif->fw_vif_idx, + (const u8 *)&rsn_capab); + if (res < 0) { + ath6kl_warn("failed to reset the RSN capabilities: %d\n", res); + return; + } + + vif->rsn_capab = 0; +} + static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *info) { @@ -2951,22 +2974,34 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev, * advertise the same in beacon/probe response. Send * the complete RSN IE capability field to firmware */ - if (!ath6kl_get_rsn_capab(&info->beacon, (u8 *) &rsn_capab) && - test_bit(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, - ar->fw_capabilities)) { - res = ath6kl_wmi_set_ie_cmd(ar->wmi, vif->fw_vif_idx, - WLAN_EID_RSN, WMI_RSN_IE_CAPB, - (const u8 *) &rsn_capab, - sizeof(rsn_capab)); - vif->rsn_capab = rsn_capab; - if (res < 0) - return res; + if (!ath6kl_get_rsn_capab(&info->beacon, (u8 *)&rsn_capab)) { + if (test_bit(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, + ar->fw_capabilities)) { + res = ath6kl_wmi_set_ie_cmd(ar->wmi, vif->fw_vif_idx, + WLAN_EID_RSN, + WMI_RSN_IE_CAPB, + (const u8 *)&rsn_capab, + sizeof(rsn_capab)); + vif->rsn_capab = rsn_capab; + if (res < 0) + return res; + } else if (ar->hw.flags & ATH6KL_HW_VENDOR_WMI) { + /* the vendor WMI layout has a command for this */ + res = ath6kl_wmi_set_rsn_cap_cmd(ar->wmi, + vif->fw_vif_idx, + (const u8 *)&rsn_capab); + if (res < 0) + return res; + vif->rsn_capab = rsn_capab; + } } memcpy(&vif->profile, &p, sizeof(p)); res = ath6kl_wmi_ap_profile_commit(ar->wmi, vif->fw_vif_idx, &p); - if (res < 0) + if (res < 0) { + ath6kl_ap_reset_rsn_capab(vif); return res; + } return 0; } @@ -2993,6 +3028,10 @@ static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev, if (vif->nw_type != AP_NETWORK) return -EOPNOTSUPP; + + /* also for an AP that the firmware never reported as started */ + ath6kl_ap_reset_rsn_capab(vif); + if (!test_bit(CONNECTED, &vif->flags)) return -ENOTCONN; diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 238dbfcf3..6582c6536 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c @@ -3679,6 +3679,33 @@ int ath6kl_wmi_set_ie_cmd(struct wmi *wmi, u8 if_idx, u8 ie_id, u8 ie_field, NO_SYNC_WMIFLAG); } +/* WMI_SET_RSN_CAP_CMDID of the vendor WMI layout, mainline has it at 0xf085 */ +#define WMI_VENDOR_SET_RSN_CAP_CMDID 0xf082 + +/* rsn_capab is the capability field as it stands in the RSN IE */ +int ath6kl_wmi_set_rsn_cap_cmd(struct wmi *wmi, u8 if_idx, const u8 *rsn_capab) +{ + struct wmi_rsn_cap_cmd *cmd; + struct sk_buff *skb; + + if (!ath6kl_wmi_vendor_abi(wmi)) + return -EOPNOTSUPP; + + skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); + if (!skb) + return -ENOMEM; + + cmd = (struct wmi_rsn_cap_cmd *)skb->data; + memcpy(&cmd->rsn_cap, rsn_capab, sizeof(cmd->rsn_cap)); + + ath6kl_dbg(ATH6KL_DBG_WMI, "set_rsn_cap: 0x%04x\n", + le16_to_cpu(cmd->rsn_cap)); + + return ath6kl_wmi_cmd_send(wmi, if_idx, skb, + (enum wmi_cmd_id)WMI_VENDOR_SET_RSN_CAP_CMDID, + NO_SYNC_WMIFLAG); +} + int ath6kl_wmi_disable_11b_rates_cmd(struct wmi *wmi, bool disable) { struct sk_buff *skb; diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h index f1da394dd..ea20c3ee3 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.h +++ b/drivers/net/wireless/ath/ath6kl/wmi.h @@ -1677,6 +1677,10 @@ struct set_dtim_cmd { __le32 dtim_period; } __packed; +struct wmi_rsn_cap_cmd { + __le16 rsn_cap; +} __packed; + /* AR6006 firmware 5.x uses 16 and 8 bits for these */ struct set_beacon_int_cmd_vendor { __le16 beacon_intvl; @@ -2732,6 +2736,7 @@ int ath6kl_wmi_set_rx_frame_format_cmd(struct wmi *wmi, u8 if_idx, int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type, const u8 *ie, u8 ie_len); +int ath6kl_wmi_set_rsn_cap_cmd(struct wmi *wmi, u8 if_idx, const u8 *rsn_capab); int ath6kl_wmi_set_ie_cmd(struct wmi *wmi, u8 if_idx, u8 ie_id, u8 ie_field, const u8 *ie_info, u8 ie_len); -- 2.54.0 (Apple Git-157)