aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath6kl/debug.c114
1 files changed, 69 insertions, 45 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index eb808b46f94c..d832058816fe 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -54,9 +54,42 @@ int ath6kl_printk(const char *level, const char *fmt, ...)
54 54
55 return rtn; 55 return rtn;
56} 56}
57EXPORT_SYMBOL(ath6kl_printk);
57 58
58#ifdef CONFIG_ATH6KL_DEBUG 59#ifdef CONFIG_ATH6KL_DEBUG
59 60
61void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
62{
63 struct va_format vaf;
64 va_list args;
65
66 if (!(debug_mask & mask))
67 return;
68
69 va_start(args, fmt);
70
71 vaf.fmt = fmt;
72 vaf.va = &args;
73
74 ath6kl_printk(KERN_DEBUG, "%pV", &vaf);
75
76 va_end(args);
77}
78EXPORT_SYMBOL(ath6kl_dbg);
79
80void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
81 const char *msg, const char *prefix,
82 const void *buf, size_t len)
83{
84 if (debug_mask & mask) {
85 if (msg)
86 ath6kl_dbg(mask, "%s\n", msg);
87
88 print_hex_dump_bytes(prefix, DUMP_PREFIX_OFFSET, buf, len);
89 }
90}
91EXPORT_SYMBOL(ath6kl_dbg_dump);
92
60#define REG_OUTPUT_LEN_PER_LINE 25 93#define REG_OUTPUT_LEN_PER_LINE 25
61#define REGTYPE_STR_LEN 100 94#define REGTYPE_STR_LEN 100
62 95
@@ -82,31 +115,31 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
82 struct ath6kl_irq_enable_reg *irq_enable_reg) 115 struct ath6kl_irq_enable_reg *irq_enable_reg)
83{ 116{
84 117
85 ath6kl_dbg(ATH6KL_DBG_ANY, ("<------- Register Table -------->\n")); 118 ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n"));
86 119
87 if (irq_proc_reg != NULL) { 120 if (irq_proc_reg != NULL) {
88 ath6kl_dbg(ATH6KL_DBG_ANY, 121 ath6kl_dbg(ATH6KL_DBG_IRQ,
89 "Host Int status: 0x%x\n", 122 "Host Int status: 0x%x\n",
90 irq_proc_reg->host_int_status); 123 irq_proc_reg->host_int_status);
91 ath6kl_dbg(ATH6KL_DBG_ANY, 124 ath6kl_dbg(ATH6KL_DBG_IRQ,
92 "CPU Int status: 0x%x\n", 125 "CPU Int status: 0x%x\n",
93 irq_proc_reg->cpu_int_status); 126 irq_proc_reg->cpu_int_status);
94 ath6kl_dbg(ATH6KL_DBG_ANY, 127 ath6kl_dbg(ATH6KL_DBG_IRQ,
95 "Error Int status: 0x%x\n", 128 "Error Int status: 0x%x\n",
96 irq_proc_reg->error_int_status); 129 irq_proc_reg->error_int_status);
97 ath6kl_dbg(ATH6KL_DBG_ANY, 130 ath6kl_dbg(ATH6KL_DBG_IRQ,
98 "Counter Int status: 0x%x\n", 131 "Counter Int status: 0x%x\n",
99 irq_proc_reg->counter_int_status); 132 irq_proc_reg->counter_int_status);
100 ath6kl_dbg(ATH6KL_DBG_ANY, 133 ath6kl_dbg(ATH6KL_DBG_IRQ,
101 "Mbox Frame: 0x%x\n", 134 "Mbox Frame: 0x%x\n",
102 irq_proc_reg->mbox_frame); 135 irq_proc_reg->mbox_frame);
103 ath6kl_dbg(ATH6KL_DBG_ANY, 136 ath6kl_dbg(ATH6KL_DBG_IRQ,
104 "Rx Lookahead Valid: 0x%x\n", 137 "Rx Lookahead Valid: 0x%x\n",
105 irq_proc_reg->rx_lkahd_valid); 138 irq_proc_reg->rx_lkahd_valid);
106 ath6kl_dbg(ATH6KL_DBG_ANY, 139 ath6kl_dbg(ATH6KL_DBG_IRQ,
107 "Rx Lookahead 0: 0x%x\n", 140 "Rx Lookahead 0: 0x%x\n",
108 irq_proc_reg->rx_lkahd[0]); 141 irq_proc_reg->rx_lkahd[0]);
109 ath6kl_dbg(ATH6KL_DBG_ANY, 142 ath6kl_dbg(ATH6KL_DBG_IRQ,
110 "Rx Lookahead 1: 0x%x\n", 143 "Rx Lookahead 1: 0x%x\n",
111 irq_proc_reg->rx_lkahd[1]); 144 irq_proc_reg->rx_lkahd[1]);
112 145
@@ -115,16 +148,16 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
115 * If the target supports GMBOX hardware, dump some 148 * If the target supports GMBOX hardware, dump some
116 * additional state. 149 * additional state.
117 */ 150 */
118 ath6kl_dbg(ATH6KL_DBG_ANY, 151 ath6kl_dbg(ATH6KL_DBG_IRQ,
119 "GMBOX Host Int status 2: 0x%x\n", 152 "GMBOX Host Int status 2: 0x%x\n",
120 irq_proc_reg->host_int_status2); 153 irq_proc_reg->host_int_status2);
121 ath6kl_dbg(ATH6KL_DBG_ANY, 154 ath6kl_dbg(ATH6KL_DBG_IRQ,
122 "GMBOX RX Avail: 0x%x\n", 155 "GMBOX RX Avail: 0x%x\n",
123 irq_proc_reg->gmbox_rx_avail); 156 irq_proc_reg->gmbox_rx_avail);
124 ath6kl_dbg(ATH6KL_DBG_ANY, 157 ath6kl_dbg(ATH6KL_DBG_IRQ,
125 "GMBOX lookahead alias 0: 0x%x\n", 158 "GMBOX lookahead alias 0: 0x%x\n",
126 irq_proc_reg->rx_gmbox_lkahd_alias[0]); 159 irq_proc_reg->rx_gmbox_lkahd_alias[0]);
127 ath6kl_dbg(ATH6KL_DBG_ANY, 160 ath6kl_dbg(ATH6KL_DBG_IRQ,
128 "GMBOX lookahead alias 1: 0x%x\n", 161 "GMBOX lookahead alias 1: 0x%x\n",
129 irq_proc_reg->rx_gmbox_lkahd_alias[1]); 162 irq_proc_reg->rx_gmbox_lkahd_alias[1]);
130 } 163 }
@@ -132,13 +165,13 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
132 } 165 }
133 166
134 if (irq_enable_reg != NULL) { 167 if (irq_enable_reg != NULL) {
135 ath6kl_dbg(ATH6KL_DBG_ANY, 168 ath6kl_dbg(ATH6KL_DBG_IRQ,
136 "Int status Enable: 0x%x\n", 169 "Int status Enable: 0x%x\n",
137 irq_enable_reg->int_status_en); 170 irq_enable_reg->int_status_en);
138 ath6kl_dbg(ATH6KL_DBG_ANY, "Counter Int status Enable: 0x%x\n", 171 ath6kl_dbg(ATH6KL_DBG_IRQ, "Counter Int status Enable: 0x%x\n",
139 irq_enable_reg->cntr_int_status_en); 172 irq_enable_reg->cntr_int_status_en);
140 } 173 }
141 ath6kl_dbg(ATH6KL_DBG_ANY, "<------------------------------->\n"); 174 ath6kl_dbg(ATH6KL_DBG_IRQ, "<------------------------------->\n");
142} 175}
143 176
144static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist) 177static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
@@ -175,9 +208,6 @@ void dump_cred_dist_stats(struct htc_target *target)
175{ 208{
176 struct htc_endpoint_credit_dist *ep_list; 209 struct htc_endpoint_credit_dist *ep_list;
177 210
178 if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_CREDIT))
179 return;
180
181 list_for_each_entry(ep_list, &target->cred_dist_list, list) 211 list_for_each_entry(ep_list, &target->cred_dist_list, list)
182 dump_cred_dist(ep_list); 212 dump_cred_dist(ep_list);
183 213
@@ -1411,6 +1441,8 @@ static ssize_t ath6kl_create_qos_write(struct file *file,
1411 return -EINVAL; 1441 return -EINVAL;
1412 pstream.medium_time = cpu_to_le32(val32); 1442 pstream.medium_time = cpu_to_le32(val32);
1413 1443
1444 pstream.nominal_phy = le32_to_cpu(pstream.min_phy_rate) / 1000000;
1445
1414 ath6kl_wmi_create_pstream_cmd(ar->wmi, vif->fw_vif_idx, &pstream); 1446 ath6kl_wmi_create_pstream_cmd(ar->wmi, vif->fw_vif_idx, &pstream);
1415 1447
1416 return count; 1448 return count;
@@ -1505,57 +1537,46 @@ static const struct file_operations fops_bgscan_int = {
1505}; 1537};
1506 1538
1507static ssize_t ath6kl_listen_int_write(struct file *file, 1539static ssize_t ath6kl_listen_int_write(struct file *file,
1508 const char __user *user_buf, 1540 const char __user *user_buf,
1509 size_t count, loff_t *ppos) 1541 size_t count, loff_t *ppos)
1510{ 1542{
1511 struct ath6kl *ar = file->private_data; 1543 struct ath6kl *ar = file->private_data;
1512 u16 listen_int_t, listen_int_b; 1544 struct ath6kl_vif *vif;
1545 u16 listen_interval;
1513 char buf[32]; 1546 char buf[32];
1514 char *sptr, *token;
1515 ssize_t len; 1547 ssize_t len;
1516 1548
1549 vif = ath6kl_vif_first(ar);
1550 if (!vif)
1551 return -EIO;
1552
1517 len = min(count, sizeof(buf) - 1); 1553 len = min(count, sizeof(buf) - 1);
1518 if (copy_from_user(buf, user_buf, len)) 1554 if (copy_from_user(buf, user_buf, len))
1519 return -EFAULT; 1555 return -EFAULT;
1520 1556
1521 buf[len] = '\0'; 1557 buf[len] = '\0';
1522 sptr = buf; 1558 if (kstrtou16(buf, 0, &listen_interval))
1523
1524 token = strsep(&sptr, " ");
1525 if (!token)
1526 return -EINVAL;
1527
1528 if (kstrtou16(token, 0, &listen_int_t))
1529 return -EINVAL;
1530
1531 if (kstrtou16(sptr, 0, &listen_int_b))
1532 return -EINVAL;
1533
1534 if ((listen_int_t < 15) || (listen_int_t > 5000))
1535 return -EINVAL; 1559 return -EINVAL;
1536 1560
1537 if ((listen_int_b < 1) || (listen_int_b > 50)) 1561 if ((listen_interval < 1) || (listen_interval > 50))
1538 return -EINVAL; 1562 return -EINVAL;
1539 1563
1540 ar->listen_intvl_t = listen_int_t; 1564 ar->listen_intvl_b = listen_interval;
1541 ar->listen_intvl_b = listen_int_b; 1565 ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, 0,
1542
1543 ath6kl_wmi_listeninterval_cmd(ar->wmi, 0, ar->listen_intvl_t,
1544 ar->listen_intvl_b); 1566 ar->listen_intvl_b);
1545 1567
1546 return count; 1568 return count;
1547} 1569}
1548 1570
1549static ssize_t ath6kl_listen_int_read(struct file *file, 1571static ssize_t ath6kl_listen_int_read(struct file *file,
1550 char __user *user_buf, 1572 char __user *user_buf,
1551 size_t count, loff_t *ppos) 1573 size_t count, loff_t *ppos)
1552{ 1574{
1553 struct ath6kl *ar = file->private_data; 1575 struct ath6kl *ar = file->private_data;
1554 char buf[32]; 1576 char buf[32];
1555 int len; 1577 int len;
1556 1578
1557 len = scnprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t, 1579 len = scnprintf(buf, sizeof(buf), "%u\n", ar->listen_intvl_b);
1558 ar->listen_intvl_b);
1559 1580
1560 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1581 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1561} 1582}
@@ -1710,6 +1731,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
1710 debugfs_create_file("bgscan_interval", S_IWUSR, 1731 debugfs_create_file("bgscan_interval", S_IWUSR,
1711 ar->debugfs_phy, ar, &fops_bgscan_int); 1732 ar->debugfs_phy, ar, &fops_bgscan_int);
1712 1733
1734 debugfs_create_file("listen_interval", S_IRUSR | S_IWUSR,
1735 ar->debugfs_phy, ar, &fops_listen_int);
1736
1713 debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar, 1737 debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
1714 &fops_power_params); 1738 &fops_power_params);
1715 1739