diff options
author | Vivek Natarajan <nataraja@qca.qualcomm.com> | 2011-08-31 05:32:19 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-09-02 05:25:58 -0400 |
commit | e5090444be811ce45653969363be8fcb4c52d597 (patch) | |
tree | efd6e1e353c8bca5773b7c98024f12eec1359bb7 | |
parent | b142b91401b8e39671db74bd4fe89f281f4c2978 (diff) |
ath6kl: Add debugfs entry to modify roaming parameters.
Firmware initiates roaming only after it reaches a rssi of 20.
This lower rssi threshold can be modified through a wmi command
to modify the roaming behavior.
kvalo: rename debugfs functions and move comment about rssi units next to
ath6kl_wmi_set_roam_lrssi_cmd()
Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.c | 47 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/init.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.c | 29 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.h | 41 |
5 files changed, 119 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index de5308727b62..faf801571214 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -394,6 +394,7 @@ struct ath6kl { | |||
394 | u16 bss_ch; | 394 | u16 bss_ch; |
395 | u16 listen_intvl_b; | 395 | u16 listen_intvl_b; |
396 | u16 listen_intvl_t; | 396 | u16 listen_intvl_t; |
397 | u8 lrssi_roam_threshold; | ||
397 | struct ath6kl_version version; | 398 | struct ath6kl_version version; |
398 | u32 target_type; | 399 | u32 target_type; |
399 | u8 tx_pwr; | 400 | u8 tx_pwr; |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index cb89776f9485..8bc475376372 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c | |||
@@ -714,6 +714,51 @@ static const struct file_operations fops_reg_dump = { | |||
714 | .llseek = default_llseek, | 714 | .llseek = default_llseek, |
715 | }; | 715 | }; |
716 | 716 | ||
717 | static ssize_t ath6kl_lrssi_roam_write(struct file *file, | ||
718 | const char __user *user_buf, | ||
719 | size_t count, loff_t *ppos) | ||
720 | { | ||
721 | struct ath6kl *ar = file->private_data; | ||
722 | unsigned long lrssi_roam_threshold; | ||
723 | char buf[32]; | ||
724 | ssize_t len; | ||
725 | |||
726 | len = min(count, sizeof(buf) - 1); | ||
727 | if (copy_from_user(buf, user_buf, len)) | ||
728 | return -EFAULT; | ||
729 | |||
730 | buf[len] = '\0'; | ||
731 | if (strict_strtoul(buf, 0, &lrssi_roam_threshold)) | ||
732 | return -EINVAL; | ||
733 | |||
734 | ar->lrssi_roam_threshold = lrssi_roam_threshold; | ||
735 | |||
736 | ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold); | ||
737 | |||
738 | return count; | ||
739 | } | ||
740 | |||
741 | static ssize_t ath6kl_lrssi_roam_read(struct file *file, | ||
742 | char __user *user_buf, | ||
743 | size_t count, loff_t *ppos) | ||
744 | { | ||
745 | struct ath6kl *ar = file->private_data; | ||
746 | char buf[32]; | ||
747 | unsigned int len; | ||
748 | |||
749 | len = snprintf(buf, sizeof(buf), "%u\n", ar->lrssi_roam_threshold); | ||
750 | |||
751 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
752 | } | ||
753 | |||
754 | static const struct file_operations fops_lrssi_roam_threshold = { | ||
755 | .read = ath6kl_lrssi_roam_read, | ||
756 | .write = ath6kl_lrssi_roam_write, | ||
757 | .open = ath6kl_debugfs_open, | ||
758 | .owner = THIS_MODULE, | ||
759 | .llseek = default_llseek, | ||
760 | }; | ||
761 | |||
717 | int ath6kl_debug_init(struct ath6kl *ar) | 762 | int ath6kl_debug_init(struct ath6kl *ar) |
718 | { | 763 | { |
719 | ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE); | 764 | ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE); |
@@ -760,6 +805,8 @@ int ath6kl_debug_init(struct ath6kl *ar) | |||
760 | debugfs_create_file("reg_dump", S_IRUSR, ar->debugfs_phy, ar, | 805 | debugfs_create_file("reg_dump", S_IRUSR, ar->debugfs_phy, ar, |
761 | &fops_reg_dump); | 806 | &fops_reg_dump); |
762 | 807 | ||
808 | debugfs_create_file("lrssi_roam_threshold", S_IRUSR | S_IWUSR, | ||
809 | ar->debugfs_phy, ar, &fops_lrssi_roam_threshold); | ||
763 | return 0; | 810 | return 0; |
764 | } | 811 | } |
765 | 812 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index d234dc22e709..3d67025b72c4 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -280,6 +280,7 @@ static void ath6kl_init_control_info(struct ath6kl *ar) | |||
280 | memset(&ar->sc_params, 0, sizeof(ar->sc_params)); | 280 | memset(&ar->sc_params, 0, sizeof(ar->sc_params)); |
281 | ar->sc_params.short_scan_ratio = WMI_SHORTSCANRATIO_DEFAULT; | 281 | ar->sc_params.short_scan_ratio = WMI_SHORTSCANRATIO_DEFAULT; |
282 | ar->sc_params.scan_ctrl_flags = DEFAULT_SCAN_CTRL_FLAGS; | 282 | ar->sc_params.scan_ctrl_flags = DEFAULT_SCAN_CTRL_FLAGS; |
283 | ar->lrssi_roam_threshold = DEF_LRSSI_ROAM_THRESHOLD; | ||
283 | 284 | ||
284 | memset((u8 *)ar->sta_list, 0, | 285 | memset((u8 *)ar->sta_list, 0, |
285 | AP_MAX_NUM_STA * sizeof(struct ath6kl_sta)); | 286 | AP_MAX_NUM_STA * sizeof(struct ath6kl_sta)); |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 7201a72ac1b8..c9ec6303db72 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -666,6 +666,35 @@ static int ath6kl_wmi_ready_event_rx(struct wmi *wmi, u8 *datap, int len) | |||
666 | return 0; | 666 | return 0; |
667 | } | 667 | } |
668 | 668 | ||
669 | /* | ||
670 | * Mechanism to modify the roaming behavior in the firmware. The lower rssi | ||
671 | * at which the station has to roam can be passed with | ||
672 | * WMI_SET_LRSSI_SCAN_PARAMS. Subtract 96 from RSSI to get the signal level | ||
673 | * in dBm. | ||
674 | */ | ||
675 | int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi) | ||
676 | { | ||
677 | struct sk_buff *skb; | ||
678 | struct roam_ctrl_cmd *cmd; | ||
679 | |||
680 | skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); | ||
681 | if (!skb) | ||
682 | return -ENOMEM; | ||
683 | |||
684 | cmd = (struct roam_ctrl_cmd *) skb->data; | ||
685 | |||
686 | cmd->info.params.lrssi_scan_period = cpu_to_le16(DEF_LRSSI_SCAN_PERIOD); | ||
687 | cmd->info.params.lrssi_scan_threshold = a_cpu_to_sle16(lrssi + | ||
688 | DEF_SCAN_FOR_ROAM_INTVL); | ||
689 | cmd->info.params.lrssi_roam_threshold = a_cpu_to_sle16(lrssi); | ||
690 | cmd->info.params.roam_rssi_floor = DEF_LRSSI_ROAM_FLOOR; | ||
691 | cmd->roam_ctrl = WMI_SET_LRSSI_SCAN_PARAMS; | ||
692 | |||
693 | ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_ROAM_CTRL_CMDID, NO_SYNC_WMIFLAG); | ||
694 | |||
695 | return 0; | ||
696 | } | ||
697 | |||
669 | static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len) | 698 | static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len) |
670 | { | 699 | { |
671 | struct wmi_connect_event *ev; | 700 | struct wmi_connect_event *ev; |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h index 1c565816f622..a78e21b91776 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.h +++ b/drivers/net/wireless/ath/ath6kl/wmi.h | |||
@@ -1333,6 +1333,46 @@ enum wmi_bi_ftype { | |||
1333 | PROBEREQ_FTYPE, | 1333 | PROBEREQ_FTYPE, |
1334 | }; | 1334 | }; |
1335 | 1335 | ||
1336 | #define DEF_LRSSI_SCAN_PERIOD 5 | ||
1337 | #define DEF_LRSSI_ROAM_THRESHOLD 20 | ||
1338 | #define DEF_LRSSI_ROAM_FLOOR 60 | ||
1339 | #define DEF_SCAN_FOR_ROAM_INTVL 2 | ||
1340 | |||
1341 | enum wmi_roam_ctrl { | ||
1342 | WMI_FORCE_ROAM = 1, | ||
1343 | WMI_SET_ROAM_MODE, | ||
1344 | WMI_SET_HOST_BIAS, | ||
1345 | WMI_SET_LRSSI_SCAN_PARAMS, | ||
1346 | }; | ||
1347 | |||
1348 | struct bss_bias { | ||
1349 | u8 bssid[ETH_ALEN]; | ||
1350 | u8 bias; | ||
1351 | } __packed; | ||
1352 | |||
1353 | struct bss_bias_info { | ||
1354 | u8 num_bss; | ||
1355 | struct bss_bias bss_bias[1]; | ||
1356 | } __packed; | ||
1357 | |||
1358 | struct low_rssi_scan_params { | ||
1359 | __le16 lrssi_scan_period; | ||
1360 | a_sle16 lrssi_scan_threshold; | ||
1361 | a_sle16 lrssi_roam_threshold; | ||
1362 | u8 roam_rssi_floor; | ||
1363 | u8 reserved[1]; | ||
1364 | } __packed; | ||
1365 | |||
1366 | struct roam_ctrl_cmd { | ||
1367 | union { | ||
1368 | u8 bssid[ETH_ALEN]; | ||
1369 | u8 roam_mode; | ||
1370 | struct bss_bias_info bss; | ||
1371 | struct low_rssi_scan_params params; | ||
1372 | } __packed info; | ||
1373 | u8 roam_ctrl; | ||
1374 | } __packed; | ||
1375 | |||
1336 | struct wmi_bss_info_hdr { | 1376 | struct wmi_bss_info_hdr { |
1337 | __le16 ch; | 1377 | __le16 ch; |
1338 | 1378 | ||
@@ -2190,6 +2230,7 @@ int ath6kl_wmi_test_cmd(struct wmi *wmi, void *buf, size_t len); | |||
2190 | s32 ath6kl_wmi_get_rate(s8 rate_index); | 2230 | s32 ath6kl_wmi_get_rate(s8 rate_index); |
2191 | 2231 | ||
2192 | int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd); | 2232 | int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd); |
2233 | int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi); | ||
2193 | 2234 | ||
2194 | struct bss *ath6kl_wmi_find_ssid_node(struct wmi *wmi, u8 *ssid, | 2235 | struct bss *ath6kl_wmi_find_ssid_node(struct wmi *wmi, u8 *ssid, |
2195 | u32 ssid_len, bool is_wpa2, | 2236 | u32 ssid_len, bool is_wpa2, |