summaryrefslogtreecommitdiffstats
path: root/drivers/net/vmxnet3
diff options
context:
space:
mode:
authorShrikrishna Khare <skhare@vmware.com>2015-02-28 23:33:09 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-01 23:03:42 -0500
commit759c9359ae5a6ecdb74cad61a31be6805fb09617 (patch)
tree1325ca274a50b5d805218c3b8dd85f7cf6418861 /drivers/net/vmxnet3
parent68932f7188f84673fdb0de14a00c2f428869c6ed (diff)
Driver: Vmxnet3: Copy TCP header to mapped frame for IPv6 packets
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>
Diffstat (limited to 'drivers/net/vmxnet3')
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c29
-rw-r--r--drivers/net/vmxnet3/vmxnet3_int.h5
2 files changed, 23 insertions, 11 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 294214c15292..61c0840c448c 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -819,6 +819,7 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
819 struct vmxnet3_adapter *adapter) 819 struct vmxnet3_adapter *adapter)
820{ 820{
821 struct Vmxnet3_TxDataDesc *tdd; 821 struct Vmxnet3_TxDataDesc *tdd;
822 u8 protocol = 0;
822 823
823 if (ctx->mss) { /* TSO */ 824 if (ctx->mss) { /* TSO */
824 ctx->eth_ip_hdr_size = skb_transport_offset(skb); 825 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,
831 if (ctx->ipv4) { 832 if (ctx->ipv4) {
832 const struct iphdr *iph = ip_hdr(skb); 833 const struct iphdr *iph = ip_hdr(skb);
833 834
834 if (iph->protocol == IPPROTO_TCP) 835 protocol = iph->protocol;
835 ctx->l4_hdr_size = tcp_hdrlen(skb); 836 } else if (ctx->ipv6) {
836 else if (iph->protocol == IPPROTO_UDP) 837 const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
837 ctx->l4_hdr_size = sizeof(struct udphdr); 838
838 else 839 protocol = ipv6h->nexthdr;
839 ctx->l4_hdr_size = 0; 840 }
840 } else { 841
841 /* for simplicity, don't copy L4 headers */ 842 switch (protocol) {
843 case IPPROTO_TCP:
844 ctx->l4_hdr_size = tcp_hdrlen(skb);
845 break;
846 case IPPROTO_UDP:
847 ctx->l4_hdr_size = sizeof(struct udphdr);
848 break;
849 default:
842 ctx->l4_hdr_size = 0; 850 ctx->l4_hdr_size = 0;
851 break;
843 } 852 }
853
844 ctx->copy_size = min(ctx->eth_ip_hdr_size + 854 ctx->copy_size = min(ctx->eth_ip_hdr_size +
845 ctx->l4_hdr_size, skb->len); 855 ctx->l4_hdr_size, skb->len);
846 } else { 856 } else {
@@ -887,7 +897,7 @@ vmxnet3_prepare_tso(struct sk_buff *skb,
887 iph->check = 0; 897 iph->check = 0;
888 tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 0, 898 tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 0,
889 IPPROTO_TCP, 0); 899 IPPROTO_TCP, 0);
890 } else { 900 } else if (ctx->ipv6) {
891 struct ipv6hdr *iph = ipv6_hdr(skb); 901 struct ipv6hdr *iph = ipv6_hdr(skb);
892 902
893 tcph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, 0, 903 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,
938 count = txd_estimate(skb); 948 count = txd_estimate(skb);
939 949
940 ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP)); 950 ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));
951 ctx.ipv6 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IPV6));
941 952
942 ctx.mss = skb_shinfo(skb)->gso_size; 953 ctx.mss = skb_shinfo(skb)->gso_size;
943 if (ctx.mss) { 954 if (ctx.mss) {
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index cd71c77f78f2..6bb769ae7de9 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -69,10 +69,10 @@
69/* 69/*
70 * Version numbers 70 * Version numbers
71 */ 71 */
72#define VMXNET3_DRIVER_VERSION_STRING "1.3.4.0-k" 72#define VMXNET3_DRIVER_VERSION_STRING "1.3.5.0-k"
73 73
74/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ 74/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
75#define VMXNET3_DRIVER_VERSION_NUM 0x01030400 75#define VMXNET3_DRIVER_VERSION_NUM 0x01030500
76 76
77#if defined(CONFIG_PCI_MSI) 77#if defined(CONFIG_PCI_MSI)
78 /* RSS only makes sense if MSI-X is supported. */ 78 /* RSS only makes sense if MSI-X is supported. */
@@ -211,6 +211,7 @@ struct vmxnet3_tq_driver_stats {
211 211
212struct vmxnet3_tx_ctx { 212struct vmxnet3_tx_ctx {
213 bool ipv4; 213 bool ipv4;
214 bool ipv6;
214 u16 mss; 215 u16 mss;
215 u32 eth_ip_hdr_size; /* only valid for pkts requesting tso or csum 216 u32 eth_ip_hdr_size; /* only valid for pkts requesting tso or csum
216 * offloading 217 * offloading