Browse Source

ath6kl: Add a modparam to enable multi normal interface support

This option lets operate more than one vif in normal mode (AP/STA/IBSS)
when support for multiple vif is enabled. This modparam needs to be used
as

modprobe ath6kl multi_norm_if_support=1

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Vasanthakumar Thiagarajan 13 years ago
parent
commit
3226f68af4

+ 22 - 1
drivers/net/wireless/ath/ath6kl/cfg80211.c

@@ -21,8 +21,10 @@
 #include "testmode.h"
 
 static unsigned int ath6kl_p2p;
+static unsigned int multi_norm_if_support;
 
 module_param(ath6kl_p2p, uint, 0644);
+module_param(multi_norm_if_support, uint, 0644);
 
 #define RATETAB_ENT(_rate, _rateid, _flags) {   \
 	.bitrate    = (_rate),                  \
@@ -341,6 +343,16 @@ static bool ath6kl_is_valid_iftype(struct ath6kl *ar, enum nl80211_iftype type,
 		}
 	}
 
+	if (type == NL80211_IFTYPE_P2P_CLIENT ||
+	    type == NL80211_IFTYPE_P2P_GO) {
+		for (i = ar->max_norm_iface; i < MAX_NUM_VIF; i++) {
+			if ((ar->avail_idx_map >> i) & BIT(0)) {
+				*if_idx = i;
+				return true;
+			}
+		}
+	}
+
 	return false;
 }
 
@@ -2095,10 +2107,19 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev)
 	}
 
 	ar = wiphy_priv(wiphy);
-	ar->p2p = !!ath6kl_p2p;
+	if (!multi_norm_if_support)
+		ar->p2p = !!ath6kl_p2p;
 	ar->wiphy = wiphy;
 	ar->dev = dev;
 
+	if (multi_norm_if_support)
+		ar->max_norm_iface = 2;
+	else
+		ar->max_norm_iface = 1;
+
+	/* FIXME: Remove this once the multivif support is enabled */
+	ar->max_norm_iface = 1;
+
 	spin_lock_init(&ar->lock);
 	spin_lock_init(&ar->mcastpsq_lock);
 	spin_lock_init(&ar->list_lock);

+ 1 - 0
drivers/net/wireless/ath/ath6kl/core.h

@@ -461,6 +461,7 @@ struct ath6kl {
 	/* Lock to avoid race in vif_list entries among add/del/traverse */
 	spinlock_t list_lock;
 	u8 num_vif;
+	u8 max_norm_iface;
 	u8 avail_idx_map;
 	spinlock_t lock;
 	struct semaphore sem;

+ 13 - 11
drivers/net/wireless/ath/ath6kl/init.c

@@ -428,7 +428,7 @@ static int ath6kl_target_config_wlan_params(struct ath6kl *ar)
 int ath6kl_configure_target(struct ath6kl *ar)
 {
 	u32 param, ram_reserved_size;
-	u8 fw_iftype, fw_mode = 0, fw_submode;
+	u8 fw_iftype, fw_mode = 0, fw_submode = 0;
 	int i;
 
 	/*
@@ -445,15 +445,19 @@ int ath6kl_configure_target(struct ath6kl *ar)
 		fw_mode |= fw_iftype << (i * HI_OPTION_FW_MODE_BITS);
 
 	/*
-	 * submodes : vif[0] - AP/STA/IBSS
-	 *	      vif[1] - "P2P dev"/"P2P GO"/"P2P Client"
-	 *	      vif[2] - "P2P dev"/"P2P GO"/"P2P Client"
+	 * By default, submodes :
+	 *		vif[0] - AP/STA/IBSS
+	 *		vif[1] - "P2P dev"/"P2P GO"/"P2P Client"
+	 *		vif[2] - "P2P dev"/"P2P GO"/"P2P Client"
 	 */
-	fw_submode = HI_OPTION_FW_SUBMODE_NONE |
-		     (HI_OPTION_FW_SUBMODE_P2PDEV <<
-		      (1 * HI_OPTION_FW_SUBMODE_BITS)) |
-		      (HI_OPTION_FW_SUBMODE_P2PDEV <<
-		      (2 * HI_OPTION_FW_SUBMODE_BITS));
+
+	for (i = 0; i < ar->max_norm_iface; i++)
+		fw_submode |= HI_OPTION_FW_SUBMODE_NONE <<
+			      (i * HI_OPTION_FW_SUBMODE_BITS);
+
+	for (i = ar->max_norm_iface; i < MAX_NUM_VIF; i++)
+		fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV <<
+			      (i * HI_OPTION_FW_SUBMODE_BITS);
 
 	/*
 	 * FIXME: This needs to be removed once the multivif
@@ -461,8 +465,6 @@ int ath6kl_configure_target(struct ath6kl *ar)
 	 */
 	if (ar->p2p)
 		fw_submode = HI_OPTION_FW_SUBMODE_P2PDEV;
-	else
-		fw_submode = HI_OPTION_FW_SUBMODE_NONE;
 
 	param = HTC_PROTOCOL_VERSION;
 	if (ath6kl_bmi_write(ar,