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.c146
1 files changed, 70 insertions, 76 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 6a1375f9cbb8..f5c57c059bca 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -352,12 +352,13 @@ static void do_s2io_copy_mac_addr(struct s2io_nic *sp, int offset, u64 mac_addr)
352 sp->def_mac_addr[offset].mac_addr[1] = (u8) (mac_addr >> 32); 352 sp->def_mac_addr[offset].mac_addr[1] = (u8) (mac_addr >> 32);
353 sp->def_mac_addr[offset].mac_addr[0] = (u8) (mac_addr >> 40); 353 sp->def_mac_addr[offset].mac_addr[0] = (u8) (mac_addr >> 40);
354} 354}
355
355/* Add the vlan */ 356/* Add the vlan */
356static void s2io_vlan_rx_register(struct net_device *dev, 357static void s2io_vlan_rx_register(struct net_device *dev,
357 struct vlan_group *grp) 358 struct vlan_group *grp)
358{ 359{
359 int i; 360 int i;
360 struct s2io_nic *nic = dev->priv; 361 struct s2io_nic *nic = netdev_priv(dev);
361 unsigned long flags[MAX_TX_FIFOS]; 362 unsigned long flags[MAX_TX_FIFOS];
362 struct mac_info *mac_control = &nic->mac_control; 363 struct mac_info *mac_control = &nic->mac_control;
363 struct config_param *config = &nic->config; 364 struct config_param *config = &nic->config;
@@ -372,10 +373,10 @@ static void s2io_vlan_rx_register(struct net_device *dev,
372} 373}
373 374
374/* Unregister the vlan */ 375/* Unregister the vlan */
375static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) 376static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
376{ 377{
377 int i; 378 int i;
378 struct s2io_nic *nic = dev->priv; 379 struct s2io_nic *nic = netdev_priv(dev);
379 unsigned long flags[MAX_TX_FIFOS]; 380 unsigned long flags[MAX_TX_FIFOS];
380 struct mac_info *mac_control = &nic->mac_control; 381 struct mac_info *mac_control = &nic->mac_control;
381 struct config_param *config = &nic->config; 382 struct config_param *config = &nic->config;
@@ -2837,7 +2838,7 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
2837 int pkts_processed = 0; 2838 int pkts_processed = 0;
2838 u8 __iomem *addr = NULL; 2839 u8 __iomem *addr = NULL;
2839 u8 val8 = 0; 2840 u8 val8 = 0;
2840 struct s2io_nic *nic = dev->priv; 2841 struct s2io_nic *nic = netdev_priv(dev);
2841 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2842 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2842 int budget_org = budget; 2843 int budget_org = budget;
2843 2844
@@ -2851,7 +2852,7 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
2851 s2io_chk_rx_buffers(nic, ring); 2852 s2io_chk_rx_buffers(nic, ring);
2852 2853
2853 if (pkts_processed < budget_org) { 2854 if (pkts_processed < budget_org) {
2854 netif_rx_complete(dev, napi); 2855 netif_rx_complete(napi);
2855 /*Re Enable MSI-Rx Vector*/ 2856 /*Re Enable MSI-Rx Vector*/
2856 addr = (u8 __iomem *)&bar0->xmsi_mask_reg; 2857 addr = (u8 __iomem *)&bar0->xmsi_mask_reg;
2857 addr += 7 - ring->ring_no; 2858 addr += 7 - ring->ring_no;
@@ -2865,7 +2866,6 @@ static int s2io_poll_inta(struct napi_struct *napi, int budget)
2865{ 2866{
2866 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi); 2867 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi);
2867 struct ring_info *ring; 2868 struct ring_info *ring;
2868 struct net_device *dev = nic->dev;
2869 struct config_param *config; 2869 struct config_param *config;
2870 struct mac_info *mac_control; 2870 struct mac_info *mac_control;
2871 int pkts_processed = 0; 2871 int pkts_processed = 0;
@@ -2889,7 +2889,7 @@ static int s2io_poll_inta(struct napi_struct *napi, int budget)
2889 break; 2889 break;
2890 } 2890 }
2891 if (pkts_processed < budget_org) { 2891 if (pkts_processed < budget_org) {
2892 netif_rx_complete(dev, napi); 2892 netif_rx_complete(napi);
2893 /* Re enable the Rx interrupts for the ring */ 2893 /* Re enable the Rx interrupts for the ring */
2894 writeq(0, &bar0->rx_traffic_mask); 2894 writeq(0, &bar0->rx_traffic_mask);
2895 readl(&bar0->rx_traffic_mask); 2895 readl(&bar0->rx_traffic_mask);
@@ -2909,7 +2909,7 @@ static int s2io_poll_inta(struct napi_struct *napi, int budget)
2909 */ 2909 */
2910static void s2io_netpoll(struct net_device *dev) 2910static void s2io_netpoll(struct net_device *dev)
2911{ 2911{
2912 struct s2io_nic *nic = dev->priv; 2912 struct s2io_nic *nic = netdev_priv(dev);
2913 struct mac_info *mac_control; 2913 struct mac_info *mac_control;
2914 struct config_param *config; 2914 struct config_param *config;
2915 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2915 struct XENA_dev_config __iomem *bar0 = nic->bar0;
@@ -3171,7 +3171,7 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
3171static void s2io_mdio_write(u32 mmd_type, u64 addr, u16 value, struct net_device *dev) 3171static void s2io_mdio_write(u32 mmd_type, u64 addr, u16 value, struct net_device *dev)
3172{ 3172{
3173 u64 val64 = 0x0; 3173 u64 val64 = 0x0;
3174 struct s2io_nic *sp = dev->priv; 3174 struct s2io_nic *sp = netdev_priv(dev);
3175 struct XENA_dev_config __iomem *bar0 = sp->bar0; 3175 struct XENA_dev_config __iomem *bar0 = sp->bar0;
3176 3176
3177 //address transaction 3177 //address transaction
@@ -3220,7 +3220,7 @@ static u64 s2io_mdio_read(u32 mmd_type, u64 addr, struct net_device *dev)
3220{ 3220{
3221 u64 val64 = 0x0; 3221 u64 val64 = 0x0;
3222 u64 rval64 = 0x0; 3222 u64 rval64 = 0x0;
3223 struct s2io_nic *sp = dev->priv; 3223 struct s2io_nic *sp = netdev_priv(dev);
3224 struct XENA_dev_config __iomem *bar0 = sp->bar0; 3224 struct XENA_dev_config __iomem *bar0 = sp->bar0;
3225 3225
3226 /* address transaction */ 3226 /* address transaction */
@@ -3324,7 +3324,7 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
3324 u64 val64 = 0x0; 3324 u64 val64 = 0x0;
3325 u64 addr = 0x0; 3325 u64 addr = 0x0;
3326 3326
3327 struct s2io_nic *sp = dev->priv; 3327 struct s2io_nic *sp = netdev_priv(dev);
3328 struct stat_block *stat_info = sp->mac_control.stats_info; 3328 struct stat_block *stat_info = sp->mac_control.stats_info;
3329 3329
3330 /* Check the communication with the MDIO slave */ 3330 /* Check the communication with the MDIO slave */
@@ -3990,7 +3990,7 @@ static void remove_inta_isr(struct s2io_nic *sp)
3990 3990
3991static int s2io_open(struct net_device *dev) 3991static int s2io_open(struct net_device *dev)
3992{ 3992{
3993 struct s2io_nic *sp = dev->priv; 3993 struct s2io_nic *sp = netdev_priv(dev);
3994 int err = 0; 3994 int err = 0;
3995 3995
3996 /* 3996 /*
@@ -4048,7 +4048,7 @@ hw_init_failed:
4048 4048
4049static int s2io_close(struct net_device *dev) 4049static int s2io_close(struct net_device *dev)
4050{ 4050{
4051 struct s2io_nic *sp = dev->priv; 4051 struct s2io_nic *sp = netdev_priv(dev);
4052 struct config_param *config = &sp->config; 4052 struct config_param *config = &sp->config;
4053 u64 tmp64; 4053 u64 tmp64;
4054 int offset; 4054 int offset;
@@ -4087,7 +4087,7 @@ static int s2io_close(struct net_device *dev)
4087 4087
4088static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) 4088static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
4089{ 4089{
4090 struct s2io_nic *sp = dev->priv; 4090 struct s2io_nic *sp = netdev_priv(dev);
4091 u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; 4091 u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off;
4092 register u64 val64; 4092 register u64 val64;
4093 struct TxD *txdp; 4093 struct TxD *txdp;
@@ -4329,7 +4329,6 @@ static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
4329 struct ring_info *ring = (struct ring_info *)dev_id; 4329 struct ring_info *ring = (struct ring_info *)dev_id;
4330 struct s2io_nic *sp = ring->nic; 4330 struct s2io_nic *sp = ring->nic;
4331 struct XENA_dev_config __iomem *bar0 = sp->bar0; 4331 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4332 struct net_device *dev = sp->dev;
4333 4332
4334 if (unlikely(!is_s2io_card_up(sp))) 4333 if (unlikely(!is_s2io_card_up(sp)))
4335 return IRQ_HANDLED; 4334 return IRQ_HANDLED;
@@ -4343,7 +4342,7 @@ static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
4343 val8 = (ring->ring_no == 0) ? 0x7f : 0xff; 4342 val8 = (ring->ring_no == 0) ? 0x7f : 0xff;
4344 writeb(val8, addr); 4343 writeb(val8, addr);
4345 val8 = readb(addr); 4344 val8 = readb(addr);
4346 netif_rx_schedule(dev, &ring->napi); 4345 netif_rx_schedule(&ring->napi);
4347 } else { 4346 } else {
4348 rx_intr_handler(ring, 0); 4347 rx_intr_handler(ring, 0);
4349 s2io_chk_rx_buffers(sp, ring); 4348 s2io_chk_rx_buffers(sp, ring);
@@ -4485,7 +4484,7 @@ static int do_s2io_chk_alarm_bit(u64 value, void __iomem * addr,
4485static void s2io_handle_errors(void * dev_id) 4484static void s2io_handle_errors(void * dev_id)
4486{ 4485{
4487 struct net_device *dev = (struct net_device *) dev_id; 4486 struct net_device *dev = (struct net_device *) dev_id;
4488 struct s2io_nic *sp = dev->priv; 4487 struct s2io_nic *sp = netdev_priv(dev);
4489 struct XENA_dev_config __iomem *bar0 = sp->bar0; 4488 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4490 u64 temp64 = 0,val64=0; 4489 u64 temp64 = 0,val64=0;
4491 int i = 0; 4490 int i = 0;
@@ -4752,7 +4751,7 @@ reset:
4752static irqreturn_t s2io_isr(int irq, void *dev_id) 4751static irqreturn_t s2io_isr(int irq, void *dev_id)
4753{ 4752{
4754 struct net_device *dev = (struct net_device *) dev_id; 4753 struct net_device *dev = (struct net_device *) dev_id;
4755 struct s2io_nic *sp = dev->priv; 4754 struct s2io_nic *sp = netdev_priv(dev);
4756 struct XENA_dev_config __iomem *bar0 = sp->bar0; 4755 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4757 int i; 4756 int i;
4758 u64 reason = 0; 4757 u64 reason = 0;
@@ -4790,7 +4789,7 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
4790 4789
4791 if (config->napi) { 4790 if (config->napi) {
4792 if (reason & GEN_INTR_RXTRAFFIC) { 4791 if (reason & GEN_INTR_RXTRAFFIC) {
4793 netif_rx_schedule(dev, &sp->napi); 4792 netif_rx_schedule(&sp->napi);
4794 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_mask); 4793 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_mask);
4795 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int); 4794 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int);
4796 readl(&bar0->rx_traffic_int); 4795 readl(&bar0->rx_traffic_int);
@@ -4881,7 +4880,7 @@ static void s2io_updt_stats(struct s2io_nic *sp)
4881 4880
4882static struct net_device_stats *s2io_get_stats(struct net_device *dev) 4881static struct net_device_stats *s2io_get_stats(struct net_device *dev)
4883{ 4882{
4884 struct s2io_nic *sp = dev->priv; 4883 struct s2io_nic *sp = netdev_priv(dev);
4885 struct mac_info *mac_control; 4884 struct mac_info *mac_control;
4886 struct config_param *config; 4885 struct config_param *config;
4887 int i; 4886 int i;
@@ -4948,7 +4947,7 @@ static void s2io_set_multicast(struct net_device *dev)
4948{ 4947{
4949 int i, j, prev_cnt; 4948 int i, j, prev_cnt;
4950 struct dev_mc_list *mclist; 4949 struct dev_mc_list *mclist;
4951 struct s2io_nic *sp = dev->priv; 4950 struct s2io_nic *sp = netdev_priv(dev);
4952 struct XENA_dev_config __iomem *bar0 = sp->bar0; 4951 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4953 u64 val64 = 0, multi_mac = 0x010203040506ULL, mask = 4952 u64 val64 = 0, multi_mac = 0x010203040506ULL, mask =
4954 0xfeffffffffffULL; 4953 0xfeffffffffffULL;
@@ -5112,7 +5111,7 @@ static void s2io_set_multicast(struct net_device *dev)
5112/* read from CAM unicast & multicast addresses and store it in 5111/* read from CAM unicast & multicast addresses and store it in
5113 * def_mac_addr structure 5112 * def_mac_addr structure
5114 */ 5113 */
5115void do_s2io_store_unicast_mc(struct s2io_nic *sp) 5114static void do_s2io_store_unicast_mc(struct s2io_nic *sp)
5116{ 5115{
5117 int offset; 5116 int offset;
5118 u64 mac_addr = 0x0; 5117 u64 mac_addr = 0x0;
@@ -5277,7 +5276,7 @@ static int s2io_set_mac_addr(struct net_device *dev, void *p)
5277 5276
5278static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr) 5277static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr)
5279{ 5278{
5280 struct s2io_nic *sp = dev->priv; 5279 struct s2io_nic *sp = netdev_priv(dev);
5281 register u64 mac_addr = 0, perm_addr = 0; 5280 register u64 mac_addr = 0, perm_addr = 0;
5282 int i; 5281 int i;
5283 u64 tmp64; 5282 u64 tmp64;
@@ -5336,7 +5335,7 @@ static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr)
5336static int s2io_ethtool_sset(struct net_device *dev, 5335static int s2io_ethtool_sset(struct net_device *dev,
5337 struct ethtool_cmd *info) 5336 struct ethtool_cmd *info)
5338{ 5337{
5339 struct s2io_nic *sp = dev->priv; 5338 struct s2io_nic *sp = netdev_priv(dev);
5340 if ((info->autoneg == AUTONEG_ENABLE) || 5339 if ((info->autoneg == AUTONEG_ENABLE) ||
5341 (info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL)) 5340 (info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL))
5342 return -EINVAL; 5341 return -EINVAL;
@@ -5362,7 +5361,7 @@ static int s2io_ethtool_sset(struct net_device *dev,
5362 5361
5363static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info) 5362static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
5364{ 5363{
5365 struct s2io_nic *sp = dev->priv; 5364 struct s2io_nic *sp = netdev_priv(dev);
5366 info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); 5365 info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
5367 info->advertising = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); 5366 info->advertising = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
5368 info->port = PORT_FIBRE; 5367 info->port = PORT_FIBRE;
@@ -5397,7 +5396,7 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
5397static void s2io_ethtool_gdrvinfo(struct net_device *dev, 5396static void s2io_ethtool_gdrvinfo(struct net_device *dev,
5398 struct ethtool_drvinfo *info) 5397 struct ethtool_drvinfo *info)
5399{ 5398{
5400 struct s2io_nic *sp = dev->priv; 5399 struct s2io_nic *sp = netdev_priv(dev);
5401 5400
5402 strncpy(info->driver, s2io_driver_name, sizeof(info->driver)); 5401 strncpy(info->driver, s2io_driver_name, sizeof(info->driver));
5403 strncpy(info->version, s2io_driver_version, sizeof(info->version)); 5402 strncpy(info->version, s2io_driver_version, sizeof(info->version));
@@ -5427,7 +5426,7 @@ static void s2io_ethtool_gregs(struct net_device *dev,
5427 int i; 5426 int i;
5428 u64 reg; 5427 u64 reg;
5429 u8 *reg_space = (u8 *) space; 5428 u8 *reg_space = (u8 *) space;
5430 struct s2io_nic *sp = dev->priv; 5429 struct s2io_nic *sp = netdev_priv(dev);
5431 5430
5432 regs->len = XENA_REG_SPACE; 5431 regs->len = XENA_REG_SPACE;
5433 regs->version = sp->pdev->subsystem_device; 5432 regs->version = sp->pdev->subsystem_device;
@@ -5487,7 +5486,7 @@ static void s2io_phy_id(unsigned long data)
5487static int s2io_ethtool_idnic(struct net_device *dev, u32 data) 5486static int s2io_ethtool_idnic(struct net_device *dev, u32 data)
5488{ 5487{
5489 u64 val64 = 0, last_gpio_ctrl_val; 5488 u64 val64 = 0, last_gpio_ctrl_val;
5490 struct s2io_nic *sp = dev->priv; 5489 struct s2io_nic *sp = netdev_priv(dev);
5491 struct XENA_dev_config __iomem *bar0 = sp->bar0; 5490 struct XENA_dev_config __iomem *bar0 = sp->bar0;
5492 u16 subid; 5491 u16 subid;
5493 5492
@@ -5525,7 +5524,7 @@ static int s2io_ethtool_idnic(struct net_device *dev, u32 data)
5525static void s2io_ethtool_gringparam(struct net_device *dev, 5524static void s2io_ethtool_gringparam(struct net_device *dev,
5526 struct ethtool_ringparam *ering) 5525 struct ethtool_ringparam *ering)
5527{ 5526{
5528 struct s2io_nic *sp = dev->priv; 5527 struct s2io_nic *sp = netdev_priv(dev);
5529 int i,tx_desc_count=0,rx_desc_count=0; 5528 int i,tx_desc_count=0,rx_desc_count=0;
5530 5529
5531 if (sp->rxd_mode == RXD_MODE_1) 5530 if (sp->rxd_mode == RXD_MODE_1)
@@ -5568,7 +5567,7 @@ static void s2io_ethtool_getpause_data(struct net_device *dev,
5568 struct ethtool_pauseparam *ep) 5567 struct ethtool_pauseparam *ep)
5569{ 5568{
5570 u64 val64; 5569 u64 val64;
5571 struct s2io_nic *sp = dev->priv; 5570 struct s2io_nic *sp = netdev_priv(dev);
5572 struct XENA_dev_config __iomem *bar0 = sp->bar0; 5571 struct XENA_dev_config __iomem *bar0 = sp->bar0;
5573 5572
5574 val64 = readq(&bar0->rmac_pause_cfg); 5573 val64 = readq(&bar0->rmac_pause_cfg);
@@ -5595,7 +5594,7 @@ static int s2io_ethtool_setpause_data(struct net_device *dev,
5595 struct ethtool_pauseparam *ep) 5594 struct ethtool_pauseparam *ep)
5596{ 5595{
5597 u64 val64; 5596 u64 val64;
5598 struct s2io_nic *sp = dev->priv; 5597 struct s2io_nic *sp = netdev_priv(dev);
5599 struct XENA_dev_config __iomem *bar0 = sp->bar0; 5598 struct XENA_dev_config __iomem *bar0 = sp->bar0;
5600 5599
5601 val64 = readq(&bar0->rmac_pause_cfg); 5600 val64 = readq(&bar0->rmac_pause_cfg);
@@ -5825,7 +5824,7 @@ static int s2io_ethtool_geeprom(struct net_device *dev,
5825{ 5824{
5826 u32 i, valid; 5825 u32 i, valid;
5827 u64 data; 5826 u64 data;
5828 struct s2io_nic *sp = dev->priv; 5827 struct s2io_nic *sp = netdev_priv(dev);
5829 5828
5830 eeprom->magic = sp->pdev->vendor | (sp->pdev->device << 16); 5829 eeprom->magic = sp->pdev->vendor | (sp->pdev->device << 16);
5831 5830
@@ -5863,7 +5862,7 @@ static int s2io_ethtool_seeprom(struct net_device *dev,
5863{ 5862{
5864 int len = eeprom->len, cnt = 0; 5863 int len = eeprom->len, cnt = 0;
5865 u64 valid = 0, data; 5864 u64 valid = 0, data;
5866 struct s2io_nic *sp = dev->priv; 5865 struct s2io_nic *sp = netdev_priv(dev);
5867 5866
5868 if (eeprom->magic != (sp->pdev->vendor | (sp->pdev->device << 16))) { 5867 if (eeprom->magic != (sp->pdev->vendor | (sp->pdev->device << 16))) {
5869 DBG_PRINT(ERR_DBG, 5868 DBG_PRINT(ERR_DBG,
@@ -6243,7 +6242,7 @@ static void s2io_ethtool_test(struct net_device *dev,
6243 struct ethtool_test *ethtest, 6242 struct ethtool_test *ethtest,
6244 uint64_t * data) 6243 uint64_t * data)
6245{ 6244{
6246 struct s2io_nic *sp = dev->priv; 6245 struct s2io_nic *sp = netdev_priv(dev);
6247 int orig_state = netif_running(sp->dev); 6246 int orig_state = netif_running(sp->dev);
6248 6247
6249 if (ethtest->flags == ETH_TEST_FL_OFFLINE) { 6248 if (ethtest->flags == ETH_TEST_FL_OFFLINE) {
@@ -6299,7 +6298,7 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
6299 u64 * tmp_stats) 6298 u64 * tmp_stats)
6300{ 6299{
6301 int i = 0, k; 6300 int i = 0, k;
6302 struct s2io_nic *sp = dev->priv; 6301 struct s2io_nic *sp = netdev_priv(dev);
6303 struct stat_block *stat_info = sp->mac_control.stats_info; 6302 struct stat_block *stat_info = sp->mac_control.stats_info;
6304 6303
6305 s2io_updt_stats(sp); 6304 s2io_updt_stats(sp);
@@ -6578,14 +6577,14 @@ static int s2io_ethtool_get_regs_len(struct net_device *dev)
6578 6577
6579static u32 s2io_ethtool_get_rx_csum(struct net_device * dev) 6578static u32 s2io_ethtool_get_rx_csum(struct net_device * dev)
6580{ 6579{
6581 struct s2io_nic *sp = dev->priv; 6580 struct s2io_nic *sp = netdev_priv(dev);
6582 6581
6583 return (sp->rx_csum); 6582 return (sp->rx_csum);
6584} 6583}
6585 6584
6586static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) 6585static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data)
6587{ 6586{
6588 struct s2io_nic *sp = dev->priv; 6587 struct s2io_nic *sp = netdev_priv(dev);
6589 6588
6590 if (data) 6589 if (data)
6591 sp->rx_csum = 1; 6590 sp->rx_csum = 1;
@@ -6602,7 +6601,7 @@ static int s2io_get_eeprom_len(struct net_device *dev)
6602 6601
6603static int s2io_get_sset_count(struct net_device *dev, int sset) 6602static int s2io_get_sset_count(struct net_device *dev, int sset)
6604{ 6603{
6605 struct s2io_nic *sp = dev->priv; 6604 struct s2io_nic *sp = netdev_priv(dev);
6606 6605
6607 switch (sset) { 6606 switch (sset) {
6608 case ETH_SS_TEST: 6607 case ETH_SS_TEST:
@@ -6625,7 +6624,7 @@ static void s2io_ethtool_get_strings(struct net_device *dev,
6625 u32 stringset, u8 * data) 6624 u32 stringset, u8 * data)
6626{ 6625{
6627 int stat_size = 0; 6626 int stat_size = 0;
6628 struct s2io_nic *sp = dev->priv; 6627 struct s2io_nic *sp = netdev_priv(dev);
6629 6628
6630 switch (stringset) { 6629 switch (stringset) {
6631 case ETH_SS_TEST: 6630 case ETH_SS_TEST:
@@ -6727,7 +6726,7 @@ static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
6727 6726
6728static int s2io_change_mtu(struct net_device *dev, int new_mtu) 6727static int s2io_change_mtu(struct net_device *dev, int new_mtu)
6729{ 6728{
6730 struct s2io_nic *sp = dev->priv; 6729 struct s2io_nic *sp = netdev_priv(dev);
6731 int ret = 0; 6730 int ret = 0;
6732 6731
6733 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { 6732 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) {
@@ -7331,7 +7330,7 @@ out_unlock:
7331 7330
7332static void s2io_tx_watchdog(struct net_device *dev) 7331static void s2io_tx_watchdog(struct net_device *dev)
7333{ 7332{
7334 struct s2io_nic *sp = dev->priv; 7333 struct s2io_nic *sp = netdev_priv(dev);
7335 7334
7336 if (netif_carrier_ok(dev)) { 7335 if (netif_carrier_ok(dev)) {
7337 sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt++; 7336 sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt++;
@@ -7366,7 +7365,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
7366 int ring_no = ring_data->ring_no; 7365 int ring_no = ring_data->ring_no;
7367 u16 l3_csum, l4_csum; 7366 u16 l3_csum, l4_csum;
7368 unsigned long long err = rxdp->Control_1 & RXD_T_CODE; 7367 unsigned long long err = rxdp->Control_1 & RXD_T_CODE;
7369 struct lro *lro; 7368 struct lro *uninitialized_var(lro);
7370 u8 err_mask; 7369 u8 err_mask;
7371 7370
7372 skb->dev = dev; 7371 skb->dev = dev;
@@ -7544,7 +7543,6 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
7544 sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 7543 sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize;
7545send_up: 7544send_up:
7546 queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp->Control_2)); 7545 queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp->Control_2));
7547 dev->last_rx = jiffies;
7548aggregate: 7546aggregate:
7549 sp->mac_control.rings[ring_no].rx_bufs_left -= 1; 7547 sp->mac_control.rings[ring_no].rx_bufs_left -= 1;
7550 return SUCCESS; 7548 return SUCCESS;
@@ -7718,6 +7716,24 @@ static int rts_ds_steer(struct s2io_nic *nic, u8 ds_codepoint, u8 ring)
7718 S2IO_BIT_RESET); 7716 S2IO_BIT_RESET);
7719} 7717}
7720 7718
7719static const struct net_device_ops s2io_netdev_ops = {
7720 .ndo_open = s2io_open,
7721 .ndo_stop = s2io_close,
7722 .ndo_get_stats = s2io_get_stats,
7723 .ndo_start_xmit = s2io_xmit,
7724 .ndo_validate_addr = eth_validate_addr,
7725 .ndo_set_multicast_list = s2io_set_multicast,
7726 .ndo_do_ioctl = s2io_ioctl,
7727 .ndo_set_mac_address = s2io_set_mac_addr,
7728 .ndo_change_mtu = s2io_change_mtu,
7729 .ndo_vlan_rx_register = s2io_vlan_rx_register,
7730 .ndo_vlan_rx_kill_vid = s2io_vlan_rx_kill_vid,
7731 .ndo_tx_timeout = s2io_tx_watchdog,
7732#ifdef CONFIG_NET_POLL_CONTROLLER
7733 .ndo_poll_controller = s2io_netpoll,
7734#endif
7735};
7736
7721/** 7737/**
7722 * s2io_init_nic - Initialization of the adapter . 7738 * s2io_init_nic - Initialization of the adapter .
7723 * @pdev : structure containing the PCI related information of the device. 7739 * @pdev : structure containing the PCI related information of the device.
@@ -7748,7 +7764,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7748 int mode; 7764 int mode;
7749 u8 dev_intr_type = intr_type; 7765 u8 dev_intr_type = intr_type;
7750 u8 dev_multiq = 0; 7766 u8 dev_multiq = 0;
7751 DECLARE_MAC_BUF(mac);
7752 7767
7753 ret = s2io_verify_parm(pdev, &dev_intr_type, &dev_multiq); 7768 ret = s2io_verify_parm(pdev, &dev_intr_type, &dev_multiq);
7754 if (ret) 7769 if (ret)
@@ -7798,7 +7813,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7798 SET_NETDEV_DEV(dev, &pdev->dev); 7813 SET_NETDEV_DEV(dev, &pdev->dev);
7799 7814
7800 /* Private member variable initialized to s2io NIC structure */ 7815 /* Private member variable initialized to s2io NIC structure */
7801 sp = dev->priv; 7816 sp = netdev_priv(dev);
7802 memset(sp, 0, sizeof(struct s2io_nic)); 7817 memset(sp, 0, sizeof(struct s2io_nic));
7803 sp->dev = dev; 7818 sp->dev = dev;
7804 sp->pdev = pdev; 7819 sp->pdev = pdev;
@@ -7918,8 +7933,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7918 goto mem_alloc_failed; 7933 goto mem_alloc_failed;
7919 } 7934 }
7920 7935
7921 sp->bar0 = ioremap(pci_resource_start(pdev, 0), 7936 sp->bar0 = pci_ioremap_bar(pdev, 0);
7922 pci_resource_len(pdev, 0));
7923 if (!sp->bar0) { 7937 if (!sp->bar0) {
7924 DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem1\n", 7938 DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem1\n",
7925 dev->name); 7939 dev->name);
@@ -7927,8 +7941,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7927 goto bar0_remap_failed; 7941 goto bar0_remap_failed;
7928 } 7942 }
7929 7943
7930 sp->bar1 = ioremap(pci_resource_start(pdev, 2), 7944 sp->bar1 = pci_ioremap_bar(pdev, 2);
7931 pci_resource_len(pdev, 2));
7932 if (!sp->bar1) { 7945 if (!sp->bar1) {
7933 DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem2\n", 7946 DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem2\n",
7934 dev->name); 7947 dev->name);
@@ -7946,26 +7959,9 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7946 } 7959 }
7947 7960
7948 /* Driver entry points */ 7961 /* Driver entry points */
7949 dev->open = &s2io_open; 7962 dev->netdev_ops = &s2io_netdev_ops;
7950 dev->stop = &s2io_close;
7951 dev->hard_start_xmit = &s2io_xmit;
7952 dev->get_stats = &s2io_get_stats;
7953 dev->set_multicast_list = &s2io_set_multicast;
7954 dev->do_ioctl = &s2io_ioctl;
7955 dev->set_mac_address = &s2io_set_mac_addr;
7956 dev->change_mtu = &s2io_change_mtu;
7957 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 7963 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
7958 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 7964 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
7959 dev->vlan_rx_register = s2io_vlan_rx_register;
7960 dev->vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid;
7961
7962 /*
7963 * will use eth_mac_addr() for dev->set_mac_address
7964 * mac address will be set every time dev->open() is called
7965 */
7966#ifdef CONFIG_NET_POLL_CONTROLLER
7967 dev->poll_controller = s2io_netpoll;
7968#endif
7969 7965
7970 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 7966 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
7971 if (sp->high_dma_flag == TRUE) 7967 if (sp->high_dma_flag == TRUE)
@@ -7976,7 +7972,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7976 dev->features |= NETIF_F_UFO; 7972 dev->features |= NETIF_F_UFO;
7977 dev->features |= NETIF_F_HW_CSUM; 7973 dev->features |= NETIF_F_HW_CSUM;
7978 } 7974 }
7979 dev->tx_timeout = &s2io_tx_watchdog;
7980 dev->watchdog_timeo = WATCH_DOG_TIMEOUT; 7975 dev->watchdog_timeo = WATCH_DOG_TIMEOUT;
7981 INIT_WORK(&sp->rst_timer_task, s2io_restart_nic); 7976 INIT_WORK(&sp->rst_timer_task, s2io_restart_nic);
7982 INIT_WORK(&sp->set_link_task, s2io_set_link); 7977 INIT_WORK(&sp->set_link_task, s2io_set_link);
@@ -8125,8 +8120,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
8125 sp->product_name, pdev->revision); 8120 sp->product_name, pdev->revision);
8126 DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name, 8121 DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name,
8127 s2io_driver_version); 8122 s2io_driver_version);
8128 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: %s\n", 8123 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: %pM\n", dev->name, dev->dev_addr);
8129 dev->name, print_mac(mac, dev->dev_addr));
8130 DBG_PRINT(ERR_DBG, "SERIAL NUMBER: %s\n", sp->serial_num); 8124 DBG_PRINT(ERR_DBG, "SERIAL NUMBER: %s\n", sp->serial_num);
8131 if (sp->device_type & XFRAME_II_DEVICE) { 8125 if (sp->device_type & XFRAME_II_DEVICE) {
8132 mode = s2io_print_pci_mode(sp); 8126 mode = s2io_print_pci_mode(sp);
@@ -8255,7 +8249,7 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev)
8255 8249
8256 flush_scheduled_work(); 8250 flush_scheduled_work();
8257 8251
8258 sp = dev->priv; 8252 sp = netdev_priv(dev);
8259 unregister_netdev(dev); 8253 unregister_netdev(dev);
8260 8254
8261 free_shared_mem(sp); 8255 free_shared_mem(sp);
@@ -8590,7 +8584,7 @@ static void clear_lro_session(struct lro *lro)
8590static void queue_rx_frame(struct sk_buff *skb, u16 vlan_tag) 8584static void queue_rx_frame(struct sk_buff *skb, u16 vlan_tag)
8591{ 8585{
8592 struct net_device *dev = skb->dev; 8586 struct net_device *dev = skb->dev;
8593 struct s2io_nic *sp = dev->priv; 8587 struct s2io_nic *sp = netdev_priv(dev);
8594 8588
8595 skb->protocol = eth_type_trans(skb, dev); 8589 skb->protocol = eth_type_trans(skb, dev);
8596 if (sp->vlgrp && vlan_tag 8590 if (sp->vlgrp && vlan_tag
@@ -8639,7 +8633,7 @@ static pci_ers_result_t s2io_io_error_detected(struct pci_dev *pdev,
8639 pci_channel_state_t state) 8633 pci_channel_state_t state)
8640{ 8634{
8641 struct net_device *netdev = pci_get_drvdata(pdev); 8635 struct net_device *netdev = pci_get_drvdata(pdev);
8642 struct s2io_nic *sp = netdev->priv; 8636 struct s2io_nic *sp = netdev_priv(netdev);
8643 8637
8644 netif_device_detach(netdev); 8638 netif_device_detach(netdev);
8645 8639
@@ -8664,7 +8658,7 @@ static pci_ers_result_t s2io_io_error_detected(struct pci_dev *pdev,
8664static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev) 8658static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev)
8665{ 8659{
8666 struct net_device *netdev = pci_get_drvdata(pdev); 8660 struct net_device *netdev = pci_get_drvdata(pdev);
8667 struct s2io_nic *sp = netdev->priv; 8661 struct s2io_nic *sp = netdev_priv(netdev);
8668 8662
8669 if (pci_enable_device(pdev)) { 8663 if (pci_enable_device(pdev)) {
8670 printk(KERN_ERR "s2io: " 8664 printk(KERN_ERR "s2io: "
@@ -8688,7 +8682,7 @@ static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev)
8688static void s2io_io_resume(struct pci_dev *pdev) 8682static void s2io_io_resume(struct pci_dev *pdev)
8689{ 8683{
8690 struct net_device *netdev = pci_get_drvdata(pdev); 8684 struct net_device *netdev = pci_get_drvdata(pdev);
8691 struct s2io_nic *sp = netdev->priv; 8685 struct s2io_nic *sp = netdev_priv(netdev);
8692 8686
8693 if (netif_running(netdev)) { 8687 if (netif_running(netdev)) {
8694 if (s2io_card_up(sp)) { 8688 if (s2io_card_up(sp)) {