From: Rostislav Lisovy <lisovy@gmail.com>
To: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
netdev@vger.kernel.org, linux-can@vger.kernel.org,
lartc@vger.kernel.org, pisa@cmp.felk.cvut.cz,
sojkam1@fel.cvut.cz
Subject: Re: [PATCH net-next] em_canid: Ematch rule to match CAN frames according to their CAN IDs
Date: Thu, 28 Jun 2012 15:35:22 +0200 [thread overview]
Message-ID: <1340890522.6032.22.camel@lolumad> (raw)
In-Reply-To: <4FEA169C.1070709@hartkopp.net>
Hello Oliver;
On Tue, 2012-06-26 at 22:07 +0200, Oliver Hartkopp wrote:
> I found some time for a review. See details inline ...
>
I agree with quite everything except for following...
> > + match = true;
>
>
> match = 1;
>
egrep -r "= true;" ./linux-source | wc -l
returns 6770 -- why don't you like "= true"?
> > + break;
> > + }
> > + }
> > + } else { /* SFF */
> > + can_id &= CAN_SFF_MASK;
> > + match = test_bit(can_id, cm->match_sff);
> > + }
> > +
>
>
> return match;
>
match() function must return 1 or 0, however (from my experience)
test_bit() returns 0 and non-0 (strictly speaking, in my case, 0 and
-1).
> > + &conf[i],
> > + sizeof(struct can_filter));
> > +
> > + cm->eff_rules_count++;
> > + } else {
> > + continue;
> > + }
>
>
> omit { } around continue
>
http://lxr.linux.no/#linux+v3.4.4/Documentation/CodingStyle#L169
> > + }
> > +
> > + /* Process SFF frame rules */
> > + for (i = 0; i < cm->rules_count; i++) {
> > + if ((conf[i].can_id & CAN_EFF_FLAG) &&
> > + (conf[i].can_mask & CAN_EFF_FLAG)) {
>
>
> What if CAN_EFF_FLAG is set in can_id but not in can_mask ?
>
There were small misunderstanding from my side -- this will be rewritten
in the way that EFF_FLAG in mask will determine if we care about the
value of EFF_FLAG in an identifier -- i.e. when EFF_FLAG is set in the
mask, the rule will be added as SFF or EFF only depending on EFF_FLAG
value in the identifier. If EFF_FLAG is 0 in the mask, the rule will be
added as both SFF and EFF.
Regards;
Rostislav
next prev parent reply other threads:[~2012-06-28 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 12:22 [PATCH net-next] em_canid: Ematch rule to match CAN frames according to their CAN IDs Rostislav Lisovy
2012-06-26 20:07 ` Oliver Hartkopp
2012-06-26 21:32 ` Thomas Graf
2012-06-27 9:33 ` Kurt Van Dijck
2012-06-28 15:35 ` Rostislav Lisovy
2012-06-28 13:35 ` Rostislav Lisovy [this message]
2012-06-28 16:35 ` Oliver Hartkopp
2012-06-28 17:02 ` Rostislav Lisovy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340890522.6032.22.camel@lolumad \
--to=lisovy@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=lartc@vger.kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pisa@cmp.felk.cvut.cz \
--cc=socketcan@hartkopp.net \
--cc=sojkam1@fel.cvut.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.