-
Notifications
You must be signed in to change notification settings - Fork 82
/
msqueue.hh
53 lines (44 loc) · 1.27 KB
/
msqueue.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef CLICK_MSQUEUE_HH
#define CLICK_MSQUEUE_HH
#include "threadsafequeue.hh"
CLICK_DECLS
/*
* =c
* MSQueue
* MSQueue(CAPACITY)
* =deprecated ThreadSafeQueue
* =s threads
* stores packets in a FIFO queue
* =d
* Stores incoming packets in a multiple producer single consumer
* first-in-first-out queue. Enqueue operations are synchronized, dequeue
* operations are not. Drops incoming packets if the queue already holds
* CAPACITY packets. The default for CAPACITY is 1000.
*
* =h length read-only
* Returns the current number of packets in the queue.
* =h dropd read-only
* Returns the number of packets dropped by the queue so far.
* =h capacity read/write
* Returns or sets the queue's capacity.
* =a Queue
*/
class MSQueue : public ThreadSafeQueue { public:
MSQueue() CLICK_COLD;
const char *class_name() const override { return "MSQueue"; }
void *cast(const char *);
int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
#if CLICK_LINUXMODULE && __i386__ && HAVE_INTEL_CPU
static void prefetch_packet(Packet *p);
#endif
};
#if CLICK_LINUXMODULE && __i386__ && HAVE_INTEL_CPU
inline void
MSQueue::prefetch_packet(Packet *p)
{
struct sk_buff *skb = p->skb();
asm volatile("prefetcht0 %0" : : "m" (skb->data));
}
#endif
CLICK_ENDDECLS
#endif