aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/via-velocity.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2008-07-10 18:05:57 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-11 01:10:15 -0400
commit9088d9a4267ff098d5edc3dad8359c92741b7a6a (patch)
tree8850458860658b16d3f52b8115e0af8c4eec7d6e /drivers/net/via-velocity.c
parent28133176082d9bcafb5958b8fac80943e51d5eda (diff)
via-velocity: add velocity_set_rxbufsize helper
It removes a dependancy from velocity_init_rd_ring to dev->mtu. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/via-velocity.c')
-rw-r--r--drivers/net/via-velocity.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 086d69c19920..370ce30f2f45 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1207,6 +1207,11 @@ static int velocity_rx_refill(struct velocity_info *vptr)
1207 return done; 1207 return done;
1208} 1208}
1209 1209
1210static void velocity_set_rxbufsize(struct velocity_info *vptr, int mtu)
1211{
1212 vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
1213}
1214
1210/** 1215/**
1211 * velocity_init_rd_ring - set up receive ring 1216 * velocity_init_rd_ring - set up receive ring
1212 * @vptr: velocity to configure 1217 * @vptr: velocity to configure
@@ -1217,11 +1222,8 @@ static int velocity_rx_refill(struct velocity_info *vptr)
1217 1222
1218static int velocity_init_rd_ring(struct velocity_info *vptr) 1223static int velocity_init_rd_ring(struct velocity_info *vptr)
1219{ 1224{
1220 int mtu = vptr->dev->mtu;
1221 int ret = -ENOMEM; 1225 int ret = -ENOMEM;
1222 1226
1223 vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
1224
1225 vptr->rd_info = kcalloc(vptr->options.numrx, 1227 vptr->rd_info = kcalloc(vptr->options.numrx,
1226 sizeof(struct velocity_rd_info), GFP_KERNEL); 1228 sizeof(struct velocity_rd_info), GFP_KERNEL);
1227 if (!vptr->rd_info) 1229 if (!vptr->rd_info)
@@ -1860,6 +1862,8 @@ static int velocity_open(struct net_device *dev)
1860 struct velocity_info *vptr = netdev_priv(dev); 1862 struct velocity_info *vptr = netdev_priv(dev);
1861 int ret; 1863 int ret;
1862 1864
1865 velocity_set_rxbufsize(vptr, dev->mtu);
1866
1863 ret = velocity_init_rings(vptr); 1867 ret = velocity_init_rings(vptr);
1864 if (ret < 0) 1868 if (ret < 0)
1865 goto out; 1869 goto out;
@@ -1941,6 +1945,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
1941 1945
1942 dev->mtu = new_mtu; 1946 dev->mtu = new_mtu;
1943 1947
1948 velocity_set_rxbufsize(vptr, new_mtu);
1949
1944 ret = velocity_init_rd_ring(vptr); 1950 ret = velocity_init_rd_ring(vptr);
1945 if (ret < 0) 1951 if (ret < 0)
1946 goto out_unlock; 1952 goto out_unlock;