linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / net / ixgb / ixgb_main.c
index 7bbd447..f9f77e4 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
 
 #include "ixgb.h"
 
+/* Change Log
+ * 1.0.96 04/19/05
+ * - Make needlessly global code static -- bunk@stusta.de
+ * - ethtool cleanup -- shemminger@osdl.org
+ * - Support for MODULE_VERSION -- linville@tuxdriver.com
+ * - add skb_header_cloned check to the tso path -- herbert@apana.org.au
+ * 1.0.88 01/05/05
+ * - include fix to the condition that determines when to quit NAPI - Robert Olsson
+ * - use netif_poll_{disable/enable} to synchronize between NAPI and i/f up/down
+ * 1.0.84 10/26/04
+ * - reset buffer_info->dma in Tx resource cleanup logic
+ * 1.0.83 10/12/04
+ * - sparse cleanup - shemminger@osdl.org
+ * - fix tx resource cleanup logic
+ */
+
 char ixgb_driver_name[] = "ixgb";
 static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
 
@@ -36,9 +52,9 @@ static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
 #else
 #define DRIVERNAPI "-NAPI"
 #endif
-#define DRV_VERSION            "1.0.109-k2"DRIVERNAPI
+#define DRV_VERSION            "1.0.100-k2"DRIVERNAPI
 char ixgb_driver_version[] = DRV_VERSION;
-static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
+static char ixgb_copyright[] = "Copyright (c) 1999-2005 Intel Corporation.";
 
 /* ixgb_pci_tbl - PCI Device ID Table
  *
@@ -51,8 +67,6 @@ static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 static struct pci_device_id ixgb_pci_tbl[] = {
        {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX,
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_CX4,
-        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR,
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_LR,  
@@ -134,11 +148,6 @@ MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
-#define DEFAULT_DEBUG_LEVEL_SHIFT 3
-static int debug = DEFAULT_DEBUG_LEVEL_SHIFT;
-module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
-
 /* some defines for controlling descriptor fetches in h/w */
 #define RXDCTL_WTHRESH_DEFAULT 16      /* chip writes back at this many or RXT0 */
 #define RXDCTL_PTHRESH_DEFAULT 0               /* chip considers prefech below
@@ -187,7 +196,7 @@ module_exit(ixgb_exit_module);
  * @adapter: board private structure
  **/
 
-static void
+static inline void
 ixgb_irq_disable(struct ixgb_adapter *adapter)
 {
        atomic_inc(&adapter->irq_sem);
@@ -201,7 +210,7 @@ ixgb_irq_disable(struct ixgb_adapter *adapter)
  * @adapter: board private structure
  **/
 
-static void
+static inline void
 ixgb_irq_enable(struct ixgb_adapter *adapter)
 {
        if(atomic_dec_and_test(&adapter->irq_sem)) {
@@ -222,7 +231,6 @@ ixgb_up(struct ixgb_adapter *adapter)
 
        /* hardware has been reset, we need to reload some things */
 
-       ixgb_rar_set(hw, netdev->dev_addr, 0);
        ixgb_set_multi(netdev);
 
        ixgb_restore_vlan(adapter);
@@ -232,9 +240,6 @@ ixgb_up(struct ixgb_adapter *adapter)
        ixgb_configure_rx(adapter);
        ixgb_alloc_rx_buffers(adapter);
 
-       /* disable interrupts and get the hardware into a known state */
-       IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
-
 #ifdef CONFIG_PCI_MSI
        {
        boolean_t pcix = (IXGB_READ_REG(&adapter->hw, STATUS) & 
@@ -244,7 +249,7 @@ ixgb_up(struct ixgb_adapter *adapter)
        if (!pcix)
           adapter->have_msi = FALSE;
        else if((err = pci_enable_msi(adapter->pdev))) {
-               DPRINTK(PROBE, ERR,
+               printk (KERN_ERR
                 "Unable to allocate MSI interrupt Error: %d\n", err);
                adapter->have_msi = FALSE;
                /* proceed to try to request regular interrupt */
@@ -253,12 +258,12 @@ ixgb_up(struct ixgb_adapter *adapter)
 
 #endif
        if((err = request_irq(adapter->pdev->irq, &ixgb_intr,
-                                 IRQF_SHARED | IRQF_SAMPLE_RANDOM,
-                                 netdev->name, netdev))) {
-               DPRINTK(PROBE, ERR,
-                "Unable to allocate interrupt Error: %d\n", err);
+                                 SA_SHIRQ | SA_SAMPLE_RANDOM,
+                                 netdev->name, netdev)))
                return err;
-       }
+
+       /* disable interrupts and get the hardware into a known state */
+       IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
 
        if((hw->max_frame_size != max_frame) ||
                (hw->max_frame_size !=
@@ -280,12 +285,11 @@ ixgb_up(struct ixgb_adapter *adapter)
        }
 
        mod_timer(&adapter->watchdog_timer, jiffies);
+       ixgb_irq_enable(adapter);
 
 #ifdef CONFIG_IXGB_NAPI
        netif_poll_enable(netdev);
 #endif
-       ixgb_irq_enable(adapter);
-
        return 0;
 }
 
@@ -322,7 +326,7 @@ ixgb_reset(struct ixgb_adapter *adapter)
 
        ixgb_adapter_stop(&adapter->hw);
        if(!ixgb_init_hw(&adapter->hw))
-               DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n");
+               IXGB_DBG("ixgb_init_hw failed.\n");
 }
 
 /**
@@ -353,21 +357,18 @@ ixgb_probe(struct pci_dev *pdev,
        if((err = pci_enable_device(pdev)))
                return err;
 
-       if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)) &&
-          !(err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))) {
+       if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
                pci_using_dac = 1;
        } else {
-               if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) ||
-                  (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
-                       printk(KERN_ERR
-                        "ixgb: No usable DMA configuration, aborting\n");
-                       goto err_dma_mask;
+               if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
+                       IXGB_ERR("No usable DMA configuration, aborting\n");
+                       return err;
                }
                pci_using_dac = 0;
        }
 
        if((err = pci_request_regions(pdev, ixgb_driver_name)))
-               goto err_request_regions;
+               return err;
 
        pci_set_master(pdev);
 
@@ -385,7 +386,6 @@ ixgb_probe(struct pci_dev *pdev,
        adapter->netdev = netdev;
        adapter->pdev = pdev;
        adapter->hw.back = adapter;
-       adapter->msg_enable = netif_msg_init(debug, DEFAULT_DEBUG_LEVEL_SHIFT);
 
        mmio_start = pci_resource_start(pdev, BAR_0);
        mmio_len = pci_resource_len(pdev, BAR_0);
@@ -414,7 +414,7 @@ ixgb_probe(struct pci_dev *pdev,
        netdev->change_mtu = &ixgb_change_mtu;
        ixgb_set_ethtool_ops(netdev);
        netdev->tx_timeout = &ixgb_tx_timeout;
-       netdev->watchdog_timeo = 5 * HZ;
+       netdev->watchdog_timeo = HZ;
 #ifdef CONFIG_IXGB_NAPI
        netdev->poll = &ixgb_clean;
        netdev->weight = 64;
@@ -426,7 +426,6 @@ ixgb_probe(struct pci_dev *pdev,
        netdev->poll_controller = ixgb_netpoll;
 #endif
 
-       strcpy(netdev->name, pci_name(pdev));
        netdev->mem_start = mmio_start;
        netdev->mem_end = mmio_start + mmio_len;
        netdev->base_addr = adapter->hw.io_base;
@@ -448,9 +447,6 @@ ixgb_probe(struct pci_dev *pdev,
 #ifdef NETIF_F_TSO
        netdev->features |= NETIF_F_TSO;
 #endif
-#ifdef NETIF_F_LLTX
-       netdev->features |= NETIF_F_LLTX;
-#endif
 
        if(pci_using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
@@ -458,7 +454,7 @@ ixgb_probe(struct pci_dev *pdev,
        /* make sure the EEPROM is good */
 
        if(!ixgb_validate_eeprom_checksum(&adapter->hw)) {
-               DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
+               printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n");
                err = -EIO;
                goto err_eeprom;
        }
@@ -467,7 +463,6 @@ ixgb_probe(struct pci_dev *pdev,
        memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
 
        if(!is_valid_ether_addr(netdev->perm_addr)) {
-               DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
                err = -EIO;
                goto err_eeprom;
        }
@@ -481,7 +476,6 @@ ixgb_probe(struct pci_dev *pdev,
        INIT_WORK(&adapter->tx_timeout_task,
                  (void (*)(void *))ixgb_tx_timeout_task, netdev);
 
-       strcpy(netdev->name, "eth%d");
        if((err = register_netdev(netdev)))
                goto err_register;
 
@@ -490,7 +484,8 @@ ixgb_probe(struct pci_dev *pdev,
        netif_carrier_off(netdev);
        netif_stop_queue(netdev);
 
-       DPRINTK(PROBE, INFO, "Intel(R) PRO/10GbE Network Connection\n");
+       printk(KERN_INFO "%s: Intel(R) PRO/10GbE Network Connection\n",
+                  netdev->name);
        ixgb_check_options(adapter);
        /* reset the hardware with the new settings */
 
@@ -507,9 +502,6 @@ err_ioremap:
        free_netdev(netdev);
 err_alloc_etherdev:
        pci_release_regions(pdev);
-err_request_regions:
-err_dma_mask:
-       pci_disable_device(pdev);
        return err;
 }
 
@@ -560,17 +552,17 @@ ixgb_sw_init(struct ixgb_adapter *adapter)
        hw->subsystem_vendor_id = pdev->subsystem_vendor;
        hw->subsystem_id = pdev->subsystem_device;
 
+       adapter->rx_buffer_len = IXGB_RXBUFFER_2048;
+
        hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
-       adapter->rx_buffer_len = hw->max_frame_size;
 
        if((hw->device_id == IXGB_DEVICE_ID_82597EX)
-          || (hw->device_id == IXGB_DEVICE_ID_82597EX_CX4)
-          || (hw->device_id == IXGB_DEVICE_ID_82597EX_LR)
-          || (hw->device_id == IXGB_DEVICE_ID_82597EX_SR))
+          ||(hw->device_id == IXGB_DEVICE_ID_82597EX_LR)
+          ||(hw->device_id == IXGB_DEVICE_ID_82597EX_SR))
                        hw->mac_type = ixgb_82597;
        else {
                /* should never have loaded on this device */
-               DPRINTK(PROBE, ERR, "unsupported device id\n");
+               printk(KERN_ERR "ixgb: unsupported device id\n");
        }
 
        /* enable flow control to be programmed */
@@ -668,8 +660,6 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
        size = sizeof(struct ixgb_buffer) * txdr->count;
        txdr->buffer_info = vmalloc(size);
        if(!txdr->buffer_info) {
-               DPRINTK(PROBE, ERR,
-                "Unable to allocate transmit descriptor ring memory\n");
                return -ENOMEM;
        }
        memset(txdr->buffer_info, 0, size);
@@ -682,8 +672,6 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
        txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
        if(!txdr->desc) {
                vfree(txdr->buffer_info);
-               DPRINTK(PROBE, ERR,
-                "Unable to allocate transmit descriptor memory\n");
                return -ENOMEM;
        }
        memset(txdr->desc, 0, txdr->size);
@@ -757,8 +745,6 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
        size = sizeof(struct ixgb_buffer) * rxdr->count;
        rxdr->buffer_info = vmalloc(size);
        if(!rxdr->buffer_info) {
-               DPRINTK(PROBE, ERR,
-                "Unable to allocate receive descriptor ring\n");
                return -ENOMEM;
        }
        memset(rxdr->buffer_info, 0, size);
@@ -772,8 +758,6 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
 
        if(!rxdr->desc) {
                vfree(rxdr->buffer_info);
-               DPRINTK(PROBE, ERR,
-                "Unable to allocate receive descriptors\n");
                return -ENOMEM;
        }
        memset(rxdr->desc, 0, rxdr->size);
@@ -805,14 +789,21 @@ ixgb_setup_rctl(struct ixgb_adapter *adapter)
 
        rctl |= IXGB_RCTL_SECRC;
 
-       if (adapter->rx_buffer_len <= IXGB_RXBUFFER_2048)
+       switch (adapter->rx_buffer_len) {
+       case IXGB_RXBUFFER_2048:
+       default:
                rctl |= IXGB_RCTL_BSIZE_2048;
-       else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_4096)
+               break;
+       case IXGB_RXBUFFER_4096:
                rctl |= IXGB_RCTL_BSIZE_4096;
-       else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_8192)
+               break;
+       case IXGB_RXBUFFER_8192:
                rctl |= IXGB_RCTL_BSIZE_8192;
-       else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_16384)
+               break;
+       case IXGB_RXBUFFER_16384:
                rctl |= IXGB_RCTL_BSIZE_16384;
+               break;
+       }
 
        IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
 }
