aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2012-05-08 21:30:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-16 12:46:35 -0400
commit4f02341ac27f70700a4fff4f3671857ca4227822 (patch)
treeb6e1997054f1978bb3f52b06b3a1b81795557c24 /drivers/net/wireless/mwifiex
parent26134e6eb512016edf17b4a904b1c19b22669421 (diff)
mwifiex: handle interface type changes correctly
mlan0: managed or ibss The iftype can be changed from STATION to ADHOC, and vice versa. uap0: AP only The iftype cannot be changed. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: Kiran Divekar <dkiran@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c64
1 files changed, 46 insertions, 18 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index f3465fc89b40..a8fa5cba2028 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -497,31 +497,59 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
497 int ret; 497 int ret;
498 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 498 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
499 499
500 if (priv->bss_mode == type) { 500 switch (dev->ieee80211_ptr->iftype) {
501 wiphy_warn(wiphy, "already set to required type\n");
502 return 0;
503 }
504
505 priv->bss_mode = type;
506
507 switch (type) {
508 case NL80211_IFTYPE_ADHOC: 501 case NL80211_IFTYPE_ADHOC:
509 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_ADHOC; 502 switch (type) {
510 wiphy_dbg(wiphy, "info: setting interface type to adhoc\n"); 503 case NL80211_IFTYPE_STATION:
504 break;
505 case NL80211_IFTYPE_UNSPECIFIED:
506 wiphy_warn(wiphy, "%s: kept type as IBSS\n", dev->name);
507 case NL80211_IFTYPE_ADHOC: /* This shouldn't happen */
508 return 0;
509 case NL80211_IFTYPE_AP:
510 default:
511 wiphy_err(wiphy, "%s: changing to %d not supported\n",
512 dev->name, type);
513 return -EOPNOTSUPP;
514 }
511 break; 515 break;
512 case NL80211_IFTYPE_STATION: 516 case NL80211_IFTYPE_STATION:
513 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION; 517 switch (type) {
514 wiphy_dbg(wiphy, "info: setting interface type to managed\n"); 518 case NL80211_IFTYPE_ADHOC:
519 break;
520 case NL80211_IFTYPE_UNSPECIFIED:
521 wiphy_warn(wiphy, "%s: kept type as STA\n", dev->name);
522 case NL80211_IFTYPE_STATION: /* This shouldn't happen */
523 return 0;
524 case NL80211_IFTYPE_AP:
525 default:
526 wiphy_err(wiphy, "%s: changing to %d not supported\n",
527 dev->name, type);
528 return -EOPNOTSUPP;
529 }
530 break;
531 case NL80211_IFTYPE_AP:
532 switch (type) {
533 case NL80211_IFTYPE_UNSPECIFIED:
534 wiphy_warn(wiphy, "%s: kept type as AP\n", dev->name);
535 case NL80211_IFTYPE_AP: /* This shouldn't happen */
536 return 0;
537 case NL80211_IFTYPE_ADHOC:
538 case NL80211_IFTYPE_STATION:
539 default:
540 wiphy_err(wiphy, "%s: changing to %d not supported\n",
541 dev->name, type);
542 return -EOPNOTSUPP;
543 }
515 break; 544 break;
516 case NL80211_IFTYPE_UNSPECIFIED:
517 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
518 wiphy_dbg(wiphy, "info: setting interface type to auto\n");
519 return 0;
520 default: 545 default:
521 wiphy_err(wiphy, "unknown interface type: %d\n", type); 546 wiphy_err(wiphy, "%s: unknown iftype: %d\n",
522 return -EINVAL; 547 dev->name, dev->ieee80211_ptr->iftype);
548 return -EOPNOTSUPP;
523 } 549 }
524 550
551 dev->ieee80211_ptr->iftype = type;
552 priv->bss_mode = type;
525 mwifiex_deauthenticate(priv, NULL); 553 mwifiex_deauthenticate(priv, NULL);
526 554
527 priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; 555 priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;