Commit ed83da12 authored by Alexander Duyck's avatar Alexander Duyck Committed by Jeff Kirsher

ixgbe: Do not parse past IP header on fragments beyond the first

This change makes it so that only the first fragment in a series of fragments
will have the L4 header pulled.  Previously we were always pulling the L4
header as well and in the case of UDP this can harm performance since only the
first fragment will have the header, the rest just contain data which should
be left in the paged portion of the packet.
Signed-off-by: default avatarAlexander Duyck <>
Tested-by: default avatarStephen Ko <>
Tested-by: default avatarMarcus Dennis <>
Signed-off-by: default avatarJeff Kirsher <>
parent e921eb1a
......@@ -1338,26 +1338,29 @@ static unsigned int ixgbe_get_headlen(unsigned char *data,
if (hlen < sizeof(struct iphdr))
return - data;
/* record next protocol */
nexthdr = hdr.ipv4->protocol; += hlen;
/* record next protocol if header is present */
if (!hdr.ipv4->frag_off)
nexthdr = hdr.ipv4->protocol;
} else if (protocol == __constant_htons(ETH_P_IPV6)) {
if (( - data) > (max_len - sizeof(struct ipv6hdr)))
return max_len;
/* record next protocol */
nexthdr = hdr.ipv6->nexthdr; += sizeof(struct ipv6hdr);
hlen = sizeof(struct ipv6hdr);
} else if (protocol == __constant_htons(ETH_P_FCOE)) {
if (( - data) > (max_len - FCOE_HEADER_LEN))
return max_len; += FCOE_HEADER_LEN;
} else {
return - data;
/* relocate pointer to start of L4 header */ += hlen;
/* finally sort out TCP/UDP */
if (nexthdr == IPPROTO_TCP) {
if (( - data) > (max_len - sizeof(struct tcphdr)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment