summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/dev.c
diff options
context:
space:
mode:
authorWolfgang Grandegger <wg@grandegger.com>2009-09-01 05:26:12 +0000
committerDavid S. Miller <davem@davemloft.net>2009-09-04 02:16:14 -0700
commit39e3ab6fded4d7e66e01a878f0cae23ddd480c3b (patch)
tree44439df4436f965269f8f795cdf048290a202ed7 /drivers/net/can/dev.c
parentfab4e76373a614d3af624caedf18bee43fc6ca16 (diff)
downloadop-kernel-dev-39e3ab6fded4d7e66e01a878f0cae23ddd480c3b.zip
op-kernel-dev-39e3ab6fded4d7e66e01a878f0cae23ddd480c3b.tar.gz
can: add can_free_echo_skb() for upcoming drivers
This patch adds the function can_free_echo_skb to the CAN device interface to allow upcoming drivers to release echo skb's in case of error. Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/dev.c')
-rw-r--r--drivers/net/can/dev.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 1d29082..f0b9a1e 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)
{
struct can_priv *priv = netdev_priv(dev);
- if ((dev->flags & IFF_ECHO) && priv->echo_skb[idx]) {
+ if (priv->echo_skb[idx]) {
netif_rx(priv->echo_skb[idx]);
priv->echo_skb[idx] = NULL;
}
@@ -323,6 +323,22 @@ void can_get_echo_skb(struct net_device *dev, int idx)
EXPORT_SYMBOL_GPL(can_get_echo_skb);
/*
+ * Remove the skb from the stack and free it.
+ *
+ * The function is typically called when TX failed.
+ */
+void can_free_echo_skb(struct net_device *dev, int idx)
+{
+ struct can_priv *priv = netdev_priv(dev);
+
+ if (priv->echo_skb[idx]) {
+ kfree_skb(priv->echo_skb[idx]);
+ priv->echo_skb[idx] = NULL;
+ }
+}
+EXPORT_SYMBOL_GPL(can_free_echo_skb);
+
+/*
* CAN device restart for bus-off recovery
*/
void can_restart(unsigned long data)
OpenPOWER on IntegriCloud