@@ -902,25 +893,22 @@ ixgb_free_tx_resources(struct ixgb_adapter *adapter)
        adapter->tx_ring.desc = NULL;
 }
 
-static void
+static inline void
 ixgb_unmap_and_free_tx_resource(struct ixgb_adapter *adapter,
                                        struct ixgb_buffer *buffer_info)
 {
        struct pci_dev *pdev = adapter->pdev;
-
-       if (buffer_info->dma)
-               pci_unmap_page(pdev, buffer_info->dma, buffer_info->length,
-                              PCI_DMA_TODEVICE);
-
-       if (buffer_info->skb)
+       if(buffer_info->dma) {
+               pci_unmap_page(pdev,
+                          buffer_info->dma,
+                          buffer_info->length,
+                          PCI_DMA_TODEVICE);
+               buffer_info->dma = 0;
+       }
+       if(buffer_info->skb) {
                dev_kfree_skb_any(buffer_info->skb);
-
-       buffer_info->skb = NULL;
-       buffer_info->dma = 0;
-       buffer_info->time_stamp = 0;
-       /* these fields must always be initialized in tx
-        * buffer_info->length = 0;
-        * buffer_info->next_to_watch = 0; */
+               buffer_info->skb = NULL;
+       }
 }
 
 /**
@@ -1119,8 +1107,8 @@ ixgb_watchdog(unsigned long data)
 
        if(adapter->hw.link_up) {
                if(!netif_carrier_ok(netdev)) {
-                       DPRINTK(LINK, INFO,
-                               "NIC Link is Up 10000 Mbps Full Duplex\n");
+                       printk(KERN_INFO "ixgb: %s NIC Link is Up %d Mbps %s\n",
+                                  netdev->name, 10000, "Full Duplex");
                        adapter->link_speed = 10000;
                        adapter->link_duplex = FULL_DUPLEX;
                        netif_carrier_on(netdev);
@@ -1130,7 +1118,9 @@ ixgb_watchdog(unsigned long data)
                if(netif_carrier_ok(netdev)) {
                        adapter->link_speed = 0;
                        adapter->link_duplex = 0;
-                       DPRINTK(LINK, INFO, "NIC Link is Down\n");
+                       printk(KERN_INFO
+                                  "ixgb: %s NIC Link is Down\n",
+                                  netdev->name);
                        netif_carrier_off(netdev);
                        netif_stop_queue(netdev);
 
@@ -1163,7 +1153,7 @@ ixgb_watchdog(unsigned long data)
 #define IXGB_TX_FLAGS_VLAN             0x00000002
 #define IXGB_TX_FLAGS_TSO              0x00000004
 
-static int
+static inline int
 ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
 {
 #ifdef NETIF_F_TSO
@@ -1173,7 +1163,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
        uint16_t ipcse, tucse, mss;
        int err;
 
-       if (likely(skb_is_gso(skb))) {
+       if(likely(skb_shinfo(skb)->tso_size)) {
                if (skb_header_cloned(skb)) {
                        err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
                        if (err)
@@ -1181,7 +1171,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
                }
 
                hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
-               mss = skb_shinfo(skb)->gso_size;
+               mss = skb_shinfo(skb)->tso_size;
                skb->nh.iph->tot_len = 0;
                skb->nh.iph->check = 0;
                skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr,
@@ -1225,7 +1215,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
        return 0;
 }
 
-static boolean_t
+static inline boolean_t
 ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
 {
        struct ixgb_context_desc *context_desc;
@@ -1263,7 +1253,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
 #define IXGB_MAX_TXD_PWR       14
 #define IXGB_MAX_DATA_PER_TXD  (1<<IXGB_MAX_TXD_PWR)
 
-static int
+static inline int
 ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
            unsigned int first)
 {
@@ -1281,7 +1271,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
 
        while(len) {
                buffer_info = &tx_ring->buffer_info[i];
-               size = min(len, IXGB_MAX_DATA_PER_TXD);
+               size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
                buffer_info->length = size;
                buffer_info->dma =
                        pci_map_single(adapter->pdev,
@@ -1289,7 +1279,6 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
                                size,
                                PCI_DMA_TODEVICE);
                buffer_info->time_stamp = jiffies;
-               buffer_info->next_to_watch = 0;
 
                len -= size;
                offset += size;
@@ -1306,7 +1295,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
 
                while(len) {
                        buffer_info = &tx_ring->buffer_info[i];
-                       size = min(len, IXGB_MAX_DATA_PER_TXD);
+                       size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
                        buffer_info->length = size;
                        buffer_info->dma =
                                pci_map_page(adapter->pdev,
@@ -1315,7 +1304,6 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
                                        size,
                                        PCI_DMA_TODEVICE);
                        buffer_info->time_stamp = jiffies;
-                       buffer_info->next_to_watch = 0;
 
                        len -= size;
                        offset += size;
@@ -1330,7 +1318,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
        return count;
 }
 
-static void
+static inline void
 ixgb_tx_queue(struct ixgb_adapter *adapter, int count, int vlan_id,int tx_flags)
 {
        struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
@@ -1402,26 +1390,13 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                return 0;
        }
 
-#ifdef NETIF_F_LLTX
-       local_irq_save(flags);
-       if (!spin_trylock(&adapter->tx_lock)) {
-               /* Collision - tell upper layer to requeue */
-               local_irq_restore(flags);
-               return NETDEV_TX_LOCKED;
-       }
-#else
        spin_lock_irqsave(&adapter->tx_lock, flags);
