wl1251: fix a memory leak in probe
[safe/jmp/linux-2.6] / drivers / net / s2io.c
index 2805edd..668327c 100644 (file)
@@ -25,7 +25,7 @@
  * Christopher Hellwig : Some more 2.6 specific issues in the driver.
  *
  * The module loadable parameters that are supported by the driver and a brief
- * explaination of all the variables.
+ * explanation of all the variables.
  *
  * rx_ring_num : This can be used to program the number of receive rings used
  * in the driver.
@@ -79,6 +79,7 @@
 #include <linux/tcp.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
+#include <linux/slab.h>
 #include <net/tcp.h>
 
 #include <asm/system.h>
@@ -363,8 +364,8 @@ static void s2io_vlan_rx_register(struct net_device *dev,
        int i;
        struct s2io_nic *nic = netdev_priv(dev);
        unsigned long flags[MAX_TX_FIFOS];
-       struct mac_info *mac_control = &nic->mac_control;
        struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
 
        for (i = 0; i < config->tx_fifo_num; i++) {
                struct fifo_info *fifo = &mac_control->fifos[i];
@@ -387,8 +388,8 @@ static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
        int i;
        struct s2io_nic *nic = netdev_priv(dev);
        unsigned long flags[MAX_TX_FIFOS];
-       struct mac_info *mac_control = &nic->mac_control;
        struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
 
        for (i = 0; i < config->tx_fifo_num; i++) {
                struct fifo_info *fifo = &mac_control->fifos[i];
@@ -523,7 +524,7 @@ module_param_array(rts_frm_len, uint, NULL, 0);
  * S2IO device table.
  * This table lists all the devices that this driver supports.
  */
-static struct pci_device_id s2io_tbl[] __devinitdata = {
+static DEFINE_PCI_DEVICE_TABLE(s2io_tbl) = {
        {PCI_VENDOR_ID_S2IO, PCI_DEVICE_ID_S2IO_WIN,
         PCI_ANY_ID, PCI_ANY_ID},
        {PCI_VENDOR_ID_S2IO, PCI_DEVICE_ID_S2IO_UNI,
@@ -640,14 +641,10 @@ static int init_shared_mem(struct s2io_nic *nic)
        struct net_device *dev = nic->dev;
        unsigned long tmp;
        struct buffAdd *ba;
-
-       struct mac_info *mac_control;
-       struct config_param *config;
+       struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
        unsigned long long mem_allocated = 0;
 
-       mac_control = &nic->mac_control;
-       config = &nic->config;
-
        /* Allocation and initialization of TXDLs in FIFOs */
        size = 0;
        for (i = 0; i < config->tx_fifo_num; i++) {
@@ -656,9 +653,9 @@ static int init_shared_mem(struct s2io_nic *nic)
                size += tx_cfg->fifo_len;
        }
        if (size > MAX_AVAILABLE_TXDS) {
-               DBG_PRINT(ERR_DBG, "s2io: Requested TxDs too high, ");
-               DBG_PRINT(ERR_DBG, "Requested: %d, max supported: 8192\n",
-                         size);
+               DBG_PRINT(ERR_DBG,
+                         "Too many TxDs requested: %d, max supported: %d\n",
+                         size, MAX_AVAILABLE_TXDS);
                return -EINVAL;
        }
 
@@ -671,10 +668,9 @@ static int init_shared_mem(struct s2io_nic *nic)
                 * Legal values are from 2 to 8192
                 */
                if (size < 2) {
-                       DBG_PRINT(ERR_DBG, "s2io: Invalid fifo len (%d)", size);
-                       DBG_PRINT(ERR_DBG, "for fifo %d\n", i);
-                       DBG_PRINT(ERR_DBG, "s2io: Legal values for fifo len"
-                                 "are 2 to 8192\n");
+                       DBG_PRINT(ERR_DBG, "Fifo %d: Invalid length (%d) - "
+                                 "Valid lengths are 2 through 8192\n",
+                                 i, size);
                        return -EINVAL;
                }
        }
@@ -717,8 +713,8 @@ static int init_shared_mem(struct s2io_nic *nic)
                        tmp_v = pci_alloc_consistent(nic->pdev,
                                                     PAGE_SIZE, &tmp_p);
                        if (!tmp_v) {
-                               DBG_PRINT(INFO_DBG, "pci_alloc_consistent ");
-                               DBG_PRINT(INFO_DBG, "failed for TxDL\n");
+                               DBG_PRINT(INFO_DBG,
+                                         "pci_alloc_consistent failed for TxDL\n");
                                return -ENOMEM;
                        }
                        /* If we got a zero DMA address(can happen on
@@ -729,17 +725,14 @@ static int init_shared_mem(struct s2io_nic *nic)
                        if (!tmp_p) {
                                mac_control->zerodma_virt_addr = tmp_v;
                                DBG_PRINT(INIT_DBG,
-                                         "%s: Zero DMA address for TxDL. ",
-                                         dev->name);
-                               DBG_PRINT(INIT_DBG,
-                                         "Virtual address %p\n", tmp_v);
+                                         "%s: Zero DMA address for TxDL. "
+                                         "Virtual address %p\n",
+                                         dev->name, tmp_v);
                                tmp_v = pci_alloc_consistent(nic->pdev,
                                                             PAGE_SIZE, &tmp_p);
                                if (!tmp_v) {
                                        DBG_PRINT(INFO_DBG,
-                                                 "pci_alloc_consistent ");
-                                       DBG_PRINT(INFO_DBG,
-                                                 "failed for TxDL\n");
+                                                 "pci_alloc_consistent failed for TxDL\n");
                                        return -ENOMEM;
                                }
                                mem_allocated += PAGE_SIZE;
@@ -775,9 +768,9 @@ static int init_shared_mem(struct s2io_nic *nic)
                struct ring_info *ring = &mac_control->rings[i];
 
                if (rx_cfg->num_rxd % (rxd_count[nic->rxd_mode] + 1)) {
-                       DBG_PRINT(ERR_DBG, "%s: RxD count of ", dev->name);
-                       DBG_PRINT(ERR_DBG, "Ring%d is not a multiple of ", i);
-                       DBG_PRINT(ERR_DBG, "RxDs per Block");
+                       DBG_PRINT(ERR_DBG, "%s: Ring%d RxD count is not a "
+                                 "multiple of RxDs per Block\n",
+                                 dev->name, i);
                        return FAILURE;
                }
                size += rx_cfg->num_rxd;
@@ -931,8 +924,8 @@ static int init_shared_mem(struct s2io_nic *nic)
        tmp_v_addr = mac_control->stats_mem;
        mac_control->stats_info = (struct stat_block *)tmp_v_addr;
        memset(tmp_v_addr, 0, size);
-       DBG_PRINT(INIT_DBG, "%s:Ring Mem PHY: 0x%llx\n", dev->name,
-                 (unsigned long long)tmp_p_addr);
+       DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n",
+               dev_name(&nic->pdev->dev), (unsigned long long)tmp_p_addr);
        mac_control->stats_info->sw_stat.mem_allocated += mem_allocated;
        return SUCCESS;
 }
@@ -949,19 +942,23 @@ static void free_shared_mem(struct s2io_nic *nic)
        int i, j, blk_cnt, size;
        void *tmp_v_addr;
        dma_addr_t tmp_p_addr;
-       struct mac_info *mac_control;
-       struct config_param *config;
        int lst_size, lst_per_page;
        struct net_device *dev;
        int page_num = 0;
+       struct config_param *config;
+       struct mac_info *mac_control;
+       struct stat_block *stats;
+       struct swStat *swstats;
 
        if (!nic)
                return;
 
        dev = nic->dev;
 
-       mac_control = &nic->mac_control;
        config = &nic->config;
+       mac_control = &nic->mac_control;
+       stats = mac_control->stats_info;
+       swstats = &stats->sw_stat;
 
        lst_size = sizeof(struct TxD) * config->max_txds;
        lst_per_page = PAGE_SIZE / lst_size;
@@ -984,8 +981,7 @@ static void free_shared_mem(struct s2io_nic *nic)
                        pci_free_consistent(nic->pdev, PAGE_SIZE,
                                            fli->list_virt_addr,
                                            fli->list_phy_addr);
-                       nic->mac_control.stats_info->sw_stat.mem_freed
-                               += PAGE_SIZE;
+                       swstats->mem_freed += PAGE_SIZE;
                }
                /* If we got a zero DMA address during allocation,
                 * free the page now
@@ -995,16 +991,13 @@ static void free_shared_mem(struct s2io_nic *nic)
                                            mac_control->zerodma_virt_addr,
                                            (dma_addr_t)0);
                        DBG_PRINT(INIT_DBG,
-                                 "%s: Freeing TxDL with zero DMA addr. ",
-                                 dev->name);
-                       DBG_PRINT(INIT_DBG, "Virtual address %p\n",
-                                 mac_control->zerodma_virt_addr);
-                       nic->mac_control.stats_info->sw_stat.mem_freed
-                               += PAGE_SIZE;
+                                 "%s: Freeing TxDL with zero DMA address. "
+                                 "Virtual address %p\n",
+                                 dev->name, mac_control->zerodma_virt_addr);
+                       swstats->mem_freed += PAGE_SIZE;
                }
                kfree(fifo->list_info);
-               nic->mac_control.stats_info->sw_stat.mem_freed +=
-                       nic->config.tx_cfg[i].fifo_len *
+               swstats->mem_freed += tx_cfg->fifo_len *
                        sizeof(struct list_info_hold);
        }
 
@@ -1020,10 +1013,10 @@ static void free_shared_mem(struct s2io_nic *nic)
                                break;
                        pci_free_consistent(nic->pdev, size,
                                            tmp_v_addr, tmp_p_addr);
-                       nic->mac_control.stats_info->sw_stat.mem_freed += size;
+                       swstats->mem_freed += size;
                        kfree(ring->rx_blocks[j].rxds);
-                       nic->mac_control.stats_info->sw_stat.mem_freed +=
-                               sizeof(struct rxd_info) * rxd_count[nic->rxd_mode];
+                       swstats->mem_freed += sizeof(struct rxd_info) *
+                               rxd_count[nic->rxd_mode];
                }
        }
 
@@ -1042,21 +1035,20 @@ static void free_shared_mem(struct s2io_nic *nic)
                                while (k != rxd_count[nic->rxd_mode]) {
                                        struct buffAdd *ba = &ring->ba[j][k];
                                        kfree(ba->ba_0_org);
-                                       nic->mac_control.stats_info->sw_stat.\
-                                               mem_freed += (BUF0_LEN + ALIGN_SIZE);
+                                       swstats->mem_freed +=
+                                               BUF0_LEN + ALIGN_SIZE;
                                        kfree(ba->ba_1_org);
-                                       nic->mac_control.stats_info->sw_stat.\
-                                               mem_freed += (BUF1_LEN + ALIGN_SIZE);
+                                       swstats->mem_freed +=
+                                               BUF1_LEN + ALIGN_SIZE;
                                        k++;
                                }
                                kfree(ring->ba[j]);
-                               nic->mac_control.stats_info->sw_stat.mem_freed +=
-                                       (sizeof(struct buffAdd) *
-                                        (rxd_count[nic->rxd_mode] + 1));
+                               swstats->mem_freed += sizeof(struct buffAdd) *
+                                       (rxd_count[nic->rxd_mode] + 1);
                        }
                        kfree(ring->ba);
-                       nic->mac_control.stats_info->sw_stat.mem_freed +=
-                               (sizeof(struct buffAdd *) * blk_cnt);
+                       swstats->mem_freed += sizeof(struct buffAdd *) *
+                               blk_cnt;
                }
        }
 
@@ -1065,15 +1057,14 @@ static void free_shared_mem(struct s2io_nic *nic)
                struct tx_fifo_config *tx_cfg = &config->tx_cfg[i];
 
                if (fifo->ufo_in_band_v) {
-                       nic->mac_control.stats_info->sw_stat.mem_freed
-                               += (tx_cfg->fifo_len * sizeof(u64));
+                       swstats->mem_freed += tx_cfg->fifo_len *
+                               sizeof(u64);
                        kfree(fifo->ufo_in_band_v);
                }
        }
 
        if (mac_control->stats_mem) {
-               nic->mac_control.stats_info->sw_stat.mem_freed +=
-                       mac_control->stats_mem_sz;
+               swstats->mem_freed += mac_control->stats_mem_sz;
                pci_free_consistent(nic->pdev,
                                    mac_control->stats_mem_sz,
                                    mac_control->stats_mem,
@@ -1125,6 +1116,7 @@ static int s2io_print_pci_mode(struct s2io_nic *nic)
        register u64 val64 = 0;
        int     mode;
        struct config_param *config = &nic->config;
+       const char *pcimode;
 
        val64 = readq(&bar0->pci_mode);
        mode = (u8)GET_PCI_MODE(val64);
@@ -1140,38 +1132,39 @@ static int s2io_print_pci_mode(struct s2io_nic *nic)
                return mode;
        }
 
-       DBG_PRINT(ERR_DBG, "%s: Device is on %d bit ",
-                 nic->dev->name, val64 & PCI_MODE_32_BITS ? 32 : 64);
-
        switch (mode) {
        case PCI_MODE_PCI_33:
-               DBG_PRINT(ERR_DBG, "33MHz PCI bus\n");
+               pcimode = "33MHz PCI bus";
                break;
        case PCI_MODE_PCI_66:
-               DBG_PRINT(ERR_DBG, "66MHz PCI bus\n");
+               pcimode = "66MHz PCI bus";
                break;
        case PCI_MODE_PCIX_M1_66:
-               DBG_PRINT(ERR_DBG, "66MHz PCIX(M1) bus\n");
+               pcimode = "66MHz PCIX(M1) bus";
                break;
        case PCI_MODE_PCIX_M1_100:
-               DBG_PRINT(ERR_DBG, "100MHz PCIX(M1) bus\n");
+               pcimode = "100MHz PCIX(M1) bus";
                break;
        case PCI_MODE_PCIX_M1_133:
-               DBG_PRINT(ERR_DBG, "133MHz PCIX(M1) bus\n");
+               pcimode = "133MHz PCIX(M1) bus";
                break;
        case PCI_MODE_PCIX_M2_66:
-               DBG_PRINT(ERR_DBG, "133MHz PCIX(M2) bus\n");
+               pcimode = "133MHz PCIX(M2) bus";
                break;
        case PCI_MODE_PCIX_M2_100:
-               DBG_PRINT(ERR_DBG, "200MHz PCIX(M2) bus\n");
+               pcimode = "200MHz PCIX(M2) bus";
                break;
        case PCI_MODE_PCIX_M2_133:
-               DBG_PRINT(ERR_DBG, "266MHz PCIX(M2) bus\n");
+               pcimode = "266MHz PCIX(M2) bus";
                break;
        default:
-               return -1;      /* Unsupported bus speed */
+               pcimode = "unsupported bus!";
+               mode = -1;
        }
 
+       DBG_PRINT(ERR_DBG, "%s: Device is on %d bit %s\n",
+                 nic->dev->name, val64 & PCI_MODE_32_BITS ? 32 : 64, pcimode);
+
        return mode;
 }
 
@@ -1190,9 +1183,7 @@ static int init_tti(struct s2io_nic *nic, int link)
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
        register u64 val64 = 0;
        int i;
-       struct config_param *config;
-
-       config = &nic->config;
+       struct config_param *config = &nic->config;
 
        for (i = 0; i < config->tx_fifo_num; i++) {
                /*
@@ -1271,14 +1262,11 @@ static int init_nic(struct s2io_nic *nic)
        void __iomem *add;
        u32 time;
        int i, j;
-       struct mac_info *mac_control;
-       struct config_param *config;
        int dtx_cnt = 0;
        unsigned long long mem_share;
        int mem_size;
-
-       mac_control = &nic->mac_control;
-       config = &nic->config;
+       struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
 
        /* to set the swapper controle on the card */
        if (s2io_set_swapper(nic)) {
@@ -1714,9 +1702,9 @@ static int init_nic(struct s2io_nic *nic)
        /* Disable differentiated services steering logic */
        for (i = 0; i < 64; i++) {
                if (rts_ds_steer(nic, i, 0) == FAILURE) {
-                       DBG_PRINT(ERR_DBG, "%s: failed rts ds steering",
-                                 dev->name);
-                       DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i);
+                       DBG_PRINT(ERR_DBG,
+                                 "%s: rts_ds_steer failed on codepoint %d\n",
+                                 dev->name, i);
                        return -ENODEV;
                }
        }
@@ -1793,7 +1781,7 @@ static int init_nic(struct s2io_nic *nic)
                                break;
 
                        if (time > 10) {
-                               DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n",
+                               DBG_PRINT(ERR_DBG, "%s: RTI init failed\n",
                                          dev->name);
                                return -ENODEV;
                        }
@@ -2199,35 +2187,35 @@ static int verify_xena_quiescence(struct s2io_nic *sp)
        mode = s2io_verify_pci_mode(sp);
 
        if (!(val64 & ADAPTER_STATUS_TDMA_READY)) {
-               DBG_PRINT(ERR_DBG, "%s", "TDMA is not ready!");
+               DBG_PRINT(ERR_DBG, "TDMA is not ready!\n");
                return 0;
        }
        if (!(val64 & ADAPTER_STATUS_RDMA_READY)) {
-               DBG_PRINT(ERR_DBG, "%s", "RDMA is not ready!");
+               DBG_PRINT(ERR_DBG, "RDMA is not ready!\n");
                return 0;
        }
        if (!(val64 & ADAPTER_STATUS_PFC_READY)) {
-               DBG_PRINT(ERR_DBG, "%s", "PFC is not ready!");
+               DBG_PRINT(ERR_DBG, "PFC is not ready!\n");
                return 0;
        }
        if (!(val64 & ADAPTER_STATUS_TMAC_BUF_EMPTY)) {
-               DBG_PRINT(ERR_DBG, "%s", "TMAC BUF is not empty!");
+               DBG_PRINT(ERR_DBG, "TMAC BUF is not empty!\n");
                return 0;
        }
        if (!(val64 & ADAPTER_STATUS_PIC_QUIESCENT)) {
-               DBG_PRINT(ERR_DBG, "%s", "PIC is not QUIESCENT!");
+               DBG_PRINT(ERR_DBG, "PIC is not QUIESCENT!\n");
                return 0;
        }
        if (!(val64 & ADAPTER_STATUS_MC_DRAM_READY)) {
-               DBG_PRINT(ERR_DBG, "%s", "MC_DRAM is not ready!");
+               DBG_PRINT(ERR_DBG, "MC_DRAM is not ready!\n");
                return 0;
        }
        if (!(val64 & ADAPTER_STATUS_MC_QUEUES_READY)) {
-               DBG_PRINT(ERR_DBG, "%s", "MC_QUEUES is not ready!");
+               DBG_PRINT(ERR_DBG, "MC_QUEUES is not ready!\n");
                return 0;
        }
        if (!(val64 & ADAPTER_STATUS_M_PLL_LOCK)) {
-               DBG_PRINT(ERR_DBG, "%s", "M_PLL is not locked!");
+               DBG_PRINT(ERR_DBG, "M_PLL is not locked!\n");
                return 0;
        }
 
@@ -2239,12 +2227,12 @@ static int verify_xena_quiescence(struct s2io_nic *sp)
        if (!(val64 & ADAPTER_STATUS_P_PLL_LOCK) &&
            sp->device_type == XFRAME_II_DEVICE &&
            mode != PCI_MODE_PCI_33) {
-               DBG_PRINT(ERR_DBG, "%s", "P_PLL is not locked!");
+               DBG_PRINT(ERR_DBG, "P_PLL is not locked!\n");
                return 0;
        }
        if (!((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
              ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
-               DBG_PRINT(ERR_DBG, "%s", "RC_PRC is not QUIESCENT!");
+               DBG_PRINT(ERR_DBG, "RC_PRC is not QUIESCENT!\n");
                return 0;
        }
        return 1;
@@ -2290,11 +2278,8 @@ static int start_nic(struct s2io_nic *nic)
        struct net_device *dev = nic->dev;
        register u64 val64 = 0;
        u16 subid, i;
-       struct mac_info *mac_control;
-       struct config_param *config;
-
-       mac_control = &nic->mac_control;
-       config = &nic->config;
+       struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
 
        /*  PRC Initialization and configuration */
        for (i = 0; i < config->rx_ring_num; i++) {
@@ -2352,9 +2337,9 @@ static int start_nic(struct s2io_nic *nic)
         */
        val64 = readq(&bar0->adapter_status);
        if (!verify_xena_quiescence(nic)) {
-               DBG_PRINT(ERR_DBG, "%s: device is not ready, ", dev->name);
-               DBG_PRINT(ERR_DBG, "Adapter status reads: 0x%llx\n",
-                         (unsigned long long)val64);
+               DBG_PRINT(ERR_DBG, "%s: device is not ready, "
+                         "Adapter status reads: 0x%llx\n",
+                         dev->name, (unsigned long long)val64);
                return FAILURE;
        }
 
@@ -2415,7 +2400,7 @@ static struct sk_buff *s2io_txdl_getskb(struct fifo_info *fifo_data,
                return NULL;
        }
        pci_unmap_single(nic->pdev, (dma_addr_t)txds->Buffer_Pointer,
-                        skb->len - skb->data_len, PCI_DMA_TODEVICE);
+                        skb_headlen(skb), PCI_DMA_TODEVICE);
        frg_cnt = skb_shinfo(skb)->nr_frags;
        if (frg_cnt) {
                txds++;
@@ -2446,12 +2431,11 @@ static void free_tx_buffers(struct s2io_nic *nic)
        struct sk_buff *skb;
        struct TxD *txdp;
        int i, j;
-       struct mac_info *mac_control;
-       struct config_param *config;
        int cnt = 0;
-
-       mac_control = &nic->mac_control;
-       config = &nic->config;
+       struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
+       struct stat_block *stats = mac_control->stats_info;
+       struct swStat *swstats = &stats->sw_stat;
 
        for (i = 0; i < config->tx_fifo_num; i++) {
                struct tx_fifo_config *tx_cfg = &config->tx_cfg[i];
@@ -2463,14 +2447,13 @@ static void free_tx_buffers(struct s2io_nic *nic)
                        txdp = (struct TxD *)fifo->list_info[j].list_virt_addr;
                        skb = s2io_txdl_getskb(&mac_control->fifos[i], txdp, j);
                        if (skb) {
-                               nic->mac_control.stats_info->sw_stat.mem_freed
-                                       += skb->truesize;
+                               swstats->mem_freed += skb->truesize;
                                dev_kfree_skb(skb);
                                cnt++;
                        }
                }
                DBG_PRINT(INTR_DBG,
-                         "%s:forcibly freeing %d skbs on FIFO%d\n",
+                         "%s: forcibly freeing %d skbs on FIFO%d\n",
                          dev->name, cnt, i);
                fifo->tx_curr_get_info.offset = 0;
                fifo->tx_curr_put_info.offset = 0;
@@ -2493,11 +2476,6 @@ static void stop_nic(struct s2io_nic *nic)
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
        register u64 val64 = 0;
        u16 interruptible;
-       struct mac_info *mac_control;
-       struct config_param *config;
-
-       mac_control = &nic->mac_control;
-       config = &nic->config;
 
        /*  Disable all interrupts */
        en_dis_err_alarms(nic, ENA_ALL_INTRS, DISABLE_INTRS);
@@ -2548,7 +2526,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
        int rxd_index = 0;
        struct RxD1 *rxdp1;
        struct RxD3 *rxdp3;
-       struct swStat *stats = &ring->nic->mac_control.stats_info->sw_stat;
+       struct swStat *swstats = &ring->nic->mac_control.stats_info->sw_stat;
 
        alloc_cnt = ring->pkt_cnt - ring->rx_bufs_left;
 
@@ -2567,8 +2545,8 @@ static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
                if ((block_no == block_no1) &&
                    (off == ring->rx_curr_get_info.offset) &&
                    (rxdp->Host_Control)) {
-                       DBG_PRINT(INTR_DBG, "%s: Get and Put", ring->dev->name);
-                       DBG_PRINT(INTR_DBG, " info equated\n");
+                       DBG_PRINT(INTR_DBG, "%s: Get and Put info equated\n",
+                                 ring->dev->name);
                        goto end;
                }
                if (off && (off == ring->rxd_count)) {
@@ -2603,17 +2581,17 @@ static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
                /* allocate skb */
                skb = dev_alloc_skb(size);
                if (!skb) {
-                       DBG_PRINT(INFO_DBG, "%s: Out of ", ring->dev->name);
-                       DBG_PRINT(INFO_DBG, "memory to allocate SKBs\n");
+                       DBG_PRINT(INFO_DBG, "%s: Could not allocate skb\n",
+                                 ring->dev->name);
                        if (first_rxdp) {
                                wmb();
                                first_rxdp->Control_1 |= RXD_OWN_XENA;
                        }
-                       stats->mem_alloc_fail_cnt++;
+                       swstats->mem_alloc_fail_cnt++;
 
                        return -ENOMEM ;
                }
-               stats->mem_allocated += skb->truesize;
+               swstats->mem_allocated += skb->truesize;
 
                if (ring->rxd_mode == RXD_MODE_1) {
                        /* 1 buffer mode - normal operation mode */
@@ -2742,8 +2720,8 @@ end:
        return SUCCESS;
 
 pci_map_failed:
-       stats->pci_map_fail_cnt++;
-       stats->mem_freed += skb->truesize;
+       swstats->pci_map_fail_cnt++;
+       swstats->mem_freed += skb->truesize;
        dev_kfree_skb_irq(skb);
        return -ENOMEM;
 }
@@ -2754,12 +2732,13 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
        int j;
        struct sk_buff *skb;
        struct RxD_t *rxdp;
-       struct mac_info *mac_control;
        struct buffAdd *ba;
        struct RxD1 *rxdp1;
        struct RxD3 *rxdp3;
+       struct mac_info *mac_control = &sp->mac_control;
+       struct stat_block *stats = mac_control->stats_info;
+       struct swStat *swstats = &stats->sw_stat;
 
-       mac_control = &sp->mac_control;
        for (j = 0 ; j < rxd_count[sp->rxd_mode]; j++) {
                rxdp = mac_control->rings[ring_no].
                        rx_blocks[blk].rxds[j].virt_addr;
@@ -2792,7 +2771,7 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
                                         PCI_DMA_FROMDEVICE);
                        memset(rxdp, 0, sizeof(struct RxD3));
                }
-               sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize;
+               swstats->mem_freed += skb->truesize;
                dev_kfree_skb(skb);
                mac_control->rings[ring_no].rx_bufs_left -= 1;
        }
@@ -2811,11 +2790,8 @@ static void free_rx_buffers(struct s2io_nic *sp)
 {
        struct net_device *dev = sp->dev;
        int i, blk = 0, buf_cnt = 0;
-       struct mac_info *mac_control;
-       struct config_param *config;
-
-       mac_control = &sp->mac_control;
-       config = &sp->config;
+       struct config_param *config = &sp->config;
+       struct mac_info *mac_control = &sp->mac_control;
 
        for (i = 0; i < config->rx_ring_num; i++) {
                struct ring_info *ring = &mac_control->rings[i];
@@ -2828,7 +2804,7 @@ static void free_rx_buffers(struct s2io_nic *sp)
                ring->rx_curr_put_info.offset = 0;
                ring->rx_curr_get_info.offset = 0;
                ring->rx_bufs_left = 0;
-               DBG_PRINT(INIT_DBG, "%s:Freed 0x%x Rx Buffers on ring%d\n",
+               DBG_PRINT(INIT_DBG, "%s: Freed 0x%x Rx Buffers on ring%d\n",
                          dev->name, buf_cnt, i);
        }
 }
@@ -2836,8 +2812,8 @@ static void free_rx_buffers(struct s2io_nic *sp)
 static int s2io_chk_rx_buffers(struct s2io_nic *nic, struct ring_info *ring)
 {
        if (fill_rx_buffers(nic, ring, 0) == -ENOMEM) {
-               DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name);
-               DBG_PRINT(INFO_DBG, " in Rx Intr!!\n");
+               DBG_PRINT(INFO_DBG, "%s: Out of memory in Rx Intr!!\n",
+                         ring->dev->name);
        }
        return 0;
 }
@@ -2859,8 +2835,6 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
 {
        struct ring_info *ring = container_of(napi, struct ring_info, napi);
        struct net_device *dev = ring->dev;
-       struct config_param *config;
-       struct mac_info *mac_control;
        int pkts_processed = 0;
        u8 __iomem *addr = NULL;
        u8 val8 = 0;
@@ -2868,9 +2842,6 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
        int budget_org = budget;
 
-       config = &nic->config;
-       mac_control = &nic->mac_control;
-
        if (unlikely(!is_s2io_card_up(nic)))
                return 0;
 
@@ -2892,15 +2863,12 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
 static int s2io_poll_inta(struct napi_struct *napi, int budget)
 {
        struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi);
-       struct config_param *config;
-       struct mac_info *mac_control;
        int pkts_processed = 0;
        int ring_pkts_processed, i;
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
        int budget_org = budget;
-
-       config = &nic->config;
-       mac_control = &nic->mac_control;
+       struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
 
        if (unlikely(!is_s2io_card_up(nic)))
                return 0;
@@ -2936,20 +2904,17 @@ static int s2io_poll_inta(struct napi_struct *napi, int budget)
 static void s2io_netpoll(struct net_device *dev)
 {
        struct s2io_nic *nic = netdev_priv(dev);
-       struct mac_info *mac_control;
-       struct config_param *config;
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
        u64 val64 = 0xFFFFFFFFFFFFFFFFULL;
        int i;
+       struct config_param *config = &nic->config;
+       struct mac_info *mac_control = &nic->mac_control;
 
        if (pci_channel_offline(nic->pdev))
                return;
 
        disable_irq(dev->irq);
 
-       mac_control = &nic->mac_control;
-       config = &nic->config;
-
        writeq(val64, &bar0->rx_traffic_int);
        writeq(val64, &bar0->tx_traffic_int);
 
@@ -2971,13 +2936,13 @@ static void s2io_netpoll(struct net_device *dev)
                struct ring_info *ring = &mac_control->rings[i];
 
                if (fill_rx_buffers(nic, ring, 0) == -ENOMEM) {
-                       DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name);
-                       DBG_PRINT(INFO_DBG, " in Rx Netpoll!!\n");
+                       DBG_PRINT(INFO_DBG,
+                                 "%s: Out of memory in Rx Netpoll!!\n",
+                                 dev->name);
                        break;
                }
        }
        enable_irq(dev->irq);
-       return;
 }
 #endif
 
@@ -3024,9 +2989,8 @@ static int rx_intr_handler(struct ring_info *ring_data, int budget)
                }
                skb = (struct sk_buff *)((unsigned long)rxdp->Host_Control);
                if (skb == NULL) {
-                       DBG_PRINT(ERR_DBG, "%s: The skb is ",
+                       DBG_PRINT(ERR_DBG, "%s: NULL skb in Rx Intr\n",
                                  ring_data->dev->name);
-                       DBG_PRINT(ERR_DBG, "Null in Rx Intr\n");
                        return 0;
                }
                if (ring_data->rxd_mode == RXD_MODE_1) {
@@ -3110,6 +3074,8 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
        int pkt_cnt = 0;
        unsigned long flags = 0;
        u8 err_mask;
+       struct stat_block *stats = nic->mac_control.stats_info;
+       struct swStat *swstats = &stats->sw_stat;
 
        if (!spin_trylock_irqsave(&fifo_data->tx_lock, flags))
                return;
@@ -3126,36 +3092,30 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
                        unsigned long long err;
                        err = txdlp->Control_1 & TXD_T_CODE;
                        if (err & 0x1) {
-                               nic->mac_control.stats_info->sw_stat.
-                                       parity_err_cnt++;
+                               swstats->parity_err_cnt++;
                        }
 
                        /* update t_code statistics */
                        err_mask = err >> 48;
                        switch (err_mask) {
                        case 2:
-                               nic->mac_control.stats_info->sw_stat.
-                                       tx_buf_abort_cnt++;
+                               swstats->tx_buf_abort_cnt++;
                                break;
 
                        case 3:
-                               nic->mac_control.stats_info->sw_stat.
-                                       tx_desc_abort_cnt++;
+                               swstats->tx_desc_abort_cnt++;
                                break;
 
                        case 7:
-                               nic->mac_control.stats_info->sw_stat.
-                                       tx_parity_err_cnt++;
+                               swstats->tx_parity_err_cnt++;
                                break;
 
                        case 10:
-                               nic->mac_control.stats_info->sw_stat.
-                                       tx_link_loss_cnt++;
+                               swstats->tx_link_loss_cnt++;
                                break;
 
                        case 15:
-                               nic->mac_control.stats_info->sw_stat.
-                                       tx_list_proc_err_cnt++;
+                               swstats->tx_list_proc_err_cnt++;
                                break;
                        }
                }
@@ -3163,15 +3123,15 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
                skb = s2io_txdl_getskb(fifo_data, txdlp, get_info.offset);
                if (skb == NULL) {
                        spin_unlock_irqrestore(&fifo_data->tx_lock, flags);
-                       DBG_PRINT(ERR_DBG, "%s: Null skb ", __func__);
-                       DBG_PRINT(ERR_DBG, "in Tx Free Intr\n");
+                       DBG_PRINT(ERR_DBG, "%s: NULL skb in Tx Free Intr\n",
+                                 __func__);
                        return;
                }
                pkt_cnt++;
 
                /* Updating the statistics block */
                nic->dev->stats.tx_bytes += skb->len;
-               nic->mac_control.stats_info->sw_stat.mem_freed += skb->truesize;
+               swstats->mem_freed += skb->truesize;
                dev_kfree_skb_irq(skb);
 
                get_info.offset++;
@@ -3278,7 +3238,7 @@ static u64 s2io_mdio_read(u32 mmd_type, u64 addr, struct net_device *dev)
 
 /**
  *  s2io_chk_xpak_counter - Function to check the status of the xpak counters
- *  @counter      : couter value to be updated
+ *  @counter      : counter value to be updated
  *  @flag         : flag to indicate the status
  *  @type         : counter type
  *  Description:
@@ -3303,22 +3263,22 @@ static void s2io_chk_xpak_counter(u64 *counter, u64 * regs_stat, u32 index,
                if (val64 == 3) {
                        switch (type) {
                        case 1:
-                               DBG_PRINT(ERR_DBG, "Take Xframe NIC out of "
-                                         "service. Excessive temperatures may "
-                                         "result in premature transceiver "
-                                         "failure \n");
+                               DBG_PRINT(ERR_DBG,
+                                         "Take Xframe NIC out of service.\n");
+                               DBG_PRINT(ERR_DBG,
+"Excessive temperatures may result in premature transceiver failure.\n");
                                break;
                        case 2:
-                               DBG_PRINT(ERR_DBG, "Take Xframe NIC out of "
-                                         "service Excessive bias currents may "
-                                         "indicate imminent laser diode "
-                                         "failure \n");
+                               DBG_PRINT(ERR_DBG,
+                                         "Take Xframe NIC out of service.\n");
+                               DBG_PRINT(ERR_DBG,
+"Excessive bias currents may indicate imminent laser diode failure.\n");
                                break;
                        case 3:
-                               DBG_PRINT(ERR_DBG, "Take Xframe NIC out of "
-                                         "service Excessive laser output "
-                                         "power may saturate far-end "
-                                         "receiver\n");
+                               DBG_PRINT(ERR_DBG,
+                                         "Take Xframe NIC out of service.\n");
+                               DBG_PRINT(ERR_DBG,
+"Excessive laser output power may saturate far-end receiver.\n");
                                break;
                        default:
                                DBG_PRINT(ERR_DBG,
@@ -3350,22 +3310,24 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
        u64 addr  = 0x0;
 
        struct s2io_nic *sp = netdev_priv(dev);
-       struct stat_block *stat_info = sp->mac_control.stats_info;
+       struct stat_block *stats = sp->mac_control.stats_info;
+       struct xpakStat *xstats = &stats->xpak_stat;
 
        /* Check the communication with the MDIO slave */
        addr = MDIO_CTRL1;
        val64 = 0x0;
        val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev);
        if ((val64 == 0xFFFF) || (val64 == 0x0000)) {
-               DBG_PRINT(ERR_DBG, "ERR: MDIO slave access failed - "
-                         "Returned %llx\n", (unsigned long long)val64);
+               DBG_PRINT(ERR_DBG,
+                         "ERR: MDIO slave access failed - Returned %llx\n",
+                         (unsigned long long)val64);
                return;
        }
 
        /* Check for the expected value of control reg 1 */
        if (val64 != MDIO_CTRL1_SPEED10G) {
-               DBG_PRINT(ERR_DBG, "Incorrect value at PMA address 0x0000 - ");
-               DBG_PRINT(ERR_DBG, "Returned: %llx- Expected: 0x%x\n",
+               DBG_PRINT(ERR_DBG, "Incorrect value at PMA address 0x0000 - "
+                         "Returned: %llx- Expected: 0x%x\n",
                          (unsigned long long)val64, MDIO_CTRL1_SPEED10G);
                return;
        }
@@ -3382,30 +3344,30 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
 
        flag = CHECKBIT(val64, 0x7);
        type = 1;
-       s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_transceiver_temp_high,
-                             &stat_info->xpak_stat.xpak_regs_stat,
+       s2io_chk_xpak_counter(&xstats->alarm_transceiver_temp_high,
+                             &xstats->xpak_regs_stat,
                              0x0, flag, type);
 
        if (CHECKBIT(val64, 0x6))
-               stat_info->xpak_stat.alarm_transceiver_temp_low++;
+               xstats->alarm_transceiver_temp_low++;
 
        flag = CHECKBIT(val64, 0x3);
        type = 2;
-       s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_laser_bias_current_high,
-                             &stat_info->xpak_stat.xpak_regs_stat,
+       s2io_chk_xpak_counter(&xstats->alarm_laser_bias_current_high,
+                             &xstats->xpak_regs_stat,
                              0x2, flag, type);
 
        if (CHECKBIT(val64, 0x2))
-               stat_info->xpak_stat.alarm_laser_bias_current_low++;
+               xstats->alarm_laser_bias_current_low++;
 
        flag = CHECKBIT(val64, 0x1);
        type = 3;
-       s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_laser_output_power_high,
-                             &stat_info->xpak_stat.xpak_regs_stat,
+       s2io_chk_xpak_counter(&xstats->alarm_laser_output_power_high,
+                             &xstats->xpak_regs_stat,
                              0x4, flag, type);
 
        if (CHECKBIT(val64, 0x0))
-               stat_info->xpak_stat.alarm_laser_output_power_low++;
+               xstats->alarm_laser_output_power_low++;
 
        /* Reading the Warning flags */
        addr = 0xA074;
@@ -3413,22 +3375,22 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
        val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev);
 
        if (CHECKBIT(val64, 0x7))
-               stat_info->xpak_stat.warn_transceiver_temp_high++;
+               xstats->warn_transceiver_temp_high++;
 
        if (CHECKBIT(val64, 0x6))
-               stat_info->xpak_stat.warn_transceiver_temp_low++;
+               xstats->warn_transceiver_temp_low++;
 
        if (CHECKBIT(val64, 0x3))
-               stat_info->xpak_stat.warn_laser_bias_current_high++;
+               xstats->warn_laser_bias_current_high++;
 
        if (CHECKBIT(val64, 0x2))
-               stat_info->xpak_stat.warn_laser_bias_current_low++;
+               xstats->warn_laser_bias_current_low++;
 
        if (CHECKBIT(val64, 0x1))
-               stat_info->xpak_stat.warn_laser_output_power_high++;
+               xstats->warn_laser_output_power_high++;
 
        if (CHECKBIT(val64, 0x0))
-               stat_info->xpak_stat.warn_laser_output_power_low++;
+               xstats->warn_laser_output_power_low++;
 }
 
 /**
@@ -3459,7 +3421,7 @@ static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
                                break;
                        }
                } else {
-                       if (!(val64 & busy_bit)) {
+                       if (val64 & busy_bit) {
                                ret = SUCCESS;
                                break;
                        }
@@ -3514,9 +3476,11 @@ static void s2io_reset(struct s2io_nic *sp)
        u16 val16;
        unsigned long long up_cnt, down_cnt, up_time, down_time, reset_cnt;
        unsigned long long mem_alloc_cnt, mem_free_cnt, watchdog_cnt;
+       struct stat_block *stats;
+       struct swStat *swstats;
 
-       DBG_PRINT(INIT_DBG, "%s - Resetting XFrame card %s\n",
-                 __func__, sp->dev->name);
+       DBG_PRINT(INIT_DBG, "%s: Resetting XFrame card %s\n",
+                 __func__, pci_name(sp->pdev));
 
        /* Back up  the PCI-X CMD reg, dont want to lose MMRBC, OST settings */
        pci_read_config_word(sp->pdev, PCIX_COMMAND_REGISTER, &(pci_cmd));
@@ -3530,6 +3494,7 @@ static void s2io_reset(struct s2io_nic *sp)
 
                /* Restore the PCI state saved during initialization. */
                pci_restore_state(sp->pdev);
+               pci_save_state(sp->pdev);
                pci_read_config_word(sp->pdev, 0x2, &val16);
                if (check_pci_device_id(val16) != (u16)PCI_ANY_ID)
                        break;
@@ -3567,25 +3532,30 @@ static void s2io_reset(struct s2io_nic *sp)
        /* Reset device statistics maintained by OS */
        memset(&sp->stats, 0, sizeof(struct net_device_stats));
 
-       up_cnt = sp->mac_control.stats_info->sw_stat.link_up_cnt;
-       down_cnt = sp->mac_control.stats_info->sw_stat.link_down_cnt;
-       up_time = sp->mac_control.stats_info->sw_stat.link_up_time;
-       down_time = sp->mac_control.stats_info->sw_stat.link_down_time;
-       reset_cnt = sp->mac_control.stats_info->sw_stat.soft_reset_cnt;
-       mem_alloc_cnt = sp->mac_control.stats_info->sw_stat.mem_allocated;
-       mem_free_cnt = sp->mac_control.stats_info->sw_stat.mem_freed;
-       watchdog_cnt = sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt;
+       stats = sp->mac_control.stats_info;
+       swstats = &stats->sw_stat;
+
        /* save link up/down time/cnt, reset/memory/watchdog cnt */
-       memset(sp->mac_control.stats_info, 0, sizeof(struct stat_block));
+       up_cnt = swstats->link_up_cnt;
+       down_cnt = swstats->link_down_cnt;
+       up_time = swstats->link_up_time;
+       down_time = swstats->link_down_time;
+       reset_cnt = swstats->soft_reset_cnt;
+       mem_alloc_cnt = swstats->mem_allocated;
+       mem_free_cnt = swstats->mem_freed;
+       watchdog_cnt = swstats->watchdog_timer_cnt;
+
+       memset(stats, 0, sizeof(struct stat_block));
+
        /* restore link up/down time/cnt, reset/memory/watchdog cnt */
-       sp->mac_control.stats_info->sw_stat.link_up_cnt = up_cnt;
-       sp->mac_control.stats_info->sw_stat.link_down_cnt = down_cnt;
-       sp->mac_control.stats_info->sw_stat.link_up_time = up_time;
-       sp->mac_control.stats_info->sw_stat.link_down_time = down_time;
-       sp->mac_control.stats_info->sw_stat.soft_reset_cnt = reset_cnt;
-       sp->mac_control.stats_info->sw_stat.mem_allocated = mem_alloc_cnt;
-       sp->mac_control.stats_info->sw_stat.mem_freed = mem_free_cnt;
-       sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt = watchdog_cnt;
+       swstats->link_up_cnt = up_cnt;
+       swstats->link_down_cnt = down_cnt;
+       swstats->link_up_time = up_time;
+       swstats->link_down_time = down_time;
+       swstats->soft_reset_cnt = reset_cnt;
+       swstats->mem_allocated = mem_alloc_cnt;
+       swstats->mem_freed = mem_free_cnt;
+       swstats->watchdog_timer_cnt = watchdog_cnt;
 
        /* SXE-002: Configure link and activity LED to turn it off */
        subid = sp->pdev->subsystem_device;
@@ -3647,10 +3617,9 @@ static int s2io_set_swapper(struct s2io_nic *sp)
                        i++;
                }
                if (i == 4) {
-                       DBG_PRINT(ERR_DBG, "%s: Endian settings are wrong, ",
-                                 dev->name);
-                       DBG_PRINT(ERR_DBG, "feedback read %llx\n",
-                                 (unsigned long long)val64);
+                       DBG_PRINT(ERR_DBG, "%s: Endian settings are wrong, "
+                                 "feedback read %llx\n",
+                                 dev->name, (unsigned long long)val64);
                        return FAILURE;
                }
                valr = value[i];
@@ -3679,8 +3648,8 @@ static int s2io_set_swapper(struct s2io_nic *sp)
                }
                if (i == 4) {
                        unsigned long long x = val64;
-                       DBG_PRINT(ERR_DBG, "Write failed, Xmsi_addr ");
-                       DBG_PRINT(ERR_DBG, "reads:0x%llx\n", x);
+                       DBG_PRINT(ERR_DBG,
+                                 "Write failed, Xmsi_addr reads:0x%llx\n", x);
                        return FAILURE;
                }
        }
