aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2012-09-23 14:22:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-09-25 15:57:44 -0400
commit55d2e9da744ba11eae900b4bfc2da72eace3c1e1 (patch)
treea66326a7c51db3390c31a6d9b770c7860116a79d /drivers/net/wireless/rt2x00
parent3e4c4151e56ff367fb1487ea79134eea74104077 (diff)
rt2x00: Replace open coded interface checking with interface combinations.
Mac80211 has formal infrastructure to specify which interface combinations are supported. Make use of this facility in favor of open coding it ourselves. So far we only have to specify we can support multiple AP interfaces, no other combinations are supported. Inspired by an earlier patch from Paul Fertser. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Cc: Paul Fertser <fercerpav@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c33
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c39
3 files changed, 47 insertions, 39 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 09bf01ce65f4..0751b35ef6dc 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -741,6 +741,14 @@ enum rt2x00_capability_flags {
741}; 741};
742 742
743/* 743/*
744 * Interface combinations
745 */
746enum {
747 IF_COMB_AP = 0,
748 NUM_IF_COMB,
749};
750
751/*
744 * rt2x00 device structure. 752 * rt2x00 device structure.
745 */ 753 */
746struct rt2x00_dev { 754struct rt2x00_dev {
@@ -867,6 +875,12 @@ struct rt2x00_dev {
867 unsigned int intf_beaconing; 875 unsigned int intf_beaconing;
868 876
869 /* 877 /*
878 * Interface combinations
879 */
880 struct ieee80211_iface_limit if_limits_ap;
881 struct ieee80211_iface_combination if_combinations[NUM_IF_COMB];
882
883 /*
870 * Link quality 884 * Link quality
871 */ 885 */
872 struct link link; 886 struct link link;
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 10cf67267775..69097d1faeb6 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1118,6 +1118,34 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev)
1118 rt2x00dev->intf_associated = 0; 1118 rt2x00dev->intf_associated = 0;
1119} 1119}
1120 1120
1121static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev)
1122{
1123 struct ieee80211_iface_limit *if_limit;
1124 struct ieee80211_iface_combination *if_combination;
1125
1126 /*
1127 * Build up AP interface limits structure.
1128 */
1129 if_limit = &rt2x00dev->if_limits_ap;
1130 if_limit->max = rt2x00dev->ops->max_ap_intf;
1131 if_limit->types = BIT(NL80211_IFTYPE_AP);
1132
1133 /*
1134 * Build up AP interface combinations structure.
1135 */
1136 if_combination = &rt2x00dev->if_combinations[IF_COMB_AP];
1137 if_combination->limits = if_limit;
1138 if_combination->n_limits = 1;
1139 if_combination->max_interfaces = if_limit->max;
1140 if_combination->num_different_channels = 1;
1141
1142 /*
1143 * Finally, specify the possible combinations to mac80211.
1144 */
1145 rt2x00dev->hw->wiphy->iface_combinations = rt2x00dev->if_combinations;
1146 rt2x00dev->hw->wiphy->n_iface_combinations = 1;
1147}
1148
1121/* 1149/*
1122 * driver allocation handlers. 1150 * driver allocation handlers.
1123 */ 1151 */
@@ -1126,6 +1154,11 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1126 int retval = -ENOMEM; 1154 int retval = -ENOMEM;
1127 1155
1128 /* 1156 /*
1157 * Set possible interface combinations.
1158 */
1159 rt2x00lib_set_if_combinations(rt2x00dev);
1160
1161 /*
1129 * Allocate the driver data memory, if necessary. 1162 * Allocate the driver data memory, if necessary.
1130 */ 1163 */
1131 if (rt2x00dev->ops->drv_data_size > 0) { 1164 if (rt2x00dev->ops->drv_data_size > 0) {
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 2f98d3d4a979..98a9e48f8e4a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -214,45 +214,6 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
214 !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) 214 !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
215 return -ENODEV; 215 return -ENODEV;
216 216
217 switch (vif->type) {
218 case NL80211_IFTYPE_AP:
219 /*
220 * We don't support mixed combinations of
221 * sta and ap interfaces.
222 */
223 if (rt2x00dev->intf_sta_count)
224 return -ENOBUFS;
225
226 /*
227 * Check if we exceeded the maximum amount
228 * of supported interfaces.
229 */
230 if (rt2x00dev->intf_ap_count >= rt2x00dev->ops->max_ap_intf)
231 return -ENOBUFS;
232
233 break;
234 case NL80211_IFTYPE_STATION:
235 case NL80211_IFTYPE_ADHOC:
236 case NL80211_IFTYPE_MESH_POINT:
237 case NL80211_IFTYPE_WDS:
238 /*
239 * We don't support mixed combinations of
240 * sta and ap interfaces.
241 */
242 if (rt2x00dev->intf_ap_count)
243 return -ENOBUFS;
244
245 /*
246 * We don't support multiple STA interfaces.
247 */
248 if (rt2x00dev->intf_sta_count)
249 return -ENOBUFS;
250
251 break;
252 default:
253 return -EINVAL;
254 }
255
256 /* 217 /*
257 * Loop through all beacon queues to find a free 218 * Loop through all beacon queues to find a free
258 * entry. Since there are as much beacon entries 219 * entry. Since there are as much beacon entries