summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2008-07-11 00:05:57 +0200
committerJeff Garzik <jgarzik@redhat.com>2008-07-11 01:10:15 -0400
commit9088d9a4267ff098d5edc3dad8359c92741b7a6a (patch)
tree8850458860658b16d3f52b8115e0af8c4eec7d6e
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>
-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)
return done;
}
+static void velocity_set_rxbufsize(struct velocity_info *vptr, int mtu)
+{
+ vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
+}
+
/**
* velocity_init_rd_ring - set up receive ring
* @vptr: velocity to configure
@@ -1217,11 +1222,8 @@ static int velocity_rx_refill(struct velocity_info *vptr)
static int velocity_init_rd_ring(struct velocity_info *vptr)
{
- int mtu = vptr->dev->mtu;
int ret = -ENOMEM;
- vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
-
vptr->rd_info = kcalloc(vptr->options.numrx,
sizeof(struct velocity_rd_info), GFP_KERNEL);
if (!vptr->rd_info)
@@ -1860,6 +1862,8 @@ static int velocity_open(struct net_device *dev)
struct velocity_info *vptr = netdev_priv(dev);
int ret;
+ velocity_set_rxbufsize(vptr, dev->mtu);
+
ret = velocity_init_rings(vptr);
if (ret < 0)
goto out;
@@ -1941,6 +1945,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
dev->mtu = new_mtu;
+ velocity_set_rxbufsize(vptr, new_mtu);
+
ret = velocity_init_rd_ring(vptr);
if (ret < 0)
goto out_unlock;