@@ -3740,10 +3709,9 @@ static int s2io_set_swapper(struct s2io_nic *sp)
        val64 = readq(&bar0->pif_rd_swapper_fb);
        if (val64 != 0x0123456789ABCDEFULL) {
                /* Endian settings are incorrect, calls for another dekko. */
-               DBG_PRINT(ERR_DBG, "%s: Endian settings are wrong, ",
-                         dev->name);
-               DBG_PRINT(ERR_DBG, "feedback read %llx\n",
-                         (unsigned long long)val64);
+               DBG_PRINT(ERR_DBG,
+                         "%s: Endian settings are wrong, feedback read %llx\n",
+                         dev->name, (unsigned long long)val64);
                return FAILURE;
        }
 
@@ -3787,7 +3755,8 @@ static void restore_xmsi_data(struct s2io_nic *nic)
                val64 = (s2BIT(7) | s2BIT(15) | vBIT(msix_index, 26, 6));
                writeq(val64, &bar0->xmsi_access);
                if (wait_for_msix_trans(nic, msix_index)) {
-                       DBG_PRINT(ERR_DBG, "failed in %s\n", __func__);
+                       DBG_PRINT(ERR_DBG, "%s: index: %d failed\n",
+                                 __func__, msix_index);
                        continue;
                }
        }
