From: Jan Kiszka <jan.kiszka@domain.hid>
To: Wolfgang Grandegger <wg@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PATCH] RT-Socket-CAN, TX loopback and further improvements
Date: Tue, 14 Nov 2006 20:54:28 +0100 [thread overview]
Message-ID: <455A1EF4.4080205@domain.hid> (raw)
In-Reply-To: <455A14C3.60701@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]
Wolfgang Grandegger wrote:
>>> @@ -894,6 +937,12 @@
>>> /* We got access */
>>>
>>>
>>> +#ifdef CONFIG_XENO_DRIVERS_RTCAN_TX_LOOPBACK
>>> + /* Push message onto stack for loopback when TX done */
>>> + if (sock->tx_loopback)
>>> + rtcan_tx_push(dev, sock, frame);
>>> +#endif /* CONFIG_XENO_DRIVERS_RTCAN_TX_LOOPBACK */
>>
>> Hmm, I would prefer to define something like
>>
>> if (rtcan_tx_loopback_enabled(sock))
>> rtcan_tx_push(dev, sock, frame);
>>
>> with rtcan_tx_loopback_enabled resolving to 0 in the configured-out
>> case. Thus some #ifdefs could be moved from the code to central places
>> in header files.
>
> OK, here I can avoid the #ifdef's ...
>
>>> Index: ksrc/drivers/can/mscan/rtcan_mscan.c
>>> ===================================================================
>>> --- ksrc/drivers/can/mscan/rtcan_mscan.c (revision 1834)
>>> +++ ksrc/drivers/can/mscan/rtcan_mscan.c (working copy)
>>> @@ -251,6 +251,21 @@
>>> regs->cantier = 0;
>>> /* Wake up a sender */
>>> rtdm_sem_up(&dev->tx_sem);
>>> +
>>> +#ifdef CONFIG_XENO_DRIVERS_RTCAN_TX_LOOPBACK
>>> + if (dev->tx_socket) {
>>
>> Same here. A macro like rtcan_tx_loopback_pending(dev) would avoid the
>> #ifdef.
>
> ...but not here. Or does the optimizer remove the if block?
AFAIK, all relevant gcc versions kill blocks like
if (0) {
...
}
from the binary. But one problem might appear: the block content must be
compilable in any case...
>> I think the timestamp should rather be passed to rtcan_tc_loopback and
>> set there. Or, if passing that value increases the code size needlessly,
>> rtcan_tx_loopback should be defined like
>>
>> static inline void
>> rtcan_tx_loopback(struct rtcan_device *dev, nanosecs_abs_t timestamp)
>> {
>> <set timestamp>
>> __rtcan_tx_loopback(dev);
>> }
>>
>> where __rtcan_tx_loopback is the uninlined code. That makes the driver
>> code leaner. Locking will hopefully change anyway, so nothing to do on
>> this part for now.
>
> Or do it directly in rtcan_tx_loopback() and rtcan_recv(). Would it be
> OK to read the time in these functions as well or should it be done, as
> is, at the beginning of the ISR? I have already planned some similar
> rewrite when Xenomai 2.3. is out, hopefully together with the new locking.
A few cycles offset of the timestamp doesn't matter here. We should just
avoid reading it more than once as this can be a costly operation on
some systems.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]
next prev parent reply other threads:[~2006-11-14 19:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-14 14:32 [Xenomai-core] [PATCH] RT-Socket-CAN, TX loopback and further improvements Wolfgang Grandegger
2006-11-14 15:00 ` Wolfgang Grandegger
2006-11-14 17:53 ` Jan Kiszka
2006-11-14 19:10 ` Wolfgang Grandegger
2006-11-14 19:54 ` Jan Kiszka [this message]
2006-11-15 7:29 ` Wolfgang Grandegger
2006-11-15 8:00 ` Jan Kiszka
2006-11-15 9:11 ` Wolfgang Grandegger
2006-11-15 7:25 ` Wolfgang Grandegger
2006-11-15 7:56 ` Jan Kiszka
2006-11-15 9:05 ` 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=455A1EF4.4080205@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.