-#endif
-
        if(unlikely(IXGB_DESC_UNUSED(&adapter->tx_ring) < DESC_NEEDED)) {
                netif_stop_queue(netdev);
                spin_unlock_irqrestore(&adapter->tx_lock, flags);
-               return NETDEV_TX_BUSY;
+               return 1;
        }
-
-#ifndef NETIF_F_LLTX
        spin_unlock_irqrestore(&adapter->tx_lock, flags);
-#endif
 
        if(adapter->vlgrp && vlan_tx_tag_present(skb)) {
                tx_flags |= IXGB_TX_FLAGS_VLAN;
@@ -1433,13 +1408,10 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        tso = ixgb_tso(adapter, skb);
        if (tso < 0) {
                dev_kfree_skb_any(skb);
-#ifdef NETIF_F_LLTX
-               spin_unlock_irqrestore(&adapter->tx_lock, flags);
-#endif
                return NETDEV_TX_OK;
        }
 
-       if (likely(tso))
+       if (tso)
                tx_flags |= IXGB_TX_FLAGS_TSO;
        else if(ixgb_tx_csum(adapter, skb))
                tx_flags |= IXGB_TX_FLAGS_CSUM;
@@ -1449,15 +1421,7 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 
        netdev->trans_start = jiffies;
 
-#ifdef NETIF_F_LLTX
-       /* Make sure there is space in the ring for the next send. */
-       if(unlikely(IXGB_DESC_UNUSED(&adapter->tx_ring) < DESC_NEEDED))
-               netif_stop_queue(netdev);
-
-       spin_unlock_irqrestore(&adapter->tx_lock, flags);
-
-#endif
-       return NETDEV_TX_OK;
+       return 0;
 }
 
 /**
@@ -1479,7 +1443,6 @@ ixgb_tx_timeout_task(struct net_device *netdev)
 {
        struct ixgb_adapter *adapter = netdev_priv(netdev);
 
-       adapter->tx_timeout_count++;
        ixgb_down(adapter, TRUE);
        ixgb_up(adapter);
 }
@@ -1518,15 +1481,28 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu)
 
        if((max_frame < IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH)
           || (max_frame > IXGB_MAX_JUMBO_FRAME_SIZE + ENET_FCS_LENGTH)) {
-               DPRINTK(PROBE, ERR, "Invalid MTU setting %d\n", new_mtu);
+               IXGB_ERR("Invalid MTU setting\n");
                return -EINVAL;
        }
 
-       adapter->rx_buffer_len = max_frame;
+       if((max_frame <= IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH)
+          || (max_frame <= IXGB_RXBUFFER_2048)) {
+               adapter->rx_buffer_len = IXGB_RXBUFFER_2048;
+
+       } else if(max_frame <= IXGB_RXBUFFER_4096) {
+               adapter->rx_buffer_len = IXGB_RXBUFFER_4096;
+
+       } else if(max_frame <= IXGB_RXBUFFER_8192) {
+               adapter->rx_buffer_len = IXGB_RXBUFFER_8192;
+
+       } else {
+               adapter->rx_buffer_len = IXGB_RXBUFFER_16384;
+       }
 
        netdev->mtu = new_mtu;
 
-       if ((old_max_frame != max_frame) && netif_running(netdev)) {
+       if(old_max_frame != max_frame && netif_running(netdev)) {
+
                ixgb_down(adapter, TRUE);
                ixgb_up(adapter);
        }
@@ -1784,43 +1760,23 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
 
        tx_ring->next_to_clean = i;
 
-       if (unlikely(netif_queue_stopped(netdev))) {
-               spin_lock(&adapter->tx_lock);
-               if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev) &&
-                   (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE))
-                       netif_wake_queue(netdev);
-               spin_unlock(&adapter->tx_lock);
+       spin_lock(&adapter->tx_lock);
+       if(cleaned && netif_queue_stopped(netdev) && netif_carrier_ok(netdev) &&
+          (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE)) {
+
+               netif_wake_queue(netdev);
        }
+       spin_unlock(&adapter->tx_lock);
 
        if(adapter->detect_tx_hung) {
                /* detect a transmit hang in hardware, this serializes the
                 * check with the clearing of time_stamp and movement of i */
                adapter->detect_tx_hung = FALSE;
