summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/marvell/mwifiex/main.h
diff options
context:
space:
mode:
authorShengzhen Li <szli@marvell.com>2015-12-14 15:15:03 +0300
committerKalle Valo <kvalo@codeaurora.org>2015-12-30 17:57:54 +0300
commit5b13d3e1f9260878c06763a13129bc94e51b4c9c (patch)
tree08f57965904f06dd99d094a2b6661001d57ee999 /drivers/net/wireless/marvell/mwifiex/main.h
parenteb5d912e156409a951460578de898270e1c89617 (diff)
downloadlinux-5b13d3e1f9260878c06763a13129bc94e51b4c9c.tar.xz
mwifiex: multiple bss support
This patch fixes issues observed while starting 3 different bss simultaneously, eg, 2 AP + 1 STA or 3 AP Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/marvell/mwifiex/main.h')
-rw-r--r--drivers/net/wireless/marvell/mwifiex/main.h42
1 files changed, 34 insertions, 8 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index a86e2aebf566..10e614e7060a 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1273,20 +1273,46 @@ mwifiex_get_priv(struct mwifiex_adapter *adapter,
}
/*
+ * This function checks available bss_num when adding new interface or
+ * changing interface type.
+ */
+static inline u8
+mwifiex_get_unused_bss_num(struct mwifiex_adapter *adapter, u8 bss_type)
+{
+ u8 i, j;
+ int index[MWIFIEX_MAX_BSS_NUM];
+
+ memset(index, 0, sizeof(index));
+ for (i = 0; i < adapter->priv_num; i++)
+ if (adapter->priv[i]) {
+ if (adapter->priv[i]->bss_type == bss_type &&
+ !(adapter->priv[i]->bss_mode ==
+ NL80211_IFTYPE_UNSPECIFIED)) {
+ index[adapter->priv[i]->bss_num] = 1;
+ }
+ }
+ for (j = 0; j < MWIFIEX_MAX_BSS_NUM; j++)
+ if (!index[j])
+ return j;
+ return -1;
+}
+
+/*
* This function returns the first available unused private structure pointer.
*/
static inline struct mwifiex_private *
-mwifiex_get_unused_priv(struct mwifiex_adapter *adapter)
+mwifiex_get_unused_priv_by_bss_type(struct mwifiex_adapter *adapter,
+ u8 bss_type)
{
- int i;
+ u8 i;
- for (i = 0; i < adapter->priv_num; i++) {
- if (adapter->priv[i]) {
- if (adapter->priv[i]->bss_mode ==
- NL80211_IFTYPE_UNSPECIFIED)
- break;
+ for (i = 0; i < adapter->priv_num; i++)
+ if (adapter->priv[i]->bss_mode ==
+ NL80211_IFTYPE_UNSPECIFIED) {
+ adapter->priv[i]->bss_num =
+ mwifiex_get_unused_bss_num(adapter, bss_type);
+ break;
}
- }
return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
}