Commit f0dd488e authored by David Lin's avatar David Lin Committed by Kalle Valo

wifi: mwifiex: configure BSSID consistently when starting AP

AP BSSID configuration is missing at AP start.  Without this fix, FW returns
STA interface MAC address after first init.  When hostapd restarts, it gets MAC
address from netdev before driver sets STA MAC to netdev again. Now MAC address
between hostapd and net interface are different causes STA cannot connect to
AP.  After that MAC address of uap0 mlan0 become the same. And issue disappears
after following hostapd restart (another issue is AP/STA MAC address become the
same).

This patch fixes the issue cleanly.
Signed-off-by: default avatarDavid Lin <yu-hao.lin@nxp.com>
Fixes: 12190c5d ("mwifiex: add cfg80211 start_ap and stop_ap handlers")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
Tested-by: Rafael Beims <rafael.beims@toradex.com> # Verdin iMX8MP/SD8997 SD
Acked-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231215005118.17031-1-yu-hao.lin@nxp.com
parent 1c5d463c
...@@ -2047,6 +2047,8 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, ...@@ -2047,6 +2047,8 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
mwifiex_set_sys_config_invalid_data(bss_cfg); mwifiex_set_sys_config_invalid_data(bss_cfg);
memcpy(bss_cfg->mac_addr, priv->curr_addr, ETH_ALEN);
if (params->beacon_interval) if (params->beacon_interval)
bss_cfg->beacon_period = params->beacon_interval; bss_cfg->beacon_period = params->beacon_interval;
if (params->dtim_period) if (params->dtim_period)
......
...@@ -165,6 +165,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { ...@@ -165,6 +165,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
#define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32) #define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32)
#define TLV_TYPE_BSSID (PROPRIETARY_TLV_BASE_ID + 35) #define TLV_TYPE_BSSID (PROPRIETARY_TLV_BASE_ID + 35)
#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) #define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42)
#define TLV_TYPE_UAP_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 43)
#define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44) #define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44)
#define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45)
#define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48) #define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48)
......
...@@ -107,6 +107,7 @@ struct mwifiex_uap_bss_param { ...@@ -107,6 +107,7 @@ struct mwifiex_uap_bss_param {
u8 qos_info; u8 qos_info;
u8 power_constraint; u8 power_constraint;
struct mwifiex_types_wmm_info wmm_info; struct mwifiex_types_wmm_info wmm_info;
u8 mac_addr[ETH_ALEN];
}; };
enum { enum {
......
...@@ -468,6 +468,7 @@ void mwifiex_config_uap_11d(struct mwifiex_private *priv, ...@@ -468,6 +468,7 @@ void mwifiex_config_uap_11d(struct mwifiex_private *priv,
static int static int
mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size)
{ {
struct host_cmd_tlv_mac_addr *mac_tlv;
struct host_cmd_tlv_dtim_period *dtim_period; struct host_cmd_tlv_dtim_period *dtim_period;
struct host_cmd_tlv_beacon_period *beacon_period; struct host_cmd_tlv_beacon_period *beacon_period;
struct host_cmd_tlv_ssid *ssid; struct host_cmd_tlv_ssid *ssid;
...@@ -487,6 +488,13 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) ...@@ -487,6 +488,13 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size)
int i; int i;
u16 cmd_size = *param_size; u16 cmd_size = *param_size;
mac_tlv = (struct host_cmd_tlv_mac_addr *)tlv;
mac_tlv->header.type = cpu_to_le16(TLV_TYPE_UAP_MAC_ADDRESS);
mac_tlv->header.len = cpu_to_le16(ETH_ALEN);
memcpy(mac_tlv->mac_addr, bss_cfg->mac_addr, ETH_ALEN);
cmd_size += sizeof(struct host_cmd_tlv_mac_addr);
tlv += sizeof(struct host_cmd_tlv_mac_addr);
if (bss_cfg->ssid.ssid_len) { if (bss_cfg->ssid.ssid_len) {
ssid = (struct host_cmd_tlv_ssid *)tlv; ssid = (struct host_cmd_tlv_ssid *)tlv;
ssid->header.type = cpu_to_le16(TLV_TYPE_UAP_SSID); ssid->header.type = cpu_to_le16(TLV_TYPE_UAP_SSID);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment