diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-08 15:04:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:06:19 -0500 |
commit | aa21c004f80bdf943736c62dccf0c0398d7824f3 (patch) | |
tree | 6815328775d3b5ec46bb342c4c256cde0f223863 /drivers/net/wireless/libertas/wext.c | |
parent | f86a93e1b2d05a7a38a48c91f8fb8fc7e8f1c734 (diff) |
libertas: kill struct lbs_adapter
There seems to be no reason for a separate structure; move it all
into struct lbs_private.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 372 |
1 files changed, 169 insertions, 203 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 1af140bbbcb1..1e0b2245db56 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | static inline void lbs_postpone_association_work(struct lbs_private *priv) | 24 | static inline void lbs_postpone_association_work(struct lbs_private *priv) |
25 | { | 25 | { |
26 | if (priv->adapter->surpriseremoved) | 26 | if (priv->surpriseremoved) |
27 | return; | 27 | return; |
28 | cancel_delayed_work(&priv->assoc_work); | 28 | cancel_delayed_work(&priv->assoc_work); |
29 | queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); | 29 | queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); |
@@ -32,21 +32,21 @@ static inline void lbs_postpone_association_work(struct lbs_private *priv) | |||
32 | static inline void lbs_cancel_association_work(struct lbs_private *priv) | 32 | static inline void lbs_cancel_association_work(struct lbs_private *priv) |
33 | { | 33 | { |
34 | cancel_delayed_work(&priv->assoc_work); | 34 | cancel_delayed_work(&priv->assoc_work); |
35 | kfree(priv->adapter->pending_assoc_req); | 35 | kfree(priv->pending_assoc_req); |
36 | priv->adapter->pending_assoc_req = NULL; | 36 | priv->pending_assoc_req = NULL; |
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | ||
40 | /** | 40 | /** |
41 | * @brief Find the channel frequency power info with specific channel | 41 | * @brief Find the channel frequency power info with specific channel |
42 | * | 42 | * |
43 | * @param adapter A pointer to struct lbs_adapter structure | 43 | * @param priv A pointer to struct lbs_private structure |
44 | * @param band it can be BAND_A, BAND_G or BAND_B | 44 | * @param band it can be BAND_A, BAND_G or BAND_B |
45 | * @param channel the channel for looking | 45 | * @param channel the channel for looking |
46 | * @return A pointer to struct chan_freq_power structure or NULL if not find. | 46 | * @return A pointer to struct chan_freq_power structure or NULL if not find. |
47 | */ | 47 | */ |
48 | struct chan_freq_power *lbs_find_cfp_by_band_and_channel( | 48 | struct chan_freq_power *lbs_find_cfp_by_band_and_channel( |
49 | struct lbs_adapter *adapter, | 49 | struct lbs_private *priv, |
50 | u8 band, | 50 | u8 band, |
51 | u16 channel) | 51 | u16 channel) |
52 | { | 52 | { |
@@ -54,11 +54,11 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel( | |||
54 | struct region_channel *rc; | 54 | struct region_channel *rc; |
55 | int i, j; | 55 | int i, j; |
56 | 56 | ||
57 | for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) { | 57 | for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { |
58 | rc = &adapter->region_channel[j]; | 58 | rc = &priv->region_channel[j]; |
59 | 59 | ||
60 | if (adapter->enable11d) | 60 | if (priv->enable11d) |
61 | rc = &adapter->universal_channel[j]; | 61 | rc = &priv->universal_channel[j]; |
62 | if (!rc->valid || !rc->CFP) | 62 | if (!rc->valid || !rc->CFP) |
63 | continue; | 63 | continue; |
64 | if (rc->band != band) | 64 | if (rc->band != band) |
@@ -81,13 +81,13 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel( | |||
81 | /** | 81 | /** |
82 | * @brief Find the channel frequency power info with specific frequency | 82 | * @brief Find the channel frequency power info with specific frequency |
83 | * | 83 | * |
84 | * @param adapter A pointer to struct lbs_adapter structure | 84 | * @param priv A pointer to struct lbs_private structure |
85 | * @param band it can be BAND_A, BAND_G or BAND_B | 85 | * @param band it can be BAND_A, BAND_G or BAND_B |
86 | * @param freq the frequency for looking | 86 | * @param freq the frequency for looking |
87 | * @return A pointer to struct chan_freq_power structure or NULL if not find. | 87 | * @return A pointer to struct chan_freq_power structure or NULL if not find. |
88 | */ | 88 | */ |
89 | static struct chan_freq_power *find_cfp_by_band_and_freq( | 89 | static struct chan_freq_power *find_cfp_by_band_and_freq( |
90 | struct lbs_adapter *adapter, | 90 | struct lbs_private *priv, |
91 | u8 band, | 91 | u8 band, |
92 | u32 freq) | 92 | u32 freq) |
93 | { | 93 | { |
@@ -95,11 +95,11 @@ static struct chan_freq_power *find_cfp_by_band_and_freq( | |||
95 | struct region_channel *rc; | 95 | struct region_channel *rc; |
96 | int i, j; | 96 | int i, j; |
97 | 97 | ||
98 | for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) { | 98 | for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { |
99 | rc = &adapter->region_channel[j]; | 99 | rc = &priv->region_channel[j]; |
100 | 100 | ||
101 | if (adapter->enable11d) | 101 | if (priv->enable11d) |
102 | rc = &adapter->universal_channel[j]; | 102 | rc = &priv->universal_channel[j]; |
103 | if (!rc->valid || !rc->CFP) | 103 | if (!rc->valid || !rc->CFP) |
104 | continue; | 104 | continue; |
105 | if (rc->band != band) | 105 | if (rc->band != band) |
@@ -130,13 +130,12 @@ static struct chan_freq_power *find_cfp_by_band_and_freq( | |||
130 | static int lbs_radio_ioctl(struct lbs_private *priv, u8 option) | 130 | static int lbs_radio_ioctl(struct lbs_private *priv, u8 option) |
131 | { | 131 | { |
132 | int ret = 0; | 132 | int ret = 0; |
133 | struct lbs_adapter *adapter = priv->adapter; | ||
134 | 133 | ||
135 | lbs_deb_enter(LBS_DEB_WEXT); | 134 | lbs_deb_enter(LBS_DEB_WEXT); |
136 | 135 | ||
137 | if (adapter->radioon != option) { | 136 | if (priv->radioon != option) { |
138 | lbs_deb_wext("switching radio %s\n", option ? "on" : "off"); | 137 | lbs_deb_wext("switching radio %s\n", option ? "on" : "off"); |
139 | adapter->radioon = option; | 138 | priv->radioon = option; |
140 | 139 | ||
141 | ret = lbs_prepare_and_send_command(priv, | 140 | ret = lbs_prepare_and_send_command(priv, |
142 | CMD_802_11_RADIO_CONTROL, | 141 | CMD_802_11_RADIO_CONTROL, |
@@ -151,18 +150,18 @@ static int lbs_radio_ioctl(struct lbs_private *priv, u8 option) | |||
151 | /** | 150 | /** |
152 | * @brief Copy active data rates based on adapter mode and status | 151 | * @brief Copy active data rates based on adapter mode and status |
153 | * | 152 | * |
154 | * @param adapter A pointer to struct lbs_adapter structure | 153 | * @param priv A pointer to struct lbs_private structure |
155 | * @param rate The buf to return the active rates | 154 | * @param rate The buf to return the active rates |
156 | */ | 155 | */ |
157 | static void copy_active_data_rates(struct lbs_adapter *adapter, u8 *rates) | 156 | static void copy_active_data_rates(struct lbs_private *priv, u8 *rates) |
158 | { | 157 | { |
159 | lbs_deb_enter(LBS_DEB_WEXT); | 158 | lbs_deb_enter(LBS_DEB_WEXT); |
160 | 159 | ||
161 | if ((adapter->connect_status != LBS_CONNECTED) && | 160 | if ((priv->connect_status != LBS_CONNECTED) && |
162 | (adapter->mesh_connect_status != LBS_CONNECTED)) | 161 | (priv->mesh_connect_status != LBS_CONNECTED)) |
163 | memcpy(rates, lbs_bg_rates, MAX_RATES); | 162 | memcpy(rates, lbs_bg_rates, MAX_RATES); |
164 | else | 163 | else |
165 | memcpy(rates, adapter->curbssparams.rates, MAX_RATES); | 164 | memcpy(rates, priv->curbssparams.rates, MAX_RATES); |
166 | 165 | ||
167 | lbs_deb_leave(LBS_DEB_WEXT); | 166 | lbs_deb_leave(LBS_DEB_WEXT); |
168 | } | 167 | } |
@@ -184,18 +183,17 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info, | |||
184 | struct iw_freq *fwrq, char *extra) | 183 | struct iw_freq *fwrq, char *extra) |
185 | { | 184 | { |
186 | struct lbs_private *priv = dev->priv; | 185 | struct lbs_private *priv = dev->priv; |
187 | struct lbs_adapter *adapter = priv->adapter; | ||
188 | struct chan_freq_power *cfp; | 186 | struct chan_freq_power *cfp; |
189 | 187 | ||
190 | lbs_deb_enter(LBS_DEB_WEXT); | 188 | lbs_deb_enter(LBS_DEB_WEXT); |
191 | 189 | ||
192 | cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, | 190 | cfp = lbs_find_cfp_by_band_and_channel(priv, 0, |
193 | adapter->curbssparams.channel); | 191 | priv->curbssparams.channel); |
194 | 192 | ||
195 | if (!cfp) { | 193 | if (!cfp) { |
196 | if (adapter->curbssparams.channel) | 194 | if (priv->curbssparams.channel) |
197 | lbs_deb_wext("invalid channel %d\n", | 195 | lbs_deb_wext("invalid channel %d\n", |
198 | adapter->curbssparams.channel); | 196 | priv->curbssparams.channel); |
199 | return -EINVAL; | 197 | return -EINVAL; |
200 | } | 198 | } |
201 | 199 | ||
@@ -211,12 +209,11 @@ static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info, | |||
211 | struct sockaddr *awrq, char *extra) | 209 | struct sockaddr *awrq, char *extra) |
212 | { | 210 | { |
213 | struct lbs_private *priv = dev->priv; | 211 | struct lbs_private *priv = dev->priv; |
214 | struct lbs_adapter *adapter = priv->adapter; | ||
215 | 212 | ||
216 | lbs_deb_enter(LBS_DEB_WEXT); | 213 | lbs_deb_enter(LBS_DEB_WEXT); |
217 | 214 | ||
218 | if (adapter->connect_status == LBS_CONNECTED) { | 215 | if (priv->connect_status == LBS_CONNECTED) { |
219 | memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 216 | memcpy(awrq->sa_data, priv->curbssparams.bssid, ETH_ALEN); |
220 | } else { | 217 | } else { |
221 | memset(awrq->sa_data, 0, ETH_ALEN); | 218 | memset(awrq->sa_data, 0, ETH_ALEN); |
222 | } | 219 | } |
@@ -230,7 +227,6 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, | |||
230 | struct iw_point *dwrq, char *extra) | 227 | struct iw_point *dwrq, char *extra) |
231 | { | 228 | { |
232 | struct lbs_private *priv = dev->priv; | 229 | struct lbs_private *priv = dev->priv; |
233 | struct lbs_adapter *adapter = priv->adapter; | ||
234 | 230 | ||
235 | lbs_deb_enter(LBS_DEB_WEXT); | 231 | lbs_deb_enter(LBS_DEB_WEXT); |
236 | 232 | ||
@@ -242,10 +238,10 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, | |||
242 | return -E2BIG; | 238 | return -E2BIG; |
243 | } | 239 | } |
244 | 240 | ||
245 | mutex_lock(&adapter->lock); | 241 | mutex_lock(&priv->lock); |
246 | memset(adapter->nodename, 0, sizeof(adapter->nodename)); | 242 | memset(priv->nodename, 0, sizeof(priv->nodename)); |
247 | memcpy(adapter->nodename, extra, dwrq->length); | 243 | memcpy(priv->nodename, extra, dwrq->length); |
248 | mutex_unlock(&adapter->lock); | 244 | mutex_unlock(&priv->lock); |
249 | 245 | ||
250 | lbs_deb_leave(LBS_DEB_WEXT); | 246 | lbs_deb_leave(LBS_DEB_WEXT); |
251 | return 0; | 247 | return 0; |
@@ -255,12 +251,11 @@ static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info, | |||
255 | struct iw_point *dwrq, char *extra) | 251 | struct iw_point *dwrq, char *extra) |
256 | { | 252 | { |
257 | struct lbs_private *priv = dev->priv; | 253 | struct lbs_private *priv = dev->priv; |
258 | struct lbs_adapter *adapter = priv->adapter; | ||
259 | 254 | ||
260 | lbs_deb_enter(LBS_DEB_WEXT); | 255 | lbs_deb_enter(LBS_DEB_WEXT); |
261 | 256 | ||
262 | dwrq->length = strlen(adapter->nodename); | 257 | dwrq->length = strlen(priv->nodename); |
263 | memcpy(extra, adapter->nodename, dwrq->length); | 258 | memcpy(extra, priv->nodename, dwrq->length); |
264 | extra[dwrq->length] = '\0'; | 259 | extra[dwrq->length] = '\0'; |
265 | 260 | ||
266 | dwrq->flags = 1; /* active */ | 261 | dwrq->flags = 1; /* active */ |
@@ -273,13 +268,12 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, | |||
273 | struct iw_point *dwrq, char *extra) | 268 | struct iw_point *dwrq, char *extra) |
274 | { | 269 | { |
275 | struct lbs_private *priv = dev->priv; | 270 | struct lbs_private *priv = dev->priv; |
276 | struct lbs_adapter *adapter = priv->adapter; | ||
277 | 271 | ||
278 | lbs_deb_enter(LBS_DEB_WEXT); | 272 | lbs_deb_enter(LBS_DEB_WEXT); |
279 | 273 | ||
280 | /* Use nickname to indicate that mesh is on */ | 274 | /* Use nickname to indicate that mesh is on */ |
281 | 275 | ||
282 | if (adapter->mesh_connect_status == LBS_CONNECTED) { | 276 | if (priv->mesh_connect_status == LBS_CONNECTED) { |
283 | strncpy(extra, "Mesh", 12); | 277 | strncpy(extra, "Mesh", 12); |
284 | extra[12] = '\0'; | 278 | extra[12] = '\0'; |
285 | dwrq->length = strlen(extra); | 279 | dwrq->length = strlen(extra); |
@@ -299,17 +293,16 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
299 | { | 293 | { |
300 | int ret = 0; | 294 | int ret = 0; |
301 | struct lbs_private *priv = dev->priv; | 295 | struct lbs_private *priv = dev->priv; |
302 | struct lbs_adapter *adapter = priv->adapter; | ||
303 | u32 rthr = vwrq->value; | 296 | u32 rthr = vwrq->value; |
304 | 297 | ||
305 | lbs_deb_enter(LBS_DEB_WEXT); | 298 | lbs_deb_enter(LBS_DEB_WEXT); |
306 | 299 | ||
307 | if (vwrq->disabled) { | 300 | if (vwrq->disabled) { |
308 | adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; | 301 | priv->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; |
309 | } else { | 302 | } else { |
310 | if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE) | 303 | if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE) |
311 | return -EINVAL; | 304 | return -EINVAL; |
312 | adapter->rtsthsd = rthr; | 305 | priv->rtsthsd = rthr; |
313 | } | 306 | } |
314 | 307 | ||
315 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 308 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, |
@@ -325,18 +318,17 @@ static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, | |||
325 | { | 318 | { |
326 | int ret = 0; | 319 | int ret = 0; |
327 | struct lbs_private *priv = dev->priv; | 320 | struct lbs_private *priv = dev->priv; |
328 | struct lbs_adapter *adapter = priv->adapter; | ||
329 | 321 | ||
330 | lbs_deb_enter(LBS_DEB_WEXT); | 322 | lbs_deb_enter(LBS_DEB_WEXT); |
331 | 323 | ||
332 | adapter->rtsthsd = 0; | 324 | priv->rtsthsd = 0; |
333 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 325 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, |
334 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | 326 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, |
335 | OID_802_11_RTS_THRESHOLD, NULL); | 327 | OID_802_11_RTS_THRESHOLD, NULL); |
336 | if (ret) | 328 | if (ret) |
337 | goto out; | 329 | goto out; |
338 | 330 | ||
339 | vwrq->value = adapter->rtsthsd; | 331 | vwrq->value = priv->rtsthsd; |
340 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) | 332 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) |
341 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); | 333 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); |
342 | vwrq->fixed = 1; | 334 | vwrq->fixed = 1; |
@@ -352,17 +344,16 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, | |||
352 | int ret = 0; | 344 | int ret = 0; |
353 | u32 fthr = vwrq->value; | 345 | u32 fthr = vwrq->value; |
354 | struct lbs_private *priv = dev->priv; | 346 | struct lbs_private *priv = dev->priv; |
355 | struct lbs_adapter *adapter = priv->adapter; | ||
356 | 347 | ||
357 | lbs_deb_enter(LBS_DEB_WEXT); | 348 | lbs_deb_enter(LBS_DEB_WEXT); |
358 | 349 | ||
359 | if (vwrq->disabled) { | 350 | if (vwrq->disabled) { |
360 | adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; | 351 | priv->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; |
361 | } else { | 352 | } else { |
362 | if (fthr < MRVDRV_FRAG_MIN_VALUE | 353 | if (fthr < MRVDRV_FRAG_MIN_VALUE |
363 | || fthr > MRVDRV_FRAG_MAX_VALUE) | 354 | || fthr > MRVDRV_FRAG_MAX_VALUE) |
364 | return -EINVAL; | 355 | return -EINVAL; |
365 | adapter->fragthsd = fthr; | 356 | priv->fragthsd = fthr; |
366 | } | 357 | } |
367 | 358 | ||
368 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 359 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, |
@@ -378,11 +369,10 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, | |||
378 | { | 369 | { |
379 | int ret = 0; | 370 | int ret = 0; |
380 | struct lbs_private *priv = dev->priv; | 371 | struct lbs_private *priv = dev->priv; |
381 | struct lbs_adapter *adapter = priv->adapter; | ||
382 | 372 | ||
383 | lbs_deb_enter(LBS_DEB_WEXT); | 373 | lbs_deb_enter(LBS_DEB_WEXT); |
384 | 374 | ||
385 | adapter->fragthsd = 0; | 375 | priv->fragthsd = 0; |
386 | ret = lbs_prepare_and_send_command(priv, | 376 | ret = lbs_prepare_and_send_command(priv, |
387 | CMD_802_11_SNMP_MIB, | 377 | CMD_802_11_SNMP_MIB, |
388 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | 378 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, |
@@ -390,7 +380,7 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, | |||
390 | if (ret) | 380 | if (ret) |
391 | goto out; | 381 | goto out; |
392 | 382 | ||
393 | vwrq->value = adapter->fragthsd; | 383 | vwrq->value = priv->fragthsd; |
394 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) | 384 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) |
395 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); | 385 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); |
396 | vwrq->fixed = 1; | 386 | vwrq->fixed = 1; |
@@ -404,11 +394,10 @@ static int lbs_get_mode(struct net_device *dev, | |||
404 | struct iw_request_info *info, u32 * uwrq, char *extra) | 394 | struct iw_request_info *info, u32 * uwrq, char *extra) |
405 | { | 395 | { |
406 | struct lbs_private *priv = dev->priv; | 396 | struct lbs_private *priv = dev->priv; |
407 | struct lbs_adapter *adapter = priv->adapter; | ||
408 | 397 | ||
409 | lbs_deb_enter(LBS_DEB_WEXT); | 398 | lbs_deb_enter(LBS_DEB_WEXT); |
410 | 399 | ||
411 | *uwrq = adapter->mode; | 400 | *uwrq = priv->mode; |
412 | 401 | ||
413 | lbs_deb_leave(LBS_DEB_WEXT); | 402 | lbs_deb_leave(LBS_DEB_WEXT); |
414 | return 0; | 403 | return 0; |
@@ -432,7 +421,6 @@ static int lbs_get_txpow(struct net_device *dev, | |||
432 | { | 421 | { |
433 | int ret = 0; | 422 | int ret = 0; |
434 | struct lbs_private *priv = dev->priv; | 423 | struct lbs_private *priv = dev->priv; |
435 | struct lbs_adapter *adapter = priv->adapter; | ||
436 | 424 | ||
437 | lbs_deb_enter(LBS_DEB_WEXT); | 425 | lbs_deb_enter(LBS_DEB_WEXT); |
438 | 426 | ||
@@ -444,10 +432,10 @@ static int lbs_get_txpow(struct net_device *dev, | |||
444 | if (ret) | 432 | if (ret) |
445 | goto out; | 433 | goto out; |
446 | 434 | ||
447 | lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel); | 435 | lbs_deb_wext("tx power level %d dbm\n", priv->txpowerlevel); |
448 | vwrq->value = adapter->txpowerlevel; | 436 | vwrq->value = priv->txpowerlevel; |
449 | vwrq->fixed = 1; | 437 | vwrq->fixed = 1; |
450 | if (adapter->radioon) { | 438 | if (priv->radioon) { |
451 | vwrq->disabled = 0; | 439 | vwrq->disabled = 0; |
452 | vwrq->flags = IW_TXPOW_DBM; | 440 | vwrq->flags = IW_TXPOW_DBM; |
453 | } else { | 441 | } else { |
@@ -464,7 +452,6 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, | |||
464 | { | 452 | { |
465 | int ret = 0; | 453 | int ret = 0; |
466 | struct lbs_private *priv = dev->priv; | 454 | struct lbs_private *priv = dev->priv; |
467 | struct lbs_adapter *adapter = priv->adapter; | ||
468 | 455 | ||
469 | lbs_deb_enter(LBS_DEB_WEXT); | 456 | lbs_deb_enter(LBS_DEB_WEXT); |
470 | 457 | ||
@@ -477,7 +464,7 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, | |||
477 | return -EINVAL; | 464 | return -EINVAL; |
478 | 465 | ||
479 | /* Adding 1 to convert retry count to try count */ | 466 | /* Adding 1 to convert retry count to try count */ |
480 | adapter->txretrycount = vwrq->value + 1; | 467 | priv->txretrycount = vwrq->value + 1; |
481 | 468 | ||
482 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 469 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, |
483 | CMD_ACT_SET, | 470 | CMD_ACT_SET, |
@@ -499,12 +486,11 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
499 | struct iw_param *vwrq, char *extra) | 486 | struct iw_param *vwrq, char *extra) |
500 | { | 487 | { |
501 | struct lbs_private *priv = dev->priv; | 488 | struct lbs_private *priv = dev->priv; |
502 | struct lbs_adapter *adapter = priv->adapter; | ||
503 | int ret = 0; | 489 | int ret = 0; |
504 | 490 | ||
505 | lbs_deb_enter(LBS_DEB_WEXT); | 491 | lbs_deb_enter(LBS_DEB_WEXT); |
506 | 492 | ||
507 | adapter->txretrycount = 0; | 493 | priv->txretrycount = 0; |
508 | ret = lbs_prepare_and_send_command(priv, | 494 | ret = lbs_prepare_and_send_command(priv, |
509 | CMD_802_11_SNMP_MIB, | 495 | CMD_802_11_SNMP_MIB, |
510 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | 496 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, |
@@ -516,7 +502,7 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
516 | if (!vwrq->flags) { | 502 | if (!vwrq->flags) { |
517 | vwrq->flags = IW_RETRY_LIMIT; | 503 | vwrq->flags = IW_RETRY_LIMIT; |
518 | /* Subtract 1 to convert try count to retry count */ | 504 | /* Subtract 1 to convert try count to retry count */ |
519 | vwrq->value = adapter->txretrycount - 1; | 505 | vwrq->value = priv->txretrycount - 1; |
520 | } | 506 | } |
521 | 507 | ||
522 | out: | 508 | out: |
@@ -568,7 +554,6 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, | |||
568 | { | 554 | { |
569 | int i, j; | 555 | int i, j; |
570 | struct lbs_private *priv = dev->priv; | 556 | struct lbs_private *priv = dev->priv; |
571 | struct lbs_adapter *adapter = priv->adapter; | ||
572 | struct iw_range *range = (struct iw_range *)extra; | 557 | struct iw_range *range = (struct iw_range *)extra; |
573 | struct chan_freq_power *cfp; | 558 | struct chan_freq_power *cfp; |
574 | u8 rates[MAX_RATES + 1]; | 559 | u8 rates[MAX_RATES + 1]; |
@@ -584,7 +569,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, | |||
584 | range->max_nwid = 0; | 569 | range->max_nwid = 0; |
585 | 570 | ||
586 | memset(rates, 0, sizeof(rates)); | 571 | memset(rates, 0, sizeof(rates)); |
587 | copy_active_data_rates(adapter, rates); | 572 | copy_active_data_rates(priv, rates); |
588 | range->num_bitrates = strnlen(rates, IW_MAX_BITRATES); | 573 | range->num_bitrates = strnlen(rates, IW_MAX_BITRATES); |
589 | for (i = 0; i < range->num_bitrates; i++) | 574 | for (i = 0; i < range->num_bitrates; i++) |
590 | range->bitrate[i] = rates[i] * 500000; | 575 | range->bitrate[i] = rates[i] * 500000; |
@@ -593,14 +578,14 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, | |||
593 | range->num_bitrates); | 578 | range->num_bitrates); |
594 | 579 | ||
595 | range->num_frequency = 0; | 580 | range->num_frequency = 0; |
596 | if (priv->adapter->enable11d && | 581 | if (priv->enable11d && |
597 | (adapter->connect_status == LBS_CONNECTED || | 582 | (priv->connect_status == LBS_CONNECTED || |
598 | adapter->mesh_connect_status == LBS_CONNECTED)) { | 583 | priv->mesh_connect_status == LBS_CONNECTED)) { |
599 | u8 chan_no; | 584 | u8 chan_no; |
600 | u8 band; | 585 | u8 band; |
601 | 586 | ||
602 | struct parsed_region_chan_11d *parsed_region_chan = | 587 | struct parsed_region_chan_11d *parsed_region_chan = |
603 | &adapter->parsed_region_chan; | 588 | &priv->parsed_region_chan; |
604 | 589 | ||
605 | if (parsed_region_chan == NULL) { | 590 | if (parsed_region_chan == NULL) { |
606 | lbs_deb_wext("11d: parsed_region_chan is NULL\n"); | 591 | lbs_deb_wext("11d: parsed_region_chan is NULL\n"); |
@@ -624,12 +609,12 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, | |||
624 | } | 609 | } |
625 | if (!flag) { | 610 | if (!flag) { |
626 | for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES) | 611 | for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES) |
627 | && (j < ARRAY_SIZE(adapter->region_channel)); j++) { | 612 | && (j < ARRAY_SIZE(priv->region_channel)); j++) { |
628 | cfp = adapter->region_channel[j].CFP; | 613 | cfp = priv->region_channel[j].CFP; |
629 | for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) | 614 | for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) |
630 | && adapter->region_channel[j].valid | 615 | && priv->region_channel[j].valid |
631 | && cfp | 616 | && cfp |
632 | && (i < adapter->region_channel[j].nrcfp); i++) { | 617 | && (i < priv->region_channel[j].nrcfp); i++) { |
633 | range->freq[range->num_frequency].i = | 618 | range->freq[range->num_frequency].i = |
634 | (long)cfp->channel; | 619 | (long)cfp->channel; |
635 | range->freq[range->num_frequency].m = | 620 | range->freq[range->num_frequency].m = |
@@ -729,7 +714,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, | |||
729 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); | 714 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
730 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 715 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
731 | 716 | ||
732 | if (adapter->fwcapinfo & FW_CAPINFO_WPA) { | 717 | if (priv->fwcapinfo & FW_CAPINFO_WPA) { |
733 | range->enc_capa = IW_ENC_CAPA_WPA | 718 | range->enc_capa = IW_ENC_CAPA_WPA |
734 | | IW_ENC_CAPA_WPA2 | 719 | | IW_ENC_CAPA_WPA2 |
735 | | IW_ENC_CAPA_CIPHER_TKIP | 720 | | IW_ENC_CAPA_CIPHER_TKIP |
@@ -745,7 +730,6 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, | |||
745 | struct iw_param *vwrq, char *extra) | 730 | struct iw_param *vwrq, char *extra) |
746 | { | 731 | { |
747 | struct lbs_private *priv = dev->priv; | 732 | struct lbs_private *priv = dev->priv; |
748 | struct lbs_adapter *adapter = priv->adapter; | ||
749 | 733 | ||
750 | lbs_deb_enter(LBS_DEB_WEXT); | 734 | lbs_deb_enter(LBS_DEB_WEXT); |
751 | 735 | ||
@@ -754,8 +738,8 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, | |||
754 | */ | 738 | */ |
755 | 739 | ||
756 | if (vwrq->disabled) { | 740 | if (vwrq->disabled) { |
757 | adapter->psmode = LBS802_11POWERMODECAM; | 741 | priv->psmode = LBS802_11POWERMODECAM; |
758 | if (adapter->psstate != PS_STATE_FULL_POWER) { | 742 | if (priv->psstate != PS_STATE_FULL_POWER) { |
759 | lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); | 743 | lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); |
760 | } | 744 | } |
761 | 745 | ||
@@ -771,13 +755,13 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, | |||
771 | return -EINVAL; | 755 | return -EINVAL; |
772 | } | 756 | } |
773 | 757 | ||
774 | if (adapter->psmode != LBS802_11POWERMODECAM) { | 758 | if (priv->psmode != LBS802_11POWERMODECAM) { |
775 | return 0; | 759 | return 0; |
776 | } | 760 | } |
777 | 761 | ||
778 | adapter->psmode = LBS802_11POWERMODEMAX_PSP; | 762 | priv->psmode = LBS802_11POWERMODEMAX_PSP; |
779 | 763 | ||
780 | if (adapter->connect_status == LBS_CONNECTED) { | 764 | if (priv->connect_status == LBS_CONNECTED) { |
781 | lbs_ps_sleep(priv, CMD_OPTION_WAITFORRSP); | 765 | lbs_ps_sleep(priv, CMD_OPTION_WAITFORRSP); |
782 | } | 766 | } |
783 | 767 | ||
@@ -789,15 +773,14 @@ static int lbs_get_power(struct net_device *dev, struct iw_request_info *info, | |||
789 | struct iw_param *vwrq, char *extra) | 773 | struct iw_param *vwrq, char *extra) |
790 | { | 774 | { |
791 | struct lbs_private *priv = dev->priv; | 775 | struct lbs_private *priv = dev->priv; |
792 | struct lbs_adapter *adapter = priv->adapter; | ||
793 | int mode; | 776 | int mode; |
794 | 777 | ||
795 | lbs_deb_enter(LBS_DEB_WEXT); | 778 | lbs_deb_enter(LBS_DEB_WEXT); |
796 | 779 | ||
797 | mode = adapter->psmode; | 780 | mode = priv->psmode; |
798 | 781 | ||
799 | if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM)) | 782 | if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM)) |
800 | || adapter->connect_status == LBS_DISCONNECTED) | 783 | || priv->connect_status == LBS_DISCONNECTED) |
801 | { | 784 | { |
802 | goto out; | 785 | goto out; |
803 | } | 786 | } |
@@ -820,7 +803,6 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) | |||
820 | PERFECT = 100 | 803 | PERFECT = 100 |
821 | }; | 804 | }; |
822 | struct lbs_private *priv = dev->priv; | 805 | struct lbs_private *priv = dev->priv; |
823 | struct lbs_adapter *adapter = priv->adapter; | ||
824 | u32 rssi_qual; | 806 | u32 rssi_qual; |
825 | u32 tx_qual; | 807 | u32 tx_qual; |
826 | u32 quality = 0; | 808 | u32 quality = 0; |
@@ -830,23 +812,23 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) | |||
830 | 812 | ||
831 | lbs_deb_enter(LBS_DEB_WEXT); | 813 | lbs_deb_enter(LBS_DEB_WEXT); |
832 | 814 | ||
833 | priv->wstats.status = adapter->mode; | 815 | priv->wstats.status = priv->mode; |
834 | 816 | ||
835 | /* If we're not associated, all quality values are meaningless */ | 817 | /* If we're not associated, all quality values are meaningless */ |
836 | if ((adapter->connect_status != LBS_CONNECTED) && | 818 | if ((priv->connect_status != LBS_CONNECTED) && |
837 | (adapter->mesh_connect_status != LBS_CONNECTED)) | 819 | (priv->mesh_connect_status != LBS_CONNECTED)) |
838 | goto out; | 820 | goto out; |
839 | 821 | ||
840 | /* Quality by RSSI */ | 822 | /* Quality by RSSI */ |
841 | priv->wstats.qual.level = | 823 | priv->wstats.qual.level = |
842 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], | 824 | CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG], |
843 | adapter->NF[TYPE_BEACON][TYPE_NOAVG]); | 825 | priv->NF[TYPE_BEACON][TYPE_NOAVG]); |
844 | 826 | ||
845 | if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { | 827 | if (priv->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { |
846 | priv->wstats.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; | 828 | priv->wstats.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; |
847 | } else { | 829 | } else { |
848 | priv->wstats.qual.noise = | 830 | priv->wstats.qual.noise = |
849 | CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); | 831 | CAL_NF(priv->NF[TYPE_BEACON][TYPE_NOAVG]); |
850 | } | 832 | } |
851 | 833 | ||
852 | lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level); | 834 | lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level); |
@@ -870,7 +852,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) | |||
870 | /* Quality by TX errors */ | 852 | /* Quality by TX errors */ |
871 | priv->wstats.discard.retries = priv->stats.tx_errors; | 853 | priv->wstats.discard.retries = priv->stats.tx_errors; |
872 | 854 | ||
873 | tx_retries = le32_to_cpu(adapter->logmsg.retry); | 855 | tx_retries = le32_to_cpu(priv->logmsg.retry); |
874 | 856 | ||
875 | if (tx_retries > 75) | 857 | if (tx_retries > 75) |
876 | tx_qual = (90 - tx_retries) * POOR / 15; | 858 | tx_qual = (90 - tx_retries) * POOR / 15; |
@@ -886,10 +868,10 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) | |||
886 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; | 868 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; |
887 | quality = min(quality, tx_qual); | 869 | quality = min(quality, tx_qual); |
888 | 870 | ||
889 | priv->wstats.discard.code = le32_to_cpu(adapter->logmsg.wepundecryptable); | 871 | priv->wstats.discard.code = le32_to_cpu(priv->logmsg.wepundecryptable); |
890 | priv->wstats.discard.fragment = le32_to_cpu(adapter->logmsg.rxfrag); | 872 | priv->wstats.discard.fragment = le32_to_cpu(priv->logmsg.rxfrag); |
891 | priv->wstats.discard.retries = tx_retries; | 873 | priv->wstats.discard.retries = tx_retries; |
892 | priv->wstats.discard.misc = le32_to_cpu(adapter->logmsg.ackfailure); | 874 | priv->wstats.discard.misc = le32_to_cpu(priv->logmsg.ackfailure); |
893 | 875 | ||
894 | /* Calculate quality */ | 876 | /* Calculate quality */ |
895 | priv->wstats.qual.qual = min_t(u8, quality, 100); | 877 | priv->wstats.qual.qual = min_t(u8, quality, 100); |
@@ -924,14 +906,13 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, | |||
924 | { | 906 | { |
925 | int ret = -EINVAL; | 907 | int ret = -EINVAL; |
926 | struct lbs_private *priv = dev->priv; | 908 | struct lbs_private *priv = dev->priv; |
927 | struct lbs_adapter *adapter = priv->adapter; | ||
928 | struct chan_freq_power *cfp; | 909 | struct chan_freq_power *cfp; |
929 | struct assoc_request * assoc_req; | 910 | struct assoc_request * assoc_req; |
930 | 911 | ||
931 | lbs_deb_enter(LBS_DEB_WEXT); | 912 | lbs_deb_enter(LBS_DEB_WEXT); |
932 | 913 | ||
933 | mutex_lock(&adapter->lock); | 914 | mutex_lock(&priv->lock); |
934 | assoc_req = lbs_get_association_request(adapter); | 915 | assoc_req = lbs_get_association_request(priv); |
935 | if (!assoc_req) { | 916 | if (!assoc_req) { |
936 | ret = -ENOMEM; | 917 | ret = -ENOMEM; |
937 | goto out; | 918 | goto out; |
@@ -941,7 +922,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, | |||
941 | if (fwrq->e == 1) { | 922 | if (fwrq->e == 1) { |
942 | long f = fwrq->m / 100000; | 923 | long f = fwrq->m / 100000; |
943 | 924 | ||
944 | cfp = find_cfp_by_band_and_freq(adapter, 0, f); | 925 | cfp = find_cfp_by_band_and_freq(priv, 0, f); |
945 | if (!cfp) { | 926 | if (!cfp) { |
946 | lbs_deb_wext("invalid freq %ld\n", f); | 927 | lbs_deb_wext("invalid freq %ld\n", f); |
947 | goto out; | 928 | goto out; |
@@ -956,7 +937,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, | |||
956 | goto out; | 937 | goto out; |
957 | } | 938 | } |
958 | 939 | ||
959 | cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, fwrq->m); | 940 | cfp = lbs_find_cfp_by_band_and_channel(priv, 0, fwrq->m); |
960 | if (!cfp) { | 941 | if (!cfp) { |
961 | goto out; | 942 | goto out; |
962 | } | 943 | } |
@@ -971,7 +952,7 @@ out: | |||
971 | } else { | 952 | } else { |
972 | lbs_cancel_association_work(priv); | 953 | lbs_cancel_association_work(priv); |
973 | } | 954 | } |
974 | mutex_unlock(&adapter->lock); | 955 | mutex_unlock(&priv->lock); |
975 | 956 | ||
976 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 957 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
977 | return ret; | 958 | return ret; |
@@ -981,7 +962,6 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
981 | struct iw_param *vwrq, char *extra) | 962 | struct iw_param *vwrq, char *extra) |
982 | { | 963 | { |
983 | struct lbs_private *priv = dev->priv; | 964 | struct lbs_private *priv = dev->priv; |
984 | struct lbs_adapter *adapter = priv->adapter; | ||
985 | u32 new_rate; | 965 | u32 new_rate; |
986 | u16 action; | 966 | u16 action; |
987 | int ret = -EINVAL; | 967 | int ret = -EINVAL; |
@@ -993,14 +973,14 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
993 | /* Auto rate? */ | 973 | /* Auto rate? */ |
994 | if (vwrq->value == -1) { | 974 | if (vwrq->value == -1) { |
995 | action = CMD_ACT_SET_TX_AUTO; | 975 | action = CMD_ACT_SET_TX_AUTO; |
996 | adapter->auto_rate = 1; | 976 | priv->auto_rate = 1; |
997 | adapter->cur_rate = 0; | 977 | priv->cur_rate = 0; |
998 | } else { | 978 | } else { |
999 | if (vwrq->value % 100000) | 979 | if (vwrq->value % 100000) |
1000 | goto out; | 980 | goto out; |
1001 | 981 | ||
1002 | memset(rates, 0, sizeof(rates)); | 982 | memset(rates, 0, sizeof(rates)); |
1003 | copy_active_data_rates(adapter, rates); | 983 | copy_active_data_rates(priv, rates); |
1004 | new_rate = vwrq->value / 500000; | 984 | new_rate = vwrq->value / 500000; |
1005 | if (!memchr(rates, new_rate, sizeof(rates))) { | 985 | if (!memchr(rates, new_rate, sizeof(rates))) { |
1006 | lbs_pr_alert("fixed data rate 0x%X out of range\n", | 986 | lbs_pr_alert("fixed data rate 0x%X out of range\n", |
@@ -1008,9 +988,9 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1008 | goto out; | 988 | goto out; |
1009 | } | 989 | } |
1010 | 990 | ||
1011 | adapter->cur_rate = new_rate; | 991 | priv->cur_rate = new_rate; |
1012 | action = CMD_ACT_SET_TX_FIX_RATE; | 992 | action = CMD_ACT_SET_TX_FIX_RATE; |
1013 | adapter->auto_rate = 0; | 993 | priv->auto_rate = 0; |
1014 | } | 994 | } |
1015 | 995 | ||
1016 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, | 996 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE, |
@@ -1025,14 +1005,13 @@ static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info, | |||
1025 | struct iw_param *vwrq, char *extra) | 1005 | struct iw_param *vwrq, char *extra) |
1026 | { | 1006 | { |
1027 | struct lbs_private *priv = dev->priv; | 1007 | struct lbs_private *priv = dev->priv; |
1028 | struct lbs_adapter *adapter = priv->adapter; | ||
1029 | 1008 | ||
1030 | lbs_deb_enter(LBS_DEB_WEXT); | 1009 | lbs_deb_enter(LBS_DEB_WEXT); |
1031 | 1010 | ||
1032 | if (adapter->connect_status == LBS_CONNECTED) { | 1011 | if (priv->connect_status == LBS_CONNECTED) { |
1033 | vwrq->value = adapter->cur_rate * 500000; | 1012 | vwrq->value = priv->cur_rate * 500000; |
1034 | 1013 | ||
1035 | if (adapter->auto_rate) | 1014 | if (priv->auto_rate) |
1036 | vwrq->fixed = 0; | 1015 | vwrq->fixed = 0; |
1037 | else | 1016 | else |
1038 | vwrq->fixed = 1; | 1017 | vwrq->fixed = 1; |
@@ -1051,7 +1030,6 @@ static int lbs_set_mode(struct net_device *dev, | |||
1051 | { | 1030 | { |
1052 | int ret = 0; | 1031 | int ret = 0; |
1053 | struct lbs_private *priv = dev->priv; | 1032 | struct lbs_private *priv = dev->priv; |
1054 | struct lbs_adapter *adapter = priv->adapter; | ||
1055 | struct assoc_request * assoc_req; | 1033 | struct assoc_request * assoc_req; |
1056 | 1034 | ||
1057 | lbs_deb_enter(LBS_DEB_WEXT); | 1035 | lbs_deb_enter(LBS_DEB_WEXT); |
@@ -1064,8 +1042,8 @@ static int lbs_set_mode(struct net_device *dev, | |||
1064 | goto out; | 1042 | goto out; |
1065 | } | 1043 | } |
1066 | 1044 | ||
1067 | mutex_lock(&adapter->lock); | 1045 | mutex_lock(&priv->lock); |
1068 | assoc_req = lbs_get_association_request(adapter); | 1046 | assoc_req = lbs_get_association_request(priv); |
1069 | if (!assoc_req) { | 1047 | if (!assoc_req) { |
1070 | ret = -ENOMEM; | 1048 | ret = -ENOMEM; |
1071 | lbs_cancel_association_work(priv); | 1049 | lbs_cancel_association_work(priv); |
@@ -1075,7 +1053,7 @@ static int lbs_set_mode(struct net_device *dev, | |||
1075 | lbs_postpone_association_work(priv); | 1053 | lbs_postpone_association_work(priv); |
1076 | lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); | 1054 | lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); |
1077 | } | 1055 | } |
1078 | mutex_unlock(&adapter->lock); | 1056 | mutex_unlock(&priv->lock); |
1079 | 1057 | ||
1080 | out: | 1058 | out: |
1081 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1059 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
@@ -1097,18 +1075,17 @@ static int lbs_get_encode(struct net_device *dev, | |||
1097 | struct iw_point *dwrq, u8 * extra) | 1075 | struct iw_point *dwrq, u8 * extra) |
1098 | { | 1076 | { |
1099 | struct lbs_private *priv = dev->priv; | 1077 | struct lbs_private *priv = dev->priv; |
1100 | struct lbs_adapter *adapter = priv->adapter; | ||
1101 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; | 1078 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; |
1102 | 1079 | ||
1103 | lbs_deb_enter(LBS_DEB_WEXT); | 1080 | lbs_deb_enter(LBS_DEB_WEXT); |
1104 | 1081 | ||
1105 | lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n", | 1082 | lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n", |
1106 | dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); | 1083 | dwrq->flags, index, dwrq->length, priv->wep_tx_keyidx); |
1107 | 1084 | ||
1108 | dwrq->flags = 0; | 1085 | dwrq->flags = 0; |
1109 | 1086 | ||
1110 | /* Authentication method */ | 1087 | /* Authentication method */ |
1111 | switch (adapter->secinfo.auth_mode) { | 1088 | switch (priv->secinfo.auth_mode) { |
1112 | case IW_AUTH_ALG_OPEN_SYSTEM: | 1089 | case IW_AUTH_ALG_OPEN_SYSTEM: |
1113 | dwrq->flags = IW_ENCODE_OPEN; | 1090 | dwrq->flags = IW_ENCODE_OPEN; |
1114 | break; | 1091 | break; |
@@ -1124,22 +1101,22 @@ static int lbs_get_encode(struct net_device *dev, | |||
1124 | 1101 | ||
1125 | memset(extra, 0, 16); | 1102 | memset(extra, 0, 16); |
1126 | 1103 | ||
1127 | mutex_lock(&adapter->lock); | 1104 | mutex_lock(&priv->lock); |
1128 | 1105 | ||
1129 | /* Default to returning current transmit key */ | 1106 | /* Default to returning current transmit key */ |
1130 | if (index < 0) | 1107 | if (index < 0) |
1131 | index = adapter->wep_tx_keyidx; | 1108 | index = priv->wep_tx_keyidx; |
1132 | 1109 | ||
1133 | if ((adapter->wep_keys[index].len) && adapter->secinfo.wep_enabled) { | 1110 | if ((priv->wep_keys[index].len) && priv->secinfo.wep_enabled) { |
1134 | memcpy(extra, adapter->wep_keys[index].key, | 1111 | memcpy(extra, priv->wep_keys[index].key, |
1135 | adapter->wep_keys[index].len); | 1112 | priv->wep_keys[index].len); |
1136 | dwrq->length = adapter->wep_keys[index].len; | 1113 | dwrq->length = priv->wep_keys[index].len; |
1137 | 1114 | ||
1138 | dwrq->flags |= (index + 1); | 1115 | dwrq->flags |= (index + 1); |
1139 | /* Return WEP enabled */ | 1116 | /* Return WEP enabled */ |
1140 | dwrq->flags &= ~IW_ENCODE_DISABLED; | 1117 | dwrq->flags &= ~IW_ENCODE_DISABLED; |
1141 | } else if ((adapter->secinfo.WPAenabled) | 1118 | } else if ((priv->secinfo.WPAenabled) |
1142 | || (adapter->secinfo.WPA2enabled)) { | 1119 | || (priv->secinfo.WPA2enabled)) { |
1143 | /* return WPA enabled */ | 1120 | /* return WPA enabled */ |
1144 | dwrq->flags &= ~IW_ENCODE_DISABLED; | 1121 | dwrq->flags &= ~IW_ENCODE_DISABLED; |
1145 | dwrq->flags |= IW_ENCODE_NOKEY; | 1122 | dwrq->flags |= IW_ENCODE_NOKEY; |
@@ -1147,7 +1124,7 @@ static int lbs_get_encode(struct net_device *dev, | |||
1147 | dwrq->flags |= IW_ENCODE_DISABLED; | 1124 | dwrq->flags |= IW_ENCODE_DISABLED; |
1148 | } | 1125 | } |
1149 | 1126 | ||
1150 | mutex_unlock(&adapter->lock); | 1127 | mutex_unlock(&priv->lock); |
1151 | 1128 | ||
1152 | lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n", | 1129 | lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n", |
1153 | extra[0], extra[1], extra[2], | 1130 | extra[0], extra[1], extra[2], |
@@ -1293,14 +1270,13 @@ static int lbs_set_encode(struct net_device *dev, | |||
1293 | { | 1270 | { |
1294 | int ret = 0; | 1271 | int ret = 0; |
1295 | struct lbs_private *priv = dev->priv; | 1272 | struct lbs_private *priv = dev->priv; |
1296 | struct lbs_adapter *adapter = priv->adapter; | ||
1297 | struct assoc_request * assoc_req; | 1273 | struct assoc_request * assoc_req; |
1298 | u16 is_default = 0, index = 0, set_tx_key = 0; | 1274 | u16 is_default = 0, index = 0, set_tx_key = 0; |
1299 | 1275 | ||
1300 | lbs_deb_enter(LBS_DEB_WEXT); | 1276 | lbs_deb_enter(LBS_DEB_WEXT); |
1301 | 1277 | ||
1302 | mutex_lock(&adapter->lock); | 1278 | mutex_lock(&priv->lock); |
1303 | assoc_req = lbs_get_association_request(adapter); | 1279 | assoc_req = lbs_get_association_request(priv); |
1304 | if (!assoc_req) { | 1280 | if (!assoc_req) { |
1305 | ret = -ENOMEM; | 1281 | ret = -ENOMEM; |
1306 | goto out; | 1282 | goto out; |
@@ -1348,7 +1324,7 @@ out: | |||
1348 | } else { | 1324 | } else { |
1349 | lbs_cancel_association_work(priv); | 1325 | lbs_cancel_association_work(priv); |
1350 | } | 1326 | } |
1351 | mutex_unlock(&adapter->lock); | 1327 | mutex_unlock(&priv->lock); |
1352 | 1328 | ||
1353 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1329 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1354 | return ret; | 1330 | return ret; |
@@ -1370,7 +1346,6 @@ static int lbs_get_encodeext(struct net_device *dev, | |||
1370 | { | 1346 | { |
1371 | int ret = -EINVAL; | 1347 | int ret = -EINVAL; |
1372 | struct lbs_private *priv = dev->priv; | 1348 | struct lbs_private *priv = dev->priv; |
1373 | struct lbs_adapter *adapter = priv->adapter; | ||
1374 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 1349 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
1375 | int index, max_key_len; | 1350 | int index, max_key_len; |
1376 | 1351 | ||
@@ -1386,46 +1361,46 @@ static int lbs_get_encodeext(struct net_device *dev, | |||
1386 | goto out; | 1361 | goto out; |
1387 | index--; | 1362 | index--; |
1388 | } else { | 1363 | } else { |
1389 | index = adapter->wep_tx_keyidx; | 1364 | index = priv->wep_tx_keyidx; |
1390 | } | 1365 | } |
1391 | 1366 | ||
1392 | if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && | 1367 | if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && |
1393 | ext->alg != IW_ENCODE_ALG_WEP) { | 1368 | ext->alg != IW_ENCODE_ALG_WEP) { |
1394 | if (index != 0 || adapter->mode != IW_MODE_INFRA) | 1369 | if (index != 0 || priv->mode != IW_MODE_INFRA) |
1395 | goto out; | 1370 | goto out; |
1396 | } | 1371 | } |
1397 | 1372 | ||
1398 | dwrq->flags = index + 1; | 1373 | dwrq->flags = index + 1; |
1399 | memset(ext, 0, sizeof(*ext)); | 1374 | memset(ext, 0, sizeof(*ext)); |
1400 | 1375 | ||
1401 | if ( !adapter->secinfo.wep_enabled | 1376 | if ( !priv->secinfo.wep_enabled |
1402 | && !adapter->secinfo.WPAenabled | 1377 | && !priv->secinfo.WPAenabled |
1403 | && !adapter->secinfo.WPA2enabled) { | 1378 | && !priv->secinfo.WPA2enabled) { |
1404 | ext->alg = IW_ENCODE_ALG_NONE; | 1379 | ext->alg = IW_ENCODE_ALG_NONE; |
1405 | ext->key_len = 0; | 1380 | ext->key_len = 0; |
1406 | dwrq->flags |= IW_ENCODE_DISABLED; | 1381 | dwrq->flags |= IW_ENCODE_DISABLED; |
1407 | } else { | 1382 | } else { |
1408 | u8 *key = NULL; | 1383 | u8 *key = NULL; |
1409 | 1384 | ||
1410 | if ( adapter->secinfo.wep_enabled | 1385 | if ( priv->secinfo.wep_enabled |
1411 | && !adapter->secinfo.WPAenabled | 1386 | && !priv->secinfo.WPAenabled |
1412 | && !adapter->secinfo.WPA2enabled) { | 1387 | && !priv->secinfo.WPA2enabled) { |
1413 | /* WEP */ | 1388 | /* WEP */ |
1414 | ext->alg = IW_ENCODE_ALG_WEP; | 1389 | ext->alg = IW_ENCODE_ALG_WEP; |
1415 | ext->key_len = adapter->wep_keys[index].len; | 1390 | ext->key_len = priv->wep_keys[index].len; |
1416 | key = &adapter->wep_keys[index].key[0]; | 1391 | key = &priv->wep_keys[index].key[0]; |
1417 | } else if ( !adapter->secinfo.wep_enabled | 1392 | } else if ( !priv->secinfo.wep_enabled |
1418 | && (adapter->secinfo.WPAenabled || | 1393 | && (priv->secinfo.WPAenabled || |
1419 | adapter->secinfo.WPA2enabled)) { | 1394 | priv->secinfo.WPA2enabled)) { |
1420 | /* WPA */ | 1395 | /* WPA */ |
1421 | struct enc_key * pkey = NULL; | 1396 | struct enc_key * pkey = NULL; |
1422 | 1397 | ||
1423 | if ( adapter->wpa_mcast_key.len | 1398 | if ( priv->wpa_mcast_key.len |
1424 | && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) | 1399 | && (priv->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) |
1425 | pkey = &adapter->wpa_mcast_key; | 1400 | pkey = &priv->wpa_mcast_key; |
1426 | else if ( adapter->wpa_unicast_key.len | 1401 | else if ( priv->wpa_unicast_key.len |
1427 | && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) | 1402 | && (priv->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) |
1428 | pkey = &adapter->wpa_unicast_key; | 1403 | pkey = &priv->wpa_unicast_key; |
1429 | 1404 | ||
1430 | if (pkey) { | 1405 | if (pkey) { |
1431 | if (pkey->type == KEY_TYPE_ID_AES) { | 1406 | if (pkey->type == KEY_TYPE_ID_AES) { |
@@ -1477,15 +1452,14 @@ static int lbs_set_encodeext(struct net_device *dev, | |||
1477 | { | 1452 | { |
1478 | int ret = 0; | 1453 | int ret = 0; |
1479 | struct lbs_private *priv = dev->priv; | 1454 | struct lbs_private *priv = dev->priv; |
1480 | struct lbs_adapter *adapter = priv->adapter; | ||
1481 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 1455 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
1482 | int alg = ext->alg; | 1456 | int alg = ext->alg; |
1483 | struct assoc_request * assoc_req; | 1457 | struct assoc_request * assoc_req; |
1484 | 1458 | ||
1485 | lbs_deb_enter(LBS_DEB_WEXT); | 1459 | lbs_deb_enter(LBS_DEB_WEXT); |
1486 | 1460 | ||
1487 | mutex_lock(&adapter->lock); | 1461 | mutex_lock(&priv->lock); |
1488 | assoc_req = lbs_get_association_request(adapter); | 1462 | assoc_req = lbs_get_association_request(priv); |
1489 | if (!assoc_req) { | 1463 | if (!assoc_req) { |
1490 | ret = -ENOMEM; | 1464 | ret = -ENOMEM; |
1491 | goto out; | 1465 | goto out; |
@@ -1589,7 +1563,7 @@ out: | |||
1589 | } else { | 1563 | } else { |
1590 | lbs_cancel_association_work(priv); | 1564 | lbs_cancel_association_work(priv); |
1591 | } | 1565 | } |
1592 | mutex_unlock(&adapter->lock); | 1566 | mutex_unlock(&priv->lock); |
1593 | 1567 | ||
1594 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1568 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1595 | return ret; | 1569 | return ret; |
@@ -1602,14 +1576,13 @@ static int lbs_set_genie(struct net_device *dev, | |||
1602 | char *extra) | 1576 | char *extra) |
1603 | { | 1577 | { |
1604 | struct lbs_private *priv = dev->priv; | 1578 | struct lbs_private *priv = dev->priv; |
1605 | struct lbs_adapter *adapter = priv->adapter; | ||
1606 | int ret = 0; | 1579 | int ret = 0; |
1607 | struct assoc_request * assoc_req; | 1580 | struct assoc_request * assoc_req; |
1608 | 1581 | ||
1609 | lbs_deb_enter(LBS_DEB_WEXT); | 1582 | lbs_deb_enter(LBS_DEB_WEXT); |
1610 | 1583 | ||
1611 | mutex_lock(&adapter->lock); | 1584 | mutex_lock(&priv->lock); |
1612 | assoc_req = lbs_get_association_request(adapter); | 1585 | assoc_req = lbs_get_association_request(priv); |
1613 | if (!assoc_req) { | 1586 | if (!assoc_req) { |
1614 | ret = -ENOMEM; | 1587 | ret = -ENOMEM; |
1615 | goto out; | 1588 | goto out; |
@@ -1625,7 +1598,7 @@ static int lbs_set_genie(struct net_device *dev, | |||
1625 | memcpy(&assoc_req->wpa_ie[0], extra, dwrq->length); | 1598 | memcpy(&assoc_req->wpa_ie[0], extra, dwrq->length); |
1626 | assoc_req->wpa_ie_len = dwrq->length; | 1599 | assoc_req->wpa_ie_len = dwrq->length; |
1627 | } else { | 1600 | } else { |
1628 | memset(&assoc_req->wpa_ie[0], 0, sizeof(adapter->wpa_ie)); | 1601 | memset(&assoc_req->wpa_ie[0], 0, sizeof(priv->wpa_ie)); |
1629 | assoc_req->wpa_ie_len = 0; | 1602 | assoc_req->wpa_ie_len = 0; |
1630 | } | 1603 | } |
1631 | 1604 | ||
@@ -1636,7 +1609,7 @@ out: | |||
1636 | } else { | 1609 | } else { |
1637 | lbs_cancel_association_work(priv); | 1610 | lbs_cancel_association_work(priv); |
1638 | } | 1611 | } |
1639 | mutex_unlock(&adapter->lock); | 1612 | mutex_unlock(&priv->lock); |
1640 | 1613 | ||
1641 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1614 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1642 | return ret; | 1615 | return ret; |
@@ -1649,22 +1622,21 @@ static int lbs_get_genie(struct net_device *dev, | |||
1649 | { | 1622 | { |
1650 | int ret = 0; | 1623 | int ret = 0; |
1651 | struct lbs_private *priv = dev->priv; | 1624 | struct lbs_private *priv = dev->priv; |
1652 | struct lbs_adapter *adapter = priv->adapter; | ||
1653 | 1625 | ||
1654 | lbs_deb_enter(LBS_DEB_WEXT); | 1626 | lbs_deb_enter(LBS_DEB_WEXT); |
1655 | 1627 | ||
1656 | if (adapter->wpa_ie_len == 0) { | 1628 | if (priv->wpa_ie_len == 0) { |
1657 | dwrq->length = 0; | 1629 | dwrq->length = 0; |
1658 | goto out; | 1630 | goto out; |
1659 | } | 1631 | } |
1660 | 1632 | ||
1661 | if (dwrq->length < adapter->wpa_ie_len) { | 1633 | if (dwrq->length < priv->wpa_ie_len) { |
1662 | ret = -E2BIG; | 1634 | ret = -E2BIG; |
1663 | goto out; | 1635 | goto out; |
1664 | } | 1636 | } |
1665 | 1637 | ||
1666 | dwrq->length = adapter->wpa_ie_len; | 1638 | dwrq->length = priv->wpa_ie_len; |
1667 | memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); | 1639 | memcpy(extra, &priv->wpa_ie[0], priv->wpa_ie_len); |
1668 | 1640 | ||
1669 | out: | 1641 | out: |
1670 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1642 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
@@ -1678,15 +1650,14 @@ static int lbs_set_auth(struct net_device *dev, | |||
1678 | char *extra) | 1650 | char *extra) |
1679 | { | 1651 | { |
1680 | struct lbs_private *priv = dev->priv; | 1652 | struct lbs_private *priv = dev->priv; |
1681 | struct lbs_adapter *adapter = priv->adapter; | ||
1682 | struct assoc_request * assoc_req; | 1653 | struct assoc_request * assoc_req; |
1683 | int ret = 0; | 1654 | int ret = 0; |
1684 | int updated = 0; | 1655 | int updated = 0; |
1685 | 1656 | ||
1686 | lbs_deb_enter(LBS_DEB_WEXT); | 1657 | lbs_deb_enter(LBS_DEB_WEXT); |
1687 | 1658 | ||
1688 | mutex_lock(&adapter->lock); | 1659 | mutex_lock(&priv->lock); |
1689 | assoc_req = lbs_get_association_request(adapter); | 1660 | assoc_req = lbs_get_association_request(priv); |
1690 | if (!assoc_req) { | 1661 | if (!assoc_req) { |
1691 | ret = -ENOMEM; | 1662 | ret = -ENOMEM; |
1692 | goto out; | 1663 | goto out; |
@@ -1765,7 +1736,7 @@ out: | |||
1765 | } else if (ret != -EOPNOTSUPP) { | 1736 | } else if (ret != -EOPNOTSUPP) { |
1766 | lbs_cancel_association_work(priv); | 1737 | lbs_cancel_association_work(priv); |
1767 | } | 1738 | } |
1768 | mutex_unlock(&adapter->lock); | 1739 | mutex_unlock(&priv->lock); |
1769 | 1740 | ||
1770 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1741 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1771 | return ret; | 1742 | return ret; |
@@ -1778,27 +1749,26 @@ static int lbs_get_auth(struct net_device *dev, | |||
1778 | { | 1749 | { |
1779 | int ret = 0; | 1750 | int ret = 0; |
1780 | struct lbs_private *priv = dev->priv; | 1751 | struct lbs_private *priv = dev->priv; |
1781 | struct lbs_adapter *adapter = priv->adapter; | ||
1782 | 1752 | ||
1783 | lbs_deb_enter(LBS_DEB_WEXT); | 1753 | lbs_deb_enter(LBS_DEB_WEXT); |
1784 | 1754 | ||
1785 | switch (dwrq->flags & IW_AUTH_INDEX) { | 1755 | switch (dwrq->flags & IW_AUTH_INDEX) { |
1786 | case IW_AUTH_WPA_VERSION: | 1756 | case IW_AUTH_WPA_VERSION: |
1787 | dwrq->value = 0; | 1757 | dwrq->value = 0; |
1788 | if (adapter->secinfo.WPAenabled) | 1758 | if (priv->secinfo.WPAenabled) |
1789 | dwrq->value |= IW_AUTH_WPA_VERSION_WPA; | 1759 | dwrq->value |= IW_AUTH_WPA_VERSION_WPA; |
1790 | if (adapter->secinfo.WPA2enabled) | 1760 | if (priv->secinfo.WPA2enabled) |
1791 | dwrq->value |= IW_AUTH_WPA_VERSION_WPA2; | 1761 | dwrq->value |= IW_AUTH_WPA_VERSION_WPA2; |
1792 | if (!dwrq->value) | 1762 | if (!dwrq->value) |
1793 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; | 1763 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; |
1794 | break; | 1764 | break; |
1795 | 1765 | ||
1796 | case IW_AUTH_80211_AUTH_ALG: | 1766 | case IW_AUTH_80211_AUTH_ALG: |
1797 | dwrq->value = adapter->secinfo.auth_mode; | 1767 | dwrq->value = priv->secinfo.auth_mode; |
1798 | break; | 1768 | break; |
1799 | 1769 | ||
1800 | case IW_AUTH_WPA_ENABLED: | 1770 | case IW_AUTH_WPA_ENABLED: |
1801 | if (adapter->secinfo.WPAenabled && adapter->secinfo.WPA2enabled) | 1771 | if (priv->secinfo.WPAenabled && priv->secinfo.WPA2enabled) |
1802 | dwrq->value = 1; | 1772 | dwrq->value = 1; |
1803 | break; | 1773 | break; |
1804 | 1774 | ||
@@ -1816,7 +1786,6 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, | |||
1816 | { | 1786 | { |
1817 | int ret = 0; | 1787 | int ret = 0; |
1818 | struct lbs_private *priv = dev->priv; | 1788 | struct lbs_private *priv = dev->priv; |
1819 | struct lbs_adapter *adapter = priv->adapter; | ||
1820 | 1789 | ||
1821 | u16 dbm; | 1790 | u16 dbm; |
1822 | 1791 | ||
@@ -1827,7 +1796,7 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, | |||
1827 | return 0; | 1796 | return 0; |
1828 | } | 1797 | } |
1829 | 1798 | ||
1830 | adapter->preamble = CMD_TYPE_AUTO_PREAMBLE; | 1799 | priv->preamble = CMD_TYPE_AUTO_PREAMBLE; |
1831 | 1800 | ||
1832 | lbs_radio_ioctl(priv, RADIO_ON); | 1801 | lbs_radio_ioctl(priv, RADIO_ON); |
1833 | 1802 | ||
@@ -1858,7 +1827,6 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
1858 | struct iw_point *dwrq, char *extra) | 1827 | struct iw_point *dwrq, char *extra) |
1859 | { | 1828 | { |
1860 | struct lbs_private *priv = dev->priv; | 1829 | struct lbs_private *priv = dev->priv; |
1861 | struct lbs_adapter *adapter = priv->adapter; | ||
1862 | 1830 | ||
1863 | lbs_deb_enter(LBS_DEB_WEXT); | 1831 | lbs_deb_enter(LBS_DEB_WEXT); |
1864 | 1832 | ||
@@ -1870,19 +1838,19 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
1870 | /* | 1838 | /* |
1871 | * Get the current SSID | 1839 | * Get the current SSID |
1872 | */ | 1840 | */ |
1873 | if (adapter->connect_status == LBS_CONNECTED) { | 1841 | if (priv->connect_status == LBS_CONNECTED) { |
1874 | memcpy(extra, adapter->curbssparams.ssid, | 1842 | memcpy(extra, priv->curbssparams.ssid, |
1875 | adapter->curbssparams.ssid_len); | 1843 | priv->curbssparams.ssid_len); |
1876 | extra[adapter->curbssparams.ssid_len] = '\0'; | 1844 | extra[priv->curbssparams.ssid_len] = '\0'; |
1877 | } else { | 1845 | } else { |
1878 | memset(extra, 0, 32); | 1846 | memset(extra, 0, 32); |
1879 | extra[adapter->curbssparams.ssid_len] = '\0'; | 1847 | extra[priv->curbssparams.ssid_len] = '\0'; |
1880 | } | 1848 | } |
1881 | /* | 1849 | /* |
1882 | * If none, we may want to get the one that was set | 1850 | * If none, we may want to get the one that was set |
1883 | */ | 1851 | */ |
1884 | 1852 | ||
1885 | dwrq->length = adapter->curbssparams.ssid_len; | 1853 | dwrq->length = priv->curbssparams.ssid_len; |
1886 | 1854 | ||
1887 | dwrq->flags = 1; /* active */ | 1855 | dwrq->flags = 1; /* active */ |
1888 | 1856 | ||
@@ -1894,7 +1862,6 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, | |||
1894 | struct iw_point *dwrq, char *extra) | 1862 | struct iw_point *dwrq, char *extra) |
1895 | { | 1863 | { |
1896 | struct lbs_private *priv = dev->priv; | 1864 | struct lbs_private *priv = dev->priv; |
1897 | struct lbs_adapter *adapter = priv->adapter; | ||
1898 | int ret = 0; | 1865 | int ret = 0; |
1899 | u8 ssid[IW_ESSID_MAX_SIZE]; | 1866 | u8 ssid[IW_ESSID_MAX_SIZE]; |
1900 | u8 ssid_len = 0; | 1867 | u8 ssid_len = 0; |
@@ -1927,10 +1894,10 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, | |||
1927 | } | 1894 | } |
1928 | 1895 | ||
1929 | out: | 1896 | out: |
1930 | mutex_lock(&adapter->lock); | 1897 | mutex_lock(&priv->lock); |
1931 | if (ret == 0) { | 1898 | if (ret == 0) { |
1932 | /* Get or create the current association request */ | 1899 | /* Get or create the current association request */ |
1933 | assoc_req = lbs_get_association_request(adapter); | 1900 | assoc_req = lbs_get_association_request(priv); |
1934 | if (!assoc_req) { | 1901 | if (!assoc_req) { |
1935 | ret = -ENOMEM; | 1902 | ret = -ENOMEM; |
1936 | } else { | 1903 | } else { |
@@ -1947,7 +1914,7 @@ out: | |||
1947 | lbs_cancel_association_work(priv); | 1914 | lbs_cancel_association_work(priv); |
1948 | } | 1915 | } |
1949 | 1916 | ||
1950 | mutex_unlock(&adapter->lock); | 1917 | mutex_unlock(&priv->lock); |
1951 | 1918 | ||
1952 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1919 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1953 | return ret; | 1920 | return ret; |
@@ -1966,7 +1933,6 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, | |||
1966 | struct sockaddr *awrq, char *extra) | 1933 | struct sockaddr *awrq, char *extra) |
1967 | { | 1934 | { |
1968 | struct lbs_private *priv = dev->priv; | 1935 | struct lbs_private *priv = dev->priv; |
1969 | struct lbs_adapter *adapter = priv->adapter; | ||
1970 | struct assoc_request * assoc_req; | 1936 | struct assoc_request * assoc_req; |
1971 | int ret = 0; | 1937 | int ret = 0; |
1972 | DECLARE_MAC_BUF(mac); | 1938 | DECLARE_MAC_BUF(mac); |
@@ -1978,10 +1944,10 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, | |||
1978 | 1944 | ||
1979 | lbs_deb_wext("ASSOC: WAP: sa_data %s\n", print_mac(mac, awrq->sa_data)); | 1945 | lbs_deb_wext("ASSOC: WAP: sa_data %s\n", print_mac(mac, awrq->sa_data)); |
1980 | 1946 | ||
1981 | mutex_lock(&adapter->lock); | 1947 | mutex_lock(&priv->lock); |
1982 | 1948 | ||
1983 | /* Get or create the current association request */ | 1949 | /* Get or create the current association request */ |
1984 | assoc_req = lbs_get_association_request(adapter); | 1950 | assoc_req = lbs_get_association_request(priv); |
1985 | if (!assoc_req) { | 1951 | if (!assoc_req) { |
1986 | lbs_cancel_association_work(priv); | 1952 | lbs_cancel_association_work(priv); |
1987 | ret = -ENOMEM; | 1953 | ret = -ENOMEM; |
@@ -1992,30 +1958,30 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, | |||
1992 | lbs_postpone_association_work(priv); | 1958 | lbs_postpone_association_work(priv); |
1993 | } | 1959 | } |
1994 | 1960 | ||
1995 | mutex_unlock(&adapter->lock); | 1961 | mutex_unlock(&priv->lock); |
1996 | 1962 | ||
1997 | return ret; | 1963 | return ret; |
1998 | } | 1964 | } |
1999 | 1965 | ||
2000 | void lbs_get_fwversion(struct lbs_adapter *adapter, char *fwversion, int maxlen) | 1966 | void lbs_get_fwversion(struct lbs_private *priv, char *fwversion, int maxlen) |
2001 | { | 1967 | { |
2002 | char fwver[32]; | 1968 | char fwver[32]; |
2003 | 1969 | ||
2004 | mutex_lock(&adapter->lock); | 1970 | mutex_lock(&priv->lock); |
2005 | 1971 | ||
2006 | if (adapter->fwreleasenumber[3] == 0) | 1972 | if (priv->fwreleasenumber[3] == 0) |
2007 | sprintf(fwver, "%u.%u.%u", | 1973 | sprintf(fwver, "%u.%u.%u", |
2008 | adapter->fwreleasenumber[2], | 1974 | priv->fwreleasenumber[2], |
2009 | adapter->fwreleasenumber[1], | 1975 | priv->fwreleasenumber[1], |
2010 | adapter->fwreleasenumber[0]); | 1976 | priv->fwreleasenumber[0]); |
2011 | else | 1977 | else |
2012 | sprintf(fwver, "%u.%u.%u.p%u", | 1978 | sprintf(fwver, "%u.%u.%u.p%u", |
2013 | adapter->fwreleasenumber[2], | 1979 | priv->fwreleasenumber[2], |
2014 | adapter->fwreleasenumber[1], | 1980 | priv->fwreleasenumber[1], |
2015 | adapter->fwreleasenumber[0], | 1981 | priv->fwreleasenumber[0], |
2016 | adapter->fwreleasenumber[3]); | 1982 | priv->fwreleasenumber[3]); |
2017 | 1983 | ||
2018 | mutex_unlock(&adapter->lock); | 1984 | mutex_unlock(&priv->lock); |
2019 | snprintf(fwversion, maxlen, fwver); | 1985 | snprintf(fwversion, maxlen, fwver); |
2020 | } | 1986 | } |
2021 | 1987 | ||