Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753091AbbB1XKQ (ORCPT ); Sat, 28 Feb 2015 18:10:16 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:44166 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752796AbbB1XKK (ORCPT ); Sat, 28 Feb 2015 18:10:10 -0500 Message-ID: <54F24ACC.7020108@cogentembedded.com> Date: Sun, 01 Mar 2015 02:10:04 +0300 From: Sergei Shtylyov Organization: Cogent Embedded User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Shrikrishna Khare , sbhatewara@vmware.com, pv-drivers@vmware.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org CC: Amitabha Banerjee Subject: Re: [PATCH net-next] Driver: Vmxnet3: Copy TCP header to mapped frame for IPv6 packets References: <1425153509-31582-1-git-send-email-skhare@vmware.com> In-Reply-To: <1425153509-31582-1-git-send-email-skhare@vmware.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 Content-Length: 1900 Lines: 56 Hello. On 02/28/2015 10:58 PM, Shrikrishna Khare wrote: > Allows for packet parsing to be done by the fast path. This performance > optimization already exists for IPv4. Add similar logic for IPv6. > Signed-off-by: Amitabha Banerjee > Signed-off-by: Shrikrishna Khare > --- > drivers/net/vmxnet3/vmxnet3_drv.c | 26 ++++++++++++++++---------- > drivers/net/vmxnet3/vmxnet3_int.h | 5 +++-- > 2 files changed, 19 insertions(+), 12 deletions(-) > diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c > index 294214c..9216e6a 100644 > --- a/drivers/net/vmxnet3/vmxnet3_drv.c > +++ b/drivers/net/vmxnet3/vmxnet3_drv.c [...] > @@ -831,16 +832,20 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, > if (ctx->ipv4) { > const struct iphdr *iph = ip_hdr(skb); > > - if (iph->protocol == IPPROTO_TCP) > - ctx->l4_hdr_size = tcp_hdrlen(skb); > - else if (iph->protocol == IPPROTO_UDP) > - ctx->l4_hdr_size = sizeof(struct udphdr); > - else > - ctx->l4_hdr_size = 0; > - } else { > - /* for simplicity, don't copy L4 headers */ > - ctx->l4_hdr_size = 0; > + protocol = iph->protocol; > + } else if (ctx->ipv6) { > + const struct ipv6hdr *ipv6h = ipv6_hdr(skb); > + > + protocol = ipv6h->nexthdr; > } > + > + if (protocol == IPPROTO_TCP) > + ctx->l4_hdr_size = tcp_hdrlen(skb); > + else if (protocol == IPPROTO_UDP) > + ctx->l4_hdr_size = sizeof(struct udphdr); > + else > + ctx->l4_hdr_size = 0; > + I think the above is asking to be a 'switch (protocol)' instead. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/