@@ -3808,7 +3777,8 @@ static void store_xmsi_data(struct s2io_nic *nic)
                val64 = (s2BIT(15) | vBIT(msix_index, 26, 6));
                writeq(val64, &bar0->xmsi_access);
                if (wait_for_msix_trans(nic, msix_index)) {
-                       DBG_PRINT(ERR_DBG, "failed in %s\n", __func__);
+                       DBG_PRINT(ERR_DBG, "%s: index: %d failed\n",
+                                 __func__, msix_index);
                        continue;
                }
                addr = readq(&bar0->xmsi_address);
@@ -3827,29 +3797,31 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
        u16 msi_control; /* Temp variable */
        int ret, i, j, msix_indx = 1;
        int size;
+       struct stat_block *stats = nic->mac_control.stats_info;
+       struct swStat *swstats = &stats->sw_stat;
 
        size = nic->num_entries * sizeof(struct msix_entry);
        nic->entries = kzalloc(size, GFP_KERNEL);
        if (!nic->entries) {
                DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
                          __func__);
-               nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
+               swstats->mem_alloc_fail_cnt++;
                return -ENOMEM;
        }
-       nic->mac_control.stats_info->sw_stat.mem_allocated += size;
+       swstats->mem_allocated += size;
 
        size = nic->num_entries * sizeof(struct s2io_msix_entry);
        nic->s2io_entries = kzalloc(size, GFP_KERNEL);
        if (!nic->s2io_entries) {
                DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
                          __func__);