-               if (tx_ring->buffer_info[eop].dma &&
-                  time_after(jiffies, tx_ring->buffer_info[eop].time_stamp + HZ)
+               if(tx_ring->buffer_info[i].dma &&
+                  time_after(jiffies, tx_ring->buffer_info[i].time_stamp + HZ)
                   && !(IXGB_READ_REG(&adapter->hw, STATUS) &
-                       IXGB_STATUS_TXOFF)) {
-                       /* detected Tx unit hang */
-                       DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
-                                       "  TDH                  <%x>\n"
-                                       "  TDT                  <%x>\n"
-                                       "  next_to_use          <%x>\n"
-                                       "  next_to_clean        <%x>\n"
-                                       "buffer_info[next_to_clean]\n"
-                                       "  time_stamp           <%lx>\n"
-                                       "  next_to_watch        <%x>\n"
-                                       "  jiffies              <%lx>\n"
-                                       "  next_to_watch.status <%x>\n",
-                               IXGB_READ_REG(&adapter->hw, TDH),
-                               IXGB_READ_REG(&adapter->hw, TDT),
-                               tx_ring->next_to_use,
-                               tx_ring->next_to_clean,
-                               tx_ring->buffer_info[eop].time_stamp,
-                               eop,
-                               jiffies,
-                               eop_desc->status);
+                       IXGB_STATUS_TXOFF))
                        netif_stop_queue(netdev);
