Thread (3 messages) 3 messages, 2 authors, 2015-03-01

Re: [PATCH net-next] Driver: Vmxnet3: Copy TCP header to mapped frame for IPv6 packets

From: Shrikrishna Khare <hidden>
Date: 2015-03-01 03:16:07
Also in: lkml


On Sat, 28 Feb 2015, Sergei Shtylyov wrote:
Hello.

On 02/28/2015 10:58 PM, Shrikrishna Khare wrote:
quoted
Allows for packet parsing to be done by the fast path. This performance
optimization already exists for IPv4. Add similar logic for IPv6.
quoted
Signed-off-by: Amitabha Banerjee <redacted>
Signed-off-by: Shrikrishna Khare <redacted>
---
  drivers/net/vmxnet3/vmxnet3_drv.c | 26 ++++++++++++++++----------
  drivers/net/vmxnet3/vmxnet3_int.h |  5 +++--
  2 files changed, 19 insertions(+), 12 deletions(-)
quoted
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
[...]
quoted
@@ -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
Thanks for the review, Sergei. Would fix it, and resubmit the patch.

Thanks,
Shri
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help