linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces
@ 2011-02-21  2:20 Sujith
  2011-02-22  5:37 ` Rajkumar Manoharan
  0 siblings, 1 reply; 7+ messages in thread
From: Sujith @ 2011-02-21  2:20 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Sujith.Manoharan

From: Sujith Manoharan <Sujith.Manoharan@atheros.com>

The AID and BSSID should be set in the HW only for the
first station interface or adhoc interface. Also, cancel
the ANI timer in stop() for multi-STA scenario. And finally
configure the HW beacon timers only for the first station
interface.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   17 ++++++++-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   44 +++++++++++++++--------
 2 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 007b99f..5238091 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -123,8 +123,9 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
 	/* TSF out of range threshold fixed at 1 second */
 	bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD;
 
-	ath_dbg(common, ATH_DBG_BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu);
-	ath_dbg(common, ATH_DBG_BEACON,
+	ath_dbg(common, ATH_DBG_CONFIG, "intval: %u tsf: %llu tsftu: %u\n",
+		intval, tsf, tsftu);
+	ath_dbg(common, ATH_DBG_CONFIG,
 		"bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n",
 		bs.bs_bmissthreshold, bs.bs_sleepduration,
 		bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext);
@@ -341,6 +342,18 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
 		return;
 	}
 
+	/*
+	 * The beacon paramters are configured only for the first
+	 * station interface.
+	 */
+	if ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
+	    (priv->num_sta_vif > 1) &&
+	    (vif->type == NL80211_IFTYPE_STATION)) {
+		ath_dbg(common, ATH_DBG_CONFIG,
+			"Beacon already configured for a station interface\n");
+		return;
+	}
+
 	cur_conf->beacon_interval = bss_conf->beacon_int;
 	if (cur_conf->beacon_interval == 0)
 		cur_conf->beacon_interval = 100;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 949af24..6ec9cb6 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1603,30 +1603,44 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
 	struct ath9k_htc_priv *priv = hw->priv;
 	struct ath_hw *ah = priv->ah;
 	struct ath_common *common = ath9k_hw_common(ah);
+	bool set_assoc;
 
 	mutex_lock(&priv->mutex);
 	ath9k_htc_ps_wakeup(priv);
 
+	/*
+	 * Set the HW AID/BSSID only for the first station interface
+	 * or in IBSS mode.
+	 */
+	set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||
+		       ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
+			(priv->num_sta_vif == 1)));
+
+
 	if (changed & BSS_CHANGED_ASSOC) {
-		common->curaid = bss_conf->assoc ?
-				 bss_conf->aid : 0;
-		ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",
-			bss_conf->assoc);
+		if (set_assoc) {
+			ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",
+				bss_conf->assoc);
 
-		if (bss_conf->assoc)
-			ath9k_htc_start_ani(priv);
-		else
-			ath9k_htc_stop_ani(priv);
+			common->curaid = bss_conf->assoc ?
+				bss_conf->aid : 0;
+
+			if (bss_conf->assoc)
+				ath9k_htc_start_ani(priv);
+			else
+				ath9k_htc_stop_ani(priv);
+		}
 	}
 
 	if (changed & BSS_CHANGED_BSSID) {
-		/* Set BSSID */
-		memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
-		ath9k_hw_write_associd(ah);
+		if (set_assoc) {
+			memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
+			ath9k_hw_write_associd(ah);
 
-		ath_dbg(common, ATH_DBG_CONFIG,
-			"BSSID: %pM aid: 0x%x\n",
-			common->curbssid, common->curaid);
+			ath_dbg(common, ATH_DBG_CONFIG,
+				"BSSID: %pM aid: 0x%x\n",
+				common->curbssid, common->curaid);
+		}
 	}
 
 	if ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon) {
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces
  2011-02-21  2:20 [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces Sujith
@ 2011-02-22  5:37 ` Rajkumar Manoharan
  2011-02-22  5:45   ` Ben Greear
  2011-02-22 13:15   ` Sujith
  0 siblings, 2 replies; 7+ messages in thread
