Drivers that do not have TX inside an interrupt handler must call this function that replaces netif_rx with netif_rx_ni.
Signed-off-by: Stefano Babic <[email protected]> --- drivers/net/can/dev.c | 13 +++++++++++++ include/linux/can/dev.h | 1 + 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index d0f8c7e..e3e6101 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -328,6 +328,19 @@ void can_get_echo_skb(struct net_device *dev, unsigned int idx) } EXPORT_SYMBOL_GPL(can_get_echo_skb); +void can_get_echo_skb_ni(struct net_device *dev, unsigned int idx) +{ + struct can_priv *priv = netdev_priv(dev); + + BUG_ON(idx >= priv->echo_skb_max); + + if (priv->echo_skb[idx]) { + netif_rx_ni(priv->echo_skb[idx]); + priv->echo_skb[idx] = NULL; + } +} +EXPORT_SYMBOL_GPL(can_get_echo_skb_ni); + /* * Remove the skb from the stack and free it. * diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index cc0bb49..5b99f78 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -94,6 +94,7 @@ void can_bus_off(struct net_device *dev); void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, unsigned int idx); void can_get_echo_skb(struct net_device *dev, unsigned int idx); +void can_get_echo_skb_ni(struct net_device *dev, unsigned int idx); void can_free_echo_skb(struct net_device *dev, unsigned int idx); struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); -- 1.7.1 _______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
