2 * Lightweight Autonomic Network Architecture
4 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
12 #include <linux/skbuff.h>
13 #include <linux/wait.h>
14 #include <linux/cpu.h>
15 #include <linux/sched.h>
16 #include <linux/u64_stats_sync.h>
17 #include <linux/atomic.h>
19 #include "xt_fblock.h"
21 #define NUM_QUEUES NUM_TYPES
27 struct worker_estats
{
31 struct u64_stats_sync syncp
;
37 struct sk_buff_head queue
;
38 struct worker_estats stats
;
39 struct ppe_queue
*next
;
40 } ____cacheline_aligned_in_smp
;
43 struct ppe_queue
*head
;
44 struct ppe_queue
*ptrs
[NUM_QUEUES
];
47 struct worker_engine
{
49 struct proc_dir_entry
*proc
;
50 struct task_struct
*thread
;
51 struct ppe_squeue inqs
;
52 wait_queue_head_t wait_queue
;
54 } ____cacheline_aligned_in_smp
;
56 extern int init_worker_engines(void);
57 extern void cleanup_worker_engines(void);
58 extern struct worker_engine __percpu
*engines
;
60 static inline void enqueue_egress_on_engine(struct sk_buff
*skb
,
63 struct worker_engine
*ppe
= per_cpu_ptr(engines
, cpu
);
64 skb_queue_tail(&ppe
->inqs
.ptrs
[TYPE_EGRESS
]->queue
, skb
);
65 atomic64_inc(&ppe
->load
);
66 wake_up_interruptible(&ppe
->wait_queue
);
69 static inline void enqueue_ingress_on_engine(struct sk_buff
*skb
,
72 struct worker_engine
*ppe
= per_cpu_ptr(engines
, cpu
);
73 skb_queue_tail(&ppe
->inqs
.ptrs
[TYPE_INGRESS
]->queue
, skb
);
74 atomic64_inc(&ppe
->load
);
75 wake_up_interruptible(&ppe
->wait_queue
);
78 #endif /* XT_ENGINE_H */