26 static struct dentry *mwifiex_dfs_dir;
28 static char *bss_modes[] = {
36 #define item_size(n) (FIELD_SIZEOF(struct mwifiex_debug_info, n))
37 #define item_addr(n) (offsetof(struct mwifiex_debug_info, n))
40 #define adapter_item_size(n) (FIELD_SIZEOF(struct mwifiex_adapter, n))
41 #define adapter_item_addr(n) (offsetof(struct mwifiex_adapter, n))
61 {
"max_tx_buf_size",
item_size(max_tx_buf_size),
65 {
"curr_tx_buf_size",
item_size(curr_tx_buf_size),
71 {
"is_deep_sleep",
item_size(is_deep_sleep),
73 {
"wakeup_dev_req",
item_size(pm_wakeup_card_req),
75 {
"wakeup_tries",
item_size(pm_wakeup_fw_try),
77 {
"hs_configured",
item_size(is_hs_configured),
81 {
"num_tx_timeout",
item_size(num_tx_timeout),
83 {
"num_cmd_timeout",
item_size(num_cmd_timeout),
85 {
"timeout_cmd_id",
item_size(timeout_cmd_id),
87 {
"timeout_cmd_act",
item_size(timeout_cmd_act),
93 {
"last_cmd_index",
item_size(last_cmd_index),
95 {
"last_cmd_resp_id",
item_size(last_cmd_resp_id),
97 {
"last_cmd_resp_index",
item_size(last_cmd_resp_index),
101 {
"last_event_index",
item_size(last_event_index),
103 {
"num_cmd_h2c_fail",
item_size(num_cmd_host_to_card_failure),
104 item_addr(num_cmd_host_to_card_failure), 1},
105 {
"num_cmd_sleep_cfm_fail",
106 item_size(num_cmd_sleep_cfm_host_to_card_failure),
107 item_addr(num_cmd_sleep_cfm_host_to_card_failure), 1},
108 {
"num_tx_h2c_fail",
item_size(num_tx_host_to_card_failure),
109 item_addr(num_tx_host_to_card_failure), 1},
110 {
"num_evt_deauth",
item_size(num_event_deauth),
112 {
"num_evt_disassoc",
item_size(num_event_disassoc),
114 {
"num_evt_link_lost",
item_size(num_event_link_lost),
116 {
"num_cmd_deauth",
item_size(num_cmd_deauth),
118 {
"num_cmd_assoc_ok",
item_size(num_cmd_assoc_success),
120 {
"num_cmd_assoc_fail",
item_size(num_cmd_assoc_failure),
126 {
"cmd_resp_received",
item_size(cmd_resp_received),
128 {
"event_received",
item_size(event_received),
174 mwifiex_info_read(
struct file *
file,
char __user *ubuf,
175 size_t count, loff_t *ppos)
200 p +=
sprintf(p,
"driver_name = " "\"mwifiex\"\n");
203 p +=
sprintf(p,
"\ninterface_name=\"%s\"\n", netdev->name);
204 p +=
sprintf(p,
"bss_mode=\"%s\"\n", bss_modes[
info.bss_mode]);
205 p +=
sprintf(p,
"media_state=\"%s\"\n",
207 p +=
sprintf(p,
"mac_address=\"%pM\"\n", netdev->dev_addr);
210 p +=
sprintf(p,
"multicast_count=\"%d\"\n",
214 p +=
sprintf(p,
"channel=\"%d\"\n", (
int)
info.bss_chan);
215 p +=
sprintf(p,
"country_code = \"%s\"\n",
info.country_code);
218 p +=
sprintf(p, "multicast_address[%
d]=\"%pM\"\
n",
230 p +=
sprintf(p, "carrier %
s\n", ((netif_carrier_ok(priv->netdev))
236 (
unsigned long) p - page);
263 mwifiex_getlog_read(
struct file *file,
char __user *ubuf,
264 size_t count, loff_t *ppos)
269 char *p = (
char *) page;
294 "wepicverrcnt-1 %u\n"
295 "wepicverrcnt-2 %u\n"
296 "wepicverrcnt-3 %u\n"
297 "wepicverrcnt-4 %u\n",
298 stats.mcast_tx_frame,
307 stats.mcast_rx_frame,
310 stats.wep_icv_error[0],
311 stats.wep_icv_error[1],
312 stats.wep_icv_error[2],
313 stats.wep_icv_error[3]);
317 (
unsigned long) p - page);
374 mwifiex_debug_read(
struct file *file,
char __user *ubuf,
375 size_t count, loff_t *ppos)
381 char *p = (
char *) page;
394 for (i = 0; i < num_of_items; i++) {
397 size =
d[
i].size /
d[
i].num;
399 if (i < (num_of_items - 3))
404 for (j = 0; j <
d[
i].num; j++) {
407 val = *((
u8 *) addr);
410 val = *((
u16 *) addr);
413 val = *((
u32 *) addr);
416 val = *((
long long *) addr);
430 if (
info.tx_tbl_num) {
431 p +=
sprintf(p,
"Tx BA stream table:\n");
432 for (i = 0; i <
info.tx_tbl_num; i++)
433 p +=
sprintf(p,
"tid = %d, ra = %pM\n",
434 info.tx_tbl[i].tid,
info.tx_tbl[i].ra);
437 if (
info.rx_tbl_num) {
438 p +=
sprintf(p,
"Rx reorder table:\n");
439 for (i = 0; i <
info.rx_tbl_num; i++) {
440 p +=
sprintf(p,
"tid = %d, ta = %pM, "
442 "win_size = %d, buffer: ",
445 info.rx_tbl[i].start_win,
446 info.rx_tbl[i].win_size);
448 for (j = 0; j <
info.rx_tbl[
i].win_size; j++)
450 info.rx_tbl[i].buffer[j] ?
458 (
unsigned long) p - page);
465 static u32 saved_reg_type, saved_reg_offset, saved_reg_value;
475 mwifiex_regrdwr_write(
struct file *file,
476 const char __user *ubuf,
size_t count, loff_t *ppos)
479 char *
buf = (
char *) addr;
482 u32 reg_type = 0, reg_offset = 0, reg_value =
UINT_MAX;
493 sscanf(buf,
"%u %x %x", ®_type, ®_offset, ®_value);
495 if (reg_type == 0 || reg_offset == 0) {
499 saved_reg_type = reg_type;
500 saved_reg_offset = reg_offset;
501 saved_reg_value = reg_value;
517 mwifiex_regrdwr_read(
struct file *file,
char __user *ubuf,
518 size_t count, loff_t *ppos)
523 char *buf = (
char *) addr;
524 int pos = 0, ret = 0;
530 if (!saved_reg_type) {
541 saved_reg_type, saved_reg_offset,
550 saved_reg_offset, ®_value);
557 saved_reg_offset, reg_value);
566 static u32 saved_offset = -1, saved_bytes = -1;
576 mwifiex_rdeeprom_write(
struct file *file,
577 const char __user *ubuf,
size_t count, loff_t *ppos)
580 char *buf = (
char *) addr;
596 if (offset == -1 ||
bytes == -1) {
617 mwifiex_rdeeprom_read(
struct file *file,
char __user *ubuf,
618 size_t count, loff_t *ppos)
623 char *buf = (
char *) addr;
624 int pos = 0, ret = 0,
i;
630 if (saved_offset == -1) {
638 (
u16) saved_bytes, value);
646 for (i = 0; i < saved_bytes; i++)
657 #define MWIFIEX_DFS_ADD_FILE(name) do { \
658 if (!debugfs_create_file(#name, 0644, priv->dfs_dev_dir, \
659 priv, &mwifiex_dfs_##name##_fops)) \
663 #define MWIFIEX_DFS_FILE_OPS(name) \
664 static const struct file_operations mwifiex_dfs_##name##_fops = { \
665 .read = mwifiex_##name##_read, \
666 .write = mwifiex_##name##_write, \
667 .open = simple_open, \
670 #define MWIFIEX_DFS_FILE_READ_OPS(name) \
671 static const struct file_operations mwifiex_dfs_##name##_fops = { \
672 .read = mwifiex_##name##_read, \
673 .open = simple_open, \
676 #define MWIFIEX_DFS_FILE_WRITE_OPS(name) \
677 static const struct file_operations mwifiex_dfs_##name##_fops = { \
678 .write = mwifiex_##name##_write, \
679 .open = simple_open, \
695 if (!mwifiex_dfs_dir || !priv)
701 if (!priv->dfs_dev_dir)
729 if (!mwifiex_dfs_dir)