diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2011-10-11 10:31:54 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-11-11 05:50:56 -0500 |
commit | 4b28a80dd6713c404f4f0084007456b769aba553 (patch) | |
tree | 3a36051268f4010159adb379815ddb357e8b558c /drivers/net | |
parent | e8091281f588812b128e102307e13acd9e917a5b (diff) |
ath6kl: Add debugfs file for target roam table
The new roam_table debugfs file can be used to display the current
roam table from the target.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.c | 109 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.h | 7 |
5 files changed, 139 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index 6d8a4845baa..c58cfad9df6 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -397,6 +397,7 @@ struct ath6kl_req_key { | |||
397 | #define TESTMODE 13 | 397 | #define TESTMODE 13 |
398 | #define CLEAR_BSSFILTER_ON_BEACON 14 | 398 | #define CLEAR_BSSFILTER_ON_BEACON 14 |
399 | #define DTIM_PERIOD_AVAIL 15 | 399 | #define DTIM_PERIOD_AVAIL 15 |
400 | #define ROAM_TBL_PEND 16 | ||
400 | 401 | ||
401 | struct ath6kl { | 402 | struct ath6kl { |
402 | struct device *dev; | 403 | struct device *dev; |
@@ -529,6 +530,9 @@ struct ath6kl { | |||
529 | struct { | 530 | struct { |
530 | unsigned int invalid_rate; | 531 | unsigned int invalid_rate; |
531 | } war_stats; | 532 | } war_stats; |
533 | |||
534 | u8 *roam_tbl; | ||
535 | unsigned int roam_tbl_len; | ||
532 | } debug; | 536 | } debug; |
533 | #endif /* CONFIG_ATH6KL_DEBUG */ | 537 | #endif /* CONFIG_ATH6KL_DEBUG */ |
534 | }; | 538 | }; |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index b9bf28d7284..cec958a3d43 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c | |||
@@ -966,6 +966,111 @@ static const struct file_operations fops_diag_reg_write = { | |||
966 | .llseek = default_llseek, | 966 | .llseek = default_llseek, |
967 | }; | 967 | }; |
968 | 968 | ||
969 | int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf, | ||
970 | size_t len) | ||
971 | { | ||
972 | const struct wmi_target_roam_tbl *tbl; | ||
973 | u16 num_entries; | ||
974 | |||
975 | if (len < sizeof(*tbl)) | ||
976 | return -EINVAL; | ||
977 | |||
978 | tbl = (const struct wmi_target_roam_tbl *) buf; | ||
979 | num_entries = le16_to_cpu(tbl->num_entries); | ||
980 | if (sizeof(*tbl) + num_entries * sizeof(struct wmi_bss_roam_info) > | ||
981 | len) | ||
982 | return -EINVAL; | ||
983 | |||
984 | if (ar->debug.roam_tbl == NULL || | ||
985 | ar->debug.roam_tbl_len < (unsigned int) len) { | ||
986 | kfree(ar->debug.roam_tbl); | ||
987 | ar->debug.roam_tbl = kmalloc(len, GFP_ATOMIC); | ||
988 | if (ar->debug.roam_tbl == NULL) | ||
989 | return -ENOMEM; | ||
990 | } | ||
991 | |||
992 | memcpy(ar->debug.roam_tbl, buf, len); | ||
993 | ar->debug.roam_tbl_len = len; | ||
994 | |||
995 | if (test_bit(ROAM_TBL_PEND, &ar->flag)) { | ||
996 | clear_bit(ROAM_TBL_PEND, &ar->flag); | ||
997 | wake_up(&ar->event_wq); | ||
998 | } | ||
999 | |||
1000 | return 0; | ||
1001 | } | ||
1002 | |||
1003 | static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf, | ||
1004 | size_t count, loff_t *ppos) | ||
1005 | { | ||
1006 | struct ath6kl *ar = file->private_data; | ||
1007 | int ret; | ||
1008 | long left; | ||
1009 | struct wmi_target_roam_tbl *tbl; | ||
1010 | u16 num_entries, i; | ||
1011 | char *buf; | ||
1012 | unsigned int len, buf_len; | ||
1013 | ssize_t ret_cnt; | ||
1014 | |||
1015 | if (down_interruptible(&ar->sem)) | ||
1016 | return -EBUSY; | ||
1017 | |||
1018 | set_bit(ROAM_TBL_PEND, &ar->flag); | ||
1019 | |||
1020 | ret = ath6kl_wmi_get_roam_tbl_cmd(ar->wmi); | ||
1021 | if (ret) { | ||
1022 | up(&ar->sem); | ||
1023 | return ret; | ||
1024 | } | ||
1025 | |||
1026 | left = wait_event_interruptible_timeout( | ||
1027 | ar->event_wq, !test_bit(ROAM_TBL_PEND, &ar->flag), WMI_TIMEOUT); | ||
1028 | up(&ar->sem); | ||
1029 | |||
1030 | if (left <= 0) | ||
1031 | return -ETIMEDOUT; | ||
1032 | |||
1033 | if (ar->debug.roam_tbl == NULL) | ||
1034 | return -ENOMEM; | ||
1035 | |||
1036 | tbl = (struct wmi_target_roam_tbl *) ar->debug.roam_tbl; | ||
1037 | num_entries = le16_to_cpu(tbl->num_entries); | ||
1038 | |||
1039 | buf_len = 100 + num_entries * 100; | ||
1040 | buf = kzalloc(buf_len, GFP_KERNEL); | ||
1041 | if (buf == NULL) | ||
1042 | return -ENOMEM; | ||
1043 | len = 0; | ||
1044 | len += scnprintf(buf + len, buf_len - len, | ||
1045 | "roam_mode=%u\n\n" | ||
1046 | "# roam_util bssid rssi rssidt last_rssi util bias\n", | ||
1047 | le16_to_cpu(tbl->roam_mode)); | ||
1048 | |||
1049 | for (i = 0; i < num_entries; i++) { | ||
1050 | struct wmi_bss_roam_info *info = &tbl->info[i]; | ||
1051 | len += scnprintf(buf + len, buf_len - len, | ||
1052 | "%d %pM %d %d %d %d %d\n", | ||
1053 | a_sle32_to_cpu(info->roam_util), info->bssid, | ||
1054 | info->rssi, info->rssidt, info->last_rssi, | ||
1055 | info->util, info->bias); | ||
1056 | } | ||
1057 | |||
1058 | if (len > buf_len) | ||
1059 | len = buf_len; | ||
1060 | |||
1061 | ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1062 | |||
1063 | kfree(buf); | ||
1064 | return ret_cnt; | ||
1065 | } | ||
1066 | |||
1067 | static const struct file_operations fops_roam_table = { | ||
1068 | .read = ath6kl_roam_table_read, | ||
1069 | .open = ath6kl_debugfs_open, | ||
1070 | .owner = THIS_MODULE, | ||
1071 | .llseek = default_llseek, | ||
1072 | }; | ||
1073 | |||
969 | int ath6kl_debug_init(struct ath6kl *ar) | 1074 | int ath6kl_debug_init(struct ath6kl *ar) |
970 | { | 1075 | { |
971 | ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE); | 1076 | ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE); |
@@ -1024,6 +1129,9 @@ int ath6kl_debug_init(struct ath6kl *ar) | |||
1024 | debugfs_create_file("war_stats", S_IRUSR, ar->debugfs_phy, ar, | 1129 | debugfs_create_file("war_stats", S_IRUSR, ar->debugfs_phy, ar, |
1025 | &fops_war_stats); | 1130 | &fops_war_stats); |
1026 | 1131 | ||
1132 | debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar, | ||
1133 | &fops_roam_table); | ||
1134 | |||
1027 | return 0; | 1135 | return 0; |
1028 | } | 1136 | } |
1029 | 1137 | ||
@@ -1031,6 +1139,7 @@ void ath6kl_debug_cleanup(struct ath6kl *ar) | |||
1031 | { | 1139 | { |
1032 | vfree(ar->debug.fwlog_buf.buf); | 1140 | vfree(ar->debug.fwlog_buf.buf); |
1033 | kfree(ar->debug.fwlog_tmp); | 1141 | kfree(ar->debug.fwlog_tmp); |
1142 | kfree(ar->debug.roam_tbl); | ||
1034 | } | 1143 | } |
1035 | 1144 | ||
1036 | #endif | 1145 | #endif |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h index e3740b07341..f73bf150199 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.h +++ b/drivers/net/wireless/ath/ath6kl/debug.h | |||
@@ -90,6 +90,8 @@ void ath6kl_dump_registers(struct ath6kl_device *dev, | |||
90 | void dump_cred_dist_stats(struct htc_target *target); | 90 | void dump_cred_dist_stats(struct htc_target *target); |
91 | void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len); | 91 | void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len); |
92 | void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war); | 92 | void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war); |
93 | int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf, | ||
94 | size_t len); | ||
93 | int ath6kl_debug_init(struct ath6kl *ar); | 95 | int ath6kl_debug_init(struct ath6kl *ar); |
94 | void ath6kl_debug_cleanup(struct ath6kl *ar); | 96 | void ath6kl_debug_cleanup(struct ath6kl *ar); |
95 | 97 | ||
@@ -125,6 +127,12 @@ static inline void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) | |||
125 | { | 127 | { |
126 | } | 128 | } |
127 | 129 | ||
130 | static inline int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, | ||
131 | const void *buf, size_t len) | ||
132 | { | ||
133 | return 0; | ||
134 | } | ||
135 | |||
128 | static inline int ath6kl_debug_init(struct ath6kl *ar) | 136 | static inline int ath6kl_debug_init(struct ath6kl *ar) |
129 | { | 137 | { |
130 | return 0; | 138 | return 0; |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index ab782d7aab0..4021527b19c 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -2407,6 +2407,11 @@ int ath6kl_wmi_get_tx_pwr_cmd(struct wmi *wmi) | |||
2407 | return ath6kl_wmi_simple_cmd(wmi, WMI_GET_TX_PWR_CMDID); | 2407 | return ath6kl_wmi_simple_cmd(wmi, WMI_GET_TX_PWR_CMDID); |
2408 | } | 2408 | } |
2409 | 2409 | ||
2410 | int ath6kl_wmi_get_roam_tbl_cmd(struct wmi *wmi) | ||
2411 | { | ||
2412 | return ath6kl_wmi_simple_cmd(wmi, WMI_GET_ROAM_TBL_CMDID); | ||
2413 | } | ||
2414 | |||
2410 | int ath6kl_wmi_set_lpreamble_cmd(struct wmi *wmi, u8 status, u8 preamble_policy) | 2415 | int ath6kl_wmi_set_lpreamble_cmd(struct wmi *wmi, u8 status, u8 preamble_policy) |
2411 | { | 2416 | { |
2412 | struct sk_buff *skb; | 2417 | struct sk_buff *skb; |
@@ -2844,6 +2849,11 @@ static int ath6kl_wmi_control_rx_xtnd(struct wmi *wmi, struct sk_buff *skb) | |||
2844 | return ret; | 2849 | return ret; |
2845 | } | 2850 | } |
2846 | 2851 | ||
2852 | static int ath6kl_wmi_roam_tbl_event_rx(struct wmi *wmi, u8 *datap, int len) | ||
2853 | { | ||
2854 | return ath6kl_debug_roam_tbl_event(wmi->parent_dev, datap, len); | ||
2855 | } | ||
2856 | |||
2847 | /* Control Path */ | 2857 | /* Control Path */ |
2848 | int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb) | 2858 | int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb) |
2849 | { | 2859 | { |
@@ -2948,6 +2958,7 @@ int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb) | |||
2948 | break; | 2958 | break; |
2949 | case WMI_REPORT_ROAM_TBL_EVENTID: | 2959 | case WMI_REPORT_ROAM_TBL_EVENTID: |
2950 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REPORT_ROAM_TBL_EVENTID\n"); | 2960 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REPORT_ROAM_TBL_EVENTID\n"); |
2961 | ret = ath6kl_wmi_roam_tbl_event_rx(wmi, datap, len); | ||
2951 | break; | 2962 | break; |
2952 | case WMI_EXTENSION_EVENTID: | 2963 | case WMI_EXTENSION_EVENTID: |
2953 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_EXTENSION_EVENTID\n"); | 2964 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_EXTENSION_EVENTID\n"); |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h index 96102c68640..f986da1885c 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.h +++ b/drivers/net/wireless/ath/ath6kl/wmi.h | |||
@@ -1624,6 +1624,12 @@ struct wmi_bss_roam_info { | |||
1624 | u8 reserved; | 1624 | u8 reserved; |
1625 | } __packed; | 1625 | } __packed; |
1626 | 1626 | ||
1627 | struct wmi_target_roam_tbl { | ||
1628 | __le16 roam_mode; | ||
1629 | __le16 num_entries; | ||
1630 | struct wmi_bss_roam_info info[]; | ||
1631 | } __packed; | ||
1632 | |||
1627 | /* WMI_CAC_EVENTID */ | 1633 | /* WMI_CAC_EVENTID */ |
1628 | enum cac_indication { | 1634 | enum cac_indication { |
1629 | CAC_INDICATION_ADMISSION = 0x00, | 1635 | CAC_INDICATION_ADMISSION = 0x00, |
@@ -2221,6 +2227,7 @@ int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, const u8 *bssid, | |||
2221 | const u8 *pmkid, bool set); | 2227 | const u8 *pmkid, bool set); |
2222 | int ath6kl_wmi_set_tx_pwr_cmd(struct wmi *wmi, u8 dbM); | 2228 | int ath6kl_wmi_set_tx_pwr_cmd(struct wmi *wmi, u8 dbM); |
2223 | int ath6kl_wmi_get_tx_pwr_cmd(struct wmi *wmi); | 2229 | int ath6kl_wmi_get_tx_pwr_cmd(struct wmi *wmi); |
2230 | int ath6kl_wmi_get_roam_tbl_cmd(struct wmi *wmi); | ||
2224 | 2231 | ||
2225 | int ath6kl_wmi_set_wmm_txop(struct wmi *wmi, enum wmi_txop_cfg cfg); | 2232 | int ath6kl_wmi_set_wmm_txop(struct wmi *wmi, enum wmi_txop_cfg cfg); |
2226 | int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 keep_alive_intvl); | 2233 | int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 keep_alive_intvl); |