From: Rajkumar Manoharan @ 2011-02-22  5:37 UTC (permalink / raw)
  To: Sujith
  Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	Sujith Manoharan

On Mon, Feb 21, 2011 at 07:50:08AM +0530, Sujith wrote:
> From: Sujith Manoharan <Sujith.Manoharan@atheros.com>
> 
> The AID and BSSID should be set in the HW only for the
> first station interface or adhoc interface. Also, cancel
> the ANI timer in stop() for multi-STA scenario. And finally
> configure the HW beacon timers only for the first station
> interface.
> 
> Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
> ---
>  drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   17 ++++++++-
>  drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   44 +++++++++++++++--------
>  2 files changed, 44 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
> index 007b99f..5238091 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
> @@ -123,8 +123,9 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
>  	/* TSF out of range threshold fixed at 1 second */
>  	bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD;
>  
> -	ath_dbg(common, ATH_DBG_BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu);
> -	ath_dbg(common, ATH_DBG_BEACON,
> +	ath_dbg(common, ATH_DBG_CONFIG, "intval: %u tsf: %llu tsftu: %u\n",
> +		intval, tsf, tsftu);
> +	ath_dbg(common, ATH_DBG_CONFIG,
>  		"bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n",
>  		bs.bs_bmissthreshold, bs.bs_sleepduration,
>  		bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext);
> @@ -341,6 +342,18 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
>  		return;
>  	}
>  
> +	/*
> +	 * The beacon paramters are configured only for the first
> +	 * station interface.
> +	 */
> +	if ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> +	    (priv->num_sta_vif > 1) &&
> +	    (vif->type == NL80211_IFTYPE_STATION)) {
> +		ath_dbg(common, ATH_DBG_CONFIG,
> +			"Beacon already configured for a station interface\n");
> +		return;
> +	}
> +
This will not allow beacon config if your first station vif was not yet
associated.
>  	cur_conf->beacon_interval = bss_conf->beacon_int;
>  	if (cur_conf->beacon_interval == 0)
>  		cur_conf->beacon_interval = 100;
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index 949af24..6ec9cb6 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -1603,30 +1603,44 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
>  	struct ath9k_htc_priv *priv = hw->priv;
>  	struct ath_hw *ah = priv->ah;
>  	struct ath_common *common = ath9k_hw_common(ah);
> +	bool set_assoc;
>  
>  	mutex_lock(&priv->mutex);
>  	ath9k_htc_ps_wakeup(priv);
>  
> +	/*
> +	 * Set the HW AID/BSSID only for the first station interface
> +	 * or in IBSS mode.
> +	 */
> +	set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||
> +		       ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> +			(priv->num_sta_vif == 1)));
> +
> +
Assume there are two station vifs where one is associated and another is not.
In such case aid and ani is not configured.
>  	if (changed & BSS_CHANGED_ASSOC) {
> -		common->curaid = bss_conf->assoc ?
> -				 bss_conf->aid : 0;
> -		ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",
> -			bss_conf->assoc);
> +		if (set_assoc) {
> +			ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",
> +				bss_conf->assoc);
>  
> -		if (bss_conf->assoc)
> -			ath9k_htc_start_ani(priv);
> -		else
> -			ath9k_htc_stop_ani(priv);
> +			common->curaid = bss_conf->assoc ?
> +				bss_conf->aid : 0;
> +
> +			if (bss_conf->assoc)
> +				ath9k_htc_start_ani(priv);
> +			else
> +				ath9k_htc_stop_ani(priv);
> +		}
>  	}
same here. 
>  	if (changed & BSS_CHANGED_BSSID) {
> -		/* Set BSSID */
> -		memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
> -		ath9k_hw_write_associd(ah);
> +		if (set_assoc) {
> +			memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
> +			ath9k_hw_write_associd(ah);
>  
> -		ath_dbg(common, ATH_DBG_CONFIG,
> -			"BSSID: %pM aid: 0x%x\n",
> -			common->curbssid, common->curaid);
> +			ath_dbg(common, ATH_DBG_CONFIG,
> +				"BSSID: %pM aid: 0x%x\n",
> +				common->curbssid, common->curaid);
> +		}
>  	}
>  
>  	if ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon) {
> -- 
> 1.7.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces
  2011-02-22  5:37 ` Rajkumar Manoharan
@ 2011-02-22  5:45   ` Ben Greear
  2011-02-22 13:15   ` Sujith
  1 sibling, 0 replies; 7+ messages in thread
From: Ben Greear @ 2011-02-22  5:45 UTC (permalink / raw)
  To: Rajkumar Manoharan
  Cc: Sujith, linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	Sujith Manoharan

On 02/21/2011 09:37 PM, Rajkumar Manoharan wrote:
> On Mon, Feb 21, 2011 at 07:50:08AM +0530, Sujith wrote:
>> From: Sujith Manoharan<Sujith.Manoharan@atheros.com>
>>
>> The AID and BSSID should be set in the HW only for the
>> first station interface or adhoc interface. Also, cancel
>> the ANI timer in stop() for multi-STA scenario. And finally
>> configure the HW beacon timers only for the first station
>> interface.

Didn't we fix all of this in ath9k by counting the various
interface types and dynamically setting the opmode,
etc properly?

Can't we re-use that code for htc?

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces
  2011-02-22  5:37 ` Rajkumar Manoharan
  2011-02-22  5:45   ` Ben Greear
@ 2011-02-22 13:15   ` Sujith
  2011-02-22 17:39     ` Rajkumar Manoharan
  1 sibling, 1 reply; 7+ messages in thread
From: Sujith @ 2011-02-22 13:15 UTC (permalink / raw)
  To: Rajkumar Manoharan; +Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org

Rajkumar Manoharan wrote:
> > +	/*
> > +	 * The beacon paramters are configured only for the first
> > +	 * station interface.
> > +	 */
> > +	if ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> > +	    (priv->num_sta_vif > 1) &&
> > +	    (vif->type == NL80211_IFTYPE_STATION)) {
> > +		ath_dbg(common, ATH_DBG_CONFIG,
> > +			"Beacon already configured for a station interface\n");
> > +		return;
> > +	}
> > +
> This will not allow beacon config if your first station vif was not yet
> associated.

Good catch.

> > +	/*
> > +	 * Set the HW AID/BSSID only for the first station interface
> > +	 * or in IBSS mode.
> > +	 */
> > +	set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||
> > +		       ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> > +			(priv->num_sta_vif == 1)));
> > +
> > +
> Assume there are two station vifs where one is associated and another is not.
> In such case aid and ani is not configured.

That's the intention...

Sujith

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces
  2011-02-22 13:15   ` Sujith
@ 2011-02-22 17:39     ` Rajkumar Manoharan
  2011-02-22 17:50       ` Sujith
  0 siblings, 1 reply; 7+ messages in thread
From: Rajkumar Manoharan @ 2011-02-22 17:39 UTC (permalink / raw)
  To: Sujith
  Cc: Rajkumar Manoharan, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org

On Tue, Feb 22, 2011 at 06:45:01PM +0530, Sujith wrote:
> Rajkumar Manoharan wrote:
> > > +	/*
> > > +	 * The beacon paramters are configured only for the first
> > > +	 * station interface.
> > > +	 */
> > > +	if ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> > > +	    (priv->num_sta_vif > 1) &&
> > > +	    (vif->type == NL80211_IFTYPE_STATION)) {
> > > +		ath_dbg(common, ATH_DBG_CONFIG,
> > > +			"Beacon already configured for a station interface\n");
> > > +		return;
> > > +	}
> > > +
> > This will not allow beacon config if your first station vif was not yet
> > associated.
> 
> Good catch.
> 
> > > +	/*
> > > +	 * Set the HW AID/BSSID only for the first station interface
> > > +	 * or in IBSS mode.
> > > +	 */
> > > +	set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||
> > > +		       ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> > > +			(priv->num_sta_vif == 1)));
> > > +
> > > +
> > Assume there are two station vifs where one is associated and another is not.
> > In such case aid and ani is not configured.
> 
> That's the intention...
>
I dont understand why not to start ani on multi-vifs.

