linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Nikolay Martynov <mar.kolya@gmail.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2] mac80211: split addba retries in time
Date: Tue, 13 Dec 2011 15:25:17 -0500	[thread overview]
Message-ID: <20111213202516.GB2613@tuxdriver.com> (raw)
In-Reply-To: <1323402221-9869-1-git-send-email-mar.kolya@gmail.com>

On Thu, Dec 08, 2011 at 10:43:41PM -0500, Nikolay Martynov wrote:
>   Currently code allows three (HT_AGG_MAX_RETRIES) unanswered addba
> requests. When this limit is reached aggregation is turned off for
> given TID permanently. This doesn't seem right: three requests is
> not that much, some 'blackout' can happen, but effect of it affects
> whole connection indefinitely.
>   This patch increases number of retries to 15. Also, when there have
> been 3 or more retries it splits further retries apart by 15 seconds
> instead of sending them in very short period of time.
> 
> Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
> ---
>  net/mac80211/agg-tx.c   |   19 +++++++++++++++++++
>  net/mac80211/sta_info.h |    6 +++++-
>  2 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
> index 7380287..7060c8f 100644
> --- a/net/mac80211/agg-tx.c
> +++ b/net/mac80211/agg-tx.c
> @@ -390,6 +390,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
>  #endif
>  
>  	spin_lock_bh(&sta->lock);
> +	sta->ampdu_mlme.last_addba_req_time[tid] = jiffies;
>  	sta->ampdu_mlme.addba_req_num[tid]++;
>  	spin_unlock_bh(&sta->lock);
>  
> @@ -490,6 +491,24 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
>  		goto err_unlock_sta;
>  	}
>  
> +	/*
> +	 * if we have tried more than HT_AGG_BURST_RETRIES times we
> +	 * will spread our requests in time to avoid stalling connection
> +	 * for too long
> +	 */
> +	if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES &&
> +	    time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] +
> +			HT_AGG_RETRIES_PERIOD)) {
> +#ifdef CONFIG_MAC80211_HT_DEBUG
> +		printk(KERN_DEBUG "BA request denied - "
> +		       "waiting a grace period after %d failed requests "
> +		       "on tid %u\n",
> +		       sta->ampdu_mlme.addba_req_num[tid], tid);
> +#endif /* CONFIG_MAC80211_HT_DEBUG */
> +		ret = -EBUSY;
> +		goto err_unlock_sta;
> +	}
> +
>  	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
>  	/* check if the TID is not in aggregation flow already */
>  	if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) {

  CC [M]  net/mac80211/agg-tx.o
net/mac80211/agg-tx.c: In function ‘ieee80211_start_tx_ba_session’:
net/mac80211/agg-tx.c:474:6: warning: comparison of distinct pointer types lacks a cast

No new warnings, please!

> diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
> index 1a14fab..c8578eb 100644
> --- a/net/mac80211/sta_info.h
> +++ b/net/mac80211/sta_info.h
> @@ -75,7 +75,9 @@ enum ieee80211_sta_info_flags {
>  
>  #define STA_TID_NUM 16
>  #define ADDBA_RESP_INTERVAL HZ
> -#define HT_AGG_MAX_RETRIES		0x3
> +#define HT_AGG_MAX_RETRIES		15
> +#define HT_AGG_BURST_RETRIES		3
> +#define HT_AGG_RETRIES_PERIOD		(15 * HZ)
>  
>  #define HT_AGG_STATE_DRV_READY		0
>  #define HT_AGG_STATE_RESPONSE_RECEIVED	1
> @@ -171,6 +173,7 @@ struct tid_ampdu_rx {
>   * @tid_tx: aggregation info for Tx per TID
>   * @tid_start_tx: sessions where start was requested
>   * @addba_req_num: number of times addBA request has been sent.
> + * @last_addba_req_time: timestamp of the last addBA request.
>   * @dialog_token_allocator: dialog token enumerator for each new session;
>   * @work: work struct for starting/stopping aggregation
>   * @tid_rx_timer_expired: bitmap indicating on which TIDs the
> @@ -190,6 +193,7 @@ struct sta_ampdu_mlme {
>  	struct work_struct work;
>  	struct tid_ampdu_tx __rcu *tid_tx[STA_TID_NUM];
>  	struct tid_ampdu_tx *tid_start_tx[STA_TID_NUM];
> +	unsigned int last_addba_req_time[STA_TID_NUM];
>  	u8 addba_req_num[STA_TID_NUM];
>  	u8 dialog_token_allocator;
>  };
> -- 
> 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
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  parent reply	other threads:[~2011-12-13 20:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29  2:27 [PATCH] mac80211: reset addba retries after timeout Nikolay Martynov
2011-11-29  8:24 ` Johannes Berg
2011-11-29 15:14   ` Nikolay Martynov
2011-11-29 15:19     ` Johannes Berg
2011-11-29 22:01       ` Nikolay Martynov
2011-11-29 22:14         ` Johannes Berg
2011-11-29 22:28           ` Nikolay Martynov
2011-11-29 22:35             ` Johannes Berg
2011-11-29 22:46               ` Nikolay Martynov
2011-11-30  8:32                 ` Johannes Berg
2011-11-30 14:16                   ` Nikolay Martynov
2011-12-06  3:03                   ` Nikolay Martynov
2011-12-06  9:09                     ` Johannes Berg
2011-12-09  3:43                       ` [PATCH v2] mac80211: split addba retries in time Nikolay Martynov
2011-12-09  8:02                         ` Helmut Schaa
     [not found]                           ` <CALGY4fvo7DMp+_+=wU+072v7sfA6EWfd_weM-G4B3ZxVYEaWhA@mail.gmail.com>
2011-12-12 18:53                             ` Helmut Schaa
2011-12-13 20:25                         ` John W. Linville [this message]
2011-12-18  0:39                           ` [PATCH v3] " Nikolay Martynov

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=20111213202516.GB2613@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mar.kolya@gmail.com \
    /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).