diff options
-rw-r--r-- | drivers/net/can/dev.c | 18 | ||||
-rw-r--r-- | include/linux/can/dev.h | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 1d29082d94ac..f0b9a1e1db46 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -315,7 +315,7 @@ void can_get_echo_skb(struct net_device *dev, int idx) | |||
315 | { | 315 | { |
316 | struct can_priv *priv = netdev_priv(dev); | 316 | struct can_priv *priv = netdev_priv(dev); |
317 | 317 | ||
318 | if ((dev->flags & IFF_ECHO) && priv->echo_skb[idx]) { | 318 | if (priv->echo_skb[idx]) { |
319 | netif_rx(priv->echo_skb[idx]); | 319 | netif_rx(priv->echo_skb[idx]); |
320 | priv->echo_skb[idx] = NULL; | 320 | priv->echo_skb[idx] = NULL; |
321 | } | 321 | } |
@@ -323,6 +323,22 @@ void can_get_echo_skb(struct net_device *dev, int idx) | |||
323 | EXPORT_SYMBOL_GPL(can_get_echo_skb); | 323 | EXPORT_SYMBOL_GPL(can_get_echo_skb); |
324 | 324 | ||
325 | /* | 325 | /* |
326 | * Remove the skb from the stack and free it. | ||
327 | * | ||
328 | * The function is typically called when TX failed. | ||
329 | */ | ||
330 | void can_free_echo_skb(struct net_device *dev, int idx) | ||
331 | { | ||
332 | struct can_priv *priv = netdev_priv(dev); | ||
333 | |||
334 | if (priv->echo_skb[idx]) { | ||
335 | kfree_skb(priv->echo_skb[idx]); | ||
336 | priv->echo_skb[idx] = NULL; | ||
337 | } | ||
338 | } | ||
339 | EXPORT_SYMBOL_GPL(can_free_echo_skb); | ||
340 | |||
341 | /* | ||
326 | * CAN device restart for bus-off recovery | 342 | * CAN device restart for bus-off recovery |
327 | */ | 343 | */ |
328 | void can_restart(unsigned long data) | 344 | void can_restart(unsigned long data) |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 4a37a56f6cdd..5824b20b5fcb 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
@@ -66,5 +66,6 @@ void can_bus_off(struct net_device *dev); | |||
66 | 66 | ||
67 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx); | 67 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx); |
68 | void can_get_echo_skb(struct net_device *dev, int idx); | 68 | void can_get_echo_skb(struct net_device *dev, int idx); |
69 | void can_free_echo_skb(struct net_device *dev, int idx); | ||
69 | 70 | ||
70 | #endif /* CAN_DEV_H */ | 71 | #endif /* CAN_DEV_H */ |