--
Rajkumar

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces
  2011-02-22 17:39     ` Rajkumar Manoharan
@ 2011-02-22 17:50       ` Sujith
  2011-02-22 19:20         ` Rajkumar Manoharan
  0 siblings, 1 reply; 7+ messages in thread
From: Sujith @ 2011-02-22 17:50 UTC (permalink / raw)
  To: Rajkumar Manoharan; +Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org

Rajkumar Manoharan wrote:
> > > > +	/*
> > > > +	 * Set the HW AID/BSSID only for the first station interface
> > > > +	 * or in IBSS mode.
> > > > +	 */
> > > > +	set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||
> > > > +		       ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> > > > +			(priv->num_sta_vif == 1)));
> > > > +
> > > > +
> > > Assume there are two station vifs where one is associated and another is not.
> > > In such case aid and ani is not configured.
> > 
> > That's the intention...
> >
> I dont understand why not to start ani on multi-vifs.

* If an AP interface is present, ANI will be started when adding the interface.
  If the AP interface is brought down, the remaining interfaces are checked to
  see if any associated STA interfaces are present before stopping ANI.

* ANI is started for the first STA interface that makes the transition to associated
  state. For subsequent managed interfaces, there is no point in re-starting ANI, since
  it is already running. The check there takes care that ANI is not stopped when one
  STA interface disconnects.

Sujith

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces
  2011-02-22 17:50       ` Sujith
