aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-02-20 21:19:15 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-23 16:25:27 -0500
commit0df8359a88f40ab3b0d38156a5f41ee856178aa3 (patch)
treeb78e5a87446960951f66dc3a164613cf52cc88b9 /drivers/net/wireless/ath
parent87df89579a4a3e6c767603acb762115159655745 (diff)
ath9k_htc: Maintain individual counters for interfaces
This is required for allowing only one IBSS interface to be configured. Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h28
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c14
2 files changed, 40 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 97f7ae096f69..0088c6e2f629 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -206,6 +206,32 @@ struct ath9k_htc_target_stats {
206 206
207#define ATH9K_HTC_MAX_VIF 2 207#define ATH9K_HTC_MAX_VIF 2
208 208
209#define INC_VIF(_priv, _type) do { \
210 switch (_type) { \
211 case NL80211_IFTYPE_STATION: \
212 _priv->num_sta_vif++; \
213 break; \
214 case NL80211_IFTYPE_ADHOC: \
215 _priv->num_ibss_vif++; \
216 break; \
217 default: \
218 break; \
219 } \
220 } while (0)
221
222#define DEC_VIF(_priv, _type) do { \
223 switch (_type) { \
224 case NL80211_IFTYPE_STATION: \
225 _priv->num_sta_vif--; \
226 break; \
227 case NL80211_IFTYPE_ADHOC: \
228 _priv->num_ibss_vif--; \
229 break; \
230 default: \
231 break; \
232 } \
233 } while (0)
234
209struct ath9k_htc_vif { 235struct ath9k_htc_vif {
210 u8 index; 236 u8 index;
211 u16 seq_no; 237 u16 seq_no;
@@ -367,6 +393,8 @@ struct ath9k_htc_priv {
367 u8 mon_vif_idx; 393 u8 mon_vif_idx;
368 u8 sta_slot; 394 u8 sta_slot;
369 u8 vif_sta_pos[ATH9K_HTC_MAX_VIF]; 395 u8 vif_sta_pos[ATH9K_HTC_MAX_VIF];
396 u8 num_ibss_vif;
397 u8 num_sta_vif;
370 398
371 u16 op_flags; 399 u16 op_flags;
372 u16 curtxpow; 400 u16 curtxpow;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 04cb243416ae..39074fc72d6f 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1193,9 +1193,15 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
1193 mutex_lock(&priv->mutex); 1193 mutex_lock(&priv->mutex);
1194 1194
1195 if (priv->nvifs >= ATH9K_HTC_MAX_VIF) { 1195 if (priv->nvifs >= ATH9K_HTC_MAX_VIF) {
1196 ret = -ENOBUFS;
1197 mutex_unlock(&priv->mutex); 1196 mutex_unlock(&priv->mutex);
1198 return ret; 1197 return -ENOBUFS;
1198 }
1199
1200 if (priv->num_ibss_vif ||
1201 (priv->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) {
1202 ath_err(common, "IBSS coexistence with other modes is not allowed\n");
1203 mutex_unlock(&priv->mutex);
1204 return -ENOBUFS;
1199 } 1205 }
1200 1206
1201 ath9k_htc_ps_wakeup(priv); 1207 ath9k_htc_ps_wakeup(priv);
@@ -1240,6 +1246,8 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
1240 priv->nvifs++; 1246 priv->nvifs++;
1241 priv->vif = vif; 1247 priv->vif = vif;
1242 1248
1249 INC_VIF(priv, vif->type);
1250
1243 ath_dbg(common, ATH_DBG_CONFIG, 1251 ath_dbg(common, ATH_DBG_CONFIG,
1244 "Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index); 1252 "Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index);
1245 1253
@@ -1273,6 +1281,8 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
1273 ath9k_htc_remove_station(priv, vif, NULL); 1281 ath9k_htc_remove_station(priv, vif, NULL);
1274 priv->vif = NULL; 1282 priv->vif = NULL;
1275 1283
1284 DEC_VIF(priv, vif->type);
1285
1276 ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface at idx: %d\n", avp->index); 1286 ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface at idx: %d\n", avp->index);
1277 1287
1278 ath9k_htc_ps_restore(priv); 1288 ath9k_htc_ps_restore(priv);