aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-10 18:01:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:23 -0400
commit05c914fe330fa8e1cc67870dc0d3809dfd96c107 (patch)
treedf53bcab47335f3361c09478d6b1447b7d298536 /net/mac80211/cfg.c
parent96dd22ac06b0dbfb069fdf530c72046a941e9694 (diff)
mac80211: use nl80211 interface types
There's really no reason for mac80211 to be using its own interface type defines. Use the nl80211 types and simplify the configuration code a bit: there's no need to translate them any more now. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c57
1 files changed, 23 insertions, 34 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6ec2127f9a60..d004351050cc 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -24,26 +24,19 @@ struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy)
24} 24}
25EXPORT_SYMBOL(wiphy_to_hw); 25EXPORT_SYMBOL(wiphy_to_hw);
26 26
27static enum ieee80211_if_types 27static bool nl80211_type_check(enum nl80211_iftype type)
28nl80211_type_to_mac80211_type(enum nl80211_iftype type)
29{ 28{
30 switch (type) { 29 switch (type) {
31 case NL80211_IFTYPE_UNSPECIFIED:
32 return IEEE80211_IF_TYPE_STA;
33 case NL80211_IFTYPE_ADHOC: 30 case NL80211_IFTYPE_ADHOC:
34 return IEEE80211_IF_TYPE_IBSS;
35 case NL80211_IFTYPE_STATION: 31 case NL80211_IFTYPE_STATION:
36 return IEEE80211_IF_TYPE_STA;
37 case NL80211_IFTYPE_MONITOR: 32 case NL80211_IFTYPE_MONITOR:
38 return IEEE80211_IF_TYPE_MNTR;
39#ifdef CONFIG_MAC80211_MESH 33#ifdef CONFIG_MAC80211_MESH
40 case NL80211_IFTYPE_MESH_POINT: 34 case NL80211_IFTYPE_MESH_POINT:
41 return IEEE80211_IF_TYPE_MESH_POINT;
42#endif 35#endif
43 case NL80211_IFTYPE_WDS: 36 case NL80211_IFTYPE_WDS:
44 return IEEE80211_IF_TYPE_WDS; 37 return true;
45 default: 38 default:
46 return IEEE80211_IF_TYPE_INVALID; 39 return false;
47 } 40 }
48} 41}
49 42
@@ -52,17 +45,15 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
52 struct vif_params *params) 45 struct vif_params *params)
53{ 46{
54 struct ieee80211_local *local = wiphy_priv(wiphy); 47 struct ieee80211_local *local = wiphy_priv(wiphy);
55 enum ieee80211_if_types itype;
56 struct net_device *dev; 48 struct net_device *dev;
57 struct ieee80211_sub_if_data *sdata; 49 struct ieee80211_sub_if_data *sdata;
58 int err; 50 int err;
59 51
60 itype = nl80211_type_to_mac80211_type(type); 52 if (!nl80211_type_check(type))
61 if (itype == IEEE80211_IF_TYPE_INVALID)
62 return -EINVAL; 53 return -EINVAL;
63 54
64 err = ieee80211_if_add(local, name, &dev, itype, params); 55 err = ieee80211_if_add(local, name, &dev, type, params);
65 if (err || itype != IEEE80211_IF_TYPE_MNTR || !flags) 56 if (err || type != NL80211_IFTYPE_MONITOR || !flags)
66 return err; 57 return err;
67 58
68 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 59 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -93,7 +84,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
93{ 84{
94 struct ieee80211_local *local = wiphy_priv(wiphy); 85 struct ieee80211_local *local = wiphy_priv(wiphy);
95 struct net_device *dev; 86 struct net_device *dev;
96 enum ieee80211_if_types itype;
97 struct ieee80211_sub_if_data *sdata; 87 struct ieee80211_sub_if_data *sdata;
98 int ret; 88 int ret;
99 89
@@ -102,8 +92,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
102 if (!dev) 92 if (!dev)
103 return -ENODEV; 93 return -ENODEV;
104 94
105 itype = nl80211_type_to_mac80211_type(type); 95 if (!nl80211_type_check(type))
106 if (itype == IEEE80211_IF_TYPE_INVALID)
107 return -EINVAL; 96 return -EINVAL;
108 97
109 if (dev == local->mdev) 98 if (dev == local->mdev)
@@ -111,7 +100,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
111 100
112 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 101 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
113 102
114 ret = ieee80211_if_change_type(sdata, itype); 103 ret = ieee80211_if_change_type(sdata, type);
115 if (ret) 104 if (ret)
116 return ret; 105 return ret;
117 106
@@ -120,7 +109,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
120 params->mesh_id_len, 109 params->mesh_id_len,
121 params->mesh_id); 110 params->mesh_id);
122 111
123 if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || !flags) 112 if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
124 return 0; 113 return 0;
125 114
126 sdata->u.mntr_flags = *flags; 115 sdata->u.mntr_flags = *flags;
@@ -516,7 +505,7 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
516 505
517 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 506 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
518 507
519 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 508 if (sdata->vif.type != NL80211_IFTYPE_AP)
520 return -EINVAL; 509 return -EINVAL;
521 510
522 old = sdata->u.ap.beacon; 511 old = sdata->u.ap.beacon;
@@ -539,7 +528,7 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
539 528
540 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 529 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
541 530
542 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 531 if (sdata->vif.type != NL80211_IFTYPE_AP)
543 return -EINVAL; 532 return -EINVAL;
544 533
545 old = sdata->u.ap.beacon; 534 old = sdata->u.ap.beacon;
@@ -561,7 +550,7 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
561 550
562 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 551 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
563 552
564 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 553 if (sdata->vif.type != NL80211_IFTYPE_AP)
565 return -EINVAL; 554 return -EINVAL;
566 555
567 old = sdata->u.ap.beacon; 556 old = sdata->u.ap.beacon;
@@ -716,8 +705,8 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
716 if (params->vlan) { 705 if (params->vlan) {
717 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 706 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
718 707
719 if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN && 708 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
720 sdata->vif.type != IEEE80211_IF_TYPE_AP) 709 sdata->vif.type != NL80211_IFTYPE_AP)
721 return -EINVAL; 710 return -EINVAL;
722 } else 711 } else
723 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 712 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -747,8 +736,8 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
747 return err; 736 return err;
748 } 737 }
749 738
750 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN || 739 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
751 sdata->vif.type == IEEE80211_IF_TYPE_AP) 740 sdata->vif.type == NL80211_IFTYPE_AP)
752 ieee80211_send_layer2_update(sta); 741 ieee80211_send_layer2_update(sta);
753 742
754 rcu_read_unlock(); 743 rcu_read_unlock();
@@ -812,8 +801,8 @@ static int ieee80211_change_station(struct wiphy *wiphy,
812 if (params->vlan && params->vlan != sta->sdata->dev) { 801 if (params->vlan && params->vlan != sta->sdata->dev) {
813 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 802 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
814 803
815 if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN && 804 if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
816 vlansdata->vif.type != IEEE80211_IF_TYPE_AP) { 805 vlansdata->vif.type != NL80211_IFTYPE_AP) {
817 rcu_read_unlock(); 806 rcu_read_unlock();
818 return -EINVAL; 807 return -EINVAL;
819 } 808 }
@@ -847,7 +836,7 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
847 836
848 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 837 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
849 838
850 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 839 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
851 return -ENOTSUPP; 840 return -ENOTSUPP;
852 841
853 rcu_read_lock(); 842 rcu_read_lock();
@@ -903,7 +892,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
903 892
904 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 893 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
905 894
906 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 895 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
907 return -ENOTSUPP; 896 return -ENOTSUPP;
908 897
909 rcu_read_lock(); 898 rcu_read_lock();
@@ -978,7 +967,7 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
978 967
979 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 968 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
980 969
981 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 970 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
982 return -ENOTSUPP; 971 return -ENOTSUPP;
983 972
984 rcu_read_lock(); 973 rcu_read_lock();
@@ -1006,7 +995,7 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
1006 995
1007 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 996 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1008 997
1009 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 998 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
1010 return -ENOTSUPP; 999 return -ENOTSUPP;
1011 1000
1012 rcu_read_lock(); 1001 rcu_read_lock();
@@ -1035,7 +1024,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1035 1024
1036 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1025 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1037 1026
1038 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 1027 if (sdata->vif.type != NL80211_IFTYPE_AP)
1039 return -EINVAL; 1028 return -EINVAL;
1040 1029
1041 if (params->use_cts_prot >= 0) { 1030 if (params->use_cts_prot >= 0) {