aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-10-06 04:08:49 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-08 14:51:51 -0400
commit2e71a6f8084e7ac87166dd77d99c44190fb844fc (patch)
treeeb2e2d47361b35b2b5a3f26beac3d1fbd888c372 /include/linux/netdevice.h
parenta2af139ff1cd85df586690ff626619ab1ee88b0a (diff)
net: gro: selective flush of packets
Current GRO can hold packets in gro_list for almost unlimited time, in case napi->poll() handler consumes its budget over and over. In this case, napi_complete()/napi_gro_flush() are not called. Another problem is that gro_list is flushed in non friendly way : We scan the list and complete packets in the reverse order. (youngest packets first, oldest packets last) This defeats priorities that sender could have cooked. Since GRO currently only store TCP packets, we dont really notice the bug because of retransmits, but this behavior can add unexpected latencies, particularly on mice flows clamped by elephant flows. This patch makes sure no packet can stay more than 1 ms in queue, and only in stress situations. It also complete packets in the right order to minimize latencies. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Jesse Gross <jesse@nicira.com> Cc: Tom Herbert <therbert@google.com> Cc: Yuchung Cheng <ycheng@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a659fd0ba965..0a36fff75bd5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1497,19 +1497,22 @@ struct napi_gro_cb {
1497 /* This indicates where we are processing relative to skb->data. */ 1497 /* This indicates where we are processing relative to skb->data. */
1498 int data_offset; 1498 int data_offset;
1499 1499
1500 /* This is non-zero if the packet may be of the same flow. */
1501 int same_flow;
1502
1503 /* This is non-zero if the packet cannot be merged with the new skb. */ 1500 /* This is non-zero if the packet cannot be merged with the new skb. */
1504 int flush; 1501 int flush;
1505 1502
1506 /* Number of segments aggregated. */ 1503 /* Number of segments aggregated. */
1507 int count; 1504 u16 count;
1505
1506 /* This is non-zero if the packet may be of the same flow. */
1507 u8 same_flow;
1508 1508
1509 /* Free the skb? */ 1509 /* Free the skb? */
1510 int free; 1510 u8 free;
1511#define NAPI_GRO_FREE 1 1511#define NAPI_GRO_FREE 1
1512#define NAPI_GRO_FREE_STOLEN_HEAD 2 1512#define NAPI_GRO_FREE_STOLEN_HEAD 2
1513
1514 /* jiffies when first packet was created/queued */
1515 unsigned long age;
1513}; 1516};
1514 1517
1515#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1518#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -2156,7 +2159,7 @@ extern gro_result_t dev_gro_receive(struct napi_struct *napi,
2156extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); 2159extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
2157extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2160extern gro_result_t napi_gro_receive(struct napi_struct *napi,
2158 struct sk_buff *skb); 2161 struct sk_buff *skb);
2159extern void napi_gro_flush(struct napi_struct *napi); 2162extern void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2160extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2163extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2161extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2164extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2162 struct sk_buff *skb, 2165 struct sk_buff *skb,