-               nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
+               swstats->mem_alloc_fail_cnt++;
                kfree(nic->entries);
-               nic->mac_control.stats_info->sw_stat.mem_freed
+               swstats->mem_freed
                        += (nic->num_entries * sizeof(struct msix_entry));
                return -ENOMEM;
        }
-       nic->mac_control.stats_info->sw_stat.mem_allocated += size;
+       swstats->mem_allocated += size;
 
        nic->entries[0].entry = 0;
        nic->s2io_entries[0].entry = 0;
@@ -3878,13 +3850,13 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
        ret = pci_enable_msix(nic->pdev, nic->entries, nic->num_entries);
        /* We fail init if error or we get less vectors than min required */
        if (ret) {
-               DBG_PRINT(ERR_DBG, "s2io: Enabling MSI-X failed\n");
+               DBG_PRINT(ERR_DBG, "Enabling MSI-X failed\n");
                kfree(nic->entries);
-               nic->mac_control.stats_info->sw_stat.mem_freed
-                       += (nic->num_entries * sizeof(struct msix_entry));
+               swstats->mem_freed += nic->num_entries *
+                       sizeof(struct msix_entry);
                kfree(nic->s2io_entries);
-               nic->mac_control.stats_info->sw_stat.mem_freed
-                       += (nic->num_entries * sizeof(struct s2io_msix_entry));
+               swstats->mem_freed += nic->num_entries *
+                       sizeof(struct s2io_msix_entry);
                nic->entries = NULL;
                nic->s2io_entries = NULL;
                return -ENOMEM;
@@ -3942,8 +3914,8 @@ static int s2io_test_msi(struct s2io_nic *sp)
        if (!sp->msi_detected) {
                /* MSI(X) test failed, go back to INTx mode */
                DBG_PRINT(ERR_DBG, "%s: PCI %s: No interrupt was generated "
-                         "using MSI(X) during test\n", sp->dev->name,
-                         pci_name(pdev));
+                         "using MSI(X) during test\n",
+                         sp->dev->name, pci_name(pdev));
 
                err = -EOPNOTSUPP;
        }
@@ -4006,6 +3978,7 @@ static void remove_inta_isr(struct s2io_nic *sp)
 static int s2io_open(struct net_device *dev)
 {
        struct s2io_nic *sp = netdev_priv(dev);
+       struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
        int err = 0;
 
        /*
@@ -4036,13 +4009,13 @@ hw_init_failed:
        if (sp->config.intr_type == MSI_X) {
                if (sp->entries) {
                        kfree(sp->entries);
-                       sp->mac_control.stats_info->sw_stat.mem_freed
-                               += (sp->num_entries * sizeof(struct msix_entry));
+                       swstats->mem_freed += sp->num_entries *
+                               sizeof(struct msix_entry);
                }
                if (sp->s2io_entries) {
                        kfree(sp->s2io_entries);
-                       sp->mac_control.stats_info->sw_stat.mem_freed
-                               += (sp->num_entries * sizeof(struct s2io_msix_entry));
+                       swstats->mem_freed += sp->num_entries *
+                               sizeof(struct s2io_msix_entry);
                }
        }
        return err;
@@ -4100,7 +4073,7 @@ static int s2io_close(struct net_device *dev)
  *  0 on success & 1 on failure.
  */
 
-static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct s2io_nic *sp = netdev_priv(dev);
        u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off;
@@ -4110,20 +4083,18 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
        unsigned long flags = 0;
        u16 vlan_tag = 0;
        struct fifo_info *fifo = NULL;
-       struct mac_info *mac_control;
-       struct config_param *config;
        int do_spin_lock = 1;
        int offload_type;
        int enable_per_list_interrupt = 0;
-       struct swStat *stats = &sp->mac_control.stats_info->sw_stat;
-
-       mac_control = &sp->mac_control;
-       config = &sp->config;
+       struct config_param *config = &sp->config;
+       struct mac_info *mac_control = &sp->mac_control;
+       struct stat_block *stats = mac_control->stats_info;
+       struct swStat *swstats = &stats->sw_stat;
 
        DBG_PRINT(TX_DBG, "%s: In Neterion Tx routine\n", dev->name);
 
        if (unlikely(skb->len <= 0)) {
-               DBG_PRINT(TX_DBG, "%s:Buffer has no data..\n", dev->name);
+               DBG_PRINT(TX_DBG, "%s: Buffer has no data..\n", dev->name);
                dev_kfree_skb_any(skb);
                return NETDEV_TX_OK;
        }
@@ -4230,7 +4201,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
                txdp->Control_2 |= TXD_VLAN_TAG(vlan_tag);
        }
 
-       frg_len = skb->len - skb->data_len;
+       frg_len = skb_headlen(skb);
        if (offload_type == SKB_GSO_UDP) {
                int ufo_size;
 
@@ -4308,23 +4279,24 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
 
        /* Avoid "put" pointer going beyond "get" pointer */
        if (((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) {
-               sp->mac_control.stats_info->sw_stat.fifo_full_cnt++;
+               swstats->fifo_full_cnt++;
                DBG_PRINT(TX_DBG,
                          "No free TxDs for xmit, Put: 0x%x Get:0x%x\n",
                          put_off, get_off);
                s2io_stop_tx_queue(sp, fifo->fifo_no);
        }
-       mac_control->stats_info->sw_stat.mem_allocated += skb->truesize;
+       swstats->mem_allocated += skb->truesize;
        spin_unlock_irqrestore(&fifo->tx_lock, flags);
 
        if (sp->config.intr_type == MSI_X)
                tx_intr_handler(fifo);
 
        return NETDEV_TX_OK;
+
 pci_map_failed:
-       stats->pci_map_fail_cnt++;
+       swstats->pci_map_fail_cnt++;
        s2io_stop_tx_queue(sp, fifo->fifo_no);
-       stats->mem_freed += skb->truesize;
+       swstats->mem_freed += skb->truesize;
        dev_kfree_skb(skb);
        spin_unlock_irqrestore(&fifo->tx_lock, flags);
        return NETDEV_TX_OK;
@@ -4783,7 +4755,6 @@ reset:
        s2io_stop_all_tx_queue(sp);
        schedule_work(&sp->rst_timer_task);
        sw_stat->soft_reset_cnt++;
-       return;
 }
 
 /**
@@ -4816,8 +4787,8 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
        if (!is_s2io_card_up(sp))
                return IRQ_NONE;
 
-       mac_control = &sp->mac_control;
        config = &sp->config;
+       mac_control = &sp->mac_control;
 
        /*
         * Identify the cause for interrupt and call the appropriate
@@ -4934,44 +4905,35 @@ static void s2io_updt_stats(struct s2io_nic *sp)
 static struct net_device_stats *s2io_get_stats(struct net_device *dev)
 {
        struct s2io_nic *sp = netdev_priv(dev);
-       struct mac_info *mac_control;
-       struct config_param *config;
+       struct config_param *config = &sp->config;
+       struct mac_info *mac_control = &sp->mac_control;
+       struct stat_block *stats = mac_control->stats_info;
        int i;
 
-
-       mac_control = &sp->mac_control;
-       config = &sp->config;
-
        /* Configure Stats for immediate updt */
        s2io_updt_stats(sp);
 
        /* Using sp->stats as a staging area, because reset (due to mtu
           change, for example) will clear some hardware counters */
-       dev->stats.tx_packets +=
-               le32_to_cpu(mac_control->stats_info->tmac_frms) -
+       dev->stats.tx_packets += le32_to_cpu(stats->tmac_frms) -
                sp->stats.tx_packets;
-       sp->stats.tx_packets =
-               le32_to_cpu(mac_control->stats_info->tmac_frms);
-       dev->stats.tx_errors +=
-               le32_to_cpu(mac_control->stats_info->tmac_any_err_frms) -
+       sp->stats.tx_packets = le32_to_cpu(stats->tmac_frms);
+
+       dev->stats.tx_errors += le32_to_cpu(stats->tmac_any_err_frms) -
                sp->stats.tx_errors;
-       sp->stats.tx_errors =
-               le32_to_cpu(mac_control->stats_info->tmac_any_err_frms);
-       dev->stats.rx_errors +=
-               le64_to_cpu(mac_control->stats_info->rmac_drop_frms) -
+       sp->stats.tx_errors = le32_to_cpu(stats->tmac_any_err_frms);
+
+       dev->stats.rx_errors += le64_to_cpu(stats->rmac_drop_frms) -
                sp->stats.rx_errors;
-       sp->stats.rx_errors =
-               le64_to_cpu(mac_control->stats_info->rmac_drop_frms);
-       dev->stats.multicast =
-               le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms) -
+       sp->stats.rx_errors = le64_to_cpu(stats->rmac_drop_frms);
+
+       dev->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms) -
                sp->stats.multicast;
