aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/debugfs_sta.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/debugfs_sta.c')
-rw-r--r--net/mac80211/debugfs_sta.c84
1 files changed, 6 insertions, 78 deletions
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index b85c4f27b361..a2fbe0131312 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -39,13 +39,6 @@ static const struct file_operations sta_ ##name## _ops = { \
39 .open = mac80211_open_file_generic, \ 39 .open = mac80211_open_file_generic, \
40} 40}
41 41
42#define STA_OPS_WR(name) \
43static const struct file_operations sta_ ##name## _ops = { \
44 .read = sta_##name##_read, \
45 .write = sta_##name##_write, \
46 .open = mac80211_open_file_generic, \
47}
48
49#define STA_FILE(name, field, format) \ 42#define STA_FILE(name, field, format) \
50 STA_READ_##format(name, field) \ 43 STA_READ_##format(name, field) \
51 STA_OPS(name) 44 STA_OPS(name)
@@ -144,7 +137,7 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
144 p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); 137 p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:");
145 for (i = 0; i < STA_TID_NUM; i++) 138 for (i = 0; i < STA_TID_NUM; i++)
146 p += scnprintf(p, sizeof(buf)+buf-p, "%5d", 139 p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
147 sta->ampdu_mlme.tid_state_rx[i]? 140 sta->ampdu_mlme.tid_state_rx[i] ?
148 sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); 141 sta->ampdu_mlme.tid_rx[i]->dialog_token : 0);
149 142
150 p += scnprintf(p, sizeof(buf)+buf-p, "\n TX :"); 143 p += scnprintf(p, sizeof(buf)+buf-p, "\n TX :");
@@ -155,84 +148,20 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
155 p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); 148 p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:");
156 for (i = 0; i < STA_TID_NUM; i++) 149 for (i = 0; i < STA_TID_NUM; i++)
157 p += scnprintf(p, sizeof(buf)+buf-p, "%5d", 150 p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
158 sta->ampdu_mlme.tid_state_tx[i]? 151 sta->ampdu_mlme.tid_state_tx[i] ?
159 sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); 152 sta->ampdu_mlme.tid_tx[i]->dialog_token : 0);
160 153
161 p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :"); 154 p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :");
162 for (i = 0; i < STA_TID_NUM; i++) 155 for (i = 0; i < STA_TID_NUM; i++)
163 p += scnprintf(p, sizeof(buf)+buf-p, "%5d", 156 p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
164 sta->ampdu_mlme.tid_state_tx[i]? 157 sta->ampdu_mlme.tid_state_tx[i] ?
165 sta->ampdu_mlme.tid_tx[i]->ssn : 0); 158 sta->ampdu_mlme.tid_tx[i]->ssn : 0);
166 159
167 p += scnprintf(p, sizeof(buf)+buf-p, "\n"); 160 p += scnprintf(p, sizeof(buf)+buf-p, "\n");
168 161
169 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 162 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
170} 163}
171 164STA_OPS(agg_status);
172static ssize_t sta_agg_status_write(struct file *file,
173 const char __user *user_buf, size_t count, loff_t *ppos)
174{
175 struct sta_info *sta = file->private_data;
176 struct ieee80211_local *local = sta->sdata->local;
177 struct ieee80211_hw *hw = &local->hw;
178 u8 *da = sta->sta.addr;
179 static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0,
180 0, 0, 0, 0, 0, 0, 0, 0};
181 static int tid_static_rx[16] = {1, 1, 1, 1, 1, 1, 1, 1,
182 1, 1, 1, 1, 1, 1, 1, 1};
183 char *endp;
184 char buf[32];
185 int buf_size, rs;
186 unsigned int tid_num;
187 char state[4];
188
189 memset(buf, 0x00, sizeof(buf));
190 buf_size = min(count, (sizeof(buf)-1));
191 if (copy_from_user(buf, user_buf, buf_size))
192 return -EFAULT;
193
194 tid_num = simple_strtoul(buf, &endp, 0);
195 if (endp == buf)
196 return -EINVAL;
197
198 if ((tid_num >= 100) && (tid_num <= 115)) {
199 /* toggle Rx aggregation command */
200 tid_num = tid_num - 100;
201 if (tid_static_rx[tid_num] == 1) {
202 strcpy(state, "off");
203 ieee80211_sta_stop_rx_ba_session(sta->sdata, da, tid_num, 0,
204 WLAN_REASON_QSTA_REQUIRE_SETUP);
205 sta->ampdu_mlme.tid_state_rx[tid_num] |=
206 HT_AGG_STATE_DEBUGFS_CTL;
207 tid_static_rx[tid_num] = 0;
208 } else {
209 strcpy(state, "on ");
210 sta->ampdu_mlme.tid_state_rx[tid_num] &=
211 ~HT_AGG_STATE_DEBUGFS_CTL;
212 tid_static_rx[tid_num] = 1;
213 }
214 printk(KERN_DEBUG "debugfs - try switching tid %u %s\n",
215 tid_num, state);
216 } else if ((tid_num >= 0) && (tid_num <= 15)) {
217 /* toggle Tx aggregation command */
218 if (tid_static_tx[tid_num] == 0) {
219 strcpy(state, "on ");
220 rs = ieee80211_start_tx_ba_session(hw, da, tid_num);
221 if (rs == 0)
222 tid_static_tx[tid_num] = 1;
223 } else {
224 strcpy(state, "off");
225 rs = ieee80211_stop_tx_ba_session(hw, da, tid_num, 1);
226 if (rs == 0)
227 tid_static_tx[tid_num] = 0;
228 }
229 printk(KERN_DEBUG "debugfs - switching tid %u %s, return=%d\n",
230 tid_num, state, rs);
231 }
232
233 return count;
234}
235STA_OPS_WR(agg_status);
236 165
237#define DEBUGFS_ADD(name) \ 166#define DEBUGFS_ADD(name) \
238 sta->debugfs.name = debugfs_create_file(#name, 0400, \ 167 sta->debugfs.name = debugfs_create_file(#name, 0400, \
@@ -246,15 +175,14 @@ STA_OPS_WR(agg_status);
246void ieee80211_sta_debugfs_add(struct sta_info *sta) 175void ieee80211_sta_debugfs_add(struct sta_info *sta)
247{ 176{
248 struct dentry *stations_dir = sta->local->debugfs.stations; 177 struct dentry *stations_dir = sta->local->debugfs.stations;
249 DECLARE_MAC_BUF(mbuf); 178 u8 mac[3*ETH_ALEN];
250 u8 *mac;
251 179
252 sta->debugfs.add_has_run = true; 180 sta->debugfs.add_has_run = true;
253 181
254 if (!stations_dir) 182 if (!stations_dir)
255 return; 183 return;
256 184
257 mac = print_mac(mbuf, sta->sta.addr); 185 snprintf(mac, sizeof(mac), "%pM", sta->sta.addr);
258 186
259 /* 187 /*
260 * This might fail due to a race condition: 188 * This might fail due to a race condition: