linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sujith <m.sujith@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: [RFC 1/2] mac80211: track receivers aggregation reorder buffer size
Date: Wed, 12 Jan 2011 18:31:36 +0530	[thread overview]
Message-ID: <19757.42544.304328.698003@gargle.gargle.HOWL> (raw)
In-Reply-To: <20110112121417.852157387@sipsolutions.net>

Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> The aggregation code currently doesn't implement the
> buffer size negotiation. It will always request a max
> buffer size (which is fine, if a little pointless, as
> the mac80211 code doesn't know and might just use 0
> instead), but if the peer requests a smaller size it
> isn't possible to honour this request.
> 
> In order to fix this, look at the buffer size in the
> addBA response frame, keep track of it and pass it to
> the driver in the ampdu_action callback when called
> with the IEEE80211_AMPDU_TX_OPERATIONAL action. That
> way the driver can limit the number of subframes in
> aggregates appropriately.
> 
> Note that this doesn't fix any drivers apart from the
> addition of the new argument -- they all need to be
> updated separately to use this variable!

At least for ath9k_htc, the fix is pretty simple, something like the patch below.
I tested this with a peer advertising a non-default subframe count
(using max_tx_aggregation_subframes) and it seems to work. Now all that is needed
is to fix the FW to actually _use_ this value. :)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 1ce506f..94a4b14 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -210,6 +210,7 @@ struct ath9k_htc_vif {
 
 #define ATH9K_HTC_MAX_STA 8
 #define ATH9K_HTC_MAX_TID 8
+#define ATH9K_HTC_MAX_SUBFRAME 20
 
 enum tid_aggr_state {
 	AGGR_STOP = 0,
@@ -433,7 +434,7 @@ void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id,
 void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
 			enum htc_endpoint_id ep_id, bool txok);
 
-int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv);
+int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv, u8 buf_size);
 void ath9k_htc_station_work(struct work_struct *work);
 void ath9k_htc_aggr_work(struct work_struct *work);
 void ath9k_ani_work(struct work_struct *work);;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index f4d576b..3a3f982 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -304,7 +304,7 @@ static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
 	/*
 	 * Set chainmask etc. on the target.
 	 */
-	ret = ath9k_htc_update_cap_target(priv);
+	ret = ath9k_htc_update_cap_target(priv, ATH9K_HTC_MAX_SUBFRAME);
 	if (ret)
 		ath_dbg(common, ATH_DBG_CONFIG,
 			"Failed to update capability in target\n");
@@ -430,7 +430,7 @@ static int ath9k_htc_remove_station(struct ath9k_htc_priv *priv,
 	return 0;
 }
 
-int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv)
+int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv, u8 buf_size)
 {
 	struct ath9k_htc_cap_target tcap;
 	int ret;
@@ -442,7 +442,7 @@ int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv)
 	tcap.flags = 0x240c40;
 	tcap.flags_ext = 0x80601000;
 	tcap.ampdu_limit = 0xffff0000;
-	tcap.ampdu_subframes = 20;
+	tcap.ampdu_subframes = min((u8)ATH9K_HTC_MAX_SUBFRAME, buf_size);
 	tcap.tx_chainmask_legacy = priv->ah->caps.tx_chainmask;
 	tcap.protmode = 1;
 	tcap.tx_chainmask = priv->ah->caps.tx_chainmask;
@@ -1130,7 +1130,7 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
 	if (ret)
 		goto out;
 
-	ret = ath9k_htc_update_cap_target(priv);
+	ret = ath9k_htc_update_cap_target(priv, ATH9K_HTC_MAX_SUBFRAME);
 	if (ret)
 		ath_dbg(common, ATH_DBG_CONFIG,
 			"Failed to update capability in target\n");
@@ -1548,7 +1548,7 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
 				  struct ieee80211_vif *vif,
 				  enum ieee80211_ampdu_mlme_action action,
 				  struct ieee80211_sta *sta,
-				  u16 tid, u16 *ssn)
+				  u16 tid, u16 *ssn, u8 buf_size)
 {
 	struct ath9k_htc_priv *priv = hw->priv;
 	struct ath9k_htc_sta *ista;
@@ -1570,6 +1570,12 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
 		break;
 	case IEEE80211_AMPDU_TX_OPERATIONAL:
 		ista = (struct ath9k_htc_sta *) sta->drv_priv;
+		if (buf_size < ATH9K_HTC_MAX_SUBFRAME) {
+			ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_CONFIG,
+				"Choosing subframe count %d for station %pM\n",
+				buf_size, sta->addr);
+			ath9k_htc_update_cap_target(priv, buf_size);
+		}
 		spin_lock_bh(&priv->tx_lock);
 		ista->tid_state[tid] = AGGR_OPERATIONAL;
 		spin_unlock_bh(&priv->tx_lock);

  reply	other threads:[~2011-01-12 13:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 12:13 [RFC 0/2] fix aggregation buffer size limits Johannes Berg
2011-01-12 12:13 ` [RFC 1/2] mac80211: track receivers aggregation reorder buffer size Johannes Berg
2011-01-12 13:01   ` Sujith [this message]
2011-01-12 16:51   ` Guy, Wey-Yi
2011-01-12 12:13 ` [RFC 2/2] iwlwifi: use maximum aggregation size Johannes Berg
2011-01-12 16:23   ` Guy, Wey-Yi
2011-01-12 16:38     ` Johannes Berg
2011-01-12 16:46       ` Guy, Wey-Yi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19757.42544.304328.698003@gargle.gargle.HOWL \
    --to=m.sujith@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).