diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2011-10-11 10:31:56 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-11-11 05:50:56 -0500 |
commit | ff0b007573c70be88c4efd3c1d8b41e9ba9710b3 (patch) | |
tree | 6ae8d74e1a743f216d34257007fd31fd50646e03 | |
parent | 1261875f7a0a22d0d47bd400b9e9a5cf99909bbf (diff) |
ath6kl: Add debugfs control for keepalive and disconnection timeout
The new debugfs files keepalive and disconnect_timeout can be used to
fetch the current values and to change the values for keepalive and
disconnect event timeout (both in seconds).
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.c | 95 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.c | 4 |
4 files changed, 113 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index c58cfad9df65..31e5c7ea1ce1 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -533,6 +533,9 @@ struct ath6kl { | |||
533 | 533 | ||
534 | u8 *roam_tbl; | 534 | u8 *roam_tbl; |
535 | unsigned int roam_tbl_len; | 535 | unsigned int roam_tbl_len; |
536 | |||
537 | u8 keepalive; | ||
538 | u8 disc_timeout; | ||
536 | } debug; | 539 | } debug; |
537 | #endif /* CONFIG_ATH6KL_DEBUG */ | 540 | #endif /* CONFIG_ATH6KL_DEBUG */ |
538 | }; | 541 | }; |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index 41161ca72725..7b1c9aee175e 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c | |||
@@ -1149,6 +1149,95 @@ static const struct file_operations fops_roam_mode = { | |||
1149 | .llseek = default_llseek, | 1149 | .llseek = default_llseek, |
1150 | }; | 1150 | }; |
1151 | 1151 | ||
1152 | void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive) | ||
1153 | { | ||
1154 | ar->debug.keepalive = keepalive; | ||
1155 | } | ||
1156 | |||
1157 | static ssize_t ath6kl_keepalive_read(struct file *file, char __user *user_buf, | ||
1158 | size_t count, loff_t *ppos) | ||
1159 | { | ||
1160 | struct ath6kl *ar = file->private_data; | ||
1161 | char buf[16]; | ||
1162 | int len; | ||
1163 | |||
1164 | len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.keepalive); | ||
1165 | |||
1166 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1167 | } | ||
1168 | |||
1169 | static ssize_t ath6kl_keepalive_write(struct file *file, | ||
1170 | const char __user *user_buf, | ||
1171 | size_t count, loff_t *ppos) | ||
1172 | { | ||
1173 | struct ath6kl *ar = file->private_data; | ||
1174 | int ret; | ||
1175 | u8 val; | ||
1176 | |||
1177 | ret = kstrtou8_from_user(user_buf, count, 0, &val); | ||
1178 | if (ret) | ||
1179 | return ret; | ||
1180 | |||
1181 | ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, val); | ||
1182 | if (ret) | ||
1183 | return ret; | ||
1184 | |||
1185 | return count; | ||
1186 | } | ||
1187 | |||
1188 | static const struct file_operations fops_keepalive = { | ||
1189 | .open = ath6kl_debugfs_open, | ||
1190 | .read = ath6kl_keepalive_read, | ||
1191 | .write = ath6kl_keepalive_write, | ||
1192 | .owner = THIS_MODULE, | ||
1193 | .llseek = default_llseek, | ||
1194 | }; | ||
1195 | |||
1196 | void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout) | ||
1197 | { | ||
1198 | ar->debug.disc_timeout = timeout; | ||
1199 | } | ||
1200 | |||
1201 | static ssize_t ath6kl_disconnect_timeout_read(struct file *file, | ||
1202 | char __user *user_buf, | ||
1203 | size_t count, loff_t *ppos) | ||
1204 | { | ||
1205 | struct ath6kl *ar = file->private_data; | ||
1206 | char buf[16]; | ||
1207 | int len; | ||
1208 | |||
1209 | len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.disc_timeout); | ||
1210 | |||
1211 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1212 | } | ||
1213 | |||
1214 | static ssize_t ath6kl_disconnect_timeout_write(struct file *file, | ||
1215 | const char __user *user_buf, | ||
1216 | size_t count, loff_t *ppos) | ||
1217 | { | ||
1218 | struct ath6kl *ar = file->private_data; | ||
1219 | int ret; | ||
1220 | u8 val; | ||
1221 | |||
1222 | ret = kstrtou8_from_user(user_buf, count, 0, &val); | ||
1223 | if (ret) | ||
1224 | return ret; | ||
1225 | |||
1226 | ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, val); | ||
1227 | if (ret) | ||
1228 | return ret; | ||
1229 | |||
1230 | return count; | ||
1231 | } | ||
1232 | |||
1233 | static const struct file_operations fops_disconnect_timeout = { | ||
1234 | .open = ath6kl_debugfs_open, | ||
1235 | .read = ath6kl_disconnect_timeout_read, | ||
1236 | .write = ath6kl_disconnect_timeout_write, | ||
1237 | .owner = THIS_MODULE, | ||
1238 | .llseek = default_llseek, | ||
1239 | }; | ||
1240 | |||
1152 | int ath6kl_debug_init(struct ath6kl *ar) | 1241 | int ath6kl_debug_init(struct ath6kl *ar) |
1153 | { | 1242 | { |
1154 | ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE); | 1243 | ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE); |
@@ -1216,6 +1305,12 @@ int ath6kl_debug_init(struct ath6kl *ar) | |||
1216 | debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar, | 1305 | debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar, |
1217 | &fops_roam_mode); | 1306 | &fops_roam_mode); |
1218 | 1307 | ||
1308 | debugfs_create_file("keepalive", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar, | ||
1309 | &fops_keepalive); | ||
1310 | |||
1311 | debugfs_create_file("disconnect_timeout", S_IRUSR | S_IWUSR, | ||
1312 | ar->debugfs_phy, ar, &fops_disconnect_timeout); | ||
1313 | |||
1219 | return 0; | 1314 | return 0; |
1220 | } | 1315 | } |
1221 | 1316 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h index f73bf1501990..7d5323d34df7 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.h +++ b/drivers/net/wireless/ath/ath6kl/debug.h | |||
@@ -92,6 +92,8 @@ 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, | 93 | int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf, |
94 | size_t len); | 94 | size_t len); |
95 | void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive); | ||
96 | void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout); | ||
95 | int ath6kl_debug_init(struct ath6kl *ar); | 97 | int ath6kl_debug_init(struct ath6kl *ar); |
96 | void ath6kl_debug_cleanup(struct ath6kl *ar); | 98 | void ath6kl_debug_cleanup(struct ath6kl *ar); |
97 | 99 | ||
@@ -133,6 +135,15 @@ static inline int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, | |||
133 | return 0; | 135 | return 0; |
134 | } | 136 | } |
135 | 137 | ||
138 | static inline void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive) | ||
139 | { | ||
140 | } | ||
141 | |||
142 | static inline void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, | ||
143 | u8 timeout) | ||
144 | { | ||
145 | } | ||
146 | |||
136 | static inline int ath6kl_debug_init(struct ath6kl *ar) | 147 | static inline int ath6kl_debug_init(struct ath6kl *ar) |
137 | { | 148 | { |
138 | return 0; | 149 | return 0; |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 3fb27027c9fa..7b6bfdde119c 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -1940,6 +1940,8 @@ int ath6kl_wmi_disctimeout_cmd(struct wmi *wmi, u8 timeout) | |||
1940 | 1940 | ||
1941 | ret = ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_DISC_TIMEOUT_CMDID, | 1941 | ret = ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_DISC_TIMEOUT_CMDID, |
1942 | NO_SYNC_WMIFLAG); | 1942 | NO_SYNC_WMIFLAG); |
1943 | if (ret == 0) | ||
1944 | ath6kl_debug_set_disconnect_timeout(wmi->parent_dev, timeout); | ||
1943 | return ret; | 1945 | return ret; |
1944 | } | 1946 | } |
1945 | 1947 | ||
@@ -2524,6 +2526,8 @@ int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 keep_alive_intvl) | |||
2524 | 2526 | ||
2525 | ret = ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_KEEPALIVE_CMDID, | 2527 | ret = ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_KEEPALIVE_CMDID, |
2526 | NO_SYNC_WMIFLAG); | 2528 | NO_SYNC_WMIFLAG); |
2529 | if (ret == 0) | ||
2530 | ath6kl_debug_set_keepalive(wmi->parent_dev, keep_alive_intvl); | ||
2527 | return ret; | 2531 | return ret; |
2528 | } | 2532 | } |
2529 | 2533 | ||