aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c505
1 files changed, 255 insertions, 250 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index b4c4cf467dc6..639fbc0f16f3 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -77,7 +77,7 @@
77#include "s2io.h" 77#include "s2io.h"
78#include "s2io-regs.h" 78#include "s2io-regs.h"
79 79
80#define DRV_VERSION "2.0.15.2" 80#define DRV_VERSION "2.0.16.1"
81 81
82/* S2io Driver name & version. */ 82/* S2io Driver name & version. */
83static char s2io_driver_name[] = "Neterion"; 83static char s2io_driver_name[] = "Neterion";
@@ -86,7 +86,7 @@ static char s2io_driver_version[] = DRV_VERSION;
86static int rxd_size[4] = {32,48,48,64}; 86static int rxd_size[4] = {32,48,48,64};
87static int rxd_count[4] = {127,85,85,63}; 87static int rxd_count[4] = {127,85,85,63};
88 88
89static inline int RXD_IS_UP2DT(RxD_t *rxdp) 89static inline int RXD_IS_UP2DT(struct RxD_t *rxdp)
90{ 90{
91 int ret; 91 int ret;
92 92
@@ -111,9 +111,9 @@ static inline int RXD_IS_UP2DT(RxD_t *rxdp)
111#define TASKLET_IN_USE test_and_set_bit(0, (&sp->tasklet_status)) 111#define TASKLET_IN_USE test_and_set_bit(0, (&sp->tasklet_status))
112#define PANIC 1 112#define PANIC 1
113#define LOW 2 113#define LOW 2
114static inline int rx_buffer_level(nic_t * sp, int rxb_size, int ring) 114static inline int rx_buffer_level(struct s2io_nic * sp, int rxb_size, int ring)
115{ 115{
116 mac_info_t *mac_control; 116 struct mac_info *mac_control;
117 117
118 mac_control = &sp->mac_control; 118 mac_control = &sp->mac_control;
119 if (rxb_size <= rxd_count[sp->rxd_mode]) 119 if (rxb_size <= rxd_count[sp->rxd_mode])
@@ -286,7 +286,7 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
286static void s2io_vlan_rx_register(struct net_device *dev, 286static void s2io_vlan_rx_register(struct net_device *dev,
287 struct vlan_group *grp) 287 struct vlan_group *grp)
288{ 288{
289 nic_t *nic = dev->priv; 289 struct s2io_nic *nic = dev->priv;
290 unsigned long flags; 290 unsigned long flags;
291 291
292 spin_lock_irqsave(&nic->tx_lock, flags); 292 spin_lock_irqsave(&nic->tx_lock, flags);
@@ -297,7 +297,7 @@ static void s2io_vlan_rx_register(struct net_device *dev,
297/* Unregister the vlan */ 297/* Unregister the vlan */
298static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) 298static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
299{ 299{
300 nic_t *nic = dev->priv; 300 struct s2io_nic *nic = dev->priv;
301 unsigned long flags; 301 unsigned long flags;
302 302
303 spin_lock_irqsave(&nic->tx_lock, flags); 303 spin_lock_irqsave(&nic->tx_lock, flags);
@@ -458,14 +458,14 @@ static int init_shared_mem(struct s2io_nic *nic)
458 u32 size; 458 u32 size;
459 void *tmp_v_addr, *tmp_v_addr_next; 459 void *tmp_v_addr, *tmp_v_addr_next;
460 dma_addr_t tmp_p_addr, tmp_p_addr_next; 460 dma_addr_t tmp_p_addr, tmp_p_addr_next;
461 RxD_block_t *pre_rxd_blk = NULL; 461 struct RxD_block *pre_rxd_blk = NULL;
462 int i, j, blk_cnt; 462 int i, j, blk_cnt;
463 int lst_size, lst_per_page; 463 int lst_size, lst_per_page;
464 struct net_device *dev = nic->dev; 464 struct net_device *dev = nic->dev;
465 unsigned long tmp; 465 unsigned long tmp;
466 buffAdd_t *ba; 466 struct buffAdd *ba;
467 467
468 mac_info_t *mac_control; 468 struct mac_info *mac_control;
469 struct config_param *config; 469 struct config_param *config;
470 470
471 mac_control = &nic->mac_control; 471 mac_control = &nic->mac_control;
@@ -483,12 +483,12 @@ static int init_shared_mem(struct s2io_nic *nic)
483 return -EINVAL; 483 return -EINVAL;
484 } 484 }
485 485
486 lst_size = (sizeof(TxD_t) * config->max_txds); 486 lst_size = (sizeof(struct TxD) * config->max_txds);
487 lst_per_page = PAGE_SIZE / lst_size; 487 lst_per_page = PAGE_SIZE / lst_size;
488 488
489 for (i = 0; i < config->tx_fifo_num; i++) { 489 for (i = 0; i < config->tx_fifo_num; i++) {
490 int fifo_len = config->tx_cfg[i].fifo_len; 490 int fifo_len = config->tx_cfg[i].fifo_len;
491 int list_holder_size = fifo_len * sizeof(list_info_hold_t); 491 int list_holder_size = fifo_len * sizeof(struct list_info_hold);
492 mac_control->fifos[i].list_info = kmalloc(list_holder_size, 492 mac_control->fifos[i].list_info = kmalloc(list_holder_size,
493 GFP_KERNEL); 493 GFP_KERNEL);
494 if (!mac_control->fifos[i].list_info) { 494 if (!mac_control->fifos[i].list_info) {
@@ -579,9 +579,9 @@ static int init_shared_mem(struct s2io_nic *nic)
579 mac_control->rings[i].block_count; 579 mac_control->rings[i].block_count;
580 } 580 }
581 if (nic->rxd_mode == RXD_MODE_1) 581 if (nic->rxd_mode == RXD_MODE_1)
582 size = (size * (sizeof(RxD1_t))); 582 size = (size * (sizeof(struct RxD1)));
583 else 583 else
584 size = (size * (sizeof(RxD3_t))); 584 size = (size * (sizeof(struct RxD3)));
585 585
586 for (i = 0; i < config->rx_ring_num; i++) { 586 for (i = 0; i < config->rx_ring_num; i++) {
587 mac_control->rings[i].rx_curr_get_info.block_index = 0; 587 mac_control->rings[i].rx_curr_get_info.block_index = 0;
@@ -599,7 +599,7 @@ static int init_shared_mem(struct s2io_nic *nic)
599 (rxd_count[nic->rxd_mode] + 1); 599 (rxd_count[nic->rxd_mode] + 1);
600 /* Allocating all the Rx blocks */ 600 /* Allocating all the Rx blocks */
601 for (j = 0; j < blk_cnt; j++) { 601 for (j = 0; j < blk_cnt; j++) {
602 rx_block_info_t *rx_blocks; 602 struct rx_block_info *rx_blocks;
603 int l; 603 int l;
604 604
605 rx_blocks = &mac_control->rings[i].rx_blocks[j]; 605 rx_blocks = &mac_control->rings[i].rx_blocks[j];
@@ -619,7 +619,7 @@ static int init_shared_mem(struct s2io_nic *nic)
619 memset(tmp_v_addr, 0, size); 619 memset(tmp_v_addr, 0, size);
620 rx_blocks->block_virt_addr = tmp_v_addr; 620 rx_blocks->block_virt_addr = tmp_v_addr;
621 rx_blocks->block_dma_addr = tmp_p_addr; 621 rx_blocks->block_dma_addr = tmp_p_addr;
622 rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)* 622 rx_blocks->rxds = kmalloc(sizeof(struct rxd_info)*
623 rxd_count[nic->rxd_mode], 623 rxd_count[nic->rxd_mode],
624 GFP_KERNEL); 624 GFP_KERNEL);
625 if (!rx_blocks->rxds) 625 if (!rx_blocks->rxds)
@@ -646,7 +646,7 @@ static int init_shared_mem(struct s2io_nic *nic)
646 mac_control->rings[i].rx_blocks[(j + 1) % 646 mac_control->rings[i].rx_blocks[(j + 1) %
647 blk_cnt].block_dma_addr; 647 blk_cnt].block_dma_addr;
648 648
649 pre_rxd_blk = (RxD_block_t *) tmp_v_addr; 649 pre_rxd_blk = (struct RxD_block *) tmp_v_addr;
650 pre_rxd_blk->reserved_2_pNext_RxD_block = 650 pre_rxd_blk->reserved_2_pNext_RxD_block =
651 (unsigned long) tmp_v_addr_next; 651 (unsigned long) tmp_v_addr_next;
652 pre_rxd_blk->pNext_RxD_Blk_physical = 652 pre_rxd_blk->pNext_RxD_Blk_physical =
@@ -662,14 +662,14 @@ static int init_shared_mem(struct s2io_nic *nic)
662 blk_cnt = config->rx_cfg[i].num_rxd / 662 blk_cnt = config->rx_cfg[i].num_rxd /
663 (rxd_count[nic->rxd_mode]+ 1); 663 (rxd_count[nic->rxd_mode]+ 1);
664 mac_control->rings[i].ba = 664 mac_control->rings[i].ba =
665 kmalloc((sizeof(buffAdd_t *) * blk_cnt), 665 kmalloc((sizeof(struct buffAdd *) * blk_cnt),
666 GFP_KERNEL); 666 GFP_KERNEL);
667 if (!mac_control->rings[i].ba) 667 if (!mac_control->rings[i].ba)
668 return -ENOMEM; 668 return -ENOMEM;
669 for (j = 0; j < blk_cnt; j++) { 669 for (j = 0; j < blk_cnt; j++) {
670 int k = 0; 670 int k = 0;
671 mac_control->rings[i].ba[j] = 671 mac_control->rings[i].ba[j] =
672 kmalloc((sizeof(buffAdd_t) * 672 kmalloc((sizeof(struct buffAdd) *
673 (rxd_count[nic->rxd_mode] + 1)), 673 (rxd_count[nic->rxd_mode] + 1)),
674 GFP_KERNEL); 674 GFP_KERNEL);
675 if (!mac_control->rings[i].ba[j]) 675 if (!mac_control->rings[i].ba[j])
@@ -701,7 +701,7 @@ static int init_shared_mem(struct s2io_nic *nic)
701 } 701 }
702 702
703 /* Allocation and initialization of Statistics block */ 703 /* Allocation and initialization of Statistics block */
704 size = sizeof(StatInfo_t); 704 size = sizeof(struct stat_block);
705 mac_control->stats_mem = pci_alloc_consistent 705 mac_control->stats_mem = pci_alloc_consistent
706 (nic->pdev, size, &mac_control->stats_mem_phy); 706 (nic->pdev, size, &mac_control->stats_mem_phy);
707 707
@@ -716,7 +716,7 @@ static int init_shared_mem(struct s2io_nic *nic)
716 mac_control->stats_mem_sz = size; 716 mac_control->stats_mem_sz = size;
717 717
718 tmp_v_addr = mac_control->stats_mem; 718 tmp_v_addr = mac_control->stats_mem;
719 mac_control->stats_info = (StatInfo_t *) tmp_v_addr; 719 mac_control->stats_info = (struct stat_block *) tmp_v_addr;
720 memset(tmp_v_addr, 0, size); 720 memset(tmp_v_addr, 0, size);
721 DBG_PRINT(INIT_DBG, "%s:Ring Mem PHY: 0x%llx\n", dev->name, 721 DBG_PRINT(INIT_DBG, "%s:Ring Mem PHY: 0x%llx\n", dev->name,
722 (unsigned long long) tmp_p_addr); 722 (unsigned long long) tmp_p_addr);
@@ -736,7 +736,7 @@ static void free_shared_mem(struct s2io_nic *nic)
736 int i, j, blk_cnt, size; 736 int i, j, blk_cnt, size;
737 void *tmp_v_addr; 737 void *tmp_v_addr;
738 dma_addr_t tmp_p_addr; 738 dma_addr_t tmp_p_addr;
739 mac_info_t *mac_control; 739 struct mac_info *mac_control;
740 struct config_param *config; 740 struct config_param *config;
741 int lst_size, lst_per_page; 741 int lst_size, lst_per_page;
742 struct net_device *dev = nic->dev; 742 struct net_device *dev = nic->dev;
@@ -747,7 +747,7 @@ static void free_shared_mem(struct s2io_nic *nic)
747 mac_control = &nic->mac_control; 747 mac_control = &nic->mac_control;
748 config = &nic->config; 748 config = &nic->config;
749 749
750 lst_size = (sizeof(TxD_t) * config->max_txds); 750 lst_size = (sizeof(struct TxD) * config->max_txds);
751 lst_per_page = PAGE_SIZE / lst_size; 751 lst_per_page = PAGE_SIZE / lst_size;
752 752
753 for (i = 0; i < config->tx_fifo_num; i++) { 753 for (i = 0; i < config->tx_fifo_num; i++) {
@@ -810,7 +810,7 @@ static void free_shared_mem(struct s2io_nic *nic)
810 if (!mac_control->rings[i].ba[j]) 810 if (!mac_control->rings[i].ba[j])
811 continue; 811 continue;
812 while (k != rxd_count[nic->rxd_mode]) { 812 while (k != rxd_count[nic->rxd_mode]) {
813 buffAdd_t *ba = 813 struct buffAdd *ba =
814 &mac_control->rings[i].ba[j][k]; 814 &mac_control->rings[i].ba[j][k];
815 kfree(ba->ba_0_org); 815 kfree(ba->ba_0_org);
816 kfree(ba->ba_1_org); 816 kfree(ba->ba_1_org);
@@ -836,9 +836,9 @@ static void free_shared_mem(struct s2io_nic *nic)
836 * s2io_verify_pci_mode - 836 * s2io_verify_pci_mode -
837 */ 837 */
838 838
839static int s2io_verify_pci_mode(nic_t *nic) 839static int s2io_verify_pci_mode(struct s2io_nic *nic)
840{ 840{
841 XENA_dev_config_t __iomem *bar0 = nic->bar0; 841 struct XENA_dev_config __iomem *bar0 = nic->bar0;
842 register u64 val64 = 0; 842 register u64 val64 = 0;
843 int mode; 843 int mode;
844 844
@@ -869,9 +869,9 @@ static int bus_speed[8] = {33, 133, 133, 200, 266, 133, 200, 266};
869/** 869/**
870 * s2io_print_pci_mode - 870 * s2io_print_pci_mode -
871 */ 871 */
872static int s2io_print_pci_mode(nic_t *nic) 872static int s2io_print_pci_mode(struct s2io_nic *nic)
873{ 873{
874 XENA_dev_config_t __iomem *bar0 = nic->bar0; 874 struct XENA_dev_config __iomem *bar0 = nic->bar0;
875 register u64 val64 = 0; 875 register u64 val64 = 0;
876 int mode; 876 int mode;
877 struct config_param *config = &nic->config; 877 struct config_param *config = &nic->config;
@@ -939,13 +939,13 @@ static int s2io_print_pci_mode(nic_t *nic)
939 939
940static int init_nic(struct s2io_nic *nic) 940static int init_nic(struct s2io_nic *nic)
941{ 941{
942 XENA_dev_config_t __iomem *bar0 = nic->bar0; 942 struct XENA_dev_config __iomem *bar0 = nic->bar0;
943 struct net_device *dev = nic->dev; 943 struct net_device *dev = nic->dev;
944 register u64 val64 = 0; 944 register u64 val64 = 0;
945 void __iomem *add; 945 void __iomem *add;
946 u32 time; 946 u32 time;
947 int i, j; 947 int i, j;
948 mac_info_t *mac_control; 948 struct mac_info *mac_control;
949 struct config_param *config; 949 struct config_param *config;
950 int dtx_cnt = 0; 950 int dtx_cnt = 0;
951 unsigned long long mem_share; 951 unsigned long long mem_share;
@@ -1628,7 +1628,7 @@ static int init_nic(struct s2io_nic *nic)
1628#define LINK_UP_DOWN_INTERRUPT 1 1628#define LINK_UP_DOWN_INTERRUPT 1
1629#define MAC_RMAC_ERR_TIMER 2 1629#define MAC_RMAC_ERR_TIMER 2
1630 1630
1631static int s2io_link_fault_indication(nic_t *nic) 1631static int s2io_link_fault_indication(struct s2io_nic *nic)
1632{ 1632{
1633 if (nic->intr_type != INTA) 1633 if (nic->intr_type != INTA)
1634 return MAC_RMAC_ERR_TIMER; 1634 return MAC_RMAC_ERR_TIMER;
@@ -1651,7 +1651,7 @@ static int s2io_link_fault_indication(nic_t *nic)
1651 1651
1652static void en_dis_able_nic_intrs(struct s2io_nic *nic, u16 mask, int flag) 1652static void en_dis_able_nic_intrs(struct s2io_nic *nic, u16 mask, int flag)
1653{ 1653{
1654 XENA_dev_config_t __iomem *bar0 = nic->bar0; 1654 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1655 register u64 val64 = 0, temp64 = 0; 1655 register u64 val64 = 0, temp64 = 0;
1656 1656
1657 /* Top level interrupt classification */ 1657 /* Top level interrupt classification */
@@ -1773,10 +1773,10 @@ static void en_dis_able_nic_intrs(struct s2io_nic *nic, u16 mask, int flag)
1773 * Return: 1 If PCC is quiescence 1773 * Return: 1 If PCC is quiescence
1774 * 0 If PCC is not quiescence 1774 * 0 If PCC is not quiescence
1775 */ 1775 */
1776static int verify_pcc_quiescent(nic_t *sp, int flag) 1776static int verify_pcc_quiescent(struct s2io_nic *sp, int flag)
1777{ 1777{
1778 int ret = 0, herc; 1778 int ret = 0, herc;
1779 XENA_dev_config_t __iomem *bar0 = sp->bar0; 1779 struct XENA_dev_config __iomem *bar0 = sp->bar0;
1780 u64 val64 = readq(&bar0->adapter_status); 1780 u64 val64 = readq(&bar0->adapter_status);
1781 1781
1782 herc = (sp->device_type == XFRAME_II_DEVICE); 1782 herc = (sp->device_type == XFRAME_II_DEVICE);
@@ -1813,10 +1813,10 @@ static int verify_pcc_quiescent(nic_t *sp, int flag)
1813 * 0 If Xena is not quiescence 1813 * 0 If Xena is not quiescence
1814 */ 1814 */
1815 1815
1816static int verify_xena_quiescence(nic_t *sp) 1816static int verify_xena_quiescence(struct s2io_nic *sp)
1817{ 1817{
1818 int mode; 1818 int mode;
1819 XENA_dev_config_t __iomem *bar0 = sp->bar0; 1819 struct XENA_dev_config __iomem *bar0 = sp->bar0;
1820 u64 val64 = readq(&bar0->adapter_status); 1820 u64 val64 = readq(&bar0->adapter_status);
1821 mode = s2io_verify_pci_mode(sp); 1821 mode = s2io_verify_pci_mode(sp);
1822 1822
@@ -1880,9 +1880,9 @@ static int verify_xena_quiescence(nic_t *sp)
1880 * 1880 *
1881 */ 1881 */
1882 1882
1883static void fix_mac_address(nic_t * sp) 1883static void fix_mac_address(struct s2io_nic * sp)
1884{ 1884{
1885 XENA_dev_config_t __iomem *bar0 = sp->bar0; 1885 struct XENA_dev_config __iomem *bar0 = sp->bar0;
1886 u64 val64; 1886 u64 val64;
1887 int i = 0; 1887 int i = 0;
1888 1888
@@ -1908,11 +1908,11 @@ static void fix_mac_address(nic_t * sp)
1908 1908
1909static int start_nic(struct s2io_nic *nic) 1909static int start_nic(struct s2io_nic *nic)
1910{ 1910{
1911 XENA_dev_config_t __iomem *bar0 = nic->bar0; 1911 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1912 struct net_device *dev = nic->dev; 1912 struct net_device *dev = nic->dev;
1913 register u64 val64 = 0; 1913 register u64 val64 = 0;
1914 u16 subid, i; 1914 u16 subid, i;
1915 mac_info_t *mac_control; 1915 struct mac_info *mac_control;
1916 struct config_param *config; 1916 struct config_param *config;
1917 1917
1918 mac_control = &nic->mac_control; 1918 mac_control = &nic->mac_control;
@@ -2017,11 +2017,12 @@ static int start_nic(struct s2io_nic *nic)
2017/** 2017/**
2018 * s2io_txdl_getskb - Get the skb from txdl, unmap and return skb 2018 * s2io_txdl_getskb - Get the skb from txdl, unmap and return skb
2019 */ 2019 */
2020static struct sk_buff *s2io_txdl_getskb(fifo_info_t *fifo_data, TxD_t *txdlp, int get_off) 2020static struct sk_buff *s2io_txdl_getskb(struct fifo_info *fifo_data, struct \
2021 TxD *txdlp, int get_off)
2021{ 2022{
2022 nic_t *nic = fifo_data->nic; 2023 struct s2io_nic *nic = fifo_data->nic;
2023 struct sk_buff *skb; 2024 struct sk_buff *skb;
2024 TxD_t *txds; 2025 struct TxD *txds;
2025 u16 j, frg_cnt; 2026 u16 j, frg_cnt;
2026 2027
2027 txds = txdlp; 2028 txds = txdlp;
@@ -2035,7 +2036,7 @@ static struct sk_buff *s2io_txdl_getskb(fifo_info_t *fifo_data, TxD_t *txdlp, in
2035 skb = (struct sk_buff *) ((unsigned long) 2036 skb = (struct sk_buff *) ((unsigned long)
2036 txds->Host_Control); 2037 txds->Host_Control);
2037 if (!skb) { 2038 if (!skb) {
2038 memset(txdlp, 0, (sizeof(TxD_t) * fifo_data->max_txds)); 2039 memset(txdlp, 0, (sizeof(struct TxD) * fifo_data->max_txds));
2039 return NULL; 2040 return NULL;
2040 } 2041 }
2041 pci_unmap_single(nic->pdev, (dma_addr_t) 2042 pci_unmap_single(nic->pdev, (dma_addr_t)
@@ -2054,7 +2055,7 @@ static struct sk_buff *s2io_txdl_getskb(fifo_info_t *fifo_data, TxD_t *txdlp, in
2054 frag->size, PCI_DMA_TODEVICE); 2055 frag->size, PCI_DMA_TODEVICE);
2055 } 2056 }
2056 } 2057 }
2057 memset(txdlp,0, (sizeof(TxD_t) * fifo_data->max_txds)); 2058 memset(txdlp,0, (sizeof(struct TxD) * fifo_data->max_txds));
2058 return(skb); 2059 return(skb);
2059} 2060}
2060 2061
@@ -2070,9 +2071,9 @@ static void free_tx_buffers(struct s2io_nic *nic)
2070{ 2071{
2071 struct net_device *dev = nic->dev; 2072 struct net_device *dev = nic->dev;
2072 struct sk_buff *skb; 2073 struct sk_buff *skb;
2073 TxD_t *txdp; 2074 struct TxD *txdp;
2074 int i, j; 2075 int i, j;
2075 mac_info_t *mac_control; 2076 struct mac_info *mac_control;
2076 struct config_param *config; 2077 struct config_param *config;
2077 int cnt = 0; 2078 int cnt = 0;
2078 2079
@@ -2081,7 +2082,7 @@ static void free_tx_buffers(struct s2io_nic *nic)
2081 2082
2082 for (i = 0; i < config->tx_fifo_num; i++) { 2083 for (i = 0; i < config->tx_fifo_num; i++) {
2083 for (j = 0; j < config->tx_cfg[i].fifo_len - 1; j++) { 2084 for (j = 0; j < config->tx_cfg[i].fifo_len - 1; j++) {
2084 txdp = (TxD_t *) mac_control->fifos[i].list_info[j]. 2085 txdp = (struct TxD *) mac_control->fifos[i].list_info[j].
2085 list_virt_addr; 2086 list_virt_addr;
2086 skb = s2io_txdl_getskb(&mac_control->fifos[i], txdp, j); 2087 skb = s2io_txdl_getskb(&mac_control->fifos[i], txdp, j);
2087 if (skb) { 2088 if (skb) {
@@ -2109,10 +2110,10 @@ static void free_tx_buffers(struct s2io_nic *nic)
2109 2110
2110static void stop_nic(struct s2io_nic *nic) 2111static void stop_nic(struct s2io_nic *nic)
2111{ 2112{
2112 XENA_dev_config_t __iomem *bar0 = nic->bar0; 2113 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2113 register u64 val64 = 0; 2114 register u64 val64 = 0;
2114 u16 interruptible; 2115 u16 interruptible;
2115 mac_info_t *mac_control; 2116 struct mac_info *mac_control;
2116 struct config_param *config; 2117 struct config_param *config;
2117 2118
2118 mac_control = &nic->mac_control; 2119 mac_control = &nic->mac_control;
@@ -2130,14 +2131,15 @@ static void stop_nic(struct s2io_nic *nic)
2130 writeq(val64, &bar0->adapter_control); 2131 writeq(val64, &bar0->adapter_control);
2131} 2132}
2132 2133
2133static int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) 2134static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \
2135 sk_buff *skb)
2134{ 2136{
2135 struct net_device *dev = nic->dev; 2137 struct net_device *dev = nic->dev;
2136 struct sk_buff *frag_list; 2138 struct sk_buff *frag_list;
2137 void *tmp; 2139 void *tmp;
2138 2140
2139 /* Buffer-1 receives L3/L4 headers */ 2141 /* Buffer-1 receives L3/L4 headers */
2140 ((RxD3_t*)rxdp)->Buffer1_ptr = pci_map_single 2142 ((struct RxD3*)rxdp)->Buffer1_ptr = pci_map_single
2141 (nic->pdev, skb->data, l3l4hdr_size + 4, 2143 (nic->pdev, skb->data, l3l4hdr_size + 4,
2142 PCI_DMA_FROMDEVICE); 2144 PCI_DMA_FROMDEVICE);
2143 2145
@@ -2155,7 +2157,7 @@ static int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb)
2155 frag_list->tail = tmp; 2157 frag_list->tail = tmp;
2156 2158
2157 /* Buffer-2 receives L4 data payload */ 2159 /* Buffer-2 receives L4 data payload */
2158 ((RxD3_t*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, 2160 ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev,
2159 frag_list->data, dev->mtu, 2161 frag_list->data, dev->mtu,
2160 PCI_DMA_FROMDEVICE); 2162 PCI_DMA_FROMDEVICE);
2161 rxdp->Control_2 |= SET_BUFFER1_SIZE_3(l3l4hdr_size + 4); 2163 rxdp->Control_2 |= SET_BUFFER1_SIZE_3(l3l4hdr_size + 4);
@@ -2189,16 +2191,16 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2189{ 2191{
2190 struct net_device *dev = nic->dev; 2192 struct net_device *dev = nic->dev;
2191 struct sk_buff *skb; 2193 struct sk_buff *skb;
2192 RxD_t *rxdp; 2194 struct RxD_t *rxdp;
2193 int off, off1, size, block_no, block_no1; 2195 int off, off1, size, block_no, block_no1;
2194 u32 alloc_tab = 0; 2196 u32 alloc_tab = 0;
2195 u32 alloc_cnt; 2197 u32 alloc_cnt;
2196 mac_info_t *mac_control; 2198 struct mac_info *mac_control;
2197 struct config_param *config; 2199 struct config_param *config;
2198 u64 tmp; 2200 u64 tmp;
2199 buffAdd_t *ba; 2201 struct buffAdd *ba;
2200 unsigned long flags; 2202 unsigned long flags;
2201 RxD_t *first_rxdp = NULL; 2203 struct RxD_t *first_rxdp = NULL;
2202 2204
2203 mac_control = &nic->mac_control; 2205 mac_control = &nic->mac_control;
2204 config = &nic->config; 2206 config = &nic->config;
@@ -2280,9 +2282,9 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2280 } 2282 }
2281 if (nic->rxd_mode == RXD_MODE_1) { 2283 if (nic->rxd_mode == RXD_MODE_1) {
2282 /* 1 buffer mode - normal operation mode */ 2284 /* 1 buffer mode - normal operation mode */
2283 memset(rxdp, 0, sizeof(RxD1_t)); 2285 memset(rxdp, 0, sizeof(struct RxD1));
2284 skb_reserve(skb, NET_IP_ALIGN); 2286 skb_reserve(skb, NET_IP_ALIGN);
2285 ((RxD1_t*)rxdp)->Buffer0_ptr = pci_map_single 2287 ((struct RxD1*)rxdp)->Buffer0_ptr = pci_map_single
2286 (nic->pdev, skb->data, size - NET_IP_ALIGN, 2288 (nic->pdev, skb->data, size - NET_IP_ALIGN,
2287 PCI_DMA_FROMDEVICE); 2289 PCI_DMA_FROMDEVICE);
2288 rxdp->Control_2 = SET_BUFFER0_SIZE_1(size - NET_IP_ALIGN); 2290 rxdp->Control_2 = SET_BUFFER0_SIZE_1(size - NET_IP_ALIGN);
@@ -2299,7 +2301,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2299 * payload 2301 * payload
2300 */ 2302 */
2301 2303
2302 memset(rxdp, 0, sizeof(RxD3_t)); 2304 memset(rxdp, 0, sizeof(struct RxD3));
2303 ba = &mac_control->rings[ring_no].ba[block_no][off]; 2305 ba = &mac_control->rings[ring_no].ba[block_no][off];
2304 skb_reserve(skb, BUF0_LEN); 2306 skb_reserve(skb, BUF0_LEN);
2305 tmp = (u64)(unsigned long) skb->data; 2307 tmp = (u64)(unsigned long) skb->data;
@@ -2308,13 +2310,13 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2308 skb->data = (void *) (unsigned long)tmp; 2310 skb->data = (void *) (unsigned long)tmp;
2309 skb->tail = (void *) (unsigned long)tmp; 2311 skb->tail = (void *) (unsigned long)tmp;
2310 2312
2311 if (!(((RxD3_t*)rxdp)->Buffer0_ptr)) 2313 if (!(((struct RxD3*)rxdp)->Buffer0_ptr))
2312 ((RxD3_t*)rxdp)->Buffer0_ptr = 2314 ((struct RxD3*)rxdp)->Buffer0_ptr =
2313 pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN, 2315 pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN,
2314 PCI_DMA_FROMDEVICE); 2316 PCI_DMA_FROMDEVICE);
2315 else 2317 else
2316 pci_dma_sync_single_for_device(nic->pdev, 2318 pci_dma_sync_single_for_device(nic->pdev,
2317 (dma_addr_t) ((RxD3_t*)rxdp)->Buffer0_ptr, 2319 (dma_addr_t) ((struct RxD3*)rxdp)->Buffer0_ptr,
2318 BUF0_LEN, PCI_DMA_FROMDEVICE); 2320 BUF0_LEN, PCI_DMA_FROMDEVICE);
2319 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN); 2321 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
2320 if (nic->rxd_mode == RXD_MODE_3B) { 2322 if (nic->rxd_mode == RXD_MODE_3B) {
@@ -2324,13 +2326,13 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2324 * Buffer2 will have L3/L4 header plus 2326 * Buffer2 will have L3/L4 header plus
2325 * L4 payload 2327 * L4 payload
2326 */ 2328 */
2327 ((RxD3_t*)rxdp)->Buffer2_ptr = pci_map_single 2329 ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single
2328 (nic->pdev, skb->data, dev->mtu + 4, 2330 (nic->pdev, skb->data, dev->mtu + 4,
2329 PCI_DMA_FROMDEVICE); 2331 PCI_DMA_FROMDEVICE);
2330 2332
2331 /* Buffer-1 will be dummy buffer. Not used */ 2333 /* Buffer-1 will be dummy buffer. Not used */
2332 if (!(((RxD3_t*)rxdp)->Buffer1_ptr)) { 2334 if (!(((struct RxD3*)rxdp)->Buffer1_ptr)) {
2333 ((RxD3_t*)rxdp)->Buffer1_ptr = 2335 ((struct RxD3*)rxdp)->Buffer1_ptr =
2334 pci_map_single(nic->pdev, 2336 pci_map_single(nic->pdev,
2335 ba->ba_1, BUF1_LEN, 2337 ba->ba_1, BUF1_LEN,
2336 PCI_DMA_FROMDEVICE); 2338 PCI_DMA_FROMDEVICE);
@@ -2390,9 +2392,9 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
2390 struct net_device *dev = sp->dev; 2392 struct net_device *dev = sp->dev;
2391 int j; 2393 int j;
2392 struct sk_buff *skb; 2394 struct sk_buff *skb;
2393 RxD_t *rxdp; 2395 struct RxD_t *rxdp;
2394 mac_info_t *mac_control; 2396 struct mac_info *mac_control;
2395 buffAdd_t *ba; 2397 struct buffAdd *ba;
2396 2398
2397 mac_control = &sp->mac_control; 2399 mac_control = &sp->mac_control;
2398 for (j = 0 ; j < rxd_count[sp->rxd_mode]; j++) { 2400 for (j = 0 ; j < rxd_count[sp->rxd_mode]; j++) {
@@ -2405,41 +2407,41 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
2405 } 2407 }
2406 if (sp->rxd_mode == RXD_MODE_1) { 2408 if (sp->rxd_mode == RXD_MODE_1) {
2407 pci_unmap_single(sp->pdev, (dma_addr_t) 2409 pci_unmap_single(sp->pdev, (dma_addr_t)
2408 ((RxD1_t*)rxdp)->Buffer0_ptr, 2410 ((struct RxD1*)rxdp)->Buffer0_ptr,
2409 dev->mtu + 2411 dev->mtu +
2410 HEADER_ETHERNET_II_802_3_SIZE 2412 HEADER_ETHERNET_II_802_3_SIZE
2411 + HEADER_802_2_SIZE + 2413 + HEADER_802_2_SIZE +
2412 HEADER_SNAP_SIZE, 2414 HEADER_SNAP_SIZE,
2413 PCI_DMA_FROMDEVICE); 2415 PCI_DMA_FROMDEVICE);
2414 memset(rxdp, 0, sizeof(RxD1_t)); 2416 memset(rxdp, 0, sizeof(struct RxD1));
2415 } else if(sp->rxd_mode == RXD_MODE_3B) { 2417 } else if(sp->rxd_mode == RXD_MODE_3B) {
2416 ba = &mac_control->rings[ring_no]. 2418 ba = &mac_control->rings[ring_no].
2417 ba[blk][j]; 2419 ba[blk][j];
2418 pci_unmap_single(sp->pdev, (dma_addr_t) 2420 pci_unmap_single(sp->pdev, (dma_addr_t)
2419 ((RxD3_t*)rxdp)->Buffer0_ptr, 2421 ((struct RxD3*)rxdp)->Buffer0_ptr,
2420 BUF0_LEN, 2422 BUF0_LEN,
2421 PCI_DMA_FROMDEVICE); 2423 PCI_DMA_FROMDEVICE);
2422 pci_unmap_single(sp->pdev, (dma_addr_t) 2424 pci_unmap_single(sp->pdev, (dma_addr_t)
2423 ((RxD3_t*)rxdp)->Buffer1_ptr, 2425 ((struct RxD3*)rxdp)->Buffer1_ptr,
2424 BUF1_LEN, 2426 BUF1_LEN,
2425 PCI_DMA_FROMDEVICE); 2427 PCI_DMA_FROMDEVICE);
2426 pci_unmap_single(sp->pdev, (dma_addr_t) 2428 pci_unmap_single(sp->pdev, (dma_addr_t)
2427 ((RxD3_t*)rxdp)->Buffer2_ptr, 2429 ((struct RxD3*)rxdp)->Buffer2_ptr,
2428 dev->mtu + 4, 2430 dev->mtu + 4,
2429 PCI_DMA_FROMDEVICE); 2431 PCI_DMA_FROMDEVICE);
2430 memset(rxdp, 0, sizeof(RxD3_t)); 2432 memset(rxdp, 0, sizeof(struct RxD3));
2431 } else { 2433 } else {
2432 pci_unmap_single(sp->pdev, (dma_addr_t) 2434 pci_unmap_single(sp->pdev, (dma_addr_t)
2433 ((RxD3_t*)rxdp)->Buffer0_ptr, BUF0_LEN, 2435 ((struct RxD3*)rxdp)->Buffer0_ptr, BUF0_LEN,
2434 PCI_DMA_FROMDEVICE); 2436 PCI_DMA_FROMDEVICE);
2435 pci_unmap_single(sp->pdev, (dma_addr_t) 2437 pci_unmap_single(sp->pdev, (dma_addr_t)
2436 ((RxD3_t*)rxdp)->Buffer1_ptr, 2438 ((struct RxD3*)rxdp)->Buffer1_ptr,
2437 l3l4hdr_size + 4, 2439 l3l4hdr_size + 4,
2438 PCI_DMA_FROMDEVICE); 2440 PCI_DMA_FROMDEVICE);
2439 pci_unmap_single(sp->pdev, (dma_addr_t) 2441 pci_unmap_single(sp->pdev, (dma_addr_t)
2440 ((RxD3_t*)rxdp)->Buffer2_ptr, dev->mtu, 2442 ((struct RxD3*)rxdp)->Buffer2_ptr, dev->mtu,
2441 PCI_DMA_FROMDEVICE); 2443 PCI_DMA_FROMDEVICE);
2442 memset(rxdp, 0, sizeof(RxD3_t)); 2444 memset(rxdp, 0, sizeof(struct RxD3));
2443 } 2445 }
2444 dev_kfree_skb(skb); 2446 dev_kfree_skb(skb);
2445 atomic_dec(&sp->rx_bufs_left[ring_no]); 2447 atomic_dec(&sp->rx_bufs_left[ring_no]);
@@ -2459,7 +2461,7 @@ static void free_rx_buffers(struct s2io_nic *sp)
2459{ 2461{
2460 struct net_device *dev = sp->dev; 2462 struct net_device *dev = sp->dev;
2461 int i, blk = 0, buf_cnt = 0; 2463 int i, blk = 0, buf_cnt = 0;
2462 mac_info_t *mac_control; 2464 struct mac_info *mac_control;
2463 struct config_param *config; 2465 struct config_param *config;
2464 2466
2465 mac_control = &sp->mac_control; 2467 mac_control = &sp->mac_control;
@@ -2494,11 +2496,11 @@ static void free_rx_buffers(struct s2io_nic *sp)
2494 2496
2495static int s2io_poll(struct net_device *dev, int *budget) 2497static int s2io_poll(struct net_device *dev, int *budget)
2496{ 2498{
2497 nic_t *nic = dev->priv; 2499 struct s2io_nic *nic = dev->priv;
2498 int pkt_cnt = 0, org_pkts_to_process; 2500 int pkt_cnt = 0, org_pkts_to_process;
2499 mac_info_t *mac_control; 2501 struct mac_info *mac_control;
2500 struct config_param *config; 2502 struct config_param *config;
2501 XENA_dev_config_t __iomem *bar0 = nic->bar0; 2503 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2502 int i; 2504 int i;
2503 2505
2504 atomic_inc(&nic->isr_cnt); 2506 atomic_inc(&nic->isr_cnt);
@@ -2568,10 +2570,10 @@ no_rx:
2568 */ 2570 */
2569static void s2io_netpoll(struct net_device *dev) 2571static void s2io_netpoll(struct net_device *dev)
2570{ 2572{
2571 nic_t *nic = dev->priv; 2573 struct s2io_nic *nic = dev->priv;
2572 mac_info_t *mac_control; 2574 struct mac_info *mac_control;
2573 struct config_param *config; 2575 struct config_param *config;
2574 XENA_dev_config_t __iomem *bar0 = nic->bar0; 2576 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2575 u64 val64 = 0xFFFFFFFFFFFFFFFFULL; 2577 u64 val64 = 0xFFFFFFFFFFFFFFFFULL;
2576 int i; 2578 int i;
2577 2579
@@ -2620,13 +2622,13 @@ static void s2io_netpoll(struct net_device *dev)
2620 * Return Value: 2622 * Return Value:
2621 * NONE. 2623 * NONE.
2622 */ 2624 */
2623static void rx_intr_handler(ring_info_t *ring_data) 2625static void rx_intr_handler(struct ring_info *ring_data)
2624{ 2626{
2625 nic_t *nic = ring_data->nic; 2627 struct s2io_nic *nic = ring_data->nic;
2626 struct net_device *dev = (struct net_device *) nic->dev; 2628 struct net_device *dev = (struct net_device *) nic->dev;
2627 int get_block, put_block, put_offset; 2629 int get_block, put_block, put_offset;
2628 rx_curr_get_info_t get_info, put_info; 2630 struct rx_curr_get_info get_info, put_info;
2629 RxD_t *rxdp; 2631 struct RxD_t *rxdp;
2630 struct sk_buff *skb; 2632 struct sk_buff *skb;
2631 int pkt_cnt = 0; 2633 int pkt_cnt = 0;
2632 int i; 2634 int i;
@@ -2641,7 +2643,7 @@ static void rx_intr_handler(ring_info_t *ring_data)
2641 2643
2642 get_info = ring_data->rx_curr_get_info; 2644 get_info = ring_data->rx_curr_get_info;
2643 get_block = get_info.block_index; 2645 get_block = get_info.block_index;
2644 put_info = ring_data->rx_curr_put_info; 2646 memcpy(&put_info, &ring_data->rx_curr_put_info, sizeof(put_info));
2645 put_block = put_info.block_index; 2647 put_block = put_info.block_index;
2646 rxdp = ring_data->rx_blocks[get_block].rxds[get_info.offset].virt_addr; 2648 rxdp = ring_data->rx_blocks[get_block].rxds[get_info.offset].virt_addr;
2647 if (!napi) { 2649 if (!napi) {
@@ -2671,7 +2673,7 @@ static void rx_intr_handler(ring_info_t *ring_data)
2671 } 2673 }
2672 if (nic->rxd_mode == RXD_MODE_1) { 2674 if (nic->rxd_mode == RXD_MODE_1) {
2673 pci_unmap_single(nic->pdev, (dma_addr_t) 2675 pci_unmap_single(nic->pdev, (dma_addr_t)
2674 ((RxD1_t*)rxdp)->Buffer0_ptr, 2676 ((struct RxD1*)rxdp)->Buffer0_ptr,
2675 dev->mtu + 2677 dev->mtu +
2676 HEADER_ETHERNET_II_802_3_SIZE + 2678 HEADER_ETHERNET_II_802_3_SIZE +
2677 HEADER_802_2_SIZE + 2679 HEADER_802_2_SIZE +
@@ -2679,22 +2681,22 @@ static void rx_intr_handler(ring_info_t *ring_data)
2679 PCI_DMA_FROMDEVICE); 2681 PCI_DMA_FROMDEVICE);
2680 } else if (nic->rxd_mode == RXD_MODE_3B) { 2682 } else if (nic->rxd_mode == RXD_MODE_3B) {
2681 pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t) 2683 pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t)
2682 ((RxD3_t*)rxdp)->Buffer0_ptr, 2684 ((struct RxD3*)rxdp)->Buffer0_ptr,
2683 BUF0_LEN, PCI_DMA_FROMDEVICE); 2685 BUF0_LEN, PCI_DMA_FROMDEVICE);
2684 pci_unmap_single(nic->pdev, (dma_addr_t) 2686 pci_unmap_single(nic->pdev, (dma_addr_t)
2685 ((RxD3_t*)rxdp)->Buffer2_ptr, 2687 ((struct RxD3*)rxdp)->Buffer2_ptr,
2686 dev->mtu + 4, 2688 dev->mtu + 4,
2687 PCI_DMA_FROMDEVICE); 2689 PCI_DMA_FROMDEVICE);
2688 } else { 2690 } else {
2689 pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t) 2691 pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t)
2690 ((RxD3_t*)rxdp)->Buffer0_ptr, BUF0_LEN, 2692 ((struct RxD3*)rxdp)->Buffer0_ptr, BUF0_LEN,
2691 PCI_DMA_FROMDEVICE); 2693 PCI_DMA_FROMDEVICE);
2692 pci_unmap_single(nic->pdev, (dma_addr_t) 2694 pci_unmap_single(nic->pdev, (dma_addr_t)
2693 ((RxD3_t*)rxdp)->Buffer1_ptr, 2695 ((struct RxD3*)rxdp)->Buffer1_ptr,
2694 l3l4hdr_size + 4, 2696 l3l4hdr_size + 4,
2695 PCI_DMA_FROMDEVICE); 2697 PCI_DMA_FROMDEVICE);
2696 pci_unmap_single(nic->pdev, (dma_addr_t) 2698 pci_unmap_single(nic->pdev, (dma_addr_t)
2697 ((RxD3_t*)rxdp)->Buffer2_ptr, 2699 ((struct RxD3*)rxdp)->Buffer2_ptr,
2698 dev->mtu, PCI_DMA_FROMDEVICE); 2700 dev->mtu, PCI_DMA_FROMDEVICE);
2699 } 2701 }
2700 prefetch(skb->data); 2702 prefetch(skb->data);
@@ -2723,7 +2725,7 @@ static void rx_intr_handler(ring_info_t *ring_data)
2723 if (nic->lro) { 2725 if (nic->lro) {
2724 /* Clear all LRO sessions before exiting */ 2726 /* Clear all LRO sessions before exiting */
2725 for (i=0; i<MAX_LRO_SESSIONS; i++) { 2727 for (i=0; i<MAX_LRO_SESSIONS; i++) {
2726 lro_t *lro = &nic->lro0_n[i]; 2728 struct lro *lro = &nic->lro0_n[i];
2727 if (lro->in_use) { 2729 if (lro->in_use) {
2728 update_L3L4_header(nic, lro); 2730 update_L3L4_header(nic, lro);
2729 queue_rx_frame(lro->parent); 2731 queue_rx_frame(lro->parent);
@@ -2747,17 +2749,17 @@ static void rx_intr_handler(ring_info_t *ring_data)
2747 * NONE 2749 * NONE
2748 */ 2750 */
2749 2751
2750static void tx_intr_handler(fifo_info_t *fifo_data) 2752static void tx_intr_handler(struct fifo_info *fifo_data)
2751{ 2753{
2752 nic_t *nic = fifo_data->nic; 2754 struct s2io_nic *nic = fifo_data->nic;
2753 struct net_device *dev = (struct net_device *) nic->dev; 2755 struct net_device *dev = (struct net_device *) nic->dev;
2754 tx_curr_get_info_t get_info, put_info; 2756 struct tx_curr_get_info get_info, put_info;
2755 struct sk_buff *skb; 2757 struct sk_buff *skb;
2756 TxD_t *txdlp; 2758 struct TxD *txdlp;
2757 2759
2758 get_info = fifo_data->tx_curr_get_info; 2760 get_info = fifo_data->tx_curr_get_info;
2759 put_info = fifo_data->tx_curr_put_info; 2761 memcpy(&put_info, &fifo_data->tx_curr_put_info, sizeof(put_info));
2760 txdlp = (TxD_t *) fifo_data->list_info[get_info.offset]. 2762 txdlp = (struct TxD *) fifo_data->list_info[get_info.offset].
2761 list_virt_addr; 2763 list_virt_addr;
2762 while ((!(txdlp->Control_1 & TXD_LIST_OWN_XENA)) && 2764 while ((!(txdlp->Control_1 & TXD_LIST_OWN_XENA)) &&
2763 (get_info.offset != put_info.offset) && 2765 (get_info.offset != put_info.offset) &&
@@ -2794,7 +2796,7 @@ static void tx_intr_handler(fifo_info_t *fifo_data)
2794 get_info.offset++; 2796 get_info.offset++;
2795 if (get_info.offset == get_info.fifo_len + 1) 2797 if (get_info.offset == get_info.fifo_len + 1)
2796 get_info.offset = 0; 2798 get_info.offset = 0;
2797 txdlp = (TxD_t *) fifo_data->list_info 2799 txdlp = (struct TxD *) fifo_data->list_info
2798 [get_info.offset].list_virt_addr; 2800 [get_info.offset].list_virt_addr;
2799 fifo_data->tx_curr_get_info.offset = 2801 fifo_data->tx_curr_get_info.offset =
2800 get_info.offset; 2802 get_info.offset;
@@ -2819,8 +2821,8 @@ static void tx_intr_handler(fifo_info_t *fifo_data)
2819static void s2io_mdio_write(u32 mmd_type, u64 addr, u16 value, struct net_device *dev) 2821static void s2io_mdio_write(u32 mmd_type, u64 addr, u16 value, struct net_device *dev)
2820{ 2822{
2821 u64 val64 = 0x0; 2823 u64 val64 = 0x0;
2822 nic_t *sp = dev->priv; 2824 struct s2io_nic *sp = dev->priv;
2823 XENA_dev_config_t __iomem *bar0 = sp->bar0; 2825 struct XENA_dev_config __iomem *bar0 = sp->bar0;
2824 2826
2825 //address transaction 2827 //address transaction
2826 val64 = val64 | MDIO_MMD_INDX_ADDR(addr) 2828 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
@@ -2868,8 +2870,8 @@ static u64 s2io_mdio_read(u32 mmd_type, u64 addr, struct net_device *dev)
2868{ 2870{
2869 u64 val64 = 0x0; 2871 u64 val64 = 0x0;
2870 u64 rval64 = 0x0; 2872 u64 rval64 = 0x0;
2871 nic_t *sp = dev->priv; 2873 struct s2io_nic *sp = dev->priv;
2872 XENA_dev_config_t __iomem *bar0 = sp->bar0; 2874 struct XENA_dev_config __iomem *bar0 = sp->bar0;
2873 2875
2874 /* address transaction */ 2876 /* address transaction */
2875 val64 = val64 | MDIO_MMD_INDX_ADDR(addr) 2877 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
@@ -2972,8 +2974,8 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
2972 u64 val64 = 0x0; 2974 u64 val64 = 0x0;
2973 u64 addr = 0x0; 2975 u64 addr = 0x0;
2974 2976
2975 nic_t *sp = dev->priv; 2977 struct s2io_nic *sp = dev->priv;
2976 StatInfo_t *stat_info = sp->mac_control.stats_info; 2978 struct stat_block *stat_info = sp->mac_control.stats_info;
2977 2979
2978 /* Check the communication with the MDIO slave */ 2980 /* Check the communication with the MDIO slave */
2979 addr = 0x0000; 2981 addr = 0x0000;
@@ -3071,7 +3073,7 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
3071static void alarm_intr_handler(struct s2io_nic *nic) 3073static void alarm_intr_handler(struct s2io_nic *nic)
3072{ 3074{
3073 struct net_device *dev = (struct net_device *) nic->dev; 3075 struct net_device *dev = (struct net_device *) nic->dev;
3074 XENA_dev_config_t __iomem *bar0 = nic->bar0; 3076 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3075 register u64 val64 = 0, err_reg = 0; 3077 register u64 val64 = 0, err_reg = 0;
3076 u64 cnt; 3078 u64 cnt;
3077 int i; 3079 int i;
@@ -3246,9 +3248,9 @@ static u16 check_pci_device_id(u16 id)
3246 * void. 3248 * void.
3247 */ 3249 */
3248 3250
3249static void s2io_reset(nic_t * sp) 3251static void s2io_reset(struct s2io_nic * sp)
3250{ 3252{
3251 XENA_dev_config_t __iomem *bar0 = sp->bar0; 3253 struct XENA_dev_config __iomem *bar0 = sp->bar0;
3252 u64 val64; 3254 u64 val64;
3253 u16 subid, pci_cmd; 3255 u16 subid, pci_cmd;
3254 int i; 3256 int i;
@@ -3352,10 +3354,10 @@ new_way:
3352 * SUCCESS on success and FAILURE on failure. 3354 * SUCCESS on success and FAILURE on failure.
3353 */ 3355 */
3354 3356
3355static int s2io_set_swapper(nic_t * sp) 3357static int s2io_set_swapper(struct s2io_nic * sp)
3356{ 3358{
3357 struct net_device *dev = sp->dev; 3359 struct net_device *dev = sp->dev;
3358 XENA_dev_config_t __iomem *bar0 = sp->bar0; 3360 struct XENA_dev_config __iomem *bar0 = sp->bar0;
3359 u64 val64, valt, valr; 3361 u64 val64, valt, valr;
3360 3362
3361 /* 3363 /*
@@ -3480,9 +3482,9 @@ static int s2io_set_swapper(nic_t * sp)
3480 return SUCCESS; 3482 return SUCCESS;
3481} 3483}
3482 3484
3483static int wait_for_msix_trans(nic_t *nic, int i) 3485static int wait_for_msix_trans(struct s2io_nic *nic, int i)
3484{ 3486{
3485 XENA_dev_config_t __iomem *bar0 = nic->bar0; 3487 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3486 u64 val64; 3488 u64 val64;
3487 int ret = 0, cnt = 0; 3489 int ret = 0, cnt = 0;
3488 3490
@@ -3501,9 +3503,9 @@ static int wait_for_msix_trans(nic_t *nic, int i)
3501 return ret; 3503 return ret;
3502} 3504}
3503 3505
3504static void restore_xmsi_data(nic_t *nic) 3506static void restore_xmsi_data(struct s2io_nic *nic)
3505{ 3507{
3506 XENA_dev_config_t __iomem *bar0 = nic->bar0; 3508 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3507 u64 val64; 3509 u64 val64;
3508 int i; 3510 int i;
3509 3511
@@ -3519,9 +3521,9 @@ static void restore_xmsi_data(nic_t *nic)
3519 } 3521 }
3520} 3522}
3521 3523
3522static void store_xmsi_data(nic_t *nic) 3524static void store_xmsi_data(struct s2io_nic *nic)
3523{ 3525{
3524 XENA_dev_config_t __iomem *bar0 = nic->bar0; 3526 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3525 u64 val64, addr, data; 3527 u64 val64, addr, data;
3526 int i; 3528 int i;
3527 3529
@@ -3542,9 +3544,9 @@ static void store_xmsi_data(nic_t *nic)
3542 } 3544 }
3543} 3545}
3544 3546
3545int s2io_enable_msi(nic_t *nic) 3547int s2io_enable_msi(struct s2io_nic *nic)
3546{ 3548{
3547 XENA_dev_config_t __iomem *bar0 = nic->bar0; 3549 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3548 u16 msi_ctrl, msg_val; 3550 u16 msi_ctrl, msg_val;
3549 struct config_param *config = &nic->config; 3551 struct config_param *config = &nic->config;
3550 struct net_device *dev = nic->dev; 3552 struct net_device *dev = nic->dev;
@@ -3592,9 +3594,9 @@ int s2io_enable_msi(nic_t *nic)
3592 return 0; 3594 return 0;
3593} 3595}
3594 3596
3595static int s2io_enable_msi_x(nic_t *nic) 3597static int s2io_enable_msi_x(struct s2io_nic *nic)
3596{ 3598{
3597 XENA_dev_config_t __iomem *bar0 = nic->bar0; 3599 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3598 u64 tx_mat, rx_mat; 3600 u64 tx_mat, rx_mat;
3599 u16 msi_control; /* Temp variable */ 3601 u16 msi_control; /* Temp variable */
3600 int ret, i, j, msix_indx = 1; 3602 int ret, i, j, msix_indx = 1;
@@ -3702,7 +3704,7 @@ static int s2io_enable_msi_x(nic_t *nic)
3702 3704
3703static int s2io_open(struct net_device *dev) 3705static int s2io_open(struct net_device *dev)
3704{ 3706{
3705 nic_t *sp = dev->priv; 3707 struct s2io_nic *sp = dev->priv;
3706 int err = 0; 3708 int err = 0;
3707 3709
3708 /* 3710 /*
@@ -3755,7 +3757,7 @@ hw_init_failed:
3755 3757
3756static int s2io_close(struct net_device *dev) 3758static int s2io_close(struct net_device *dev)
3757{ 3759{
3758 nic_t *sp = dev->priv; 3760 struct s2io_nic *sp = dev->priv;
3759 3761
3760 flush_scheduled_work(); 3762 flush_scheduled_work();
3761 netif_stop_queue(dev); 3763 netif_stop_queue(dev);
@@ -3781,15 +3783,15 @@ static int s2io_close(struct net_device *dev)
3781 3783
3782static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) 3784static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
3783{ 3785{
3784 nic_t *sp = dev->priv; 3786 struct s2io_nic *sp = dev->priv;
3785 u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; 3787 u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off;
3786 register u64 val64; 3788 register u64 val64;
3787 TxD_t *txdp; 3789 struct TxD *txdp;
3788 TxFIFO_element_t __iomem *tx_fifo; 3790 struct TxFIFO_element __iomem *tx_fifo;
3789 unsigned long flags; 3791 unsigned long flags;
3790 u16 vlan_tag = 0; 3792 u16 vlan_tag = 0;
3791 int vlan_priority = 0; 3793 int vlan_priority = 0;
3792 mac_info_t *mac_control; 3794 struct mac_info *mac_control;
3793 struct config_param *config; 3795 struct config_param *config;
3794 int offload_type; 3796 int offload_type;
3795 3797
@@ -3817,7 +3819,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
3817 3819
3818 put_off = (u16) mac_control->fifos[queue].tx_curr_put_info.offset; 3820 put_off = (u16) mac_control->fifos[queue].tx_curr_put_info.offset;
3819 get_off = (u16) mac_control->fifos[queue].tx_curr_get_info.offset; 3821 get_off = (u16) mac_control->fifos[queue].tx_curr_get_info.offset;
3820 txdp = (TxD_t *) mac_control->fifos[queue].list_info[put_off]. 3822 txdp = (struct TxD *) mac_control->fifos[queue].list_info[put_off].
3821 list_virt_addr; 3823 list_virt_addr;
3822 3824
3823 queue_len = mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1; 3825 queue_len = mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1;
@@ -3944,13 +3946,13 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
3944static void 3946static void
3945s2io_alarm_handle(unsigned long data) 3947s2io_alarm_handle(unsigned long data)
3946{ 3948{
3947 nic_t *sp = (nic_t *)data; 3949 struct s2io_nic *sp = (struct s2io_nic *)data;
3948 3950
3949 alarm_intr_handler(sp); 3951 alarm_intr_handler(sp);
3950 mod_timer(&sp->alarm_timer, jiffies + HZ / 2); 3952 mod_timer(&sp->alarm_timer, jiffies + HZ / 2);
3951} 3953}
3952 3954
3953static int s2io_chk_rx_buffers(nic_t *sp, int rng_n) 3955static int s2io_chk_rx_buffers(struct s2io_nic *sp, int rng_n)
3954{ 3956{
3955 int rxb_size, level; 3957 int rxb_size, level;
3956 3958
@@ -3982,9 +3984,9 @@ static int s2io_chk_rx_buffers(nic_t *sp, int rng_n)
3982static irqreturn_t s2io_msi_handle(int irq, void *dev_id) 3984static irqreturn_t s2io_msi_handle(int irq, void *dev_id)
3983{ 3985{
3984 struct net_device *dev = (struct net_device *) dev_id; 3986 struct net_device *dev = (struct net_device *) dev_id;
3985 nic_t *sp = dev->priv; 3987 struct s2io_nic *sp = dev->priv;
3986 int i; 3988 int i;
3987 mac_info_t *mac_control; 3989 struct mac_info *mac_control;
3988 struct config_param *config; 3990 struct config_param *config;
3989 3991
3990 atomic_inc(&sp->isr_cnt); 3992 atomic_inc(&sp->isr_cnt);
@@ -4014,8 +4016,8 @@ static irqreturn_t s2io_msi_handle(int irq, void *dev_id)
4014 4016
4015static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id) 4017static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
4016{ 4018{
4017 ring_info_t *ring = (ring_info_t *)dev_id; 4019 struct ring_info *ring = (struct ring_info *)dev_id;
4018 nic_t *sp = ring->nic; 4020 struct s2io_nic *sp = ring->nic;
4019 4021
4020 atomic_inc(&sp->isr_cnt); 4022 atomic_inc(&sp->isr_cnt);
4021 4023
@@ -4028,17 +4030,17 @@ static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
4028 4030
4029static irqreturn_t s2io_msix_fifo_handle(int irq, void *dev_id) 4031static irqreturn_t s2io_msix_fifo_handle(int irq, void *dev_id)
4030{ 4032{
4031 fifo_info_t *fifo = (fifo_info_t *)dev_id; 4033 struct fifo_info *fifo = (struct fifo_info *)dev_id;
4032 nic_t *sp = fifo->nic; 4034 struct s2io_nic *sp = fifo->nic;
4033 4035
4034 atomic_inc(&sp->isr_cnt); 4036 atomic_inc(&sp->isr_cnt);
4035 tx_intr_handler(fifo); 4037 tx_intr_handler(fifo);
4036 atomic_dec(&sp->isr_cnt); 4038 atomic_dec(&sp->isr_cnt);
4037 return IRQ_HANDLED; 4039 return IRQ_HANDLED;
4038} 4040}
4039static void s2io_txpic_intr_handle(nic_t *sp) 4041static void s2io_txpic_intr_handle(struct s2io_nic *sp)
4040{ 4042{
4041 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4043 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4042 u64 val64; 4044 u64 val64;
4043 4045
4044 val64 = readq(&bar0->pic_int_status); 4046 val64 = readq(&bar0->pic_int_status);
@@ -4108,11 +4110,11 @@ static void s2io_txpic_intr_handle(nic_t *sp)
4108static irqreturn_t s2io_isr(int irq, void *dev_id) 4110static irqreturn_t s2io_isr(int irq, void *dev_id)
4109{ 4111{
4110 struct net_device *dev = (struct net_device *) dev_id; 4112 struct net_device *dev = (struct net_device *) dev_id;
4111 nic_t *sp = dev->priv; 4113 struct s2io_nic *sp = dev->priv;
4112 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4114 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4113 int i; 4115 int i;
4114 u64 reason = 0; 4116 u64 reason = 0;
4115 mac_info_t *mac_control; 4117 struct mac_info *mac_control;
4116 struct config_param *config; 4118 struct config_param *config;
4117 4119
4118 atomic_inc(&sp->isr_cnt); 4120 atomic_inc(&sp->isr_cnt);
@@ -4198,9 +4200,9 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
4198/** 4200/**
4199 * s2io_updt_stats - 4201 * s2io_updt_stats -
4200 */ 4202 */
4201static void s2io_updt_stats(nic_t *sp) 4203static void s2io_updt_stats(struct s2io_nic *sp)
4202{ 4204{
4203 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4205 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4204 u64 val64; 4206 u64 val64;
4205 int cnt = 0; 4207 int cnt = 0;
4206 4208
@@ -4219,7 +4221,7 @@ static void s2io_updt_stats(nic_t *sp)
4219 break; /* Updt failed */ 4221 break; /* Updt failed */
4220 } while(1); 4222 } while(1);
4221 } else { 4223 } else {
4222 memset(sp->mac_control.stats_info, 0, sizeof(StatInfo_t)); 4224 memset(sp->mac_control.stats_info, 0, sizeof(struct stat_block));
4223 } 4225 }
4224} 4226}
4225 4227
@@ -4235,8 +4237,8 @@ static void s2io_updt_stats(nic_t *sp)
4235 4237
4236static struct net_device_stats *s2io_get_stats(struct net_device *dev) 4238static struct net_device_stats *s2io_get_stats(struct net_device *dev)
4237{ 4239{
4238 nic_t *sp = dev->priv; 4240 struct s2io_nic *sp = dev->priv;
4239 mac_info_t *mac_control; 4241 struct mac_info *mac_control;
4240 struct config_param *config; 4242 struct config_param *config;
4241 4243
4242 4244
@@ -4277,8 +4279,8 @@ static void s2io_set_multicast(struct net_device *dev)
4277{ 4279{
4278 int i, j, prev_cnt; 4280 int i, j, prev_cnt;
4279 struct dev_mc_list *mclist; 4281 struct dev_mc_list *mclist;
4280 nic_t *sp = dev->priv; 4282 struct s2io_nic *sp = dev->priv;
4281 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4283 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4282 u64 val64 = 0, multi_mac = 0x010203040506ULL, mask = 4284 u64 val64 = 0, multi_mac = 0x010203040506ULL, mask =
4283 0xfeffffffffffULL; 4285 0xfeffffffffffULL;
4284 u64 dis_addr = 0xffffffffffffULL, mac_addr = 0; 4286 u64 dis_addr = 0xffffffffffffULL, mac_addr = 0;
@@ -4431,8 +4433,8 @@ static void s2io_set_multicast(struct net_device *dev)
4431 4433
4432static int s2io_set_mac_addr(struct net_device *dev, u8 * addr) 4434static int s2io_set_mac_addr(struct net_device *dev, u8 * addr)
4433{ 4435{
4434 nic_t *sp = dev->priv; 4436 struct s2io_nic *sp = dev->priv;
4435 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4437 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4436 register u64 val64, mac_addr = 0; 4438 register u64 val64, mac_addr = 0;
4437 int i; 4439 int i;
4438 4440
@@ -4478,7 +4480,7 @@ static int s2io_set_mac_addr(struct net_device *dev, u8 * addr)
4478static int s2io_ethtool_sset(struct net_device *dev, 4480static int s2io_ethtool_sset(struct net_device *dev,
4479 struct ethtool_cmd *info) 4481 struct ethtool_cmd *info)
4480{ 4482{
4481 nic_t *sp = dev->priv; 4483 struct s2io_nic *sp = dev->priv;
4482 if ((info->autoneg == AUTONEG_ENABLE) || 4484 if ((info->autoneg == AUTONEG_ENABLE) ||
4483 (info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL)) 4485 (info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL))
4484 return -EINVAL; 4486 return -EINVAL;
@@ -4504,7 +4506,7 @@ static int s2io_ethtool_sset(struct net_device *dev,
4504 4506
4505static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info) 4507static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
4506{ 4508{
4507 nic_t *sp = dev->priv; 4509 struct s2io_nic *sp = dev->priv;
4508 info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); 4510 info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
4509 info->advertising = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); 4511 info->advertising = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
4510 info->port = PORT_FIBRE; 4512 info->port = PORT_FIBRE;
@@ -4537,7 +4539,7 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
4537static void s2io_ethtool_gdrvinfo(struct net_device *dev, 4539static void s2io_ethtool_gdrvinfo(struct net_device *dev,
4538 struct ethtool_drvinfo *info) 4540 struct ethtool_drvinfo *info)
4539{ 4541{
4540 nic_t *sp = dev->priv; 4542 struct s2io_nic *sp = dev->priv;
4541 4543
4542 strncpy(info->driver, s2io_driver_name, sizeof(info->driver)); 4544 strncpy(info->driver, s2io_driver_name, sizeof(info->driver));
4543 strncpy(info->version, s2io_driver_version, sizeof(info->version)); 4545 strncpy(info->version, s2io_driver_version, sizeof(info->version));
@@ -4569,7 +4571,7 @@ static void s2io_ethtool_gregs(struct net_device *dev,
4569 int i; 4571 int i;
4570 u64 reg; 4572 u64 reg;
4571 u8 *reg_space = (u8 *) space; 4573 u8 *reg_space = (u8 *) space;
4572 nic_t *sp = dev->priv; 4574 struct s2io_nic *sp = dev->priv;
4573 4575
4574 regs->len = XENA_REG_SPACE; 4576 regs->len = XENA_REG_SPACE;
4575 regs->version = sp->pdev->subsystem_device; 4577 regs->version = sp->pdev->subsystem_device;
@@ -4591,8 +4593,8 @@ static void s2io_ethtool_gregs(struct net_device *dev,
4591*/ 4593*/
4592static void s2io_phy_id(unsigned long data) 4594static void s2io_phy_id(unsigned long data)
4593{ 4595{
4594 nic_t *sp = (nic_t *) data; 4596 struct s2io_nic *sp = (struct s2io_nic *) data;
4595 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4597 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4596 u64 val64 = 0; 4598 u64 val64 = 0;
4597 u16 subid; 4599 u16 subid;
4598 4600
@@ -4629,8 +4631,8 @@ static void s2io_phy_id(unsigned long data)
4629static int s2io_ethtool_idnic(struct net_device *dev, u32 data) 4631static int s2io_ethtool_idnic(struct net_device *dev, u32 data)
4630{ 4632{
4631 u64 val64 = 0, last_gpio_ctrl_val; 4633 u64 val64 = 0, last_gpio_ctrl_val;
4632 nic_t *sp = dev->priv; 4634 struct s2io_nic *sp = dev->priv;
4633 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4635 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4634 u16 subid; 4636 u16 subid;
4635 4637
4636 subid = sp->pdev->subsystem_device; 4638 subid = sp->pdev->subsystem_device;
@@ -4678,8 +4680,8 @@ static void s2io_ethtool_getpause_data(struct net_device *dev,
4678 struct ethtool_pauseparam *ep) 4680 struct ethtool_pauseparam *ep)
4679{ 4681{
4680 u64 val64; 4682 u64 val64;
4681 nic_t *sp = dev->priv; 4683 struct s2io_nic *sp = dev->priv;
4682 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4684 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4683 4685
4684 val64 = readq(&bar0->rmac_pause_cfg); 4686 val64 = readq(&bar0->rmac_pause_cfg);
4685 if (val64 & RMAC_PAUSE_GEN_ENABLE) 4687 if (val64 & RMAC_PAUSE_GEN_ENABLE)
@@ -4705,8 +4707,8 @@ static int s2io_ethtool_setpause_data(struct net_device *dev,
4705 struct ethtool_pauseparam *ep) 4707 struct ethtool_pauseparam *ep)
4706{ 4708{
4707 u64 val64; 4709 u64 val64;
4708 nic_t *sp = dev->priv; 4710 struct s2io_nic *sp = dev->priv;
4709 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4711 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4710 4712
4711 val64 = readq(&bar0->rmac_pause_cfg); 4713 val64 = readq(&bar0->rmac_pause_cfg);
4712 if (ep->tx_pause) 4714 if (ep->tx_pause)
@@ -4738,12 +4740,12 @@ static int s2io_ethtool_setpause_data(struct net_device *dev,
4738 */ 4740 */
4739 4741
4740#define S2IO_DEV_ID 5 4742#define S2IO_DEV_ID 5
4741static int read_eeprom(nic_t * sp, int off, u64 * data) 4743static int read_eeprom(struct s2io_nic * sp, int off, u64 * data)
4742{ 4744{
4743 int ret = -1; 4745 int ret = -1;
4744 u32 exit_cnt = 0; 4746 u32 exit_cnt = 0;
4745 u64 val64; 4747 u64 val64;
4746 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4748 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4747 4749
4748 if (sp->device_type == XFRAME_I_DEVICE) { 4750 if (sp->device_type == XFRAME_I_DEVICE) {
4749 val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) | 4751 val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) |
@@ -4803,11 +4805,11 @@ static int read_eeprom(nic_t * sp, int off, u64 * data)
4803 * 0 on success, -1 on failure. 4805 * 0 on success, -1 on failure.
4804 */ 4806 */
4805 4807
4806static int write_eeprom(nic_t * sp, int off, u64 data, int cnt) 4808static int write_eeprom(struct s2io_nic * sp, int off, u64 data, int cnt)
4807{ 4809{
4808 int exit_cnt = 0, ret = -1; 4810 int exit_cnt = 0, ret = -1;
4809 u64 val64; 4811 u64 val64;
4810 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4812 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4811 4813
4812 if (sp->device_type == XFRAME_I_DEVICE) { 4814 if (sp->device_type == XFRAME_I_DEVICE) {
4813 val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) | 4815 val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) |
@@ -4852,7 +4854,7 @@ static int write_eeprom(nic_t * sp, int off, u64 data, int cnt)
4852 } 4854 }
4853 return ret; 4855 return ret;
4854} 4856}
4855static void s2io_vpd_read(nic_t *nic) 4857static void s2io_vpd_read(struct s2io_nic *nic)
4856{ 4858{
4857 u8 *vpd_data; 4859 u8 *vpd_data;
4858 u8 data; 4860 u8 data;
@@ -4931,7 +4933,7 @@ static int s2io_ethtool_geeprom(struct net_device *dev,
4931{ 4933{
4932 u32 i, valid; 4934 u32 i, valid;
4933 u64 data; 4935 u64 data;
4934 nic_t *sp = dev->priv; 4936 struct s2io_nic *sp = dev->priv;
4935 4937
4936 eeprom->magic = sp->pdev->vendor | (sp->pdev->device << 16); 4938 eeprom->magic = sp->pdev->vendor | (sp->pdev->device << 16);
4937 4939
@@ -4969,7 +4971,7 @@ static int s2io_ethtool_seeprom(struct net_device *dev,
4969{ 4971{
4970 int len = eeprom->len, cnt = 0; 4972 int len = eeprom->len, cnt = 0;
4971 u64 valid = 0, data; 4973 u64 valid = 0, data;
4972 nic_t *sp = dev->priv; 4974 struct s2io_nic *sp = dev->priv;
4973 4975
4974 if (eeprom->magic != (sp->pdev->vendor | (sp->pdev->device << 16))) { 4976 if (eeprom->magic != (sp->pdev->vendor | (sp->pdev->device << 16))) {
4975 DBG_PRINT(ERR_DBG, 4977 DBG_PRINT(ERR_DBG,
@@ -5013,9 +5015,9 @@ static int s2io_ethtool_seeprom(struct net_device *dev,
5013 * 0 on success. 5015 * 0 on success.
5014 */ 5016 */
5015 5017
5016static int s2io_register_test(nic_t * sp, uint64_t * data) 5018static int s2io_register_test(struct s2io_nic * sp, uint64_t * data)
5017{ 5019{
5018 XENA_dev_config_t __iomem *bar0 = sp->bar0; 5020 struct XENA_dev_config __iomem *bar0 = sp->bar0;
5019 u64 val64 = 0, exp_val; 5021 u64 val64 = 0, exp_val;
5020 int fail = 0; 5022 int fail = 0;
5021 5023
@@ -5080,7 +5082,7 @@ static int s2io_register_test(nic_t * sp, uint64_t * data)
5080 * 0 on success. 5082 * 0 on success.
5081 */ 5083 */
5082 5084
5083static int s2io_eeprom_test(nic_t * sp, uint64_t * data) 5085static int s2io_eeprom_test(struct s2io_nic * sp, uint64_t * data)
5084{ 5086{
5085 int fail = 0; 5087 int fail = 0;
5086 u64 ret_data, org_4F0, org_7F0; 5088 u64 ret_data, org_4F0, org_7F0;
@@ -5182,7 +5184,7 @@ static int s2io_eeprom_test(nic_t * sp, uint64_t * data)
5182 * 0 on success and -1 on failure. 5184 * 0 on success and -1 on failure.
5183 */ 5185 */
5184 5186
5185static int s2io_bist_test(nic_t * sp, uint64_t * data) 5187static int s2io_bist_test(struct s2io_nic * sp, uint64_t * data)
5186{ 5188{
5187 u8 bist = 0; 5189 u8 bist = 0;
5188 int cnt = 0, ret = -1; 5190 int cnt = 0, ret = -1;
@@ -5218,9 +5220,9 @@ static int s2io_bist_test(nic_t * sp, uint64_t * data)
5218 * 0 on success. 5220 * 0 on success.
5219 */ 5221 */
5220 5222
5221static int s2io_link_test(nic_t * sp, uint64_t * data) 5223static int s2io_link_test(struct s2io_nic * sp, uint64_t * data)
5222{ 5224{
5223 XENA_dev_config_t __iomem *bar0 = sp->bar0; 5225 struct XENA_dev_config __iomem *bar0 = sp->bar0;
5224 u64 val64; 5226 u64 val64;
5225 5227
5226 val64 = readq(&bar0->adapter_status); 5228 val64 = readq(&bar0->adapter_status);
@@ -5245,9 +5247,9 @@ static int s2io_link_test(nic_t * sp, uint64_t * data)
5245 * 0 on success. 5247 * 0 on success.
5246 */ 5248 */
5247 5249
5248static int s2io_rldram_test(nic_t * sp, uint64_t * data) 5250static int s2io_rldram_test(struct s2io_nic * sp, uint64_t * data)
5249{ 5251{
5250 XENA_dev_config_t __iomem *bar0 = sp->bar0; 5252 struct XENA_dev_config __iomem *bar0 = sp->bar0;
5251 u64 val64; 5253 u64 val64;
5252 int cnt, iteration = 0, test_fail = 0; 5254 int cnt, iteration = 0, test_fail = 0;
5253 5255
@@ -5349,7 +5351,7 @@ static void s2io_ethtool_test(struct net_device *dev,
5349 struct ethtool_test *ethtest, 5351 struct ethtool_test *ethtest,
5350 uint64_t * data) 5352 uint64_t * data)
5351{ 5353{
5352 nic_t *sp = dev->priv; 5354 struct s2io_nic *sp = dev->priv;
5353 int orig_state = netif_running(sp->dev); 5355 int orig_state = netif_running(sp->dev);
5354 5356
5355 if (ethtest->flags == ETH_TEST_FL_OFFLINE) { 5357 if (ethtest->flags == ETH_TEST_FL_OFFLINE) {
@@ -5405,8 +5407,8 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
5405 u64 * tmp_stats) 5407 u64 * tmp_stats)
5406{ 5408{
5407 int i = 0; 5409 int i = 0;
5408 nic_t *sp = dev->priv; 5410 struct s2io_nic *sp = dev->priv;
5409 StatInfo_t *stat_info = sp->mac_control.stats_info; 5411 struct stat_block *stat_info = sp->mac_control.stats_info;
5410 5412
5411 s2io_updt_stats(sp); 5413 s2io_updt_stats(sp);
5412 tmp_stats[i++] = 5414 tmp_stats[i++] =
@@ -5633,14 +5635,14 @@ static int s2io_ethtool_get_regs_len(struct net_device *dev)
5633 5635
5634static u32 s2io_ethtool_get_rx_csum(struct net_device * dev) 5636static u32 s2io_ethtool_get_rx_csum(struct net_device * dev)
5635{ 5637{
5636 nic_t *sp = dev->priv; 5638 struct s2io_nic *sp = dev->priv;
5637 5639
5638 return (sp->rx_csum); 5640 return (sp->rx_csum);
5639} 5641}
5640 5642
5641static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) 5643static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data)
5642{ 5644{
5643 nic_t *sp = dev->priv; 5645 struct s2io_nic *sp = dev->priv;
5644 5646
5645 if (data) 5647 if (data)
5646 sp->rx_csum = 1; 5648 sp->rx_csum = 1;
@@ -5761,7 +5763,7 @@ static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
5761 5763
5762static int s2io_change_mtu(struct net_device *dev, int new_mtu) 5764static int s2io_change_mtu(struct net_device *dev, int new_mtu)
5763{ 5765{
5764 nic_t *sp = dev->priv; 5766 struct s2io_nic *sp = dev->priv;
5765 5767
5766 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { 5768 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) {
5767 DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", 5769 DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n",
@@ -5780,7 +5782,7 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu)
5780 if (netif_queue_stopped(dev)) 5782 if (netif_queue_stopped(dev))
5781 netif_wake_queue(dev); 5783 netif_wake_queue(dev);
5782 } else { /* Device is down */ 5784 } else { /* Device is down */
5783 XENA_dev_config_t __iomem *bar0 = sp->bar0; 5785 struct XENA_dev_config __iomem *bar0 = sp->bar0;
5784 u64 val64 = new_mtu; 5786 u64 val64 = new_mtu;
5785 5787
5786 writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); 5788 writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len);
@@ -5805,9 +5807,9 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu)
5805static void s2io_tasklet(unsigned long dev_addr) 5807static void s2io_tasklet(unsigned long dev_addr)
5806{ 5808{
5807 struct net_device *dev = (struct net_device *) dev_addr; 5809 struct net_device *dev = (struct net_device *) dev_addr;
5808 nic_t *sp = dev->priv; 5810 struct s2io_nic *sp = dev->priv;
5809 int i, ret; 5811 int i, ret;
5810 mac_info_t *mac_control; 5812 struct mac_info *mac_control;
5811 struct config_param *config; 5813 struct config_param *config;
5812 5814
5813 mac_control = &sp->mac_control; 5815 mac_control = &sp->mac_control;
@@ -5840,9 +5842,9 @@ static void s2io_tasklet(unsigned long dev_addr)
5840 5842
5841static void s2io_set_link(struct work_struct *work) 5843static void s2io_set_link(struct work_struct *work)
5842{ 5844{
5843 nic_t *nic = container_of(work, nic_t, set_link_task); 5845 struct s2io_nic *nic = container_of(work, struct s2io_nic, set_link_task);
5844 struct net_device *dev = nic->dev; 5846 struct net_device *dev = nic->dev;
5845 XENA_dev_config_t __iomem *bar0 = nic->bar0; 5847 struct XENA_dev_config __iomem *bar0 = nic->bar0;
5846 register u64 val64; 5848 register u64 val64;
5847 u16 subid; 5849 u16 subid;
5848 5850
@@ -5904,9 +5906,10 @@ static void s2io_set_link(struct work_struct *work)
5904 clear_bit(0, &(nic->link_state)); 5906 clear_bit(0, &(nic->link_state));
5905} 5907}
5906 5908
5907static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba, 5909static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
5908 struct sk_buff **skb, u64 *temp0, u64 *temp1, 5910 struct buffAdd *ba,
5909 u64 *temp2, int size) 5911 struct sk_buff **skb, u64 *temp0, u64 *temp1,
5912 u64 *temp2, int size)
5910{ 5913{
5911 struct net_device *dev = sp->dev; 5914 struct net_device *dev = sp->dev;
5912 struct sk_buff *frag_list; 5915 struct sk_buff *frag_list;
@@ -5920,7 +5923,7 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
5920 * using same mapped address for the Rxd 5923 * using same mapped address for the Rxd
5921 * buffer pointer 5924 * buffer pointer
5922 */ 5925 */
5923 ((RxD1_t*)rxdp)->Buffer0_ptr = *temp0; 5926 ((struct RxD1*)rxdp)->Buffer0_ptr = *temp0;
5924 } else { 5927 } else {
5925 *skb = dev_alloc_skb(size); 5928 *skb = dev_alloc_skb(size);
5926 if (!(*skb)) { 5929 if (!(*skb)) {
@@ -5932,7 +5935,7 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
5932 * such it will be used for next rxd whose 5935 * such it will be used for next rxd whose
5933 * Host Control is NULL 5936 * Host Control is NULL
5934 */ 5937 */
5935 ((RxD1_t*)rxdp)->Buffer0_ptr = *temp0 = 5938 ((struct RxD1*)rxdp)->Buffer0_ptr = *temp0 =
5936 pci_map_single( sp->pdev, (*skb)->data, 5939 pci_map_single( sp->pdev, (*skb)->data,
5937 size - NET_IP_ALIGN, 5940 size - NET_IP_ALIGN,
5938 PCI_DMA_FROMDEVICE); 5941 PCI_DMA_FROMDEVICE);
@@ -5941,9 +5944,9 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
5941 } else if ((sp->rxd_mode == RXD_MODE_3B) && (rxdp->Host_Control == 0)) { 5944 } else if ((sp->rxd_mode == RXD_MODE_3B) && (rxdp->Host_Control == 0)) {
5942 /* Two buffer Mode */ 5945 /* Two buffer Mode */
5943 if (*skb) { 5946 if (*skb) {
5944 ((RxD3_t*)rxdp)->Buffer2_ptr = *temp2; 5947 ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2;
5945 ((RxD3_t*)rxdp)->Buffer0_ptr = *temp0; 5948 ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0;
5946 ((RxD3_t*)rxdp)->Buffer1_ptr = *temp1; 5949 ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1;
5947 } else { 5950 } else {
5948 *skb = dev_alloc_skb(size); 5951 *skb = dev_alloc_skb(size);
5949 if (!(*skb)) { 5952 if (!(*skb)) {
@@ -5951,26 +5954,26 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
5951 dev->name); 5954 dev->name);
5952 return -ENOMEM; 5955 return -ENOMEM;
5953 } 5956 }
5954 ((RxD3_t*)rxdp)->Buffer2_ptr = *temp2 = 5957 ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2 =
5955 pci_map_single(sp->pdev, (*skb)->data, 5958 pci_map_single(sp->pdev, (*skb)->data,
5956 dev->mtu + 4, 5959 dev->mtu + 4,
5957 PCI_DMA_FROMDEVICE); 5960 PCI_DMA_FROMDEVICE);
5958 ((RxD3_t*)rxdp)->Buffer0_ptr = *temp0 = 5961 ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0 =
5959 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN, 5962 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN,
5960 PCI_DMA_FROMDEVICE); 5963 PCI_DMA_FROMDEVICE);
5961 rxdp->Host_Control = (unsigned long) (*skb); 5964 rxdp->Host_Control = (unsigned long) (*skb);
5962 5965
5963 /* Buffer-1 will be dummy buffer not used */ 5966 /* Buffer-1 will be dummy buffer not used */
5964 ((RxD3_t*)rxdp)->Buffer1_ptr = *temp1 = 5967 ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1 =
5965 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN, 5968 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN,
5966 PCI_DMA_FROMDEVICE); 5969 PCI_DMA_FROMDEVICE);
5967 } 5970 }
5968 } else if ((rxdp->Host_Control == 0)) { 5971 } else if ((rxdp->Host_Control == 0)) {
5969 /* Three buffer mode */ 5972 /* Three buffer mode */
5970 if (*skb) { 5973 if (*skb) {
5971 ((RxD3_t*)rxdp)->Buffer0_ptr = *temp0; 5974 ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0;
5972 ((RxD3_t*)rxdp)->Buffer1_ptr = *temp1; 5975 ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1;
5973 ((RxD3_t*)rxdp)->Buffer2_ptr = *temp2; 5976 ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2;
5974 } else { 5977 } else {
5975 *skb = dev_alloc_skb(size); 5978 *skb = dev_alloc_skb(size);
5976 if (!(*skb)) { 5979 if (!(*skb)) {
@@ -5978,11 +5981,11 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
5978 dev->name); 5981 dev->name);
5979 return -ENOMEM; 5982 return -ENOMEM;
5980 } 5983 }
5981 ((RxD3_t*)rxdp)->Buffer0_ptr = *temp0 = 5984 ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0 =
5982 pci_map_single(sp->pdev, ba->ba_0, BUF0_LEN, 5985 pci_map_single(sp->pdev, ba->ba_0, BUF0_LEN,
5983 PCI_DMA_FROMDEVICE); 5986 PCI_DMA_FROMDEVICE);
5984 /* Buffer-1 receives L3/L4 headers */ 5987 /* Buffer-1 receives L3/L4 headers */
5985 ((RxD3_t*)rxdp)->Buffer1_ptr = *temp1 = 5988 ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1 =
5986 pci_map_single( sp->pdev, (*skb)->data, 5989 pci_map_single( sp->pdev, (*skb)->data,
5987 l3l4hdr_size + 4, 5990 l3l4hdr_size + 4,
5988 PCI_DMA_FROMDEVICE); 5991 PCI_DMA_FROMDEVICE);
@@ -6002,14 +6005,15 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
6002 /* 6005 /*
6003 * Buffer-2 receives L4 data payload 6006 * Buffer-2 receives L4 data payload
6004 */ 6007 */
6005 ((RxD3_t*)rxdp)->Buffer2_ptr = *temp2 = 6008 ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2 =
6006 pci_map_single( sp->pdev, frag_list->data, 6009 pci_map_single( sp->pdev, frag_list->data,
6007 dev->mtu, PCI_DMA_FROMDEVICE); 6010 dev->mtu, PCI_DMA_FROMDEVICE);
6008 } 6011 }
6009 } 6012 }
6010 return 0; 6013 return 0;
6011} 6014}
6012static void set_rxd_buffer_size(nic_t *sp, RxD_t *rxdp, int size) 6015static void set_rxd_buffer_size(struct s2io_nic *sp, struct RxD_t *rxdp,
6016 int size)
6013{ 6017{
6014 struct net_device *dev = sp->dev; 6018 struct net_device *dev = sp->dev;
6015 if (sp->rxd_mode == RXD_MODE_1) { 6019 if (sp->rxd_mode == RXD_MODE_1) {
@@ -6025,15 +6029,15 @@ static void set_rxd_buffer_size(nic_t *sp, RxD_t *rxdp, int size)
6025 } 6029 }
6026} 6030}
6027 6031
6028static int rxd_owner_bit_reset(nic_t *sp) 6032static int rxd_owner_bit_reset(struct s2io_nic *sp)
6029{ 6033{
6030 int i, j, k, blk_cnt = 0, size; 6034 int i, j, k, blk_cnt = 0, size;
6031 mac_info_t * mac_control = &sp->mac_control; 6035 struct mac_info * mac_control = &sp->mac_control;
6032 struct config_param *config = &sp->config; 6036 struct config_param *config = &sp->config;
6033 struct net_device *dev = sp->dev; 6037 struct net_device *dev = sp->dev;
6034 RxD_t *rxdp = NULL; 6038 struct RxD_t *rxdp = NULL;
6035 struct sk_buff *skb = NULL; 6039 struct sk_buff *skb = NULL;
6036 buffAdd_t *ba = NULL; 6040 struct buffAdd *ba = NULL;
6037 u64 temp0_64 = 0, temp1_64 = 0, temp2_64 = 0; 6041 u64 temp0_64 = 0, temp1_64 = 0, temp2_64 = 0;
6038 6042
6039 /* Calculate the size based on ring mode */ 6043 /* Calculate the size based on ring mode */
@@ -6072,7 +6076,7 @@ static int rxd_owner_bit_reset(nic_t *sp)
6072 6076
6073} 6077}
6074 6078
6075static int s2io_add_isr(nic_t * sp) 6079static int s2io_add_isr(struct s2io_nic * sp)
6076{ 6080{
6077 int ret = 0; 6081 int ret = 0;
6078 struct net_device *dev = sp->dev; 6082 struct net_device *dev = sp->dev;
@@ -6087,7 +6091,7 @@ static int s2io_add_isr(nic_t * sp)
6087 sp->intr_type = INTA; 6091 sp->intr_type = INTA;
6088 } 6092 }
6089 6093
6090 /* Store the values of the MSIX table in the nic_t structure */ 6094 /* Store the values of the MSIX table in the struct s2io_nic structure */
6091 store_xmsi_data(sp); 6095 store_xmsi_data(sp);
6092 6096
6093 /* After proper initialization of H/W, register ISR */ 6097 /* After proper initialization of H/W, register ISR */
@@ -6142,7 +6146,7 @@ static int s2io_add_isr(nic_t * sp)
6142 } 6146 }
6143 return 0; 6147 return 0;
6144} 6148}
6145static void s2io_rem_isr(nic_t * sp) 6149static void s2io_rem_isr(struct s2io_nic * sp)
6146{ 6150{
6147 int cnt = 0; 6151 int cnt = 0;
6148 struct net_device *dev = sp->dev; 6152 struct net_device *dev = sp->dev;
@@ -6184,10 +6188,10 @@ static void s2io_rem_isr(nic_t * sp)
6184 } while(cnt < 5); 6188 } while(cnt < 5);
6185} 6189}
6186 6190
6187static void s2io_card_down(nic_t * sp) 6191static void s2io_card_down(struct s2io_nic * sp)
6188{ 6192{
6189 int cnt = 0; 6193 int cnt = 0;
6190 XENA_dev_config_t __iomem *bar0 = sp->bar0; 6194 struct XENA_dev_config __iomem *bar0 = sp->bar0;
6191 unsigned long flags; 6195 unsigned long flags;
6192 register u64 val64 = 0; 6196 register u64 val64 = 0;
6193 6197
@@ -6248,10 +6252,10 @@ static void s2io_card_down(nic_t * sp)
6248 clear_bit(0, &(sp->link_state)); 6252 clear_bit(0, &(sp->link_state));
6249} 6253}
6250 6254
6251static int s2io_card_up(nic_t * sp) 6255static int s2io_card_up(struct s2io_nic * sp)
6252{ 6256{
6253 int i, ret = 0; 6257 int i, ret = 0;
6254 mac_info_t *mac_control; 6258 struct mac_info *mac_control;
6255 struct config_param *config; 6259 struct config_param *config;
6256 struct net_device *dev = (struct net_device *) sp->dev; 6260 struct net_device *dev = (struct net_device *) sp->dev;
6257 u16 interruptible; 6261 u16 interruptible;
@@ -6350,7 +6354,7 @@ static int s2io_card_up(nic_t * sp)
6350 6354
6351static void s2io_restart_nic(struct work_struct *work) 6355static void s2io_restart_nic(struct work_struct *work)
6352{ 6356{
6353 nic_t *sp = container_of(work, nic_t, rst_timer_task); 6357 struct s2io_nic *sp = container_of(work, struct s2io_nic, rst_timer_task);
6354 struct net_device *dev = sp->dev; 6358 struct net_device *dev = sp->dev;
6355 6359
6356 s2io_card_down(sp); 6360 s2io_card_down(sp);
@@ -6379,7 +6383,7 @@ static void s2io_restart_nic(struct work_struct *work)
6379 6383
6380static void s2io_tx_watchdog(struct net_device *dev) 6384static void s2io_tx_watchdog(struct net_device *dev)
6381{ 6385{
6382 nic_t *sp = dev->priv; 6386 struct s2io_nic *sp = dev->priv;
6383 6387
6384 if (netif_carrier_ok(dev)) { 6388 if (netif_carrier_ok(dev)) {
6385 schedule_work(&sp->rst_timer_task); 6389 schedule_work(&sp->rst_timer_task);
@@ -6404,16 +6408,16 @@ static void s2io_tx_watchdog(struct net_device *dev)
6404 * Return value: 6408 * Return value:
6405 * SUCCESS on success and -1 on failure. 6409 * SUCCESS on success and -1 on failure.
6406 */ 6410 */
6407static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp) 6411static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
6408{ 6412{
6409 nic_t *sp = ring_data->nic; 6413 struct s2io_nic *sp = ring_data->nic;
6410 struct net_device *dev = (struct net_device *) sp->dev; 6414 struct net_device *dev = (struct net_device *) sp->dev;
6411 struct sk_buff *skb = (struct sk_buff *) 6415 struct sk_buff *skb = (struct sk_buff *)
6412 ((unsigned long) rxdp->Host_Control); 6416 ((unsigned long) rxdp->Host_Control);
6413 int ring_no = ring_data->ring_no; 6417 int ring_no = ring_data->ring_no;
6414 u16 l3_csum, l4_csum; 6418 u16 l3_csum, l4_csum;
6415 unsigned long long err = rxdp->Control_1 & RXD_T_CODE; 6419 unsigned long long err = rxdp->Control_1 & RXD_T_CODE;
6416 lro_t *lro; 6420 struct lro *lro;
6417 6421
6418 skb->dev = dev; 6422 skb->dev = dev;
6419 6423
@@ -6458,7 +6462,7 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp)
6458 int buf2_len = RXD_GET_BUFFER2_SIZE_3(rxdp->Control_2); 6462 int buf2_len = RXD_GET_BUFFER2_SIZE_3(rxdp->Control_2);
6459 unsigned char *buff = skb_push(skb, buf0_len); 6463 unsigned char *buff = skb_push(skb, buf0_len);
6460 6464
6461 buffAdd_t *ba = &ring_data->ba[get_block][get_off]; 6465 struct buffAdd *ba = &ring_data->ba[get_block][get_off];
6462 sp->stats.rx_bytes += buf0_len + buf2_len; 6466 sp->stats.rx_bytes += buf0_len + buf2_len;
6463 memcpy(buff, ba->ba_0, buf0_len); 6467 memcpy(buff, ba->ba_0, buf0_len);
6464 6468
@@ -6588,7 +6592,7 @@ aggregate:
6588 * void. 6592 * void.
6589 */ 6593 */
6590 6594
6591static void s2io_link(nic_t * sp, int link) 6595static void s2io_link(struct s2io_nic * sp, int link)
6592{ 6596{
6593 struct net_device *dev = (struct net_device *) sp->dev; 6597 struct net_device *dev = (struct net_device *) sp->dev;
6594 6598
@@ -6632,7 +6636,7 @@ static int get_xena_rev_id(struct pci_dev *pdev)
6632 * void 6636 * void
6633 */ 6637 */
6634 6638
6635static void s2io_init_pci(nic_t * sp) 6639static void s2io_init_pci(struct s2io_nic * sp)
6636{ 6640{
6637 u16 pci_cmd = 0, pcix_cmd = 0; 6641 u16 pci_cmd = 0, pcix_cmd = 0;
6638 6642
@@ -6715,15 +6719,15 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
6715static int __devinit 6719static int __devinit
6716s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) 6720s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6717{ 6721{
6718 nic_t *sp; 6722 struct s2io_nic *sp;
6719 struct net_device *dev; 6723 struct net_device *dev;
6720 int i, j, ret; 6724 int i, j, ret;
6721 int dma_flag = FALSE; 6725 int dma_flag = FALSE;
6722 u32 mac_up, mac_down; 6726 u32 mac_up, mac_down;
6723 u64 val64 = 0, tmp64 = 0; 6727 u64 val64 = 0, tmp64 = 0;
6724 XENA_dev_config_t __iomem *bar0 = NULL; 6728 struct XENA_dev_config __iomem *bar0 = NULL;
6725 u16 subid; 6729 u16 subid;
6726 mac_info_t *mac_control; 6730 struct mac_info *mac_control;
6727 struct config_param *config; 6731 struct config_param *config;
6728 int mode; 6732 int mode;
6729 u8 dev_intr_type = intr_type; 6733 u8 dev_intr_type = intr_type;
@@ -6778,7 +6782,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6778 } 6782 }
6779 } 6783 }
6780 6784
6781 dev = alloc_etherdev(sizeof(nic_t)); 6785 dev = alloc_etherdev(sizeof(struct s2io_nic));
6782 if (dev == NULL) { 6786 if (dev == NULL) {
6783 DBG_PRINT(ERR_DBG, "Device allocation failed\n"); 6787 DBG_PRINT(ERR_DBG, "Device allocation failed\n");
6784 pci_disable_device(pdev); 6788 pci_disable_device(pdev);
@@ -6793,7 +6797,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6793 6797
6794 /* Private member variable initialized to s2io NIC structure */ 6798 /* Private member variable initialized to s2io NIC structure */
6795 sp = dev->priv; 6799 sp = dev->priv;
6796 memset(sp, 0, sizeof(nic_t)); 6800 memset(sp, 0, sizeof(struct s2io_nic));
6797 sp->dev = dev; 6801 sp->dev = dev;
6798 sp->pdev = pdev; 6802 sp->pdev = pdev;
6799 sp->high_dma_flag = dma_flag; 6803 sp->high_dma_flag = dma_flag;
@@ -6909,7 +6913,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6909 6913
6910 /* Initializing the BAR1 address as the start of the FIFO pointer. */ 6914 /* Initializing the BAR1 address as the start of the FIFO pointer. */
6911 for (j = 0; j < MAX_TX_FIFOS; j++) { 6915 for (j = 0; j < MAX_TX_FIFOS; j++) {
6912 mac_control->tx_FIFO_start[j] = (TxFIFO_element_t __iomem *) 6916 mac_control->tx_FIFO_start[j] = (struct TxFIFO_element __iomem *)
6913 (sp->bar1 + (j * 0x00020000)); 6917 (sp->bar1 + (j * 0x00020000));
6914 } 6918 }
6915 6919
@@ -7163,7 +7167,7 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev)
7163{ 7167{
7164 struct net_device *dev = 7168 struct net_device *dev =
7165 (struct net_device *) pci_get_drvdata(pdev); 7169 (struct net_device *) pci_get_drvdata(pdev);
7166 nic_t *sp; 7170 struct s2io_nic *sp;
7167 7171
7168 if (dev == NULL) { 7172 if (dev == NULL) {
7169 DBG_PRINT(ERR_DBG, "Driver Data is NULL!!\n"); 7173 DBG_PRINT(ERR_DBG, "Driver Data is NULL!!\n");
@@ -7215,7 +7219,7 @@ module_init(s2io_starter);
7215module_exit(s2io_closer); 7219module_exit(s2io_closer);
7216 7220
7217static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip, 7221static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip,
7218 struct tcphdr **tcp, RxD_t *rxdp) 7222 struct tcphdr **tcp, struct RxD_t *rxdp)
7219{ 7223{
7220 int ip_off; 7224 int ip_off;
7221 u8 l2_type = (u8)((rxdp->Control_1 >> 37) & 0x7), ip_len; 7225 u8 l2_type = (u8)((rxdp->Control_1 >> 37) & 0x7), ip_len;
@@ -7249,7 +7253,7 @@ static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip,
7249 return 0; 7253 return 0;
7250} 7254}
7251 7255
7252static int check_for_socket_match(lro_t *lro, struct iphdr *ip, 7256static int check_for_socket_match(struct lro *lro, struct iphdr *ip,
7253 struct tcphdr *tcp) 7257 struct tcphdr *tcp)
7254{ 7258{
7255 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__); 7259 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__);
@@ -7264,7 +7268,7 @@ static inline int get_l4_pyld_length(struct iphdr *ip, struct tcphdr *tcp)
7264 return(ntohs(ip->tot_len) - (ip->ihl << 2) - (tcp->doff << 2)); 7268 return(ntohs(ip->tot_len) - (ip->ihl << 2) - (tcp->doff << 2));
7265} 7269}
7266 7270
7267static void initiate_new_session(lro_t *lro, u8 *l2h, 7271static void initiate_new_session(struct lro *lro, u8 *l2h,
7268 struct iphdr *ip, struct tcphdr *tcp, u32 tcp_pyld_len) 7272 struct iphdr *ip, struct tcphdr *tcp, u32 tcp_pyld_len)
7269{ 7273{
7270 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__); 7274 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__);
@@ -7290,12 +7294,12 @@ static void initiate_new_session(lro_t *lro, u8 *l2h,
7290 lro->in_use = 1; 7294 lro->in_use = 1;
7291} 7295}
7292 7296
7293static void update_L3L4_header(nic_t *sp, lro_t *lro) 7297static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro)
7294{ 7298{
7295 struct iphdr *ip = lro->iph; 7299 struct iphdr *ip = lro->iph;
7296 struct tcphdr *tcp = lro->tcph; 7300 struct tcphdr *tcp = lro->tcph;
7297 u16 nchk; 7301 u16 nchk;
7298 StatInfo_t *statinfo = sp->mac_control.stats_info; 7302 struct stat_block *statinfo = sp->mac_control.stats_info;
7299 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__); 7303 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__);
7300 7304
7301 /* Update L3 header */ 7305 /* Update L3 header */
@@ -7321,7 +7325,7 @@ static void update_L3L4_header(nic_t *sp, lro_t *lro)
7321 statinfo->sw_stat.num_aggregations++; 7325 statinfo->sw_stat.num_aggregations++;
7322} 7326}
7323 7327
7324static void aggregate_new_rx(lro_t *lro, struct iphdr *ip, 7328static void aggregate_new_rx(struct lro *lro, struct iphdr *ip,
7325 struct tcphdr *tcp, u32 l4_pyld) 7329 struct tcphdr *tcp, u32 l4_pyld)
7326{ 7330{
7327 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__); 7331 DBG_PRINT(INFO_DBG,"%s: Been here...\n", __FUNCTION__);
@@ -7343,7 +7347,7 @@ static void aggregate_new_rx(lro_t *lro, struct iphdr *ip,
7343 } 7347 }
7344} 7348}
7345 7349
7346static int verify_l3_l4_lro_capable(lro_t *l_lro, struct iphdr *ip, 7350static int verify_l3_l4_lro_capable(struct lro *l_lro, struct iphdr *ip,
7347 struct tcphdr *tcp, u32 tcp_pyld_len) 7351 struct tcphdr *tcp, u32 tcp_pyld_len)
7348{ 7352{
7349 u8 *ptr; 7353 u8 *ptr;
@@ -7401,8 +7405,8 @@ static int verify_l3_l4_lro_capable(lro_t *l_lro, struct iphdr *ip,
7401} 7405}
7402 7406
7403static int 7407static int
7404s2io_club_tcp_session(u8 *buffer, u8 **tcp, u32 *tcp_len, lro_t **lro, 7408s2io_club_tcp_session(u8 *buffer, u8 **tcp, u32 *tcp_len, struct lro **lro,
7405 RxD_t *rxdp, nic_t *sp) 7409 struct RxD_t *rxdp, struct s2io_nic *sp)
7406{ 7410{
7407 struct iphdr *ip; 7411 struct iphdr *ip;
7408 struct tcphdr *tcph; 7412 struct tcphdr *tcph;
@@ -7419,7 +7423,7 @@ s2io_club_tcp_session(u8 *buffer, u8 **tcp, u32 *tcp_len, lro_t **lro,
7419 tcph = (struct tcphdr *)*tcp; 7423 tcph = (struct tcphdr *)*tcp;
7420 *tcp_len = get_l4_pyld_length(ip, tcph); 7424 *tcp_len = get_l4_pyld_length(ip, tcph);
7421 for (i=0; i<MAX_LRO_SESSIONS; i++) { 7425 for (i=0; i<MAX_LRO_SESSIONS; i++) {
7422 lro_t *l_lro = &sp->lro0_n[i]; 7426 struct lro *l_lro = &sp->lro0_n[i];
7423 if (l_lro->in_use) { 7427 if (l_lro->in_use) {
7424 if (check_for_socket_match(l_lro, ip, tcph)) 7428 if (check_for_socket_match(l_lro, ip, tcph))
7425 continue; 7429 continue;
@@ -7457,7 +7461,7 @@ s2io_club_tcp_session(u8 *buffer, u8 **tcp, u32 *tcp_len, lro_t **lro,
7457 } 7461 }
7458 7462
7459 for (i=0; i<MAX_LRO_SESSIONS; i++) { 7463 for (i=0; i<MAX_LRO_SESSIONS; i++) {
7460 lro_t *l_lro = &sp->lro0_n[i]; 7464 struct lro *l_lro = &sp->lro0_n[i];
7461 if (!(l_lro->in_use)) { 7465 if (!(l_lro->in_use)) {
7462 *lro = l_lro; 7466 *lro = l_lro;
7463 ret = 3; /* Begin anew */ 7467 ret = 3; /* Begin anew */
@@ -7496,9 +7500,9 @@ s2io_club_tcp_session(u8 *buffer, u8 **tcp, u32 *tcp_len, lro_t **lro,
7496 return ret; 7500 return ret;
7497} 7501}
7498 7502
7499static void clear_lro_session(lro_t *lro) 7503static void clear_lro_session(struct lro *lro)
7500{ 7504{
7501 static u16 lro_struct_size = sizeof(lro_t); 7505 static u16 lro_struct_size = sizeof(struct lro);
7502 7506
7503 memset(lro, 0, lro_struct_size); 7507 memset(lro, 0, lro_struct_size);
7504} 7508}
@@ -7514,7 +7518,8 @@ static void queue_rx_frame(struct sk_buff *skb)
7514 netif_rx(skb); 7518 netif_rx(skb);
7515} 7519}
7516 7520
7517static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb, 7521static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
7522 struct sk_buff *skb,
7518 u32 tcp_len) 7523 u32 tcp_len)
7519{ 7524{
7520 struct sk_buff *first = lro->parent; 7525 struct sk_buff *first = lro->parent;