aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/debugfs_netdev.c112
1 files changed, 24 insertions, 88 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 69b2fbf35145..56f3f29385cb 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
45static 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) \
68static ssize_t ieee80211_if_fmt_##name( \ 45static 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) \
75static 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) \
@@ -125,34 +89,6 @@ static const struct file_operations name##_ops = { \
125 IEEE80211_IF_FMT_##format(name, field) \ 89 IEEE80211_IF_FMT_##format(name, field) \
126 __IEEE80211_IF_FILE(name) 90 __IEEE80211_IF_FILE(name)
127 91
128#define __IEEE80211_IF_WFILE(name) \
129static ssize_t ieee80211_if_read_##name(struct file *file, \
130 char __user *userbuf, \
131 size_t count, loff_t *ppos) \
132{ \
133 return ieee80211_if_read(file->private_data, \
134 userbuf, count, ppos, \
135 ieee80211_if_fmt_##name); \
136} \
137static ssize_t ieee80211_if_write_##name(struct file *file, \
138 const char __user *userbuf, \
139 size_t count, loff_t *ppos) \
140{ \
141 return ieee80211_if_write(file->private_data, \
142 userbuf, count, ppos, \
143 ieee80211_if_wfmt_##name); \
144} \
145static const struct file_operations name##_ops = { \
146 .read = ieee80211_if_read_##name, \
147 .write = ieee80211_if_write_##name, \
148 .open = mac80211_open_file_generic, \
149}
150
151#define IEEE80211_IF_WFILE(name, field, format, type) \
152 IEEE80211_IF_FMT_##format(name, field) \
153 IEEE80211_IF_WFMT(name, field, type) \
154 __IEEE80211_IF_WFILE(name)
155
156/* common attributes */ 92/* common attributes */
157IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); 93IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
158IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC); 94IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC);
@@ -211,30 +147,30 @@ IEEE80211_IF_FILE(dropped_frames_no_route,
211IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); 147IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC);
212 148
213/* Mesh parameters */ 149/* Mesh parameters */
214IEEE80211_IF_WFILE(dot11MeshMaxRetries, 150IEEE80211_IF_FILE(dot11MeshMaxRetries,
215 u.mesh.mshcfg.dot11MeshMaxRetries, DEC, u8); 151 u.mesh.mshcfg.dot11MeshMaxRetries, DEC);
216IEEE80211_IF_WFILE(dot11MeshRetryTimeout, 152IEEE80211_IF_FILE(dot11MeshRetryTimeout,
217 u.mesh.mshcfg.dot11MeshRetryTimeout, DEC, u16); 153 u.mesh.mshcfg.dot11MeshRetryTimeout, DEC);
218IEEE80211_IF_WFILE(dot11MeshConfirmTimeout, 154IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
219 u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC, u16); 155 u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC);
220IEEE80211_IF_WFILE(dot11MeshHoldingTimeout, 156IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
221 u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC, u16); 157 u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
222IEEE80211_IF_WFILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC, u8); 158IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
223IEEE80211_IF_WFILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC, u8); 159IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
224IEEE80211_IF_WFILE(dot11MeshMaxPeerLinks, 160IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
225 u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC, u16); 161 u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
226IEEE80211_IF_WFILE(dot11MeshHWMPactivePathTimeout, 162IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
227 u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC, u32); 163 u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
228IEEE80211_IF_WFILE(dot11MeshHWMPpreqMinInterval, 164IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
229 u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC, u16); 165 u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
230IEEE80211_IF_WFILE(dot11MeshHWMPnetDiameterTraversalTime, 166IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
231 u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC, u16); 167 u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
232IEEE80211_IF_WFILE(dot11MeshHWMPmaxPREQretries, 168IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
233 u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC, u8); 169 u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC);
234IEEE80211_IF_WFILE(path_refresh_time, 170IEEE80211_IF_FILE(path_refresh_time,
235 u.mesh.mshcfg.path_refresh_time, DEC, u32); 171 u.mesh.mshcfg.path_refresh_time, DEC);
236IEEE80211_IF_WFILE(min_discovery_timeout, 172IEEE80211_IF_FILE(min_discovery_timeout,
237 u.mesh.mshcfg.min_discovery_timeout, DEC, u16); 173 u.mesh.mshcfg.min_discovery_timeout, DEC);
238#endif 174#endif
239 175
240 176