aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vmxnet3
diff options
context:
space:
mode:
authorShreyas Bhatewara <sbhatewara@vmware.com>2011-01-14 09:59:41 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-16 00:21:12 -0500
commit39d4a96fd7d2926e46151adbd18b810aeeea8ec0 (patch)
tree555913c044588534f3fcca62e2e3aea023e8e974 /drivers/net/vmxnet3
parent54da3d00f6e781f69cb8726757d190704b702a8e (diff)
vmxnet3: Provide required number of bytes in first SG buffer
This is a performance enhancement fix. vmxnet3 device performs better when provided with at least 54 bytes (ethernet 14 + IP 20+ TCP 20) in the first SG buffer. For UDP packets driver provides lesser than that in first sg. This change fixes the same. Also avoid the redundant pskb_may_pull() call. Signed-off-by: Shreyas N Bhatewara <sbhatewara@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.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index f47db1cc766f..a1632a995380 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -807,30 +807,25 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
807 skb_transport_header(skb))->doff * 4; 807 skb_transport_header(skb))->doff * 4;
808 ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size; 808 ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size;
809 } else { 809 } else {
810 unsigned int pull_size;
811
812 if (skb->ip_summed == CHECKSUM_PARTIAL) { 810 if (skb->ip_summed == CHECKSUM_PARTIAL) {
813 ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb); 811 ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb);
814 812
815 if (ctx->ipv4) { 813 if (ctx->ipv4) {
816 struct iphdr *iph = (struct iphdr *) 814 struct iphdr *iph = (struct iphdr *)
817 skb_network_header(skb); 815 skb_network_header(skb);
818 if (iph->protocol == IPPROTO_TCP) { 816 if (iph->protocol == IPPROTO_TCP)
819 pull_size = ctx->eth_ip_hdr_size +
820 sizeof(struct tcphdr);
821
822 if (unlikely(!pskb_may_pull(skb,
823 pull_size))) {
824 goto err;
825 }
826 ctx->l4_hdr_size = ((struct tcphdr *) 817 ctx->l4_hdr_size = ((struct tcphdr *)
827 skb_transport_header(skb))->doff * 4; 818 skb_transport_header(skb))->doff * 4;
828 } else if (iph->protocol == IPPROTO_UDP) { 819 else if (iph->protocol == IPPROTO_UDP)
820 /*
821 * Use tcp header size so that bytes to
822 * be copied are more than required by
823 * the device.
824 */
829 ctx->l4_hdr_size = 825 ctx->l4_hdr_size =
830 sizeof(struct udphdr); 826 sizeof(struct tcphdr);
831 } else { 827 else
832 ctx->l4_hdr_size = 0; 828 ctx->l4_hdr_size = 0;
833 }
834 } else { 829 } else {
835 /* for simplicity, don't copy L4 headers */ 830 /* for simplicity, don't copy L4 headers */
836 ctx->l4_hdr_size = 0; 831 ctx->l4_hdr_size = 0;