]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
cls_can: Storing SFF rules in bitmap only.
authorRostislav Lisovy <lisovy@gmail.com>
Wed, 23 May 2012 10:35:55 +0000 (12:35 +0200)
committerRostislav Lisovy <lisovy@gmail.com>
Wed, 23 May 2012 10:35:55 +0000 (12:35 +0200)
net/sched/cls_can.c

index cf34eb56b8de7d9da26403824df726d8eb6dcd9a..0f64fb00227bc767602bfa3361cecb8d7206491b 100644 (file)
@@ -35,9 +35,6 @@
 #include <linux/rcupdate.h>
 #include <linux/can.h>
 
-#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);
 }