aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/s2io.c851
1 files changed, 408 insertions, 443 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 4897f0449db2..06223dfd2e88 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -363,8 +363,8 @@ static void s2io_vlan_rx_register(struct net_device *dev,
363 int i; 363 int i;
364 struct s2io_nic *nic = netdev_priv(dev); 364 struct s2io_nic *nic = netdev_priv(dev);
365 unsigned long flags[MAX_TX_FIFOS]; 365 unsigned long flags[MAX_TX_FIFOS];
366 struct mac_info *mac_control = &nic->mac_control;
367 struct config_param *config = &nic->config; 366 struct config_param *config = &nic->config;
367 struct mac_info *mac_control = &nic->mac_control;
368 368
369 for (i = 0; i < config->tx_fifo_num; i++) { 369 for (i = 0; i < config->tx_fifo_num; i++) {
370 struct fifo_info *fifo = &mac_control->fifos[i]; 370 struct fifo_info *fifo = &mac_control->fifos[i];
@@ -387,8 +387,8 @@ static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
387 int i; 387 int i;
388 struct s2io_nic *nic = netdev_priv(dev); 388 struct s2io_nic *nic = netdev_priv(dev);
389 unsigned long flags[MAX_TX_FIFOS]; 389 unsigned long flags[MAX_TX_FIFOS];
390 struct mac_info *mac_control = &nic->mac_control;
391 struct config_param *config = &nic->config; 390 struct config_param *config = &nic->config;
391 struct mac_info *mac_control = &nic->mac_control;
392 392
393 for (i = 0; i < config->tx_fifo_num; i++) { 393 for (i = 0; i < config->tx_fifo_num; i++) {
394 struct fifo_info *fifo = &mac_control->fifos[i]; 394 struct fifo_info *fifo = &mac_control->fifos[i];
@@ -640,14 +640,10 @@ static int init_shared_mem(struct s2io_nic *nic)
640 struct net_device *dev = nic->dev; 640 struct net_device *dev = nic->dev;
641 unsigned long tmp; 641 unsigned long tmp;
642 struct buffAdd *ba; 642 struct buffAdd *ba;
643 643 struct config_param *config = &nic->config;
644 struct mac_info *mac_control; 644 struct mac_info *mac_control = &nic->mac_control;
645 struct config_param *config;
646 unsigned long long mem_allocated = 0; 645 unsigned long long mem_allocated = 0;
647 646
648 mac_control = &nic->mac_control;
649 config = &nic->config;
650
651 /* Allocation and initialization of TXDLs in FIFOs */ 647 /* Allocation and initialization of TXDLs in FIFOs */
652 size = 0; 648 size = 0;
653 for (i = 0; i < config->tx_fifo_num; i++) { 649 for (i = 0; i < config->tx_fifo_num; i++) {
@@ -949,19 +945,23 @@ static void free_shared_mem(struct s2io_nic *nic)
949 int i, j, blk_cnt, size; 945 int i, j, blk_cnt, size;
950 void *tmp_v_addr; 946 void *tmp_v_addr;
951 dma_addr_t tmp_p_addr; 947 dma_addr_t tmp_p_addr;
952 struct mac_info *mac_control;
953 struct config_param *config;
954 int lst_size, lst_per_page; 948 int lst_size, lst_per_page;
955 struct net_device *dev; 949 struct net_device *dev;
956 int page_num = 0; 950 int page_num = 0;
951 struct config_param *config;
952 struct mac_info *mac_control;
953 struct stat_block *stats;
954 struct swStat *swstats;
957 955
958 if (!nic) 956 if (!nic)
959 return; 957 return;
960 958
961 dev = nic->dev; 959 dev = nic->dev;
962 960
963 mac_control = &nic->mac_control;
964 config = &nic->config; 961 config = &nic->config;
962 mac_control = &nic->mac_control;
963 stats = mac_control->stats_info;
964 swstats = &stats->sw_stat;
965 965
966 lst_size = sizeof(struct TxD) * config->max_txds; 966 lst_size = sizeof(struct TxD) * config->max_txds;
967 lst_per_page = PAGE_SIZE / lst_size; 967 lst_per_page = PAGE_SIZE / lst_size;
@@ -984,8 +984,7 @@ static void free_shared_mem(struct s2io_nic *nic)
984 pci_free_consistent(nic->pdev, PAGE_SIZE, 984 pci_free_consistent(nic->pdev, PAGE_SIZE,
985 fli->list_virt_addr, 985 fli->list_virt_addr,
986 fli->list_phy_addr); 986 fli->list_phy_addr);
987 nic->mac_control.stats_info->sw_stat.mem_freed 987 swstats->mem_freed += PAGE_SIZE;
988 += PAGE_SIZE;
989 } 988 }
990 /* If we got a zero DMA address during allocation, 989 /* If we got a zero DMA address during allocation,
991 * free the page now 990 * free the page now
@@ -999,12 +998,10 @@ static void free_shared_mem(struct s2io_nic *nic)
999 dev->name); 998 dev->name);
1000 DBG_PRINT(INIT_DBG, "Virtual address %p\n", 999 DBG_PRINT(INIT_DBG, "Virtual address %p\n",
1001 mac_control->zerodma_virt_addr); 1000 mac_control->zerodma_virt_addr);
1002 nic->mac_control.stats_info->sw_stat.mem_freed 1001 swstats->mem_freed += PAGE_SIZE;
1003 += PAGE_SIZE;
1004 } 1002 }
1005 kfree(fifo->list_info); 1003 kfree(fifo->list_info);
1006 nic->mac_control.stats_info->sw_stat.mem_freed += 1004 swstats->mem_freed += nic->config.tx_cfg[i].fifo_len *
1007 nic->config.tx_cfg[i].fifo_len *
1008 sizeof(struct list_info_hold); 1005 sizeof(struct list_info_hold);
1009 } 1006 }
1010 1007
@@ -1020,10 +1017,10 @@ static void free_shared_mem(struct s2io_nic *nic)
1020 break; 1017 break;
1021 pci_free_consistent(nic->pdev, size, 1018 pci_free_consistent(nic->pdev, size,
1022 tmp_v_addr, tmp_p_addr); 1019 tmp_v_addr, tmp_p_addr);
1023 nic->mac_control.stats_info->sw_stat.mem_freed += size; 1020 swstats->mem_freed += size;
1024 kfree(ring->rx_blocks[j].rxds); 1021 kfree(ring->rx_blocks[j].rxds);
1025 nic->mac_control.stats_info->sw_stat.mem_freed += 1022 swstats->mem_freed += sizeof(struct rxd_info) *
1026 sizeof(struct rxd_info) * rxd_count[nic->rxd_mode]; 1023 rxd_count[nic->rxd_mode];
1027 } 1024 }
1028 } 1025 }
1029 1026
@@ -1042,21 +1039,20 @@ static void free_shared_mem(struct s2io_nic *nic)
1042 while (k != rxd_count[nic->rxd_mode]) { 1039 while (k != rxd_count[nic->rxd_mode]) {
1043 struct buffAdd *ba = &ring->ba[j][k]; 1040 struct buffAdd *ba = &ring->ba[j][k];
1044 kfree(ba->ba_0_org); 1041 kfree(ba->ba_0_org);
1045 nic->mac_control.stats_info->sw_stat.\ 1042 swstats->mem_freed +=
1046 mem_freed += (BUF0_LEN + ALIGN_SIZE); 1043 BUF0_LEN + ALIGN_SIZE;
1047 kfree(ba->ba_1_org); 1044 kfree(ba->ba_1_org);
1048 nic->mac_control.stats_info->sw_stat.\ 1045 swstats->mem_freed +=
1049 mem_freed += (BUF1_LEN + ALIGN_SIZE); 1046 BUF1_LEN + ALIGN_SIZE;
1050 k++; 1047 k++;
1051 } 1048 }
1052 kfree(ring->ba[j]); 1049 kfree(ring->ba[j]);
1053 nic->mac_control.stats_info->sw_stat.mem_freed += 1050 swstats->mem_freed += sizeof(struct buffAdd) *
1054 (sizeof(struct buffAdd) * 1051 (rxd_count[nic->rxd_mode] + 1);
1055 (rxd_count[nic->rxd_mode] + 1));
1056 } 1052 }
1057 kfree(ring->ba); 1053 kfree(ring->ba);
1058 nic->mac_control.stats_info->sw_stat.mem_freed += 1054 swstats->mem_freed += sizeof(struct buffAdd *) *
1059 (sizeof(struct buffAdd *) * blk_cnt); 1055 blk_cnt;
1060 } 1056 }
1061 } 1057 }
1062 1058
@@ -1065,15 +1061,14 @@ static void free_shared_mem(struct s2io_nic *nic)
1065 struct tx_fifo_config *tx_cfg = &config->tx_cfg[i]; 1061 struct tx_fifo_config *tx_cfg = &config->tx_cfg[i];
1066 1062
1067 if (fifo->ufo_in_band_v) { 1063 if (fifo->ufo_in_band_v) {
1068 nic->mac_control.stats_info->sw_stat.mem_freed 1064 swstats->mem_freed += tx_cfg->fifo_len *
1069 += (tx_cfg->fifo_len * sizeof(u64)); 1065 sizeof(u64);
1070 kfree(fifo->ufo_in_band_v); 1066 kfree(fifo->ufo_in_band_v);
1071 } 1067 }
1072 } 1068 }
1073 1069
1074 if (mac_control->stats_mem) { 1070 if (mac_control->stats_mem) {
1075 nic->mac_control.stats_info->sw_stat.mem_freed += 1071 swstats->mem_freed += mac_control->stats_mem_sz;
1076 mac_control->stats_mem_sz;
1077 pci_free_consistent(nic->pdev, 1072 pci_free_consistent(nic->pdev,
1078 mac_control->stats_mem_sz, 1073 mac_control->stats_mem_sz,
1079 mac_control->stats_mem, 1074 mac_control->stats_mem,
@@ -1190,9 +1185,7 @@ static int init_tti(struct s2io_nic *nic, int link)
1190 struct XENA_dev_config __iomem *bar0 = nic->bar0; 1185 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1191 register u64 val64 = 0; 1186 register u64 val64 = 0;
1192 int i; 1187 int i;
1193 struct config_param *config; 1188 struct config_param *config = &nic->config;
1194
1195 config = &nic->config;
1196 1189
1197 for (i = 0; i < config->tx_fifo_num; i++) { 1190 for (i = 0; i < config->tx_fifo_num; i++) {
1198 /* 1191 /*
@@ -1271,14 +1264,11 @@ static int init_nic(struct s2io_nic *nic)
1271 void __iomem *add; 1264 void __iomem *add;
1272 u32 time; 1265 u32 time;
1273 int i, j; 1266 int i, j;
1274 struct mac_info *mac_control;
1275 struct config_param *config;
1276 int dtx_cnt = 0; 1267 int dtx_cnt = 0;
1277 unsigned long long mem_share; 1268 unsigned long long mem_share;
1278 int mem_size; 1269 int mem_size;
1279 1270 struct config_param *config = &nic->config;
1280 mac_control = &nic->mac_control; 1271 struct mac_info *mac_control = &nic->mac_control;
1281 config = &nic->config;
1282 1272
1283 /* to set the swapper controle on the card */ 1273 /* to set the swapper controle on the card */
1284 if (s2io_set_swapper(nic)) { 1274 if (s2io_set_swapper(nic)) {
@@ -2290,11 +2280,8 @@ static int start_nic(struct s2io_nic *nic)
2290 struct net_device *dev = nic->dev; 2280 struct net_device *dev = nic->dev;
2291 register u64 val64 = 0; 2281 register u64 val64 = 0;
2292 u16 subid, i; 2282 u16 subid, i;
2293 struct mac_info *mac_control; 2283 struct config_param *config = &nic->config;
2294 struct config_param *config; 2284 struct mac_info *mac_control = &nic->mac_control;
2295
2296 mac_control = &nic->mac_control;
2297 config = &nic->config;
2298 2285
2299 /* PRC Initialization and configuration */ 2286 /* PRC Initialization and configuration */
2300 for (i = 0; i < config->rx_ring_num; i++) { 2287 for (i = 0; i < config->rx_ring_num; i++) {
@@ -2446,12 +2433,11 @@ static void free_tx_buffers(struct s2io_nic *nic)
2446 struct sk_buff *skb; 2433 struct sk_buff *skb;
2447 struct TxD *txdp; 2434 struct TxD *txdp;
2448 int i, j; 2435 int i, j;
2449 struct mac_info *mac_control;
2450 struct config_param *config;
2451 int cnt = 0; 2436 int cnt = 0;
2452 2437 struct config_param *config = &nic->config;
2453 mac_control = &nic->mac_control; 2438 struct mac_info *mac_control = &nic->mac_control;
2454 config = &nic->config; 2439 struct stat_block *stats = mac_control->stats_info;
2440 struct swStat *swstats = &stats->sw_stat;
2455 2441
2456 for (i = 0; i < config->tx_fifo_num; i++) { 2442 for (i = 0; i < config->tx_fifo_num; i++) {
2457 struct tx_fifo_config *tx_cfg = &config->tx_cfg[i]; 2443 struct tx_fifo_config *tx_cfg = &config->tx_cfg[i];
@@ -2463,8 +2449,7 @@ static void free_tx_buffers(struct s2io_nic *nic)
2463 txdp = (struct TxD *)fifo->list_info[j].list_virt_addr; 2449 txdp = (struct TxD *)fifo->list_info[j].list_virt_addr;
2464 skb = s2io_txdl_getskb(&mac_control->fifos[i], txdp, j); 2450 skb = s2io_txdl_getskb(&mac_control->fifos[i], txdp, j);
2465 if (skb) { 2451 if (skb) {
2466 nic->mac_control.stats_info->sw_stat.mem_freed 2452 swstats->mem_freed += skb->truesize;
2467 += skb->truesize;
2468 dev_kfree_skb(skb); 2453 dev_kfree_skb(skb);
2469 cnt++; 2454 cnt++;
2470 } 2455 }
@@ -2493,11 +2478,6 @@ static void stop_nic(struct s2io_nic *nic)
2493 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2478 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2494 register u64 val64 = 0; 2479 register u64 val64 = 0;
2495 u16 interruptible; 2480 u16 interruptible;
2496 struct mac_info *mac_control;
2497 struct config_param *config;
2498
2499 mac_control = &nic->mac_control;
2500 config = &nic->config;
2501 2481
2502 /* Disable all interrupts */ 2482 /* Disable all interrupts */
2503 en_dis_err_alarms(nic, ENA_ALL_INTRS, DISABLE_INTRS); 2483 en_dis_err_alarms(nic, ENA_ALL_INTRS, DISABLE_INTRS);
@@ -2548,7 +2528,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
2548 int rxd_index = 0; 2528 int rxd_index = 0;
2549 struct RxD1 *rxdp1; 2529 struct RxD1 *rxdp1;
2550 struct RxD3 *rxdp3; 2530 struct RxD3 *rxdp3;
2551 struct swStat *stats = &ring->nic->mac_control.stats_info->sw_stat; 2531 struct swStat *swstats = &ring->nic->mac_control.stats_info->sw_stat;
2552 2532
2553 alloc_cnt = ring->pkt_cnt - ring->rx_bufs_left; 2533 alloc_cnt = ring->pkt_cnt - ring->rx_bufs_left;
2554 2534
@@ -2609,11 +2589,11 @@ static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
2609 wmb(); 2589 wmb();
2610 first_rxdp->Control_1 |= RXD_OWN_XENA; 2590 first_rxdp->Control_1 |= RXD_OWN_XENA;
2611 } 2591 }
2612 stats->mem_alloc_fail_cnt++; 2592 swstats->mem_alloc_fail_cnt++;
2613 2593
2614 return -ENOMEM ; 2594 return -ENOMEM ;
2615 } 2595 }
2616 stats->mem_allocated += skb->truesize; 2596 swstats->mem_allocated += skb->truesize;
2617 2597
2618 if (ring->rxd_mode == RXD_MODE_1) { 2598 if (ring->rxd_mode == RXD_MODE_1) {
2619 /* 1 buffer mode - normal operation mode */ 2599 /* 1 buffer mode - normal operation mode */
@@ -2742,8 +2722,8 @@ end:
2742 return SUCCESS; 2722 return SUCCESS;
2743 2723
2744pci_map_failed: 2724pci_map_failed:
2745 stats->pci_map_fail_cnt++; 2725 swstats->pci_map_fail_cnt++;
2746 stats->mem_freed += skb->truesize; 2726 swstats->mem_freed += skb->truesize;
2747 dev_kfree_skb_irq(skb); 2727 dev_kfree_skb_irq(skb);
2748 return -ENOMEM; 2728 return -ENOMEM;
2749} 2729}
@@ -2754,12 +2734,13 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
2754 int j; 2734 int j;
2755 struct sk_buff *skb; 2735 struct sk_buff *skb;
2756 struct RxD_t *rxdp; 2736 struct RxD_t *rxdp;
2757 struct mac_info *mac_control;
2758 struct buffAdd *ba; 2737 struct buffAdd *ba;
2759 struct RxD1 *rxdp1; 2738 struct RxD1 *rxdp1;
2760 struct RxD3 *rxdp3; 2739 struct RxD3 *rxdp3;
2740 struct mac_info *mac_control = &sp->mac_control;
2741 struct stat_block *stats = mac_control->stats_info;
2742 struct swStat *swstats = &stats->sw_stat;
2761 2743
2762 mac_control = &sp->mac_control;
2763 for (j = 0 ; j < rxd_count[sp->rxd_mode]; j++) { 2744 for (j = 0 ; j < rxd_count[sp->rxd_mode]; j++) {
2764 rxdp = mac_control->rings[ring_no]. 2745 rxdp = mac_control->rings[ring_no].
2765 rx_blocks[blk].rxds[j].virt_addr; 2746 rx_blocks[blk].rxds[j].virt_addr;
@@ -2792,7 +2773,7 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
2792 PCI_DMA_FROMDEVICE); 2773 PCI_DMA_FROMDEVICE);
2793 memset(rxdp, 0, sizeof(struct RxD3)); 2774 memset(rxdp, 0, sizeof(struct RxD3));
2794 } 2775 }
2795 sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 2776 swstats->mem_freed += skb->truesize;
2796 dev_kfree_skb(skb); 2777 dev_kfree_skb(skb);
2797 mac_control->rings[ring_no].rx_bufs_left -= 1; 2778 mac_control->rings[ring_no].rx_bufs_left -= 1;
2798 } 2779 }
@@ -2811,11 +2792,8 @@ static void free_rx_buffers(struct s2io_nic *sp)
2811{ 2792{
2812 struct net_device *dev = sp->dev; 2793 struct net_device *dev = sp->dev;
2813 int i, blk = 0, buf_cnt = 0; 2794 int i, blk = 0, buf_cnt = 0;
2814 struct mac_info *mac_control; 2795 struct config_param *config = &sp->config;
2815 struct config_param *config; 2796 struct mac_info *mac_control = &sp->mac_control;
2816
2817 mac_control = &sp->mac_control;
2818 config = &sp->config;
2819 2797
2820 for (i = 0; i < config->rx_ring_num; i++) { 2798 for (i = 0; i < config->rx_ring_num; i++) {
2821 struct ring_info *ring = &mac_control->rings[i]; 2799 struct ring_info *ring = &mac_control->rings[i];
@@ -2859,8 +2837,6 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
2859{ 2837{
2860 struct ring_info *ring = container_of(napi, struct ring_info, napi); 2838 struct ring_info *ring = container_of(napi, struct ring_info, napi);
2861 struct net_device *dev = ring->dev; 2839 struct net_device *dev = ring->dev;
2862 struct config_param *config;
2863 struct mac_info *mac_control;
2864 int pkts_processed = 0; 2840 int pkts_processed = 0;
2865 u8 __iomem *addr = NULL; 2841 u8 __iomem *addr = NULL;
2866 u8 val8 = 0; 2842 u8 val8 = 0;
@@ -2868,9 +2844,6 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
2868 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2844 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2869 int budget_org = budget; 2845 int budget_org = budget;
2870 2846
2871 config = &nic->config;
2872 mac_control = &nic->mac_control;
2873
2874 if (unlikely(!is_s2io_card_up(nic))) 2847 if (unlikely(!is_s2io_card_up(nic)))
2875 return 0; 2848 return 0;
2876 2849
@@ -2892,15 +2865,12 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
2892static int s2io_poll_inta(struct napi_struct *napi, int budget) 2865static int s2io_poll_inta(struct napi_struct *napi, int budget)
2893{ 2866{
2894 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi); 2867 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi);
2895 struct config_param *config;
2896 struct mac_info *mac_control;
2897 int pkts_processed = 0; 2868 int pkts_processed = 0;
2898 int ring_pkts_processed, i; 2869 int ring_pkts_processed, i;
2899 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2870 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2900 int budget_org = budget; 2871 int budget_org = budget;
2901 2872 struct config_param *config = &nic->config;
2902 config = &nic->config; 2873 struct mac_info *mac_control = &nic->mac_control;
2903 mac_control = &nic->mac_control;
2904 2874
2905 if (unlikely(!is_s2io_card_up(nic))) 2875 if (unlikely(!is_s2io_card_up(nic)))
2906 return 0; 2876 return 0;
@@ -2936,20 +2906,17 @@ static int s2io_poll_inta(struct napi_struct *napi, int budget)
2936static void s2io_netpoll(struct net_device *dev) 2906static void s2io_netpoll(struct net_device *dev)
2937{ 2907{
2938 struct s2io_nic *nic = netdev_priv(dev); 2908 struct s2io_nic *nic = netdev_priv(dev);
2939 struct mac_info *mac_control;
2940 struct config_param *config;
2941 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2909 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2942 u64 val64 = 0xFFFFFFFFFFFFFFFFULL; 2910 u64 val64 = 0xFFFFFFFFFFFFFFFFULL;
2943 int i; 2911 int i;
2912 struct config_param *config = &nic->config;
2913 struct mac_info *mac_control = &nic->mac_control;
2944 2914
2945 if (pci_channel_offline(nic->pdev)) 2915 if (pci_channel_offline(nic->pdev))
2946 return; 2916 return;
2947 2917
2948 disable_irq(dev->irq); 2918 disable_irq(dev->irq);
2949 2919
2950 mac_control = &nic->mac_control;
2951 config = &nic->config;
2952
2953 writeq(val64, &bar0->rx_traffic_int); 2920 writeq(val64, &bar0->rx_traffic_int);
2954 writeq(val64, &bar0->tx_traffic_int); 2921 writeq(val64, &bar0->tx_traffic_int);
2955 2922
@@ -3110,6 +3077,8 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
3110 int pkt_cnt = 0; 3077 int pkt_cnt = 0;
3111 unsigned long flags = 0; 3078 unsigned long flags = 0;
3112 u8 err_mask; 3079 u8 err_mask;
3080 struct stat_block *stats = nic->mac_control.stats_info;
3081 struct swStat *swstats = &stats->sw_stat;
3113 3082
3114 if (!spin_trylock_irqsave(&fifo_data->tx_lock, flags)) 3083 if (!spin_trylock_irqsave(&fifo_data->tx_lock, flags))
3115 return; 3084 return;
@@ -3126,36 +3095,30 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
3126 unsigned long long err; 3095 unsigned long long err;
3127 err = txdlp->Control_1 & TXD_T_CODE; 3096 err = txdlp->Control_1 & TXD_T_CODE;
3128 if (err & 0x1) { 3097 if (err & 0x1) {
3129 nic->mac_control.stats_info->sw_stat. 3098 swstats->parity_err_cnt++;
3130 parity_err_cnt++;
3131 } 3099 }
3132 3100
3133 /* update t_code statistics */ 3101 /* update t_code statistics */
3134 err_mask = err >> 48; 3102 err_mask = err >> 48;
3135 switch (err_mask) { 3103 switch (err_mask) {
3136 case 2: 3104 case 2:
3137 nic->mac_control.stats_info->sw_stat. 3105 swstats->tx_buf_abort_cnt++;
3138 tx_buf_abort_cnt++;
3139 break; 3106 break;
3140 3107
3141 case 3: 3108 case 3:
3142 nic->mac_control.stats_info->sw_stat. 3109 swstats->tx_desc_abort_cnt++;
3143 tx_desc_abort_cnt++;
3144 break; 3110 break;
3145 3111
3146 case 7: 3112 case 7:
3147 nic->mac_control.stats_info->sw_stat. 3113 swstats->tx_parity_err_cnt++;
3148 tx_parity_err_cnt++;
3149 break; 3114 break;
3150 3115
3151 case 10: 3116 case 10:
3152 nic->mac_control.stats_info->sw_stat. 3117 swstats->tx_link_loss_cnt++;
3153 tx_link_loss_cnt++;
3154 break; 3118 break;
3155 3119
3156 case 15: 3120 case 15:
3157 nic->mac_control.stats_info->sw_stat. 3121 swstats->tx_list_proc_err_cnt++;
3158 tx_list_proc_err_cnt++;
3159 break; 3122 break;
3160 } 3123 }
3161 } 3124 }
@@ -3171,7 +3134,7 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
3171 3134
3172 /* Updating the statistics block */ 3135 /* Updating the statistics block */
3173 nic->dev->stats.tx_bytes += skb->len; 3136 nic->dev->stats.tx_bytes += skb->len;
3174 nic->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 3137 swstats->mem_freed += skb->truesize;
3175 dev_kfree_skb_irq(skb); 3138 dev_kfree_skb_irq(skb);
3176 3139
3177 get_info.offset++; 3140 get_info.offset++;
@@ -3350,7 +3313,8 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
3350 u64 addr = 0x0; 3313 u64 addr = 0x0;
3351 3314
3352 struct s2io_nic *sp = netdev_priv(dev); 3315 struct s2io_nic *sp = netdev_priv(dev);
3353 struct stat_block *stat_info = sp->mac_control.stats_info; 3316 struct stat_block *stats = sp->mac_control.stats_info;
3317 struct xpakStat *xstats = &stats->xpak_stat;
3354 3318
3355 /* Check the communication with the MDIO slave */ 3319 /* Check the communication with the MDIO slave */
3356 addr = MDIO_CTRL1; 3320 addr = MDIO_CTRL1;
@@ -3382,30 +3346,30 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
3382 3346
3383 flag = CHECKBIT(val64, 0x7); 3347 flag = CHECKBIT(val64, 0x7);
3384 type = 1; 3348 type = 1;
3385 s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_transceiver_temp_high, 3349 s2io_chk_xpak_counter(&xstats->alarm_transceiver_temp_high,
3386 &stat_info->xpak_stat.xpak_regs_stat, 3350 &xstats->xpak_regs_stat,
3387 0x0, flag, type); 3351 0x0, flag, type);
3388 3352
3389 if (CHECKBIT(val64, 0x6)) 3353 if (CHECKBIT(val64, 0x6))
3390 stat_info->xpak_stat.alarm_transceiver_temp_low++; 3354 xstats->alarm_transceiver_temp_low++;
3391 3355
3392 flag = CHECKBIT(val64, 0x3); 3356 flag = CHECKBIT(val64, 0x3);
3393 type = 2; 3357 type = 2;
3394 s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_laser_bias_current_high, 3358 s2io_chk_xpak_counter(&xstats->alarm_laser_bias_current_high,
3395 &stat_info->xpak_stat.xpak_regs_stat, 3359 &xstats->xpak_regs_stat,
3396 0x2, flag, type); 3360 0x2, flag, type);
3397 3361
3398 if (CHECKBIT(val64, 0x2)) 3362 if (CHECKBIT(val64, 0x2))
3399 stat_info->xpak_stat.alarm_laser_bias_current_low++; 3363 xstats->alarm_laser_bias_current_low++;
3400 3364
3401 flag = CHECKBIT(val64, 0x1); 3365 flag = CHECKBIT(val64, 0x1);
3402 type = 3; 3366 type = 3;
3403 s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_laser_output_power_high, 3367 s2io_chk_xpak_counter(&xstats->alarm_laser_output_power_high,
3404 &stat_info->xpak_stat.xpak_regs_stat, 3368 &xstats->xpak_regs_stat,
3405 0x4, flag, type); 3369 0x4, flag, type);
3406 3370
3407 if (CHECKBIT(val64, 0x0)) 3371 if (CHECKBIT(val64, 0x0))
3408 stat_info->xpak_stat.alarm_laser_output_power_low++; 3372 xstats->alarm_laser_output_power_low++;
3409 3373
3410 /* Reading the Warning flags */ 3374 /* Reading the Warning flags */
3411 addr = 0xA074; 3375 addr = 0xA074;
@@ -3413,22 +3377,22 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
3413 val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev); 3377 val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev);
3414 3378
3415 if (CHECKBIT(val64, 0x7)) 3379 if (CHECKBIT(val64, 0x7))
3416 stat_info->xpak_stat.warn_transceiver_temp_high++; 3380 xstats->warn_transceiver_temp_high++;
3417 3381
3418 if (CHECKBIT(val64, 0x6)) 3382 if (CHECKBIT(val64, 0x6))
3419 stat_info->xpak_stat.warn_transceiver_temp_low++; 3383 xstats->warn_transceiver_temp_low++;
3420 3384
3421 if (CHECKBIT(val64, 0x3)) 3385 if (CHECKBIT(val64, 0x3))
3422 stat_info->xpak_stat.warn_laser_bias_current_high++; 3386 xstats->warn_laser_bias_current_high++;
3423 3387
3424 if (CHECKBIT(val64, 0x2)) 3388 if (CHECKBIT(val64, 0x2))
3425 stat_info->xpak_stat.warn_laser_bias_current_low++; 3389 xstats->warn_laser_bias_current_low++;
3426 3390
3427 if (CHECKBIT(val64, 0x1)) 3391 if (CHECKBIT(val64, 0x1))
3428 stat_info->xpak_stat.warn_laser_output_power_high++; 3392 xstats->warn_laser_output_power_high++;
3429 3393
3430 if (CHECKBIT(val64, 0x0)) 3394 if (CHECKBIT(val64, 0x0))
3431 stat_info->xpak_stat.warn_laser_output_power_low++; 3395 xstats->warn_laser_output_power_low++;
3432} 3396}
3433 3397
3434/** 3398/**
@@ -3514,6 +3478,8 @@ static void s2io_reset(struct s2io_nic *sp)
3514 u16 val16; 3478 u16 val16;
3515 unsigned long long up_cnt, down_cnt, up_time, down_time, reset_cnt; 3479 unsigned long long up_cnt, down_cnt, up_time, down_time, reset_cnt;
3516 unsigned long long mem_alloc_cnt, mem_free_cnt, watchdog_cnt; 3480 unsigned long long mem_alloc_cnt, mem_free_cnt, watchdog_cnt;
3481 struct stat_block *stats;
3482 struct swStat *swstats;
3517 3483
3518 DBG_PRINT(INIT_DBG, "%s - Resetting XFrame card %s\n", 3484 DBG_PRINT(INIT_DBG, "%s - Resetting XFrame card %s\n",
3519 __func__, sp->dev->name); 3485 __func__, sp->dev->name);
@@ -3567,25 +3533,30 @@ static void s2io_reset(struct s2io_nic *sp)
3567 /* Reset device statistics maintained by OS */ 3533 /* Reset device statistics maintained by OS */
3568 memset(&sp->stats, 0, sizeof(struct net_device_stats)); 3534 memset(&sp->stats, 0, sizeof(struct net_device_stats));
3569 3535
3570 up_cnt = sp->mac_control.stats_info->sw_stat.link_up_cnt; 3536 stats = sp->mac_control.stats_info;
3571 down_cnt = sp->mac_control.stats_info->sw_stat.link_down_cnt; 3537 swstats = &stats->sw_stat;
3572 up_time = sp->mac_control.stats_info->sw_stat.link_up_time; 3538
3573 down_time = sp->mac_control.stats_info->sw_stat.link_down_time;
3574 reset_cnt = sp->mac_control.stats_info->sw_stat.soft_reset_cnt;
3575 mem_alloc_cnt = sp->mac_control.stats_info->sw_stat.mem_allocated;
3576 mem_free_cnt = sp->mac_control.stats_info->sw_stat.mem_freed;
3577 watchdog_cnt = sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt;
3578 /* save link up/down time/cnt, reset/memory/watchdog cnt */ 3539 /* save link up/down time/cnt, reset/memory/watchdog cnt */
3579 memset(sp->mac_control.stats_info, 0, sizeof(struct stat_block)); 3540 up_cnt = swstats->link_up_cnt;
3541 down_cnt = swstats->link_down_cnt;
3542 up_time = swstats->link_up_time;
3543 down_time = swstats->link_down_time;
3544 reset_cnt = swstats->soft_reset_cnt;
3545 mem_alloc_cnt = swstats->mem_allocated;
3546 mem_free_cnt = swstats->mem_freed;
3547 watchdog_cnt = swstats->watchdog_timer_cnt;
3548
3549 memset(stats, 0, sizeof(struct stat_block));
3550
3580 /* restore link up/down time/cnt, reset/memory/watchdog cnt */ 3551 /* restore link up/down time/cnt, reset/memory/watchdog cnt */
3581 sp->mac_control.stats_info->sw_stat.link_up_cnt = up_cnt; 3552 swstats->link_up_cnt = up_cnt;
3582 sp->mac_control.stats_info->sw_stat.link_down_cnt = down_cnt; 3553 swstats->link_down_cnt = down_cnt;
3583 sp->mac_control.stats_info->sw_stat.link_up_time = up_time; 3554 swstats->link_up_time = up_time;
3584 sp->mac_control.stats_info->sw_stat.link_down_time = down_time; 3555 swstats->link_down_time = down_time;
3585 sp->mac_control.stats_info->sw_stat.soft_reset_cnt = reset_cnt; 3556 swstats->soft_reset_cnt = reset_cnt;
3586 sp->mac_control.stats_info->sw_stat.mem_allocated = mem_alloc_cnt; 3557 swstats->mem_allocated = mem_alloc_cnt;
3587 sp->mac_control.stats_info->sw_stat.mem_freed = mem_free_cnt; 3558 swstats->mem_freed = mem_free_cnt;
3588 sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt = watchdog_cnt; 3559 swstats->watchdog_timer_cnt = watchdog_cnt;
3589 3560
3590 /* SXE-002: Configure link and activity LED to turn it off */ 3561 /* SXE-002: Configure link and activity LED to turn it off */
3591 subid = sp->pdev->subsystem_device; 3562 subid = sp->pdev->subsystem_device;
@@ -3827,29 +3798,31 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3827 u16 msi_control; /* Temp variable */ 3798 u16 msi_control; /* Temp variable */
3828 int ret, i, j, msix_indx = 1; 3799 int ret, i, j, msix_indx = 1;
3829 int size; 3800 int size;
3801 struct stat_block *stats = nic->mac_control.stats_info;
3802 struct swStat *swstats = &stats->sw_stat;
3830 3803
3831 size = nic->num_entries * sizeof(struct msix_entry); 3804 size = nic->num_entries * sizeof(struct msix_entry);
3832 nic->entries = kzalloc(size, GFP_KERNEL); 3805 nic->entries = kzalloc(size, GFP_KERNEL);
3833 if (!nic->entries) { 3806 if (!nic->entries) {
3834 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", 3807 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
3835 __func__); 3808 __func__);
3836 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 3809 swstats->mem_alloc_fail_cnt++;
3837 return -ENOMEM; 3810 return -ENOMEM;
3838 } 3811 }
3839 nic->mac_control.stats_info->sw_stat.mem_allocated += size; 3812 swstats->mem_allocated += size;
3840 3813
3841 size = nic->num_entries * sizeof(struct s2io_msix_entry); 3814 size = nic->num_entries * sizeof(struct s2io_msix_entry);
3842 nic->s2io_entries = kzalloc(size, GFP_KERNEL); 3815 nic->s2io_entries = kzalloc(size, GFP_KERNEL);
3843 if (!nic->s2io_entries) { 3816 if (!nic->s2io_entries) {
3844 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", 3817 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
3845 __func__); 3818 __func__);
3846 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 3819 swstats->mem_alloc_fail_cnt++;
3847 kfree(nic->entries); 3820 kfree(nic->entries);
3848 nic->mac_control.stats_info->sw_stat.mem_freed 3821 swstats->mem_freed
3849 += (nic->num_entries * sizeof(struct msix_entry)); 3822 += (nic->num_entries * sizeof(struct msix_entry));
3850 return -ENOMEM; 3823 return -ENOMEM;
3851 } 3824 }
3852 nic->mac_control.stats_info->sw_stat.mem_allocated += size; 3825 swstats->mem_allocated += size;
3853 3826
3854 nic->entries[0].entry = 0; 3827 nic->entries[0].entry = 0;
3855 nic->s2io_entries[0].entry = 0; 3828 nic->s2io_entries[0].entry = 0;
@@ -3880,11 +3853,11 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3880 if (ret) { 3853 if (ret) {
3881 DBG_PRINT(ERR_DBG, "s2io: Enabling MSI-X failed\n"); 3854 DBG_PRINT(ERR_DBG, "s2io: Enabling MSI-X failed\n");
3882 kfree(nic->entries); 3855 kfree(nic->entries);
3883 nic->mac_control.stats_info->sw_stat.mem_freed 3856 swstats->mem_freed += nic->num_entries *
3884 += (nic->num_entries * sizeof(struct msix_entry)); 3857 sizeof(struct msix_entry);
3885 kfree(nic->s2io_entries); 3858 kfree(nic->s2io_entries);
3886 nic->mac_control.stats_info->sw_stat.mem_freed 3859 swstats->mem_freed += nic->num_entries *
3887 += (nic->num_entries * sizeof(struct s2io_msix_entry)); 3860 sizeof(struct s2io_msix_entry);
3888 nic->entries = NULL; 3861 nic->entries = NULL;
3889 nic->s2io_entries = NULL; 3862 nic->s2io_entries = NULL;
3890 return -ENOMEM; 3863 return -ENOMEM;
@@ -4006,6 +3979,7 @@ static void remove_inta_isr(struct s2io_nic *sp)
4006static int s2io_open(struct net_device *dev) 3979static int s2io_open(struct net_device *dev)
4007{ 3980{
4008 struct s2io_nic *sp = netdev_priv(dev); 3981 struct s2io_nic *sp = netdev_priv(dev);
3982 struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
4009 int err = 0; 3983 int err = 0;
4010 3984
4011 /* 3985 /*
@@ -4036,13 +4010,13 @@ hw_init_failed:
4036 if (sp->config.intr_type == MSI_X) { 4010 if (sp->config.intr_type == MSI_X) {
4037 if (sp->entries) { 4011 if (sp->entries) {
4038 kfree(sp->entries); 4012 kfree(sp->entries);
4039 sp->mac_control.stats_info->sw_stat.mem_freed 4013 swstats->mem_freed += sp->num_entries *
4040 += (sp->num_entries * sizeof(struct msix_entry)); 4014 sizeof(struct msix_entry);
4041 } 4015 }
4042 if (sp->s2io_entries) { 4016 if (sp->s2io_entries) {
4043 kfree(sp->s2io_entries); 4017 kfree(sp->s2io_entries);
4044 sp->mac_control.stats_info->sw_stat.mem_freed 4018 swstats->mem_freed += sp->num_entries *
4045 += (sp->num_entries * sizeof(struct s2io_msix_entry)); 4019 sizeof(struct s2io_msix_entry);
4046 } 4020 }
4047 } 4021 }
4048 return err; 4022 return err;
@@ -4110,15 +4084,13 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
4110 unsigned long flags = 0; 4084 unsigned long flags = 0;
4111 u16 vlan_tag = 0; 4085 u16 vlan_tag = 0;
4112 struct fifo_info *fifo = NULL; 4086 struct fifo_info *fifo = NULL;
4113 struct mac_info *mac_control;
4114 struct config_param *config;
4115 int do_spin_lock = 1; 4087 int do_spin_lock = 1;
4116 int offload_type; 4088 int offload_type;
4117 int enable_per_list_interrupt = 0; 4089 int enable_per_list_interrupt = 0;
4118 struct swStat *stats = &sp->mac_control.stats_info->sw_stat; 4090 struct config_param *config = &sp->config;
4119 4091 struct mac_info *mac_control = &sp->mac_control;
4120 mac_control = &sp->mac_control; 4092 struct stat_block *stats = mac_control->stats_info;
4121 config = &sp->config; 4093 struct swStat *swstats = &stats->sw_stat;
4122 4094
4123 DBG_PRINT(TX_DBG, "%s: In Neterion Tx routine\n", dev->name); 4095 DBG_PRINT(TX_DBG, "%s: In Neterion Tx routine\n", dev->name);
4124 4096
@@ -4308,23 +4280,24 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
4308 4280
4309 /* Avoid "put" pointer going beyond "get" pointer */ 4281 /* Avoid "put" pointer going beyond "get" pointer */
4310 if (((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) { 4282 if (((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) {
4311 sp->mac_control.stats_info->sw_stat.fifo_full_cnt++; 4283 swstats->fifo_full_cnt++;
4312 DBG_PRINT(TX_DBG, 4284 DBG_PRINT(TX_DBG,
4313 "No free TxDs for xmit, Put: 0x%x Get:0x%x\n", 4285 "No free TxDs for xmit, Put: 0x%x Get:0x%x\n",
4314 put_off, get_off); 4286 put_off, get_off);
4315 s2io_stop_tx_queue(sp, fifo->fifo_no); 4287 s2io_stop_tx_queue(sp, fifo->fifo_no);
4316 } 4288 }
4317 mac_control->stats_info->sw_stat.mem_allocated += skb->truesize; 4289 swstats->mem_allocated += skb->truesize;
4318 spin_unlock_irqrestore(&fifo->tx_lock, flags); 4290 spin_unlock_irqrestore(&fifo->tx_lock, flags);
4319 4291
4320 if (sp->config.intr_type == MSI_X) 4292 if (sp->config.intr_type == MSI_X)
4321 tx_intr_handler(fifo); 4293 tx_intr_handler(fifo);
4322 4294
4323 return NETDEV_TX_OK; 4295 return NETDEV_TX_OK;
4296
4324pci_map_failed: 4297pci_map_failed:
4325 stats->pci_map_fail_cnt++; 4298 swstats->pci_map_fail_cnt++;
4326 s2io_stop_tx_queue(sp, fifo->fifo_no); 4299 s2io_stop_tx_queue(sp, fifo->fifo_no);
4327 stats->mem_freed += skb->truesize; 4300 swstats->mem_freed += skb->truesize;
4328 dev_kfree_skb(skb); 4301 dev_kfree_skb(skb);
4329 spin_unlock_irqrestore(&fifo->tx_lock, flags); 4302 spin_unlock_irqrestore(&fifo->tx_lock, flags);
4330 return NETDEV_TX_OK; 4303 return NETDEV_TX_OK;
@@ -4816,8 +4789,8 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
4816 if (!is_s2io_card_up(sp)) 4789 if (!is_s2io_card_up(sp))
4817 return IRQ_NONE; 4790 return IRQ_NONE;
4818 4791
4819 mac_control = &sp->mac_control;
4820 config = &sp->config; 4792 config = &sp->config;
4793 mac_control = &sp->mac_control;
4821 4794
4822 /* 4795 /*
4823 * Identify the cause for interrupt and call the appropriate 4796 * Identify the cause for interrupt and call the appropriate
@@ -4934,44 +4907,35 @@ static void s2io_updt_stats(struct s2io_nic *sp)
4934static struct net_device_stats *s2io_get_stats(struct net_device *dev) 4907static struct net_device_stats *s2io_get_stats(struct net_device *dev)
4935{ 4908{
4936 struct s2io_nic *sp = netdev_priv(dev); 4909 struct s2io_nic *sp = netdev_priv(dev);
4937 struct mac_info *mac_control; 4910 struct config_param *config = &sp->config;
4938 struct config_param *config; 4911 struct mac_info *mac_control = &sp->mac_control;
4912 struct stat_block *stats = mac_control->stats_info;
4939 int i; 4913 int i;
4940 4914
4941
4942 mac_control = &sp->mac_control;
4943 config = &sp->config;
4944
4945 /* Configure Stats for immediate updt */ 4915 /* Configure Stats for immediate updt */
4946 s2io_updt_stats(sp); 4916 s2io_updt_stats(sp);
4947 4917
4948 /* Using sp->stats as a staging area, because reset (due to mtu 4918 /* Using sp->stats as a staging area, because reset (due to mtu
4949 change, for example) will clear some hardware counters */ 4919 change, for example) will clear some hardware counters */
4950 dev->stats.tx_packets += 4920 dev->stats.tx_packets += le32_to_cpu(stats->tmac_frms) -
4951 le32_to_cpu(mac_control->stats_info->tmac_frms) -
4952 sp->stats.tx_packets; 4921 sp->stats.tx_packets;
4953 sp->stats.tx_packets = 4922 sp->stats.tx_packets = le32_to_cpu(stats->tmac_frms);
4954 le32_to_cpu(mac_control->stats_info->tmac_frms); 4923
4955 dev->stats.tx_errors += 4924 dev->stats.tx_errors += le32_to_cpu(stats->tmac_any_err_frms) -
4956 le32_to_cpu(mac_control->stats_info->tmac_any_err_frms) -
4957 sp->stats.tx_errors; 4925 sp->stats.tx_errors;
4958 sp->stats.tx_errors = 4926 sp->stats.tx_errors = le32_to_cpu(stats->tmac_any_err_frms);
4959 le32_to_cpu(mac_control->stats_info->tmac_any_err_frms); 4927
4960 dev->stats.rx_errors += 4928 dev->stats.rx_errors += le64_to_cpu(stats->rmac_drop_frms) -
4961 le64_to_cpu(mac_control->stats_info->rmac_drop_frms) -
4962 sp->stats.rx_errors; 4929 sp->stats.rx_errors;
4963 sp->stats.rx_errors = 4930 sp->stats.rx_errors = le64_to_cpu(stats->rmac_drop_frms);
4964 le64_to_cpu(mac_control->stats_info->rmac_drop_frms); 4931
4965 dev->stats.multicast = 4932 dev->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms) -
4966 le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms) -
4967 sp->stats.multicast; 4933 sp->stats.multicast;
4968 sp->stats.multicast = 4934 sp->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms);
4969 le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms); 4935
4970 dev->stats.rx_length_errors = 4936 dev->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms) -
4971 le64_to_cpu(mac_control->stats_info->rmac_long_frms) -
4972 sp->stats.rx_length_errors; 4937 sp->stats.rx_length_errors;
4973 sp->stats.rx_length_errors = 4938 sp->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms);
4974 le64_to_cpu(mac_control->stats_info->rmac_long_frms);
4975 4939
4976 /* collect per-ring rx_packets and rx_bytes */ 4940 /* collect per-ring rx_packets and rx_bytes */
4977 dev->stats.rx_packets = dev->stats.rx_bytes = 0; 4941 dev->stats.rx_packets = dev->stats.rx_bytes = 0;
@@ -5803,6 +5767,7 @@ static void s2io_vpd_read(struct s2io_nic *nic)
5803 u8 data; 5767 u8 data;
5804 int i = 0, cnt, fail = 0; 5768 int i = 0, cnt, fail = 0;
5805 int vpd_addr = 0x80; 5769 int vpd_addr = 0x80;
5770 struct swStat *swstats = &nic->mac_control.stats_info->sw_stat;
5806 5771
5807 if (nic->device_type == XFRAME_II_DEVICE) { 5772 if (nic->device_type == XFRAME_II_DEVICE) {
5808 strcpy(nic->product_name, "Xframe II 10GbE network adapter"); 5773 strcpy(nic->product_name, "Xframe II 10GbE network adapter");
@@ -5815,10 +5780,10 @@ static void s2io_vpd_read(struct s2io_nic *nic)
5815 5780
5816 vpd_data = kmalloc(256, GFP_KERNEL); 5781 vpd_data = kmalloc(256, GFP_KERNEL);
5817 if (!vpd_data) { 5782 if (!vpd_data) {
5818 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 5783 swstats->mem_alloc_fail_cnt++;
5819 return; 5784 return;
5820 } 5785 }
5821 nic->mac_control.stats_info->sw_stat.mem_allocated += 256; 5786 swstats->mem_allocated += 256;
5822 5787
5823 for (i = 0; i < 256; i += 4) { 5788 for (i = 0; i < 256; i += 4) {
5824 pci_write_config_byte(nic->pdev, (vpd_addr + 2), i); 5789 pci_write_config_byte(nic->pdev, (vpd_addr + 2), i);
@@ -5858,7 +5823,7 @@ static void s2io_vpd_read(struct s2io_nic *nic)
5858 memcpy(nic->product_name, &vpd_data[3], vpd_data[1]); 5823 memcpy(nic->product_name, &vpd_data[3], vpd_data[1]);
5859 } 5824 }
5860 kfree(vpd_data); 5825 kfree(vpd_data);
5861 nic->mac_control.stats_info->sw_stat.mem_freed += 256; 5826 swstats->mem_freed += 256;
5862} 5827}
5863 5828
5864/** 5829/**
@@ -6350,273 +6315,275 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
6350{ 6315{
6351 int i = 0, k; 6316 int i = 0, k;
6352 struct s2io_nic *sp = netdev_priv(dev); 6317 struct s2io_nic *sp = netdev_priv(dev);
6353 struct stat_block *stat_info = sp->mac_control.stats_info; 6318 struct stat_block *stats = sp->mac_control.stats_info;
6319 struct swStat *swstats = &stats->sw_stat;
6320 struct xpakStat *xstats = &stats->xpak_stat;
6354 6321
6355 s2io_updt_stats(sp); 6322 s2io_updt_stats(sp);
6356 tmp_stats[i++] = 6323 tmp_stats[i++] =
6357 (u64)le32_to_cpu(stat_info->tmac_frms_oflow) << 32 | 6324 (u64)le32_to_cpu(stats->tmac_frms_oflow) << 32 |
6358 le32_to_cpu(stat_info->tmac_frms); 6325 le32_to_cpu(stats->tmac_frms);
6359 tmp_stats[i++] = 6326 tmp_stats[i++] =
6360 (u64)le32_to_cpu(stat_info->tmac_data_octets_oflow) << 32 | 6327 (u64)le32_to_cpu(stats->tmac_data_octets_oflow) << 32 |
6361 le32_to_cpu(stat_info->tmac_data_octets); 6328 le32_to_cpu(stats->tmac_data_octets);
6362 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_drop_frms); 6329 tmp_stats[i++] = le64_to_cpu(stats->tmac_drop_frms);
6363 tmp_stats[i++] = 6330 tmp_stats[i++] =
6364 (u64)le32_to_cpu(stat_info->tmac_mcst_frms_oflow) << 32 | 6331 (u64)le32_to_cpu(stats->tmac_mcst_frms_oflow) << 32 |
6365 le32_to_cpu(stat_info->tmac_mcst_frms); 6332 le32_to_cpu(stats->tmac_mcst_frms);
6366 tmp_stats[i++] = 6333 tmp_stats[i++] =
6367 (u64)le32_to_cpu(stat_info->tmac_bcst_frms_oflow) << 32 | 6334 (u64)le32_to_cpu(stats->tmac_bcst_frms_oflow) << 32 |
6368 le32_to_cpu(stat_info->tmac_bcst_frms); 6335 le32_to_cpu(stats->tmac_bcst_frms);
6369 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_pause_ctrl_frms); 6336 tmp_stats[i++] = le64_to_cpu(stats->tmac_pause_ctrl_frms);
6370 tmp_stats[i++] = 6337 tmp_stats[i++] =
6371 (u64)le32_to_cpu(stat_info->tmac_ttl_octets_oflow) << 32 | 6338 (u64)le32_to_cpu(stats->tmac_ttl_octets_oflow) << 32 |
6372 le32_to_cpu(stat_info->tmac_ttl_octets); 6339 le32_to_cpu(stats->tmac_ttl_octets);
6373 tmp_stats[i++] = 6340 tmp_stats[i++] =
6374 (u64)le32_to_cpu(stat_info->tmac_ucst_frms_oflow) << 32 | 6341 (u64)le32_to_cpu(stats->tmac_ucst_frms_oflow) << 32 |
6375 le32_to_cpu(stat_info->tmac_ucst_frms); 6342 le32_to_cpu(stats->tmac_ucst_frms);
6376 tmp_stats[i++] = 6343 tmp_stats[i++] =
6377 (u64)le32_to_cpu(stat_info->tmac_nucst_frms_oflow) << 32 | 6344 (u64)le32_to_cpu(stats->tmac_nucst_frms_oflow) << 32 |
6378 le32_to_cpu(stat_info->tmac_nucst_frms); 6345 le32_to_cpu(stats->tmac_nucst_frms);
6379 tmp_stats[i++] = 6346 tmp_stats[i++] =
6380 (u64)le32_to_cpu(stat_info->tmac_any_err_frms_oflow) << 32 | 6347 (u64)le32_to_cpu(stats->tmac_any_err_frms_oflow) << 32 |
6381 le32_to_cpu(stat_info->tmac_any_err_frms); 6348 le32_to_cpu(stats->tmac_any_err_frms);
6382 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_ttl_less_fb_octets); 6349 tmp_stats[i++] = le64_to_cpu(stats->tmac_ttl_less_fb_octets);
6383 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_vld_ip_octets); 6350 tmp_stats[i++] = le64_to_cpu(stats->tmac_vld_ip_octets);
6384 tmp_stats[i++] = 6351 tmp_stats[i++] =
6385 (u64)le32_to_cpu(stat_info->tmac_vld_ip_oflow) << 32 | 6352 (u64)le32_to_cpu(stats->tmac_vld_ip_oflow) << 32 |
6386 le32_to_cpu(stat_info->tmac_vld_ip); 6353 le32_to_cpu(stats->tmac_vld_ip);
6387 tmp_stats[i++] = 6354 tmp_stats[i++] =
6388 (u64)le32_to_cpu(stat_info->tmac_drop_ip_oflow) << 32 | 6355 (u64)le32_to_cpu(stats->tmac_drop_ip_oflow) << 32 |
6389 le32_to_cpu(stat_info->tmac_drop_ip); 6356 le32_to_cpu(stats->tmac_drop_ip);
6390 tmp_stats[i++] = 6357 tmp_stats[i++] =
6391 (u64)le32_to_cpu(stat_info->tmac_icmp_oflow) << 32 | 6358 (u64)le32_to_cpu(stats->tmac_icmp_oflow) << 32 |
6392 le32_to_cpu(stat_info->tmac_icmp); 6359 le32_to_cpu(stats->tmac_icmp);
6393 tmp_stats[i++] = 6360 tmp_stats[i++] =
6394 (u64)le32_to_cpu(stat_info->tmac_rst_tcp_oflow) << 32 | 6361 (u64)le32_to_cpu(stats->tmac_rst_tcp_oflow) << 32 |
6395 le32_to_cpu(stat_info->tmac_rst_tcp); 6362 le32_to_cpu(stats->tmac_rst_tcp);
6396 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_tcp); 6363 tmp_stats[i++] = le64_to_cpu(stats->tmac_tcp);
6397 tmp_stats[i++] = (u64)le32_to_cpu(stat_info->tmac_udp_oflow) << 32 | 6364 tmp_stats[i++] = (u64)le32_to_cpu(stats->tmac_udp_oflow) << 32 |
6398 le32_to_cpu(stat_info->tmac_udp); 6365 le32_to_cpu(stats->tmac_udp);
6399 tmp_stats[i++] = 6366 tmp_stats[i++] =
6400 (u64)le32_to_cpu(stat_info->rmac_vld_frms_oflow) << 32 | 6367 (u64)le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 |
6401 le32_to_cpu(stat_info->rmac_vld_frms); 6368 le32_to_cpu(stats->rmac_vld_frms);
6402 tmp_stats[i++] = 6369 tmp_stats[i++] =
6403 (u64)le32_to_cpu(stat_info->rmac_data_octets_oflow) << 32 | 6370 (u64)le32_to_cpu(stats->rmac_data_octets_oflow) << 32 |
6404 le32_to_cpu(stat_info->rmac_data_octets); 6371 le32_to_cpu(stats->rmac_data_octets);
6405 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_fcs_err_frms); 6372 tmp_stats[i++] = le64_to_cpu(stats->rmac_fcs_err_frms);
6406 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_drop_frms); 6373 tmp_stats[i++] = le64_to_cpu(stats->rmac_drop_frms);
6407 tmp_stats[i++] = 6374 tmp_stats[i++] =
6408 (u64)le32_to_cpu(stat_info->rmac_vld_mcst_frms_oflow) << 32 | 6375 (u64)le32_to_cpu(stats->rmac_vld_mcst_frms_oflow) << 32 |
6409 le32_to_cpu(stat_info->rmac_vld_mcst_frms); 6376 le32_to_cpu(stats->rmac_vld_mcst_frms);
6410 tmp_stats[i++] = 6377 tmp_stats[i++] =
6411 (u64)le32_to_cpu(stat_info->rmac_vld_bcst_frms_oflow) << 32 | 6378 (u64)le32_to_cpu(stats->rmac_vld_bcst_frms_oflow) << 32 |
6412 le32_to_cpu(stat_info->rmac_vld_bcst_frms); 6379 le32_to_cpu(stats->rmac_vld_bcst_frms);
6413 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_in_rng_len_err_frms); 6380 tmp_stats[i++] = le32_to_cpu(stats->rmac_in_rng_len_err_frms);
6414 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_out_rng_len_err_frms); 6381 tmp_stats[i++] = le32_to_cpu(stats->rmac_out_rng_len_err_frms);
6415 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_long_frms); 6382 tmp_stats[i++] = le64_to_cpu(stats->rmac_long_frms);
6416 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_pause_ctrl_frms); 6383 tmp_stats[i++] = le64_to_cpu(stats->rmac_pause_ctrl_frms);
6417 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_unsup_ctrl_frms); 6384 tmp_stats[i++] = le64_to_cpu(stats->rmac_unsup_ctrl_frms);
6418 tmp_stats[i++] = 6385 tmp_stats[i++] =
6419 (u64)le32_to_cpu(stat_info->rmac_ttl_octets_oflow) << 32 | 6386 (u64)le32_to_cpu(stats->rmac_ttl_octets_oflow) << 32 |
6420 le32_to_cpu(stat_info->rmac_ttl_octets); 6387 le32_to_cpu(stats->rmac_ttl_octets);
6421 tmp_stats[i++] = 6388 tmp_stats[i++] =
6422 (u64)le32_to_cpu(stat_info->rmac_accepted_ucst_frms_oflow) << 32 6389 (u64)le32_to_cpu(stats->rmac_accepted_ucst_frms_oflow) << 32
6423 | le32_to_cpu(stat_info->rmac_accepted_ucst_frms); 6390 | le32_to_cpu(stats->rmac_accepted_ucst_frms);
6424 tmp_stats[i++] = 6391 tmp_stats[i++] =
6425 (u64)le32_to_cpu(stat_info->rmac_accepted_nucst_frms_oflow) 6392 (u64)le32_to_cpu(stats->rmac_accepted_nucst_frms_oflow)
6426 << 32 | le32_to_cpu(stat_info->rmac_accepted_nucst_frms); 6393 << 32 | le32_to_cpu(stats->rmac_accepted_nucst_frms);
6427 tmp_stats[i++] = 6394 tmp_stats[i++] =
6428 (u64)le32_to_cpu(stat_info->rmac_discarded_frms_oflow) << 32 | 6395 (u64)le32_to_cpu(stats->rmac_discarded_frms_oflow) << 32 |
6429 le32_to_cpu(stat_info->rmac_discarded_frms); 6396 le32_to_cpu(stats->rmac_discarded_frms);
6430 tmp_stats[i++] = 6397 tmp_stats[i++] =
6431 (u64)le32_to_cpu(stat_info->rmac_drop_events_oflow) 6398 (u64)le32_to_cpu(stats->rmac_drop_events_oflow)
6432 << 32 | le32_to_cpu(stat_info->rmac_drop_events); 6399 << 32 | le32_to_cpu(stats->rmac_drop_events);
6433 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_less_fb_octets); 6400 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_less_fb_octets);
6434 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_frms); 6401 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_frms);
6435 tmp_stats[i++] = 6402 tmp_stats[i++] =
6436 (u64)le32_to_cpu(stat_info->rmac_usized_frms_oflow) << 32 | 6403 (u64)le32_to_cpu(stats->rmac_usized_frms_oflow) << 32 |
6437 le32_to_cpu(stat_info->rmac_usized_frms); 6404 le32_to_cpu(stats->rmac_usized_frms);
6438 tmp_stats[i++] = 6405 tmp_stats[i++] =
6439 (u64)le32_to_cpu(stat_info->rmac_osized_frms_oflow) << 32 | 6406 (u64)le32_to_cpu(stats->rmac_osized_frms_oflow) << 32 |
6440 le32_to_cpu(stat_info->rmac_osized_frms); 6407 le32_to_cpu(stats->rmac_osized_frms);
6441 tmp_stats[i++] = 6408 tmp_stats[i++] =
6442 (u64)le32_to_cpu(stat_info->rmac_frag_frms_oflow) << 32 | 6409 (u64)le32_to_cpu(stats->rmac_frag_frms_oflow) << 32 |
6443 le32_to_cpu(stat_info->rmac_frag_frms); 6410 le32_to_cpu(stats->rmac_frag_frms);
6444 tmp_stats[i++] = 6411 tmp_stats[i++] =
6445 (u64)le32_to_cpu(stat_info->rmac_jabber_frms_oflow) << 32 | 6412 (u64)le32_to_cpu(stats->rmac_jabber_frms_oflow) << 32 |
6446 le32_to_cpu(stat_info->rmac_jabber_frms); 6413 le32_to_cpu(stats->rmac_jabber_frms);
6447 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_64_frms); 6414 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_64_frms);
6448 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_65_127_frms); 6415 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_65_127_frms);
6449 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_128_255_frms); 6416 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_128_255_frms);
6450 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_256_511_frms); 6417 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_256_511_frms);
6451 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_512_1023_frms); 6418 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_512_1023_frms);
6452 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_1024_1518_frms); 6419 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_1024_1518_frms);
6453 tmp_stats[i++] = 6420 tmp_stats[i++] =
6454 (u64)le32_to_cpu(stat_info->rmac_ip_oflow) << 32 | 6421 (u64)le32_to_cpu(stats->rmac_ip_oflow) << 32 |
6455 le32_to_cpu(stat_info->rmac_ip); 6422 le32_to_cpu(stats->rmac_ip);
6456 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ip_octets); 6423 tmp_stats[i++] = le64_to_cpu(stats->rmac_ip_octets);
6457 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_hdr_err_ip); 6424 tmp_stats[i++] = le32_to_cpu(stats->rmac_hdr_err_ip);
6458 tmp_stats[i++] = 6425 tmp_stats[i++] =
6459 (u64)le32_to_cpu(stat_info->rmac_drop_ip_oflow) << 32 | 6426 (u64)le32_to_cpu(stats->rmac_drop_ip_oflow) << 32 |
6460 le32_to_cpu(stat_info->rmac_drop_ip); 6427 le32_to_cpu(stats->rmac_drop_ip);
6461 tmp_stats[i++] = 6428 tmp_stats[i++] =
6462 (u64)le32_to_cpu(stat_info->rmac_icmp_oflow) << 32 | 6429 (u64)le32_to_cpu(stats->rmac_icmp_oflow) << 32 |
6463 le32_to_cpu(stat_info->rmac_icmp); 6430 le32_to_cpu(stats->rmac_icmp);
6464 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_tcp); 6431 tmp_stats[i++] = le64_to_cpu(stats->rmac_tcp);
6465 tmp_stats[i++] = 6432 tmp_stats[i++] =
6466 (u64)le32_to_cpu(stat_info->rmac_udp_oflow) << 32 | 6433 (u64)le32_to_cpu(stats->rmac_udp_oflow) << 32 |
6467 le32_to_cpu(stat_info->rmac_udp); 6434 le32_to_cpu(stats->rmac_udp);
6468 tmp_stats[i++] = 6435 tmp_stats[i++] =
6469 (u64)le32_to_cpu(stat_info->rmac_err_drp_udp_oflow) << 32 | 6436 (u64)le32_to_cpu(stats->rmac_err_drp_udp_oflow) << 32 |
6470 le32_to_cpu(stat_info->rmac_err_drp_udp); 6437 le32_to_cpu(stats->rmac_err_drp_udp);
6471 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_err_sym); 6438 tmp_stats[i++] = le64_to_cpu(stats->rmac_xgmii_err_sym);
6472 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q0); 6439 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q0);
6473 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q1); 6440 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q1);
6474 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q2); 6441 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q2);
6475 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q3); 6442 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q3);
6476 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q4); 6443 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q4);
6477 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q5); 6444 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q5);
6478 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q6); 6445 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q6);
6479 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q7); 6446 tmp_stats[i++] = le64_to_cpu(stats->rmac_frms_q7);
6480 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q0); 6447 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q0);
6481 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q1); 6448 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q1);
6482 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q2); 6449 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q2);
6483 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q3); 6450 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q3);
6484 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q4); 6451 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q4);
6485 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q5); 6452 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q5);
6486 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q6); 6453 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q6);
6487 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q7); 6454 tmp_stats[i++] = le16_to_cpu(stats->rmac_full_q7);
6488 tmp_stats[i++] = 6455 tmp_stats[i++] =
6489 (u64)le32_to_cpu(stat_info->rmac_pause_cnt_oflow) << 32 | 6456 (u64)le32_to_cpu(stats->rmac_pause_cnt_oflow) << 32 |
6490 le32_to_cpu(stat_info->rmac_pause_cnt); 6457 le32_to_cpu(stats->rmac_pause_cnt);
6491 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_data_err_cnt); 6458 tmp_stats[i++] = le64_to_cpu(stats->rmac_xgmii_data_err_cnt);
6492 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_ctrl_err_cnt); 6459 tmp_stats[i++] = le64_to_cpu(stats->rmac_xgmii_ctrl_err_cnt);
6493 tmp_stats[i++] = 6460 tmp_stats[i++] =
6494 (u64)le32_to_cpu(stat_info->rmac_accepted_ip_oflow) << 32 | 6461 (u64)le32_to_cpu(stats->rmac_accepted_ip_oflow) << 32 |
6495 le32_to_cpu(stat_info->rmac_accepted_ip); 6462 le32_to_cpu(stats->rmac_accepted_ip);
6496 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_err_tcp); 6463 tmp_stats[i++] = le32_to_cpu(stats->rmac_err_tcp);
6497 tmp_stats[i++] = le32_to_cpu(stat_info->rd_req_cnt); 6464 tmp_stats[i++] = le32_to_cpu(stats->rd_req_cnt);
6498 tmp_stats[i++] = le32_to_cpu(stat_info->new_rd_req_cnt); 6465 tmp_stats[i++] = le32_to_cpu(stats->new_rd_req_cnt);
6499 tmp_stats[i++] = le32_to_cpu(stat_info->new_rd_req_rtry_cnt); 6466 tmp_stats[i++] = le32_to_cpu(stats->new_rd_req_rtry_cnt);
6500 tmp_stats[i++] = le32_to_cpu(stat_info->rd_rtry_cnt); 6467 tmp_stats[i++] = le32_to_cpu(stats->rd_rtry_cnt);
6501 tmp_stats[i++] = le32_to_cpu(stat_info->wr_rtry_rd_ack_cnt); 6468 tmp_stats[i++] = le32_to_cpu(stats->wr_rtry_rd_ack_cnt);
6502 tmp_stats[i++] = le32_to_cpu(stat_info->wr_req_cnt); 6469 tmp_stats[i++] = le32_to_cpu(stats->wr_req_cnt);
6503 tmp_stats[i++] = le32_to_cpu(stat_info->new_wr_req_cnt); 6470 tmp_stats[i++] = le32_to_cpu(stats->new_wr_req_cnt);
6504 tmp_stats[i++] = le32_to_cpu(stat_info->new_wr_req_rtry_cnt); 6471 tmp_stats[i++] = le32_to_cpu(stats->new_wr_req_rtry_cnt);
6505 tmp_stats[i++] = le32_to_cpu(stat_info->wr_rtry_cnt); 6472 tmp_stats[i++] = le32_to_cpu(stats->wr_rtry_cnt);
6506 tmp_stats[i++] = le32_to_cpu(stat_info->wr_disc_cnt); 6473 tmp_stats[i++] = le32_to_cpu(stats->wr_disc_cnt);
6507 tmp_stats[i++] = le32_to_cpu(stat_info->rd_rtry_wr_ack_cnt); 6474 tmp_stats[i++] = le32_to_cpu(stats->rd_rtry_wr_ack_cnt);
6508 tmp_stats[i++] = le32_to_cpu(stat_info->txp_wr_cnt); 6475 tmp_stats[i++] = le32_to_cpu(stats->txp_wr_cnt);
6509 tmp_stats[i++] = le32_to_cpu(stat_info->txd_rd_cnt); 6476 tmp_stats[i++] = le32_to_cpu(stats->txd_rd_cnt);
6510 tmp_stats[i++] = le32_to_cpu(stat_info->txd_wr_cnt); 6477 tmp_stats[i++] = le32_to_cpu(stats->txd_wr_cnt);
6511 tmp_stats[i++] = le32_to_cpu(stat_info->rxd_rd_cnt); 6478 tmp_stats[i++] = le32_to_cpu(stats->rxd_rd_cnt);
6512 tmp_stats[i++] = le32_to_cpu(stat_info->rxd_wr_cnt); 6479 tmp_stats[i++] = le32_to_cpu(stats->rxd_wr_cnt);
6513 tmp_stats[i++] = le32_to_cpu(stat_info->txf_rd_cnt); 6480 tmp_stats[i++] = le32_to_cpu(stats->txf_rd_cnt);
6514 tmp_stats[i++] = le32_to_cpu(stat_info->rxf_wr_cnt); 6481 tmp_stats[i++] = le32_to_cpu(stats->rxf_wr_cnt);
6515 6482
6516 /* Enhanced statistics exist only for Hercules */ 6483 /* Enhanced statistics exist only for Hercules */
6517 if (sp->device_type == XFRAME_II_DEVICE) { 6484 if (sp->device_type == XFRAME_II_DEVICE) {
6518 tmp_stats[i++] = 6485 tmp_stats[i++] =
6519 le64_to_cpu(stat_info->rmac_ttl_1519_4095_frms); 6486 le64_to_cpu(stats->rmac_ttl_1519_4095_frms);
6520 tmp_stats[i++] = 6487 tmp_stats[i++] =
6521 le64_to_cpu(stat_info->rmac_ttl_4096_8191_frms); 6488 le64_to_cpu(stats->rmac_ttl_4096_8191_frms);
6522 tmp_stats[i++] = 6489 tmp_stats[i++] =
6523 le64_to_cpu(stat_info->rmac_ttl_8192_max_frms); 6490 le64_to_cpu(stats->rmac_ttl_8192_max_frms);
6524 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_gt_max_frms); 6491 tmp_stats[i++] = le64_to_cpu(stats->rmac_ttl_gt_max_frms);
6525 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_osized_alt_frms); 6492 tmp_stats[i++] = le64_to_cpu(stats->rmac_osized_alt_frms);
6526 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_jabber_alt_frms); 6493 tmp_stats[i++] = le64_to_cpu(stats->rmac_jabber_alt_frms);
6527 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_gt_max_alt_frms); 6494 tmp_stats[i++] = le64_to_cpu(stats->rmac_gt_max_alt_frms);
6528 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_vlan_frms); 6495 tmp_stats[i++] = le64_to_cpu(stats->rmac_vlan_frms);
6529 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_len_discard); 6496 tmp_stats[i++] = le32_to_cpu(stats->rmac_len_discard);
6530 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_fcs_discard); 6497 tmp_stats[i++] = le32_to_cpu(stats->rmac_fcs_discard);
6531 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_pf_discard); 6498 tmp_stats[i++] = le32_to_cpu(stats->rmac_pf_discard);
6532 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_da_discard); 6499 tmp_stats[i++] = le32_to_cpu(stats->rmac_da_discard);
6533 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_red_discard); 6500 tmp_stats[i++] = le32_to_cpu(stats->rmac_red_discard);
6534 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_rts_discard); 6501 tmp_stats[i++] = le32_to_cpu(stats->rmac_rts_discard);
6535 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_ingm_full_discard); 6502 tmp_stats[i++] = le32_to_cpu(stats->rmac_ingm_full_discard);
6536 tmp_stats[i++] = le32_to_cpu(stat_info->link_fault_cnt); 6503 tmp_stats[i++] = le32_to_cpu(stats->link_fault_cnt);
6537 } 6504 }
6538 6505
6539 tmp_stats[i++] = 0; 6506 tmp_stats[i++] = 0;
6540 tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs; 6507 tmp_stats[i++] = swstats->single_ecc_errs;
6541 tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; 6508 tmp_stats[i++] = swstats->double_ecc_errs;
6542 tmp_stats[i++] = stat_info->sw_stat.parity_err_cnt; 6509 tmp_stats[i++] = swstats->parity_err_cnt;
6543 tmp_stats[i++] = stat_info->sw_stat.serious_err_cnt; 6510 tmp_stats[i++] = swstats->serious_err_cnt;
6544 tmp_stats[i++] = stat_info->sw_stat.soft_reset_cnt; 6511 tmp_stats[i++] = swstats->soft_reset_cnt;
6545 tmp_stats[i++] = stat_info->sw_stat.fifo_full_cnt; 6512 tmp_stats[i++] = swstats->fifo_full_cnt;
6546 for (k = 0; k < MAX_RX_RINGS; k++) 6513 for (k = 0; k < MAX_RX_RINGS; k++)
6547 tmp_stats[i++] = stat_info->sw_stat.ring_full_cnt[k]; 6514 tmp_stats[i++] = swstats->ring_full_cnt[k];
6548 tmp_stats[i++] = stat_info->xpak_stat.alarm_transceiver_temp_high; 6515 tmp_stats[i++] = xstats->alarm_transceiver_temp_high;
6549 tmp_stats[i++] = stat_info->xpak_stat.alarm_transceiver_temp_low; 6516 tmp_stats[i++] = xstats->alarm_transceiver_temp_low;
6550 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_bias_current_high; 6517 tmp_stats[i++] = xstats->alarm_laser_bias_current_high;
6551 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_bias_current_low; 6518 tmp_stats[i++] = xstats->alarm_laser_bias_current_low;
6552 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_output_power_high; 6519 tmp_stats[i++] = xstats->alarm_laser_output_power_high;
6553 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_output_power_low; 6520 tmp_stats[i++] = xstats->alarm_laser_output_power_low;
6554 tmp_stats[i++] = stat_info->xpak_stat.warn_transceiver_temp_high; 6521 tmp_stats[i++] = xstats->warn_transceiver_temp_high;
6555 tmp_stats[i++] = stat_info->xpak_stat.warn_transceiver_temp_low; 6522 tmp_stats[i++] = xstats->warn_transceiver_temp_low;
6556 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_bias_current_high; 6523 tmp_stats[i++] = xstats->warn_laser_bias_current_high;
6557 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_bias_current_low; 6524 tmp_stats[i++] = xstats->warn_laser_bias_current_low;
6558 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_output_power_high; 6525 tmp_stats[i++] = xstats->warn_laser_output_power_high;
6559 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_output_power_low; 6526 tmp_stats[i++] = xstats->warn_laser_output_power_low;
6560 tmp_stats[i++] = stat_info->sw_stat.clubbed_frms_cnt; 6527 tmp_stats[i++] = swstats->clubbed_frms_cnt;
6561 tmp_stats[i++] = stat_info->sw_stat.sending_both; 6528 tmp_stats[i++] = swstats->sending_both;
6562 tmp_stats[i++] = stat_info->sw_stat.outof_sequence_pkts; 6529 tmp_stats[i++] = swstats->outof_sequence_pkts;
6563 tmp_stats[i++] = stat_info->sw_stat.flush_max_pkts; 6530 tmp_stats[i++] = swstats->flush_max_pkts;
6564 if (stat_info->sw_stat.num_aggregations) { 6531 if (swstats->num_aggregations) {
6565 u64 tmp = stat_info->sw_stat.sum_avg_pkts_aggregated; 6532 u64 tmp = swstats->sum_avg_pkts_aggregated;
6566 int count = 0; 6533 int count = 0;
6567 /* 6534 /*
6568 * Since 64-bit divide does not work on all platforms, 6535 * Since 64-bit divide does not work on all platforms,
6569 * do repeated subtraction. 6536 * do repeated subtraction.
6570 */ 6537 */
6571 while (tmp >= stat_info->sw_stat.num_aggregations) { 6538 while (tmp >= swstats->num_aggregations) {
6572 tmp -= stat_info->sw_stat.num_aggregations; 6539 tmp -= swstats->num_aggregations;
6573 count++; 6540 count++;
6574 } 6541 }
6575 tmp_stats[i++] = count; 6542 tmp_stats[i++] = count;
6576 } else 6543 } else
6577 tmp_stats[i++] = 0; 6544 tmp_stats[i++] = 0;
6578 tmp_stats[i++] = stat_info->sw_stat.mem_alloc_fail_cnt; 6545 tmp_stats[i++] = swstats->mem_alloc_fail_cnt;
6579 tmp_stats[i++] = stat_info->sw_stat.pci_map_fail_cnt; 6546 tmp_stats[i++] = swstats->pci_map_fail_cnt;
6580 tmp_stats[i++] = stat_info->sw_stat.watchdog_timer_cnt; 6547 tmp_stats[i++] = swstats->watchdog_timer_cnt;
6581 tmp_stats[i++] = stat_info->sw_stat.mem_allocated; 6548 tmp_stats[i++] = swstats->mem_allocated;
6582 tmp_stats[i++] = stat_info->sw_stat.mem_freed; 6549 tmp_stats[i++] = swstats->mem_freed;
6583 tmp_stats[i++] = stat_info->sw_stat.link_up_cnt; 6550 tmp_stats[i++] = swstats->link_up_cnt;
6584 tmp_stats[i++] = stat_info->sw_stat.link_down_cnt; 6551 tmp_stats[i++] = swstats->link_down_cnt;
6585 tmp_stats[i++] = stat_info->sw_stat.link_up_time; 6552 tmp_stats[i++] = swstats->link_up_time;
6586 tmp_stats[i++] = stat_info->sw_stat.link_down_time; 6553 tmp_stats[i++] = swstats->link_down_time;
6587 6554
6588 tmp_stats[i++] = stat_info->sw_stat.tx_buf_abort_cnt; 6555 tmp_stats[i++] = swstats->tx_buf_abort_cnt;
6589 tmp_stats[i++] = stat_info->sw_stat.tx_desc_abort_cnt; 6556 tmp_stats[i++] = swstats->tx_desc_abort_cnt;
6590 tmp_stats[i++] = stat_info->sw_stat.tx_parity_err_cnt; 6557 tmp_stats[i++] = swstats->tx_parity_err_cnt;
6591 tmp_stats[i++] = stat_info->sw_stat.tx_link_loss_cnt; 6558 tmp_stats[i++] = swstats->tx_link_loss_cnt;
6592 tmp_stats[i++] = stat_info->sw_stat.tx_list_proc_err_cnt; 6559 tmp_stats[i++] = swstats->tx_list_proc_err_cnt;
6593 6560
6594 tmp_stats[i++] = stat_info->sw_stat.rx_parity_err_cnt; 6561 tmp_stats[i++] = swstats->rx_parity_err_cnt;
6595 tmp_stats[i++] = stat_info->sw_stat.rx_abort_cnt; 6562 tmp_stats[i++] = swstats->rx_abort_cnt;
6596 tmp_stats[i++] = stat_info->sw_stat.rx_parity_abort_cnt; 6563 tmp_stats[i++] = swstats->rx_parity_abort_cnt;
6597 tmp_stats[i++] = stat_info->sw_stat.rx_rda_fail_cnt; 6564 tmp_stats[i++] = swstats->rx_rda_fail_cnt;
6598 tmp_stats[i++] = stat_info->sw_stat.rx_unkn_prot_cnt; 6565 tmp_stats[i++] = swstats->rx_unkn_prot_cnt;
6599 tmp_stats[i++] = stat_info->sw_stat.rx_fcs_err_cnt; 6566 tmp_stats[i++] = swstats->rx_fcs_err_cnt;
6600 tmp_stats[i++] = stat_info->sw_stat.rx_buf_size_err_cnt; 6567 tmp_stats[i++] = swstats->rx_buf_size_err_cnt;
6601 tmp_stats[i++] = stat_info->sw_stat.rx_rxd_corrupt_cnt; 6568 tmp_stats[i++] = swstats->rx_rxd_corrupt_cnt;
6602 tmp_stats[i++] = stat_info->sw_stat.rx_unkn_err_cnt; 6569 tmp_stats[i++] = swstats->rx_unkn_err_cnt;
6603 tmp_stats[i++] = stat_info->sw_stat.tda_err_cnt; 6570 tmp_stats[i++] = swstats->tda_err_cnt;
6604 tmp_stats[i++] = stat_info->sw_stat.pfc_err_cnt; 6571 tmp_stats[i++] = swstats->pfc_err_cnt;
6605 tmp_stats[i++] = stat_info->sw_stat.pcc_err_cnt; 6572 tmp_stats[i++] = swstats->pcc_err_cnt;
6606 tmp_stats[i++] = stat_info->sw_stat.tti_err_cnt; 6573 tmp_stats[i++] = swstats->tti_err_cnt;
6607 tmp_stats[i++] = stat_info->sw_stat.tpa_err_cnt; 6574 tmp_stats[i++] = swstats->tpa_err_cnt;
6608 tmp_stats[i++] = stat_info->sw_stat.sm_err_cnt; 6575 tmp_stats[i++] = swstats->sm_err_cnt;
6609 tmp_stats[i++] = stat_info->sw_stat.lso_err_cnt; 6576 tmp_stats[i++] = swstats->lso_err_cnt;
6610 tmp_stats[i++] = stat_info->sw_stat.mac_tmac_err_cnt; 6577 tmp_stats[i++] = swstats->mac_tmac_err_cnt;
6611 tmp_stats[i++] = stat_info->sw_stat.mac_rmac_err_cnt; 6578 tmp_stats[i++] = swstats->mac_rmac_err_cnt;
6612 tmp_stats[i++] = stat_info->sw_stat.xgxs_txgxs_err_cnt; 6579 tmp_stats[i++] = swstats->xgxs_txgxs_err_cnt;
6613 tmp_stats[i++] = stat_info->sw_stat.xgxs_rxgxs_err_cnt; 6580 tmp_stats[i++] = swstats->xgxs_rxgxs_err_cnt;
6614 tmp_stats[i++] = stat_info->sw_stat.rc_err_cnt; 6581 tmp_stats[i++] = swstats->rc_err_cnt;
6615 tmp_stats[i++] = stat_info->sw_stat.prc_pcix_err_cnt; 6582 tmp_stats[i++] = swstats->prc_pcix_err_cnt;
6616 tmp_stats[i++] = stat_info->sw_stat.rpa_err_cnt; 6583 tmp_stats[i++] = swstats->rpa_err_cnt;
6617 tmp_stats[i++] = stat_info->sw_stat.rda_err_cnt; 6584 tmp_stats[i++] = swstats->rda_err_cnt;
6618 tmp_stats[i++] = stat_info->sw_stat.rti_err_cnt; 6585 tmp_stats[i++] = swstats->rti_err_cnt;
6619 tmp_stats[i++] = stat_info->sw_stat.mc_err_cnt; 6586 tmp_stats[i++] = swstats->mc_err_cnt;
6620} 6587}
6621 6588
6622static int s2io_ethtool_get_regs_len(struct net_device *dev) 6589static int s2io_ethtool_get_regs_len(struct net_device *dev)
@@ -6912,12 +6879,10 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6912 DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); 6879 DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name);
6913 DBG_PRINT(INFO_DBG, "memory to allocate "); 6880 DBG_PRINT(INFO_DBG, "memory to allocate ");
6914 DBG_PRINT(INFO_DBG, "1 buf mode SKBs\n"); 6881 DBG_PRINT(INFO_DBG, "1 buf mode SKBs\n");
6915 sp->mac_control.stats_info->sw_stat. 6882 stats->mem_alloc_fail_cnt++;
6916 mem_alloc_fail_cnt++;
6917 return -ENOMEM ; 6883 return -ENOMEM ;
6918 } 6884 }
6919 sp->mac_control.stats_info->sw_stat.mem_allocated 6885 stats->mem_allocated += (*skb)->truesize;
6920 += (*skb)->truesize;
6921 /* storing the mapped addr in a temp variable 6886 /* storing the mapped addr in a temp variable
6922 * such it will be used for next rxd whose 6887 * such it will be used for next rxd whose
6923 * Host Control is NULL 6888 * Host Control is NULL
@@ -6943,12 +6908,10 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6943 DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); 6908 DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name);
6944 DBG_PRINT(INFO_DBG, "memory to allocate "); 6909 DBG_PRINT(INFO_DBG, "memory to allocate ");
6945 DBG_PRINT(INFO_DBG, "2 buf mode SKBs\n"); 6910 DBG_PRINT(INFO_DBG, "2 buf mode SKBs\n");
6946 sp->mac_control.stats_info->sw_stat. 6911 stats->mem_alloc_fail_cnt++;
6947 mem_alloc_fail_cnt++;
6948 return -ENOMEM; 6912 return -ENOMEM;
6949 } 6913 }
6950 sp->mac_control.stats_info->sw_stat.mem_allocated 6914 stats->mem_allocated += (*skb)->truesize;
6951 += (*skb)->truesize;
6952 rxdp3->Buffer2_ptr = *temp2 = 6915 rxdp3->Buffer2_ptr = *temp2 =
6953 pci_map_single(sp->pdev, (*skb)->data, 6916 pci_map_single(sp->pdev, (*skb)->data,
6954 dev->mtu + 4, 6917 dev->mtu + 4,
@@ -7010,8 +6973,8 @@ static void set_rxd_buffer_size(struct s2io_nic *sp, struct RxD_t *rxdp,
7010static int rxd_owner_bit_reset(struct s2io_nic *sp) 6973static int rxd_owner_bit_reset(struct s2io_nic *sp)
7011{ 6974{
7012 int i, j, k, blk_cnt = 0, size; 6975 int i, j, k, blk_cnt = 0, size;
7013 struct mac_info *mac_control = &sp->mac_control;
7014 struct config_param *config = &sp->config; 6976 struct config_param *config = &sp->config;
6977 struct mac_info *mac_control = &sp->mac_control;
7015 struct net_device *dev = sp->dev; 6978 struct net_device *dev = sp->dev;
7016 struct RxD_t *rxdp = NULL; 6979 struct RxD_t *rxdp = NULL;
7017 struct sk_buff *skb = NULL; 6980 struct sk_buff *skb = NULL;
@@ -7239,8 +7202,8 @@ static void s2io_card_down(struct s2io_nic *sp)
7239static int s2io_card_up(struct s2io_nic *sp) 7202static int s2io_card_up(struct s2io_nic *sp)
7240{ 7203{
7241 int i, ret = 0; 7204 int i, ret = 0;
7242 struct mac_info *mac_control;
7243 struct config_param *config; 7205 struct config_param *config;
7206 struct mac_info *mac_control;
7244 struct net_device *dev = (struct net_device *)sp->dev; 7207 struct net_device *dev = (struct net_device *)sp->dev;
7245 u16 interruptible; 7208 u16 interruptible;
7246 7209
@@ -7258,8 +7221,8 @@ static int s2io_card_up(struct s2io_nic *sp)
7258 * Initializing the Rx buffers. For now we are considering only 1 7221 * Initializing the Rx buffers. For now we are considering only 1
7259 * Rx ring and initializing buffers into 30 Rx blocks 7222 * Rx ring and initializing buffers into 30 Rx blocks
7260 */ 7223 */
7261 mac_control = &sp->mac_control;
7262 config = &sp->config; 7224 config = &sp->config;
7225 mac_control = &sp->mac_control;
7263 7226
7264 for (i = 0; i < config->rx_ring_num; i++) { 7227 for (i = 0; i < config->rx_ring_num; i++) {
7265 struct ring_info *ring = &mac_control->rings[i]; 7228 struct ring_info *ring = &mac_control->rings[i];
@@ -7387,11 +7350,12 @@ out_unlock:
7387static void s2io_tx_watchdog(struct net_device *dev) 7350static void s2io_tx_watchdog(struct net_device *dev)
7388{ 7351{
7389 struct s2io_nic *sp = netdev_priv(dev); 7352 struct s2io_nic *sp = netdev_priv(dev);
7353 struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
7390 7354
7391 if (netif_carrier_ok(dev)) { 7355 if (netif_carrier_ok(dev)) {
7392 sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt++; 7356 swstats->watchdog_timer_cnt++;
7393 schedule_work(&sp->rst_timer_task); 7357 schedule_work(&sp->rst_timer_task);
7394 sp->mac_control.stats_info->sw_stat.soft_reset_cnt++; 7358 swstats->soft_reset_cnt++;
7395 } 7359 }
7396} 7360}
7397 7361
@@ -7423,50 +7387,51 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
7423 unsigned long long err = rxdp->Control_1 & RXD_T_CODE; 7387 unsigned long long err = rxdp->Control_1 & RXD_T_CODE;
7424 struct lro *uninitialized_var(lro); 7388 struct lro *uninitialized_var(lro);
7425 u8 err_mask; 7389 u8 err_mask;
7390 struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
7426 7391
7427 skb->dev = dev; 7392 skb->dev = dev;
7428 7393
7429 if (err) { 7394 if (err) {
7430 /* Check for parity error */ 7395 /* Check for parity error */
7431 if (err & 0x1) 7396 if (err & 0x1)
7432 sp->mac_control.stats_info->sw_stat.parity_err_cnt++; 7397 swstats->parity_err_cnt++;
7433 7398
7434 err_mask = err >> 48; 7399 err_mask = err >> 48;
7435 switch (err_mask) { 7400 switch (err_mask) {
7436 case 1: 7401 case 1:
7437 sp->mac_control.stats_info->sw_stat.rx_parity_err_cnt++; 7402 swstats->rx_parity_err_cnt++;
7438 break; 7403 break;
7439 7404
7440 case 2: 7405 case 2:
7441 sp->mac_control.stats_info->sw_stat.rx_abort_cnt++; 7406 swstats->rx_abort_cnt++;
7442 break; 7407 break;
7443 7408
7444 case 3: 7409 case 3:
7445 sp->mac_control.stats_info->sw_stat.rx_parity_abort_cnt++; 7410 swstats->rx_parity_abort_cnt++;
7446 break; 7411 break;
7447 7412
7448 case 4: 7413 case 4:
7449 sp->mac_control.stats_info->sw_stat.rx_rda_fail_cnt++; 7414 swstats->rx_rda_fail_cnt++;
7450 break; 7415 break;
7451 7416
7452 case 5: 7417 case 5:
7453 sp->mac_control.stats_info->sw_stat.rx_unkn_prot_cnt++; 7418 swstats->rx_unkn_prot_cnt++;
7454 break; 7419 break;
7455 7420
7456 case 6: 7421 case 6:
7457 sp->mac_control.stats_info->sw_stat.rx_fcs_err_cnt++; 7422 swstats->rx_fcs_err_cnt++;
7458 break; 7423 break;
7459 7424
7460 case 7: 7425 case 7:
7461 sp->mac_control.stats_info->sw_stat.rx_buf_size_err_cnt++; 7426 swstats->rx_buf_size_err_cnt++;
7462 break; 7427 break;
7463 7428
7464 case 8: 7429 case 8:
7465 sp->mac_control.stats_info->sw_stat.rx_rxd_corrupt_cnt++; 7430 swstats->rx_rxd_corrupt_cnt++;
7466 break; 7431 break;
7467 7432
7468 case 15: 7433 case 15:
7469 sp->mac_control.stats_info->sw_stat.rx_unkn_err_cnt++; 7434 swstats->rx_unkn_err_cnt++;
7470 break; 7435 break;
7471 } 7436 }
7472 /* 7437 /*
@@ -7480,7 +7445,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
7480 DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n", 7445 DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
7481 dev->name, err_mask); 7446 dev->name, err_mask);
7482 dev->stats.rx_crc_errors++; 7447 dev->stats.rx_crc_errors++;
7483 sp->mac_control.stats_info->sw_stat.mem_freed 7448 swstats->mem_freed
7484 += skb->truesize; 7449 += skb->truesize;
7485 dev_kfree_skb(skb); 7450 dev_kfree_skb(skb);
7486 ring_data->rx_bufs_left -= 1; 7451 ring_data->rx_bufs_left -= 1;
@@ -7545,13 +7510,11 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
7545 queue_rx_frame(lro->parent, 7510 queue_rx_frame(lro->parent,
7546 lro->vlan_tag); 7511 lro->vlan_tag);
7547 clear_lro_session(lro); 7512 clear_lro_session(lro);
7548 sp->mac_control.stats_info-> 7513 swstats->flush_max_pkts++;
7549 sw_stat.flush_max_pkts++;
7550 goto aggregate; 7514 goto aggregate;
7551 case 2: /* Flush both */ 7515 case 2: /* Flush both */
7552 lro->parent->data_len = lro->frags_len; 7516 lro->parent->data_len = lro->frags_len;
7553 sp->mac_control.stats_info-> 7517 swstats->sending_both++;
7554 sw_stat.sending_both++;
7555 queue_rx_frame(lro->parent, 7518 queue_rx_frame(lro->parent,
7556 lro->vlan_tag); 7519 lro->vlan_tag);
7557 clear_lro_session(lro); 7520 clear_lro_session(lro);
@@ -7580,7 +7543,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
7580 } else 7543 } else
7581 skb->ip_summed = CHECKSUM_NONE; 7544 skb->ip_summed = CHECKSUM_NONE;
7582 7545
7583 sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 7546 swstats->mem_freed += skb->truesize;
7584send_up: 7547send_up:
7585 skb_record_rx_queue(skb, ring_no); 7548 skb_record_rx_queue(skb, ring_no);
7586 queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp->Control_2)); 7549 queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp->Control_2));
@@ -7605,6 +7568,7 @@ aggregate:
7605static void s2io_link(struct s2io_nic *sp, int link) 7568static void s2io_link(struct s2io_nic *sp, int link)
7606{ 7569{
7607 struct net_device *dev = (struct net_device *)sp->dev; 7570 struct net_device *dev = (struct net_device *)sp->dev;
7571 struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
7608 7572
7609 if (link != sp->last_link_state) { 7573 if (link != sp->last_link_state) {
7610 init_tti(sp, link); 7574 init_tti(sp, link);
@@ -7612,17 +7576,16 @@ static void s2io_link(struct s2io_nic *sp, int link)
7612 DBG_PRINT(ERR_DBG, "%s: Link down\n", dev->name); 7576 DBG_PRINT(ERR_DBG, "%s: Link down\n", dev->name);
7613 s2io_stop_all_tx_queue(sp); 7577 s2io_stop_all_tx_queue(sp);
7614 netif_carrier_off(dev); 7578 netif_carrier_off(dev);
7615 if (sp->mac_control.stats_info->sw_stat.link_up_cnt) 7579 if (swstats->link_up_cnt)
7616 sp->mac_control.stats_info->sw_stat. 7580 swstats->link_up_time =
7617 link_up_time = jiffies - sp->start_time; 7581 jiffies - sp->start_time;
7618 sp->mac_control.stats_info->sw_stat.link_down_cnt++; 7582 swstats->link_down_cnt++;
7619 } else { 7583 } else {
7620 DBG_PRINT(ERR_DBG, "%s: Link Up\n", dev->name); 7584 DBG_PRINT(ERR_DBG, "%s: Link Up\n", dev->name);
7621 if (sp->mac_control.stats_info->sw_stat.link_down_cnt) 7585 if (swstats->link_down_cnt)
7622 sp->mac_control.stats_info-> 7586 swstats->link_down_time =
7623 sw_stat.link_down_time =
7624 jiffies - sp->start_time; 7587 jiffies - sp->start_time;
7625 sp->mac_control.stats_info->sw_stat.link_up_cnt++; 7588 swstats->link_up_cnt++;
7626 netif_carrier_on(dev); 7589 netif_carrier_on(dev);
7627 s2io_wake_all_tx_queue(sp); 7590 s2io_wake_all_tx_queue(sp);
7628 } 7591 }
@@ -7800,8 +7763,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7800 u64 val64 = 0, tmp64 = 0; 7763 u64 val64 = 0, tmp64 = 0;
7801 struct XENA_dev_config __iomem *bar0 = NULL; 7764 struct XENA_dev_config __iomem *bar0 = NULL;
7802 u16 subid; 7765 u16 subid;
7803 struct mac_info *mac_control;
7804 struct config_param *config; 7766 struct config_param *config;
7767 struct mac_info *mac_control;
7805 int mode; 7768 int mode;
7806 u8 dev_intr_type = intr_type; 7769 u8 dev_intr_type = intr_type;
7807 u8 dev_multiq = 0; 7770 u8 dev_multiq = 0;
@@ -7887,8 +7850,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7887 * these parameters are not not specified during load time, they 7850 * these parameters are not not specified during load time, they
7888 * are initialized with default values. 7851 * are initialized with default values.
7889 */ 7852 */
7890 mac_control = &sp->mac_control;
7891 config = &sp->config; 7853 config = &sp->config;
7854 mac_control = &sp->mac_control;
7892 7855
7893 config->napi = napi; 7856 config->napi = napi;
7894 config->tx_steering_type = tx_steering_type; 7857 config->tx_steering_type = tx_steering_type;
@@ -8433,7 +8396,8 @@ static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro)
8433 struct iphdr *ip = lro->iph; 8396 struct iphdr *ip = lro->iph;
8434 struct tcphdr *tcp = lro->tcph; 8397 struct tcphdr *tcp = lro->tcph;
8435 __sum16 nchk; 8398 __sum16 nchk;
8436 struct stat_block *statinfo = sp->mac_control.stats_info; 8399 struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
8400
8437 DBG_PRINT(INFO_DBG, "%s: Been here...\n", __func__); 8401 DBG_PRINT(INFO_DBG, "%s: Been here...\n", __func__);
8438 8402
8439 /* Update L3 header */ 8403 /* Update L3 header */
@@ -8455,8 +8419,8 @@ static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro)
8455 /* Update counters required for calculation of 8419 /* Update counters required for calculation of
8456 * average no. of packets aggregated. 8420 * average no. of packets aggregated.
8457 */ 8421 */
8458 statinfo->sw_stat.sum_avg_pkts_aggregated += lro->sg_num; 8422 swstats->sum_avg_pkts_aggregated += lro->sg_num;
8459 statinfo->sw_stat.num_aggregations++; 8423 swstats->num_aggregations++;
8460} 8424}
8461 8425
8462static void aggregate_new_rx(struct lro *lro, struct iphdr *ip, 8426static void aggregate_new_rx(struct lro *lro, struct iphdr *ip,
@@ -8547,6 +8511,7 @@ static int s2io_club_tcp_session(struct ring_info *ring_data, u8 *buffer,
8547 struct tcphdr *tcph; 8511 struct tcphdr *tcph;
8548 int ret = 0, i; 8512 int ret = 0, i;
8549 u16 vlan_tag = 0; 8513 u16 vlan_tag = 0;
8514 struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
8550 8515
8551 ret = check_L2_lro_capable(buffer, &ip, (struct tcphdr **)tcp, 8516 ret = check_L2_lro_capable(buffer, &ip, (struct tcphdr **)tcp,
8552 rxdp, sp); 8517 rxdp, sp);
@@ -8572,8 +8537,7 @@ static int s2io_club_tcp_session(struct ring_info *ring_data, u8 *buffer,
8572 (*lro)->tcp_next_seq, 8537 (*lro)->tcp_next_seq,
8573 ntohl(tcph->seq)); 8538 ntohl(tcph->seq));
8574 8539
8575 sp->mac_control.stats_info-> 8540 swstats->outof_sequence_pkts++;
8576 sw_stat.outof_sequence_pkts++;
8577 ret = 2; 8541 ret = 2;
8578 break; 8542 break;
8579 } 8543 }
@@ -8667,6 +8631,7 @@ static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
8667 struct sk_buff *skb, u32 tcp_len) 8631 struct sk_buff *skb, u32 tcp_len)
8668{ 8632{
8669 struct sk_buff *first = lro->parent; 8633 struct sk_buff *first = lro->parent;
8634 struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
8670 8635
8671 first->len += tcp_len; 8636 first->len += tcp_len;
8672 first->data_len = lro->frags_len; 8637 first->data_len = lro->frags_len;
@@ -8677,7 +8642,7 @@ static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
8677 skb_shinfo(first)->frag_list = skb; 8642 skb_shinfo(first)->frag_list = skb;
8678 first->truesize += skb->truesize; 8643 first->truesize += skb->truesize;
8679 lro->last_frag = skb; 8644 lro->last_frag = skb;
8680 sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++; 8645 swstats->clubbed_frms_cnt++;
8681 return; 8646 return;
8682} 8647}
8683 8648