From 1f7984972234a61c47da2ee71fd3adb037cfe1b8 Mon Sep 17 00:00:00 2001 From: Rostislav Lisovy Date: Mon, 23 Jan 2012 13:01:09 +0100 Subject: [PATCH] cls_can: Simplified matching condition expression. --- net/sched/cls_can.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/sched/cls_can.c b/net/sched/cls_can.c index 2c2b58972b1..34f00c06ec1 100644 --- a/net/sched/cls_can.c +++ b/net/sched/cls_can.c @@ -173,9 +173,8 @@ static int canfltr_classify(struct sk_buff *skb, struct tcf_proto *tp, can_id &= CAN_EFF_MASK; for (i = 0; i < r->eff_rules_count; i++) { - /* XXX: Why aren't these & performed "off-line"? */ - if ((r->rules_raw[i].can_id & r->rules_raw[i].can_mask & CAN_EFF_MASK) == - (can_id & r->rules_raw[i].can_mask & CAN_EFF_MASK)) { + if (!(((r->rules_raw[i].can_id ^ can_id) & + r->rules_raw[i].can_mask) & CAN_EFF_MASK)) { match = true; break; } @@ -185,9 +184,10 @@ static int canfltr_classify(struct sk_buff *skb, struct tcf_proto *tp, #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 & r->rules_raw[i].can_mask & CAN_SFF_MASK) == /* XXX: dtto */ - (can_id & r->rules_raw[i].can_mask & CAN_SFF_MASK)) { + 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; } -- 2.39.2