diff options
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 141 |
1 files changed, 74 insertions, 67 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index e8cadad2c86..d86fcf0a5ad 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -266,21 +266,17 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
266 | { | 266 | { |
267 | int ret = 0; | 267 | int ret = 0; |
268 | struct lbs_private *priv = dev->priv; | 268 | struct lbs_private *priv = dev->priv; |
269 | u32 rthr = vwrq->value; | 269 | u32 val = vwrq->value; |
270 | 270 | ||
271 | lbs_deb_enter(LBS_DEB_WEXT); | 271 | lbs_deb_enter(LBS_DEB_WEXT); |
272 | 272 | ||
273 | if (vwrq->disabled) { | 273 | if (vwrq->disabled) |
274 | priv->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; | 274 | val = MRVDRV_RTS_MAX_VALUE; |
275 | } else { | 275 | |
276 | if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE) | 276 | if (val < MRVDRV_RTS_MIN_VALUE || val > MRVDRV_RTS_MAX_VALUE) |
277 | return -EINVAL; | 277 | return -EINVAL; |
278 | priv->rtsthsd = rthr; | ||
279 | } | ||
280 | 278 | ||
281 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 279 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, (u16) val); |
282 | CMD_ACT_SET, CMD_OPTION_WAITFORRSP, | ||
283 | OID_802_11_RTS_THRESHOLD, &rthr); | ||
284 | 280 | ||
285 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 281 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
286 | return ret; | 282 | return ret; |
@@ -289,21 +285,19 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
289 | static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, | 285 | static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, |
290 | struct iw_param *vwrq, char *extra) | 286 | struct iw_param *vwrq, char *extra) |
291 | { | 287 | { |
292 | int ret = 0; | ||
293 | struct lbs_private *priv = dev->priv; | 288 | struct lbs_private *priv = dev->priv; |
289 | int ret = 0; | ||
290 | u16 val = 0; | ||
294 | 291 | ||
295 | lbs_deb_enter(LBS_DEB_WEXT); | 292 | lbs_deb_enter(LBS_DEB_WEXT); |
296 | 293 | ||
297 | priv->rtsthsd = 0; | 294 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, &val); |
298 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | ||
299 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | ||
300 | OID_802_11_RTS_THRESHOLD, NULL); | ||
301 | if (ret) | 295 | if (ret) |
302 | goto out; | 296 | goto out; |
303 | 297 | ||
304 | vwrq->value = priv->rtsthsd; | 298 | vwrq->value = val; |
305 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) | 299 | vwrq->disabled = ((val < MRVDRV_RTS_MIN_VALUE) |
306 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); | 300 | || (val > MRVDRV_RTS_MAX_VALUE)); |
307 | vwrq->fixed = 1; | 301 | vwrq->fixed = 1; |
308 | 302 | ||
309 | out: | 303 | out: |
@@ -314,24 +308,19 @@ out: | |||
314 | static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, | 308 | static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, |
315 | struct iw_param *vwrq, char *extra) | 309 | struct iw_param *vwrq, char *extra) |
316 | { | 310 | { |
317 | int ret = 0; | ||
318 | u32 fthr = vwrq->value; | ||
319 | struct lbs_private *priv = dev->priv; | 311 | struct lbs_private *priv = dev->priv; |
312 | int ret = 0; | ||
313 | u32 val = vwrq->value; | ||
320 | 314 | ||
321 | lbs_deb_enter(LBS_DEB_WEXT); | 315 | lbs_deb_enter(LBS_DEB_WEXT); |
322 | 316 | ||
323 | if (vwrq->disabled) { | 317 | if (vwrq->disabled) |
324 | priv->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; | 318 | val = MRVDRV_FRAG_MAX_VALUE; |
325 | } else { | 319 | |
326 | if (fthr < MRVDRV_FRAG_MIN_VALUE | 320 | if (val < MRVDRV_FRAG_MIN_VALUE || val > MRVDRV_FRAG_MAX_VALUE) |
327 | || fthr > MRVDRV_FRAG_MAX_VALUE) | 321 | return -EINVAL; |
328 | return -EINVAL; | ||
329 | priv->fragthsd = fthr; | ||
330 | } | ||
331 | 322 | ||
332 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 323 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, (u16) val); |
333 | CMD_ACT_SET, CMD_OPTION_WAITFORRSP, | ||
334 | OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); | ||
335 | 324 | ||
336 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 325 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
337 | return ret; | 326 | return ret; |
@@ -340,22 +329,19 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, | |||
340 | static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, | 329 | static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, |
341 | struct iw_param *vwrq, char *extra) | 330 | struct iw_param *vwrq, char *extra) |
342 | { | 331 | { |
343 | int ret = 0; | ||
344 | struct lbs_private *priv = dev->priv; | 332 | struct lbs_private *priv = dev->priv; |
333 | int ret = 0; | ||
334 | u16 val = 0; | ||
345 | 335 | ||
346 | lbs_deb_enter(LBS_DEB_WEXT); | 336 | lbs_deb_enter(LBS_DEB_WEXT); |
347 | 337 | ||
348 | priv->fragthsd = 0; | 338 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, &val); |
349 | ret = lbs_prepare_and_send_command(priv, | ||
350 | CMD_802_11_SNMP_MIB, | ||
351 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | ||
352 | OID_802_11_FRAGMENTATION_THRESHOLD, NULL); | ||
353 | if (ret) | 339 | if (ret) |
354 | goto out; | 340 | goto out; |
355 | 341 | ||
356 | vwrq->value = priv->fragthsd; | 342 | vwrq->value = val; |
357 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) | 343 | vwrq->disabled = ((val < MRVDRV_FRAG_MIN_VALUE) |
358 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); | 344 | || (val > MRVDRV_FRAG_MAX_VALUE)); |
359 | vwrq->fixed = 1; | 345 | vwrq->fixed = 1; |
360 | 346 | ||
361 | out: | 347 | out: |
@@ -382,7 +368,7 @@ static int mesh_wlan_get_mode(struct net_device *dev, | |||
382 | { | 368 | { |
383 | lbs_deb_enter(LBS_DEB_WEXT); | 369 | lbs_deb_enter(LBS_DEB_WEXT); |
384 | 370 | ||
385 | *uwrq = IW_MODE_REPEAT ; | 371 | *uwrq = IW_MODE_REPEAT; |
386 | 372 | ||
387 | lbs_deb_leave(LBS_DEB_WEXT); | 373 | lbs_deb_leave(LBS_DEB_WEXT); |
388 | return 0; | 374 | return 0; |
@@ -425,31 +411,44 @@ out: | |||
425 | static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, | 411 | static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, |
426 | struct iw_param *vwrq, char *extra) | 412 | struct iw_param *vwrq, char *extra) |
427 | { | 413 | { |
428 | int ret = 0; | ||
429 | struct lbs_private *priv = dev->priv; | 414 | struct lbs_private *priv = dev->priv; |
415 | int ret = 0; | ||
416 | u16 slimit = 0, llimit = 0; | ||
430 | 417 | ||
431 | lbs_deb_enter(LBS_DEB_WEXT); | 418 | lbs_deb_enter(LBS_DEB_WEXT); |
432 | 419 | ||
433 | if (vwrq->flags == IW_RETRY_LIMIT) { | 420 | if ((vwrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) |
434 | /* The MAC has a 4-bit Total_Tx_Count register | 421 | return -EOPNOTSUPP; |
435 | Total_Tx_Count = 1 + Tx_Retry_Count */ | 422 | |
423 | /* The MAC has a 4-bit Total_Tx_Count register | ||
424 | Total_Tx_Count = 1 + Tx_Retry_Count */ | ||
436 | #define TX_RETRY_MIN 0 | 425 | #define TX_RETRY_MIN 0 |
437 | #define TX_RETRY_MAX 14 | 426 | #define TX_RETRY_MAX 14 |
438 | if (vwrq->value < TX_RETRY_MIN || vwrq->value > TX_RETRY_MAX) | 427 | if (vwrq->value < TX_RETRY_MIN || vwrq->value > TX_RETRY_MAX) |
439 | return -EINVAL; | 428 | return -EINVAL; |
440 | 429 | ||
441 | /* Adding 1 to convert retry count to try count */ | 430 | /* Add 1 to convert retry count to try count */ |
442 | priv->txretrycount = vwrq->value + 1; | 431 | if (vwrq->flags & IW_RETRY_SHORT) |
432 | slimit = (u16) (vwrq->value + 1); | ||
433 | else if (vwrq->flags & IW_RETRY_LONG) | ||
434 | llimit = (u16) (vwrq->value + 1); | ||
435 | else | ||
436 | slimit = llimit = (u16) (vwrq->value + 1); /* set both */ | ||
443 | 437 | ||
444 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 438 | if (llimit) { |
445 | CMD_ACT_SET, | 439 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_LONG_RETRY_LIMIT, |
446 | CMD_OPTION_WAITFORRSP, | 440 | llimit); |
447 | OID_802_11_TX_RETRYCOUNT, NULL); | 441 | if (ret) |
442 | goto out; | ||
443 | } | ||
448 | 444 | ||
445 | if (slimit) { | ||
446 | /* txretrycount follows the short retry limit */ | ||
447 | priv->txretrycount = slimit; | ||
448 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_SHORT_RETRY_LIMIT, | ||
449 | slimit); | ||
449 | if (ret) | 450 | if (ret) |
450 | goto out; | 451 | goto out; |
451 | } else { | ||
452 | return -EOPNOTSUPP; | ||
453 | } | 452 | } |
454 | 453 | ||
455 | out: | 454 | out: |
@@ -462,22 +461,30 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
462 | { | 461 | { |
463 | struct lbs_private *priv = dev->priv; | 462 | struct lbs_private *priv = dev->priv; |
464 | int ret = 0; | 463 | int ret = 0; |
464 | u16 val = 0; | ||
465 | 465 | ||
466 | lbs_deb_enter(LBS_DEB_WEXT); | 466 | lbs_deb_enter(LBS_DEB_WEXT); |
467 | 467 | ||
468 | priv->txretrycount = 0; | ||
469 | ret = lbs_prepare_and_send_command(priv, | ||
470 | CMD_802_11_SNMP_MIB, | ||
471 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | ||
472 | OID_802_11_TX_RETRYCOUNT, NULL); | ||
473 | if (ret) | ||
474 | goto out; | ||
475 | |||
476 | vwrq->disabled = 0; | 468 | vwrq->disabled = 0; |
477 | if (!vwrq->flags) { | 469 | |
478 | vwrq->flags = IW_RETRY_LIMIT; | 470 | if (vwrq->flags & IW_RETRY_LONG) { |
471 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_LONG_RETRY_LIMIT, &val); | ||
472 | if (ret) | ||
473 | goto out; | ||
474 | |||
475 | /* Subtract 1 to convert try count to retry count */ | ||
476 | vwrq->value = val - 1; | ||
477 | vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; | ||
478 | } else { | ||
479 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_SHORT_RETRY_LIMIT, &val); | ||
480 | if (ret) | ||
481 | goto out; | ||
482 | |||
483 | /* txretry count follows the short retry limit */ | ||
484 | priv->txretrycount = val; | ||
479 | /* Subtract 1 to convert try count to retry count */ | 485 | /* Subtract 1 to convert try count to retry count */ |
480 | vwrq->value = priv->txretrycount - 1; | 486 | vwrq->value = val - 1; |
487 | vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; | ||
481 | } | 488 | } |
482 | 489 | ||
483 | out: | 490 | out: |