ath6kl: refactor wmi scan command
PATCH 1/2 ath6kl: refactor wmi scan command
ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX was checked in cfg80211.c which is a bit awkward when adding more callsites to the scan functions. Refactor the code to wmi.c so that it's transparent to the callers.
Even though the patch looks scary there are no functional changes. I just had to move ath6kl_wmi_startscan_cmd() before ath6kl_wmi_beginscan_cmd() which confuses patch.
--- drivers/net/wireless/ath/ath6kl/cfg80211.c | 31 ++------ drivers/net/wireless/ath/ath6kl/wmi.c | 107 ++++++++++++++++------------ drivers/net/wireless/ath/ath6kl/wmi.h | 5 - 3 files changed, 69 insertions(+), 74 deletions(-)
drivers/net/wireless/ath/ath6kl/cfg80211.c +8 -23
@@ -1031,30 +1031,15 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, vif->scan_req = request; -if (test_bit (ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX , - ar->fw_capabilities)) { -/* -* If capable of doing P2P mgmt operations using -* station interface, send additional information like -* supported rates to advertise and xmit rates for -* probe requests -*/ - ret =ath6kl_wmi_beginscan_cmd (ar->wmi, vif->fw_vif_idx, -WMI_LONG_SCAN , force_fg_scan, - false,0 , -ATH6KL_FG_SCAN_INTERVAL , - n_channels, channels, - request->no_cck, - request->rates); - }else { - ret =ath6kl_wmi_startscan_cmd (ar->wmi, vif->fw_vif_idx, -WMI_LONG_SCAN , force_fg_scan, - false,0 , -ATH6KL_FG_SCAN_INTERVAL , - n_channels, channels); - } + ret =ath6kl_wmi_beginscan_cmd (ar->wmi, vif->fw_vif_idx, +WMI_LONG_SCAN , force_fg_scan, + false,0 , +ATH6KL_FG_SCAN_INTERVAL , + n_channels, channels, + request->no_cck, + request->rates);if (ret) { -ath6kl_err ("wmi_startscan_cmd failed\n" ); +ath6kl_err ("failed to start scan: %d\n" , ret); vif->scan_req =NULL ; }
drivers/net/wireless/ath/ath6kl/wmi.c +61 -46
160 lines not on this page · raw message
drivers/net/wireless/ath/ath6kl/wmi.h +0 -5
@@ -2514,11 +2514,6 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx,int ath6kl_wmi_reconnect_cmd (struct wmi *wmi,u8 if_idx,u8 *bssid,u16 channel);int ath6kl_wmi_disconnect_cmd (struct wmi *wmi,u8 if_idx); -int ath6kl_wmi_startscan_cmd (struct wmi *wmi,u8 if_idx, -enum wmi_scan_type scan_type, -u32 force_fgscan,u32 is_legacy, -u32 home_dwell_time,u32 force_scan_interval, -s8 num_chan,u16 *ch_list); int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx, enum wmi_scan_type scan_type,
PATCH 2/2 ath6kl: add support for changing contry code
To make it possible to change the country code from user space via nl80211 add handler for reg_notifier. The feature is only enabled when built time option CONFIG_ATH6KL_REGDOMAIN is enabled, which again depends on CFG80211_CERTIFICATION_ONUS for certication purposes.
--- drivers/net/wireless/ath/ath6kl/Kconfig | 9 +++++ drivers/net/wireless/ath/ath6kl/cfg80211.c | 47 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath6kl/core.h | 3 ++ drivers/net/wireless/ath/ath6kl/wmi.c | 17 ++++++++++ drivers/net/wireless/ath/ath6kl/wmi.h | 6 ++++ 5 files changed, 82 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath6kl/Kconfig +9 -0
@@ -30,3 +30,12 @@ config ATH6KL_DEBUG depends on ATH6KL ---help--- Enables debug support + +config ATH6KL_REGDOMAIN + bool "Atheros ath6kl regdomain support" + depends on ATH6KL + depends on CFG80211_CERTIFICATION_ONUS + ---help--- + Enabling this makes it possible to change the regdomain in + the firmware. This can be only enabled if regulatory requirements + are taken into account.
drivers/net/wireless/ath/ath6kl/cfg80211.c +47 -0
59 lines not on this page · raw message
drivers/net/wireless/ath/ath6kl/core.h +3 -0
@@ -121,6 +121,9 @@ enum ath6kl_fw_capability {/* FW sets mac_addr[4] ^= 0x80 for newly created interfaces */ ATH6KL_FW_CAPABILITY_CUSTOM_MAC_ADDR , +/* supports WMI_SET_REGDOMAIN_CMDID command */ +ATH6KL_FW_CAPABILITY_REGDOMAIN , +/* this needs to be last */ ATH6KL_FW_CAPABILITY_MAX, };
drivers/net/wireless/ath/ath6kl/wmi.c +17 -0
@@ -3172,6 +3172,23 @@ int ath6kl_wmi_sta_bmiss_enhance_cmd(struct wmi *wmi, u8 if_idx, bool enhance)return ret; } +int ath6kl_wmi_set_regdomain_cmd (struct wmi *wmi,const char *alpha2) +{ +struct sk_buff *skb; +struct wmi_set_regdomain_cmd *cmd; + + skb =ath6kl_wmi_get_new_buf (sizeof (*cmd)); +if (!skb) +return -ENOMEM ; + + cmd = (struct wmi_set_regdomain_cmd *) skb->data; +memcpy (cmd->iso_name, alpha2,2 ); + +return ath6kl_wmi_cmd_send (wmi,0 , skb, +WMI_SET_REGDOMAIN_CMDID , +NO_SYNC_WMIFLAG ); +} +s32 ath6kl_wmi_get_rate (s8 rate_index) {if (rate_index ==RATE_AUTO )
drivers/net/wireless/ath/ath6kl/wmi.h +6 -0
@@ -1036,6 +1036,11 @@ struct wmi_sta_bmiss_enhance_cmd {u8 enable; } __packed; +struct wmi_set_regdomain_cmd { +u8 length; +u8 iso_name[2 ]; +} __packed; +/* WMI_SET_POWER_MODE_CMDID */ enum wmi_power_mode {REC_POWER =0x01 ,
@@ -2605,6 +2610,7 @@ int ath6kl_wmi_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, bool mc_all_on);int ath6kl_wmi_add_del_mcast_filter_cmd (struct wmi *wmi,u8 if_idx,u8 *filter,bool add_filter);int ath6kl_wmi_sta_bmiss_enhance_cmd (struct wmi *wmi,u8 if_idx,bool enable); +int ath6kl_wmi_set_regdomain_cmd (struct wmi *wmi,const char *alpha2);/* AP mode uAPSD */ int ath6kl_wmi_ap_set_apsd (struct wmi *wmi,u8 if_idx,u8 enable);
Re: [PATCH 2/2] ath6kl: add support for changing contry code
drivers/net/wireless/ath/ath6kl/Kconfig config ATH6KL_DEBUG · line 41
Quoted 8 lines · Kalle Valo
drivers/net/wireless/ath/ath6kl/Kconfig +8
-0+config ATH6KL_REGDOMAIN + bool "Atheros ath6kl regdomain support" + depends on ATH6KL + depends on CFG80211_CERTIFICATION_ONUS + ---help--- + Enabling this makes it possible to change the regdomain in + the firmware. This can be only enabled if regulatory requirements + are taken into account.
You will need to add wiphy->features |= NL80211_FEATURE_CELL_BASE_REG_HINTS in order to enable the base station hints to propagate to the driver and even to the core, otherwise this is ignored. This was addressed starting at v4 of my onus patches. Given this, I think it makes sense to rename the option to enable / disable base station hints and to update the language to clearly reflect that is the only type of hint that would be used to update the firmware regulatory domain.
Luis
Re: [PATCH 2/2] ath6kl: add support for changing contry code
Quoted 10 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath6kl/Kconfig config ATH6KL_DEBUG · line 41
Quoted 8 lines · Kalle Valo
drivers/net/wireless/ath/ath6kl/Kconfig +8
-0+config ATH6KL_REGDOMAIN + bool "Atheros ath6kl regdomain support" + depends on ATH6KL + depends on CFG80211_CERTIFICATION_ONUS + ---help--- + Enabling this makes it possible to change the regdomain in + the firmware. This can be only enabled if regulatory requirements + are taken into account.
Quoted 8 lines
You will need to add
wiphy->features|=NL80211_FEATURE_CELL_BASE_REG_HINTSin order to enable the base station hints to propagate to the driver and even to the core, otherwise this is ignored. This was addressed starting at v4 of my onus patches. Given this, I think it makes sense to rename the option to enable / disable base station hints and to update the language to clearly reflect that is the only type of hint that would be used to update the firmware regulatory domain.
I was planning to do this in two phases, first do a simple implementation (these two patches) and then add support for the cellular BTS hints.
Kalle