-               }
        }
 
        return cleaned;
@@ -1833,7 +1789,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
  * @sk_buff: socket buffer with received data
  **/
 
-static void
+static inline void
 ixgb_rx_checksum(struct ixgb_adapter *adapter,
                 struct ixgb_rx_desc *rx_desc,
                 struct sk_buff *skb)
@@ -1897,7 +1853,6 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
 #endif
                status = rx_desc->status;
                skb = buffer_info->skb;
-               buffer_info->skb = NULL;
 
                prefetch(skb->data);
 
@@ -1942,26 +1897,6 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
                        goto rxdesc_done;
                }
 
-               /* code added for copybreak, this should improve
-                * performance for small packets with large amounts
-                * of reassembly being done in the stack */
-#define IXGB_CB_LENGTH 256
-               if (length < IXGB_CB_LENGTH) {
-                       struct sk_buff *new_skb =
-                           dev_alloc_skb(length + NET_IP_ALIGN);
-                       if (new_skb) {
-                               skb_reserve(new_skb, NET_IP_ALIGN);
-                               new_skb->dev = netdev;
-                               memcpy(new_skb->data - NET_IP_ALIGN,
-                                      skb->data - NET_IP_ALIGN,
-                                      length + NET_IP_ALIGN);
-                               /* save the skb in buffer_info as good */
-                               buffer_info->skb = skb;
-                               skb = new_skb;
-                       }
-               }
-               /* end copybreak code */
-
                /* Good Receive */
                skb_put(skb, length);
 