-       sp->stats.multicast =
-               le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms);
-       dev->stats.rx_length_errors =
-               le64_to_cpu(mac_control->stats_info->rmac_long_frms) -
+       sp->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms);
+
+       dev->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms) -
                sp->stats.rx_length_errors;
-       sp->stats.rx_length_errors =
-               le64_to_cpu(mac_control->stats_info->rmac_long_frms);
+       sp->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms);
 
        /* collect per-ring rx_packets and rx_bytes */
        dev->stats.rx_packets = dev->stats.rx_bytes = 0;
@@ -5001,7 +4963,7 @@ static struct net_device_stats *s2io_get_stats(struct net_device *dev)
 static void s2io_set_multicast(struct net_device *dev)
 {
        int i, j, prev_cnt;
-       struct dev_mc_list *mclist;
+       struct netdev_hw_addr *ha;
        struct s2io_nic *sp = netdev_priv(dev);
        struct XENA_dev_config __iomem *bar0 = sp->bar0;
        u64 val64 = 0, multi_mac = 0x010203040506ULL, mask =
@@ -5088,23 +5050,22 @@ static void s2io_set_multicast(struct net_device *dev)
 
                val64 = readq(&bar0->mac_cfg);
                sp->promisc_flg = 0;
-               DBG_PRINT(INFO_DBG, "%s: left promiscuous mode\n",
-                         dev->name);
+               DBG_PRINT(INFO_DBG, "%s: left promiscuous mode\n", dev->name);
        }
 
        /*  Update individual M_CAST address list */
-       if ((!sp->m_cast_flg) && dev->mc_count) {
-               if (dev->mc_count >
+       if ((!sp->m_cast_flg) && netdev_mc_count(dev)) {
+               if (netdev_mc_count(dev) >
                    (config->max_mc_addr - config->max_mac_addr)) {
-                       DBG_PRINT(ERR_DBG, "%s: No more Rx filters ",
+                       DBG_PRINT(ERR_DBG,
+                                 "%s: No more Rx filters can be added - "
+                                 "please enable ALL_MULTI instead\n",
                                  dev->name);
-                       DBG_PRINT(ERR_DBG, "can be added, please enable ");
-                       DBG_PRINT(ERR_DBG, "ALL_MULTI instead\n");
                        return;
                }
 
                prev_cnt = sp->mc_addr_count;
-               sp->mc_addr_count = dev->mc_count;
+               sp->mc_addr_count = netdev_mc_count(dev);
 
                /* Clear out the previous list of Mc in the H/W. */
                for (i = 0; i < prev_cnt; i++) {
@@ -5122,20 +5083,21 @@ static void s2io_set_multicast(struct net_device *dev)
                        if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                                  RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
                                                  S2IO_BIT_RESET)) {
-                               DBG_PRINT(ERR_DBG, "%s: Adding ", dev->name);
-                               DBG_PRINT(ERR_DBG, "Multicasts failed\n");
+                               DBG_PRINT(ERR_DBG,
+                                         "%s: Adding Multicasts failed\n",
+                                         dev->name);
                                return;
                        }
                }
 
                /* Create the new Rx filter list and update the same in H/W. */
-               for (i = 0, mclist = dev->mc_list; i < dev->mc_count;
-                    i++, mclist = mclist->next) {
-                       memcpy(sp->usr_addrs[i].addr, mclist->dmi_addr,
+               i = 0;
+               netdev_for_each_mc_addr(ha, dev) {
+                       memcpy(sp->usr_addrs[i].addr, ha->addr,
                               ETH_ALEN);
                        mac_addr = 0;
                        for (j = 0; j < ETH_ALEN; j++) {
-                               mac_addr |= mclist->dmi_addr[j];
+                               mac_addr |= ha->addr[j];
                                mac_addr <<= 8;
                        }
                        mac_addr >>= 8;
@@ -5153,10 +5115,12 @@ static void s2io_set_multicast(struct net_device *dev)
                        if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                                  RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
                                                  S2IO_BIT_RESET)) {
-                               DBG_PRINT(ERR_DBG, "%s: Adding ", dev->name);
-                               DBG_PRINT(ERR_DBG, "Multicasts failed\n");
+                               DBG_PRINT(ERR_DBG,
+                                         "%s: Adding Multicasts failed\n",
+                                         dev->name);
                                return;
                        }
+                       i++;
                }
        }
 }
