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,
AFAIK this function is usually called in the TX interrupt ... and therefore
strictly from interrupt context.
In general one should avoid in_interrupt() checks at runtime. 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 ;-)
Regards,
Oliver
> ---
> drivers/net/can/dev.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index d0f8c7e..61f28ff 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -322,7 +322,11 @@ void can_get_echo_skb(struct net_device *dev, unsigned
> int idx)
> BUG_ON(idx >= priv->echo_skb_max);
>
> if (priv->echo_skb[idx]) {
> - netif_rx(priv->echo_skb[idx]);
> + if (in_interrupt())
> + netif_rx(priv->echo_skb[idx]);
> + else
> + netif_rx_ni(priv->echo_skb[idx]);
> +
> priv->echo_skb[idx] = NULL;
> }
> }
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core