Skip to content
Browse files

packet: Fixed TPACKET V3 to signal poll when block is closed rather t…

…han every packet

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 <>
Signed-off-by: David S. Miller <>
  • Loading branch information
Dan Collins authored and davem330 committed Dec 22, 2014
1 parent 02d6a74 commit da413eec729dae5dcb150e2eb34c5e7e5e4e1b49
Showing with 7 additions and 4 deletions.
  1. +7 −4 net/packet/af_packet.c
@@ -785,6 +785,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)
@@ -809,6 +810,8 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1,
/* Flush the block */
prb_flush_block(pkc1, pbd1, status);


pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1);

@@ -2052,12 +2055,12 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,

if (po->tp_version <= TPACKET_V2)
if (po->tp_version <= TPACKET_V2) {
__packet_set_status(po, h.raw, status);
} else {


if (skb_head != skb->data && skb_shared(skb)) {

0 comments on commit da413ee

Please sign in to comment.
You can’t perform that action at this time.