From ed5b9b2da20860cfe947c952dbc1cb46b098cad9 Mon Sep 17 00:00:00 2001 From: Rostislav Lisovy Date: Wed, 23 May 2012 12:35:55 +0200 Subject: [PATCH] cls_can: Storing SFF rules in bitmap only. --- net/sched/cls_can.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/net/sched/cls_can.c b/net/sched/cls_can.c index cf34eb56b8d..0f64fb00227 100644 --- a/net/sched/cls_can.c +++ b/net/sched/cls_can.c @@ -35,9 +35,6 @@ #include #include -#define SFF_BITMAP 1 /* Use bitmap for storing rules - for SFF frames? */ - /* Definition of Netlink message parts */ enum { TCA_CANFLTR_UNSPEC, @@ -60,11 +57,9 @@ struct canfltr_rules { message; Used for sending information to userspace (when 'tc filter show' is invoked) AND when matching EFF frames*/ -#ifdef SFF_BITMAP DECLARE_BITMAP(match_sff, (1 << CAN_SFF_ID_BITS)); /* For each SFF CAN ID (11 bit) there is one record in this bitfield */ -#endif int rules_count; int eff_rules_count; int sff_rules_count; @@ -93,7 +88,6 @@ struct canfltr_state { static void canfltr_sff_match_add(struct canfltr_rules *rls, u32 can_id, u32 can_mask) { -#ifdef SFF_BITMAP int i; /* Limit can_mask and can_id to SFF range to @@ -120,7 +114,6 @@ static void canfltr_sff_match_add(struct canfltr_rules *rls, if ((i & can_mask) == can_id) set_bit(i, rls->match_sff); } -#endif } /** @@ -174,20 +167,9 @@ static int canfltr_classify(struct sk_buff *skb, const struct tcf_proto *tp, break; } } - } else { + } else { /* SFF */ can_id &= CAN_SFF_MASK; -#ifdef SFF_BITMAP match = test_bit(can_id, r->match_sff); -#else - for (i = r->eff_rules_count; - i < r->eff_rules_count + r->sff_rules_count; i++) { - if (!(((r->rules_raw[i].can_id ^ can_id) & - r->rules_raw[i].can_mask) & CAN_SFF_MASK)) { - match = true; - break; - } - } -#endif } if (match) { @@ -568,11 +550,6 @@ static struct tcf_proto_ops cls_canfltr_ops __read_mostly = { static int __init init_canfltr(void) { pr_debug("canfltr: CAN filter loaded\n"); -#ifdef SFF_BITMAP - pr_debug("canfltr: SFF rules stored in bitmap\n"); -#else - pr_debug("canfltr: SFF rules stored in array\n"); -#endif return register_tcf_proto_ops(&cls_canfltr_ops); } -- 2.39.2