From: Brian Norris <briannorris@chromium.org>
To: Xinming Hu <huxinming820@gmail.com>
Cc: Linux Wireless <linux-wireless@vger.kernel.org>,
Kalle Valo <kvalo@qca.qualcomm.com>,
Dmitry Torokhov <dtor@google.com>,
rajatja@google.com, Zhiyuan Yang <yangzy@marvell.com>,
Cathy Luo <cluo@marvell.com>, Xinming Hu <huxm@marvell.com>,
Ganapathi Bhat <gbhat@marvell.com>
Subject: Re: [PATCH v3 5/6] mwifiex: do not aggregate tcp ack in usb tx aggregation queue
Date: Fri, 19 May 2017 09:42:33 -0700 [thread overview]
Message-ID: <20170519164232.GB125761@google.com> (raw)
In-Reply-To: <1495184805-6631-5-git-send-email-huxinming820@gmail.com>
On Fri, May 19, 2017 at 09:06:44AM +0000, Xinming Hu wrote:
> From: Xinming Hu <huxm@marvell.com>
>
> Tcp ack should be send as soon to avoid throuput drop during receive tcp
> traffic.
>
> Signed-off-by: Xinming Hu <huxm@marvell.com>
> Signed-off-by: Cathy Luo <cluo@marvell.com>
> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
> ---
> v2: same as v1
> v3: avoid to use magic tcp flag (Kalle)
> ---
> 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 2c42191..b7d835c 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;
What about IPv6?
Also, what about all the protocols that you're *not* hacking this for?
Is the latency induced by aggregation really that poor?
I'm not really a networking expert here, but this whole patch smells bad
to me.
> +
> + 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 (tcp_flag_word(tcph) == TCP_FLAG_ACK &&
> + 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 1f7e6c3..b0010a9 100644
> --- a/drivers/net/wireless/marvell/mwifiex/main.h
> +++ b/drivers/net/wireless/marvell/mwifiex/main.h
> @@ -49,6 +49,7 @@
> #include <linux/pm_runtime.h>
> #include <linux/slab.h>
> #include <linux/of_irq.h>
> +#include <linux/tcp.h>
I dislike polluting the (driver-global) main.h with #include's that only
are used in one file. Especially when you talk about seemingly
layer-violating TCP hacks. Can you move this to main.c instead?
Brian
>
> #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;
> --
> 1.9.1
>
next prev parent reply other threads:[~2017-05-19 16:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 9:06 [PATCH v3 1/6] mwifiex: use variable interface header length Xinming Hu
2017-05-19 9:06 ` [PATCH v3 2/6] mwifiex: usb: kill urb before free its memory Xinming Hu
2017-05-19 9:06 ` [PATCH v3 3/6] mwifiex: usb: transmit aggregation packets Xinming Hu
2017-05-19 9:06 ` [PATCH v3 4/6] mwifiex: usb: add timer to flush " Xinming Hu
2017-05-19 9:06 ` [PATCH v3 5/6] mwifiex: do not aggregate tcp ack in usb tx aggregation queue Xinming Hu
2017-05-19 16:42 ` Brian Norris [this message]
2017-05-23 7:08 ` [EXT] " Xinming Hu
2017-05-23 7:10 ` Xinming Hu
2017-05-19 9:06 ` [PATCH v3 6/6] mwifiex: check next packet length for usb tx aggregation Xinming Hu
2017-05-19 16:28 ` Brian Norris
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=20170519164232.GB125761@google.com \
--to=briannorris@chromium.org \
--cc=cluo@marvell.com \
--cc=dtor@google.com \
--cc=gbhat@marvell.com \
--cc=huxinming820@gmail.com \
--cc=huxm@marvell.com \
--cc=kvalo@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rajatja@google.com \
--cc=yangzy@marvell.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).