[<prev] [next>] [day] [month] [year] [list]
Message-ID: <AANLkTinaMX-yaWRcEf56dPxPdJBJNRnGf3rXEKO-_y86@mail.gmail.com>
Date: Wed, 22 Dec 2010 12:33:40 +0800
From: Rui <wirelesser@...il.com>
To: netdev@...r.kernel.org
Subject: how to make sure that packet is inserted into PACKET_MMAP ring buffer
strictly according to its timestamp order?
hi
how to make sure that packet is inserted into PACKET_MMAP ring buffer
strictly according to its timestamp order?
I am studying the code below
as the function tpacket_rcv will be running in parallel in multi queue
nic supportted kernel,
is it possible that a later packet get the spinlock earlier,
thus it is copied to the ring buffer prior to packet which timestamp is earlier?
thanks
rui
af_packet.c
static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
{
...
spin_lock(&sk->sk_receive_queue.lock);
h.raw = packet_current_frame(po, &po->rx_ring, TP_STATUS_KERNEL);
if (!h.raw)
goto ring_is_full;
packet_increment_head(&po->rx_ring);
po->stats.tp_packets++;
if (copy_skb) {
status |= TP_STATUS_COPY;
__skb_queue_tail(&sk->sk_receive_queue, copy_skb);
}
if (!po->stats.tp_drops)
status &= ~TP_STATUS_LOSING;
spin_unlock(&sk->sk_receive_queue.lock);
skb_copy_bits(skb, 0, h.raw + macoff, snaplen);
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists