mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shreyas N Bhatewara <sbhatewara@vmware.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: pv-drivers@vmware.com
Subject: [PATCH net-next 4/8] vmxnet3: Provide required number of bytes in first SG buffer
Date: Fri, 14 Jan 2011 16:59:41 -0800	[thread overview]
Message-ID: <20110115005941.1064.26929.stgit@sbhatewara-dev1.eng.vmware.com> (raw)
In-Reply-To: <20110115005701.1064.67435.stgit@sbhatewara-dev1.eng.vmware.com>

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>
---
 drivers/net/vmxnet3/vmxnet3_drv.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index f47db1c..a1632a9 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,
 				   skb_transport_header(skb))->doff * 4;
 		ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size;
 	} else {
-		unsigned int pull_size;
-
 		if (skb->ip_summed == CHECKSUM_PARTIAL) {
 			ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb);
 
 			if (ctx->ipv4) {
 				struct iphdr *iph = (struct iphdr *)
 						    skb_network_header(skb);
-				if (iph->protocol == IPPROTO_TCP) {
-					pull_size = ctx->eth_ip_hdr_size +
-						    sizeof(struct tcphdr);
-
-					if (unlikely(!pskb_may_pull(skb,
-								pull_size))) {
-						goto err;
-					}
+				if (iph->protocol == IPPROTO_TCP)
 					ctx->l4_hdr_size = ((struct tcphdr *)
 					   skb_transport_header(skb))->doff * 4;
-				} else if (iph->protocol == IPPROTO_UDP) {
+				else if (iph->protocol == IPPROTO_UDP)
+					/*
+					 * Use tcp header size so that bytes to
+					 * be copied are more than required by
+					 * the device.
+					 */
 					ctx->l4_hdr_size =
-							sizeof(struct udphdr);
-				} else {
+							sizeof(struct tcphdr);
+				else
 					ctx->l4_hdr_size = 0;
-				}
 			} else {
 				/* for simplicity, don't copy L4 headers */
 				ctx->l4_hdr_size = 0;


  parent reply	other threads:[~2011-01-15  0:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-15  0:59 [PATCH net-next 0/8] vmxnet3 fixes and enhancements Shreyas N Bhatewara
2011-01-15  0:59 ` [PATCH net-next 1/8] vmxnet3: fix ring size update Shreyas N Bhatewara
2011-01-15  0:59 ` [PATCH net-next 2/8] vmxnet3: Preserve the MAC address configured by ifconfig Shreyas N Bhatewara
2011-01-15  0:59 ` [PATCH net-next 3/8] vmxnet3: Enable HW Rx VLAN stripping by default Shreyas N Bhatewara
2011-01-15  0:59 ` Shreyas N Bhatewara [this message]
2011-01-15  0:59 ` [PATCH net-next 5/8] vmxnet3: Make ethtool handlers multiqueue aware Shreyas N Bhatewara
2011-01-18 16:05   ` Ben Hutchings
2011-01-15  0:59 ` [PATCH net-next 6/8] vmxnet3: Disable napi in suspend, reenable in resume Shreyas N Bhatewara
2011-01-15  0:59 ` [PATCH net-next 7/8] vmxnet3: Add locking for access to command register Shreyas N Bhatewara
2011-01-15  1:00 ` [PATCH net-next 8/8] vmxnet3: Dont allocate extra MSI-x vectors Shreyas N Bhatewara
2011-01-16  5:21 ` [PATCH net-next 0/8] vmxnet3 fixes and enhancements David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110115005941.1064.26929.stgit@sbhatewara-dev1.eng.vmware.com \
    --to=sbhatewara@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pv-drivers@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®