Skip to contentSkip to conversation

net/gianfar: drop recycled skbs on MTU change

PATCH Superseded Sebastian Andrzej Siewior 4 participants 7 messages May 3, 2010 – May 6, 2010

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

PATCH 1/1 net/gianfar: drop recycled skbs on MTU change

From: Sebastian Andrzej Siewior <[email protected]>

The size for skb which is added to the recycled list is using the current descriptor size which is current MTU. gfar_new_skb() is also using this size. So after changing or alteast increasing the MTU all recycled skbs should be dropped.

---
I'm not 100% sure but it looks like it is wrong.

 drivers/net/gianfar.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/gianfar.c +3 -1
index 5267c27..9093106 100644
@@ -2287,8 +2287,10 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
 
 	/* Only stop and start the controller if it isn't already
 	 * stopped, and we changed something */
-	if ((oldsize != tempsize) && (dev->flags & IFF_UP))
+	if ((oldsize != tempsize) && (dev->flags & IFF_UP)) {
 		stop_gfar(dev);
+		skb_queue_purge(&priv->rx_recycle);
+	}
 
 	priv->rx_buffer_size = tempsize;
 
Signature · 1 line
1.6.6.1
maintainer
#1 lore raw

From: Sebastian Andrzej Siewior <[email protected]>
Date: Mon, 3 May 2010 17:17:45 +0200

Quoted 10 lines

From: Sebastian Andrzej Siewior <[email protected]>

The size for skb which is added to the recycled list is using the current descriptor size which is current MTU. gfar_new_skb() is also using this size. So after changing or alteast increasing the MTU all recycled skbs should be dropped.

---
I'm not 100% sure but it looks like it is wrong.

It looks right to me, can I get an ACK from gianfar developers?

#2 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 19 lines · Sebastian Andrzej Siewior

From: Sebastian Andrzej Siewior <[email protected]>

The size for skb which is added to the recycled list is using the current descriptor size which is current MTU. gfar_new_skb() is also using this size. So after changing or alteast increasing the MTU all recycled skbs should be dropped.

---
I'm not 100% sure but it looks like it is wrong.

 drivers/net/gianfar.c |    4 +++-

 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/gianfar.c +0 -0
index 5267c27..9093106 100644

drivers/net/gianfar.c static int gfar_change_mtu(struct net_device *dev, int new_mtu) · line 2293

Quoted 8 lines
drivers/net/gianfar.c +3 -1
@@ -2287,8 +2287,10 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
 
        /* Only stop and start the controller if it isn't already
         * stopped, and we changed something */
-       if ((oldsize != tempsize) && (dev->flags & IFF_UP))
+       if ((oldsize != tempsize) && (dev->flags & IFF_UP)) {
                stop_gfar(dev);
+               skb_queue_purge(&priv->rx_recycle);
+       }

I think we should probably do this in free_skb_resources. And remove the call from gfar_close().

Andy

maintainer
#3 lore raw

From: Andy Fleming <[email protected]>
Date: Tue, 4 May 2010 08:29:06 -0700

Quoted 22 lines
Quoted 20 lines · Sebastian Andrzej Siewior

From: Sebastian Andrzej Siewior <[email protected]>

The size for skb which is added to the recycled list is using the current descriptor size which is current MTU. gfar_new_skb() is also using this size. So after changing or alteast increasing the MTU all recycled skbs should be dropped.

---
I'm not 100% sure but it looks like it is wrong.

 drivers/net/gianfar.c |    4 +++-

 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/gianfar.c +0 -0
index 5267c27..9093106 100644
@@ -2287,8 +2287,10 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
 
Quoted 11 lines

drivers/net/gianfar.c static int gfar_change_mtu(struct net_device *dev, int new_mtu) · line 2293

Quoted 7 lines
drivers/net/gianfar.c +3 -1
        /* Only stop and start the controller if it isn't already
         * stopped, and we changed something */
-       if ((oldsize != tempsize) && (dev->flags & IFF_UP))
+       if ((oldsize != tempsize) && (dev->flags & IFF_UP)) {
                stop_gfar(dev);
+               skb_queue_purge(&priv->rx_recycle);
+       }

I think we should probably do this in free_skb_resources. And remove the call from gfar_close().

Ok, Sebastian please rework your patch as requested by Andy.

Thanks.

#4 lore raw

PATCH v2 1/1 net/gianfar: drop recycled skbs on MTU change

From: Sebastian Andrzej Siewior <[email protected]>

The size for skbs which is added to the recycled list is using the current descriptor size which is current MTU. gfar_new_skb() is also using this size. So after changing or alteast increasing the MTU all recycled skbs should be dropped.

---

Quoted 4 lines
Quoted 2 lines

I think we should probably do this in free_skb_resources. And remove the call from gfar_close().

Ok, Sebastian please rework your patch as requested by Andy.

This has the side effect of dropping them on reset which is not required.

 drivers/net/gianfar.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/gianfar.c +1 -1
index 4e97ca1..5d3763f 100644
@@ -1649,6 +1649,7 @@ static void free_skb_resources(struct gfar_private *priv)
 			sizeof(struct rxbd8) * priv->total_rx_ring_size,
 			priv->tx_queue[0]->tx_bd_base,
 			priv->tx_queue[0]->tx_bd_dma_base);
+	skb_queue_purge(&priv->rx_recycle);
 }
 
 void gfar_start(struct net_device *dev)
@@ -2088,7 +2089,6 @@ static int gfar_close(struct net_device *dev)
 
 	disable_napi(priv);
 
-	skb_queue_purge(&priv->rx_recycle);
 	cancel_work_sync(&priv->reset_task);
 	stop_gfar(dev);
 
Signature · 1 line
1.6.6.1
Acked-by on v2 1/1
#5 lore raw
Quoted 8 lines · Sebastian Andrzej Siewior

From: Sebastian Andrzej Siewior <[email protected]>

The size for skbs which is added to the recycled list is using the current descriptor size which is current MTU. gfar_new_skb() is also using this size. So after changing or alteast increasing the MTU all recycled skbs should be dropped.

Quoted 8 lines

---

Quoted 4 lines
Quoted 2 lines

I think we should probably do this in free_skb_resources. And remove the call from gfar_close().

Ok, Sebastian please rework your patch as requested by Andy.

This has the side effect of dropping them on reset which is not required.

Sure, but that's true of the buffers in the BD ring, too. My theory, here, is just that it's best to treat it the same as the other "skb resources". If we want to avoid reallocation during a reset, that's a separate patch. :)

maintainer Applied
#6 lore raw

From: Andy Fleming <[email protected]>
Date: Wed, 5 May 2010 10:18:40 -0500

Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 9 lines

From: Sebastian Andrzej Siewior <[email protected]>

The size for skbs which is added to the recycled list is using the current descriptor size which is current MTU. gfar_new_skb() is also using this size. So after changing or alteast increasing the MTU all recycled skbs should be dropped.

...

Quoted 1 line

Applied, thanks everyone.