Driver: Vmxnet3: Copy TCP header to mapped frame for IPv6 packets
authorShrikrishna Khare <skhare@vmware.com>
Sun, 1 Mar 2015 04:33:09 +0000 (20:33 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Mar 2015 04:03:42 +0000 (23:03 -0500)
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 <banerjeea@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vmxnet3/vmxnet3_drv.c
drivers/net/vmxnet3/vmxnet3_int.h

index 294214c152927a30564bf83d9204f3351b64f237..61c0840c448c05e3e7fc340e4b1d19370db3363c 100644 (file)
@@ -819,6 +819,7 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
                           struct vmxnet3_adapter *adapter)
 {
        struct Vmxnet3_TxDataDesc *tdd;
+       u8 protocol = 0;
 
        if (ctx->mss) { /* TSO */
                ctx->eth_ip_hdr_size = skb_transport_offset(skb);
@@ -831,16 +832,25 @@ 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 */
+                               protocol = iph->protocol;
+                       } else if (ctx->ipv6) {
+                               const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
+
+                               protocol = ipv6h->nexthdr;
+                       }
+
+                       switch (protocol) {
+                       case IPPROTO_TCP:
+                               ctx->l4_hdr_size = tcp_hdrlen(skb);
+                               break;
+                       case IPPROTO_UDP:
+                               ctx->l4_hdr_size = sizeof(struct udphdr);
+                               break;
+                       default:
                                ctx->l4_hdr_size = 0;
+                               break;
                        }
+
                        ctx->copy_size = min(ctx->eth_ip_hdr_size +
                                         ctx->l4_hdr_size, skb->len);
                } else {
@@ -887,7 +897,7 @@ vmxnet3_prepare_tso(struct sk_buff *skb,
                iph->check = 0;
                tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 0,
                                                 IPPROTO_TCP, 0);
-       } else {
+       } else if (ctx->ipv6) {
                struct ipv6hdr *iph = ipv6_hdr(skb);
 
                tcph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, 0,
@@ -938,6 +948,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
        count = txd_estimate(skb);
 
        ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));
+       ctx.ipv6 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IPV6));
 
        ctx.mss = skb_shinfo(skb)->gso_size;
        if (ctx.mss) {
index cd71c77f78f2f5aeaa7165cbe83e71c0e25587c3..6bb769ae7de94ca5b0bbe0a83b0fcb83223f5081 100644 (file)
 /*
  * Version numbers
  */
-#define VMXNET3_DRIVER_VERSION_STRING   "1.3.4.0-k"
+#define VMXNET3_DRIVER_VERSION_STRING   "1.3.5.0-k"
 
 /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
-#define VMXNET3_DRIVER_VERSION_NUM      0x01030400
+#define VMXNET3_DRIVER_VERSION_NUM      0x01030500
 
 #if defined(CONFIG_PCI_MSI)
        /* RSS only makes sense if MSI-X is supported. */
@@ -211,6 +211,7 @@ struct vmxnet3_tq_driver_stats {
 
 struct vmxnet3_tx_ctx {
        bool   ipv4;
+       bool   ipv6;
        u16 mss;
        u32 eth_ip_hdr_size; /* only valid for pkts requesting tso or csum
                                 * offloading