From patchwork Fri May 5 12:08:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9713443 X-Patchwork-Delegate: kvalo@adurom.com 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 7A10560235 for ; Fri, 5 May 2017 12:08:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 673A128627 for ; Fri, 5 May 2017 12:08:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C27C2869A; Fri, 5 May 2017 12:08:44 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 B308828627 for ; Fri, 5 May 2017 12:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752847AbdEEMIm (ORCPT ); Fri, 5 May 2017 08:08:42 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36524 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138AbdEEMIl (ORCPT ); Fri, 5 May 2017 08:08:41 -0400 Received: by mail-pf0-f196.google.com with SMTP id v14so543278pfd.3 for ; Fri, 05 May 2017 05:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pIGxf6UvjZt03W4Xei+KgpbYr5ALuZccbFfWpHQuRmA=; b=m1E+aGDmPrnjxWsezzID9TlxaqffNYUOeoRZ6RkyUqX4d0du3ts6oS17SiNCg1hOQj RHACjzHq0CeDHw9dhC5921NCm7y3YkIbjPfwiXtWhHRWWVYmGM2M3CJJRptq8fFkkndS WzyVP2ZmnyChZSmAekb7bHKwNMoD6lZsnUwB32ZqXSrQGesaTGwhWhOFe4hJ8qsVuxk+ dnHhkLLho8CRIM+ss4qZkPAUlSuEOeF0Ep4jjfRZzz0n0ZFEmUDoi90IePA2/HCy+XPf RazGEE7lJFRlsbwLxMUcAx/54HjudEfNLVrTr7MNWr+sFKLdsPch3aqmWXtmZN6chqqK 11qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pIGxf6UvjZt03W4Xei+KgpbYr5ALuZccbFfWpHQuRmA=; b=Xy7qXDw68pM3h8Svr2fe8i9uA9Ou7od3ysZLZqxaKLsC363K5IsC+38ZUthzNYBZe0 iHPrFcAZ3fhbCdiLNvz2WhjD8ZwV9IARXQLPlpbABe656c84ruOLqcENxqqTrK9LwbRr UO7VmWbxrwqc6bzA2MkKg+qmjLn5x2Jc1UU8JB+JqzhSpaJAtnJDLjQbNG2haoTuT+hs g0Kx1/eLfYALlMOzVF/gUCJ3iu2X0BN6FnDIckLVJAcTMSfzJy0PNiGSYt14elgvdwi0 CMVKBD7FG4QjXIwhmBt2lRxAzD4iXctbUdHwpQpylhtNFEIxB83PseLZOV1ynGOyqRdM qMYQ== X-Gm-Message-State: AN3rC/79bIN9btxQ5N3bd8IKDZ18LJUlKsxkdQGvjf2YqwYlPxB6pli7 OJL5PLh999FJ/Q== X-Received: by 10.84.238.200 with SMTP id l8mr11158192pln.85.1493986120642; Fri, 05 May 2017 05:08:40 -0700 (PDT) Received: from ubuntu.members.linode.com ([2400:8902::f03c:91ff:fee7:7cf1]) by smtp.gmail.com with ESMTPSA id i15sm13743913pfj.51.2017.05.05.05.08.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 May 2017 05:08:40 -0700 (PDT) From: Xinming Hu To: Linux Wireless Cc: Kalle Valo , Brian Norris , Dmitry Torokhov , rajatja@google.com, Zhiyuan Yang , Cathy Luo , Xinming Hu , Ganapathi Bhat Subject: [PATCH v2 5/6] mwifiex: do not aggregate tcp ack in usb tx aggregation queue Date: Fri, 5 May 2017 12:08:19 +0000 Message-Id: <1493986100-24509-5-git-send-email-huxinming820@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493986100-24509-1-git-send-email-huxinming820@gmail.com> References: <1493986100-24509-1-git-send-email-huxinming820@gmail.com> 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 From: Xinming Hu Tcp ack should be send as soon to avoid throuput drop during receive tcp traffic. Signed-off-by: Xinming Hu Signed-off-by: Cathy Luo Signed-off-by: Ganapathi Bhat --- v2: same as v1 --- drivers/net/wireless/marvell/mwifiex/11n_aggr.c | 4 ++++ drivers/net/wireless/marvell/mwifiex/decl.h | 1 + drivers/net/wireless/marvell/mwifiex/main.c | 26 +++++++++++++++++++++++++ drivers/net/wireless/marvell/mwifiex/main.h | 1 + drivers/net/wireless/marvell/mwifiex/usb.c | 6 ++++-- 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c index e8ffb26..cbf3bc2 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c @@ -194,6 +194,10 @@ if (tx_info_src->flags & MWIFIEX_BUF_FLAG_TDLS_PKT) tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; + + if (tx_info_src->flags & MWIFIEX_BUF_FLAG_TCP_ACK) + tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_TCP_ACK; + tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_AGGR_PKT; skb_aggr->priority = skb_src->priority; skb_aggr->tstamp = skb_src->tstamp; diff --git a/drivers/net/wireless/marvell/mwifiex/decl.h b/drivers/net/wireless/marvell/mwifiex/decl.h index 188e4c3..0487420 100644 --- a/drivers/net/wireless/marvell/mwifiex/decl.h +++ b/drivers/net/wireless/marvell/mwifiex/decl.h @@ -89,6 +89,7 @@ #define MWIFIEX_BUF_FLAG_EAPOL_TX_STATUS BIT(3) #define MWIFIEX_BUF_FLAG_ACTION_TX_STATUS BIT(4) #define MWIFIEX_BUF_FLAG_AGGR_PKT BIT(5) +#define MWIFIEX_BUF_FLAG_TCP_ACK BIT(6) #define MWIFIEX_BRIDGED_PKTS_THR_HIGH 1024 #define MWIFIEX_BRIDGED_PKTS_THR_LOW 128 diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index dc79d1a..5c7fbc6 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -851,6 +851,30 @@ struct sk_buff * return skb; } +static bool is_piggyback_tcp_ack(struct sk_buff *skb) +{ + struct ethhdr *ethh = NULL; + struct iphdr *iph = NULL; + struct tcphdr *tcph = NULL; + + ethh = (struct ethhdr *)skb->data; + if (ntohs(ethh->h_proto) != ETH_P_IP) + return false; + + iph = (struct iphdr *)((u8 *)ethh + sizeof(struct ethhdr)); + if (iph->protocol != IPPROTO_TCP) + return false; + + tcph = (struct tcphdr *)((u8 *)iph + iph->ihl * 4); + /* Piggyback ack without payload*/ + if (*((u8 *)tcph + 13) == 0x10 && + ntohs(iph->tot_len) <= (iph->ihl + tcph->doff) * 4) { + return true; + } + + return false; +} + /* * CFG802.11 network device handler for data transmission. */ @@ -904,6 +928,8 @@ struct sk_buff * tx_info->bss_num = priv->bss_num; tx_info->bss_type = priv->bss_type; tx_info->pkt_len = skb->len; + if (is_piggyback_tcp_ack(skb)) + tx_info->flags |= MWIFIEX_BUF_FLAG_TCP_ACK; multicast = is_multicast_ether_addr(skb->data); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index a85b89e..a947825 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -49,6 +49,7 @@ #include #include #include +#include #include "decl.h" #include "ioctl.h" diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index f230017..e9c3d43 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -934,6 +934,7 @@ static int mwifiex_usb_aggr_tx_data(struct mwifiex_adapter *adapter, u8 ep, struct urb_context *context = NULL; struct txpd *local_tx_pd = (struct txpd *)((u8 *)skb->data + adapter->intf_hdr_len); + struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb); u8 f_send_aggr_buf = 0; u8 f_send_cur_buf = 0; u8 f_precopy_cur_buf = 0; @@ -989,8 +990,9 @@ static int mwifiex_usb_aggr_tx_data(struct mwifiex_adapter *adapter, u8 ep, } } - if (local_tx_pd->flags & MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET) { - /* Send NULL packet immediately*/ + if (local_tx_pd->flags & MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET || + tx_info->flags & MWIFIEX_BUF_FLAG_TCP_ACK) { + /* Send NULL data/TCP ACK packet immediately*/ if (f_precopy_cur_buf) { if (skb_queue_empty(&port->tx_aggr.aggr_list)) { f_precopy_cur_buf = 0;