diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-28 15:49:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-28 15:49:40 -0500 |
commit | 0191b625ca5a46206d2fb862bb08f36f2fcb3b31 (patch) | |
tree | 454d1842b1833d976da62abcbd5c47521ebe9bd7 /net/mac80211/debugfs_sta.c | |
parent | 54a696bd07c14d3b1192d03ce7269bc59b45209a (diff) | |
parent | eb56092fc168bf5af199d47af50c0d84a96db898 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1429 commits)
net: Allow dependancies of FDDI & Tokenring to be modular.
igb: Fix build warning when DCA is disabled.
net: Fix warning fallout from recent NAPI interface changes.
gro: Fix potential use after free
sfc: If AN is enabled, always read speed/duplex from the AN advertising bits
sfc: When disabling the NIC, close the device rather than unregistering it
sfc: SFT9001: Add cable diagnostics
sfc: Add support for multiple PHY self-tests
sfc: Merge top-level functions for self-tests
sfc: Clean up PHY mode management in loopback self-test
sfc: Fix unreliable link detection in some loopback modes
sfc: Generate unique names for per-NIC workqueues
802.3ad: use standard ethhdr instead of ad_header
802.3ad: generalize out mac address initializer
802.3ad: initialize ports LACPDU from const initializer
802.3ad: remove typedef around ad_system
802.3ad: turn ports is_individual into a bool
802.3ad: turn ports is_enabled into a bool
802.3ad: make ntt bool
ixgbe: Fix set_ringparam in ixgbe to use the same memory pools.
...
Fixed trivial IPv4/6 address printing conflicts in fs/cifs/connect.c due
to the conversion to %pI (in this networking merge) and the addition of
doing IPv6 addresses (from the earlier merge of CIFS).
Diffstat (limited to 'net/mac80211/debugfs_sta.c')
-rw-r--r-- | net/mac80211/debugfs_sta.c | 84 |
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) \ | ||
43 | static 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 | 164 | STA_OPS(agg_status); | |
172 | static 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 | } | ||
235 | STA_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); | |||
246 | void ieee80211_sta_debugfs_add(struct sta_info *sta) | 175 | void 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: |