]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/via-velocity.c
typhoon: trivial endianness annotations
[linux-2.6-omap-h63xx.git] / drivers / net / via-velocity.c
index 4ae05799ac447b571412990d6fd9c7f2bdfc2ac2..35cd65d6b9edcdad5080e31ba52cc56b77b6b777 100644 (file)
@@ -1242,6 +1242,9 @@ static int velocity_rx_refill(struct velocity_info *vptr)
 static int velocity_init_rd_ring(struct velocity_info *vptr)
 {
        int ret;
+       int mtu = vptr->dev->mtu;
+
+       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);
@@ -1648,7 +1651,7 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
  *
  *     Scan the queues looking for transmitted packets that
  *     we can complete and clean up. Update any statistics as
- *     neccessary/
+ *     necessary/
  */
 
 static int velocity_tx_srv(struct velocity_info *vptr, u32 status)
@@ -1898,8 +1901,6 @@ static int velocity_open(struct net_device *dev)
        struct 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;
@@ -1963,6 +1964,11 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
                return -EINVAL;
        }
 
+       if (!netif_running(dev)) {
+               dev->mtu = new_mtu;
+               return 0;
+       }
+
        if (new_mtu != oldmtu) {
                spin_lock_irqsave(&vptr->lock, flags);
 
@@ -1973,12 +1979,6 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
                velocity_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)