@@ -5588,7 +5552,7 @@ static void s2io_ethtool_gringparam(struct net_device *dev,
        for (i = 0 ; i < sp->config.tx_fifo_num ; i++)
                tx_desc_count += sp->config.tx_cfg[i].fifo_len;
 
-       DBG_PRINT(INFO_DBG, "\nmax txds : %d\n", sp->config.max_txds);
+       DBG_PRINT(INFO_DBG, "max txds: %d\n", sp->config.max_txds);
        ering->tx_pending = tx_desc_count;
        rx_desc_count = 0;
        for (i = 0 ; i < sp->config.rx_ring_num ; i++)
@@ -5803,6 +5767,7 @@ static void s2io_vpd_read(struct s2io_nic *nic)
        u8 data;
        int i = 0, cnt, fail = 0;
        int vpd_addr = 0x80;
+       struct swStat *swstats = &nic->mac_control.stats_info->sw_stat;
 
        if (nic->device_type == XFRAME_II_DEVICE) {
                strcpy(nic->product_name, "Xframe II 10GbE network adapter");
@@ -5815,10 +5780,10 @@ static void s2io_vpd_read(struct s2io_nic *nic)
 
        vpd_data = kmalloc(256, GFP_KERNEL);
        if (!vpd_data) {
-               nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
+               swstats->mem_alloc_fail_cnt++;
                return;
        }
-       nic->mac_control.stats_info->sw_stat.mem_allocated += 256;
+       swstats->mem_allocated += 256;
 
        for (i = 0; i < 256; i += 4) {
                pci_write_config_byte(nic->pdev, (vpd_addr + 2), i);
@@ -5853,12 +5818,10 @@ static void s2io_vpd_read(struct s2io_nic *nic)
                }
        }
 
-       if ((!fail) && (vpd_data[1] < VPD_STRING_LEN)) {
-               memset(nic->product_name, 0, vpd_data[1]);
+       if ((!fail) && (vpd_data[1] < VPD_STRING_LEN))
                memcpy(nic->product_name, &vpd_data[3], vpd_data[1]);
-       }
        kfree(vpd_data);
-       nic->mac_control.stats_info->sw_stat.mem_freed += 256;
+       swstats->mem_freed += 256;
 }
 
 /**
@@ -5921,8 +5884,10 @@ static int s2io_ethtool_seeprom(struct net_device *dev,
 
        if (eeprom->magic != (sp->pdev->vendor | (sp->pdev->device << 16))) {
                DBG_PRINT(ERR_DBG,
-                         "ETHTOOL_WRITE_EEPROM Err: Magic value ");
-               DBG_PRINT(ERR_DBG, "is wrong, Its not 0x%x\n", eeprom->magic);
+                         "ETHTOOL_WRITE_EEPROM Err: "
+                         "Magic value is wrong, it is 0x%x should be 0x%x\n",
+                         (sp->pdev->vendor | (sp->pdev->device << 16)),
+                         eeprom->magic);
                return -EFAULT;
        }
 
@@ -5935,9 +5900,8 @@ static int s2io_ethtool_seeprom(struct net_device *dev,
 
                if (write_eeprom(sp, (eeprom->offset + cnt), valid, 0)) {
                        DBG_PRINT(ERR_DBG,
-                                 "ETHTOOL_WRITE_EEPROM Err: Cannot ");
-                       DBG_PRINT(ERR_DBG,
-                                 "write into the specified offset\n");
+                                 "ETHTOOL_WRITE_EEPROM Err: "
+                                 "Cannot write into the specified offset\n");
                        return -EFAULT;
                }
                cnt++;
@@ -5969,13 +5933,13 @@ static int s2io_register_test(struct s2io_nic *sp, uint64_t *data)
        val64 = readq(&bar0->pif_rd_swapper_fb);
        if (val64 != 0x123456789abcdefULL) {
                fail = 1;
-               DBG_PRINT(INFO_DBG, "Read Test level 1 fails\n");
+               DBG_PRINT(INFO_DBG, "Read Test level %d fails\n", 1);
        }
 
        val64 = readq(&bar0->rmac_pause_cfg);
        if (val64 != 0xc000ffff00000000ULL) {
                fail = 1;
-               DBG_PRINT(INFO_DBG, "Read Test level 2 fails\n");
+               DBG_PRINT(INFO_DBG, "Read Test level %d fails\n", 2);
        }
 
        val64 = readq(&bar0->rx_queue_cfg);
@@ -5985,13 +5949,13 @@ static int s2io_register_test(struct s2io_nic *sp, uint64_t *data)
                exp_val = 0x0808080808080808ULL;
        if (val64 != exp_val) {
                fail = 1;
-               DBG_PRINT(INFO_DBG, "Read Test level 3 fails\n");
+               DBG_PRINT(INFO_DBG, "Read Test level %d fails\n", 3);
        }
 
        val64 = readq(&bar0->xgxs_efifo_cfg);
        if (val64 != 0x000000001923141EULL) {
                fail = 1;
-               DBG_PRINT(INFO_DBG, "Read Test level 4 fails\n");
+               DBG_PRINT(INFO_DBG, "Read Test level %d fails\n", 4);
        }
 
        val64 = 0x5A5A5A5A5A5A5A5AULL;
@@ -5999,7 +5963,7 @@ static int s2io_register_test(struct s2io_nic *sp, uint64_t *data)
        val64 = readq(&bar0->xmsi_data);
        if (val64 != 0x5A5A5A5A5A5A5A5AULL) {
                fail = 1;
-               DBG_PRINT(ERR_DBG, "Write Test level 1 fails\n");
+               DBG_PRINT(ERR_DBG, "Write Test level %d fails\n", 1);
        }
 
        val64 = 0xA5A5A5A5A5A5A5A5ULL;
@@ -6007,7 +5971,7 @@ static int s2io_register_test(struct s2io_nic *sp, uint64_t *data)
        val64 = readq(&bar0->xmsi_data);
        if (val64 != 0xA5A5A5A5A5A5A5A5ULL) {
                fail = 1;
-               DBG_PRINT(ERR_DBG, "Write Test level 2 fails\n");
+               DBG_PRINT(ERR_DBG, "Write Test level %d fails\n", 2);
        }
 
        *data = fail;
@@ -6350,273 +6314,275 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
 {
        int i = 0, k;
        struct s2io_nic *sp = netdev_priv(dev);
-       struct stat_block *stat_info = sp->mac_control.stats_info;
+       struct stat_block *stats = sp->mac_control.stats_info;
+       struct swStat *swstats = &stats->sw_stat;
+       struct xpakStat *xstats = &stats->xpak_stat;
 
        s2io_updt_stats(sp);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_frms_oflow) << 32  |
-               le32_to_cpu(stat_info->tmac_frms);
+               (u64)le32_to_cpu(stats->tmac_frms_oflow) << 32  |
+               le32_to_cpu(stats->tmac_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_data_octets_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_data_octets);
-       tmp_stats[i++] = le64_to_cpu(stat_info->tmac_drop_frms);
+               (u64)le32_to_cpu(stats->tmac_data_octets_oflow) << 32 |
+               le32_to_cpu(stats->tmac_data_octets);
+       tmp_stats[i++] = le64_to_cpu(stats->tmac_drop_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_mcst_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_mcst_frms);
+               (u64)le32_to_cpu(stats->tmac_mcst_frms_oflow) << 32 |
+               le32_to_cpu(stats->tmac_mcst_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_bcst_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_bcst_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->tmac_pause_ctrl_frms);
+               (u64)le32_to_cpu(stats->tmac_bcst_frms_oflow) << 32 |
+               le32_to_cpu(stats->tmac_bcst_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->tmac_pause_ctrl_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_ttl_octets_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_ttl_octets);
+               (u64)le32_to_cpu(stats->tmac_ttl_octets_oflow) << 32 |
+               le32_to_cpu(stats->tmac_ttl_octets);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_ucst_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_ucst_frms);
+               (u64)le32_to_cpu(stats->tmac_ucst_frms_oflow) << 32 |
+               le32_to_cpu(stats->tmac_ucst_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_nucst_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_nucst_frms);
+               (u64)le32_to_cpu(stats->tmac_nucst_frms_oflow) << 32 |
+               le32_to_cpu(stats->tmac_nucst_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_any_err_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_any_err_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->tmac_ttl_less_fb_octets);
-       tmp_stats[i++] = le64_to_cpu(stat_info->tmac_vld_ip_octets);
+               (u64)le32_to_cpu(stats->tmac_any_err_frms_oflow) << 32 |
+               le32_to_cpu(stats->tmac_any_err_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->tmac_ttl_less_fb_octets);
+       tmp_stats[i++] = le64_to_cpu(stats->tmac_vld_ip_octets);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_vld_ip_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_vld_ip);
+               (u64)le32_to_cpu(stats->tmac_vld_ip_oflow) << 32 |
+               le32_to_cpu(stats->tmac_vld_ip);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_drop_ip_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_drop_ip);
+               (u64)le32_to_cpu(stats->tmac_drop_ip_oflow) << 32 |
+               le32_to_cpu(stats->tmac_drop_ip);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_icmp_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_icmp);
+               (u64)le32_to_cpu(stats->tmac_icmp_oflow) << 32 |
+               le32_to_cpu(stats->tmac_icmp);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->tmac_rst_tcp_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_rst_tcp);
-       tmp_stats[i++] = le64_to_cpu(stat_info->tmac_tcp);
-       tmp_stats[i++] = (u64)le32_to_cpu(stat_info->tmac_udp_oflow) << 32 |
-               le32_to_cpu(stat_info->tmac_udp);
+               (u64)le32_to_cpu(stats->tmac_rst_tcp_oflow) << 32 |
+               le32_to_cpu(stats->tmac_rst_tcp);
+       tmp_stats[i++] = le64_to_cpu(stats->tmac_tcp);
+       tmp_stats[i++] = (u64)le32_to_cpu(stats->tmac_udp_oflow) << 32 |
+               le32_to_cpu(stats->tmac_udp);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_vld_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_vld_frms);
+               (u64)le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_vld_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_data_octets_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_data_octets);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_fcs_err_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_drop_frms);
+               (u64)le32_to_cpu(stats->rmac_data_octets_oflow) << 32 |
+               le32_to_cpu(stats->rmac_data_octets);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_fcs_err_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_drop_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_vld_mcst_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_vld_mcst_frms);
+               (u64)le32_to_cpu(stats->rmac_vld_mcst_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_vld_mcst_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_vld_bcst_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_vld_bcst_frms);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rmac_in_rng_len_err_frms);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rmac_out_rng_len_err_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_long_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_pause_ctrl_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_unsup_ctrl_frms);
+               (u64)le32_to_cpu(stats->rmac_vld_bcst_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_vld_bcst_frms);
+       tmp_stats[i++] = le32_to_cpu(stats->rmac_in_rng_len_err_frms);
+       tmp_stats[i++] = le32_to_cpu(stats->rmac_out_rng_len_err_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_long_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_pause_ctrl_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_unsup_ctrl_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_ttl_octets_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_ttl_octets);
+               (u64)le32_to_cpu(stats->rmac_ttl_octets_oflow) << 32 |
+               le32_to_cpu(stats->rmac_ttl_octets);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_accepted_ucst_frms_oflow) << 32
-               | le32_to_cpu(stat_info->rmac_accepted_ucst_frms);
+               (u64)le32_to_cpu(stats->rmac_accepted_ucst_frms_oflow) << 32
+               | le32_to_cpu(stats->rmac_accepted_ucst_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_accepted_nucst_frms_oflow)
-               << 32 | le32_to_cpu(stat_info->rmac_accepted_nucst_frms);
+               (u64)le32_to_cpu(stats->rmac_accepted_nucst_frms_oflow)
+               << 32 | le32_to_cpu(stats->rmac_accepted_nucst_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_discarded_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_discarded_frms);
+               (u64)le32_to_cpu(stats->rmac_discarded_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_discarded_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_drop_events_oflow)
-               << 32 | le32_to_cpu(stat_info->rmac_drop_events);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_less_fb_octets);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_frms);
+               (u64)le32_to_cpu(stats->rmac_drop_events_oflow)
+               << 32 | le32_to_cpu(stats->rmac_drop_events);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_less_fb_octets);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_usized_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_usized_frms);
+               (u64)le32_to_cpu(stats->rmac_usized_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_usized_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_osized_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_osized_frms);
+               (u64)le32_to_cpu(stats->rmac_osized_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_osized_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_frag_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_frag_frms);
+               (u64)le32_to_cpu(stats->rmac_frag_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_frag_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_jabber_frms_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_jabber_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_64_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_65_127_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_128_255_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_256_511_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_512_1023_frms);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_1024_1518_frms);
+               (u64)le32_to_cpu(stats->rmac_jabber_frms_oflow) << 32 |
+               le32_to_cpu(stats->rmac_jabber_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_64_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_65_127_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_128_255_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_256_511_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_512_1023_frms);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_1024_1518_frms);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_ip_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_ip);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ip_octets);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rmac_hdr_err_ip);
+               (u64)le32_to_cpu(stats->rmac_ip_oflow) << 32 |
+               le32_to_cpu(stats->rmac_ip);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_ip_octets);
+       tmp_stats[i++] = le32_to_cpu(stats->rmac_hdr_err_ip);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_drop_ip_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_drop_ip);
+               (u64)le32_to_cpu(stats->rmac_drop_ip_oflow) << 32 |
+               le32_to_cpu(stats->rmac_drop_ip);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_icmp_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_icmp);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_tcp);
+               (u64)le32_to_cpu(stats->rmac_icmp_oflow) << 32 |
+               le32_to_cpu(stats->rmac_icmp);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_tcp);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_udp_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_udp);
+               (u64)le32_to_cpu(stats->rmac_udp_oflow) << 32 |
+               le32_to_cpu(stats->rmac_udp);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_err_drp_udp_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_err_drp_udp);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_err_sym);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q0);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q1);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q2);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q3);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q4);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q5);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q6);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q7);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q0);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q1);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q2);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q3);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q4);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q5);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q6);
-       tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q7);
+               (u64)le32_to_cpu(stats->rmac_err_drp_udp_oflow) << 32 |
+               le32_to_cpu(stats->rmac_err_drp_udp);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_xgmii_err_sym);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q0);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q1);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q2);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q3);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q4);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q5);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q6);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q7);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q0);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q1);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q2);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q3);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q4);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q5);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q6);
+       tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q7);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_pause_cnt_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_pause_cnt);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_data_err_cnt);
-       tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_ctrl_err_cnt);
+               (u64)le32_to_cpu(stats->rmac_pause_cnt_oflow) << 32 |
+               le32_to_cpu(stats->rmac_pause_cnt);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_xgmii_data_err_cnt);
+       tmp_stats[i++] = le64_to_cpu(stats->rmac_xgmii_ctrl_err_cnt);
        tmp_stats[i++] =
-               (u64)le32_to_cpu(stat_info->rmac_accepted_ip_oflow) << 32 |
-               le32_to_cpu(stat_info->rmac_accepted_ip);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rmac_err_tcp);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rd_req_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->new_rd_req_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->new_rd_req_rtry_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rd_rtry_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->wr_rtry_rd_ack_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->wr_req_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->new_wr_req_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->new_wr_req_rtry_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->wr_rtry_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->wr_disc_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rd_rtry_wr_ack_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->txp_wr_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->txd_rd_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->txd_wr_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rxd_rd_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rxd_wr_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->txf_rd_cnt);
-       tmp_stats[i++] = le32_to_cpu(stat_info->rxf_wr_cnt);
+               (u64)le32_to_cpu(stats->rmac_accepted_ip_oflow) << 32 |
+               le32_to_cpu(stats->rmac_accepted_ip);
+       tmp_stats[i++] = le32_to_cpu(stats->rmac_err_tcp);
+       tmp_stats[i++] = le32_to_cpu(stats->rd_req_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->new_rd_req_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->new_rd_req_rtry_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->rd_rtry_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->wr_rtry_rd_ack_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->wr_req_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->new_wr_req_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->new_wr_req_rtry_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->wr_rtry_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->wr_disc_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->rd_rtry_wr_ack_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->txp_wr_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->txd_rd_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->txd_wr_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->rxd_rd_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->rxd_wr_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->txf_rd_cnt);
+       tmp_stats[i++] = le32_to_cpu(stats->rxf_wr_cnt);
 
        /* Enhanced statistics exist only for Hercules */
        if (sp->device_type == XFRAME_II_DEVICE) {
                tmp_stats[i++] =
-                       le64_to_cpu(stat_info->rmac_ttl_1519_4095_frms);
+                       le64_to_cpu(stats->rmac_ttl_1519_4095_frms);
                tmp_stats[i++] =
-                       le64_to_cpu(stat_info->rmac_ttl_4096_8191_frms);
+                       le64_to_cpu(stats->rmac_ttl_4096_8191_frms);
                tmp_stats[i++] =
-                       le64_to_cpu(stat_info->rmac_ttl_8192_max_frms);
-               tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_gt_max_frms);
-               tmp_stats[i++] = le64_to_cpu(stat_info->rmac_osized_alt_frms);
-               tmp_stats[i++] = le64_to_cpu(stat_info->rmac_jabber_alt_frms);
-               tmp_stats[i++] = le64_to_cpu(stat_info->rmac_gt_max_alt_frms);
-               tmp_stats[i++] = le64_to_cpu(stat_info->rmac_vlan_frms);
-               tmp_stats[i++] = le32_to_cpu(stat_info->rmac_len_discard);
-               tmp_stats[i++] = le32_to_cpu(stat_info->rmac_fcs_discard);
-               tmp_stats[i++] = le32_to_cpu(stat_info->rmac_pf_discard);
-               tmp_stats[i++] = le32_to_cpu(stat_info->rmac_da_discard);
-               tmp_stats[i++] = le32_to_cpu(stat_info->rmac_red_discard);
-               tmp_stats[i++] = le32_to_cpu(stat_info->rmac_rts_discard);
-               tmp_stats[i++] = le32_to_cpu(stat_info->rmac_ingm_full_discard);
-               tmp_stats[i++] = le32_to_cpu(stat_info->link_fault_cnt);
+                       le64_to_cpu(stats->rmac_ttl_8192_max_frms);
+               tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_gt_max_frms);
+               tmp_stats[i++] = le64_to_cpu(stats->rmac_osized_alt_frms);
+               tmp_stats[i++] = le64_to_cpu(stats->rmac_jabber_alt_frms);
+               tmp_stats[i++] = le64_to_cpu(stats->rmac_gt_max_alt_frms);
+               tmp_stats[i++] = le64_to_cpu(stats->rmac_vlan_frms);
+               tmp_stats[i++] = le32_to_cpu(stats->rmac_len_discard);
+               tmp_stats[i++] = le32_to_cpu(stats->rmac_fcs_discard);
+               tmp_stats[i++] = le32_to_cpu(stats->rmac_pf_discard);
+               tmp_stats[i++] = le32_to_cpu(stats->rmac_da_discard);
+               tmp_stats[i++] = le32_to_cpu(stats->rmac_red_discard);
+               tmp_stats[i++] = le32_to_cpu(stats->rmac_rts_discard);
+               tmp_stats[i++] = le32_to_cpu(stats->rmac_ingm_full_discard);
+               tmp_stats[i++] = le32_to_cpu(stats->link_fault_cnt);
        }
 
        tmp_stats[i++] = 0;
-       tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs;
-       tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs;
-       tmp_stats[i++] = stat_info->sw_stat.parity_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.serious_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.soft_reset_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.fifo_full_cnt;
+       tmp_stats[i++] = swstats->single_ecc_errs;
+       tmp_stats[i++] = swstats->double_ecc_errs;
+       tmp_stats[i++] = swstats->parity_err_cnt;
+       tmp_stats[i++] = swstats->serious_err_cnt;
+       tmp_stats[i++] = swstats->soft_reset_cnt;
+       tmp_stats[i++] = swstats->fifo_full_cnt;
        for (k = 0; k < MAX_RX_RINGS; k++)
