netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 01/13] ixgbe: Add support for IPv6 and UDP to ixgbe_get_headlen
Date: Fri, 19 Oct 2012 23:25:55 -0700	[thread overview]
Message-ID: <1350714367-24208-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1350714367-24208-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Alexander Duyck <alexander.h.duyck@intel.com>

This change adds support for IPv6 and UDP to ixgbe_get_headlen. The
advantage to this is that we can now handle ipv4/UDP, ipv6/TCP, and
ipv6/UDP with a single memcpy instead of having to do them in multiple
pskb_may_pull calls.

A quick bit of testing shows that we increase throughput for a single
session of netperf from 8800Mpbs to about 9300Mpbs in the case of ipv6/TCP.
As such overall ipv6 performance should improve with this change.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Stephen Ko  <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index e2a6691..3ef74f8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1244,6 +1244,7 @@ static unsigned int ixgbe_get_headlen(unsigned char *data,
 		struct vlan_hdr *vlan;
 		/* l3 headers */
 		struct iphdr *ipv4;
+		struct ipv6hdr *ipv6;
 	} hdr;
 	__be16 protocol;
 	u8 nexthdr = 0;	/* default to not TCP */
@@ -1284,6 +1285,13 @@ static unsigned int ixgbe_get_headlen(unsigned char *data,
 		/* record next protocol */
 		nexthdr = hdr.ipv4->protocol;
 		hdr.network += hlen;
+	} else if (protocol == __constant_htons(ETH_P_IPV6)) {
+		if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))
+			return max_len;
+
+		/* record next protocol */
+		nexthdr = hdr.ipv6->nexthdr;
+		hdr.network += sizeof(struct ipv6hdr);
 #ifdef IXGBE_FCOE
 	} else if (protocol == __constant_htons(ETH_P_FCOE)) {
 		if ((hdr.network - data) > (max_len - FCOE_HEADER_LEN))
@@ -1294,7 +1302,7 @@ static unsigned int ixgbe_get_headlen(unsigned char *data,
 		return hdr.network - data;
 	}
 
-	/* finally sort out TCP */
+	/* finally sort out TCP/UDP */
 	if (nexthdr == IPPROTO_TCP) {
 		if ((hdr.network - data) > (max_len - sizeof(struct tcphdr)))
 			return max_len;
@@ -1307,6 +1315,11 @@ static unsigned int ixgbe_get_headlen(unsigned char *data,
 			return hdr.network - data;
 
 		hdr.network += hlen;
+	} else if (nexthdr == IPPROTO_UDP) {
+		if ((hdr.network - data) > (max_len - sizeof(struct udphdr)))
+			return max_len;
+
+		hdr.network += sizeof(struct udphdr);
 	}
 
 	/*
-- 
1.7.11.7

  reply	other threads:[~2012-10-20  6:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20  6:25 [net-next 00/13][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-10-20  6:25 ` Jeff Kirsher [this message]
2012-10-20  8:01   ` [net-next 01/13] ixgbe: Add support for IPv6 and UDP to ixgbe_get_headlen Eric Dumazet
2012-10-20 20:39     ` Alexander Duyck
2012-10-20  6:25 ` [net-next 02/13] ixgbe: Add support for tracking the default user priority to SR-IOV Jeff Kirsher
2012-10-20  6:25 ` [net-next 03/13] ixgbe: Add support for GET_QUEUES message to get DCB configuration Jeff Kirsher
2012-10-20  6:25 ` [net-next 04/13] ixgbe: Enable support for VF API version 1.1 in the PF Jeff Kirsher
2012-10-20  6:25 ` [net-next 05/13] ixgbevf: Add VF DCB + SR-IOV support Jeff Kirsher
2012-10-20  6:26 ` [net-next 06/13] ixgbe: add WOL support for new subdevice id Jeff Kirsher
2012-10-20  6:26 ` [net-next 07/13] ixgbe: (PTP) refactor init, cyclecounter and reset Jeff Kirsher
2012-10-20  6:26 ` [net-next 08/13] ixgbe: using is_zero_ether_addr() to simplify the code Jeff Kirsher
2012-10-20  6:26 ` [net-next 09/13] ixgbe: Correcting small packet padding Jeff Kirsher
2012-10-20  6:26 ` [net-next 10/13] ixgbe: Drop unnecessary addition from ixgbe_set_rx_buffer_len Jeff Kirsher
2012-10-20  6:26 ` [net-next 11/13] ixgbe: Add function ixgbe_reset_pipeline_82599 Jeff Kirsher
2012-10-20  6:26 ` [net-next 12/13] ixgbe: Add support for pipeline reset Jeff Kirsher
2012-10-21 12:06   ` Martin Josefsson
2012-10-22 20:45     ` Skidmore, Donald C
2012-10-20  6:26 ` [net-next 13/13] ixgbe: Fix possible memory leak in ixgbe_set_ringparam Jeff Kirsher

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=1350714367-24208-2-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.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;
as well as URLs for NNTP newsgroup(s).