mac80211: reduce stack usage in sta_agg_status_read()
authorPavel Roskin <proski@gnu.org>
Sun, 31 Jan 2010 00:55:27 +0000 (19:55 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 1 Feb 2010 20:40:07 +0000 (15:40 -0500)
Use a more compact and readable format for "agg_status" to reduce the
stack frame to less than 1024 bytes.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/debugfs_sta.c

index 84865e7ef13bcfd1eb5cadd7d47ebcfa930b2135..d92800bb2d2f4c0ec2cfe3333548e992aee1fb8c 100644 (file)
@@ -120,36 +120,38 @@ STA_OPS(last_seq_ctrl);
 static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
                                        size_t count, loff_t *ppos)
 {
-       char buf[30 + STA_TID_NUM * 70], *p = buf;
+       char buf[64 + STA_TID_NUM * 40], *p = buf;
        int i;
        struct sta_info *sta = file->private_data;
 
        spin_lock_bh(&sta->lock);
-       p += scnprintf(p, sizeof(buf)+buf-p, "next dialog_token is %#02x\n",
+       p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n",
                        sta->ampdu_mlme.dialog_token_allocator + 1);
+       p += scnprintf(p, sizeof(buf) + buf - p,
+                      "TID\t\tRX\tDTKN\tSSN\t\tTX\tDTKN\tSSN\tpending\n");
        for (i = 0; i < STA_TID_NUM; i++) {
-               p += scnprintf(p, sizeof(buf)+buf-p, "TID %02d:", i);
-               p += scnprintf(p, sizeof(buf)+buf-p, " RX=%x",
+               p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i);
+               p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x",
                                sta->ampdu_mlme.tid_state_rx[i]);
-               p += scnprintf(p, sizeof(buf)+buf-p, "/DTKN=%#.2x",
+               p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x",
                                sta->ampdu_mlme.tid_state_rx[i] ?
                                sta->ampdu_mlme.tid_rx[i]->dialog_token : 0);
-               p += scnprintf(p, sizeof(buf)+buf-p, "/SSN=%#.3x",
+               p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x",
                                sta->ampdu_mlme.tid_state_rx[i] ?
                                sta->ampdu_mlme.tid_rx[i]->ssn : 0);
 
-               p += scnprintf(p, sizeof(buf)+buf-p, " TX=%x",
+               p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x",
                                sta->ampdu_mlme.tid_state_tx[i]);
-               p += scnprintf(p, sizeof(buf)+buf-p, "/DTKN=%#.2x",
+               p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x",
                                sta->ampdu_mlme.tid_state_tx[i] ?
                                sta->ampdu_mlme.tid_tx[i]->dialog_token : 0);
-               p += scnprintf(p, sizeof(buf)+buf-p, "/SSN=%#.3x",
+               p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x",
                                sta->ampdu_mlme.tid_state_tx[i] ?
                                sta->ampdu_mlme.tid_tx[i]->ssn : 0);
-               p += scnprintf(p, sizeof(buf)+buf-p, "/pending=%03d",
+               p += scnprintf(p, sizeof(buf) + buf - p, "\t%03d",
                                sta->ampdu_mlme.tid_state_tx[i] ?
                                skb_queue_len(&sta->ampdu_mlme.tid_tx[i]->pending) : 0);
-               p += scnprintf(p, sizeof(buf)+buf-p, "\n");
+               p += scnprintf(p, sizeof(buf) + buf - p, "\n");
        }
        spin_unlock_bh(&sta->lock);