{11/17} - via-velocity-dont-oops-on-mtu-change-2 - series for stable kernel #2
mainline: 48f6b053613b62fed7a2fe3255e5568260a8d615
Signature · 2 lines
Thanks, Oliver
Date: Wed, 28 Nov 2007 22:20:16 +0000 (-0800)
Subject: via-velocity: don't oops on MTU change (resend)
Patch-mainline: v2.6.24-rc4
References: 341537
via-velocity: don't oops on MTU change (resend)
The VIA veloicty driver needs the following to allow changing MTU when down. The buffer size needs to be computed when device is brought up, not when device is initialized. This also fixes a bug where the buffer size was computed differently on change_mtu versus initial setting.
--- drivers/net/via-velocity.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/via-velocity.c +3 -8
@@ -1075,6 +1075,9 @@ static int velocity_init_rd_ring(structint ret = -ENOMEM ;unsigned int rsize =sizeof (struct velocity_rd_info ) * vptr->options.numrx; +int mtu = vptr->dev->mtu; + + vptr->rx_buf_sz = (mtu <=ETH_DATA_LEN ) ?PKT_BUF_SZ : mtu +32 ; vptr->rd_info =kmalloc (rsize,GFP_KERNEL );if (vptr->rd_info ==NULL )
@@ -1733,8 +1736,6 @@ static int velocity_open(struct net_devistruct velocity_info *vptr =netdev_priv (dev);int ret; - vptr->rx_buf_sz = (dev->mtu <=1504 ?PKT_BUF_SZ : dev->mtu +32 ); - ret =velocity_init_rings (vptr);if (ret <0 ) goto out;
@@ -1813,12 +1814,6 @@ static int velocity_change_mtu(struct nevelocity_free_rd_ring (vptr); dev->mtu = new_mtu; -if (new_mtu >8192 ) - vptr->rx_buf_sz =9 *1024 ; -else if (new_mtu >4096 ) - vptr->rx_buf_sz =8192 ; -else - vptr->rx_buf_sz =4 *1024 ; ret =velocity_init_rd_ring (vptr);if (ret <0 )
Oliver Pinter
Acked-by Jeff MahoneyFrom: Stephen Hemminger <[email protected]>
Date: Wed, 28 Nov 2007 22:20:16 +0000 (-0800)
Subject: via-velocity: don't oops on MTU change (resend)
Patch-mainline: v2.6.24-rc4
References: 341537
via-velocity: don't oops on MTU change (resend)
The VIA veloicty driver needs the following to allow changing MTU when down. The buffer size needs to be computed when device is brought up, not when device is initialized. This also fixes a bug where the buffer size was computed differently on change_mtu versus initial setting.
--- drivers/net/via-velocity.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/via-velocity.c +3 -8
@@ -1075,6 +1075,9 @@ static int velocity_init_rd_ring(structint ret = -ENOMEM ;unsigned int rsize =sizeof (struct velocity_rd_info ) * vptr->options.numrx; +int mtu = vptr->dev->mtu; + + vptr->rx_buf_sz = (mtu <=ETH_DATA_LEN ) ?PKT_BUF_SZ : mtu +32 ; vptr->rd_info =kmalloc (rsize,GFP_KERNEL );if (vptr->rd_info ==NULL )
@@ -1733,8 +1736,6 @@ static int velocity_open(struct net_devistruct velocity_info *vptr =netdev_priv (dev);int ret; - vptr->rx_buf_sz = (dev->mtu <=1504 ?PKT_BUF_SZ : dev->mtu +32 ); - ret =velocity_init_rings (vptr);if (ret <0 ) goto out;
@@ -1813,12 +1814,6 @@ static int velocity_change_mtu(struct nevelocity_free_rd_ring (vptr); dev->mtu = new_mtu; -if (new_mtu >8192 ) - vptr->rx_buf_sz =9 *1024 ; -else if (new_mtu >4096 ) - vptr->rx_buf_sz =8192 ; -else - vptr->rx_buf_sz =4 *1024 ; ret =velocity_init_rd_ring (vptr);if (ret <0 )
Quoted 7 lines · Oliver Pinter (Pintér Olivér)
mainline:
48f6b053613b62fed7a2fe3255e5568260a8d615--
Thanks,
Oliver
Signature · 2 lines
Thanks, Oliver