@ 2011-02-22 19:20         ` Rajkumar Manoharan
  0 siblings, 0 replies; 7+ messages in thread
From: Rajkumar Manoharan @ 2011-02-22 19:20 UTC (permalink / raw)
  To: Sujith
  Cc: Rajkumar Manoharan, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org

On Tue, Feb 22, 2011 at 11:20:48PM +0530, Sujith wrote:
> Rajkumar Manoharan wrote:
> > > > > +	/*
> > > > > +	 * Set the HW AID/BSSID only for the first station interface
> > > > > +	 * or in IBSS mode.
> > > > > +	 */
> > > > > +	set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||
> > > > > +		       ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
> > > > > +			(priv->num_sta_vif == 1)));
> > > > > +
> > > > > +
> > > > Assume there are two station vifs where one is associated and another is not.
> > > > In such case aid and ani is not configured.
> > > 
> > > That's the intention...
> > >
> > I dont understand why not to start ani on multi-vifs.
> 
> * If an AP interface is present, ANI will be started when adding the interface.
>   If the AP interface is brought down, the remaining interfaces are checked to
>   see if any associated STA interfaces are present before stopping ANI.
> 
> * ANI is started for the first STA interface that makes the transition to associated
>   state. For subsequent managed interfaces, there is no point in re-starting ANI, since
>   it is already running. The check there takes care that ANI is not stopped when one
>   STA interface disconnects.
>
Assume num_sta_vif = 2 and none of the interfaces are associated. Now one of
vif moves to assoc state. set_assoc check would fail so ani will not be started.
Correct me if I am wrong?

--
Rajkumar

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-22 19:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-21  2:20 [PATCH 19/23] ath9k_htc: Handle BSSID/AID for multiple interfaces Sujith
2011-02-22  5:37 ` Rajkumar Manoharan
2011-02-22  5:45   ` Ben Greear
2011-02-22 13:15   ` Sujith
2011-02-22 17:39     ` Rajkumar Manoharan
2011-02-22 17:50       ` Sujith
2011-02-22 19:20         ` Rajkumar Manoharan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).