diff options
Diffstat (limited to 'net/mac80211/debugfs_netdev.c')
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 117 |
1 files changed, 26 insertions, 91 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 2ad504fc3414..c54219301724 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -41,29 +41,6 @@ static ssize_t ieee80211_if_read( | |||
41 | return ret; | 41 | return ret; |
42 | } | 42 | } |
43 | 43 | ||
44 | #ifdef CONFIG_MAC80211_MESH | ||
45 | static ssize_t ieee80211_if_write( | ||
46 | struct ieee80211_sub_if_data *sdata, | ||
47 | char const __user *userbuf, | ||
48 | size_t count, loff_t *ppos, | ||
49 | int (*format)(struct ieee80211_sub_if_data *, char *)) | ||
50 | { | ||
51 | char buf[10]; | ||
52 | int buf_size; | ||
53 | |||
54 | memset(buf, 0x00, sizeof(buf)); | ||
55 | buf_size = min(count, (sizeof(buf)-1)); | ||
56 | if (copy_from_user(buf, userbuf, buf_size)) | ||
57 | return count; | ||
58 | read_lock(&dev_base_lock); | ||
59 | if (sdata->dev->reg_state == NETREG_REGISTERED) | ||
60 | (*format)(sdata, buf); | ||
61 | read_unlock(&dev_base_lock); | ||
62 | |||
63 | return count; | ||
64 | } | ||
65 | #endif | ||
66 | |||
67 | #define IEEE80211_IF_FMT(name, field, format_string) \ | 44 | #define IEEE80211_IF_FMT(name, field, format_string) \ |
68 | static ssize_t ieee80211_if_fmt_##name( \ | 45 | static ssize_t ieee80211_if_fmt_##name( \ |
69 | const struct ieee80211_sub_if_data *sdata, char *buf, \ | 46 | const struct ieee80211_sub_if_data *sdata, char *buf, \ |
@@ -71,19 +48,6 @@ static ssize_t ieee80211_if_fmt_##name( \ | |||
71 | { \ | 48 | { \ |
72 | return scnprintf(buf, buflen, format_string, sdata->field); \ | 49 | return scnprintf(buf, buflen, format_string, sdata->field); \ |
73 | } | 50 | } |
74 | #define IEEE80211_IF_WFMT(name, field, type) \ | ||
75 | static int ieee80211_if_wfmt_##name( \ | ||
76 | struct ieee80211_sub_if_data *sdata, char *buf) \ | ||
77 | { \ | ||
78 | unsigned long tmp; \ | ||
79 | char *endp; \ | ||
80 | \ | ||
81 | tmp = simple_strtoul(buf, &endp, 0); \ | ||
82 | if ((endp == buf) || ((type)tmp != tmp)) \ | ||
83 | return -EINVAL; \ | ||
84 | sdata->field = tmp; \ | ||
85 | return 0; \ | ||
86 | } | ||
87 | #define IEEE80211_IF_FMT_DEC(name, field) \ | 51 | #define IEEE80211_IF_FMT_DEC(name, field) \ |
88 | IEEE80211_IF_FMT(name, field, "%d\n") | 52 | IEEE80211_IF_FMT(name, field, "%d\n") |
89 | #define IEEE80211_IF_FMT_HEX(name, field) \ | 53 | #define IEEE80211_IF_FMT_HEX(name, field) \ |
@@ -104,8 +68,7 @@ static ssize_t ieee80211_if_fmt_##name( \ | |||
104 | const struct ieee80211_sub_if_data *sdata, char *buf, \ | 68 | const struct ieee80211_sub_if_data *sdata, char *buf, \ |
105 | int buflen) \ | 69 | int buflen) \ |
106 | { \ | 70 | { \ |
107 | DECLARE_MAC_BUF(mac); \ | 71 | return scnprintf(buf, buflen, "%pM\n", sdata->field); \ |
108 | return scnprintf(buf, buflen, "%s\n", print_mac(mac, sdata->field));\ | ||
109 | } | 72 | } |
110 | 73 | ||
111 | #define __IEEE80211_IF_FILE(name) \ | 74 | #define __IEEE80211_IF_FILE(name) \ |
@@ -126,34 +89,6 @@ static const struct file_operations name##_ops = { \ | |||
126 | IEEE80211_IF_FMT_##format(name, field) \ | 89 | IEEE80211_IF_FMT_##format(name, field) \ |
127 | __IEEE80211_IF_FILE(name) | 90 | __IEEE80211_IF_FILE(name) |
128 | 91 | ||
129 | #define __IEEE80211_IF_WFILE(name) \ | ||
130 | static ssize_t ieee80211_if_read_##name(struct file *file, \ | ||
131 | char __user *userbuf, \ | ||
132 | size_t count, loff_t *ppos) \ | ||
133 | { \ | ||
134 | return ieee80211_if_read(file->private_data, \ | ||
135 | userbuf, count, ppos, \ | ||
136 | ieee80211_if_fmt_##name); \ | ||
137 | } \ | ||
138 | static ssize_t ieee80211_if_write_##name(struct file *file, \ | ||
139 | const char __user *userbuf, \ | ||
140 | size_t count, loff_t *ppos) \ | ||
141 | { \ | ||
142 | return ieee80211_if_write(file->private_data, \ | ||
143 | userbuf, count, ppos, \ | ||
144 | ieee80211_if_wfmt_##name); \ | ||
145 | } \ | ||
146 | static const struct file_operations name##_ops = { \ | ||
147 | .read = ieee80211_if_read_##name, \ | ||
148 | .write = ieee80211_if_write_##name, \ | ||
149 | .open = mac80211_open_file_generic, \ | ||
150 | } | ||
151 | |||
152 | #define IEEE80211_IF_WFILE(name, field, format, type) \ | ||
153 | IEEE80211_IF_FMT_##format(name, field) \ | ||
154 | IEEE80211_IF_WFMT(name, field, type) \ | ||
155 | __IEEE80211_IF_WFILE(name) | ||
156 | |||
157 | /* common attributes */ | 92 | /* common attributes */ |
158 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); | 93 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); |
159 | IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC); | 94 | IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC); |
@@ -184,7 +119,7 @@ static ssize_t ieee80211_if_fmt_flags( | |||
184 | sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", | 119 | sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", |
185 | sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", | 120 | sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", |
186 | sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", | 121 | sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", |
187 | sdata->bss_conf.use_cts_prot ? "CTS prot\n" : ""); | 122 | sdata->vif.bss_conf.use_cts_prot ? "CTS prot\n" : ""); |
188 | } | 123 | } |
189 | __IEEE80211_IF_FILE(flags); | 124 | __IEEE80211_IF_FILE(flags); |
190 | 125 | ||
@@ -212,30 +147,30 @@ IEEE80211_IF_FILE(dropped_frames_no_route, | |||
212 | IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); | 147 | IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); |
213 | 148 | ||
214 | /* Mesh parameters */ | 149 | /* Mesh parameters */ |
215 | IEEE80211_IF_WFILE(dot11MeshMaxRetries, | 150 | IEEE80211_IF_FILE(dot11MeshMaxRetries, |
216 | u.mesh.mshcfg.dot11MeshMaxRetries, DEC, u8); | 151 | u.mesh.mshcfg.dot11MeshMaxRetries, DEC); |
217 | IEEE80211_IF_WFILE(dot11MeshRetryTimeout, | 152 | IEEE80211_IF_FILE(dot11MeshRetryTimeout, |
218 | u.mesh.mshcfg.dot11MeshRetryTimeout, DEC, u16); | 153 | u.mesh.mshcfg.dot11MeshRetryTimeout, DEC); |
219 | IEEE80211_IF_WFILE(dot11MeshConfirmTimeout, | 154 | IEEE80211_IF_FILE(dot11MeshConfirmTimeout, |
220 | u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC, u16); | 155 | u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC); |
221 | IEEE80211_IF_WFILE(dot11MeshHoldingTimeout, | 156 | IEEE80211_IF_FILE(dot11MeshHoldingTimeout, |
222 | u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC, u16); | 157 | u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC); |
223 | IEEE80211_IF_WFILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC, u8); | 158 | IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC); |
224 | IEEE80211_IF_WFILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC, u8); | 159 | IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC); |
225 | IEEE80211_IF_WFILE(dot11MeshMaxPeerLinks, | 160 | IEEE80211_IF_FILE(dot11MeshMaxPeerLinks, |
226 | u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC, u16); | 161 | u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC); |
227 | IEEE80211_IF_WFILE(dot11MeshHWMPactivePathTimeout, | 162 | IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout, |
228 | u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC, u32); | 163 | u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC); |
229 | IEEE80211_IF_WFILE(dot11MeshHWMPpreqMinInterval, | 164 | IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval, |
230 | u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC, u16); | 165 | u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC); |
231 | IEEE80211_IF_WFILE(dot11MeshHWMPnetDiameterTraversalTime, | 166 | IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime, |
232 | u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC, u16); | 167 | u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC); |
233 | IEEE80211_IF_WFILE(dot11MeshHWMPmaxPREQretries, | 168 | IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries, |
234 | u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC, u8); | 169 | u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC); |
235 | IEEE80211_IF_WFILE(path_refresh_time, | 170 | IEEE80211_IF_FILE(path_refresh_time, |
236 | u.mesh.mshcfg.path_refresh_time, DEC, u32); | 171 | u.mesh.mshcfg.path_refresh_time, DEC); |
237 | IEEE80211_IF_WFILE(min_discovery_timeout, | 172 | IEEE80211_IF_FILE(min_discovery_timeout, |
238 | u.mesh.mshcfg.min_discovery_timeout, DEC, u16); | 173 | u.mesh.mshcfg.min_discovery_timeout, DEC); |
239 | #endif | 174 | #endif |
240 | 175 | ||
241 | 176 | ||