From: Jan Kiszka <jan.kiszka@domain.hid>
To: Wolfgang Grandegger <wg@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] Re: Extended CAN frame filtering
Date: Sat, 17 Feb 2007 19:54:40 +0100 [thread overview]
Message-ID: <45D74F70.2090200@domain.hid> (raw)
In-Reply-To: <45D7475E.1030504@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
Wolfgang Grandegger wrote:
>>> Index: ksrc/drivers/can/rtcan_raw_filter.c
>>> ===================================================================
>>> --- ksrc/drivers/can/rtcan_raw_filter.c (revision 2193)
>>> +++ ksrc/drivers/can/rtcan_raw_filter.c (working copy)
>>> @@ -55,13 +55,13 @@ void rtcan_raw_print_filter(struct rtcan
>>> static inline void rtcan_raw_mount_filter(can_filter_t *recv_filter,
>>> can_filter_t *filter)
>>> {
>>> - if (filter->can_id & CAN_EFF_FLAG)
>>> - recv_filter->can_mask = ((filter->can_mask & CAN_EFF_MASK) |
>>> - CAN_EFF_FLAG);
>>> - else
>>> - recv_filter->can_mask = (filter->can_mask & CAN_SFF_MASK);
>>> -
>>> - recv_filter->can_id = filter->can_id & recv_filter->can_mask;
>>> + if (filter->can_id & CAN_INV_FILTER) {
>>> + recv_filter->can_id = filter->can_id & ~CAN_INV_FILTER;
>>> + recv_filter->can_mask = filter->can_mask | CAN_INV_FILTER;
>>> + } else {
>>> + recv_filter->can_id = filter->can_id;
>>> + recv_filter->can_mask = filter->can_mask & ~CAN_INV_FILTER;
>>> + }
>>
>> Why do you push CAN_INV_FILTER internally into the mask instead of
>> keeping it in the filter's ID - as the pseudo code above states?
>
> To simplify the filter calculation. It actually avoids the expression
> (filter->can_id & ~CAN_INV_FILTER). As this is in a very frequently
> called function, I think it's worth the trick.
>
Ack. I missed that point on first run.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2007-02-17 18:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-14 16:28 [Xenomai-core] Extended CAN frame filtering Jan Kiszka
2007-02-15 8:34 ` [Xenomai-core] " Wolfgang Grandegger
2007-02-16 12:37 ` Wolfgang Grandegger
2007-02-17 14:31 ` Wolfgang Grandegger
2007-02-17 17:55 ` Jan Kiszka
2007-02-17 18:20 ` Wolfgang Grandegger
2007-02-17 18:54 ` Jan Kiszka [this message]
2007-02-17 20:49 ` Wolfgang Grandegger
2007-02-18 18:18 ` Jan Kiszka
2007-02-18 19:49 ` Wolfgang Grandegger
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=45D74F70.2090200@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=wg@domain.hid \
--cc=xenomai@xenomai.org \
/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.