mwifiex: set channel via start_ap handler for AP interface
PATCH RESEND 1/4 mwifiex: set channel via start_ap handler for AP interface
From: Avinash Patil <[email protected]>
This patch adds functionality to set channel info received from cfg80211_ap_settings in start_ap handler.
Since set_channel cfg80211 handler has been removed and we need not explicitely call mwifiex_uap_set_channel(); hence this function definition is also removed.
--- drivers/net/wireless/mwifiex/cfg80211.c | 23 +++++++++++++++++------ drivers/net/wireless/mwifiex/main.h | 1 - drivers/net/wireless/mwifiex/uap_cmd.c | 30 ------------------------------ 3 files changed, 17 insertions(+), 37 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +17 -6
@@ -384,13 +384,13 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, cfp.freq = chan->center_freq; cfp.channel =ieee80211_frequency_to_channel (chan->center_freq); -if (mwifiex_bss_set_channel (priv, &cfp)) -return -EFAULT ; - -if (priv->bss_type ==MWIFIEX_BSS_TYPE_STA ) +if (priv->bss_type ==MWIFIEX_BSS_TYPE_STA ) { +if (mwifiex_bss_set_channel (priv, &cfp)) +return -EFAULT ;return mwifiex_drv_change_adhoc_chan (priv, cfp.channel); -else -return mwifiex_uap_set_channel (priv, cfp.channel); + } + +return 0 ; }/*
@@ -961,6 +961,17 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,return -EINVAL ; } + bss_cfg->channel = + (u8 )ieee80211_frequency_to_channel (params->channel->center_freq); + bss_cfg->band_cfg =BAND_CONFIG_MANUAL ; + +if (mwifiex_set_rf_channel (priv, params->channel, + params->channel_type)) { +kfree (bss_cfg); +wiphy_err (wiphy,"Failed to set band config information!\n" ); +return -1 ; + } +if (mwifiex_set_secure_params (priv, bss_cfg, params)) {kfree (bss_cfg);wiphy_err (wiphy,"Failed to parse secuirty parameters!\n" );
drivers/net/wireless/mwifiex/main.h +0 -1
@@ -990,7 +990,6 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,int mwifiex_main_process (struct mwifiex_adapter *); -int mwifiex_uap_set_channel (struct mwifiex_private *priv,int channel);int mwifiex_bss_set_channel (struct mwifiex_private *,struct mwifiex_chan_freq_power *cfp); int mwifiex_get_bss_info(struct mwifiex_private *,
drivers/net/wireless/mwifiex/uap_cmd.c +0 -30
@@ -421,33 +421,3 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no,return 0 ; } - -/* This function sets the RF channel for AP. -* -* This function populates channel information in AP config structure -* and sends command to configure channel information in AP. -*/ -int mwifiex_uap_set_channel (struct mwifiex_private *priv,int channel) -{ -struct mwifiex_uap_bss_param *bss_cfg; -struct wiphy *wiphy = priv->wdev->wiphy; - - bss_cfg =kzalloc (sizeof (struct mwifiex_uap_bss_param ),GFP_KERNEL ); -if (!bss_cfg) -return -ENOMEM ; - -mwifiex_set_sys_config_invalid_data (bss_cfg); - bss_cfg->band_cfg =BAND_CONFIG_MANUAL ; - bss_cfg->channel = channel; - -if (mwifiex_send_cmd_async (priv, HostCmd_CMD_UAP_SYS_CONFIG, - HostCmd_ACT_GEN_SET, -UAP_BSS_PARAMS_I , bss_cfg)) { -wiphy_err (wiphy,"Failed to set the uAP channel\n" ); -kfree (bss_cfg); -return -1 ; - } - -kfree (bss_cfg); -return 0 ; -}
Signature · 1 line
1.7.0.2
PATCH RESEND 2/4 mwifiex: parse WPA IE and support WPA/WPA2 mixed mode for uAP
From: Avinash Patil <[email protected]>
Add support for parsing WPA IE from beacon parameter of cfg80211_ap_settings and set it to FW.
WPA/WPA2 mixed mode is supported with this patch.
---
This patch depends on:
[PATCH] ieee80211: definitions for Microsoft Vendor OUI and WPA OUI type (mac80211-next.git)
drivers/net/wireless/mwifiex/ie.c | 55 +++++++++++++++++++++----------- drivers/net/wireless/mwifiex/uap_cmd.c | 17 +++++++-- 2 files changed, 49 insertions(+), 23 deletions(-)
drivers/net/wireless/mwifiex/ie.c +36 -19
@@ -224,29 +224,46 @@ int mwifiex_set_mgmt_ies(struct mwifiex_private *priv, struct cfg80211_ap_settings *params) {struct mwifiex_ie *beacon_ie =NULL , *pr_ie =NULL ; -struct mwifiex_ie *ar_ie =NULL , *rsn_ie =NULL ; -struct ieee_types_header *ie =NULL ; +struct mwifiex_ie *ar_ie =NULL , *gen_ie =NULL ; +struct ieee_types_header *rsn_ie =NULL , *wpa_ie =NULL ;u16 beacon_idx =MWIFIEX_AUTO_IDX_MASK , pr_idx =MWIFIEX_AUTO_IDX_MASK ;u16 ar_idx =MWIFIEX_AUTO_IDX_MASK , rsn_idx =MWIFIEX_AUTO_IDX_MASK ; -u16 mask; +u16 mask, ie_len =0 ; +const u8 *vendor_ie;int ret =0 ;if (params->beacon.tail && params->beacon.tail_len) { - ie = (void *)cfg80211_find_ie (WLAN_EID_RSN , params->beacon.tail, - params->beacon.tail_len); -if (ie) { - rsn_ie =kmalloc (sizeof (struct mwifiex_ie ),GFP_KERNEL ); -if (!rsn_ie) -return -ENOMEM ; - - rsn_ie->ie_index =cpu_to_le16 (rsn_idx); - mask =MGMT_MASK_BEACON |MGMT_MASK_PROBE_RESP | -MGMT_MASK_ASSOC_RESP ; - rsn_ie->mgmt_subtype_mask =cpu_to_le16 (mask); - rsn_ie->ie_length =cpu_to_le16 (ie->len +2 ); -memcpy (rsn_ie->ie_buffer, ie, ie->len +2 ); - -if (mwifiex_update_uap_custom_ie (priv, rsn_ie, &rsn_idx, + gen_ie =kzalloc (sizeof (struct mwifiex_ie ),GFP_KERNEL ); +if (!gen_ie) +return -ENOMEM ; + gen_ie->ie_index =cpu_to_le16 (rsn_idx); + mask =MGMT_MASK_BEACON |MGMT_MASK_PROBE_RESP | +MGMT_MASK_ASSOC_RESP ; + gen_ie->mgmt_subtype_mask =cpu_to_le16 (mask); + + rsn_ie = (void *)cfg80211_find_ie (WLAN_EID_RSN , + params->beacon.tail, + params->beacon.tail_len); +if (rsn_ie) { +memcpy (gen_ie->ie_buffer, rsn_ie, rsn_ie->len +2 ); + ie_len = rsn_ie->len +2 ; + gen_ie->ie_length =cpu_to_le16 (ie_len); + } + + vendor_ie =cfg80211_find_vendor_ie (WLAN_OUI_MICROSOFT , +WLAN_OUI_TYPE_MICROSOFT_WPA , + params->beacon.tail, + params->beacon.tail_len); +if (vendor_ie) { + wpa_ie = (struct ieee_types_header *)vendor_ie; +memcpy (gen_ie->ie_buffer + ie_len, + wpa_ie, wpa_ie->len +2 ); + ie_len += wpa_ie->len +2 ; + gen_ie->ie_length =cpu_to_le16 (ie_len); + } + +if (rsn_ie || wpa_ie) { +if (mwifiex_update_uap_custom_ie (priv, gen_ie, &rsn_idx,NULL ,NULL ,NULL ,NULL )) { ret =-1 ;
@@ -319,7 +336,7 @@ done:kfree (beacon_ie);kfree (pr_ie);kfree (ar_ie); -kfree (rsn_ie); +kfree (gen_ie);return ret; }
drivers/net/wireless/mwifiex/uap_cmd.c +13 -4
@@ -65,7 +65,7 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, }if (params->crypto.wpa_versions &NL80211_WPA_VERSION_2 ) { - bss_config->protocol =PROTOCOL_WPA2 ; + bss_config->protocol |=PROTOCOL_WPA2 ; bss_config->key_mgmt =KEY_MGMT_EAP ; }break ;
@@ -77,7 +77,7 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, }if (params->crypto.wpa_versions &NL80211_WPA_VERSION_2 ) { - bss_config->protocol =PROTOCOL_WPA2 ; + bss_config->protocol |=PROTOCOL_WPA2 ; bss_config->key_mgmt =KEY_MGMT_PSK ; }break ;
@@ -91,10 +91,19 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,case WLAN_CIPHER_SUITE_WEP104 :break ;case WLAN_CIPHER_SUITE_TKIP : - bss_config->wpa_cfg.pairwise_cipher_wpa =CIPHER_TKIP ; +if (params->crypto.wpa_versions &NL80211_WPA_VERSION_1 ) + bss_config->wpa_cfg.pairwise_cipher_wpa |= +CIPHER_TKIP ; +if (params->crypto.wpa_versions &NL80211_WPA_VERSION_2 ) + bss_config->wpa_cfg.pairwise_cipher_wpa2 |= +CIPHER_TKIP ;break ;case WLAN_CIPHER_SUITE_CCMP : - bss_config->wpa_cfg.pairwise_cipher_wpa2 = +if (params->crypto.wpa_versions &NL80211_WPA_VERSION_1 ) + bss_config->wpa_cfg.pairwise_cipher_wpa |= +CIPHER_AES_CCMP ; +if (params->crypto.wpa_versions &NL80211_WPA_VERSION_2 ) + bss_config->wpa_cfg.pairwise_cipher_wpa2 |=CIPHER_AES_CCMP ;default :break ;
Signature · 1 line
1.7.0.2
PATCH v2 3/4 mwifiex: add 11n support for AP mode
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
Parse HT IE from cfg80211 and set HT capabilities accordingly to FW. If HT IE is missing, 11n would be disabled in FW.
---
v2: fixed sparse warnings
drivers/net/wireless/mwifiex/cfg80211.c | 2 + drivers/net/wireless/mwifiex/fw.h | 6 ++++ drivers/net/wireless/mwifiex/ioctl.h | 1 + drivers/net/wireless/mwifiex/main.h | 3 ++ drivers/net/wireless/mwifiex/uap_cmd.c | 47 +++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 0 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +2 -0
@@ -978,6 +978,8 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,return -1 ; } +mwifiex_set_ht_params (priv, bss_cfg, params); +if (mwifiex_send_cmd_sync (priv, HostCmd_CMD_UAP_BSS_STOP, HostCmd_ACT_GEN_SET,0 ,NULL )) {wiphy_err (wiphy,"Failed to stop the BSS\n" );
drivers/net/wireless/mwifiex/fw.h +6 -0
@@ -162,6 +162,12 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define ISSUPP_11NENABLED (FwCapInfo) (FwCapInfo & BIT(11)) +#define MWIFIEX_DEF_HT_CAP (IEEE80211_HT_CAP_DSSSCCK40 | \ + (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \ + IEEE80211_HT_CAP_SM_PS) + +#define MWIFIEX_DEF_AMPDU IEEE80211_HT_AMPDU_PARM_FACTOR +/* dev_cap bitmap * BIT * 0-16 reserved
drivers/net/wireless/mwifiex/ioctl.h +1 -0
@@ -90,6 +90,7 @@ struct mwifiex_uap_bss_param {u16 key_mgmt;u16 key_mgmt_operation;struct wpa_param wpa_cfg; +struct ieee80211_ht_cap ht_cap; };enum {
drivers/net/wireless/mwifiex/main.h +3 -0
@@ -840,6 +840,9 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv,int mwifiex_set_secure_params (struct mwifiex_private *priv,struct mwifiex_uap_bss_param *bss_config,struct cfg80211_ap_settings *params); +void mwifiex_set_ht_params (struct mwifiex_private *priv, +struct mwifiex_uap_bss_param *bss_cfg, +struct cfg80211_ap_settings *params);/* * This function checks if the queuing is RA based or not.
drivers/net/wireless/mwifiex/uap_cmd.c +47 -0
65 lines not on this page · raw message
Signature · 1 line
1.7.0.2
PATCH RESEND 4/4 mwifiex: separate uAP WPA/WPA2 parsing from other BSS parameters
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
To enhance readability, create a separate function for parsing WPA/WPA2 related parameters from cfg80211_ap_settings. There is no functional change in this patch.
--- drivers/net/wireless/mwifiex/uap_cmd.c | 145 +++++++++++++++++--------------- 1 files changed, 78 insertions(+), 67 deletions(-)
drivers/net/wireless/mwifiex/uap_cmd.c +79 -68
@@ -171,6 +171,82 @@ void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config) }/* This function parses BSS related parameters from structure +* and prepares TLVs specific to WPA/WPA2 security. +* These TLVs are appended to command buffer. +*/ +static void +mwifiex_uap_bss_wpa (u8 **tlv_buf,void *cmd_buf,u16 *param_size) +{ +struct host_cmd_tlv_pwk_cipher *pwk_cipher; +struct host_cmd_tlv_gwk_cipher *gwk_cipher; +struct host_cmd_tlv_passphrase *passphrase; +struct host_cmd_tlv_akmp *tlv_akmp; +struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; +u16 cmd_size = *param_size; +u8 *tlv = *tlv_buf; + + tlv_akmp = (struct host_cmd_tlv_akmp *)tlv; + tlv_akmp->tlv.type =cpu_to_le16 (TLV_TYPE_UAP_AKMP ); + tlv_akmp->tlv.len =cpu_to_le16 (sizeof (struct host_cmd_tlv_akmp ) - +sizeof (struct host_cmd_tlv )); + tlv_akmp->key_mgmt_operation =cpu_to_le16 (bss_cfg->key_mgmt_operation); + tlv_akmp->key_mgmt =cpu_to_le16 (bss_cfg->key_mgmt); + cmd_size +=sizeof (struct host_cmd_tlv_akmp ); + tlv +=sizeof (struct host_cmd_tlv_akmp ); + +if (bss_cfg->wpa_cfg.pairwise_cipher_wpa &VALID_CIPHER_BITMAP ) { + pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; + pwk_cipher->tlv.type =cpu_to_le16 (TLV_TYPE_PWK_CIPHER ); + pwk_cipher->tlv.len = +cpu_to_le16 (sizeof (struct host_cmd_tlv_pwk_cipher ) - +sizeof (struct host_cmd_tlv )); + pwk_cipher->proto =cpu_to_le16 (PROTOCOL_WPA ); + pwk_cipher->cipher = bss_cfg->wpa_cfg.pairwise_cipher_wpa; + cmd_size +=sizeof (struct host_cmd_tlv_pwk_cipher ); + tlv +=sizeof (struct host_cmd_tlv_pwk_cipher ); + } + +if (bss_cfg->wpa_cfg.pairwise_cipher_wpa2 &VALID_CIPHER_BITMAP ) { + pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; + pwk_cipher->tlv.type =cpu_to_le16 (TLV_TYPE_PWK_CIPHER ); + pwk_cipher->tlv.len = +cpu_to_le16 (sizeof (struct host_cmd_tlv_pwk_cipher ) - +sizeof (struct host_cmd_tlv )); + pwk_cipher->proto =cpu_to_le16 (PROTOCOL_WPA2 ); + pwk_cipher->cipher = bss_cfg->wpa_cfg.pairwise_cipher_wpa2; + cmd_size +=sizeof (struct host_cmd_tlv_pwk_cipher ); + tlv +=sizeof (struct host_cmd_tlv_pwk_cipher ); + } + +if (bss_cfg->wpa_cfg.group_cipher &VALID_CIPHER_BITMAP ) { + gwk_cipher = (struct host_cmd_tlv_gwk_cipher *)tlv; + gwk_cipher->tlv.type =cpu_to_le16 (TLV_TYPE_GWK_CIPHER ); + gwk_cipher->tlv.len = +cpu_to_le16 (sizeof (struct host_cmd_tlv_gwk_cipher ) - +sizeof (struct host_cmd_tlv )); + gwk_cipher->cipher = bss_cfg->wpa_cfg.group_cipher; + cmd_size +=sizeof (struct host_cmd_tlv_gwk_cipher ); + tlv +=sizeof (struct host_cmd_tlv_gwk_cipher ); + } + +if (bss_cfg->wpa_cfg.length) { + passphrase = (struct host_cmd_tlv_passphrase *)tlv; + passphrase->tlv.type =cpu_to_le16 (TLV_TYPE_UAP_WPA_PASSPHRASE ); + passphrase->tlv.len =cpu_to_le16 (bss_cfg->wpa_cfg.length); +memcpy (passphrase->passphrase, bss_cfg->wpa_cfg.passphrase, + bss_cfg->wpa_cfg.length); + cmd_size +=sizeof (struct host_cmd_tlv ) + + bss_cfg->wpa_cfg.length; + tlv +=sizeof (struct host_cmd_tlv ) + bss_cfg->wpa_cfg.length; + } + + *param_size = cmd_size; + *tlv_buf = tlv; + +return ; +} + +/* This function parses BSS related parameters from structure * and prepares TLVs. These TLVs are appended to command buffer. */ static int
@@ -184,12 +260,8 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size)struct host_cmd_tlv_frag_threshold *frag_threshold;struct host_cmd_tlv_rts_threshold *rts_threshold;struct host_cmd_tlv_retry_limit *retry_limit; -struct host_cmd_tlv_pwk_cipher *pwk_cipher; -struct host_cmd_tlv_gwk_cipher *gwk_cipher;struct host_cmd_tlv_encrypt_protocol *encrypt_protocol;struct host_cmd_tlv_auth_type *auth_type; -struct host_cmd_tlv_passphrase *passphrase; -struct host_cmd_tlv_akmp *tlv_akmp;struct mwifiex_ie_types_htcap *htcap;struct mwifiex_uap_bss_param *bss_cfg = cmd_buf;u16 cmd_size = *param_size;
@@ -280,70 +352,9 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) }if ((bss_cfg->protocol &PROTOCOL_WPA ) || (bss_cfg->protocol &PROTOCOL_WPA2 ) || - (bss_cfg->protocol &PROTOCOL_EAP )) { - tlv_akmp = (struct host_cmd_tlv_akmp *)tlv; - tlv_akmp->tlv.type =cpu_to_le16 (TLV_TYPE_UAP_AKMP ); - tlv_akmp->tlv.len = -cpu_to_le16 (sizeof (struct host_cmd_tlv_akmp ) - -sizeof (struct host_cmd_tlv )); - tlv_akmp->key_mgmt_operation = -cpu_to_le16 (bss_cfg->key_mgmt_operation); - tlv_akmp->key_mgmt =cpu_to_le16 (bss_cfg->key_mgmt); - cmd_size +=sizeof (struct host_cmd_tlv_akmp ); - tlv +=sizeof (struct host_cmd_tlv_akmp ); - -if (bss_cfg->wpa_cfg.pairwise_cipher_wpa & -VALID_CIPHER_BITMAP ) { - pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; - pwk_cipher->tlv.type = -cpu_to_le16 (TLV_TYPE_PWK_CIPHER ); - pwk_cipher->tlv.len =cpu_to_le16 ( -sizeof (struct host_cmd_tlv_pwk_cipher ) - -sizeof (struct host_cmd_tlv )); - pwk_cipher->proto =cpu_to_le16 (PROTOCOL_WPA ); - pwk_cipher->cipher = - bss_cfg->wpa_cfg.pairwise_cipher_wpa; - cmd_size +=sizeof (struct host_cmd_tlv_pwk_cipher ); - tlv +=sizeof (struct host_cmd_tlv_pwk_cipher ); - } -if (bss_cfg->wpa_cfg.pairwise_cipher_wpa2 & -VALID_CIPHER_BITMAP ) { - pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; - pwk_cipher->tlv.type =cpu_to_le16 (TLV_TYPE_PWK_CIPHER ); - pwk_cipher->tlv.len =cpu_to_le16 ( -sizeof (struct host_cmd_tlv_pwk_cipher ) - -sizeof (struct host_cmd_tlv )); - pwk_cipher->proto =cpu_to_le16 (PROTOCOL_WPA2 ); - pwk_cipher->cipher = - bss_cfg->wpa_cfg.pairwise_cipher_wpa2; - cmd_size +=sizeof (struct host_cmd_tlv_pwk_cipher ); - tlv +=sizeof (struct host_cmd_tlv_pwk_cipher ); - } -if (bss_cfg->wpa_cfg.group_cipher &VALID_CIPHER_BITMAP ) { - gwk_cipher = (struct host_cmd_tlv_gwk_cipher *)tlv; - gwk_cipher->tlv.type =cpu_to_le16 (TLV_TYPE_GWK_CIPHER ); - gwk_cipher->tlv.len =cpu_to_le16 ( -sizeof (struct host_cmd_tlv_gwk_cipher ) - -sizeof (struct host_cmd_tlv )); - gwk_cipher->cipher = bss_cfg->wpa_cfg.group_cipher; - cmd_size +=sizeof (struct host_cmd_tlv_gwk_cipher ); - tlv +=sizeof (struct host_cmd_tlv_gwk_cipher ); - } -if (bss_cfg->wpa_cfg.length) { - passphrase = (struct host_cmd_tlv_passphrase *)tlv; - passphrase->tlv.type = -cpu_to_le16 (TLV_TYPE_UAP_WPA_PASSPHRASE ); - passphrase->tlv.len = -cpu_to_le16 (bss_cfg->wpa_cfg.length); -memcpy (passphrase->passphrase, - bss_cfg->wpa_cfg.passphrase, - bss_cfg->wpa_cfg.length); - cmd_size +=sizeof (struct host_cmd_tlv ) + - bss_cfg->wpa_cfg.length; - tlv +=sizeof (struct host_cmd_tlv ) + - bss_cfg->wpa_cfg.length; - } - } + (bss_cfg->protocol &PROTOCOL_EAP )) +mwifiex_uap_bss_wpa (&tlv, cmd_buf, &cmd_size); +if ((bss_cfg->auth_mode <=WLAN_AUTH_SHARED_KEY ) || (bss_cfg->auth_mode ==MWIFIEX_AUTH_MODE_AUTO )) { auth_type = (struct host_cmd_tlv_auth_type *)tlv;
Signature · 1 line
1.7.0.2