From: Michal Sojka Date: Wed, 17 Aug 2011 11:57:49 +0000 (+0200) Subject: Add notes and coding style fixes X-Git-Url: https://rtime.felk.cvut.cz/gitweb/lisovros/linux_canprio.git/commitdiff_plain/7721a3a5a1ae4ec27f8d65edb8cd6d1f17ddc087?hp=6e6f16e8049ff210847de9df4d19211a57b93886 Add notes and coding style fixes --- diff --git a/net/sched/cls_canprio.c b/net/sched/cls_canprio.c index 2f19fb94295..2d3b4a27e85 100644 --- a/net/sched/cls_canprio.c +++ b/net/sched/cls_canprio.c @@ -45,7 +45,7 @@ enum { static const struct nla_policy canprio_policy[TCA_CANPRIO_MAX + 1] = { [TCA_CANPRIO_CLASSID] = { .type = NLA_U32 }, //FIXME Be aware of possible problems with 64bit kernel and 32bit userspace etc. - [TCA_CANPRIO_RULES] = { .len = sizeof(canprio_rules) }, + [TCA_CANPRIO_RULES] = { .len = sizeof(canprio_rules) }, /* FIXME */ [TCA_CANPRIO_INV_EN] = { .type = NLA_U32 }, }; @@ -153,7 +153,7 @@ static int canprio_classify(struct sk_buff *skb, struct tcf_proto *tp, canid = canprio_get_id(skb); list_for_each_entry(f, &head->flist, link) { - int match = 0; + bool match = false; printk(" canprio_classify() can ID of received frame = 0x%x\n", canid); if (canid & CAN_EFF_FLAG) { @@ -163,17 +163,15 @@ static int canprio_classify(struct sk_buff *skb, struct tcf_proto *tp, rcu_read_lock(); hlist_for_each_entry_rcu(effi, next, &f->match_eff, list) { - if((effi->canid ^ canid) & effi->mask) { - match = 1; + if ((effi->canid ^ canid) & effi->mask) { + match = true; break; } } rcu_read_unlock(); } else { - if(test_bit(canid, f->match_sff)) { - match = 1; - } + match = test_bit(canid, f->match_sff); } if (f->inv_match_en) @@ -322,6 +320,9 @@ static int canprio_change(struct tcf_proto *tp, unsigned long base, u32 handle, printk(" rules_count = %u\n", canprio_rules_count); for (i = 0; i < canprio_rules_count; i++) { + /* FIXME: shouldn't use here the same logic as in + * can_rcv_filter() to filter for various combination + * of flags (EFF, RTR) */ if (canprio_rules[i].canid & CAN_EFF_FLAG) { err = eff_match_add(f, canprio_rules[i].canid, canprio_rules[i].canid_mask); if (err < 0) @@ -419,6 +420,7 @@ static int canprio_init(struct tcf_proto *tp) return -ENOBUFS; INIT_LIST_HEAD(&head->flist); tp->root = head; + tp->protocol = htons(ETH_P_CAN); /* Work only on AF_CAN packets - not tested! */ return 0; }