From patchwork Sun Aug 21 11:24:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Altshul X-Patchwork-Id: 9292117 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B724F607FF for ; Sun, 21 Aug 2016 11:17:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F91128AE6 for ; Sun, 21 Aug 2016 11:17:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C96728AE9; Sun, 21 Aug 2016 11:17:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BA1D28AE6 for ; Sun, 21 Aug 2016 11:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752443AbcHULRL (ORCPT ); Sun, 21 Aug 2016 07:17:11 -0400 Received: from bear.ext.ti.com ([198.47.19.11]:57872 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751694AbcHULRK (ORCPT ); Sun, 21 Aug 2016 07:17:10 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id u7LBH4Dq008158; Sun, 21 Aug 2016 06:17:04 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u7LBH3vF014066; Sun, 21 Aug 2016 06:17:04 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Sun, 21 Aug 2016 06:17:03 -0500 Received: from wlsrv.emea.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u7LBH277015753; Sun, 21 Aug 2016 06:17:02 -0500 From: Maxim Altshul To: CC: , , Maxim Altshul Subject: [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes Date: Sun, 21 Aug 2016 14:24:23 +0300 Message-ID: <20160821112425.11302-1-maxim.altshul@ti.com> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ability to change the max_rx_aggregation frames is useful in cases of IOP. There exist some devices (latest mobile phones and some AP's) that tend to not respect a BA sessions maximum size (in Kbps). These devices won't respect the AMPDU size that was negotiated during associasion (even though they do respect the maximal number of packets). This violation is characterized by a valid number of packets in a single AMPDU. Even so, the total size will exceed the size negotiated during association. Eventually, this will cause some undefined behavior, which in turn causes the hw to drop packets, causing the throughput to plummet. This patch will: a. Make the subframe limitation to be held by each station, instead of being held only by hw. b. Create an api for the driver to call which will remove violating BA sessions with a specific peer. When the session is reopened, it will use the new size, limiting the aggregation. Signed-off-by: Maxim Altshul --- Change documentation and removed unnecessary function include/net/mac80211.h | 4 ++++ net/mac80211/agg-rx.c | 10 ++++++---- net/mac80211/sta_info.c | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index cca510a..a1457ca 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1735,6 +1735,9 @@ struct ieee80211_sta_rates { * @supp_rates: Bitmap of supported rates (per band) * @ht_cap: HT capabilities of this STA; restricted to our own capabilities * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities + * @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU + * that this station is allowed to transmit to us. + * Can be modified by driver. * @wme: indicates whether the STA supports QoS/WME (if local devices does, * otherwise always false) * @drv_priv: data area for driver use, will always be aligned to @@ -1775,6 +1778,7 @@ struct ieee80211_sta { u16 aid; struct ieee80211_sta_ht_cap ht_cap; struct ieee80211_sta_vht_cap vht_cap; + u8 max_rx_aggregation_subframes; bool wme; u8 uapsd_queues; u8 max_sp; diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index a9aff60..8532e36 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c @@ -297,13 +297,15 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, if (buf_size == 0) buf_size = IEEE80211_MAX_AMPDU_BUF; + /* examine state machine */ + mutex_lock(&sta->ampdu_mlme.mtx); + /* make sure the size doesn't exceed the maximum supported by the hw */ - if (buf_size > local->hw.max_rx_aggregation_subframes) - buf_size = local->hw.max_rx_aggregation_subframes; + if (buf_size > sta->sta.max_rx_aggregation_subframes) + buf_size = sta->sta.max_rx_aggregation_subframes; params.buf_size = buf_size; - /* examine state machine */ - mutex_lock(&sta->ampdu_mlme.mtx); + ht_dbg(sta->sdata, "AddBA Req buf_size=%d\n", buf_size); if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) { tid_agg_rx = rcu_dereference_protected( diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 19f14c9..5e70fa5 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -340,6 +340,9 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, memcpy(sta->addr, addr, ETH_ALEN); memcpy(sta->sta.addr, addr, ETH_ALEN); + sta->sta.max_rx_aggregation_subframes = + local->hw.max_rx_aggregation_subframes; + sta->local = local; sta->sdata = sdata; sta->rx_stats.last_rx = jiffies;