Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39d4a96f authored by Shreyas Bhatewara's avatar Shreyas Bhatewara Committed by David S. Miller
Browse files

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: default avatarShreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 54da3d00
Loading
Loading
Loading
Loading
+9 −14
Original line number Original line Diff line number Diff line
@@ -807,30 +807,25 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
				   skb_transport_header(skb))->doff * 4;
				   skb_transport_header(skb))->doff * 4;
		ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size;
		ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size;
	} else {
	} else {
		unsigned int pull_size;

		if (skb->ip_summed == CHECKSUM_PARTIAL) {
		if (skb->ip_summed == CHECKSUM_PARTIAL) {
			ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb);
			ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb);


			if (ctx->ipv4) {
			if (ctx->ipv4) {
				struct iphdr *iph = (struct iphdr *)
				struct iphdr *iph = (struct iphdr *)
						    skb_network_header(skb);
						    skb_network_header(skb);
				if (iph->protocol == IPPROTO_TCP) {
				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;
					}
					ctx->l4_hdr_size = ((struct tcphdr *)
					ctx->l4_hdr_size = ((struct tcphdr *)
					   skb_transport_header(skb))->doff * 4;
					   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 =
					ctx->l4_hdr_size =
							sizeof(struct udphdr);
							sizeof(struct tcphdr);
				} else {
				else
					ctx->l4_hdr_size = 0;
					ctx->l4_hdr_size = 0;
				}
			} else {
			} else {
				/* for simplicity, don't copy L4 headers */
				/* for simplicity, don't copy L4 headers */
				ctx->l4_hdr_size = 0;
				ctx->l4_hdr_size = 0;