From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam01on0116.outbound.protection.outlook.com ([104.47.34.116]:44640 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731114AbeIXUwq (ORCPT ); Mon, 24 Sep 2018 16:52:46 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Lorenzo Bianconi , Johannes Berg , Sasha Levin Subject: [PATCH AUTOSEL 4.14 16/36] mac80211: do not convert to A-MSDU if frag/subframe limited Date: Mon, 24 Sep 2018 14:49:03 +0000 Message-ID: <20180924144851.164533-16-alexander.levin@microsoft.com> References: <20180924144851.164533-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144851.164533-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Lorenzo Bianconi [ Upstream commit 1eb507903665442360a959136dfa3234c43db085 ] Do not start to aggregate packets in a A-MSDU frame (converting the first subframe to A-MSDU, adding the header) if max_tx_fragments or max_amsdu_subframes limits are already exceeded by it. In particular, this happens when drivers set the limit to 1 to avoid A-MSDUs at all. Signed-off-by: Lorenzo Bianconi [reword commit message to be more precise] Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/tx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 2064234500cf..fd8dafe73aec 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3157,9 +3157,6 @@ static bool ieee80211_amsdu_aggregate(struct ieee8021= 1_sub_if_data *sdata, if (skb->len + head->len > max_amsdu_len) goto out; =20 - if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) - goto out; - nfrags =3D 1 + skb_shinfo(skb)->nr_frags; nfrags +=3D 1 + skb_shinfo(head)->nr_frags; frag_tail =3D &skb_shinfo(head)->frag_list; @@ -3175,6 +3172,9 @@ static bool ieee80211_amsdu_aggregate(struct ieee8021= 1_sub_if_data *sdata, if (max_frags && nfrags > max_frags) goto out; =20 + if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) + goto out; + /* * Pad out the previous subframe to a multiple of 4 by adding the * padding to the next one, that's being added. Note that head->len --=20 2.17.1