Commit db2e6bd4e966a36c6b2f1921feb3537e8254415c

Authored by Johannes Berg
Committed by John W. Linville
1 parent 3b319aae42

mac80211: add queue debugfs file

I suspect that some driver bugs can cause queues to be
stopped while they shouldn't be, but it's hard to find
out whether that is the case or not without having any
visible information about the queues. This adds a file
to debugfs that allows us to see the queues' statuses.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 2 changed files with 26 additions and 0 deletions Side-by-side Diff

net/mac80211/debugfs.c
... ... @@ -163,6 +163,29 @@
163 163 .open = mac80211_open_file_generic
164 164 };
165 165  
  166 +static ssize_t queues_read(struct file *file, char __user *user_buf,
  167 + size_t count, loff_t *ppos)
  168 +{
  169 + struct ieee80211_local *local = file->private_data;
  170 + unsigned long flags;
  171 + char buf[IEEE80211_MAX_QUEUES * 20];
  172 + int q, res = 0;
  173 +
  174 + spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
  175 + for (q = 0; q < local->hw.queues; q++)
  176 + res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q,
  177 + local->queue_stop_reasons[q],
  178 + __netif_subqueue_stopped(local->mdev, q));
  179 + spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  180 +
  181 + return simple_read_from_buffer(user_buf, count, ppos, buf, res);
  182 +}
  183 +
  184 +static const struct file_operations queues_ops = {
  185 + .read = queues_read,
  186 + .open = mac80211_open_file_generic
  187 +};
  188 +
166 189 /* statistics stuff */
167 190  
168 191 #define DEBUGFS_STATS_FILE(name, buflen, fmt, value...) \
... ... @@ -298,6 +321,7 @@
298 321 DEBUGFS_ADD(total_ps_buffered);
299 322 DEBUGFS_ADD(wep_iv);
300 323 DEBUGFS_ADD(tsf);
  324 + DEBUGFS_ADD(queues);
301 325 DEBUGFS_ADD_MODE(reset, 0200);
302 326 DEBUGFS_ADD(noack);
303 327  
... ... @@ -350,6 +374,7 @@
350 374 DEBUGFS_DEL(total_ps_buffered);
351 375 DEBUGFS_DEL(wep_iv);
352 376 DEBUGFS_DEL(tsf);
  377 + DEBUGFS_DEL(queues);
353 378 DEBUGFS_DEL(reset);
354 379 DEBUGFS_DEL(noack);
355 380  
net/mac80211/ieee80211_i.h
... ... @@ -783,6 +783,7 @@
783 783 struct dentry *total_ps_buffered;
784 784 struct dentry *wep_iv;
785 785 struct dentry *tsf;
  786 + struct dentry *queues;
786 787 struct dentry *reset;
787 788 struct dentry *noack;
788 789 struct dentry *statistics;