@@ -1991,6 +1926,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
 rxdesc_done:
                /* clean up descriptor, might be written over by hw */
                rx_desc->status = 0;
+               buffer_info->skb = NULL;
 
                /* use prefetched values */
                rx_desc = next_rxd;
@@ -2030,18 +1966,12 @@ ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter)
 
        /* leave three descriptors unused */
        while(--cleancount > 2) {
-               /* recycle! its good for you */
-               if (!(skb = buffer_info->skb))
-                       skb = dev_alloc_skb(adapter->rx_buffer_len
-                                           + NET_IP_ALIGN);
-               else {
-                       skb_trim(skb, 0);
-                       goto map_skb;
-               }
+               rx_desc = IXGB_RX_DESC(*rx_ring, i);
 
-               if (unlikely(!skb)) {
+               skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN);
+
+               if(unlikely(!skb)) {
                        /* Better luck next round */
-                       adapter->alloc_rx_buff_failed++;
                        break;
                }
 
@@ -2055,36 +1985,33 @@ ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter)
 
                buffer_info->skb = skb;
                buffer_info->length = adapter->rx_buffer_len;
-map_skb:
-               buffer_info->dma = pci_map_single(pdev,
-                                                 skb->data,
-                                                 adapter->rx_buffer_len,
-                                                 PCI_DMA_FROMDEVICE);
+               buffer_info->dma =
+                       pci_map_single(pdev,
+                                  skb->data,
+                                  adapter->rx_buffer_len,
+                                  PCI_DMA_FROMDEVICE);
 
-               rx_desc = IXGB_RX_DESC(*rx_ring, i);
                rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
                /* guarantee DD bit not set now before h/w gets descriptor
                 * this is the rest of the workaround for h/w double 
                 * writeback. */
                rx_desc->status = 0;
 
+               if((i & ~(num_group_tail_writes- 1)) == i) {
+                       /* Force memory writes to complete before letting h/w
+                        * know there are new descriptors to fetch.  (Only
+                        * applicable for weak-ordered memory model archs,
+                        * such as IA-64). */
+                       wmb();
+
+                       IXGB_WRITE_REG(&adapter->hw, RDT, i);
+               }
 
                if(++i == rx_ring->count) i = 0;
                buffer_info = &rx_ring->buffer_info[i];
        }
 
-       if (likely(rx_ring->next_to_use != i)) {
-               rx_ring->next_to_use = i;
-               if (unlikely(i-- == 0))
-                       i = (rx_ring->count - 1);
-
-               /* Force memory writes to complete before letting h/w
-                * know there are new descriptors to fetch.  (Only
-                * applicable for weak-ordered memory model archs, such
-                * as IA-64). */
-               wmb();
-               IXGB_WRITE_REG(&adapter->hw, RDT, i);
-       }
+       rx_ring->next_to_use = i;
 }
 
 /**