diff options
Diffstat (limited to 'drivers/net/acenic.c')
-rw-r--r-- | drivers/net/acenic.c | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index 23ff22ba5d31..71a4f60f7325 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
@@ -50,7 +50,6 @@ | |||
50 | * Grant Grundler <grundler@cup.hp.com>: PCI write posting fixes. | 50 | * Grant Grundler <grundler@cup.hp.com>: PCI write posting fixes. |
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <linux/config.h> | ||
54 | #include <linux/module.h> | 53 | #include <linux/module.h> |
55 | #include <linux/moduleparam.h> | 54 | #include <linux/moduleparam.h> |
56 | #include <linux/version.h> | 55 | #include <linux/version.h> |
@@ -100,7 +99,7 @@ | |||
100 | #endif | 99 | #endif |
101 | 100 | ||
102 | #ifndef PCI_VENDOR_ID_ALTEON | 101 | #ifndef PCI_VENDOR_ID_ALTEON |
103 | #define PCI_VENDOR_ID_ALTEON 0x12ae | 102 | #define PCI_VENDOR_ID_ALTEON 0x12ae |
104 | #endif | 103 | #endif |
105 | #ifndef PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE | 104 | #ifndef PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE |
106 | #define PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE 0x0001 | 105 | #define PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE 0x0001 |
@@ -164,11 +163,7 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl); | |||
164 | #define SET_NETDEV_DEV(net, pdev) do{} while(0) | 163 | #define SET_NETDEV_DEV(net, pdev) do{} while(0) |
165 | #endif | 164 | #endif |
166 | 165 | ||
167 | #if LINUX_VERSION_CODE >= 0x2051c | ||
168 | #define ace_sync_irq(irq) synchronize_irq(irq) | 166 | #define ace_sync_irq(irq) synchronize_irq(irq) |
169 | #else | ||
170 | #define ace_sync_irq(irq) synchronize_irq() | ||
171 | #endif | ||
172 | 167 | ||
173 | #ifndef offset_in_page | 168 | #ifndef offset_in_page |
174 | #define offset_in_page(ptr) ((unsigned long)(ptr) & ~PAGE_MASK) | 169 | #define offset_in_page(ptr) ((unsigned long)(ptr) & ~PAGE_MASK) |
@@ -444,7 +439,7 @@ MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C985/GA620 max number of receive descript | |||
444 | MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)"); | 439 | MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)"); |
445 | 440 | ||
446 | 441 | ||
447 | static char version[] __devinitdata = | 442 | static char version[] __devinitdata = |
448 | "acenic.c: v0.92 08/05/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n" | 443 | "acenic.c: v0.92 08/05/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n" |
449 | " http://home.cern.ch/~jes/gige/acenic.html\n"; | 444 | " http://home.cern.ch/~jes/gige/acenic.html\n"; |
450 | 445 | ||
@@ -452,7 +447,7 @@ static int ace_get_settings(struct net_device *, struct ethtool_cmd *); | |||
452 | static int ace_set_settings(struct net_device *, struct ethtool_cmd *); | 447 | static int ace_set_settings(struct net_device *, struct ethtool_cmd *); |
453 | static void ace_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); | 448 | static void ace_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); |
454 | 449 | ||
455 | static struct ethtool_ops ace_ethtool_ops = { | 450 | static const struct ethtool_ops ace_ethtool_ops = { |
456 | .get_settings = ace_get_settings, | 451 | .get_settings = ace_get_settings, |
457 | .set_settings = ace_set_settings, | 452 | .set_settings = ace_set_settings, |
458 | .get_drvinfo = ace_get_drvinfo, | 453 | .get_drvinfo = ace_get_drvinfo, |
@@ -517,7 +512,7 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev, | |||
517 | 512 | ||
518 | pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command); | 513 | pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command); |
519 | 514 | ||
520 | /* OpenFirmware on Mac's does not set this - DOH.. */ | 515 | /* OpenFirmware on Mac's does not set this - DOH.. */ |
521 | if (!(ap->pci_command & PCI_COMMAND_MEMORY)) { | 516 | if (!(ap->pci_command & PCI_COMMAND_MEMORY)) { |
522 | printk(KERN_INFO "%s: Enabling PCI Memory Mapped " | 517 | printk(KERN_INFO "%s: Enabling PCI Memory Mapped " |
523 | "access - was not enabled by BIOS/Firmware\n", | 518 | "access - was not enabled by BIOS/Firmware\n", |
@@ -637,7 +632,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev) | |||
637 | writel(readl(®s->CpuCtrl) | CPU_HALT, ®s->CpuCtrl); | 632 | writel(readl(®s->CpuCtrl) | CPU_HALT, ®s->CpuCtrl); |
638 | if (ap->version >= 2) | 633 | if (ap->version >= 2) |
639 | writel(readl(®s->CpuBCtrl) | CPU_HALT, ®s->CpuBCtrl); | 634 | writel(readl(®s->CpuBCtrl) | CPU_HALT, ®s->CpuBCtrl); |
640 | 635 | ||
641 | /* | 636 | /* |
642 | * This clears any pending interrupts | 637 | * This clears any pending interrupts |
643 | */ | 638 | */ |
@@ -726,7 +721,7 @@ static struct pci_driver acenic_pci_driver = { | |||
726 | 721 | ||
727 | static int __init acenic_init(void) | 722 | static int __init acenic_init(void) |
728 | { | 723 | { |
729 | return pci_module_init(&acenic_pci_driver); | 724 | return pci_register_driver(&acenic_pci_driver); |
730 | } | 725 | } |
731 | 726 | ||
732 | static void __exit acenic_exit(void) | 727 | static void __exit acenic_exit(void) |
@@ -1060,7 +1055,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1060 | printk(KERN_INFO " PCI bus width: %i bits, speed: %iMHz, " | 1055 | printk(KERN_INFO " PCI bus width: %i bits, speed: %iMHz, " |
1061 | "latency: %i clks\n", | 1056 | "latency: %i clks\n", |
1062 | (pci_state & PCI_32BIT) ? 32 : 64, | 1057 | (pci_state & PCI_32BIT) ? 32 : 64, |
1063 | (pci_state & PCI_66MHZ) ? 66 : 33, | 1058 | (pci_state & PCI_66MHZ) ? 66 : 33, |
1064 | ap->pci_latency); | 1059 | ap->pci_latency); |
1065 | 1060 | ||
1066 | /* | 1061 | /* |
@@ -1162,7 +1157,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1162 | pci_write_config_word(pdev, PCI_COMMAND, ap->pci_command); | 1157 | pci_write_config_word(pdev, PCI_COMMAND, ap->pci_command); |
1163 | } | 1158 | } |
1164 | #endif | 1159 | #endif |
1165 | 1160 | ||
1166 | /* | 1161 | /* |
1167 | * Configure DMA attributes. | 1162 | * Configure DMA attributes. |
1168 | */ | 1163 | */ |
@@ -1195,7 +1190,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1195 | goto init_error; | 1190 | goto init_error; |
1196 | } | 1191 | } |
1197 | 1192 | ||
1198 | ecode = request_irq(pdev->irq, ace_interrupt, SA_SHIRQ, | 1193 | ecode = request_irq(pdev->irq, ace_interrupt, IRQF_SHARED, |
1199 | DRV_NAME, dev); | 1194 | DRV_NAME, dev); |
1200 | if (ecode) { | 1195 | if (ecode) { |
1201 | printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", | 1196 | printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", |
@@ -1285,7 +1280,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1285 | (RX_STD_RING_ENTRIES + | 1280 | (RX_STD_RING_ENTRIES + |
1286 | RX_JUMBO_RING_ENTRIES)))); | 1281 | RX_JUMBO_RING_ENTRIES)))); |
1287 | info->rx_mini_ctrl.max_len = ACE_MINI_SIZE; | 1282 | info->rx_mini_ctrl.max_len = ACE_MINI_SIZE; |
1288 | info->rx_mini_ctrl.flags = | 1283 | info->rx_mini_ctrl.flags = |
1289 | RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|ACE_RCB_VLAN_FLAG; | 1284 | RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|ACE_RCB_VLAN_FLAG; |
1290 | 1285 | ||
1291 | for (i = 0; i < RX_MINI_RING_ENTRIES; i++) | 1286 | for (i = 0; i < RX_MINI_RING_ENTRIES; i++) |
@@ -1319,7 +1314,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1319 | 1314 | ||
1320 | if (ACE_IS_TIGON_I(ap)) { | 1315 | if (ACE_IS_TIGON_I(ap)) { |
1321 | ap->tx_ring = (struct tx_desc *) regs->Window; | 1316 | ap->tx_ring = (struct tx_desc *) regs->Window; |
1322 | for (i = 0; i < (TIGON_I_TX_RING_ENTRIES | 1317 | for (i = 0; i < (TIGON_I_TX_RING_ENTRIES |
1323 | * sizeof(struct tx_desc)) / sizeof(u32); i++) | 1318 | * sizeof(struct tx_desc)) / sizeof(u32); i++) |
1324 | writel(0, (void __iomem *)ap->tx_ring + i * 4); | 1319 | writel(0, (void __iomem *)ap->tx_ring + i * 4); |
1325 | 1320 | ||
@@ -1671,7 +1666,7 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs) | |||
1671 | { | 1666 | { |
1672 | struct ace_regs __iomem *regs = ap->regs; | 1667 | struct ace_regs __iomem *regs = ap->regs; |
1673 | short i, idx; | 1668 | short i, idx; |
1674 | 1669 | ||
1675 | 1670 | ||
1676 | prefetchw(&ap->cur_rx_bufs); | 1671 | prefetchw(&ap->cur_rx_bufs); |
1677 | 1672 | ||
@@ -1967,7 +1962,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) | |||
1967 | 1962 | ||
1968 | prefetchw(&ap->cur_rx_bufs); | 1963 | prefetchw(&ap->cur_rx_bufs); |
1969 | prefetchw(&ap->cur_mini_bufs); | 1964 | prefetchw(&ap->cur_mini_bufs); |
1970 | 1965 | ||
1971 | while (idx != rxretprd) { | 1966 | while (idx != rxretprd) { |
1972 | struct ring_info *rip; | 1967 | struct ring_info *rip; |
1973 | struct sk_buff *skb; | 1968 | struct sk_buff *skb; |
@@ -1978,7 +1973,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) | |||
1978 | 1973 | ||
1979 | 1974 | ||
1980 | /* make sure the rx descriptor isn't read before rxretprd */ | 1975 | /* make sure the rx descriptor isn't read before rxretprd */ |
1981 | if (idx == rxretcsm) | 1976 | if (idx == rxretcsm) |
1982 | rmb(); | 1977 | rmb(); |
1983 | 1978 | ||
1984 | retdesc = &ap->rx_return_ring[idx]; | 1979 | retdesc = &ap->rx_return_ring[idx]; |
@@ -2010,7 +2005,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) | |||
2010 | rip = &ap->skb->rx_mini_skbuff[skbidx]; | 2005 | rip = &ap->skb->rx_mini_skbuff[skbidx]; |
2011 | mapsize = ACE_MINI_BUFSIZE; | 2006 | mapsize = ACE_MINI_BUFSIZE; |
2012 | rxdesc = &ap->rx_mini_ring[skbidx]; | 2007 | rxdesc = &ap->rx_mini_ring[skbidx]; |
2013 | mini_count++; | 2008 | mini_count++; |
2014 | break; | 2009 | break; |
2015 | default: | 2010 | default: |
2016 | printk(KERN_INFO "%s: unknown frame type (0x%02x) " | 2011 | printk(KERN_INFO "%s: unknown frame type (0x%02x) " |
@@ -2041,7 +2036,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) | |||
2041 | */ | 2036 | */ |
2042 | if (bd_flags & BD_FLG_TCP_UDP_SUM) { | 2037 | if (bd_flags & BD_FLG_TCP_UDP_SUM) { |
2043 | skb->csum = htons(csum); | 2038 | skb->csum = htons(csum); |
2044 | skb->ip_summed = CHECKSUM_HW; | 2039 | skb->ip_summed = CHECKSUM_COMPLETE; |
2045 | } else { | 2040 | } else { |
2046 | skb->ip_summed = CHECKSUM_NONE; | 2041 | skb->ip_summed = CHECKSUM_NONE; |
2047 | } | 2042 | } |
@@ -2378,7 +2373,7 @@ static int ace_close(struct net_device *dev) | |||
2378 | */ | 2373 | */ |
2379 | netif_stop_queue(dev); | 2374 | netif_stop_queue(dev); |
2380 | 2375 | ||
2381 | 2376 | ||
2382 | if (ap->promisc) { | 2377 | if (ap->promisc) { |
2383 | cmd.evt = C_SET_PROMISC_MODE; | 2378 | cmd.evt = C_SET_PROMISC_MODE; |
2384 | cmd.code = C_C_PROMISC_DISABLE; | 2379 | cmd.code = C_C_PROMISC_DISABLE; |
@@ -2413,7 +2408,7 @@ static int ace_close(struct net_device *dev) | |||
2413 | 2408 | ||
2414 | if (mapping) { | 2409 | if (mapping) { |
2415 | if (ACE_IS_TIGON_I(ap)) { | 2410 | if (ACE_IS_TIGON_I(ap)) { |
2416 | struct tx_desc __iomem *tx | 2411 | struct tx_desc __iomem *tx |
2417 | = (struct tx_desc __iomem *) &ap->tx_ring[i]; | 2412 | = (struct tx_desc __iomem *) &ap->tx_ring[i]; |
2418 | writel(0, &tx->addr.addrhi); | 2413 | writel(0, &tx->addr.addrhi); |
2419 | writel(0, &tx->addr.addrlo); | 2414 | writel(0, &tx->addr.addrlo); |
@@ -2512,7 +2507,7 @@ restart: | |||
2512 | 2507 | ||
2513 | mapping = ace_map_tx_skb(ap, skb, skb, idx); | 2508 | mapping = ace_map_tx_skb(ap, skb, skb, idx); |
2514 | flagsize = (skb->len << 16) | (BD_FLG_END); | 2509 | flagsize = (skb->len << 16) | (BD_FLG_END); |
2515 | if (skb->ip_summed == CHECKSUM_HW) | 2510 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
2516 | flagsize |= BD_FLG_TCP_UDP_SUM; | 2511 | flagsize |= BD_FLG_TCP_UDP_SUM; |
2517 | #if ACENIC_DO_VLAN | 2512 | #if ACENIC_DO_VLAN |
2518 | if (vlan_tx_tag_present(skb)) { | 2513 | if (vlan_tx_tag_present(skb)) { |
@@ -2535,7 +2530,7 @@ restart: | |||
2535 | 2530 | ||
2536 | mapping = ace_map_tx_skb(ap, skb, NULL, idx); | 2531 | mapping = ace_map_tx_skb(ap, skb, NULL, idx); |
2537 | flagsize = (skb_headlen(skb) << 16); | 2532 | flagsize = (skb_headlen(skb) << 16); |
2538 | if (skb->ip_summed == CHECKSUM_HW) | 2533 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
2539 | flagsize |= BD_FLG_TCP_UDP_SUM; | 2534 | flagsize |= BD_FLG_TCP_UDP_SUM; |
2540 | #if ACENIC_DO_VLAN | 2535 | #if ACENIC_DO_VLAN |
2541 | if (vlan_tx_tag_present(skb)) { | 2536 | if (vlan_tx_tag_present(skb)) { |
@@ -2561,7 +2556,7 @@ restart: | |||
2561 | PCI_DMA_TODEVICE); | 2556 | PCI_DMA_TODEVICE); |
2562 | 2557 | ||
2563 | flagsize = (frag->size << 16); | 2558 | flagsize = (frag->size << 16); |
2564 | if (skb->ip_summed == CHECKSUM_HW) | 2559 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
2565 | flagsize |= BD_FLG_TCP_UDP_SUM; | 2560 | flagsize |= BD_FLG_TCP_UDP_SUM; |
2566 | idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); | 2561 | idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); |
2567 | 2562 | ||
@@ -2626,7 +2621,7 @@ overflow: | |||
2626 | cpu_relax(); | 2621 | cpu_relax(); |
2627 | goto restart; | 2622 | goto restart; |
2628 | } | 2623 | } |
2629 | 2624 | ||
2630 | /* The ring is stuck full. */ | 2625 | /* The ring is stuck full. */ |
2631 | printk(KERN_WARNING "%s: Transmit ring stuck full\n", dev->name); | 2626 | printk(KERN_WARNING "%s: Transmit ring stuck full\n", dev->name); |
2632 | return NETDEV_TX_BUSY; | 2627 | return NETDEV_TX_BUSY; |
@@ -2785,18 +2780,18 @@ static int ace_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
2785 | return 0; | 2780 | return 0; |
2786 | } | 2781 | } |
2787 | 2782 | ||
2788 | static void ace_get_drvinfo(struct net_device *dev, | 2783 | static void ace_get_drvinfo(struct net_device *dev, |
2789 | struct ethtool_drvinfo *info) | 2784 | struct ethtool_drvinfo *info) |
2790 | { | 2785 | { |
2791 | struct ace_private *ap = netdev_priv(dev); | 2786 | struct ace_private *ap = netdev_priv(dev); |
2792 | 2787 | ||
2793 | strlcpy(info->driver, "acenic", sizeof(info->driver)); | 2788 | strlcpy(info->driver, "acenic", sizeof(info->driver)); |
2794 | snprintf(info->version, sizeof(info->version), "%i.%i.%i", | 2789 | snprintf(info->version, sizeof(info->version), "%i.%i.%i", |
2795 | tigonFwReleaseMajor, tigonFwReleaseMinor, | 2790 | tigonFwReleaseMajor, tigonFwReleaseMinor, |
2796 | tigonFwReleaseFix); | 2791 | tigonFwReleaseFix); |
2797 | 2792 | ||
2798 | if (ap->pdev) | 2793 | if (ap->pdev) |
2799 | strlcpy(info->bus_info, pci_name(ap->pdev), | 2794 | strlcpy(info->bus_info, pci_name(ap->pdev), |
2800 | sizeof(info->bus_info)); | 2795 | sizeof(info->bus_info)); |
2801 | 2796 | ||
2802 | } | 2797 | } |
@@ -2913,7 +2908,7 @@ static void __devinit ace_copy(struct ace_regs __iomem *regs, void *src, | |||
2913 | while (size > 0) { | 2908 | while (size > 0) { |
2914 | tsize = min_t(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1), | 2909 | tsize = min_t(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1), |
2915 | min_t(u32, size, ACE_WINDOW_SIZE)); | 2910 | min_t(u32, size, ACE_WINDOW_SIZE)); |
2916 | tdest = (void __iomem *) ®s->Window + | 2911 | tdest = (void __iomem *) ®s->Window + |
2917 | (dest & (ACE_WINDOW_SIZE - 1)); | 2912 | (dest & (ACE_WINDOW_SIZE - 1)); |
2918 | writel(dest & ~(ACE_WINDOW_SIZE - 1), ®s->WinBase); | 2913 | writel(dest & ~(ACE_WINDOW_SIZE - 1), ®s->WinBase); |
2919 | /* | 2914 | /* |
@@ -2944,7 +2939,7 @@ static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int siz | |||
2944 | while (size > 0) { | 2939 | while (size > 0) { |
2945 | tsize = min_t(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1), | 2940 | tsize = min_t(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1), |
2946 | min_t(u32, size, ACE_WINDOW_SIZE)); | 2941 | min_t(u32, size, ACE_WINDOW_SIZE)); |
2947 | tdest = (void __iomem *) ®s->Window + | 2942 | tdest = (void __iomem *) ®s->Window + |
2948 | (dest & (ACE_WINDOW_SIZE - 1)); | 2943 | (dest & (ACE_WINDOW_SIZE - 1)); |
2949 | writel(dest & ~(ACE_WINDOW_SIZE - 1), ®s->WinBase); | 2944 | writel(dest & ~(ACE_WINDOW_SIZE - 1), ®s->WinBase); |
2950 | 2945 | ||
@@ -3061,7 +3056,7 @@ static void __devinit eeprom_prep(struct ace_regs __iomem *regs, u8 magic) | |||
3061 | 3056 | ||
3062 | for (i = 0; i < 8; i++, magic <<= 1) { | 3057 | for (i = 0; i < 8; i++, magic <<= 1) { |
3063 | udelay(ACE_SHORT_DELAY); | 3058 | udelay(ACE_SHORT_DELAY); |
3064 | if (magic & 0x80) | 3059 | if (magic & 0x80) |
3065 | local |= EEPROM_DATA_OUT; | 3060 | local |= EEPROM_DATA_OUT; |
3066 | else | 3061 | else |
3067 | local &= ~EEPROM_DATA_OUT; | 3062 | local &= ~EEPROM_DATA_OUT; |