Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150521
b: refs/heads/master
c: a5b1cf2
h: refs/heads/master
i:
  150519: f04679a
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed May 27, 2009
1 parent e7b2670 commit 74a9185
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7489594cb249aeb178287c9a43a9e4f366044259
refs/heads/master: a5b1cf288d4200506ab62fbb86cc81ace948a306
23 changes: 14 additions & 9 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1132,18 +1132,23 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
NAPI_GRO_CB(skb)->data_offset += len;
}

static inline void *skb_gro_header(struct sk_buff *skb, unsigned int hlen)
static inline void *skb_gro_header_fast(struct sk_buff *skb,
unsigned int offset)
{
unsigned int offset = skb_gro_offset(skb);
return NAPI_GRO_CB(skb)->frag0 + offset;
}

hlen += offset;
if (NAPI_GRO_CB(skb)->frag0_len < hlen) {
NAPI_GRO_CB(skb)->frag0 = NULL;
NAPI_GRO_CB(skb)->frag0_len = 0;
return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
}
static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
{
return NAPI_GRO_CB(skb)->frag0_len < hlen;
}

return NAPI_GRO_CB(skb)->frag0 + offset;
static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
unsigned int offset)
{
NAPI_GRO_CB(skb)->frag0 = NULL;
NAPI_GRO_CB(skb)->frag0_len = 0;
return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
}

static inline void *skb_gro_mac_header(struct sk_buff *skb)
Expand Down
17 changes: 12 additions & 5 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2590,17 +2590,24 @@ struct sk_buff *napi_frags_skb(struct napi_struct *napi)
{
struct sk_buff *skb = napi->skb;
struct ethhdr *eth;
unsigned int hlen;
unsigned int off;

napi->skb = NULL;

skb_reset_mac_header(skb);
skb_gro_reset_offset(skb);

eth = skb_gro_header(skb, sizeof(*eth));
if (!eth) {
napi_reuse_skb(napi, skb);
skb = NULL;
goto out;
off = skb_gro_offset(skb);
hlen = off + sizeof(*eth);
eth = skb_gro_header_fast(skb, off);
if (skb_gro_header_hard(skb, hlen)) {
eth = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!eth)) {
napi_reuse_skb(napi, skb);
skb = NULL;
goto out;
}
}

skb_gro_pull(skb, sizeof(*eth));
Expand Down
13 changes: 10 additions & 3 deletions trunk/net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,13 +1246,20 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
struct sk_buff **pp = NULL;
struct sk_buff *p;
struct iphdr *iph;
unsigned int hlen;
unsigned int off;
int flush = 1;
int proto;
int id;

iph = skb_gro_header(skb, sizeof(*iph));
if (unlikely(!iph))
goto out;
off = skb_gro_offset(skb);
hlen = off + sizeof(*iph);
iph = skb_gro_header_fast(skb, off);
if (skb_gro_header_hard(skb, hlen)) {
iph = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!iph))
goto out;
}

proto = iph->protocol & (MAX_INET_PROTOS - 1);

Expand Down
22 changes: 16 additions & 6 deletions trunk/net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2518,20 +2518,30 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
unsigned int thlen;
unsigned int flags;
unsigned int mss = 1;
unsigned int hlen;
unsigned int off;
int flush = 1;
int i;

th = skb_gro_header(skb, sizeof(*th));
if (unlikely(!th))
goto out;
off = skb_gro_offset(skb);
hlen = off + sizeof(*th);
th = skb_gro_header_fast(skb, off);
if (skb_gro_header_hard(skb, hlen)) {
th = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!th))
goto out;
}

thlen = th->doff * 4;
if (thlen < sizeof(*th))
goto out;

th = skb_gro_header(skb, thlen);
if (unlikely(!th))
goto out;
hlen = off + thlen;
if (skb_gro_header_hard(skb, hlen)) {
th = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!th))
goto out;
}

skb_gro_pull(skb, thlen);

Expand Down
13 changes: 10 additions & 3 deletions trunk/net/ipv6/af_inet6.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,13 +817,20 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
struct sk_buff *p;
struct ipv6hdr *iph;
unsigned int nlen;
unsigned int hlen;
unsigned int off;
int flush = 1;
int proto;
__wsum csum;

iph = skb_gro_header(skb, sizeof(*iph));
if (unlikely(!iph))
goto out;
off = skb_gro_offset(skb);
hlen = off + sizeof(*iph);
iph = skb_gro_header_fast(skb, off);
if (skb_gro_header_hard(skb, hlen)) {
iph = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!iph))
goto out;
}

skb_gro_pull(skb, sizeof(*iph));
skb_set_transport_header(skb, skb_gro_offset(skb));
Expand Down

0 comments on commit 74a9185

Please sign in to comment.