* Re: [PATCH] Fixed TPACKET V3 to signal poll when block is closed rather than for every packet
[not found] <14a5a65c372.fa01df65100787.352762707968323665@dcollins.co.nz>
@ 2014-12-18 4:37 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2014-12-18 4:37 UTC (permalink / raw)
To: dan; +Cc: netdev, linux-kernel
From: Dan Collins <dan@dcollins.co.nz>
Date: Thu, 18 Dec 2014 12:36:56 +1300
> Make TPACKET_V3 signal poll when block is closed rather than for every packet. Side effect is that poll will be signaled when block retire timer expires which didn't previously happen. Issue was visible when sending packets at a very low frequency such that all blocks are retired before packets are received by TPACKET_V3. This caused avoidable packet loss. The fix ensures that the signal is sent when blocks are closed which covers the normal path where the block is filled as well as the path where the timer expires. The case where a block is filled without moving to the next block (ie. all blocks are full) will still cause poll to be signaled.
Please format your commit messages to 80 column ascii formatted text.
> Signed-off-by: Dan Collins <dan@dcollins.co.nz>
You need real "<" and ">" characters here.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Fixed TPACKET V3 to signal poll when block is closed rather than for every packet
@ 2014-12-18 21:49 Dan Collins
2014-12-18 21:51 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Dan Collins @ 2014-12-18 21:49 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel
Make TPACKET_V3 signal poll when block is closed rather than for every
packet. Side effect is that poll will be signaled when block retire
timer expires which didn't previously happen. Issue was visible when
sending packets at a very low frequency such that all blocks are retired
before packets are received by TPACKET_V3. This caused avoidable packet
loss. The fix ensures that the signal is sent when blocks are closed
which covers the normal path where the block is filled as well as the
path where the timer expires. The case where a block is filled without
moving to the next block (ie. all blocks are full) will still cause poll
to be signaled.
Signed-off-by: Dan Collins <dan@dcollins.co.nz>
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e52a447..14e883d 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -43,6 +43,8 @@
* Chetan Loke : Implemented TPACKET_V3 block abstraction
* layer.
* Copyright (C) 2011, <lokec@ccs.neu.edu>
+ * Dan Collins : Fixed TPACKET_V3 to wake poll when block is closed
+ * rather than for every packet.
*
*
* This program is free software; you can redistribute it and/or
@@ -785,6 +787,7 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1,
struct tpacket3_hdr *last_pkt;
struct tpacket_hdr_v1 *h1 = &pbd1->hdr.bh1;
+ struct sock *sk = &po->sk;
if (po->stats.stats3.tp_drops)
status |= TP_STATUS_LOSING;
@@ -809,6 +812,8 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1,
/* Flush the block */
prb_flush_block(pkc1, pbd1, status);
+ sk->sk_data_ready(sk);
+
pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1);
}
@@ -2052,12 +2057,12 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
smp_wmb();
#endif
- if (po->tp_version <= TPACKET_V2)
+ if (po->tp_version <= TPACKET_V2) {
__packet_set_status(po, h.raw, status);
- else
+ sk->sk_data_ready(sk);
+ } else {
prb_clear_blk_fill_status(&po->rx_ring);
-
- sk->sk_data_ready(sk);
+ }
drop_n_restore:
if (skb_head != skb->data && skb_shared(skb)) {
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fixed TPACKET V3 to signal poll when block is closed rather than for every packet
2014-12-18 21:49 Dan Collins
@ 2014-12-18 21:51 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2014-12-18 21:51 UTC (permalink / raw)
To: dan; +Cc: netdev, linux-kernel
From: Dan Collins <dan@dcollins.co.nz>
Date: Fri, 19 Dec 2014 10:49:16 +1300
> Make TPACKET_V3 signal poll when block is closed rather than for every
> packet. Side effect is that poll will be signaled when block retire
> timer expires which didn't previously happen. Issue was visible when
> sending packets at a very low frequency such that all blocks are retired
> before packets are received by TPACKET_V3. This caused avoidable packet
> loss. The fix ensures that the signal is sent when blocks are closed
> which covers the normal path where the block is filled as well as the
> path where the timer expires. The case where a block is filled without
> moving to the next block (ie. all blocks are full) will still cause poll
> to be signaled.
>
> Signed-off-by: Dan Collins <dan@dcollins.co.nz>
Your email client has corrupted the patch, turning TAB characters into
sequences of SPACE characters.
Please turn off all formatting in your email client, read:
Documentation/email-clients.txt
for help.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-18 21:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <14a5a65c372.fa01df65100787.352762707968323665@dcollins.co.nz>
2014-12-18 4:37 ` [PATCH] Fixed TPACKET V3 to signal poll when block is closed rather than for every packet David Miller
2014-12-18 21:49 Dan Collins
2014-12-18 21:51 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox