From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755129AbbLPSpa (ORCPT ); Wed, 16 Dec 2015 13:45:30 -0500 Received: from mail-lf0-f47.google.com ([209.85.215.47]:33780 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755017AbbLPSp3 (ORCPT ); Wed, 16 Dec 2015 13:45:29 -0500 Subject: Re: [PATCH net-next] hv_netvsc: Use simple parser for IPv4 and v6 headers To: Haiyang Zhang , davem@davemloft.net, netdev@vger.kernel.org References: <1450289022-9958-1-git-send-email-haiyangz@microsoft.com> <5671AEAE.9080803@cogentembedded.com> Cc: kys@microsoft.com, olaf@aepfle.de, linux-kernel@vger.kernel.org, driverdev-devel@linuxdriverproject.org From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <5671B145.2080908@cogentembedded.com> Date: Wed, 16 Dec 2015 21:45:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5671AEAE.9080803@cogentembedded.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/16/2015 09:34 PM, Sergei Shtylyov 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 >> Tested-by: Simon Xiao >> Reviewed-by: K. Y. Srinivasan >> --- >> 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. Oops, nevermind. I'd misread the code. > [...] MBR, Sergei From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id D075E1C105D for ; Wed, 16 Dec 2015 18:45:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id ABB9D33B83 for ; Wed, 16 Dec 2015 18:45:30 +0000 (UTC) Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zqXTwPAJUoqu for ; Wed, 16 Dec 2015 18:45:29 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by silver.osuosl.org (Postfix) with ESMTPS id 8EA6B25142 for ; Wed, 16 Dec 2015 18:45:29 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id l133so35711325lfd.2 for ; Wed, 16 Dec 2015 10:45:29 -0800 (PST) Subject: Re: [PATCH net-next] hv_netvsc: Use simple parser for IPv4 and v6 headers References: <1450289022-9958-1-git-send-email-haiyangz@microsoft.com> <5671AEAE.9080803@cogentembedded.com> From: Sergei Shtylyov Message-ID: <5671B145.2080908@cogentembedded.com> Date: Wed, 16 Dec 2015 21:45:25 +0300 MIME-Version: 1.0 In-Reply-To: <5671AEAE.9080803@cogentembedded.com> List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: Haiyang Zhang , davem@davemloft.net, netdev@vger.kernel.org Cc: driverdev-devel@linuxdriverproject.org, olaf@aepfle.de, linux-kernel@vger.kernel.org On 12/16/2015 09:34 PM, Sergei Shtylyov 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 >> Tested-by: Simon Xiao >> Reviewed-by: K. Y. Srinivasan >> --- >> 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. Oops, nevermind. I'd misread the code. > [...] MBR, Sergei _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel