On 05/16/2011 05:41 PM, Oliver Hartkopp wrote:
> On 15.05.2011 17:36, Stefano Babic wrote:
>> The patch checks the context when can_get_echo_skb() and
>> calls netif_rx_ni instead of netif_rx in process context.
>>
>> Signed-off-by: Stefano Babic <[email protected]>
> 
> Hello Stephano,

Hi Oliver,

> 
> AFAIK this function is usually called in the TX interrupt ... and therefore
> strictly from interrupt context.

I know, and I understand that checking runtime if the function is called
in an interrupt context introduce an additional latency, that is
unwanted and unneeded in most cases / drivers

However, my system consists of an ARM processor (IMX) that talks via SPI
to a 16-bit microcontroller, able to drive 5 CAN bus (a Freescale
HCS12). On the ARM side, the TX is called as part of the Linux spi
framework, that is in a kernel thread, as this is the SPI API under Linux.

> In general one should avoid in_interrupt() checks at runtime.

Agree.

> As
> can_get_echo_skb() is pretty short, i would tend to introduce a new function
> called can_get_echo_skb_ni() so that it can be distinguished in the CAN
> drivers source code. But only if really needed ;-)

Well, in my case I have probably no other chance, as the TX part must
call spi_(a)sync. I will prepare the patch as you suggest and I will
post to the ML, and maybe there is someone else with a similar set up.

Best regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
=====================================================================
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to