-               tmp_stats[i++] = stat_info->sw_stat.ring_full_cnt[k];
-       tmp_stats[i++] = stat_info->xpak_stat.alarm_transceiver_temp_high;
-       tmp_stats[i++] = stat_info->xpak_stat.alarm_transceiver_temp_low;
-       tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_bias_current_high;
-       tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_bias_current_low;
-       tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_output_power_high;
-       tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_output_power_low;
-       tmp_stats[i++] = stat_info->xpak_stat.warn_transceiver_temp_high;
-       tmp_stats[i++] = stat_info->xpak_stat.warn_transceiver_temp_low;
-       tmp_stats[i++] = stat_info->xpak_stat.warn_laser_bias_current_high;
-       tmp_stats[i++] = stat_info->xpak_stat.warn_laser_bias_current_low;
-       tmp_stats[i++] = stat_info->xpak_stat.warn_laser_output_power_high;
-       tmp_stats[i++] = stat_info->xpak_stat.warn_laser_output_power_low;
-       tmp_stats[i++] = stat_info->sw_stat.clubbed_frms_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.sending_both;
-       tmp_stats[i++] = stat_info->sw_stat.outof_sequence_pkts;
-       tmp_stats[i++] = stat_info->sw_stat.flush_max_pkts;
-       if (stat_info->sw_stat.num_aggregations) {
-               u64 tmp = stat_info->sw_stat.sum_avg_pkts_aggregated;
+               tmp_stats[i++] = swstats->ring_full_cnt[k];
+       tmp_stats[i++] = xstats->alarm_transceiver_temp_high;
+       tmp_stats[i++] = xstats->alarm_transceiver_temp_low;
+       tmp_stats[i++] = xstats->alarm_laser_bias_current_high;
+       tmp_stats[i++] = xstats->alarm_laser_bias_current_low;
+       tmp_stats[i++] = xstats->alarm_laser_output_power_high;
+       tmp_stats[i++] = xstats->alarm_laser_output_power_low;
+       tmp_stats[i++] = xstats->warn_transceiver_temp_high;
+       tmp_stats[i++] = xstats->warn_transceiver_temp_low;
+       tmp_stats[i++] = xstats->warn_laser_bias_current_high;
+       tmp_stats[i++] = xstats->warn_laser_bias_current_low;
+       tmp_stats[i++] = xstats->warn_laser_output_power_high;
+       tmp_stats[i++] = xstats->warn_laser_output_power_low;
+       tmp_stats[i++] = swstats->clubbed_frms_cnt;
+       tmp_stats[i++] = swstats->sending_both;
+       tmp_stats[i++] = swstats->outof_sequence_pkts;
+       tmp_stats[i++] = swstats->flush_max_pkts;
+       if (swstats->num_aggregations) {
+               u64 tmp = swstats->sum_avg_pkts_aggregated;
                int count = 0;
                /*
                 * Since 64-bit divide does not work on all platforms,
                 * do repeated subtraction.
                 */
-               while (tmp >= stat_info->sw_stat.num_aggregations) {
-                       tmp -= stat_info->sw_stat.num_aggregations;
+               while (tmp >= swstats->num_aggregations) {
+                       tmp -= swstats->num_aggregations;
                        count++;
                }
                tmp_stats[i++] = count;
        } else
                tmp_stats[i++] = 0;
-       tmp_stats[i++] = stat_info->sw_stat.mem_alloc_fail_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.pci_map_fail_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.watchdog_timer_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.mem_allocated;
-       tmp_stats[i++] = stat_info->sw_stat.mem_freed;
-       tmp_stats[i++] = stat_info->sw_stat.link_up_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.link_down_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.link_up_time;
-       tmp_stats[i++] = stat_info->sw_stat.link_down_time;
-
-       tmp_stats[i++] = stat_info->sw_stat.tx_buf_abort_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.tx_desc_abort_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.tx_parity_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.tx_link_loss_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.tx_list_proc_err_cnt;
-
-       tmp_stats[i++] = stat_info->sw_stat.rx_parity_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_abort_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_parity_abort_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_rda_fail_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_unkn_prot_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_fcs_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_buf_size_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_rxd_corrupt_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rx_unkn_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.tda_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.pfc_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.pcc_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.tti_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.tpa_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.sm_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.lso_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.mac_tmac_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.mac_rmac_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.xgxs_txgxs_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.xgxs_rxgxs_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rc_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.prc_pcix_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rpa_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rda_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.rti_err_cnt;
-       tmp_stats[i++] = stat_info->sw_stat.mc_err_cnt;
+       tmp_stats[i++] = swstats->mem_alloc_fail_cnt;
+       tmp_stats[i++] = swstats->pci_map_fail_cnt;
+       tmp_stats[i++] = swstats->watchdog_timer_cnt;
+       tmp_stats[i++] = swstats->mem_allocated;
+       tmp_stats[i++] = swstats->mem_freed;
+       tmp_stats[i++] = swstats->link_up_cnt;
+       tmp_stats[i++] = swstats->link_down_cnt;
+       tmp_stats[i++] = swstats->link_up_time;
+       tmp_stats[i++] = swstats->link_down_time;
+
+       tmp_stats[i++] = swstats->tx_buf_abort_cnt;
+       tmp_stats[i++] = swstats->tx_desc_abort_cnt;
+       tmp_stats[i++] = swstats->tx_parity_err_cnt;
+       tmp_stats[i++] = swstats->tx_link_loss_cnt;
+       tmp_stats[i++] = swstats->tx_list_proc_err_cnt;
+
+       tmp_stats[i++] = swstats->rx_parity_err_cnt;
+       tmp_stats[i++] = swstats->rx_abort_cnt;
+       tmp_stats[i++] = swstats->rx_parity_abort_cnt;
+       tmp_stats[i++] = swstats->rx_rda_fail_cnt;
+       tmp_stats[i++] = swstats->rx_unkn_prot_cnt;
+       tmp_stats[i++] = swstats->rx_fcs_err_cnt;
+       tmp_stats[i++] = swstats->rx_buf_size_err_cnt;
+       tmp_stats[i++] = swstats->rx_rxd_corrupt_cnt;
+       tmp_stats[i++] = swstats->rx_unkn_err_cnt;
+       tmp_stats[i++] = swstats->tda_err_cnt;
+       tmp_stats[i++] = swstats->pfc_err_cnt;
+       tmp_stats[i++] = swstats->pcc_err_cnt;
+       tmp_stats[i++] = swstats->tti_err_cnt;
+       tmp_stats[i++] = swstats->tpa_err_cnt;
+       tmp_stats[i++] = swstats->sm_err_cnt;
+       tmp_stats[i++] = swstats->lso_err_cnt;
+       tmp_stats[i++] = swstats->mac_tmac_err_cnt;
+       tmp_stats[i++] = swstats->mac_rmac_err_cnt;
+       tmp_stats[i++] = swstats->xgxs_txgxs_err_cnt;
+       tmp_stats[i++] = swstats->xgxs_rxgxs_err_cnt;
+       tmp_stats[i++] = swstats->rc_err_cnt;
+       tmp_stats[i++] = swstats->prc_pcix_err_cnt;
+       tmp_stats[i++] = swstats->rpa_err_cnt;
+       tmp_stats[i++] = swstats->rda_err_cnt;
+       tmp_stats[i++] = swstats->rti_err_cnt;
+       tmp_stats[i++] = swstats->mc_err_cnt;
 }
 
 static int s2io_ethtool_get_regs_len(struct net_device *dev)
@@ -6858,8 +6824,9 @@ static void s2io_set_link(struct work_struct *work)
                                }
                                nic->device_enabled_once = true;
                        } else {
-                               DBG_PRINT(ERR_DBG, "%s: Error: ", dev->name);
-                               DBG_PRINT(ERR_DBG, "device is not Quiescent\n");
+                               DBG_PRINT(ERR_DBG,
+                                         "%s: Error: device is not Quiescent\n",
+                                         dev->name);
                                s2io_stop_all_tx_queue(nic);
                        }
                }
@@ -6909,15 +6876,13 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                } else {
                        *skb = dev_alloc_skb(size);
                        if (!(*skb)) {
-                               DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name);
-                               DBG_PRINT(INFO_DBG, "memory to allocate ");
-                               DBG_PRINT(INFO_DBG, "1 buf mode SKBs\n");
-                               sp->mac_control.stats_info->sw_stat.
-                                       mem_alloc_fail_cnt++;
+                               DBG_PRINT(INFO_DBG,
+                                         "%s: Out of memory to allocate %s\n",
+                                         dev->name, "1 buf mode SKBs");
+                               stats->mem_alloc_fail_cnt++;
                                return -ENOMEM ;
                        }
-                       sp->mac_control.stats_info->sw_stat.mem_allocated
-                               += (*skb)->truesize;
+                       stats->mem_allocated += (*skb)->truesize;
                        /* storing the mapped addr in a temp variable
                         * such it will be used for next rxd whose
                         * Host Control is NULL
@@ -6940,15 +6905,14 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                } else {
                        *skb = dev_alloc_skb(size);
                        if (!(*skb)) {
-                               DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name);
-                               DBG_PRINT(INFO_DBG, "memory to allocate ");
-                               DBG_PRINT(INFO_DBG, "2 buf mode SKBs\n");
-                               sp->mac_control.stats_info->sw_stat.
-                                       mem_alloc_fail_cnt++;
+                               DBG_PRINT(INFO_DBG,
+                                         "%s: Out of memory to allocate %s\n",
+                                         dev->name,
+                                         "2 buf mode SKBs");
+                               stats->mem_alloc_fail_cnt++;
                                return -ENOMEM;
                        }
-                       sp->mac_control.stats_info->sw_stat.mem_allocated
-                               += (*skb)->truesize;
+                       stats->mem_allocated += (*skb)->truesize;
                        rxdp3->Buffer2_ptr = *temp2 =
                                pci_map_single(sp->pdev, (*skb)->data,
                                               dev->mtu + 4,
@@ -7010,8 +6974,8 @@ static void set_rxd_buffer_size(struct s2io_nic *sp, struct RxD_t *rxdp,
 static  int rxd_owner_bit_reset(struct s2io_nic *sp)
 {
        int i, j, k, blk_cnt = 0, size;
-       struct mac_info *mac_control = &sp->mac_control;
        struct config_param *config = &sp->config;
+       struct mac_info *mac_control = &sp->mac_control;
        struct net_device *dev = sp->dev;
        struct RxD_t *rxdp = NULL;
        struct sk_buff *skb = NULL;
@@ -7132,8 +7096,8 @@ static int s2io_add_isr(struct s2io_nic *sp)
                }
                if (!err) {
                        pr_info("MSI-X-RX %d entries enabled\n", --msix_rx_cnt);
-                       DBG_PRINT(INFO_DBG, "MSI-X-TX entries enabled"
-                                 " through alarm vector\n");
+                       DBG_PRINT(INFO_DBG,
+                                 "MSI-X-TX entries enabled through alarm vector\n");
                }
        }
        if (sp->config.intr_type == INTA) {
@@ -7213,8 +7177,8 @@ static void do_s2io_card_down(struct s2io_nic *sp, int do_io)
                msleep(50);
                cnt++;
                if (cnt == 10) {
-                       DBG_PRINT(ERR_DBG, "s2io_close:Device not Quiescent ");
-                       DBG_PRINT(ERR_DBG, "adaper status reads 0x%llx\n",
+                       DBG_PRINT(ERR_DBG, "Device not Quiescent - "
+                                 "adapter status reads 0x%llx\n",
                                  (unsigned long long)val64);
                        break;
                }
@@ -7239,8 +7203,8 @@ static void s2io_card_down(struct s2io_nic *sp)
 static int s2io_card_up(struct s2io_nic *sp)
 {
        int i, ret = 0;
-       struct mac_info *mac_control;
        struct config_param *config;
+       struct mac_info *mac_control;
        struct net_device *dev = (struct net_device *)sp->dev;
        u16 interruptible;
 
@@ -7258,8 +7222,8 @@ static int s2io_card_up(struct s2io_nic *sp)
         * Initializing the Rx buffers. For now we are considering only 1
         * Rx ring and initializing buffers into 30 Rx blocks
         */
-       mac_control = &sp->mac_control;
        config = &sp->config;
+       mac_control = &sp->mac_control;
 
        for (i = 0; i < config->rx_ring_num; i++) {
                struct ring_info *ring = &mac_control->rings[i];
@@ -7387,11 +7351,12 @@ out_unlock:
 static void s2io_tx_watchdog(struct net_device *dev)
 {
        struct s2io_nic *sp = netdev_priv(dev);
+       struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
 
        if (netif_carrier_ok(dev)) {
-               sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt++;
+               swstats->watchdog_timer_cnt++;
                schedule_work(&sp->rst_timer_task);
-               sp->mac_control.stats_info->sw_stat.soft_reset_cnt++;
+               swstats->soft_reset_cnt++;
        }
 }
 
@@ -7423,50 +7388,51 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
        unsigned long long err = rxdp->Control_1 & RXD_T_CODE;
        struct lro *uninitialized_var(lro);
        u8 err_mask;
+       struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
 
        skb->dev = dev;
 
        if (err) {
                /* Check for parity error */
                if (err & 0x1)
-                       sp->mac_control.stats_info->sw_stat.parity_err_cnt++;
+                       swstats->parity_err_cnt++;
 
                err_mask = err >> 48;
                switch (err_mask) {
                case 1:
-                       sp->mac_control.stats_info->sw_stat.rx_parity_err_cnt++;
+                       swstats->rx_parity_err_cnt++;
                        break;
 
                case 2:
-                       sp->mac_control.stats_info->sw_stat.rx_abort_cnt++;
+                       swstats->rx_abort_cnt++;
                        break;
 
                case 3:
-                       sp->mac_control.stats_info->sw_stat.rx_parity_abort_cnt++;
+                       swstats->rx_parity_abort_cnt++;
                        break;
 
                case 4:
-                       sp->mac_control.stats_info->sw_stat.rx_rda_fail_cnt++;
+                       swstats->rx_rda_fail_cnt++;
                        break;
 
                case 5:
-                       sp->mac_control.stats_info->sw_stat.rx_unkn_prot_cnt++;
+                       swstats->rx_unkn_prot_cnt++;
                        break;
 
                case 6:
-                       sp->mac_control.stats_info->sw_stat.rx_fcs_err_cnt++;
+                       swstats->rx_fcs_err_cnt++;
                        break;
 
                case 7:
-                       sp->mac_control.stats_info->sw_stat.rx_buf_size_err_cnt++;
+                       swstats->rx_buf_size_err_cnt++;
                        break;
 
                case 8:
-                       sp->mac_control.stats_info->sw_stat.rx_rxd_corrupt_cnt++;
+                       swstats->rx_rxd_corrupt_cnt++;
                        break;
 
                case 15:
-                       sp->mac_control.stats_info->sw_stat.rx_unkn_err_cnt++;
+                       swstats->rx_unkn_err_cnt++;
                        break;
                }
                /*
@@ -7480,7 +7446,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
                        DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
                                  dev->name, err_mask);
                        dev->stats.rx_crc_errors++;
-                       sp->mac_control.stats_info->sw_stat.mem_freed
+                       swstats->mem_freed
                                += skb->truesize;
                        dev_kfree_skb(skb);
                        ring_data->rx_bufs_left -= 1;
@@ -7545,13 +7511,11 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
                                        queue_rx_frame(lro->parent,
                                                       lro->vlan_tag);
                                        clear_lro_session(lro);
-                                       sp->mac_control.stats_info->
-                                               sw_stat.flush_max_pkts++;
+                                       swstats->flush_max_pkts++;
                                        goto aggregate;
                                case 2: /* Flush both */
                                        lro->parent->data_len = lro->frags_len;
-                                       sp->mac_control.stats_info->
-                                               sw_stat.sending_both++;
+                                       swstats->sending_both++;
                                        queue_rx_frame(lro->parent,
                                                       lro->vlan_tag);
                                        clear_lro_session(lro);
@@ -7580,7 +7544,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
        } else
                skb->ip_summed = CHECKSUM_NONE;
 
-       sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize;
+       swstats->mem_freed += skb->truesize;
 send_up:
        skb_record_rx_queue(skb, ring_no);
        queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp->Control_2));
