All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Haiyang Zhang <haiyangz@microsoft.com>,
	davem@davemloft.net, netdev@vger.kernel.org
Cc: kys@microsoft.com, olaf@aepfle.de, linux-kernel@vger.kernel.org,
	driverdev-devel@linuxdriverproject.org
Subject: Re: [PATCH net-next] hv_netvsc: Use simple parser for IPv4 and v6 headers
Date: Wed, 16 Dec 2015 21:34:22 +0300	[thread overview]
Message-ID: <5671AEAE.9080803@cogentembedded.com> (raw)
In-Reply-To: <1450289022-9958-1-git-send-email-haiyangz@microsoft.com>

Hello.

On 12/16/2015 09:03 PM, Haiyang Zhang wrote:

> To avoid performance overhead when using skb_flow_dissect_flow_keys(),
> we switch to the simple parsers to get the IP and port numbers.
>
> Performance comparison: throughput (Gbps):
> Number of connections, before patch, after patch
> 1			8.56		10.18
> 4			11.17		14.07
> 16			12.21		21.78
> 64			18.71		32.08
> 256			15.92		26.32
> 1024			8.41		15.49
> 3000			7.82		11.58
>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Tested-by: Simon Xiao <sixiao@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>   drivers/net/hyperv/netvsc_drv.c |   38 +++++++++++++++++++++++++++++---------
>   1 files changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 1c8db9a..e28951f 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -237,20 +237,40 @@ static u32 comp_hash(u8 *key, int klen, void *data, int dlen)
[...]
> +	if (iphdr->version == 4) {
> +		dbuf[0] = iphdr->saddr;
> +		dbuf[1] = iphdr->daddr;
> +		if (iphdr->protocol == IPPROTO_TCP) {
> +			dbuf[2] = *(__be32 *)&tcp_hdr(skb)->source;
> +			data_len = 12;
> +		} else {
> +			data_len = 8;
> +		}
> +	} else if (ipv6hdr->version == 6) {
> +		memcpy(dbuf, &ipv6hdr->saddr, 32);
> +		if (ipv6hdr->nexthdr == IPPROTO_TCP) {
> +			dbuf[8] = *(__be32 *)&tcp_hdr(skb)->source;
> +			data_len = 36;
> +		} else {
> +			data_len = 32;
> +		}
> +	} else {
> +		return false;
> +	}

    This is asking to be a *switch* statement.

[...]

MBR, Sergei


WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Haiyang Zhang <haiyangz@microsoft.com>,
	davem@davemloft.net, netdev@vger.kernel.org
Cc: driverdev-devel@linuxdriverproject.org, olaf@aepfle.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] hv_netvsc: Use simple parser for IPv4 and v6 headers
Date: Wed, 16 Dec 2015 21:34:22 +0300	[thread overview]
Message-ID: <5671AEAE.9080803@cogentembedded.com> (raw)
In-Reply-To: <1450289022-9958-1-git-send-email-haiyangz@microsoft.com>

Hello.

On 12/16/2015 09:03 PM, Haiyang Zhang wrote:

> To avoid performance overhead when using skb_flow_dissect_flow_keys(),
> we switch to the simple parsers to get the IP and port numbers.
>
> Performance comparison: throughput (Gbps):
> Number of connections, before patch, after patch
> 1			8.56		10.18
> 4			11.17		14.07
> 16			12.21		21.78
> 64			18.71		32.08
> 256			15.92		26.32
> 1024			8.41		15.49
> 3000			7.82		11.58
>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Tested-by: Simon Xiao <sixiao@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>   drivers/net/hyperv/netvsc_drv.c |   38 +++++++++++++++++++++++++++++---------
>   1 files changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 1c8db9a..e28951f 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -237,20 +237,40 @@ static u32 comp_hash(u8 *key, int klen, void *data, int dlen)
[...]
> +	if (iphdr->version == 4) {
> +		dbuf[0] = iphdr->saddr;
> +		dbuf[1] = iphdr->daddr;
> +		if (iphdr->protocol == IPPROTO_TCP) {
> +			dbuf[2] = *(__be32 *)&tcp_hdr(skb)->source;
> +			data_len = 12;
> +		} else {
> +			data_len = 8;
> +		}
> +	} else if (ipv6hdr->version == 6) {
> +		memcpy(dbuf, &ipv6hdr->saddr, 32);
> +		if (ipv6hdr->nexthdr == IPPROTO_TCP) {
> +			dbuf[8] = *(__be32 *)&tcp_hdr(skb)->source;
> +			data_len = 36;
> +		} else {
> +			data_len = 32;
> +		}
> +	} else {
> +		return false;
> +	}

    This is asking to be a *switch* statement.

[...]

MBR, Sergei

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2015-12-16 18:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 18:03 [PATCH net-next] hv_netvsc: Use simple parser for IPv4 and v6 headers Haiyang Zhang
2015-12-16 18:03 ` Haiyang Zhang
2015-12-16 18:03 ` Haiyang Zhang
2015-12-16 17:08 ` Eric Dumazet
2015-12-16 17:08   ` Eric Dumazet
2015-12-16 17:08   ` Eric Dumazet
2015-12-16 19:20   ` Haiyang Zhang
2015-12-16 19:20     ` Haiyang Zhang
2015-12-16 19:20     ` Haiyang Zhang
2015-12-16 21:19     ` Eric Dumazet
2015-12-16 21:19       ` Eric Dumazet
2015-12-16 21:19       ` Eric Dumazet
2015-12-16 23:23     ` David Miller
2015-12-16 23:23       ` David Miller
2015-12-16 23:23       ` David Miller
2015-12-16 18:34 ` Sergei Shtylyov [this message]
2015-12-16 18:34   ` Sergei Shtylyov
2015-12-16 18:45   ` Sergei Shtylyov
2015-12-16 18:45     ` Sergei Shtylyov

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=5671AEAE.9080803@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.