18 #include <linux/slab.h>
19 #include <linux/module.h>
20 #include <linux/types.h>
21 #include <linux/kernel.h>
22 #include <linux/string.h>
27 #define EM_CAN_RULES_MAX 500
86 if ((i & can_mask) ==
can_id)
91 static inline struct canid_match *em_canid_priv(
struct tcf_ematch *
m)
96 static int em_canid_match(
struct sk_buff *
skb,
struct tcf_ematch *m,
105 can_id = em_canid_get_id(skb);
109 i < cm->eff_rules_count; i++, lp++) {
117 match = (
test_bit(can_id, cm->match_sff) ? 1 : 0);
123 static int em_canid_change(
struct tcf_proto *tp,
void *
data,
int len,
124 struct tcf_ematch *m)
158 if (conf[i].can_id & CAN_EFF_FLAG) {
169 if (!(conf[i].can_id & CAN_EFF_FLAG)) {
177 em_canid_sff_match_add(cm,
178 conf[i].can_id, conf[i].can_mask);
183 m->data = (
unsigned long)cm;
185 if (cm_old !=
NULL) {
186 pr_err(
"canid: Configuring an existing ematch!\n");
193 static void em_canid_destroy(
struct tcf_proto *tp,
struct tcf_ematch *m)
200 static int em_canid_dump(
struct sk_buff *skb,
struct tcf_ematch *m)
215 static struct tcf_ematch_ops em_canid_ops = {
217 .change = em_canid_change,
218 .match = em_canid_match,
219 .destroy = em_canid_destroy,
220 .dump = em_canid_dump,
225 static int __init init_em_canid(
void)
230 static void __exit exit_em_canid(
void)