Skip to contentSkip to conversation

can: add can_free_echo_skb() for upcoming drivers

PATCH In review Wolfgang Grandegger 4 participants 6 messages Sep 1, 2009 – Sep 4, 2009 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/can/dev.c   |   18 +++++++++++++++++-
 include/linux/can/dev.h |    1 +
 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/net/can/dev.c +17 -1
Index: net-next-2.6/drivers/net/can/dev.c
===================================================================
@@ -315,7 +315,7 @@ void can_get_echo_skb(struct net_device 
 {
 	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 
 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)
include/linux/can/dev.h +1 -0
Index: net-next-2.6/include/linux/can/dev.h
===================================================================
@@ -66,5 +66,6 @@ void can_bus_off(struct net_device *dev)
 
 void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
 void can_get_echo_skb(struct net_device *dev, int idx);
+void can_free_echo_skb(struct net_device *dev, int idx);
 
 #endif /* CAN_DEV_H */
maintainer
#1 lore raw

Can a CAN expert please review these patches? They are rotting in patchwork and I want to move forward with them somehow.

Thanks.

#3 lore raw
In reply to a message not in the archive
Quoted 2 lines · David Miller

Can a CAN expert please review these patches? They are rotting in patchwork and I want to move forward with them somehow.

Hello Dave,

Wolfgang *is* the CAN expert for CAN drivers :-)

We've split the things up:

CAN network layer: Oliver Hartkopp / Urs Thuermann CAN network drivers: Wolfgang Grandegger

As written in MAINTAINERS:

CAN NETWORK DRIVERS

M:      Wolfgang Grandegger <[email protected]>
L:      [email protected] (subscribers-only)
W:      http://developer.berlios.de/projects/socketcan/
S:      Maintained

Btw. All three patches sitting in patchwork are ok from my side and i've personally reviewed them. I thought that Wolfgang was already known to maintain this stuff, so i did not put my Acked-by ...

Best regards,
Oliver

#4 lore raw
In reply to a message not in the archive

Hello Dave,

Quoted 2 lines · David Miller

Can a CAN expert please review these patches? They are rotting in patchwork and I want to move forward with them somehow.I'

I'm maintaining the CAN device drivers interface and drivers as listed in MAINTAINERS. Though, these patches have already the official blessing.

Do you want me to setup a git repository "can-next-2.6" where you can pull from? So far, not that much can-drv patches have been posted to this list.

Wolfgang.

maintainer
#5 lore raw

From: Wolfgang Grandegger <[email protected]>
Date: Fri, 04 Sep 2009 09:49:38 +0200

Quoted 6 lines
Quoted 2 lines · David Miller

Can a CAN expert please review these patches? They are rotting in patchwork and I want to move forward with them somehow.I'

I'm maintaining the CAN device drivers interface and drivers as listed in MAINTAINERS. Though, these patches have already the official blessing.

My bad :-) I'll apply these then.

Quoted 3 lines

Do you want me to setup a git repository "can-next-2.6" where you can pull from? So far, not that much can-drv patches have been posted to this list.

You can do that in the future if you like, sure. But it is not a requirement, as with the rate you guys send things I am handling it efficiently using patchwork.

#7 lore raw
In reply to a message not in the archive
Quoted 12 lines · David Miller

From: Wolfgang Grandegger<[email protected]>
Date: Fri, 04 Sep 2009 09:49:38 +0200

Quoted 6 lines
Quoted 2 lines · David Miller

Can a CAN expert please review these patches? They are rotting in patchwork and I want to move forward with them somehow.I'

I'm maintaining the CAN device drivers interface and drivers as listed in MAINTAINERS. Though, these patches have already the official blessing.

My bad :-) I'll apply these then.

Quoted 7 lines
Quoted 3 lines

Do you want me to setup a git repository "can-next-2.6" where you can pull from? So far, not that much can-drv patches have been posted to this list.

You can do that in the future if you like, sure. But it is not a requirement, as with the rate you guys send things I am handling it efficiently using patchwork.

OK, then I will continue sending patches for the time being. Please let me know when a git repository would ease your work.

Thanks,

Wolfgang.