* how to make sure that packet is inserted into PACKET_MMAP ring buffer strictly according to its timestamp order?
@ 2010-12-22 4:33 Rui
0 siblings, 0 replies; only message in thread
From: Rui @ 2010-12-22 4:33 UTC (permalink / raw)
To: netdev
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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-22 4:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-22 4:33 how to make sure that packet is inserted into PACKET_MMAP ring buffer strictly according to its timestamp order? Rui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).