aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c73
1 files changed, 44 insertions, 29 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 23632e54aab2..0f16f2606f29 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -102,10 +102,14 @@ static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
102 struct iwl_priv *priv = (struct iwl_priv *)file->private_data; 102 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
103 char buf[256]; 103 char buf[256];
104 int pos = 0; 104 int pos = 0;
105 const size_t bufsz = sizeof(buf);
105 106
106 pos += sprintf(buf+pos, "mgmt: %u\n", priv->tx_stats[0].cnt); 107 pos += scnprintf(buf + pos, bufsz - pos, "mgmt: %u\n",
107 pos += sprintf(buf+pos, "ctrl: %u\n", priv->tx_stats[1].cnt); 108 priv->tx_stats[0].cnt);
108 pos += sprintf(buf+pos, "data: %u\n", priv->tx_stats[2].cnt); 109 pos += scnprintf(buf + pos, bufsz - pos, "ctrl: %u\n",
110 priv->tx_stats[1].cnt);
111 pos += scnprintf(buf + pos, bufsz - pos, "data: %u\n",
112 priv->tx_stats[2].cnt);
109 113
110 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 114 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
111} 115}
@@ -117,10 +121,14 @@ static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file,
117 struct iwl_priv *priv = (struct iwl_priv *)file->private_data; 121 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
118 char buf[256]; 122 char buf[256];
119 int pos = 0; 123 int pos = 0;
124 const size_t bufsz = sizeof(buf);
120 125
121 pos += sprintf(buf+pos, "mgmt: %u\n", priv->rx_stats[0].cnt); 126 pos += scnprintf(buf + pos, bufsz - pos, "mgmt: %u\n",
122 pos += sprintf(buf+pos, "ctrl: %u\n", priv->rx_stats[1].cnt); 127 priv->rx_stats[0].cnt);
123 pos += sprintf(buf+pos, "data: %u\n", priv->rx_stats[2].cnt); 128 pos += scnprintf(buf + pos, bufsz - pos, "ctrl: %u\n",
129 priv->rx_stats[1].cnt);
130 pos += scnprintf(buf + pos, bufsz - pos, "data: %u\n",
131 priv->rx_stats[2].cnt);
124 132
125 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 133 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
126} 134}
@@ -138,6 +146,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
138 int i; 146 int i;
139 int pos = 0; 147 int pos = 0;
140 struct iwl_priv *priv = (struct iwl_priv *)file->private_data; 148 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
149 const size_t bufsz = sizeof(buf);
141 150
142 printk(KERN_DEBUG "offset is: 0x%x\tlen is: 0x%x\n", 151 printk(KERN_DEBUG "offset is: 0x%x\tlen is: 0x%x\n",
143 priv->dbgfs->sram_offset, priv->dbgfs->sram_len); 152 priv->dbgfs->sram_offset, priv->dbgfs->sram_len);
@@ -159,9 +168,9 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
159 break; 168 break;
160 } 169 }
161 } 170 }
162 pos += sprintf(buf+pos, "0x%08x ", val); 171 pos += scnprintf(buf + pos, bufsz - pos, "0x%08x ", val);
163 } 172 }
164 pos += sprintf(buf+pos, "\n"); 173 pos += scnprintf(buf + pos, bufsz - pos, "\n");
165 iwl_release_nic_access(priv); 174 iwl_release_nic_access(priv);
166 175
167 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 176 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
@@ -198,7 +207,7 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
198{ 207{
199 struct iwl_priv *priv = (struct iwl_priv *)file->private_data; 208 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
200 struct iwl4965_station_entry *station; 209 struct iwl4965_station_entry *station;
201 int max_sta = priv->hw_setting.max_stations; 210 int max_sta = priv->hw_params.max_stations;
202 char *buf; 211 char *buf;
203 int i, j, pos = 0; 212 int i, j, pos = 0;
204 ssize_t ret; 213 ssize_t ret;
@@ -210,44 +219,50 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
210 if(!buf) 219 if(!buf)
211 return -ENOMEM; 220 return -ENOMEM;
212 221
213 pos += sprintf(buf+pos, "num of stations: %d\n\n", 222 pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n",
214 priv->num_stations); 223 priv->num_stations);
215 224
216 for (i = 0; i < max_sta; i++) { 225 for (i = 0; i < max_sta; i++) {
217 station = &priv->stations[i]; 226 station = &priv->stations[i];
218 if (station->used) { 227 if (station->used) {
219 pos += sprintf(buf+pos, "station %d:\ngeneral data:\n", 228 pos += scnprintf(buf + pos, bufsz - pos,
220 i+1); 229 "station %d:\ngeneral data:\n", i+1);
221 print_mac(mac, station->sta.sta.addr); 230 print_mac(mac, station->sta.sta.addr);
222 pos += sprintf(buf+pos, "id: %u\n", 231 pos += scnprintf(buf + pos, bufsz - pos, "id: %u\n",
223 station->sta.sta.sta_id); 232 station->sta.sta.sta_id);
224 pos += sprintf(buf+pos, "mode: %u\n", 233 pos += scnprintf(buf + pos, bufsz - pos, "mode: %u\n",
225 station->sta.mode); 234 station->sta.mode);
226 pos += sprintf(buf+pos, "flags: 0x%x\n", 235 pos += scnprintf(buf + pos, bufsz - pos,
236 "flags: 0x%x\n",
227 station->sta.station_flags_msk); 237 station->sta.station_flags_msk);
228 pos += sprintf(buf+pos, "ps_status: %u\n", 238 pos += scnprintf(buf + pos, bufsz - pos,
229 station->ps_status); 239 "ps_status: %u\n", station->ps_status);
230 240 pos += scnprintf(buf + pos, bufsz - pos, "tid data:\n");
231 pos += sprintf(buf+pos, "tid data:\n"); 241 pos += scnprintf(buf + pos, bufsz - pos,
232 242 "seq_num\t\ttxq_id\t");
233 pos += sprintf(buf+pos, "seq_num\t\ttxq_id\t"); 243 pos += scnprintf(buf + pos, bufsz - pos,
234 pos += sprintf(buf+pos, "frame_count\twait_for_ba\t"); 244 "frame_count\twait_for_ba\t");
235 pos += sprintf(buf+pos, "start_idx\tbitmap0\t"); 245 pos += scnprintf(buf + pos, bufsz - pos,
236 pos += sprintf(buf+pos, "bitmap1\trate_n_flags\n"); 246 "start_idx\tbitmap0\t");
247 pos += scnprintf(buf + pos, bufsz - pos,
248 "bitmap1\trate_n_flags\n");
237 249
238 for (j = 0; j < MAX_TID_COUNT; j++) { 250 for (j = 0; j < MAX_TID_COUNT; j++) {
239 pos += sprintf(buf+pos, "[%d]:\t\t%u\t", 251 pos += scnprintf(buf + pos, bufsz - pos,
240 j, station->tid[j].seq_number); 252 "[%d]:\t\t%u\t", j,
241 pos += sprintf(buf+pos, "%u\t\t%u\t\t%u\t\t", 253 station->tid[j].seq_number);
254 pos += scnprintf(buf + pos, bufsz - pos,
255 "%u\t\t%u\t\t%u\t\t",
242 station->tid[j].agg.txq_id, 256 station->tid[j].agg.txq_id,
243 station->tid[j].agg.frame_count, 257 station->tid[j].agg.frame_count,
244 station->tid[j].agg.wait_for_ba); 258 station->tid[j].agg.wait_for_ba);
245 pos += sprintf(buf+pos, "%u\t%llu\t%u\n", 259 pos += scnprintf(buf + pos, bufsz - pos,
260 "%u\t%llu\t%u\n",
246 station->tid[j].agg.start_idx, 261 station->tid[j].agg.start_idx,
247 (unsigned long long)station->tid[j].agg.bitmap, 262 (unsigned long long)station->tid[j].agg.bitmap,
248 station->tid[j].agg.rate_n_flags); 263 station->tid[j].agg.rate_n_flags);
249 } 264 }
250 pos += sprintf(buf+pos, "\n"); 265 pos += scnprintf(buf + pos, bufsz - pos, "\n");
251 } 266 }
252 } 267 }
253 268