Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127771
b: refs/heads/master
c: 96e93ea
h: refs/heads/master
i:
  127769: f92f5df
  127767: 8c26de5
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jan 6, 2009
1 parent f283a5c commit 7812e0c
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 24 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: ff5bfc3584efdadf826a21bc76ef42bdfcf3f612
refs/heads/master: 96e93eab20337d063c70d537bd7bc70d90e04fa3
6 changes: 6 additions & 0 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1373,8 +1373,14 @@ extern int netif_rx_ni(struct sk_buff *skb);
#define HAVE_NETIF_RECEIVE_SKB 1
extern int netif_receive_skb(struct sk_buff *skb);
extern void napi_gro_flush(struct napi_struct *napi);
extern int dev_gro_receive(struct napi_struct *napi,
struct sk_buff *skb);
extern int napi_gro_receive(struct napi_struct *napi,
struct sk_buff *skb);
extern void napi_reuse_skb(struct napi_struct *napi,
struct sk_buff *skb);
extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
struct napi_gro_fraginfo *info);
extern int napi_gro_frags(struct napi_struct *napi,
struct napi_gro_fraginfo *info);
extern void netif_nit_deliver(struct sk_buff *skb);
Expand Down
82 changes: 59 additions & 23 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,7 @@ void napi_gro_flush(struct napi_struct *napi)
}
EXPORT_SYMBOL(napi_gro_flush);

static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
{
struct sk_buff **pp = NULL;
struct packet_type *ptype;
Expand Down Expand Up @@ -2417,11 +2417,14 @@ static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)

for (p = napi->gro_list; p; p = p->next) {
count++;
NAPI_GRO_CB(p)->same_flow =
p->mac_len == mac_len &&
!memcmp(skb_mac_header(p), skb_mac_header(skb),
mac_len);
NAPI_GRO_CB(p)->flush = 0;

if (!NAPI_GRO_CB(p)->same_flow)
continue;

if (p->mac_len != mac_len ||
memcmp(skb_mac_header(p), skb_mac_header(skb),
mac_len))
NAPI_GRO_CB(p)->same_flow = 0;
}

pp = ptype->gro_receive(&napi->gro_list, skb);
Expand Down Expand Up @@ -2463,6 +2466,19 @@ static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
normal:
return -1;
}
EXPORT_SYMBOL(dev_gro_receive);

static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
{
struct sk_buff *p;

for (p = napi->gro_list; p; p = p->next) {
NAPI_GRO_CB(p)->same_flow = 1;
NAPI_GRO_CB(p)->flush = 0;
}

return dev_gro_receive(napi, skb);
}

int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
{
Expand All @@ -2479,11 +2495,26 @@ int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
}
EXPORT_SYMBOL(napi_gro_receive);

int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
{
skb_shinfo(skb)->nr_frags = 0;

skb->len -= skb->data_len;
skb->truesize -= skb->data_len;
skb->data_len = 0;

__skb_pull(skb, skb_headlen(skb));
skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb));

napi->skb = skb;
}
EXPORT_SYMBOL(napi_reuse_skb);

struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,
struct napi_gro_fraginfo *info)
{
struct net_device *dev = napi->dev;
struct sk_buff *skb = napi->skb;
int err = NET_RX_DROP;

napi->skb = NULL;

Expand All @@ -2503,16 +2534,31 @@ int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
skb->len += info->len;
skb->truesize += info->len;

if (!pskb_may_pull(skb, ETH_HLEN))
goto reuse;

err = NET_RX_SUCCESS;
if (!pskb_may_pull(skb, ETH_HLEN)) {
napi_reuse_skb(napi, skb);
goto out;
}

skb->protocol = eth_type_trans(skb, dev);

skb->ip_summed = info->ip_summed;
skb->csum = info->csum;

out:
return skb;
}
EXPORT_SYMBOL(napi_fraginfo_skb);

int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
{
struct sk_buff *skb = napi_fraginfo_skb(napi, info);
int err = NET_RX_DROP;

if (!skb)
goto out;

err = NET_RX_SUCCESS;

switch (__napi_gro_receive(napi, skb)) {
case -1:
return netif_receive_skb(skb);
Expand All @@ -2521,17 +2567,7 @@ int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
goto out;
}

reuse:
skb_shinfo(skb)->nr_frags = 0;

skb->len -= skb->data_len;
skb->truesize -= skb->data_len;
skb->data_len = 0;

__skb_pull(skb, skb_headlen(skb));
skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb));

napi->skb = skb;
napi_reuse_skb(napi, skb);

out:
return err;
Expand Down

0 comments on commit 7812e0c

Please sign in to comment.