@@ -7605,6 +7569,7 @@ aggregate:
 static void s2io_link(struct s2io_nic *sp, int link)
 {
        struct net_device *dev = (struct net_device *)sp->dev;
+       struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
 
        if (link != sp->last_link_state) {
                init_tti(sp, link);
@@ -7612,17 +7577,16 @@ static void s2io_link(struct s2io_nic *sp, int link)
                        DBG_PRINT(ERR_DBG, "%s: Link down\n", dev->name);
                        s2io_stop_all_tx_queue(sp);
                        netif_carrier_off(dev);
-                       if (sp->mac_control.stats_info->sw_stat.link_up_cnt)
-                               sp->mac_control.stats_info->sw_stat.
-                                       link_up_time = jiffies - sp->start_time;
-                       sp->mac_control.stats_info->sw_stat.link_down_cnt++;
+                       if (swstats->link_up_cnt)
+                               swstats->link_up_time =
+                                       jiffies - sp->start_time;
+                       swstats->link_down_cnt++;
                } else {
                        DBG_PRINT(ERR_DBG, "%s: Link Up\n", dev->name);
-                       if (sp->mac_control.stats_info->sw_stat.link_down_cnt)
-                               sp->mac_control.stats_info->
-                                       sw_stat.link_down_time =
+                       if (swstats->link_down_cnt)
+                               swstats->link_down_time =
                                        jiffies - sp->start_time;
-                       sp->mac_control.stats_info->sw_stat.link_up_cnt++;
+                       swstats->link_up_cnt++;
                        netif_carrier_on(dev);
                        s2io_wake_all_tx_queue(sp);
                }
@@ -7665,7 +7629,7 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
                            u8 *dev_multiq)
 {
        if ((tx_fifo_num > MAX_TX_FIFOS) || (tx_fifo_num < 1)) {
-               DBG_PRINT(ERR_DBG, "s2io: Requested number of tx fifos "
+               DBG_PRINT(ERR_DBG, "Requested number of tx fifos "
                          "(%d) not supported\n", tx_fifo_num);
 
                if (tx_fifo_num < 1)
@@ -7673,8 +7637,7 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
                else
                        tx_fifo_num = MAX_TX_FIFOS;
 
-               DBG_PRINT(ERR_DBG, "s2io: Default to %d ", tx_fifo_num);
-               DBG_PRINT(ERR_DBG, "tx fifos\n");
+               DBG_PRINT(ERR_DBG, "Default to %d tx fifos\n", tx_fifo_num);
        }
 
        if (multiq)
@@ -7683,7 +7646,7 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
        if (tx_steering_type && (1 == tx_fifo_num)) {
                if (tx_steering_type != TX_DEFAULT_STEERING)
                        DBG_PRINT(ERR_DBG,
-                                 "s2io: Tx steering is not supported with "
+                                 "Tx steering is not supported with "
                                  "one fifo. Disabling Tx steering.\n");
                tx_steering_type = NO_STEERING;
        }
@@ -7691,21 +7654,21 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
        if ((tx_steering_type < NO_STEERING) ||
            (tx_steering_type > TX_DEFAULT_STEERING)) {
                DBG_PRINT(ERR_DBG,
-                         "s2io: Requested transmit steering not supported\n");
-               DBG_PRINT(ERR_DBG, "s2io: Disabling transmit steering\n");
+                         "Requested transmit steering not supported\n");
+               DBG_PRINT(ERR_DBG, "Disabling transmit steering\n");
                tx_steering_type = NO_STEERING;
        }
 
        if (rx_ring_num > MAX_RX_RINGS) {
                DBG_PRINT(ERR_DBG,
-                         "s2io: Requested number of rx rings not supported\n");
-               DBG_PRINT(ERR_DBG, "s2io: Default to %d rx rings\n",
+                         "Requested number of rx rings not supported\n");
+               DBG_PRINT(ERR_DBG, "Default to %d rx rings\n",
                          MAX_RX_RINGS);
                rx_ring_num = MAX_RX_RINGS;
        }
 
        if ((*dev_intr_type != INTA) && (*dev_intr_type != MSI_X)) {
-               DBG_PRINT(ERR_DBG, "s2io: Wrong intr_type requested. "
+               DBG_PRINT(ERR_DBG, "Wrong intr_type requested. "
                          "Defaulting to INTA\n");
                *dev_intr_type = INTA;
        }
@@ -7713,14 +7676,14 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
        if ((*dev_intr_type == MSI_X) &&
            ((pdev->device != PCI_DEVICE_ID_HERC_WIN) &&
             (pdev->device != PCI_DEVICE_ID_HERC_UNI))) {
-               DBG_PRINT(ERR_DBG, "s2io: Xframe I does not support MSI_X. "
+               DBG_PRINT(ERR_DBG, "Xframe I does not support MSI_X. "
                          "Defaulting to INTA\n");
                *dev_intr_type = INTA;
        }
 
        if ((rx_ring_mode != 1) && (rx_ring_mode != 2)) {
-               DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n");
-               DBG_PRINT(ERR_DBG, "s2io: Defaulting to 1-buffer mode\n");
+               DBG_PRINT(ERR_DBG, "Requested ring mode not supported\n");
+               DBG_PRINT(ERR_DBG, "Defaulting to 1-buffer mode\n");
                rx_ring_mode = 1;
        }
        return SUCCESS;
@@ -7800,8 +7763,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
        u64 val64 = 0, tmp64 = 0;
        struct XENA_dev_config __iomem *bar0 = NULL;
        u16 subid;
-       struct mac_info *mac_control;
        struct config_param *config;
+       struct mac_info *mac_control;
        int mode;
        u8 dev_intr_type = intr_type;
        u8 dev_multiq = 0;
@@ -7813,12 +7776,12 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
        ret = pci_enable_device(pdev);
        if (ret) {
                DBG_PRINT(ERR_DBG,
-                         "s2io_init_nic: pci_enable_device failed\n");
+                         "%s: pci_enable_device failed\n", __func__);
                return ret;
        }
 
        if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
-               DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 64bit DMA\n");
+               DBG_PRINT(INIT_DBG, "%s: Using 64bit DMA\n", __func__);
                dma_flag = true;
                if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
                        DBG_PRINT(ERR_DBG,
@@ -7828,14 +7791,14 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                        return -ENOMEM;
                }
        } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
-               DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 32bit DMA\n");
+               DBG_PRINT(INIT_DBG, "%s: Using 32bit DMA\n", __func__);
        } else {
                pci_disable_device(pdev);
                return -ENOMEM;
        }
        ret = pci_request_regions(pdev, s2io_driver_name);
        if (ret) {
-               DBG_PRINT(ERR_DBG, "%s: Request Regions failed - %x \n",
+               DBG_PRINT(ERR_DBG, "%s: Request Regions failed - %x\n",
                          __func__, ret);
                pci_disable_device(pdev);
                return -ENODEV;
@@ -7887,8 +7850,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
         * these parameters are not not specified during load time, they
         * are initialized with default values.
         */
-       mac_control = &sp->mac_control;
        config = &sp->config;
+       mac_control = &sp->mac_control;
 
        config->napi = napi;
        config->tx_steering_type = tx_steering_type;
@@ -8029,7 +7992,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
 
        /* Setting swapper control on the NIC, for proper reset operation */
        if (s2io_set_swapper(sp)) {
-               DBG_PRINT(ERR_DBG, "%s:swapper settings are wrong\n",
+               DBG_PRINT(ERR_DBG, "%s: swapper settings are wrong\n",
                          dev->name);
                ret = -EAGAIN;
                goto set_swap_failed;
@@ -8039,8 +8002,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
        if (sp->device_type & XFRAME_II_DEVICE) {
                mode = s2io_verify_pci_mode(sp);
                if (mode < 0) {
-                       DBG_PRINT(ERR_DBG, "%s: ", __func__);
-                       DBG_PRINT(ERR_DBG, " Unsupported PCI bus mode\n");
+                       DBG_PRINT(ERR_DBG, "%s: Unsupported PCI bus mode\n",
+                                 __func__);
                        ret = -EBADSLT;
                        goto set_swap_failed;
                }
@@ -8058,7 +8021,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                if (ret) {
 
                        DBG_PRINT(ERR_DBG,
-                                 "s2io: MSI-X requested but failed to enable\n");
+                                 "MSI-X requested but failed to enable\n");
                        sp->config.intr_type = INTA;
                }
        }
@@ -8174,12 +8137,11 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                  sp->product_name, pdev->revision);
        DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name,
                  s2io_driver_version);
-       DBG_PRINT(ERR_DBG, "%s: MAC ADDR: %pM\n", dev->name, dev->dev_addr);
-       DBG_PRINT(ERR_DBG, "SERIAL NUMBER: %s\n", sp->serial_num);
+       DBG_PRINT(ERR_DBG, "%s: MAC Address: %pM\n", dev->name, dev->dev_addr);
+       DBG_PRINT(ERR_DBG, "Serial number: %s\n", sp->serial_num);
        if (sp->device_type & XFRAME_II_DEVICE) {
                mode = s2io_print_pci_mode(sp);
                if (mode < 0) {
-                       DBG_PRINT(ERR_DBG, " Unsupported PCI bus mode\n");
                        ret = -EBADSLT;
                        unregister_netdev(dev);
                        goto set_swap_failed;
@@ -8433,7 +8395,8 @@ static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro)
        struct iphdr *ip = lro->iph;
        struct tcphdr *tcp = lro->tcph;
        __sum16 nchk;
-       struct stat_block *statinfo = sp->mac_control.stats_info;
+       struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
+
        DBG_PRINT(INFO_DBG, "%s: Been here...\n", __func__);
 
        /* Update L3 header */
@@ -8455,8 +8418,8 @@ static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro)
        /* Update counters required for calculation of
         * average no. of packets aggregated.
         */
-       statinfo->sw_stat.sum_avg_pkts_aggregated += lro->sg_num;
-       statinfo->sw_stat.num_aggregations++;
+       swstats->sum_avg_pkts_aggregated += lro->sg_num;
+       swstats->num_aggregations++;
 }
 
 static void aggregate_new_rx(struct lro *lro, struct iphdr *ip,
@@ -8547,6 +8510,7 @@ static int s2io_club_tcp_session(struct ring_info *ring_data, u8 *buffer,
        struct tcphdr *tcph;
        int ret = 0, i;
        u16 vlan_tag = 0;
+       struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
 
        ret = check_L2_lro_capable(buffer, &ip, (struct tcphdr **)tcp,
                                   rxdp, sp);
@@ -8567,13 +8531,13 @@ static int s2io_club_tcp_session(struct ring_info *ring_data, u8 *buffer,
                        *lro = l_lro;
 
                        if ((*lro)->tcp_next_seq != ntohl(tcph->seq)) {
-                               DBG_PRINT(INFO_DBG, "%s:Out of order. expected "
-                                         "0x%x, actual 0x%x\n", __func__,
+                               DBG_PRINT(INFO_DBG, "%s: Out of sequence. "
+                                         "expected 0x%x, actual 0x%x\n",
+                                         __func__,
                                          (*lro)->tcp_next_seq,
                                          ntohl(tcph->seq));
 
-                               sp->mac_control.stats_info->
-                                       sw_stat.outof_sequence_pkts++;
+                               swstats->outof_sequence_pkts++;
                                ret = 2;
                                break;
                        }
@@ -8607,7 +8571,7 @@ static int s2io_club_tcp_session(struct ring_info *ring_data, u8 *buffer,
        }
 
        if (ret == 0) { /* sessions exceeded */
-               DBG_PRINT(INFO_DBG, "%s:All LRO sessions already in use\n",
+               DBG_PRINT(INFO_DBG, "%s: All LRO sessions already in use\n",
                          __func__);
                *lro = NULL;
                return ret;
@@ -8629,7 +8593,7 @@ static int s2io_club_tcp_session(struct ring_info *ring_data, u8 *buffer,
                }
                break;
        default:
-               DBG_PRINT(ERR_DBG, "%s:Dont know, can't say!!\n", __func__);
+               DBG_PRINT(ERR_DBG, "%s: Don't know, can't say!!\n", __func__);
                break;
        }
 
@@ -8667,6 +8631,7 @@ static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
                           struct sk_buff *skb, u32 tcp_len)
 {
        struct sk_buff *first = lro->parent;
+       struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
 
        first->len += tcp_len;
        first->data_len = lro->frags_len;
@@ -8677,8 +8642,7 @@ static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
                skb_shinfo(first)->frag_list = skb;
        first->truesize += skb->truesize;
        lro->last_frag = skb;
-       sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
-       return;
+       swstats->clubbed_frms_cnt++;
 }
 
 /**