diff options
Diffstat (limited to 'drivers/net')
167 files changed, 2671 insertions, 2099 deletions
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index edda6e10ebe5..8fafac987e0b 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -385,6 +385,7 @@ static int __init el3_probe(int card_idx) | |||
385 | #if defined(__ISAPNP__) | 385 | #if defined(__ISAPNP__) |
386 | static int pnp_cards; | 386 | static int pnp_cards; |
387 | struct pnp_dev *idev = NULL; | 387 | struct pnp_dev *idev = NULL; |
388 | int pnp_found = 0; | ||
388 | 389 | ||
389 | if (nopnp == 1) | 390 | if (nopnp == 1) |
390 | goto no_pnp; | 391 | goto no_pnp; |
@@ -430,6 +431,7 @@ __again: | |||
430 | pnp_cards++; | 431 | pnp_cards++; |
431 | 432 | ||
432 | netdev_boot_setup_check(dev); | 433 | netdev_boot_setup_check(dev); |
434 | pnp_found = 1; | ||
433 | goto found; | 435 | goto found; |
434 | } | 436 | } |
435 | } | 437 | } |
@@ -560,6 +562,8 @@ no_pnp: | |||
560 | lp = netdev_priv(dev); | 562 | lp = netdev_priv(dev); |
561 | #if defined(__ISAPNP__) | 563 | #if defined(__ISAPNP__) |
562 | lp->dev = &idev->dev; | 564 | lp->dev = &idev->dev; |
565 | if (pnp_found) | ||
566 | lp->type = EL3_PNP; | ||
563 | #endif | 567 | #endif |
564 | err = el3_common_init(dev); | 568 | err = el3_common_init(dev); |
565 | 569 | ||
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index 275e7510ebaf..684bab781015 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c | |||
@@ -243,14 +243,16 @@ enum eeprom_offset { | |||
243 | enum Window3 { /* Window 3: MAC/config bits. */ | 243 | enum Window3 { /* Window 3: MAC/config bits. */ |
244 | Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8, | 244 | Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8, |
245 | }; | 245 | }; |
246 | union wn3_config { | 246 | enum wn3_config { |
247 | int i; | 247 | Ram_size = 7, |
248 | struct w3_config_fields { | 248 | Ram_width = 8, |
249 | unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; | 249 | Ram_speed = 0x30, |
250 | int pad8:8; | 250 | Rom_size = 0xc0, |
251 | unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; | 251 | Ram_split_shift = 16, |
252 | int pad24:7; | 252 | Ram_split = 3 << Ram_split_shift, |
253 | } u; | 253 | Xcvr_shift = 20, |
254 | Xcvr = 7 << Xcvr_shift, | ||
255 | Autoselect = 0x1000000, | ||
254 | }; | 256 | }; |
255 | 257 | ||
256 | enum Window4 { | 258 | enum Window4 { |
@@ -614,7 +616,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr, | |||
614 | /* Read the station address from the EEPROM. */ | 616 | /* Read the station address from the EEPROM. */ |
615 | EL3WINDOW(0); | 617 | EL3WINDOW(0); |
616 | for (i = 0; i < 0x18; i++) { | 618 | for (i = 0; i < 0x18; i++) { |
617 | short *phys_addr = (short *) dev->dev_addr; | 619 | __be16 *phys_addr = (__be16 *) dev->dev_addr; |
618 | int timer; | 620 | int timer; |
619 | outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd); | 621 | outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd); |
620 | /* Pause for at least 162 us. for the read to take place. */ | 622 | /* Pause for at least 162 us. for the read to take place. */ |
@@ -646,22 +648,22 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr, | |||
646 | 648 | ||
647 | { | 649 | { |
648 | char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" }; | 650 | char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" }; |
649 | union wn3_config config; | 651 | __u32 config; |
650 | EL3WINDOW(3); | 652 | EL3WINDOW(3); |
651 | vp->available_media = inw(ioaddr + Wn3_Options); | 653 | vp->available_media = inw(ioaddr + Wn3_Options); |
652 | config.i = inl(ioaddr + Wn3_Config); | 654 | config = inl(ioaddr + Wn3_Config); |
653 | if (corkscrew_debug > 1) | 655 | if (corkscrew_debug > 1) |
654 | printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n", | 656 | printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n", |
655 | config.i, inw(ioaddr + Wn3_Options)); | 657 | config, inw(ioaddr + Wn3_Options)); |
656 | printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n", | 658 | printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n", |
657 | 8 << config.u.ram_size, | 659 | 8 << config & Ram_size, |
658 | config.u.ram_width ? "word" : "byte", | 660 | config & Ram_width ? "word" : "byte", |
659 | ram_split[config.u.ram_split], | 661 | ram_split[(config & Ram_split) >> Ram_split_shift], |
660 | config.u.autoselect ? "autoselect/" : "", | 662 | config & Autoselect ? "autoselect/" : "", |
661 | media_tbl[config.u.xcvr].name); | 663 | media_tbl[(config & Xcvr) >> Xcvr_shift].name); |
662 | dev->if_port = config.u.xcvr; | 664 | vp->default_media = (config & Xcvr) >> Xcvr_shift; |
663 | vp->default_media = config.u.xcvr; | 665 | vp->autoselect = config & Autoselect ? 1 : 0; |
664 | vp->autoselect = config.u.autoselect; | 666 | dev->if_port = vp->default_media; |
665 | } | 667 | } |
666 | if (vp->media_override != 7) { | 668 | if (vp->media_override != 7) { |
667 | printk(KERN_INFO " Media override to transceiver type %d (%s).\n", | 669 | printk(KERN_INFO " Media override to transceiver type %d (%s).\n", |
@@ -694,14 +696,14 @@ static int corkscrew_open(struct net_device *dev) | |||
694 | { | 696 | { |
695 | int ioaddr = dev->base_addr; | 697 | int ioaddr = dev->base_addr; |
696 | struct corkscrew_private *vp = netdev_priv(dev); | 698 | struct corkscrew_private *vp = netdev_priv(dev); |
697 | union wn3_config config; | 699 | __u32 config; |
698 | int i; | 700 | int i; |
699 | 701 | ||
700 | /* Before initializing select the active media port. */ | 702 | /* Before initializing select the active media port. */ |
701 | EL3WINDOW(3); | 703 | EL3WINDOW(3); |
702 | if (vp->full_duplex) | 704 | if (vp->full_duplex) |
703 | outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */ | 705 | outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */ |
704 | config.i = inl(ioaddr + Wn3_Config); | 706 | config = inl(ioaddr + Wn3_Config); |
705 | 707 | ||
706 | if (vp->media_override != 7) { | 708 | if (vp->media_override != 7) { |
707 | if (corkscrew_debug > 1) | 709 | if (corkscrew_debug > 1) |
@@ -727,12 +729,12 @@ static int corkscrew_open(struct net_device *dev) | |||
727 | } else | 729 | } else |
728 | dev->if_port = vp->default_media; | 730 | dev->if_port = vp->default_media; |
729 | 731 | ||
730 | config.u.xcvr = dev->if_port; | 732 | config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift); |
731 | outl(config.i, ioaddr + Wn3_Config); | 733 | outl(config, ioaddr + Wn3_Config); |
732 | 734 | ||
733 | if (corkscrew_debug > 1) { | 735 | if (corkscrew_debug > 1) { |
734 | printk("%s: corkscrew_open() InternalConfig %8.8x.\n", | 736 | printk("%s: corkscrew_open() InternalConfig %8.8x.\n", |
735 | dev->name, config.i); | 737 | dev->name, config); |
736 | } | 738 | } |
737 | 739 | ||
738 | outw(TxReset, ioaddr + EL3_CMD); | 740 | outw(TxReset, ioaddr + EL3_CMD); |
@@ -901,7 +903,7 @@ static void corkscrew_timer(unsigned long data) | |||
901 | ok = 1; | 903 | ok = 1; |
902 | } | 904 | } |
903 | if (!ok) { | 905 | if (!ok) { |
904 | union wn3_config config; | 906 | __u32 config; |
905 | 907 | ||
906 | do { | 908 | do { |
907 | dev->if_port = | 909 | dev->if_port = |
@@ -928,9 +930,9 @@ static void corkscrew_timer(unsigned long data) | |||
928 | ioaddr + Wn4_Media); | 930 | ioaddr + Wn4_Media); |
929 | 931 | ||
930 | EL3WINDOW(3); | 932 | EL3WINDOW(3); |
931 | config.i = inl(ioaddr + Wn3_Config); | 933 | config = inl(ioaddr + Wn3_Config); |
932 | config.u.xcvr = dev->if_port; | 934 | config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift); |
933 | outl(config.i, ioaddr + Wn3_Config); | 935 | outl(config, ioaddr + Wn3_Config); |
934 | 936 | ||
935 | outw(dev->if_port == 3 ? StartCoax : StopCoax, | 937 | outw(dev->if_port == 3 ? StartCoax : StopCoax, |
936 | ioaddr + EL3_CMD); | 938 | ioaddr + EL3_CMD); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e8d69b0adf90..9af05a2f4af3 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -166,16 +166,6 @@ config NET_SB1000 | |||
166 | 166 | ||
167 | If you don't have this card, of course say N. | 167 | If you don't have this card, of course say N. |
168 | 168 | ||
169 | config IP1000 | ||
170 | tristate "IP1000 Gigabit Ethernet support" | ||
171 | depends on PCI && EXPERIMENTAL | ||
172 | select MII | ||
173 | ---help--- | ||
174 | This driver supports IP1000 gigabit Ethernet cards. | ||
175 | |||
176 | To compile this driver as a module, choose M here: the module | ||
177 | will be called ipg. This is recommended. | ||
178 | |||
179 | source "drivers/net/arcnet/Kconfig" | 169 | source "drivers/net/arcnet/Kconfig" |
180 | 170 | ||
181 | source "drivers/net/phy/Kconfig" | 171 | source "drivers/net/phy/Kconfig" |
@@ -888,7 +878,7 @@ config SMC91X | |||
888 | tristate "SMC 91C9x/91C1xxx support" | 878 | tristate "SMC 91C9x/91C1xxx support" |
889 | select CRC32 | 879 | select CRC32 |
890 | select MII | 880 | select MII |
891 | depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BFIN | 881 | depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BLACKFIN |
892 | help | 882 | help |
893 | This is a driver for SMC's 91x series of Ethernet chipsets, | 883 | This is a driver for SMC's 91x series of Ethernet chipsets, |
894 | including the SMC91C94 and the SMC91C111. Say Y if you want it | 884 | including the SMC91C94 and the SMC91C111. Say Y if you want it |
@@ -926,7 +916,7 @@ config SMC911X | |||
926 | tristate "SMSC LAN911[5678] support" | 916 | tristate "SMSC LAN911[5678] support" |
927 | select CRC32 | 917 | select CRC32 |
928 | select MII | 918 | select MII |
929 | depends on ARCH_PXA || SUPERH | 919 | depends on ARCH_PXA || SH_MAGIC_PANEL_R2 |
930 | help | 920 | help |
931 | This is a driver for SMSC's LAN911x series of Ethernet chipsets | 921 | This is a driver for SMSC's LAN911x series of Ethernet chipsets |
932 | including the new LAN9115, LAN9116, LAN9117, and LAN9118. | 922 | including the new LAN9115, LAN9116, LAN9117, and LAN9118. |
@@ -1986,12 +1976,19 @@ config E1000E | |||
1986 | 1976 | ||
1987 | <http://support.intel.com> | 1977 | <http://support.intel.com> |
1988 | 1978 | ||
1989 | More specific information on configuring the driver is in | ||
1990 | <file:Documentation/networking/e1000e.txt>. | ||
1991 | |||
1992 | To compile this driver as a module, choose M here. The module | 1979 | To compile this driver as a module, choose M here. The module |
1993 | will be called e1000e. | 1980 | will be called e1000e. |
1994 | 1981 | ||
1982 | config IP1000 | ||
1983 | tristate "IP1000 Gigabit Ethernet support" | ||
1984 | depends on PCI && EXPERIMENTAL | ||
1985 | select MII | ||
1986 | ---help--- | ||
1987 | This driver supports IP1000 gigabit Ethernet cards. | ||
1988 | |||
1989 | To compile this driver as a module, choose M here: the module | ||
1990 | will be called ipg. This is recommended. | ||
1991 | |||
1995 | source "drivers/net/ixp2000/Kconfig" | 1992 | source "drivers/net/ixp2000/Kconfig" |
1996 | 1993 | ||
1997 | config MYRI_SBUS | 1994 | config MYRI_SBUS |
@@ -2468,9 +2465,6 @@ config IXGBE | |||
2468 | 2465 | ||
2469 | <http://support.intel.com> | 2466 | <http://support.intel.com> |
2470 | 2467 | ||
2471 | More specific information on configuring the driver is in | ||
2472 | <file:Documentation/networking/ixgbe.txt>. | ||
2473 | |||
2474 | To compile this driver as a module, choose M here. The module | 2468 | To compile this driver as a module, choose M here. The module |
2475 | will be called ixgbe. | 2469 | will be called ixgbe. |
2476 | 2470 | ||
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index eebf5bb2b03a..e7fdd81919bd 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c | |||
@@ -1340,7 +1340,9 @@ static int amd8111e_close(struct net_device * dev) | |||
1340 | struct amd8111e_priv *lp = netdev_priv(dev); | 1340 | struct amd8111e_priv *lp = netdev_priv(dev); |
1341 | netif_stop_queue(dev); | 1341 | netif_stop_queue(dev); |
1342 | 1342 | ||
1343 | #ifdef CONFIG_AMD8111E_NAPI | ||
1343 | napi_disable(&lp->napi); | 1344 | napi_disable(&lp->napi); |
1345 | #endif | ||
1344 | 1346 | ||
1345 | spin_lock_irq(&lp->lock); | 1347 | spin_lock_irq(&lp->lock); |
1346 | 1348 | ||
@@ -1372,7 +1374,9 @@ static int amd8111e_open(struct net_device * dev ) | |||
1372 | dev->name, dev)) | 1374 | dev->name, dev)) |
1373 | return -EAGAIN; | 1375 | return -EAGAIN; |
1374 | 1376 | ||
1377 | #ifdef CONFIG_AMD8111E_NAPI | ||
1375 | napi_enable(&lp->napi); | 1378 | napi_enable(&lp->napi); |
1379 | #endif | ||
1376 | 1380 | ||
1377 | spin_lock_irq(&lp->lock); | 1381 | spin_lock_irq(&lp->lock); |
1378 | 1382 | ||
@@ -1380,7 +1384,9 @@ static int amd8111e_open(struct net_device * dev ) | |||
1380 | 1384 | ||
1381 | if(amd8111e_restart(dev)){ | 1385 | if(amd8111e_restart(dev)){ |
1382 | spin_unlock_irq(&lp->lock); | 1386 | spin_unlock_irq(&lp->lock); |
1387 | #ifdef CONFIG_AMD8111E_NAPI | ||
1383 | napi_disable(&lp->napi); | 1388 | napi_disable(&lp->napi); |
1389 | #endif | ||
1384 | if (dev->irq) | 1390 | if (dev->irq) |
1385 | free_irq(dev->irq, dev); | 1391 | free_irq(dev->irq, dev); |
1386 | return -ENOMEM; | 1392 | return -ENOMEM; |
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 35b0a7dd4ef4..9200ee59d854 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -120,7 +120,7 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter) | |||
120 | struct atl1_hw *hw = &adapter->hw; | 120 | struct atl1_hw *hw = &adapter->hw; |
121 | struct net_device *netdev = adapter->netdev; | 121 | struct net_device *netdev = adapter->netdev; |
122 | 122 | ||
123 | hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; | 123 | hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; |
124 | hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; | 124 | hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
125 | 125 | ||
126 | adapter->wol = 0; | 126 | adapter->wol = 0; |
@@ -688,7 +688,7 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu) | |||
688 | { | 688 | { |
689 | struct atl1_adapter *adapter = netdev_priv(netdev); | 689 | struct atl1_adapter *adapter = netdev_priv(netdev); |
690 | int old_mtu = netdev->mtu; | 690 | int old_mtu = netdev->mtu; |
691 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 691 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; |
692 | 692 | ||
693 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || | 693 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || |
694 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { | 694 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { |
@@ -853,8 +853,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter) | |||
853 | /* set Interrupt Clear Timer */ | 853 | /* set Interrupt Clear Timer */ |
854 | iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER); | 854 | iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER); |
855 | 855 | ||
856 | /* set MTU, 4 : VLAN */ | 856 | /* set max frame size hw will accept */ |
857 | iowrite32(hw->max_frame_size + 4, hw->hw_addr + REG_MTU); | 857 | iowrite32(hw->max_frame_size, hw->hw_addr + REG_MTU); |
858 | 858 | ||
859 | /* jumbo size & rrd retirement timer */ | 859 | /* jumbo size & rrd retirement timer */ |
860 | value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK) | 860 | value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK) |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 084acfd6fc5f..eb971755a3ff 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -676,7 +676,7 @@ static void bf537mac_rx(struct net_device *dev) | |||
676 | skb->protocol = eth_type_trans(skb, dev); | 676 | skb->protocol = eth_type_trans(skb, dev); |
677 | #if defined(BFIN_MAC_CSUM_OFFLOAD) | 677 | #if defined(BFIN_MAC_CSUM_OFFLOAD) |
678 | skb->csum = current_rx_ptr->status.ip_payload_csum; | 678 | skb->csum = current_rx_ptr->status.ip_payload_csum; |
679 | skb->ip_summed = CHECKSUM_PARTIAL; | 679 | skb->ip_summed = CHECKSUM_COMPLETE; |
680 | #endif | 680 | #endif |
681 | 681 | ||
682 | netif_rx(skb); | 682 | netif_rx(skb); |
@@ -924,7 +924,7 @@ static int __init bf537mac_probe(struct net_device *dev) | |||
924 | if (!is_valid_ether_addr(dev->dev_addr)) { | 924 | if (!is_valid_ether_addr(dev->dev_addr)) { |
925 | /* Grab the MAC from the board somehow - this is done in the | 925 | /* Grab the MAC from the board somehow - this is done in the |
926 | arch/blackfin/mach-bf537/boards/eth_mac.c */ | 926 | arch/blackfin/mach-bf537/boards/eth_mac.c */ |
927 | get_bf537_ether_addr(dev->dev_addr); | 927 | bfin_get_ether_addr(dev->dev_addr); |
928 | } | 928 | } |
929 | 929 | ||
930 | /* If still not valid, get a random one */ | 930 | /* If still not valid, get a random one */ |
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h index 3a107ad75381..5970ea7142cd 100644 --- a/drivers/net/bfin_mac.h +++ b/drivers/net/bfin_mac.h | |||
@@ -92,4 +92,4 @@ struct bf537mac_local { | |||
92 | struct mii_bus mii_bus; | 92 | struct mii_bus mii_bus; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | extern void get_bf537_ether_addr(char *addr); | 95 | extern void bfin_get_ether_addr(char *addr); |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index da767d3d5af5..4e7b46e44874 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -56,8 +56,8 @@ | |||
56 | 56 | ||
57 | #define DRV_MODULE_NAME "bnx2" | 57 | #define DRV_MODULE_NAME "bnx2" |
58 | #define PFX DRV_MODULE_NAME ": " | 58 | #define PFX DRV_MODULE_NAME ": " |
59 | #define DRV_MODULE_VERSION "1.6.8" | 59 | #define DRV_MODULE_VERSION "1.6.9" |
60 | #define DRV_MODULE_RELDATE "October 17, 2007" | 60 | #define DRV_MODULE_RELDATE "December 8, 2007" |
61 | 61 | ||
62 | #define RUN_AT(x) (jiffies + (x)) | 62 | #define RUN_AT(x) (jiffies + (x)) |
63 | 63 | ||
@@ -2387,18 +2387,24 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb, | |||
2387 | prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; | 2387 | prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; |
2388 | } | 2388 | } |
2389 | 2389 | ||
2390 | static inline u16 | ||
2391 | bnx2_get_hw_rx_cons(struct bnx2 *bp) | ||
2392 | { | ||
2393 | u16 cons = bp->status_blk->status_rx_quick_consumer_index0; | ||
2394 | |||
2395 | if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)) | ||
2396 | cons++; | ||
2397 | return cons; | ||
2398 | } | ||
2399 | |||
2390 | static int | 2400 | static int |
2391 | bnx2_rx_int(struct bnx2 *bp, int budget) | 2401 | bnx2_rx_int(struct bnx2 *bp, int budget) |
2392 | { | 2402 | { |
2393 | struct status_block *sblk = bp->status_blk; | ||
2394 | u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; | 2403 | u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; |
2395 | struct l2_fhdr *rx_hdr; | 2404 | struct l2_fhdr *rx_hdr; |
2396 | int rx_pkt = 0; | 2405 | int rx_pkt = 0; |
2397 | 2406 | ||
2398 | hw_cons = bp->hw_rx_cons = sblk->status_rx_quick_consumer_index0; | 2407 | hw_cons = bnx2_get_hw_rx_cons(bp); |
2399 | if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) { | ||
2400 | hw_cons++; | ||
2401 | } | ||
2402 | sw_cons = bp->rx_cons; | 2408 | sw_cons = bp->rx_cons; |
2403 | sw_prod = bp->rx_prod; | 2409 | sw_prod = bp->rx_prod; |
2404 | 2410 | ||
@@ -2515,10 +2521,7 @@ next_rx: | |||
2515 | 2521 | ||
2516 | /* Refresh hw_cons to see if there is new work */ | 2522 | /* Refresh hw_cons to see if there is new work */ |
2517 | if (sw_cons == hw_cons) { | 2523 | if (sw_cons == hw_cons) { |
2518 | hw_cons = bp->hw_rx_cons = | 2524 | hw_cons = bnx2_get_hw_rx_cons(bp); |
2519 | sblk->status_rx_quick_consumer_index0; | ||
2520 | if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) | ||
2521 | hw_cons++; | ||
2522 | rmb(); | 2525 | rmb(); |
2523 | } | 2526 | } |
2524 | } | 2527 | } |
@@ -2622,7 +2625,7 @@ bnx2_has_work(struct bnx2 *bp) | |||
2622 | { | 2625 | { |
2623 | struct status_block *sblk = bp->status_blk; | 2626 | struct status_block *sblk = bp->status_blk; |
2624 | 2627 | ||
2625 | if ((sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) || | 2628 | if ((bnx2_get_hw_rx_cons(bp) != bp->rx_cons) || |
2626 | (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) | 2629 | (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) |
2627 | return 1; | 2630 | return 1; |
2628 | 2631 | ||
@@ -2655,7 +2658,7 @@ static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget) | |||
2655 | if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) | 2658 | if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) |
2656 | bnx2_tx_int(bp); | 2659 | bnx2_tx_int(bp); |
2657 | 2660 | ||
2658 | if (sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) | 2661 | if (bnx2_get_hw_rx_cons(bp) != bp->rx_cons) |
2659 | work_done += bnx2_rx_int(bp, budget - work_done); | 2662 | work_done += bnx2_rx_int(bp, budget - work_done); |
2660 | 2663 | ||
2661 | return work_done; | 2664 | return work_done; |
@@ -4177,7 +4180,6 @@ bnx2_init_rx_ring(struct bnx2 *bp) | |||
4177 | 4180 | ||
4178 | ring_prod = prod = bp->rx_prod = 0; | 4181 | ring_prod = prod = bp->rx_prod = 0; |
4179 | bp->rx_cons = 0; | 4182 | bp->rx_cons = 0; |
4180 | bp->hw_rx_cons = 0; | ||
4181 | bp->rx_prod_bseq = 0; | 4183 | bp->rx_prod_bseq = 0; |
4182 | 4184 | ||
4183 | for (i = 0; i < bp->rx_max_ring; i++) { | 4185 | for (i = 0; i < bp->rx_max_ring; i++) { |
@@ -6685,8 +6687,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
6685 | } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || | 6687 | } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || |
6686 | CHIP_NUM(bp) == CHIP_NUM_5708) | 6688 | CHIP_NUM(bp) == CHIP_NUM_5708) |
6687 | bp->phy_flags |= PHY_CRC_FIX_FLAG; | 6689 | bp->phy_flags |= PHY_CRC_FIX_FLAG; |
6688 | else if (CHIP_ID(bp) == CHIP_ID_5709_A0 || | 6690 | else if (CHIP_NUM(bp) == CHIP_NUM_5709 && |
6689 | CHIP_ID(bp) == CHIP_ID_5709_A1) | 6691 | (CHIP_REV(bp) == CHIP_REV_Ax || |
6692 | CHIP_REV(bp) == CHIP_REV_Bx)) | ||
6690 | bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; | 6693 | bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; |
6691 | 6694 | ||
6692 | if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || | 6695 | if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 1dce0d1a2581..30ba366608b0 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6513,7 +6513,6 @@ struct bnx2 { | |||
6513 | u32 rx_prod_bseq; | 6513 | u32 rx_prod_bseq; |
6514 | u16 rx_prod; | 6514 | u16 rx_prod; |
6515 | u16 rx_cons; | 6515 | u16 rx_cons; |
6516 | u16 hw_rx_cons; | ||
6517 | 6516 | ||
6518 | u32 rx_csum; | 6517 | u32 rx_csum; |
6519 | 6518 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 25b8dbf6cfd7..b57bc9467dbe 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -979,7 +979,7 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct | |||
979 | /* | 979 | /* |
980 | * Send learning packets after MAC address swap. | 980 | * Send learning packets after MAC address swap. |
981 | * | 981 | * |
982 | * Called with RTNL and bond->lock held for read. | 982 | * Called with RTNL and no other locks |
983 | */ | 983 | */ |
984 | static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, | 984 | static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, |
985 | struct slave *slave2) | 985 | struct slave *slave2) |
@@ -987,6 +987,8 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, | |||
987 | int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); | 987 | int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); |
988 | struct slave *disabled_slave = NULL; | 988 | struct slave *disabled_slave = NULL; |
989 | 989 | ||
990 | ASSERT_RTNL(); | ||
991 | |||
990 | /* fasten the change in the switch */ | 992 | /* fasten the change in the switch */ |
991 | if (SLAVE_IS_OK(slave1)) { | 993 | if (SLAVE_IS_OK(slave1)) { |
992 | alb_send_learning_packets(slave1, slave1->dev->dev_addr); | 994 | alb_send_learning_packets(slave1, slave1->dev->dev_addr); |
@@ -1031,7 +1033,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, | |||
1031 | * a slave that has @slave's permanet address as its current address. | 1033 | * a slave that has @slave's permanet address as its current address. |
1032 | * We'll make sure that that slave no longer uses @slave's permanent address. | 1034 | * We'll make sure that that slave no longer uses @slave's permanent address. |
1033 | * | 1035 | * |
1034 | * Caller must hold bond lock | 1036 | * Caller must hold RTNL and no other locks |
1035 | */ | 1037 | */ |
1036 | static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) | 1038 | static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) |
1037 | { | 1039 | { |
@@ -1542,7 +1544,12 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave) | |||
1542 | return 0; | 1544 | return 0; |
1543 | } | 1545 | } |
1544 | 1546 | ||
1545 | /* Caller must hold bond lock for write */ | 1547 | /* |
1548 | * Remove slave from tlb and rlb hash tables, and fix up MAC addresses | ||
1549 | * if necessary. | ||
1550 | * | ||
1551 | * Caller must hold RTNL and no other locks | ||
1552 | */ | ||
1546 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) | 1553 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) |
1547 | { | 1554 | { |
1548 | if (bond->slave_cnt > 1) { | 1555 | if (bond->slave_cnt > 1) { |
@@ -1601,9 +1608,6 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave | |||
1601 | struct slave *swap_slave; | 1608 | struct slave *swap_slave; |
1602 | int i; | 1609 | int i; |
1603 | 1610 | ||
1604 | if (new_slave) | ||
1605 | ASSERT_RTNL(); | ||
1606 | |||
1607 | if (bond->curr_active_slave == new_slave) { | 1611 | if (bond->curr_active_slave == new_slave) { |
1608 | return; | 1612 | return; |
1609 | } | 1613 | } |
@@ -1649,6 +1653,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave | |||
1649 | write_unlock_bh(&bond->curr_slave_lock); | 1653 | write_unlock_bh(&bond->curr_slave_lock); |
1650 | read_unlock(&bond->lock); | 1654 | read_unlock(&bond->lock); |
1651 | 1655 | ||
1656 | ASSERT_RTNL(); | ||
1657 | |||
1652 | /* curr_active_slave must be set before calling alb_swap_mac_addr */ | 1658 | /* curr_active_slave must be set before calling alb_swap_mac_addr */ |
1653 | if (swap_slave) { | 1659 | if (swap_slave) { |
1654 | /* swap mac address */ | 1660 | /* swap mac address */ |
@@ -1659,12 +1665,11 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave | |||
1659 | bond->alb_info.rlb_enabled); | 1665 | bond->alb_info.rlb_enabled); |
1660 | } | 1666 | } |
1661 | 1667 | ||
1662 | read_lock(&bond->lock); | ||
1663 | |||
1664 | if (swap_slave) { | 1668 | if (swap_slave) { |
1665 | alb_fasten_mac_swap(bond, swap_slave, new_slave); | 1669 | alb_fasten_mac_swap(bond, swap_slave, new_slave); |
1670 | read_lock(&bond->lock); | ||
1666 | } else { | 1671 | } else { |
1667 | /* fasten bond mac on new current slave */ | 1672 | read_lock(&bond->lock); |
1668 | alb_send_learning_packets(new_slave, bond->dev->dev_addr); | 1673 | alb_send_learning_packets(new_slave, bond->dev->dev_addr); |
1669 | } | 1674 | } |
1670 | 1675 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 423298c84a1d..49a198206e3d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/ethtool.h> | 74 | #include <linux/ethtool.h> |
75 | #include <linux/if_vlan.h> | 75 | #include <linux/if_vlan.h> |
76 | #include <linux/if_bonding.h> | 76 | #include <linux/if_bonding.h> |
77 | #include <linux/jiffies.h> | ||
77 | #include <net/route.h> | 78 | #include <net/route.h> |
78 | #include <net/net_namespace.h> | 79 | #include <net/net_namespace.h> |
79 | #include "bonding.h" | 80 | #include "bonding.h" |
@@ -174,6 +175,7 @@ struct bond_parm_tbl bond_mode_tbl[] = { | |||
174 | struct bond_parm_tbl xmit_hashtype_tbl[] = { | 175 | struct bond_parm_tbl xmit_hashtype_tbl[] = { |
175 | { "layer2", BOND_XMIT_POLICY_LAYER2}, | 176 | { "layer2", BOND_XMIT_POLICY_LAYER2}, |
176 | { "layer3+4", BOND_XMIT_POLICY_LAYER34}, | 177 | { "layer3+4", BOND_XMIT_POLICY_LAYER34}, |
178 | { "layer2+3", BOND_XMIT_POLICY_LAYER23}, | ||
177 | { NULL, -1}, | 179 | { NULL, -1}, |
178 | }; | 180 | }; |
179 | 181 | ||
@@ -1744,7 +1746,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1744 | * has been cleared (if our_slave == old_current), | 1746 | * has been cleared (if our_slave == old_current), |
1745 | * but before a new active slave is selected. | 1747 | * but before a new active slave is selected. |
1746 | */ | 1748 | */ |
1749 | write_unlock_bh(&bond->lock); | ||
1747 | bond_alb_deinit_slave(bond, slave); | 1750 | bond_alb_deinit_slave(bond, slave); |
1751 | write_lock_bh(&bond->lock); | ||
1748 | } | 1752 | } |
1749 | 1753 | ||
1750 | if (oldcurrent == slave) { | 1754 | if (oldcurrent == slave) { |
@@ -1903,6 +1907,12 @@ static int bond_release_all(struct net_device *bond_dev) | |||
1903 | slave_dev = slave->dev; | 1907 | slave_dev = slave->dev; |
1904 | bond_detach_slave(bond, slave); | 1908 | bond_detach_slave(bond, slave); |
1905 | 1909 | ||
1910 | /* now that the slave is detached, unlock and perform | ||
1911 | * all the undo steps that should not be called from | ||
1912 | * within a lock. | ||
1913 | */ | ||
1914 | write_unlock_bh(&bond->lock); | ||
1915 | |||
1906 | if ((bond->params.mode == BOND_MODE_TLB) || | 1916 | if ((bond->params.mode == BOND_MODE_TLB) || |
1907 | (bond->params.mode == BOND_MODE_ALB)) { | 1917 | (bond->params.mode == BOND_MODE_ALB)) { |
1908 | /* must be called only after the slave | 1918 | /* must be called only after the slave |
@@ -1913,12 +1923,6 @@ static int bond_release_all(struct net_device *bond_dev) | |||
1913 | 1923 | ||
1914 | bond_compute_features(bond); | 1924 | bond_compute_features(bond); |
1915 | 1925 | ||
1916 | /* now that the slave is detached, unlock and perform | ||
1917 | * all the undo steps that should not be called from | ||
1918 | * within a lock. | ||
1919 | */ | ||
1920 | write_unlock_bh(&bond->lock); | ||
1921 | |||
1922 | bond_destroy_slave_symlinks(bond_dev, slave_dev); | 1926 | bond_destroy_slave_symlinks(bond_dev, slave_dev); |
1923 | bond_del_vlans_from_slave(bond, slave_dev); | 1927 | bond_del_vlans_from_slave(bond, slave_dev); |
1924 | 1928 | ||
@@ -2382,7 +2386,9 @@ void bond_mii_monitor(struct work_struct *work) | |||
2382 | rtnl_lock(); | 2386 | rtnl_lock(); |
2383 | read_lock(&bond->lock); | 2387 | read_lock(&bond->lock); |
2384 | __bond_mii_monitor(bond, 1); | 2388 | __bond_mii_monitor(bond, 1); |
2385 | rtnl_unlock(); | 2389 | read_unlock(&bond->lock); |
2390 | rtnl_unlock(); /* might sleep, hold no other locks */ | ||
2391 | read_lock(&bond->lock); | ||
2386 | } | 2392 | } |
2387 | 2393 | ||
2388 | delay = ((bond->params.miimon * HZ) / 1000) ? : 1; | 2394 | delay = ((bond->params.miimon * HZ) / 1000) ? : 1; |
@@ -2722,8 +2728,8 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2722 | */ | 2728 | */ |
2723 | bond_for_each_slave(bond, slave, i) { | 2729 | bond_for_each_slave(bond, slave, i) { |
2724 | if (slave->link != BOND_LINK_UP) { | 2730 | if (slave->link != BOND_LINK_UP) { |
2725 | if (((jiffies - slave->dev->trans_start) <= delta_in_ticks) && | 2731 | if (time_before_eq(jiffies, slave->dev->trans_start + delta_in_ticks) && |
2726 | ((jiffies - slave->dev->last_rx) <= delta_in_ticks)) { | 2732 | time_before_eq(jiffies, slave->dev->last_rx + delta_in_ticks)) { |
2727 | 2733 | ||
2728 | slave->link = BOND_LINK_UP; | 2734 | slave->link = BOND_LINK_UP; |
2729 | slave->state = BOND_STATE_ACTIVE; | 2735 | slave->state = BOND_STATE_ACTIVE; |
@@ -2754,8 +2760,8 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2754 | * when the source ip is 0, so don't take the link down | 2760 | * when the source ip is 0, so don't take the link down |
2755 | * if we don't know our ip yet | 2761 | * if we don't know our ip yet |
2756 | */ | 2762 | */ |
2757 | if (((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || | 2763 | if (time_after_eq(jiffies, slave->dev->trans_start + 2*delta_in_ticks) || |
2758 | (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) && | 2764 | (time_after_eq(jiffies, slave->dev->last_rx + 2*delta_in_ticks) && |
2759 | bond_has_ip(bond))) { | 2765 | bond_has_ip(bond))) { |
2760 | 2766 | ||
2761 | slave->link = BOND_LINK_DOWN; | 2767 | slave->link = BOND_LINK_DOWN; |
@@ -2848,8 +2854,8 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2848 | */ | 2854 | */ |
2849 | bond_for_each_slave(bond, slave, i) { | 2855 | bond_for_each_slave(bond, slave, i) { |
2850 | if (slave->link != BOND_LINK_UP) { | 2856 | if (slave->link != BOND_LINK_UP) { |
2851 | if ((jiffies - slave_last_rx(bond, slave)) <= | 2857 | if (time_before_eq(jiffies, |
2852 | delta_in_ticks) { | 2858 | slave_last_rx(bond, slave) + delta_in_ticks)) { |
2853 | 2859 | ||
2854 | slave->link = BOND_LINK_UP; | 2860 | slave->link = BOND_LINK_UP; |
2855 | 2861 | ||
@@ -2858,7 +2864,7 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2858 | write_lock_bh(&bond->curr_slave_lock); | 2864 | write_lock_bh(&bond->curr_slave_lock); |
2859 | 2865 | ||
2860 | if ((!bond->curr_active_slave) && | 2866 | if ((!bond->curr_active_slave) && |
2861 | ((jiffies - slave->dev->trans_start) <= delta_in_ticks)) { | 2867 | time_before_eq(jiffies, slave->dev->trans_start + delta_in_ticks)) { |
2862 | bond_change_active_slave(bond, slave); | 2868 | bond_change_active_slave(bond, slave); |
2863 | bond->current_arp_slave = NULL; | 2869 | bond->current_arp_slave = NULL; |
2864 | } else if (bond->curr_active_slave != slave) { | 2870 | } else if (bond->curr_active_slave != slave) { |
@@ -2897,7 +2903,7 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2897 | 2903 | ||
2898 | if ((slave != bond->curr_active_slave) && | 2904 | if ((slave != bond->curr_active_slave) && |
2899 | (!bond->current_arp_slave) && | 2905 | (!bond->current_arp_slave) && |
2900 | (((jiffies - slave_last_rx(bond, slave)) >= 3*delta_in_ticks) && | 2906 | (time_after_eq(jiffies, slave_last_rx(bond, slave) + 3*delta_in_ticks) && |
2901 | bond_has_ip(bond))) { | 2907 | bond_has_ip(bond))) { |
2902 | /* a backup slave has gone down; three times | 2908 | /* a backup slave has gone down; three times |
2903 | * the delta allows the current slave to be | 2909 | * the delta allows the current slave to be |
@@ -2943,10 +2949,10 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2943 | * before being taken out. if a primary is being used, check | 2949 | * before being taken out. if a primary is being used, check |
2944 | * if it is up and needs to take over as the curr_active_slave | 2950 | * if it is up and needs to take over as the curr_active_slave |
2945 | */ | 2951 | */ |
2946 | if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || | 2952 | if ((time_after_eq(jiffies, slave->dev->trans_start + 2*delta_in_ticks) || |
2947 | (((jiffies - slave_last_rx(bond, slave)) >= (2*delta_in_ticks)) && | 2953 | (time_after_eq(jiffies, slave_last_rx(bond, slave) + 2*delta_in_ticks) && |
2948 | bond_has_ip(bond))) && | 2954 | bond_has_ip(bond))) && |
2949 | ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) { | 2955 | time_after_eq(jiffies, slave->jiffies + 2*delta_in_ticks)) { |
2950 | 2956 | ||
2951 | slave->link = BOND_LINK_DOWN; | 2957 | slave->link = BOND_LINK_DOWN; |
2952 | 2958 | ||
@@ -3397,9 +3403,7 @@ static int bond_master_netdev_event(unsigned long event, struct net_device *bond | |||
3397 | case NETDEV_CHANGENAME: | 3403 | case NETDEV_CHANGENAME: |
3398 | return bond_event_changename(event_bond); | 3404 | return bond_event_changename(event_bond); |
3399 | case NETDEV_UNREGISTER: | 3405 | case NETDEV_UNREGISTER: |
3400 | /* | 3406 | bond_release_all(event_bond->dev); |
3401 | * TODO: remove a bond from the list? | ||
3402 | */ | ||
3403 | break; | 3407 | break; |
3404 | default: | 3408 | default: |
3405 | break; | 3409 | break; |
@@ -3604,6 +3608,24 @@ void bond_unregister_arp(struct bonding *bond) | |||
3604 | /*---------------------------- Hashing Policies -----------------------------*/ | 3608 | /*---------------------------- Hashing Policies -----------------------------*/ |
3605 | 3609 | ||
3606 | /* | 3610 | /* |
3611 | * Hash for the output device based upon layer 2 and layer 3 data. If | ||
3612 | * the packet is not IP mimic bond_xmit_hash_policy_l2() | ||
3613 | */ | ||
3614 | static int bond_xmit_hash_policy_l23(struct sk_buff *skb, | ||
3615 | struct net_device *bond_dev, int count) | ||
3616 | { | ||
3617 | struct ethhdr *data = (struct ethhdr *)skb->data; | ||
3618 | struct iphdr *iph = ip_hdr(skb); | ||
3619 | |||
3620 | if (skb->protocol == __constant_htons(ETH_P_IP)) { | ||
3621 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ | ||
3622 | (data->h_dest[5] ^ bond_dev->dev_addr[5])) % count; | ||
3623 | } | ||
3624 | |||
3625 | return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; | ||
3626 | } | ||
3627 | |||
3628 | /* | ||
3607 | * Hash for the output device based upon layer 3 and layer 4 data. If | 3629 | * Hash for the output device based upon layer 3 and layer 4 data. If |
3608 | * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is | 3630 | * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is |
3609 | * altogether not IP, mimic bond_xmit_hash_policy_l2() | 3631 | * altogether not IP, mimic bond_xmit_hash_policy_l2() |
@@ -4305,6 +4327,22 @@ out: | |||
4305 | 4327 | ||
4306 | /*------------------------- Device initialization ---------------------------*/ | 4328 | /*------------------------- Device initialization ---------------------------*/ |
4307 | 4329 | ||
4330 | static void bond_set_xmit_hash_policy(struct bonding *bond) | ||
4331 | { | ||
4332 | switch (bond->params.xmit_policy) { | ||
4333 | case BOND_XMIT_POLICY_LAYER23: | ||
4334 | bond->xmit_hash_policy = bond_xmit_hash_policy_l23; | ||
4335 | break; | ||
4336 | case BOND_XMIT_POLICY_LAYER34: | ||
4337 | bond->xmit_hash_policy = bond_xmit_hash_policy_l34; | ||
4338 | break; | ||
4339 | case BOND_XMIT_POLICY_LAYER2: | ||
4340 | default: | ||
4341 | bond->xmit_hash_policy = bond_xmit_hash_policy_l2; | ||
4342 | break; | ||
4343 | } | ||
4344 | } | ||
4345 | |||
4308 | /* | 4346 | /* |
4309 | * set bond mode specific net device operations | 4347 | * set bond mode specific net device operations |
4310 | */ | 4348 | */ |
@@ -4321,10 +4359,7 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4321 | break; | 4359 | break; |
4322 | case BOND_MODE_XOR: | 4360 | case BOND_MODE_XOR: |
4323 | bond_dev->hard_start_xmit = bond_xmit_xor; | 4361 | bond_dev->hard_start_xmit = bond_xmit_xor; |
4324 | if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) | 4362 | bond_set_xmit_hash_policy(bond); |
4325 | bond->xmit_hash_policy = bond_xmit_hash_policy_l34; | ||
4326 | else | ||
4327 | bond->xmit_hash_policy = bond_xmit_hash_policy_l2; | ||
4328 | break; | 4363 | break; |
4329 | case BOND_MODE_BROADCAST: | 4364 | case BOND_MODE_BROADCAST: |
4330 | bond_dev->hard_start_xmit = bond_xmit_broadcast; | 4365 | bond_dev->hard_start_xmit = bond_xmit_broadcast; |
@@ -4332,10 +4367,7 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4332 | case BOND_MODE_8023AD: | 4367 | case BOND_MODE_8023AD: |
4333 | bond_set_master_3ad_flags(bond); | 4368 | bond_set_master_3ad_flags(bond); |
4334 | bond_dev->hard_start_xmit = bond_3ad_xmit_xor; | 4369 | bond_dev->hard_start_xmit = bond_3ad_xmit_xor; |
4335 | if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) | 4370 | bond_set_xmit_hash_policy(bond); |
4336 | bond->xmit_hash_policy = bond_xmit_hash_policy_l34; | ||
4337 | else | ||
4338 | bond->xmit_hash_policy = bond_xmit_hash_policy_l2; | ||
4339 | break; | 4371 | break; |
4340 | case BOND_MODE_ALB: | 4372 | case BOND_MODE_ALB: |
4341 | bond_set_master_alb_flags(bond); | 4373 | bond_set_master_alb_flags(bond); |
@@ -4462,6 +4494,27 @@ static void bond_deinit(struct net_device *bond_dev) | |||
4462 | #endif | 4494 | #endif |
4463 | } | 4495 | } |
4464 | 4496 | ||
4497 | static void bond_work_cancel_all(struct bonding *bond) | ||
4498 | { | ||
4499 | write_lock_bh(&bond->lock); | ||
4500 | bond->kill_timers = 1; | ||
4501 | write_unlock_bh(&bond->lock); | ||
4502 | |||
4503 | if (bond->params.miimon && delayed_work_pending(&bond->mii_work)) | ||
4504 | cancel_delayed_work(&bond->mii_work); | ||
4505 | |||
4506 | if (bond->params.arp_interval && delayed_work_pending(&bond->arp_work)) | ||
4507 | cancel_delayed_work(&bond->arp_work); | ||
4508 | |||
4509 | if (bond->params.mode == BOND_MODE_ALB && | ||
4510 | delayed_work_pending(&bond->alb_work)) | ||
4511 | cancel_delayed_work(&bond->alb_work); | ||
4512 | |||
4513 | if (bond->params.mode == BOND_MODE_8023AD && | ||
4514 | delayed_work_pending(&bond->ad_work)) | ||
4515 | cancel_delayed_work(&bond->ad_work); | ||
4516 | } | ||
4517 | |||
4465 | /* Unregister and free all bond devices. | 4518 | /* Unregister and free all bond devices. |
4466 | * Caller must hold rtnl_lock. | 4519 | * Caller must hold rtnl_lock. |
4467 | */ | 4520 | */ |
@@ -4472,6 +4525,7 @@ static void bond_free_all(void) | |||
4472 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { | 4525 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { |
4473 | struct net_device *bond_dev = bond->dev; | 4526 | struct net_device *bond_dev = bond->dev; |
4474 | 4527 | ||
4528 | bond_work_cancel_all(bond); | ||
4475 | bond_mc_list_destroy(bond); | 4529 | bond_mc_list_destroy(bond); |
4476 | /* Release the bonded slaves */ | 4530 | /* Release the bonded slaves */ |
4477 | bond_release_all(bond_dev); | 4531 | bond_release_all(bond_dev); |
@@ -4488,19 +4542,27 @@ static void bond_free_all(void) | |||
4488 | 4542 | ||
4489 | /* | 4543 | /* |
4490 | * Convert string input module parms. Accept either the | 4544 | * Convert string input module parms. Accept either the |
4491 | * number of the mode or its string name. | 4545 | * number of the mode or its string name. A bit complicated because |
4546 | * some mode names are substrings of other names, and calls from sysfs | ||
4547 | * may have whitespace in the name (trailing newlines, for example). | ||
4492 | */ | 4548 | */ |
4493 | int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl) | 4549 | int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl) |
4494 | { | 4550 | { |
4495 | int i; | 4551 | int mode = -1, i, rv; |
4552 | char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, }; | ||
4553 | |||
4554 | rv = sscanf(buf, "%d", &mode); | ||
4555 | if (!rv) { | ||
4556 | rv = sscanf(buf, "%20s", modestr); | ||
4557 | if (!rv) | ||
4558 | return -1; | ||
4559 | } | ||
4496 | 4560 | ||
4497 | for (i = 0; tbl[i].modename; i++) { | 4561 | for (i = 0; tbl[i].modename; i++) { |
4498 | if ((isdigit(*mode_arg) && | 4562 | if (mode == tbl[i].mode) |
4499 | tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) || | 4563 | return tbl[i].mode; |
4500 | (strncmp(mode_arg, tbl[i].modename, | 4564 | if (strcmp(modestr, tbl[i].modename) == 0) |
4501 | strlen(tbl[i].modename)) == 0)) { | ||
4502 | return tbl[i].mode; | 4565 | return tbl[i].mode; |
4503 | } | ||
4504 | } | 4566 | } |
4505 | 4567 | ||
4506 | return -1; | 4568 | return -1; |
@@ -4814,9 +4876,22 @@ static struct lock_class_key bonding_netdev_xmit_lock_key; | |||
4814 | int bond_create(char *name, struct bond_params *params, struct bonding **newbond) | 4876 | int bond_create(char *name, struct bond_params *params, struct bonding **newbond) |
4815 | { | 4877 | { |
4816 | struct net_device *bond_dev; | 4878 | struct net_device *bond_dev; |
4879 | struct bonding *bond, *nxt; | ||
4817 | int res; | 4880 | int res; |
4818 | 4881 | ||
4819 | rtnl_lock(); | 4882 | rtnl_lock(); |
4883 | down_write(&bonding_rwsem); | ||
4884 | |||
4885 | /* Check to see if the bond already exists. */ | ||
4886 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) | ||
4887 | if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) { | ||
4888 | printk(KERN_ERR DRV_NAME | ||
4889 | ": cannot add bond %s; it already exists\n", | ||
4890 | name); | ||
4891 | res = -EPERM; | ||
4892 | goto out_rtnl; | ||
4893 | } | ||
4894 | |||
4820 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", | 4895 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", |
4821 | ether_setup); | 4896 | ether_setup); |
4822 | if (!bond_dev) { | 4897 | if (!bond_dev) { |
@@ -4855,10 +4930,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond | |||
4855 | 4930 | ||
4856 | netif_carrier_off(bond_dev); | 4931 | netif_carrier_off(bond_dev); |
4857 | 4932 | ||
4933 | up_write(&bonding_rwsem); | ||
4858 | rtnl_unlock(); /* allows sysfs registration of net device */ | 4934 | rtnl_unlock(); /* allows sysfs registration of net device */ |
4859 | res = bond_create_sysfs_entry(bond_dev->priv); | 4935 | res = bond_create_sysfs_entry(bond_dev->priv); |
4860 | if (res < 0) { | 4936 | if (res < 0) { |
4861 | rtnl_lock(); | 4937 | rtnl_lock(); |
4938 | down_write(&bonding_rwsem); | ||
4862 | goto out_bond; | 4939 | goto out_bond; |
4863 | } | 4940 | } |
4864 | 4941 | ||
@@ -4869,31 +4946,11 @@ out_bond: | |||
4869 | out_netdev: | 4946 | out_netdev: |
4870 | free_netdev(bond_dev); | 4947 | free_netdev(bond_dev); |
4871 | out_rtnl: | 4948 | out_rtnl: |
4949 | up_write(&bonding_rwsem); | ||
4872 | rtnl_unlock(); | 4950 | rtnl_unlock(); |
4873 | return res; | 4951 | return res; |
4874 | } | 4952 | } |
4875 | 4953 | ||
4876 | static void bond_work_cancel_all(struct bonding *bond) | ||
4877 | { | ||
4878 | write_lock_bh(&bond->lock); | ||
4879 | bond->kill_timers = 1; | ||
4880 | write_unlock_bh(&bond->lock); | ||
4881 | |||
4882 | if (bond->params.miimon && delayed_work_pending(&bond->mii_work)) | ||
4883 | cancel_delayed_work(&bond->mii_work); | ||
4884 | |||
4885 | if (bond->params.arp_interval && delayed_work_pending(&bond->arp_work)) | ||
4886 | cancel_delayed_work(&bond->arp_work); | ||
4887 | |||
4888 | if (bond->params.mode == BOND_MODE_ALB && | ||
4889 | delayed_work_pending(&bond->alb_work)) | ||
4890 | cancel_delayed_work(&bond->alb_work); | ||
4891 | |||
4892 | if (bond->params.mode == BOND_MODE_8023AD && | ||
4893 | delayed_work_pending(&bond->ad_work)) | ||
4894 | cancel_delayed_work(&bond->ad_work); | ||
4895 | } | ||
4896 | |||
4897 | static int __init bonding_init(void) | 4954 | static int __init bonding_init(void) |
4898 | { | 4955 | { |
4899 | int i; | 4956 | int i; |
@@ -4910,6 +4967,9 @@ static int __init bonding_init(void) | |||
4910 | #ifdef CONFIG_PROC_FS | 4967 | #ifdef CONFIG_PROC_FS |
4911 | bond_create_proc_dir(); | 4968 | bond_create_proc_dir(); |
4912 | #endif | 4969 | #endif |
4970 | |||
4971 | init_rwsem(&bonding_rwsem); | ||
4972 | |||
4913 | for (i = 0; i < max_bonds; i++) { | 4973 | for (i = 0; i < max_bonds; i++) { |
4914 | res = bond_create(NULL, &bonding_defaults, NULL); | 4974 | res = bond_create(NULL, &bonding_defaults, NULL); |
4915 | if (res) | 4975 | if (res) |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index b29330d8e309..90a1f31e8e63 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -74,7 +74,7 @@ struct rw_semaphore bonding_rwsem; | |||
74 | * "show" function for the bond_masters attribute. | 74 | * "show" function for the bond_masters attribute. |
75 | * The class parameter is ignored. | 75 | * The class parameter is ignored. |
76 | */ | 76 | */ |
77 | static ssize_t bonding_show_bonds(struct class *cls, char *buffer) | 77 | static ssize_t bonding_show_bonds(struct class *cls, char *buf) |
78 | { | 78 | { |
79 | int res = 0; | 79 | int res = 0; |
80 | struct bonding *bond; | 80 | struct bonding *bond; |
@@ -86,14 +86,13 @@ static ssize_t bonding_show_bonds(struct class *cls, char *buffer) | |||
86 | /* not enough space for another interface name */ | 86 | /* not enough space for another interface name */ |
87 | if ((PAGE_SIZE - res) > 10) | 87 | if ((PAGE_SIZE - res) > 10) |
88 | res = PAGE_SIZE - 10; | 88 | res = PAGE_SIZE - 10; |
89 | res += sprintf(buffer + res, "++more++"); | 89 | res += sprintf(buf + res, "++more++ "); |
90 | break; | 90 | break; |
91 | } | 91 | } |
92 | res += sprintf(buffer + res, "%s ", | 92 | res += sprintf(buf + res, "%s ", bond->dev->name); |
93 | bond->dev->name); | ||
94 | } | 93 | } |
95 | res += sprintf(buffer + res, "\n"); | 94 | if (res) |
96 | res++; | 95 | buf[res-1] = '\n'; /* eat the leftover space */ |
97 | up_read(&(bonding_rwsem)); | 96 | up_read(&(bonding_rwsem)); |
98 | return res; | 97 | return res; |
99 | } | 98 | } |
@@ -110,11 +109,10 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t | |||
110 | { | 109 | { |
111 | char command[IFNAMSIZ + 1] = {0, }; | 110 | char command[IFNAMSIZ + 1] = {0, }; |
112 | char *ifname; | 111 | char *ifname; |
113 | int res = count; | 112 | int rv, res = count; |
114 | struct bonding *bond; | 113 | struct bonding *bond; |
115 | struct bonding *nxt; | 114 | struct bonding *nxt; |
116 | 115 | ||
117 | down_write(&(bonding_rwsem)); | ||
118 | sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ | 116 | sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ |
119 | ifname = command + 1; | 117 | ifname = command + 1; |
120 | if ((strlen(command) <= 1) || | 118 | if ((strlen(command) <= 1) || |
@@ -122,39 +120,28 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t | |||
122 | goto err_no_cmd; | 120 | goto err_no_cmd; |
123 | 121 | ||
124 | if (command[0] == '+') { | 122 | if (command[0] == '+') { |
125 | |||
126 | /* Check to see if the bond already exists. */ | ||
127 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) | ||
128 | if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { | ||
129 | printk(KERN_ERR DRV_NAME | ||
130 | ": cannot add bond %s; it already exists\n", | ||
131 | ifname); | ||
132 | res = -EPERM; | ||
133 | goto out; | ||
134 | } | ||
135 | |||
136 | printk(KERN_INFO DRV_NAME | 123 | printk(KERN_INFO DRV_NAME |
137 | ": %s is being created...\n", ifname); | 124 | ": %s is being created...\n", ifname); |
138 | if (bond_create(ifname, &bonding_defaults, &bond)) { | 125 | rv = bond_create(ifname, &bonding_defaults, &bond); |
139 | printk(KERN_INFO DRV_NAME | 126 | if (rv) { |
140 | ": %s interface already exists. Bond creation failed.\n", | 127 | printk(KERN_INFO DRV_NAME ": Bond creation failed.\n"); |
141 | ifname); | 128 | res = rv; |
142 | res = -EPERM; | ||
143 | } | 129 | } |
144 | goto out; | 130 | goto out; |
145 | } | 131 | } |
146 | 132 | ||
147 | if (command[0] == '-') { | 133 | if (command[0] == '-') { |
134 | rtnl_lock(); | ||
135 | down_write(&bonding_rwsem); | ||
136 | |||
148 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) | 137 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) |
149 | if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { | 138 | if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { |
150 | rtnl_lock(); | ||
151 | /* check the ref count on the bond's kobject. | 139 | /* check the ref count on the bond's kobject. |
152 | * If it's > expected, then there's a file open, | 140 | * If it's > expected, then there's a file open, |
153 | * and we have to fail. | 141 | * and we have to fail. |
154 | */ | 142 | */ |
155 | if (atomic_read(&bond->dev->dev.kobj.kref.refcount) | 143 | if (atomic_read(&bond->dev->dev.kobj.kref.refcount) |
156 | > expected_refcount){ | 144 | > expected_refcount){ |
157 | rtnl_unlock(); | ||
158 | printk(KERN_INFO DRV_NAME | 145 | printk(KERN_INFO DRV_NAME |
159 | ": Unable remove bond %s due to open references.\n", | 146 | ": Unable remove bond %s due to open references.\n", |
160 | ifname); | 147 | ifname); |
@@ -165,6 +152,7 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t | |||
165 | ": %s is being deleted...\n", | 152 | ": %s is being deleted...\n", |
166 | bond->dev->name); | 153 | bond->dev->name); |
167 | bond_destroy(bond); | 154 | bond_destroy(bond); |
155 | up_write(&bonding_rwsem); | ||
168 | rtnl_unlock(); | 156 | rtnl_unlock(); |
169 | goto out; | 157 | goto out; |
170 | } | 158 | } |
@@ -172,6 +160,8 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t | |||
172 | printk(KERN_ERR DRV_NAME | 160 | printk(KERN_ERR DRV_NAME |
173 | ": unable to delete non-existent bond %s\n", ifname); | 161 | ": unable to delete non-existent bond %s\n", ifname); |
174 | res = -ENODEV; | 162 | res = -ENODEV; |
163 | up_write(&bonding_rwsem); | ||
164 | rtnl_unlock(); | ||
175 | goto out; | 165 | goto out; |
176 | } | 166 | } |
177 | 167 | ||
@@ -184,7 +174,6 @@ err_no_cmd: | |||
184 | * get called forever, which is bad. | 174 | * get called forever, which is bad. |
185 | */ | 175 | */ |
186 | out: | 176 | out: |
187 | up_write(&(bonding_rwsem)); | ||
188 | return res; | 177 | return res; |
189 | } | 178 | } |
190 | /* class attribute for bond_masters file. This ends up in /sys/class/net */ | 179 | /* class attribute for bond_masters file. This ends up in /sys/class/net */ |
@@ -235,14 +224,14 @@ static ssize_t bonding_show_slaves(struct device *d, | |||
235 | /* not enough space for another interface name */ | 224 | /* not enough space for another interface name */ |
236 | if ((PAGE_SIZE - res) > 10) | 225 | if ((PAGE_SIZE - res) > 10) |
237 | res = PAGE_SIZE - 10; | 226 | res = PAGE_SIZE - 10; |
238 | res += sprintf(buf + res, "++more++"); | 227 | res += sprintf(buf + res, "++more++ "); |
239 | break; | 228 | break; |
240 | } | 229 | } |
241 | res += sprintf(buf + res, "%s ", slave->dev->name); | 230 | res += sprintf(buf + res, "%s ", slave->dev->name); |
242 | } | 231 | } |
243 | read_unlock(&bond->lock); | 232 | read_unlock(&bond->lock); |
244 | res += sprintf(buf + res, "\n"); | 233 | if (res) |
245 | res++; | 234 | buf[res-1] = '\n'; /* eat the leftover space */ |
246 | return res; | 235 | return res; |
247 | } | 236 | } |
248 | 237 | ||
@@ -272,6 +261,9 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
272 | 261 | ||
273 | /* Note: We can't hold bond->lock here, as bond_create grabs it. */ | 262 | /* Note: We can't hold bond->lock here, as bond_create grabs it. */ |
274 | 263 | ||
264 | rtnl_lock(); | ||
265 | down_write(&(bonding_rwsem)); | ||
266 | |||
275 | sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ | 267 | sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ |
276 | ifname = command + 1; | 268 | ifname = command + 1; |
277 | if ((strlen(command) <= 1) || | 269 | if ((strlen(command) <= 1) || |
@@ -337,12 +329,10 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
337 | dev->mtu = bond->dev->mtu; | 329 | dev->mtu = bond->dev->mtu; |
338 | } | 330 | } |
339 | } | 331 | } |
340 | rtnl_lock(); | ||
341 | res = bond_enslave(bond->dev, dev); | 332 | res = bond_enslave(bond->dev, dev); |
342 | bond_for_each_slave(bond, slave, i) | 333 | bond_for_each_slave(bond, slave, i) |
343 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) | 334 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) |
344 | slave->original_mtu = original_mtu; | 335 | slave->original_mtu = original_mtu; |
345 | rtnl_unlock(); | ||
346 | if (res) { | 336 | if (res) { |
347 | ret = res; | 337 | ret = res; |
348 | } | 338 | } |
@@ -360,12 +350,10 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
360 | if (dev) { | 350 | if (dev) { |
361 | printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n", | 351 | printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n", |
362 | bond->dev->name, dev->name); | 352 | bond->dev->name, dev->name); |
363 | rtnl_lock(); | ||
364 | if (bond->setup_by_slave) | 353 | if (bond->setup_by_slave) |
365 | res = bond_release_and_destroy(bond->dev, dev); | 354 | res = bond_release_and_destroy(bond->dev, dev); |
366 | else | 355 | else |
367 | res = bond_release(bond->dev, dev); | 356 | res = bond_release(bond->dev, dev); |
368 | rtnl_unlock(); | ||
369 | if (res) { | 357 | if (res) { |
370 | ret = res; | 358 | ret = res; |
371 | goto out; | 359 | goto out; |
@@ -390,6 +378,8 @@ err_no_cmd: | |||
390 | ret = -EPERM; | 378 | ret = -EPERM; |
391 | 379 | ||
392 | out: | 380 | out: |
381 | up_write(&(bonding_rwsem)); | ||
382 | rtnl_unlock(); | ||
393 | return ret; | 383 | return ret; |
394 | } | 384 | } |
395 | 385 | ||
@@ -406,7 +396,7 @@ static ssize_t bonding_show_mode(struct device *d, | |||
406 | 396 | ||
407 | return sprintf(buf, "%s %d\n", | 397 | return sprintf(buf, "%s %d\n", |
408 | bond_mode_tbl[bond->params.mode].modename, | 398 | bond_mode_tbl[bond->params.mode].modename, |
409 | bond->params.mode) + 1; | 399 | bond->params.mode); |
410 | } | 400 | } |
411 | 401 | ||
412 | static ssize_t bonding_store_mode(struct device *d, | 402 | static ssize_t bonding_store_mode(struct device *d, |
@@ -424,7 +414,7 @@ static ssize_t bonding_store_mode(struct device *d, | |||
424 | goto out; | 414 | goto out; |
425 | } | 415 | } |
426 | 416 | ||
427 | new_value = bond_parse_parm((char *)buf, bond_mode_tbl); | 417 | new_value = bond_parse_parm(buf, bond_mode_tbl); |
428 | if (new_value < 0) { | 418 | if (new_value < 0) { |
429 | printk(KERN_ERR DRV_NAME | 419 | printk(KERN_ERR DRV_NAME |
430 | ": %s: Ignoring invalid mode value %.*s.\n", | 420 | ": %s: Ignoring invalid mode value %.*s.\n", |
@@ -457,20 +447,11 @@ static ssize_t bonding_show_xmit_hash(struct device *d, | |||
457 | struct device_attribute *attr, | 447 | struct device_attribute *attr, |
458 | char *buf) | 448 | char *buf) |
459 | { | 449 | { |
460 | int count; | ||
461 | struct bonding *bond = to_bond(d); | 450 | struct bonding *bond = to_bond(d); |
462 | 451 | ||
463 | if ((bond->params.mode != BOND_MODE_XOR) && | 452 | return sprintf(buf, "%s %d\n", |
464 | (bond->params.mode != BOND_MODE_8023AD)) { | 453 | xmit_hashtype_tbl[bond->params.xmit_policy].modename, |
465 | // Not Applicable | 454 | bond->params.xmit_policy); |
466 | count = sprintf(buf, "NA\n") + 1; | ||
467 | } else { | ||
468 | count = sprintf(buf, "%s %d\n", | ||
469 | xmit_hashtype_tbl[bond->params.xmit_policy].modename, | ||
470 | bond->params.xmit_policy) + 1; | ||
471 | } | ||
472 | |||
473 | return count; | ||
474 | } | 455 | } |
475 | 456 | ||
476 | static ssize_t bonding_store_xmit_hash(struct device *d, | 457 | static ssize_t bonding_store_xmit_hash(struct device *d, |
@@ -488,16 +469,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
488 | goto out; | 469 | goto out; |
489 | } | 470 | } |
490 | 471 | ||
491 | if ((bond->params.mode != BOND_MODE_XOR) && | 472 | new_value = bond_parse_parm(buf, xmit_hashtype_tbl); |
492 | (bond->params.mode != BOND_MODE_8023AD)) { | ||
493 | printk(KERN_ERR DRV_NAME | ||
494 | "%s: Transmit hash policy is irrelevant in this mode.\n", | ||
495 | bond->dev->name); | ||
496 | ret = -EPERM; | ||
497 | goto out; | ||
498 | } | ||
499 | |||
500 | new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl); | ||
501 | if (new_value < 0) { | 473 | if (new_value < 0) { |
502 | printk(KERN_ERR DRV_NAME | 474 | printk(KERN_ERR DRV_NAME |
503 | ": %s: Ignoring invalid xmit hash policy value %.*s.\n", | 475 | ": %s: Ignoring invalid xmit hash policy value %.*s.\n", |
@@ -527,7 +499,7 @@ static ssize_t bonding_show_arp_validate(struct device *d, | |||
527 | 499 | ||
528 | return sprintf(buf, "%s %d\n", | 500 | return sprintf(buf, "%s %d\n", |
529 | arp_validate_tbl[bond->params.arp_validate].modename, | 501 | arp_validate_tbl[bond->params.arp_validate].modename, |
530 | bond->params.arp_validate) + 1; | 502 | bond->params.arp_validate); |
531 | } | 503 | } |
532 | 504 | ||
533 | static ssize_t bonding_store_arp_validate(struct device *d, | 505 | static ssize_t bonding_store_arp_validate(struct device *d, |
@@ -537,7 +509,7 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
537 | int new_value; | 509 | int new_value; |
538 | struct bonding *bond = to_bond(d); | 510 | struct bonding *bond = to_bond(d); |
539 | 511 | ||
540 | new_value = bond_parse_parm((char *)buf, arp_validate_tbl); | 512 | new_value = bond_parse_parm(buf, arp_validate_tbl); |
541 | if (new_value < 0) { | 513 | if (new_value < 0) { |
542 | printk(KERN_ERR DRV_NAME | 514 | printk(KERN_ERR DRV_NAME |
543 | ": %s: Ignoring invalid arp_validate value %s\n", | 515 | ": %s: Ignoring invalid arp_validate value %s\n", |
@@ -627,7 +599,7 @@ static ssize_t bonding_show_arp_interval(struct device *d, | |||
627 | { | 599 | { |
628 | struct bonding *bond = to_bond(d); | 600 | struct bonding *bond = to_bond(d); |
629 | 601 | ||
630 | return sprintf(buf, "%d\n", bond->params.arp_interval) + 1; | 602 | return sprintf(buf, "%d\n", bond->params.arp_interval); |
631 | } | 603 | } |
632 | 604 | ||
633 | static ssize_t bonding_store_arp_interval(struct device *d, | 605 | static ssize_t bonding_store_arp_interval(struct device *d, |
@@ -712,9 +684,7 @@ static ssize_t bonding_show_arp_targets(struct device *d, | |||
712 | NIPQUAD(bond->params.arp_targets[i])); | 684 | NIPQUAD(bond->params.arp_targets[i])); |
713 | } | 685 | } |
714 | if (res) | 686 | if (res) |
715 | res--; /* eat the leftover space */ | 687 | buf[res-1] = '\n'; /* eat the leftover space */ |
716 | res += sprintf(buf + res, "\n"); | ||
717 | res++; | ||
718 | return res; | 688 | return res; |
719 | } | 689 | } |
720 | 690 | ||
@@ -815,7 +785,7 @@ static ssize_t bonding_show_downdelay(struct device *d, | |||
815 | { | 785 | { |
816 | struct bonding *bond = to_bond(d); | 786 | struct bonding *bond = to_bond(d); |
817 | 787 | ||
818 | return sprintf(buf, "%d\n", bond->params.downdelay * bond->params.miimon) + 1; | 788 | return sprintf(buf, "%d\n", bond->params.downdelay * bond->params.miimon); |
819 | } | 789 | } |
820 | 790 | ||
821 | static ssize_t bonding_store_downdelay(struct device *d, | 791 | static ssize_t bonding_store_downdelay(struct device *d, |
@@ -872,7 +842,7 @@ static ssize_t bonding_show_updelay(struct device *d, | |||
872 | { | 842 | { |
873 | struct bonding *bond = to_bond(d); | 843 | struct bonding *bond = to_bond(d); |
874 | 844 | ||
875 | return sprintf(buf, "%d\n", bond->params.updelay * bond->params.miimon) + 1; | 845 | return sprintf(buf, "%d\n", bond->params.updelay * bond->params.miimon); |
876 | 846 | ||
877 | } | 847 | } |
878 | 848 | ||
@@ -936,7 +906,7 @@ static ssize_t bonding_show_lacp(struct device *d, | |||
936 | 906 | ||
937 | return sprintf(buf, "%s %d\n", | 907 | return sprintf(buf, "%s %d\n", |
938 | bond_lacp_tbl[bond->params.lacp_fast].modename, | 908 | bond_lacp_tbl[bond->params.lacp_fast].modename, |
939 | bond->params.lacp_fast) + 1; | 909 | bond->params.lacp_fast); |
940 | } | 910 | } |
941 | 911 | ||
942 | static ssize_t bonding_store_lacp(struct device *d, | 912 | static ssize_t bonding_store_lacp(struct device *d, |
@@ -962,7 +932,7 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
962 | goto out; | 932 | goto out; |
963 | } | 933 | } |
964 | 934 | ||
965 | new_value = bond_parse_parm((char *)buf, bond_lacp_tbl); | 935 | new_value = bond_parse_parm(buf, bond_lacp_tbl); |
966 | 936 | ||
967 | if ((new_value == 1) || (new_value == 0)) { | 937 | if ((new_value == 1) || (new_value == 0)) { |
968 | bond->params.lacp_fast = new_value; | 938 | bond->params.lacp_fast = new_value; |
@@ -992,7 +962,7 @@ static ssize_t bonding_show_miimon(struct device *d, | |||
992 | { | 962 | { |
993 | struct bonding *bond = to_bond(d); | 963 | struct bonding *bond = to_bond(d); |
994 | 964 | ||
995 | return sprintf(buf, "%d\n", bond->params.miimon) + 1; | 965 | return sprintf(buf, "%d\n", bond->params.miimon); |
996 | } | 966 | } |
997 | 967 | ||
998 | static ssize_t bonding_store_miimon(struct device *d, | 968 | static ssize_t bonding_store_miimon(struct device *d, |
@@ -1083,9 +1053,7 @@ static ssize_t bonding_show_primary(struct device *d, | |||
1083 | struct bonding *bond = to_bond(d); | 1053 | struct bonding *bond = to_bond(d); |
1084 | 1054 | ||
1085 | if (bond->primary_slave) | 1055 | if (bond->primary_slave) |
1086 | count = sprintf(buf, "%s\n", bond->primary_slave->dev->name) + 1; | 1056 | count = sprintf(buf, "%s\n", bond->primary_slave->dev->name); |
1087 | else | ||
1088 | count = sprintf(buf, "\n") + 1; | ||
1089 | 1057 | ||
1090 | return count; | 1058 | return count; |
1091 | } | 1059 | } |
@@ -1098,7 +1066,10 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1098 | struct slave *slave; | 1066 | struct slave *slave; |
1099 | struct bonding *bond = to_bond(d); | 1067 | struct bonding *bond = to_bond(d); |
1100 | 1068 | ||
1101 | write_lock_bh(&bond->lock); | 1069 | rtnl_lock(); |
1070 | read_lock(&bond->lock); | ||
1071 | write_lock_bh(&bond->curr_slave_lock); | ||
1072 | |||
1102 | if (!USES_PRIMARY(bond->params.mode)) { | 1073 | if (!USES_PRIMARY(bond->params.mode)) { |
1103 | printk(KERN_INFO DRV_NAME | 1074 | printk(KERN_INFO DRV_NAME |
1104 | ": %s: Unable to set primary slave; %s is in mode %d\n", | 1075 | ": %s: Unable to set primary slave; %s is in mode %d\n", |
@@ -1132,8 +1103,8 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1132 | } | 1103 | } |
1133 | } | 1104 | } |
1134 | out: | 1105 | out: |
1135 | write_unlock_bh(&bond->lock); | 1106 | write_unlock_bh(&bond->curr_slave_lock); |
1136 | 1107 | read_unlock(&bond->lock); | |
1137 | rtnl_unlock(); | 1108 | rtnl_unlock(); |
1138 | 1109 | ||
1139 | return count; | 1110 | return count; |
@@ -1149,7 +1120,7 @@ static ssize_t bonding_show_carrier(struct device *d, | |||
1149 | { | 1120 | { |
1150 | struct bonding *bond = to_bond(d); | 1121 | struct bonding *bond = to_bond(d); |
1151 | 1122 | ||
1152 | return sprintf(buf, "%d\n", bond->params.use_carrier) + 1; | 1123 | return sprintf(buf, "%d\n", bond->params.use_carrier); |
1153 | } | 1124 | } |
1154 | 1125 | ||
1155 | static ssize_t bonding_store_carrier(struct device *d, | 1126 | static ssize_t bonding_store_carrier(struct device *d, |
@@ -1191,16 +1162,14 @@ static ssize_t bonding_show_active_slave(struct device *d, | |||
1191 | { | 1162 | { |
1192 | struct slave *curr; | 1163 | struct slave *curr; |
1193 | struct bonding *bond = to_bond(d); | 1164 | struct bonding *bond = to_bond(d); |
1194 | int count; | 1165 | int count = 0; |
1195 | 1166 | ||
1196 | read_lock(&bond->curr_slave_lock); | 1167 | read_lock(&bond->curr_slave_lock); |
1197 | curr = bond->curr_active_slave; | 1168 | curr = bond->curr_active_slave; |
1198 | read_unlock(&bond->curr_slave_lock); | 1169 | read_unlock(&bond->curr_slave_lock); |
1199 | 1170 | ||
1200 | if (USES_PRIMARY(bond->params.mode) && curr) | 1171 | if (USES_PRIMARY(bond->params.mode) && curr) |
1201 | count = sprintf(buf, "%s\n", curr->dev->name) + 1; | 1172 | count = sprintf(buf, "%s\n", curr->dev->name); |
1202 | else | ||
1203 | count = sprintf(buf, "\n") + 1; | ||
1204 | return count; | 1173 | return count; |
1205 | } | 1174 | } |
1206 | 1175 | ||
@@ -1215,7 +1184,8 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1215 | struct bonding *bond = to_bond(d); | 1184 | struct bonding *bond = to_bond(d); |
1216 | 1185 | ||
1217 | rtnl_lock(); | 1186 | rtnl_lock(); |
1218 | write_lock_bh(&bond->lock); | 1187 | read_lock(&bond->lock); |
1188 | write_lock_bh(&bond->curr_slave_lock); | ||
1219 | 1189 | ||
1220 | if (!USES_PRIMARY(bond->params.mode)) { | 1190 | if (!USES_PRIMARY(bond->params.mode)) { |
1221 | printk(KERN_INFO DRV_NAME | 1191 | printk(KERN_INFO DRV_NAME |
@@ -1272,7 +1242,8 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1272 | } | 1242 | } |
1273 | } | 1243 | } |
1274 | out: | 1244 | out: |
1275 | write_unlock_bh(&bond->lock); | 1245 | write_unlock_bh(&bond->curr_slave_lock); |
1246 | read_unlock(&bond->lock); | ||
1276 | rtnl_unlock(); | 1247 | rtnl_unlock(); |
1277 | 1248 | ||
1278 | return count; | 1249 | return count; |
@@ -1295,7 +1266,7 @@ static ssize_t bonding_show_mii_status(struct device *d, | |||
1295 | curr = bond->curr_active_slave; | 1266 | curr = bond->curr_active_slave; |
1296 | read_unlock(&bond->curr_slave_lock); | 1267 | read_unlock(&bond->curr_slave_lock); |
1297 | 1268 | ||
1298 | return sprintf(buf, "%s\n", (curr) ? "up" : "down") + 1; | 1269 | return sprintf(buf, "%s\n", (curr) ? "up" : "down"); |
1299 | } | 1270 | } |
1300 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); | 1271 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); |
1301 | 1272 | ||
@@ -1312,10 +1283,8 @@ static ssize_t bonding_show_ad_aggregator(struct device *d, | |||
1312 | 1283 | ||
1313 | if (bond->params.mode == BOND_MODE_8023AD) { | 1284 | if (bond->params.mode == BOND_MODE_8023AD) { |
1314 | struct ad_info ad_info; | 1285 | struct ad_info ad_info; |
1315 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.aggregator_id) + 1; | 1286 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.aggregator_id); |
1316 | } | 1287 | } |
1317 | else | ||
1318 | count = sprintf(buf, "\n") + 1; | ||
1319 | 1288 | ||
1320 | return count; | 1289 | return count; |
1321 | } | 1290 | } |
@@ -1334,10 +1303,8 @@ static ssize_t bonding_show_ad_num_ports(struct device *d, | |||
1334 | 1303 | ||
1335 | if (bond->params.mode == BOND_MODE_8023AD) { | 1304 | if (bond->params.mode == BOND_MODE_8023AD) { |
1336 | struct ad_info ad_info; | 1305 | struct ad_info ad_info; |
1337 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0: ad_info.ports) + 1; | 1306 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0: ad_info.ports); |
1338 | } | 1307 | } |
1339 | else | ||
1340 | count = sprintf(buf, "\n") + 1; | ||
1341 | 1308 | ||
1342 | return count; | 1309 | return count; |
1343 | } | 1310 | } |
@@ -1356,10 +1323,8 @@ static ssize_t bonding_show_ad_actor_key(struct device *d, | |||
1356 | 1323 | ||
1357 | if (bond->params.mode == BOND_MODE_8023AD) { | 1324 | if (bond->params.mode == BOND_MODE_8023AD) { |
1358 | struct ad_info ad_info; | 1325 | struct ad_info ad_info; |
1359 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.actor_key) + 1; | 1326 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.actor_key); |
1360 | } | 1327 | } |
1361 | else | ||
1362 | count = sprintf(buf, "\n") + 1; | ||
1363 | 1328 | ||
1364 | return count; | 1329 | return count; |
1365 | } | 1330 | } |
@@ -1378,10 +1343,8 @@ static ssize_t bonding_show_ad_partner_key(struct device *d, | |||
1378 | 1343 | ||
1379 | if (bond->params.mode == BOND_MODE_8023AD) { | 1344 | if (bond->params.mode == BOND_MODE_8023AD) { |
1380 | struct ad_info ad_info; | 1345 | struct ad_info ad_info; |
1381 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.partner_key) + 1; | 1346 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.partner_key); |
1382 | } | 1347 | } |
1383 | else | ||
1384 | count = sprintf(buf, "\n") + 1; | ||
1385 | 1348 | ||
1386 | return count; | 1349 | return count; |
1387 | } | 1350 | } |
@@ -1403,12 +1366,9 @@ static ssize_t bonding_show_ad_partner_mac(struct device *d, | |||
1403 | struct ad_info ad_info; | 1366 | struct ad_info ad_info; |
1404 | if (!bond_3ad_get_active_agg_info(bond, &ad_info)) { | 1367 | if (!bond_3ad_get_active_agg_info(bond, &ad_info)) { |
1405 | count = sprintf(buf,"%s\n", | 1368 | count = sprintf(buf,"%s\n", |
1406 | print_mac(mac, ad_info.partner_system)) | 1369 | print_mac(mac, ad_info.partner_system)); |
1407 | + 1; | ||
1408 | } | 1370 | } |
1409 | } | 1371 | } |
1410 | else | ||
1411 | count = sprintf(buf, "\n") + 1; | ||
1412 | 1372 | ||
1413 | return count; | 1373 | return count; |
1414 | } | 1374 | } |
@@ -1454,8 +1414,6 @@ int bond_create_sysfs(void) | |||
1454 | int ret = 0; | 1414 | int ret = 0; |
1455 | struct bonding *firstbond; | 1415 | struct bonding *firstbond; |
1456 | 1416 | ||
1457 | init_rwsem(&bonding_rwsem); | ||
1458 | |||
1459 | /* get the netdev class pointer */ | 1417 | /* get the netdev class pointer */ |
1460 | firstbond = container_of(bond_dev_list.next, struct bonding, bond_list); | 1418 | firstbond = container_of(bond_dev_list.next, struct bonding, bond_list); |
1461 | if (!firstbond) | 1419 | if (!firstbond) |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 61c1b4536d34..6d83be49899a 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #include "bond_3ad.h" | 22 | #include "bond_3ad.h" |
23 | #include "bond_alb.h" | 23 | #include "bond_alb.h" |
24 | 24 | ||
25 | #define DRV_VERSION "3.2.1" | 25 | #define DRV_VERSION "3.2.3" |
26 | #define DRV_RELDATE "October 15, 2007" | 26 | #define DRV_RELDATE "December 6, 2007" |
27 | #define DRV_NAME "bonding" | 27 | #define DRV_NAME "bonding" |
28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | 28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" |
29 | 29 | ||
@@ -141,6 +141,8 @@ struct bond_parm_tbl { | |||
141 | int mode; | 141 | int mode; |
142 | }; | 142 | }; |
143 | 143 | ||
144 | #define BOND_MAX_MODENAME_LEN 20 | ||
145 | |||
144 | struct vlan_entry { | 146 | struct vlan_entry { |
145 | struct list_head vlan_list; | 147 | struct list_head vlan_list; |
146 | __be32 vlan_ip; | 148 | __be32 vlan_ip; |
@@ -314,7 +316,7 @@ void bond_mii_monitor(struct work_struct *); | |||
314 | void bond_loadbalance_arp_mon(struct work_struct *); | 316 | void bond_loadbalance_arp_mon(struct work_struct *); |
315 | void bond_activebackup_arp_mon(struct work_struct *); | 317 | void bond_activebackup_arp_mon(struct work_struct *); |
316 | void bond_set_mode_ops(struct bonding *bond, int mode); | 318 | void bond_set_mode_ops(struct bonding *bond, int mode); |
317 | int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl); | 319 | int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl); |
318 | void bond_select_active_slave(struct bonding *bond); | 320 | void bond_select_active_slave(struct bonding *bond); |
319 | void bond_change_active_slave(struct bonding *bond, struct slave *new_active); | 321 | void bond_change_active_slave(struct bonding *bond, struct slave *new_active); |
320 | void bond_register_arp(struct bonding *); | 322 | void bond_register_arp(struct bonding *); |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 7df31b5561cc..d66915d82b24 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -142,8 +142,8 @@ | |||
142 | 142 | ||
143 | #define DRV_MODULE_NAME "cassini" | 143 | #define DRV_MODULE_NAME "cassini" |
144 | #define PFX DRV_MODULE_NAME ": " | 144 | #define PFX DRV_MODULE_NAME ": " |
145 | #define DRV_MODULE_VERSION "1.4" | 145 | #define DRV_MODULE_VERSION "1.5" |
146 | #define DRV_MODULE_RELDATE "1 July 2004" | 146 | #define DRV_MODULE_RELDATE "4 Jan 2008" |
147 | 147 | ||
148 | #define CAS_DEF_MSG_ENABLE \ | 148 | #define CAS_DEF_MSG_ENABLE \ |
149 | (NETIF_MSG_DRV | \ | 149 | (NETIF_MSG_DRV | \ |
@@ -336,30 +336,6 @@ static inline void cas_mask_intr(struct cas *cp) | |||
336 | cas_disable_irq(cp, i); | 336 | cas_disable_irq(cp, i); |
337 | } | 337 | } |
338 | 338 | ||
339 | static inline void cas_buffer_init(cas_page_t *cp) | ||
340 | { | ||
341 | struct page *page = cp->buffer; | ||
342 | atomic_set((atomic_t *)&page->lru.next, 1); | ||
343 | } | ||
344 | |||
345 | static inline int cas_buffer_count(cas_page_t *cp) | ||
346 | { | ||
347 | struct page *page = cp->buffer; | ||
348 | return atomic_read((atomic_t *)&page->lru.next); | ||
349 | } | ||
350 | |||
351 | static inline void cas_buffer_inc(cas_page_t *cp) | ||
352 | { | ||
353 | struct page *page = cp->buffer; | ||
354 | atomic_inc((atomic_t *)&page->lru.next); | ||
355 | } | ||
356 | |||
357 | static inline void cas_buffer_dec(cas_page_t *cp) | ||
358 | { | ||
359 | struct page *page = cp->buffer; | ||
360 | atomic_dec((atomic_t *)&page->lru.next); | ||
361 | } | ||
362 | |||
363 | static void cas_enable_irq(struct cas *cp, const int ring) | 339 | static void cas_enable_irq(struct cas *cp, const int ring) |
364 | { | 340 | { |
365 | if (ring == 0) { /* all but TX_DONE */ | 341 | if (ring == 0) { /* all but TX_DONE */ |
@@ -497,7 +473,6 @@ static int cas_page_free(struct cas *cp, cas_page_t *page) | |||
497 | { | 473 | { |
498 | pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, | 474 | pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, |
499 | PCI_DMA_FROMDEVICE); | 475 | PCI_DMA_FROMDEVICE); |
500 | cas_buffer_dec(page); | ||
501 | __free_pages(page->buffer, cp->page_order); | 476 | __free_pages(page->buffer, cp->page_order); |
502 | kfree(page); | 477 | kfree(page); |
503 | return 0; | 478 | return 0; |
@@ -527,7 +502,6 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags) | |||
527 | page->buffer = alloc_pages(flags, cp->page_order); | 502 | page->buffer = alloc_pages(flags, cp->page_order); |
528 | if (!page->buffer) | 503 | if (!page->buffer) |
529 | goto page_err; | 504 | goto page_err; |
530 | cas_buffer_init(page); | ||
531 | page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, | 505 | page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, |
532 | cp->page_size, PCI_DMA_FROMDEVICE); | 506 | cp->page_size, PCI_DMA_FROMDEVICE); |
533 | return page; | 507 | return page; |
@@ -606,7 +580,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags) | |||
606 | list_for_each_safe(elem, tmp, &list) { | 580 | list_for_each_safe(elem, tmp, &list) { |
607 | cas_page_t *page = list_entry(elem, cas_page_t, list); | 581 | cas_page_t *page = list_entry(elem, cas_page_t, list); |
608 | 582 | ||
609 | if (cas_buffer_count(page) > 1) | 583 | if (page_count(page->buffer) > 1) |
610 | continue; | 584 | continue; |
611 | 585 | ||
612 | list_del(elem); | 586 | list_del(elem); |
@@ -1374,7 +1348,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index) | |||
1374 | cas_page_t *page = cp->rx_pages[1][index]; | 1348 | cas_page_t *page = cp->rx_pages[1][index]; |
1375 | cas_page_t *new; | 1349 | cas_page_t *new; |
1376 | 1350 | ||
1377 | if (cas_buffer_count(page) == 1) | 1351 | if (page_count(page->buffer) == 1) |
1378 | return page; | 1352 | return page; |
1379 | 1353 | ||
1380 | new = cas_page_dequeue(cp); | 1354 | new = cas_page_dequeue(cp); |
@@ -1394,7 +1368,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring, | |||
1394 | cas_page_t **page1 = cp->rx_pages[1]; | 1368 | cas_page_t **page1 = cp->rx_pages[1]; |
1395 | 1369 | ||
1396 | /* swap if buffer is in use */ | 1370 | /* swap if buffer is in use */ |
1397 | if (cas_buffer_count(page0[index]) > 1) { | 1371 | if (page_count(page0[index]->buffer) > 1) { |
1398 | cas_page_t *new = cas_page_spare(cp, index); | 1372 | cas_page_t *new = cas_page_spare(cp, index); |
1399 | if (new) { | 1373 | if (new) { |
1400 | page1[index] = page0[index]; | 1374 | page1[index] = page0[index]; |
@@ -1979,6 +1953,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
1979 | struct cas_page *page; | 1953 | struct cas_page *page; |
1980 | struct sk_buff *skb; | 1954 | struct sk_buff *skb; |
1981 | void *addr, *crcaddr; | 1955 | void *addr, *crcaddr; |
1956 | __sum16 csum; | ||
1982 | char *p; | 1957 | char *p; |
1983 | 1958 | ||
1984 | hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]); | 1959 | hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]); |
@@ -2062,10 +2037,10 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
2062 | 2037 | ||
2063 | skb_shinfo(skb)->nr_frags++; | 2038 | skb_shinfo(skb)->nr_frags++; |
2064 | skb->data_len += hlen - swivel; | 2039 | skb->data_len += hlen - swivel; |
2040 | skb->truesize += hlen - swivel; | ||
2065 | skb->len += hlen - swivel; | 2041 | skb->len += hlen - swivel; |
2066 | 2042 | ||
2067 | get_page(page->buffer); | 2043 | get_page(page->buffer); |
2068 | cas_buffer_inc(page); | ||
2069 | frag->page = page->buffer; | 2044 | frag->page = page->buffer; |
2070 | frag->page_offset = off; | 2045 | frag->page_offset = off; |
2071 | frag->size = hlen - swivel; | 2046 | frag->size = hlen - swivel; |
@@ -2090,7 +2065,6 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
2090 | frag++; | 2065 | frag++; |
2091 | 2066 | ||
2092 | get_page(page->buffer); | 2067 | get_page(page->buffer); |
2093 | cas_buffer_inc(page); | ||
2094 | frag->page = page->buffer; | 2068 | frag->page = page->buffer; |
2095 | frag->page_offset = 0; | 2069 | frag->page_offset = 0; |
2096 | frag->size = hlen; | 2070 | frag->size = hlen; |
@@ -2158,14 +2132,15 @@ end_copy_pkt: | |||
2158 | skb_put(skb, alloclen); | 2132 | skb_put(skb, alloclen); |
2159 | } | 2133 | } |
2160 | 2134 | ||
2161 | i = CAS_VAL(RX_COMP4_TCP_CSUM, words[3]); | 2135 | csum = (__force __sum16)htons(CAS_VAL(RX_COMP4_TCP_CSUM, words[3])); |
2162 | if (cp->crc_size) { | 2136 | if (cp->crc_size) { |
2163 | /* checksum includes FCS. strip it out. */ | 2137 | /* checksum includes FCS. strip it out. */ |
2164 | i = csum_fold(csum_partial(crcaddr, cp->crc_size, i)); | 2138 | csum = csum_fold(csum_partial(crcaddr, cp->crc_size, |
2139 | csum_unfold(csum))); | ||
2165 | if (addr) | 2140 | if (addr) |
2166 | cas_page_unmap(addr); | 2141 | cas_page_unmap(addr); |
2167 | } | 2142 | } |
2168 | skb->csum = ntohs(i ^ 0xffff); | 2143 | skb->csum = csum_unfold(~csum); |
2169 | skb->ip_summed = CHECKSUM_COMPLETE; | 2144 | skb->ip_summed = CHECKSUM_COMPLETE; |
2170 | skb->protocol = eth_type_trans(skb, cp->dev); | 2145 | skb->protocol = eth_type_trans(skb, cp->dev); |
2171 | return len; | 2146 | return len; |
@@ -2253,7 +2228,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) | |||
2253 | released = 0; | 2228 | released = 0; |
2254 | while (entry != last) { | 2229 | while (entry != last) { |
2255 | /* make a new buffer if it's still in use */ | 2230 | /* make a new buffer if it's still in use */ |
2256 | if (cas_buffer_count(page[entry]) > 1) { | 2231 | if (page_count(page[entry]->buffer) > 1) { |
2257 | cas_page_t *new = cas_page_dequeue(cp); | 2232 | cas_page_t *new = cas_page_dequeue(cp); |
2258 | if (!new) { | 2233 | if (!new) { |
2259 | /* let the timer know that we need to | 2234 | /* let the timer know that we need to |
@@ -2611,7 +2586,7 @@ static int cas_poll(struct napi_struct *napi, int budget) | |||
2611 | { | 2586 | { |
2612 | struct cas *cp = container_of(napi, struct cas, napi); | 2587 | struct cas *cp = container_of(napi, struct cas, napi); |
2613 | struct net_device *dev = cp->dev; | 2588 | struct net_device *dev = cp->dev; |
2614 | int i, enable_intr, todo, credits; | 2589 | int i, enable_intr, credits; |
2615 | u32 status = readl(cp->regs + REG_INTR_STATUS); | 2590 | u32 status = readl(cp->regs + REG_INTR_STATUS); |
2616 | unsigned long flags; | 2591 | unsigned long flags; |
2617 | 2592 | ||
@@ -4375,7 +4350,7 @@ static int cas_close(struct net_device *dev) | |||
4375 | struct cas *cp = netdev_priv(dev); | 4350 | struct cas *cp = netdev_priv(dev); |
4376 | 4351 | ||
4377 | #ifdef USE_NAPI | 4352 | #ifdef USE_NAPI |
4378 | napi_enable(&cp->napi); | 4353 | napi_disable(&cp->napi); |
4379 | #endif | 4354 | #endif |
4380 | /* Make sure we don't get distracted by suspend/resume */ | 4355 | /* Make sure we don't get distracted by suspend/resume */ |
4381 | mutex_lock(&cp->pm_mutex); | 4356 | mutex_lock(&cp->pm_mutex); |
@@ -4872,6 +4847,90 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
4872 | return rc; | 4847 | return rc; |
4873 | } | 4848 | } |
4874 | 4849 | ||
4850 | /* When this chip sits underneath an Intel 31154 bridge, it is the | ||
4851 | * only subordinate device and we can tweak the bridge settings to | ||
4852 | * reflect that fact. | ||
4853 | */ | ||
4854 | static void __devinit cas_program_bridge(struct pci_dev *cas_pdev) | ||
4855 | { | ||
4856 | struct pci_dev *pdev = cas_pdev->bus->self; | ||
4857 | u32 val; | ||
4858 | |||
4859 | if (!pdev) | ||
4860 | return; | ||
4861 | |||
4862 | if (pdev->vendor != 0x8086 || pdev->device != 0x537c) | ||
4863 | return; | ||
4864 | |||
4865 | /* Clear bit 10 (Bus Parking Control) in the Secondary | ||
4866 | * Arbiter Control/Status Register which lives at offset | ||
4867 | * 0x41. Using a 32-bit word read/modify/write at 0x40 | ||
4868 | * is much simpler so that's how we do this. | ||
4869 | */ | ||
4870 | pci_read_config_dword(pdev, 0x40, &val); | ||
4871 | val &= ~0x00040000; | ||
4872 | pci_write_config_dword(pdev, 0x40, val); | ||
4873 | |||
4874 | /* Max out the Multi-Transaction Timer settings since | ||
4875 | * Cassini is the only device present. | ||
4876 | * | ||
4877 | * The register is 16-bit and lives at 0x50. When the | ||
4878 | * settings are enabled, it extends the GRANT# signal | ||
4879 | * for a requestor after a transaction is complete. This | ||
4880 | * allows the next request to run without first needing | ||
4881 | * to negotiate the GRANT# signal back. | ||
4882 | * | ||
4883 | * Bits 12:10 define the grant duration: | ||
4884 | * | ||
4885 | * 1 -- 16 clocks | ||
4886 | * 2 -- 32 clocks | ||
4887 | * 3 -- 64 clocks | ||
4888 | * 4 -- 128 clocks | ||
4889 | * 5 -- 256 clocks | ||
4890 | * | ||
4891 | * All other values are illegal. | ||
4892 | * | ||
4893 | * Bits 09:00 define which REQ/GNT signal pairs get the | ||
4894 | * GRANT# signal treatment. We set them all. | ||
4895 | */ | ||
4896 | pci_write_config_word(pdev, 0x50, (5 << 10) | 0x3ff); | ||
4897 | |||
4898 | /* The Read Prefecth Policy register is 16-bit and sits at | ||
4899 | * offset 0x52. It enables a "smart" pre-fetch policy. We | ||
4900 | * enable it and max out all of the settings since only one | ||
4901 | * device is sitting underneath and thus bandwidth sharing is | ||
4902 | * not an issue. | ||
4903 | * | ||
4904 | * The register has several 3 bit fields, which indicates a | ||
4905 | * multiplier applied to the base amount of prefetching the | ||
4906 | * chip would do. These fields are at: | ||
4907 | * | ||
4908 | * 15:13 --- ReRead Primary Bus | ||
4909 | * 12:10 --- FirstRead Primary Bus | ||
4910 | * 09:07 --- ReRead Secondary Bus | ||
4911 | * 06:04 --- FirstRead Secondary Bus | ||
4912 | * | ||
4913 | * Bits 03:00 control which REQ/GNT pairs the prefetch settings | ||
4914 | * get enabled on. Bit 3 is a grouped enabler which controls | ||
4915 | * all of the REQ/GNT pairs from [8:3]. Bits 2 to 0 control | ||
4916 | * the individual REQ/GNT pairs [2:0]. | ||
4917 | */ | ||
4918 | pci_write_config_word(pdev, 0x52, | ||
4919 | (0x7 << 13) | | ||
4920 | (0x7 << 10) | | ||
4921 | (0x7 << 7) | | ||
4922 | (0x7 << 4) | | ||
4923 | (0xf << 0)); | ||
4924 | |||
4925 | /* Force cacheline size to 0x8 */ | ||
4926 | pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08); | ||
4927 | |||
4928 | /* Force latency timer to maximum setting so Cassini can | ||
4929 | * sit on the bus as long as it likes. | ||
4930 | */ | ||
4931 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff); | ||
4932 | } | ||
4933 | |||
4875 | static int __devinit cas_init_one(struct pci_dev *pdev, | 4934 | static int __devinit cas_init_one(struct pci_dev *pdev, |
4876 | const struct pci_device_id *ent) | 4935 | const struct pci_device_id *ent) |
4877 | { | 4936 | { |
@@ -4927,6 +4986,8 @@ static int __devinit cas_init_one(struct pci_dev *pdev, | |||
4927 | printk(KERN_WARNING PFX "Could not enable MWI for %s\n", | 4986 | printk(KERN_WARNING PFX "Could not enable MWI for %s\n", |
4928 | pci_name(pdev)); | 4987 | pci_name(pdev)); |
4929 | 4988 | ||
4989 | cas_program_bridge(pdev); | ||
4990 | |||
4930 | /* | 4991 | /* |
4931 | * On some architectures, the default cache line size set | 4992 | * On some architectures, the default cache line size set |
4932 | * by pci_try_set_mwi reduces perforamnce. We have to increase | 4993 | * by pci_try_set_mwi reduces perforamnce. We have to increase |
diff --git a/drivers/net/cassini.h b/drivers/net/cassini.h index 2f93f83342d2..552af89ca1cf 100644 --- a/drivers/net/cassini.h +++ b/drivers/net/cassini.h | |||
@@ -4122,8 +4122,8 @@ cas_saturn_patch_t cas_saturn_patch[] = { | |||
4122 | inserted into | 4122 | inserted into |
4123 | outgoing frame. */ | 4123 | outgoing frame. */ |
4124 | struct cas_tx_desc { | 4124 | struct cas_tx_desc { |
4125 | u64 control; | 4125 | __le64 control; |
4126 | u64 buffer; | 4126 | __le64 buffer; |
4127 | }; | 4127 | }; |
4128 | 4128 | ||
4129 | /* descriptor ring for free buffers contains page-sized buffers. the index | 4129 | /* descriptor ring for free buffers contains page-sized buffers. the index |
@@ -4131,8 +4131,8 @@ struct cas_tx_desc { | |||
4131 | * the completion ring. | 4131 | * the completion ring. |
4132 | */ | 4132 | */ |
4133 | struct cas_rx_desc { | 4133 | struct cas_rx_desc { |
4134 | u64 index; | 4134 | __le64 index; |
4135 | u64 buffer; | 4135 | __le64 buffer; |
4136 | }; | 4136 | }; |
4137 | 4137 | ||
4138 | /* received packets are put on the completion ring. */ | 4138 | /* received packets are put on the completion ring. */ |
@@ -4210,10 +4210,10 @@ struct cas_rx_desc { | |||
4210 | #define RX_INDEX_RELEASE 0x0000000000002000ULL | 4210 | #define RX_INDEX_RELEASE 0x0000000000002000ULL |
4211 | 4211 | ||
4212 | struct cas_rx_comp { | 4212 | struct cas_rx_comp { |
4213 | u64 word1; | 4213 | __le64 word1; |
4214 | u64 word2; | 4214 | __le64 word2; |
4215 | u64 word3; | 4215 | __le64 word3; |
4216 | u64 word4; | 4216 | __le64 word4; |
4217 | }; | 4217 | }; |
4218 | 4218 | ||
4219 | enum link_state { | 4219 | enum link_state { |
@@ -4252,7 +4252,7 @@ struct cas_init_block { | |||
4252 | struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP]; | 4252 | struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP]; |
4253 | struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC]; | 4253 | struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC]; |
4254 | struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX]; | 4254 | struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX]; |
4255 | u64 tx_compwb; | 4255 | __le64 tx_compwb; |
4256 | }; | 4256 | }; |
4257 | 4257 | ||
4258 | /* tiny buffers to deal with target abort issue. we allocate a bit | 4258 | /* tiny buffers to deal with target abort issue. we allocate a bit |
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 2dbf8dc116c6..c5975047c89b 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c | |||
@@ -374,7 +374,9 @@ static char stats_strings[][ETH_GSTRING_LEN] = { | |||
374 | "TxInternalMACXmitError", | 374 | "TxInternalMACXmitError", |
375 | "TxFramesWithExcessiveDeferral", | 375 | "TxFramesWithExcessiveDeferral", |
376 | "TxFCSErrors", | 376 | "TxFCSErrors", |
377 | 377 | "TxJumboFramesOk", | |
378 | "TxJumboOctetsOk", | ||
379 | |||
378 | "RxOctetsOK", | 380 | "RxOctetsOK", |
379 | "RxOctetsBad", | 381 | "RxOctetsBad", |
380 | "RxUnicastFramesOK", | 382 | "RxUnicastFramesOK", |
@@ -392,16 +394,17 @@ static char stats_strings[][ETH_GSTRING_LEN] = { | |||
392 | "RxInRangeLengthErrors", | 394 | "RxInRangeLengthErrors", |
393 | "RxOutOfRangeLengthField", | 395 | "RxOutOfRangeLengthField", |
394 | "RxFrameTooLongErrors", | 396 | "RxFrameTooLongErrors", |
397 | "RxJumboFramesOk", | ||
398 | "RxJumboOctetsOk", | ||
395 | 399 | ||
396 | /* Port stats */ | 400 | /* Port stats */ |
397 | "RxPackets", | ||
398 | "RxCsumGood", | 401 | "RxCsumGood", |
399 | "TxPackets", | ||
400 | "TxCsumOffload", | 402 | "TxCsumOffload", |
401 | "TxTso", | 403 | "TxTso", |
402 | "RxVlan", | 404 | "RxVlan", |
403 | "TxVlan", | 405 | "TxVlan", |
404 | 406 | "TxNeedHeadroom", | |
407 | |||
405 | /* Interrupt stats */ | 408 | /* Interrupt stats */ |
406 | "rx drops", | 409 | "rx drops", |
407 | "pure_rsps", | 410 | "pure_rsps", |
@@ -463,23 +466,56 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
463 | const struct cmac_statistics *s; | 466 | const struct cmac_statistics *s; |
464 | const struct sge_intr_counts *t; | 467 | const struct sge_intr_counts *t; |
465 | struct sge_port_stats ss; | 468 | struct sge_port_stats ss; |
466 | unsigned int len; | ||
467 | 469 | ||
468 | s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); | 470 | s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); |
469 | 471 | t = t1_sge_get_intr_counts(adapter->sge); | |
470 | len = sizeof(u64)*(&s->TxFCSErrors + 1 - &s->TxOctetsOK); | ||
471 | memcpy(data, &s->TxOctetsOK, len); | ||
472 | data += len; | ||
473 | |||
474 | len = sizeof(u64)*(&s->RxFrameTooLongErrors + 1 - &s->RxOctetsOK); | ||
475 | memcpy(data, &s->RxOctetsOK, len); | ||
476 | data += len; | ||
477 | |||
478 | t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); | 472 | t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); |
479 | memcpy(data, &ss, sizeof(ss)); | ||
480 | data += sizeof(ss); | ||
481 | 473 | ||
482 | t = t1_sge_get_intr_counts(adapter->sge); | 474 | *data++ = s->TxOctetsOK; |
475 | *data++ = s->TxOctetsBad; | ||
476 | *data++ = s->TxUnicastFramesOK; | ||
477 | *data++ = s->TxMulticastFramesOK; | ||
478 | *data++ = s->TxBroadcastFramesOK; | ||
479 | *data++ = s->TxPauseFrames; | ||
480 | *data++ = s->TxFramesWithDeferredXmissions; | ||
481 | *data++ = s->TxLateCollisions; | ||
482 | *data++ = s->TxTotalCollisions; | ||
483 | *data++ = s->TxFramesAbortedDueToXSCollisions; | ||
484 | *data++ = s->TxUnderrun; | ||
485 | *data++ = s->TxLengthErrors; | ||
486 | *data++ = s->TxInternalMACXmitError; | ||
487 | *data++ = s->TxFramesWithExcessiveDeferral; | ||
488 | *data++ = s->TxFCSErrors; | ||
489 | *data++ = s->TxJumboFramesOK; | ||
490 | *data++ = s->TxJumboOctetsOK; | ||
491 | |||
492 | *data++ = s->RxOctetsOK; | ||
493 | *data++ = s->RxOctetsBad; | ||
494 | *data++ = s->RxUnicastFramesOK; | ||
495 | *data++ = s->RxMulticastFramesOK; | ||
496 | *data++ = s->RxBroadcastFramesOK; | ||
497 | *data++ = s->RxPauseFrames; | ||
498 | *data++ = s->RxFCSErrors; | ||
499 | *data++ = s->RxAlignErrors; | ||
500 | *data++ = s->RxSymbolErrors; | ||
501 | *data++ = s->RxDataErrors; | ||
502 | *data++ = s->RxSequenceErrors; | ||
503 | *data++ = s->RxRuntErrors; | ||
504 | *data++ = s->RxJabberErrors; | ||
505 | *data++ = s->RxInternalMACRcvError; | ||
506 | *data++ = s->RxInRangeLengthErrors; | ||
507 | *data++ = s->RxOutOfRangeLengthField; | ||
508 | *data++ = s->RxFrameTooLongErrors; | ||
509 | *data++ = s->RxJumboFramesOK; | ||
510 | *data++ = s->RxJumboOctetsOK; | ||
511 | |||
512 | *data++ = ss.rx_cso_good; | ||
513 | *data++ = ss.tx_cso; | ||
514 | *data++ = ss.tx_tso; | ||
515 | *data++ = ss.vlan_xtract; | ||
516 | *data++ = ss.vlan_insert; | ||
517 | *data++ = ss.tx_need_hdrroom; | ||
518 | |||
483 | *data++ = t->rx_drops; | 519 | *data++ = t->rx_drops; |
484 | *data++ = t->pure_rsps; | 520 | *data++ = t->pure_rsps; |
485 | *data++ = t->unhandled_irqs; | 521 | *data++ = t->unhandled_irqs; |
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c index 678778a8d133..2117c4fbb107 100644 --- a/drivers/net/chelsio/pm3393.c +++ b/drivers/net/chelsio/pm3393.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #include <linux/crc32.h> | 46 | #include <linux/crc32.h> |
47 | 47 | ||
48 | #define OFFSET(REG_ADDR) (REG_ADDR << 2) | 48 | #define OFFSET(REG_ADDR) ((REG_ADDR) << 2) |
49 | 49 | ||
50 | /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ | 50 | /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ |
51 | #define MAX_FRAME_SIZE 9600 | 51 | #define MAX_FRAME_SIZE 9600 |
@@ -428,69 +428,26 @@ static int pm3393_set_speed_duplex_fc(struct cmac *cmac, int speed, int duplex, | |||
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | 430 | ||
431 | static void pm3393_rmon_update(struct adapter *adapter, u32 offs, u64 *val, | 431 | #define RMON_UPDATE(mac, name, stat_name) \ |
432 | int over) | 432 | { \ |
433 | { | 433 | t1_tpi_read((mac)->adapter, OFFSET(name), &val0); \ |
434 | u32 val0, val1, val2; | 434 | t1_tpi_read((mac)->adapter, OFFSET((name)+1), &val1); \ |
435 | 435 | t1_tpi_read((mac)->adapter, OFFSET((name)+2), &val2); \ | |
436 | t1_tpi_read(adapter, offs, &val0); | 436 | (mac)->stats.stat_name = (u64)(val0 & 0xffff) | \ |
437 | t1_tpi_read(adapter, offs + 4, &val1); | 437 | ((u64)(val1 & 0xffff) << 16) | \ |
438 | t1_tpi_read(adapter, offs + 8, &val2); | 438 | ((u64)(val2 & 0xff) << 32) | \ |
439 | 439 | ((mac)->stats.stat_name & \ | |
440 | *val &= ~0ull << 40; | 440 | 0xffffff0000000000ULL); \ |
441 | *val |= val0 & 0xffff; | 441 | if (ro & \ |
442 | *val |= (val1 & 0xffff) << 16; | 442 | (1ULL << ((name - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW) >> 2))) \ |
443 | *val |= (u64)(val2 & 0xff) << 32; | 443 | (mac)->stats.stat_name += 1ULL << 40; \ |
444 | |||
445 | if (over) | ||
446 | *val += 1ull << 40; | ||
447 | } | 444 | } |
448 | 445 | ||
449 | static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, | 446 | static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, |
450 | int flag) | 447 | int flag) |
451 | { | 448 | { |
452 | static struct { | 449 | u64 ro; |
453 | unsigned int reg; | 450 | u32 val0, val1, val2, val3; |
454 | unsigned int offset; | ||
455 | } hw_stats [] = { | ||
456 | |||
457 | #define HW_STAT(name, stat_name) \ | ||
458 | { name, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL } | ||
459 | |||
460 | /* Rx stats */ | ||
461 | HW_STAT(RxOctetsReceivedOK, RxOctetsOK), | ||
462 | HW_STAT(RxUnicastFramesReceivedOK, RxUnicastFramesOK), | ||
463 | HW_STAT(RxMulticastFramesReceivedOK, RxMulticastFramesOK), | ||
464 | HW_STAT(RxBroadcastFramesReceivedOK, RxBroadcastFramesOK), | ||
465 | HW_STAT(RxPAUSEMACCtrlFramesReceived, RxPauseFrames), | ||
466 | HW_STAT(RxFrameCheckSequenceErrors, RxFCSErrors), | ||
467 | HW_STAT(RxFramesLostDueToInternalMACErrors, | ||
468 | RxInternalMACRcvError), | ||
469 | HW_STAT(RxSymbolErrors, RxSymbolErrors), | ||
470 | HW_STAT(RxInRangeLengthErrors, RxInRangeLengthErrors), | ||
471 | HW_STAT(RxFramesTooLongErrors , RxFrameTooLongErrors), | ||
472 | HW_STAT(RxJabbers, RxJabberErrors), | ||
473 | HW_STAT(RxFragments, RxRuntErrors), | ||
474 | HW_STAT(RxUndersizedFrames, RxRuntErrors), | ||
475 | HW_STAT(RxJumboFramesReceivedOK, RxJumboFramesOK), | ||
476 | HW_STAT(RxJumboOctetsReceivedOK, RxJumboOctetsOK), | ||
477 | |||
478 | /* Tx stats */ | ||
479 | HW_STAT(TxOctetsTransmittedOK, TxOctetsOK), | ||
480 | HW_STAT(TxFramesLostDueToInternalMACTransmissionError, | ||
481 | TxInternalMACXmitError), | ||
482 | HW_STAT(TxTransmitSystemError, TxFCSErrors), | ||
483 | HW_STAT(TxUnicastFramesTransmittedOK, TxUnicastFramesOK), | ||
484 | HW_STAT(TxMulticastFramesTransmittedOK, TxMulticastFramesOK), | ||
485 | HW_STAT(TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK), | ||
486 | HW_STAT(TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames), | ||
487 | HW_STAT(TxJumboFramesReceivedOK, TxJumboFramesOK), | ||
488 | HW_STAT(TxJumboOctetsReceivedOK, TxJumboOctetsOK) | ||
489 | }, *p = hw_stats; | ||
490 | u64 ro; | ||
491 | u32 val0, val1, val2, val3; | ||
492 | u64 *stats = (u64 *) &mac->stats; | ||
493 | unsigned int i; | ||
494 | 451 | ||
495 | /* Snap the counters */ | 452 | /* Snap the counters */ |
496 | pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, | 453 | pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, |
@@ -504,14 +461,35 @@ static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, | |||
504 | ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | | 461 | ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | |
505 | (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); | 462 | (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); |
506 | 463 | ||
507 | for (i = 0; i < ARRAY_SIZE(hw_stats); i++) { | 464 | /* Rx stats */ |
508 | unsigned reg = p->reg - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW; | 465 | RMON_UPDATE(mac, RxOctetsReceivedOK, RxOctetsOK); |
509 | 466 | RMON_UPDATE(mac, RxUnicastFramesReceivedOK, RxUnicastFramesOK); | |
510 | pm3393_rmon_update((mac)->adapter, OFFSET(p->reg), | 467 | RMON_UPDATE(mac, RxMulticastFramesReceivedOK, RxMulticastFramesOK); |
511 | stats + p->offset, ro & (reg >> 2)); | 468 | RMON_UPDATE(mac, RxBroadcastFramesReceivedOK, RxBroadcastFramesOK); |
512 | } | 469 | RMON_UPDATE(mac, RxPAUSEMACCtrlFramesReceived, RxPauseFrames); |
513 | 470 | RMON_UPDATE(mac, RxFrameCheckSequenceErrors, RxFCSErrors); | |
514 | 471 | RMON_UPDATE(mac, RxFramesLostDueToInternalMACErrors, | |
472 | RxInternalMACRcvError); | ||
473 | RMON_UPDATE(mac, RxSymbolErrors, RxSymbolErrors); | ||
474 | RMON_UPDATE(mac, RxInRangeLengthErrors, RxInRangeLengthErrors); | ||
475 | RMON_UPDATE(mac, RxFramesTooLongErrors , RxFrameTooLongErrors); | ||
476 | RMON_UPDATE(mac, RxJabbers, RxJabberErrors); | ||
477 | RMON_UPDATE(mac, RxFragments, RxRuntErrors); | ||
478 | RMON_UPDATE(mac, RxUndersizedFrames, RxRuntErrors); | ||
479 | RMON_UPDATE(mac, RxJumboFramesReceivedOK, RxJumboFramesOK); | ||
480 | RMON_UPDATE(mac, RxJumboOctetsReceivedOK, RxJumboOctetsOK); | ||
481 | |||
482 | /* Tx stats */ | ||
483 | RMON_UPDATE(mac, TxOctetsTransmittedOK, TxOctetsOK); | ||
484 | RMON_UPDATE(mac, TxFramesLostDueToInternalMACTransmissionError, | ||
485 | TxInternalMACXmitError); | ||
486 | RMON_UPDATE(mac, TxTransmitSystemError, TxFCSErrors); | ||
487 | RMON_UPDATE(mac, TxUnicastFramesTransmittedOK, TxUnicastFramesOK); | ||
488 | RMON_UPDATE(mac, TxMulticastFramesTransmittedOK, TxMulticastFramesOK); | ||
489 | RMON_UPDATE(mac, TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK); | ||
490 | RMON_UPDATE(mac, TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames); | ||
491 | RMON_UPDATE(mac, TxJumboFramesReceivedOK, TxJumboFramesOK); | ||
492 | RMON_UPDATE(mac, TxJumboOctetsReceivedOK, TxJumboOctetsOK); | ||
515 | 493 | ||
516 | return &mac->stats; | 494 | return &mac->stats; |
517 | } | 495 | } |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 443666292a5c..b301c0428ae0 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -986,11 +986,10 @@ void t1_sge_get_port_stats(const struct sge *sge, int port, | |||
986 | for_each_possible_cpu(cpu) { | 986 | for_each_possible_cpu(cpu) { |
987 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); | 987 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); |
988 | 988 | ||
989 | ss->rx_packets += st->rx_packets; | ||
990 | ss->rx_cso_good += st->rx_cso_good; | 989 | ss->rx_cso_good += st->rx_cso_good; |
991 | ss->tx_packets += st->tx_packets; | ||
992 | ss->tx_cso += st->tx_cso; | 990 | ss->tx_cso += st->tx_cso; |
993 | ss->tx_tso += st->tx_tso; | 991 | ss->tx_tso += st->tx_tso; |
992 | ss->tx_need_hdrroom += st->tx_need_hdrroom; | ||
994 | ss->vlan_xtract += st->vlan_xtract; | 993 | ss->vlan_xtract += st->vlan_xtract; |
995 | ss->vlan_insert += st->vlan_insert; | 994 | ss->vlan_insert += st->vlan_insert; |
996 | } | 995 | } |
@@ -1380,7 +1379,6 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) | |||
1380 | __skb_pull(skb, sizeof(*p)); | 1379 | __skb_pull(skb, sizeof(*p)); |
1381 | 1380 | ||
1382 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); | 1381 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); |
1383 | st->rx_packets++; | ||
1384 | 1382 | ||
1385 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); | 1383 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); |
1386 | skb->dev->last_rx = jiffies; | 1384 | skb->dev->last_rx = jiffies; |
@@ -1624,11 +1622,9 @@ int t1_poll(struct napi_struct *napi, int budget) | |||
1624 | { | 1622 | { |
1625 | struct adapter *adapter = container_of(napi, struct adapter, napi); | 1623 | struct adapter *adapter = container_of(napi, struct adapter, napi); |
1626 | struct net_device *dev = adapter->port[0].dev; | 1624 | struct net_device *dev = adapter->port[0].dev; |
1627 | int work_done; | 1625 | int work_done = process_responses(adapter, budget); |
1628 | |||
1629 | work_done = process_responses(adapter, budget); | ||
1630 | 1626 | ||
1631 | if (likely(!responses_pending(adapter))) { | 1627 | if (likely(work_done < budget)) { |
1632 | netif_rx_complete(dev, napi); | 1628 | netif_rx_complete(dev, napi); |
1633 | writel(adapter->sge->respQ.cidx, | 1629 | writel(adapter->sge->respQ.cidx, |
1634 | adapter->regs + A_SG_SLEEPING); | 1630 | adapter->regs + A_SG_SLEEPING); |
@@ -1848,7 +1844,8 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1848 | { | 1844 | { |
1849 | struct adapter *adapter = dev->priv; | 1845 | struct adapter *adapter = dev->priv; |
1850 | struct sge *sge = adapter->sge; | 1846 | struct sge *sge = adapter->sge; |
1851 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], smp_processor_id()); | 1847 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], |
1848 | smp_processor_id()); | ||
1852 | struct cpl_tx_pkt *cpl; | 1849 | struct cpl_tx_pkt *cpl; |
1853 | struct sk_buff *orig_skb = skb; | 1850 | struct sk_buff *orig_skb = skb; |
1854 | int ret; | 1851 | int ret; |
@@ -1856,6 +1853,18 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1856 | if (skb->protocol == htons(ETH_P_CPL5)) | 1853 | if (skb->protocol == htons(ETH_P_CPL5)) |
1857 | goto send; | 1854 | goto send; |
1858 | 1855 | ||
1856 | /* | ||
1857 | * We are using a non-standard hard_header_len. | ||
1858 | * Allocate more header room in the rare cases it is not big enough. | ||
1859 | */ | ||
1860 | if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) { | ||
1861 | skb = skb_realloc_headroom(skb, sizeof(struct cpl_tx_pkt_lso)); | ||
1862 | ++st->tx_need_hdrroom; | ||
1863 | dev_kfree_skb_any(orig_skb); | ||
1864 | if (!skb) | ||
1865 | return NETDEV_TX_OK; | ||
1866 | } | ||
1867 | |||
1859 | if (skb_shinfo(skb)->gso_size) { | 1868 | if (skb_shinfo(skb)->gso_size) { |
1860 | int eth_type; | 1869 | int eth_type; |
1861 | struct cpl_tx_pkt_lso *hdr; | 1870 | struct cpl_tx_pkt_lso *hdr; |
@@ -1889,24 +1898,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1889 | return NETDEV_TX_OK; | 1898 | return NETDEV_TX_OK; |
1890 | } | 1899 | } |
1891 | 1900 | ||
1892 | /* | ||
1893 | * We are using a non-standard hard_header_len and some kernel | ||
1894 | * components, such as pktgen, do not handle it right. | ||
1895 | * Complain when this happens but try to fix things up. | ||
1896 | */ | ||
1897 | if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) { | ||
1898 | pr_debug("%s: headroom %d header_len %d\n", dev->name, | ||
1899 | skb_headroom(skb), dev->hard_header_len); | ||
1900 | |||
1901 | if (net_ratelimit()) | ||
1902 | printk(KERN_ERR "%s: inadequate headroom in " | ||
1903 | "Tx packet\n", dev->name); | ||
1904 | skb = skb_realloc_headroom(skb, sizeof(*cpl)); | ||
1905 | dev_kfree_skb_any(orig_skb); | ||
1906 | if (!skb) | ||
1907 | return NETDEV_TX_OK; | ||
1908 | } | ||
1909 | |||
1910 | if (!(adapter->flags & UDP_CSUM_CAPABLE) && | 1901 | if (!(adapter->flags & UDP_CSUM_CAPABLE) && |
1911 | skb->ip_summed == CHECKSUM_PARTIAL && | 1902 | skb->ip_summed == CHECKSUM_PARTIAL && |
1912 | ip_hdr(skb)->protocol == IPPROTO_UDP) { | 1903 | ip_hdr(skb)->protocol == IPPROTO_UDP) { |
@@ -1952,7 +1943,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1952 | cpl->vlan_valid = 0; | 1943 | cpl->vlan_valid = 0; |
1953 | 1944 | ||
1954 | send: | 1945 | send: |
1955 | st->tx_packets++; | ||
1956 | dev->trans_start = jiffies; | 1946 | dev->trans_start = jiffies; |
1957 | ret = t1_sge_tx(skb, adapter, 0, dev); | 1947 | ret = t1_sge_tx(skb, adapter, 0, dev); |
1958 | 1948 | ||
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h index 713d9c55f24d..cced9dff91c5 100644 --- a/drivers/net/chelsio/sge.h +++ b/drivers/net/chelsio/sge.h | |||
@@ -57,13 +57,12 @@ struct sge_intr_counts { | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct sge_port_stats { | 59 | struct sge_port_stats { |
60 | u64 rx_packets; /* # of Ethernet packets received */ | ||
61 | u64 rx_cso_good; /* # of successful RX csum offloads */ | 60 | u64 rx_cso_good; /* # of successful RX csum offloads */ |
62 | u64 tx_packets; /* # of TX packets */ | ||
63 | u64 tx_cso; /* # of TX checksum offloads */ | 61 | u64 tx_cso; /* # of TX checksum offloads */ |
64 | u64 tx_tso; /* # of TSO requests */ | 62 | u64 tx_tso; /* # of TSO requests */ |
65 | u64 vlan_xtract; /* # of VLAN tag extractions */ | 63 | u64 vlan_xtract; /* # of VLAN tag extractions */ |
66 | u64 vlan_insert; /* # of VLAN tag insertions */ | 64 | u64 vlan_insert; /* # of VLAN tag insertions */ |
65 | u64 tx_need_hdrroom; /* # of TX skbs in need of more header room */ | ||
67 | }; | 66 | }; |
68 | 67 | ||
69 | struct sk_buff; | 68 | struct sk_buff; |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 6fd95a2c8cec..6e12d48351b8 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -459,7 +459,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
459 | return NETDEV_TX_OK; | 459 | return NETDEV_TX_OK; |
460 | 460 | ||
461 | len = max(skb->len, ETH_ZLEN); | 461 | len = max(skb->len, ETH_ZLEN); |
462 | queue = skb->queue_mapping; | 462 | queue = skb_get_queue_mapping(skb); |
463 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 463 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE |
464 | netif_stop_subqueue(dev, queue); | 464 | netif_stop_subqueue(dev, queue); |
465 | #else | 465 | #else |
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h index 5e1bc0dec5f1..6e12bf4bc6cf 100644 --- a/drivers/net/cxgb3/regs.h +++ b/drivers/net/cxgb3/regs.h | |||
@@ -1937,6 +1937,10 @@ | |||
1937 | 1937 | ||
1938 | #define A_XGM_RXFIFO_CFG 0x884 | 1938 | #define A_XGM_RXFIFO_CFG 0x884 |
1939 | 1939 | ||
1940 | #define S_RXFIFO_EMPTY 31 | ||
1941 | #define V_RXFIFO_EMPTY(x) ((x) << S_RXFIFO_EMPTY) | ||
1942 | #define F_RXFIFO_EMPTY V_RXFIFO_EMPTY(1U) | ||
1943 | |||
1940 | #define S_RXFIFOPAUSEHWM 17 | 1944 | #define S_RXFIFOPAUSEHWM 17 |
1941 | #define M_RXFIFOPAUSEHWM 0xfff | 1945 | #define M_RXFIFOPAUSEHWM 0xfff |
1942 | 1946 | ||
@@ -1961,6 +1965,10 @@ | |||
1961 | 1965 | ||
1962 | #define A_XGM_TXFIFO_CFG 0x888 | 1966 | #define A_XGM_TXFIFO_CFG 0x888 |
1963 | 1967 | ||
1968 | #define S_UNDERUNFIX 22 | ||
1969 | #define V_UNDERUNFIX(x) ((x) << S_UNDERUNFIX) | ||
1970 | #define F_UNDERUNFIX V_UNDERUNFIX(1U) | ||
1971 | |||
1964 | #define S_TXIPG 13 | 1972 | #define S_TXIPG 13 |
1965 | #define M_TXIPG 0xff | 1973 | #define M_TXIPG 0xff |
1966 | #define V_TXIPG(x) ((x) << S_TXIPG) | 1974 | #define V_TXIPG(x) ((x) << S_TXIPG) |
@@ -2034,10 +2042,27 @@ | |||
2034 | #define V_XAUIIMP(x) ((x) << S_XAUIIMP) | 2042 | #define V_XAUIIMP(x) ((x) << S_XAUIIMP) |
2035 | 2043 | ||
2036 | #define A_XGM_RX_MAX_PKT_SIZE 0x8a8 | 2044 | #define A_XGM_RX_MAX_PKT_SIZE 0x8a8 |
2037 | #define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4 | 2045 | |
2046 | #define S_RXMAXFRAMERSIZE 17 | ||
2047 | #define M_RXMAXFRAMERSIZE 0x3fff | ||
2048 | #define V_RXMAXFRAMERSIZE(x) ((x) << S_RXMAXFRAMERSIZE) | ||
2049 | #define G_RXMAXFRAMERSIZE(x) (((x) >> S_RXMAXFRAMERSIZE) & M_RXMAXFRAMERSIZE) | ||
2050 | |||
2051 | #define S_RXENFRAMER 14 | ||
2052 | #define V_RXENFRAMER(x) ((x) << S_RXENFRAMER) | ||
2053 | #define F_RXENFRAMER V_RXENFRAMER(1U) | ||
2054 | |||
2055 | #define S_RXMAXPKTSIZE 0 | ||
2056 | #define M_RXMAXPKTSIZE 0x3fff | ||
2057 | #define V_RXMAXPKTSIZE(x) ((x) << S_RXMAXPKTSIZE) | ||
2058 | #define G_RXMAXPKTSIZE(x) (((x) >> S_RXMAXPKTSIZE) & M_RXMAXPKTSIZE) | ||
2038 | 2059 | ||
2039 | #define A_XGM_RESET_CTRL 0x8ac | 2060 | #define A_XGM_RESET_CTRL 0x8ac |
2040 | 2061 | ||
2062 | #define S_XGMAC_STOP_EN 4 | ||
2063 | #define V_XGMAC_STOP_EN(x) ((x) << S_XGMAC_STOP_EN) | ||
2064 | #define F_XGMAC_STOP_EN V_XGMAC_STOP_EN(1U) | ||
2065 | |||
2041 | #define S_XG2G_RESET_ 3 | 2066 | #define S_XG2G_RESET_ 3 |
2042 | #define V_XG2G_RESET_(x) ((x) << S_XG2G_RESET_) | 2067 | #define V_XG2G_RESET_(x) ((x) << S_XG2G_RESET_) |
2043 | #define F_XG2G_RESET_ V_XG2G_RESET_(1U) | 2068 | #define F_XG2G_RESET_ V_XG2G_RESET_(1U) |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index d4ee00d32219..522834c42ae7 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -447,8 +447,8 @@ static const struct adapter_info t3_adap_info[] = { | |||
447 | &mi1_mdio_ops, "Chelsio T302"}, | 447 | &mi1_mdio_ops, "Chelsio T302"}, |
448 | {1, 0, 0, 0, | 448 | {1, 0, 0, 0, |
449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | | 449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | |
450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 450 | F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, |
451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, | 451 | 0, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
452 | &mi1_mdio_ext_ops, "Chelsio T310"}, | 452 | &mi1_mdio_ext_ops, "Chelsio T310"}, |
453 | {2, 0, 0, 0, | 453 | {2, 0, 0, 0, |
454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | | 454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | |
@@ -2613,7 +2613,7 @@ static void __devinit init_mtus(unsigned short mtus[]) | |||
2613 | * it can accomodate max size TCP/IP headers when SACK and timestamps | 2613 | * it can accomodate max size TCP/IP headers when SACK and timestamps |
2614 | * are enabled and still have at least 8 bytes of payload. | 2614 | * are enabled and still have at least 8 bytes of payload. |
2615 | */ | 2615 | */ |
2616 | mtus[1] = 88; | 2616 | mtus[0] = 88; |
2617 | mtus[1] = 88; | 2617 | mtus[1] = 88; |
2618 | mtus[2] = 256; | 2618 | mtus[2] = 256; |
2619 | mtus[3] = 512; | 2619 | mtus[3] = 512; |
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c index eeb766aeced9..efcf09a709cf 100644 --- a/drivers/net/cxgb3/xgmac.c +++ b/drivers/net/cxgb3/xgmac.c | |||
@@ -106,6 +106,7 @@ int t3_mac_reset(struct cmac *mac) | |||
106 | t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft, | 106 | t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft, |
107 | F_RXSTRFRWRD | F_DISERRFRAMES, | 107 | F_RXSTRFRWRD | F_DISERRFRAMES, |
108 | uses_xaui(adap) ? 0 : F_RXSTRFRWRD); | 108 | uses_xaui(adap) ? 0 : F_RXSTRFRWRD); |
109 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + oft, 0, F_UNDERUNFIX); | ||
109 | 110 | ||
110 | if (uses_xaui(adap)) { | 111 | if (uses_xaui(adap)) { |
111 | if (adap->params.rev == 0) { | 112 | if (adap->params.rev == 0) { |
@@ -124,7 +125,11 @@ int t3_mac_reset(struct cmac *mac) | |||
124 | xaui_serdes_reset(mac); | 125 | xaui_serdes_reset(mac); |
125 | } | 126 | } |
126 | 127 | ||
127 | val = F_MAC_RESET_; | 128 | t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + oft, |
129 | V_RXMAXFRAMERSIZE(M_RXMAXFRAMERSIZE), | ||
130 | V_RXMAXFRAMERSIZE(MAX_FRAME_SIZE) | F_RXENFRAMER); | ||
131 | val = F_MAC_RESET_ | F_XGMAC_STOP_EN; | ||
132 | |||
128 | if (is_10G(adap)) | 133 | if (is_10G(adap)) |
129 | val |= F_PCS_RESET_; | 134 | val |= F_PCS_RESET_; |
130 | else if (uses_xaui(adap)) | 135 | else if (uses_xaui(adap)) |
@@ -313,8 +318,9 @@ static int rx_fifo_hwm(int mtu) | |||
313 | 318 | ||
314 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | 319 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) |
315 | { | 320 | { |
316 | int hwm, lwm; | 321 | int hwm, lwm, divisor; |
317 | unsigned int thres, v; | 322 | int ipg; |
323 | unsigned int thres, v, reg; | ||
318 | struct adapter *adap = mac->adapter; | 324 | struct adapter *adap = mac->adapter; |
319 | 325 | ||
320 | /* | 326 | /* |
@@ -335,27 +341,32 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | |||
335 | hwm = min(hwm, MAC_RXFIFO_SIZE - 8192); | 341 | hwm = min(hwm, MAC_RXFIFO_SIZE - 8192); |
336 | lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4); | 342 | lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4); |
337 | 343 | ||
338 | if (adap->params.rev == T3_REV_B2 && | 344 | if (adap->params.rev >= T3_REV_B2 && |
339 | (t3_read_reg(adap, A_XGM_RX_CTRL + mac->offset) & F_RXEN)) { | 345 | (t3_read_reg(adap, A_XGM_RX_CTRL + mac->offset) & F_RXEN)) { |
340 | disable_exact_filters(mac); | 346 | disable_exact_filters(mac); |
341 | v = t3_read_reg(adap, A_XGM_RX_CFG + mac->offset); | 347 | v = t3_read_reg(adap, A_XGM_RX_CFG + mac->offset); |
342 | t3_set_reg_field(adap, A_XGM_RX_CFG + mac->offset, | 348 | t3_set_reg_field(adap, A_XGM_RX_CFG + mac->offset, |
343 | F_ENHASHMCAST | F_COPYALLFRAMES, F_DISBCAST); | 349 | F_ENHASHMCAST | F_COPYALLFRAMES, F_DISBCAST); |
344 | 350 | ||
345 | /* drain rx FIFO */ | 351 | reg = adap->params.rev == T3_REV_B2 ? |
346 | if (t3_wait_op_done(adap, | 352 | A_XGM_RX_MAX_PKT_SIZE_ERR_CNT : A_XGM_RXFIFO_CFG; |
347 | A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + | 353 | |
348 | mac->offset, | 354 | /* drain RX FIFO */ |
349 | 1 << 31, 1, 20, 5)) { | 355 | if (t3_wait_op_done(adap, reg + mac->offset, |
356 | F_RXFIFO_EMPTY, 1, 20, 5)) { | ||
350 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); | 357 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); |
351 | enable_exact_filters(mac); | 358 | enable_exact_filters(mac); |
352 | return -EIO; | 359 | return -EIO; |
353 | } | 360 | } |
354 | t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); | 361 | t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, |
362 | V_RXMAXPKTSIZE(M_RXMAXPKTSIZE), | ||
363 | V_RXMAXPKTSIZE(mtu)); | ||
355 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); | 364 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); |
356 | enable_exact_filters(mac); | 365 | enable_exact_filters(mac); |
357 | } else | 366 | } else |
358 | t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); | 367 | t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, |
368 | V_RXMAXPKTSIZE(M_RXMAXPKTSIZE), | ||
369 | V_RXMAXPKTSIZE(mtu)); | ||
359 | 370 | ||
360 | /* | 371 | /* |
361 | * Adjust the PAUSE frame watermarks. We always set the LWM, and the | 372 | * Adjust the PAUSE frame watermarks. We always set the LWM, and the |
@@ -379,13 +390,16 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | |||
379 | thres /= 10; | 390 | thres /= 10; |
380 | thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; | 391 | thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; |
381 | thres = max(thres, 8U); /* need at least 8 */ | 392 | thres = max(thres, 8U); /* need at least 8 */ |
393 | ipg = (adap->params.rev == T3_REV_C) ? 0 : 1; | ||
382 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, | 394 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, |
383 | V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), | 395 | V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), |
384 | V_TXFIFOTHRESH(thres) | V_TXIPG(1)); | 396 | V_TXFIFOTHRESH(thres) | V_TXIPG(ipg)); |
385 | 397 | ||
386 | if (adap->params.rev > 0) | 398 | if (adap->params.rev > 0) { |
399 | divisor = (adap->params.rev == T3_REV_C) ? 64 : 8; | ||
387 | t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, | 400 | t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, |
388 | (hwm - lwm) * 4 / 8); | 401 | (hwm - lwm) * 4 / divisor); |
402 | } | ||
389 | t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, | 403 | t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, |
390 | MAC_RXFIFO_SIZE * 4 * 8 / 512); | 404 | MAC_RXFIFO_SIZE * 4 * 8 / 512); |
391 | return 0; | 405 | return 0; |
@@ -522,7 +536,7 @@ int t3b2_mac_watchdog_task(struct cmac *mac) | |||
522 | goto rxcheck; | 536 | goto rxcheck; |
523 | } | 537 | } |
524 | 538 | ||
525 | if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { | 539 | if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { |
526 | if (mac->toggle_cnt > 4) { | 540 | if (mac->toggle_cnt > 4) { |
527 | status = 2; | 541 | status = 2; |
528 | goto out; | 542 | goto out; |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 5066beb2e7bc..e233d04a2132 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev) | |||
332 | #endif | 332 | #endif |
333 | /* Read eeprom */ | 333 | /* Read eeprom */ |
334 | for (i = 0; i < 128; i++) { | 334 | for (i = 0; i < 128; i++) { |
335 | ((u16 *) sromdata)[i] = le16_to_cpu (read_eeprom (ioaddr, i)); | 335 | ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i)); |
336 | } | 336 | } |
337 | #ifdef MEM_MAPPING | 337 | #ifdef MEM_MAPPING |
338 | ioaddr = dev->base_addr; | 338 | ioaddr = dev->base_addr; |
@@ -516,7 +516,7 @@ rio_timer (unsigned long data) | |||
516 | PCI_DMA_FROMDEVICE)); | 516 | PCI_DMA_FROMDEVICE)); |
517 | } | 517 | } |
518 | np->rx_ring[entry].fraginfo |= | 518 | np->rx_ring[entry].fraginfo |= |
519 | cpu_to_le64 (np->rx_buf_sz) << 48; | 519 | cpu_to_le64((u64)np->rx_buf_sz << 48); |
520 | np->rx_ring[entry].status = 0; | 520 | np->rx_ring[entry].status = 0; |
521 | } /* end for */ | 521 | } /* end for */ |
522 | } /* end if */ | 522 | } /* end if */ |
@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev) | |||
584 | cpu_to_le64 ( pci_map_single ( | 584 | cpu_to_le64 ( pci_map_single ( |
585 | np->pdev, skb->data, np->rx_buf_sz, | 585 | np->pdev, skb->data, np->rx_buf_sz, |
586 | PCI_DMA_FROMDEVICE)); | 586 | PCI_DMA_FROMDEVICE)); |
587 | np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; | 587 | np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48); |
588 | } | 588 | } |
589 | 589 | ||
590 | /* Set RFDListPtr */ | 590 | /* Set RFDListPtr */ |
591 | writel (cpu_to_le32 (np->rx_ring_dma), dev->base_addr + RFDListPtr0); | 591 | writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0); |
592 | writel (0, dev->base_addr + RFDListPtr1); | 592 | writel (0, dev->base_addr + RFDListPtr1); |
593 | 593 | ||
594 | return; | 594 | return; |
@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
620 | } | 620 | } |
621 | #endif | 621 | #endif |
622 | if (np->vlan) { | 622 | if (np->vlan) { |
623 | tfc_vlan_tag = | 623 | tfc_vlan_tag = VLANTagInsert | |
624 | cpu_to_le64 (VLANTagInsert) | | 624 | ((u64)np->vlan << 32) | |
625 | (cpu_to_le64 (np->vlan) << 32) | | 625 | ((u64)skb->priority << 45); |
626 | (cpu_to_le64 (skb->priority) << 45); | ||
627 | } | 626 | } |
628 | txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, | 627 | txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, |
629 | skb->len, | 628 | skb->len, |
630 | PCI_DMA_TODEVICE)); | 629 | PCI_DMA_TODEVICE)); |
631 | txdesc->fraginfo |= cpu_to_le64 (skb->len) << 48; | 630 | txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48); |
632 | 631 | ||
633 | /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode | 632 | /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode |
634 | * Work around: Always use 1 descriptor in 10Mbps mode */ | 633 | * Work around: Always use 1 descriptor in 10Mbps mode */ |
@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance) | |||
708 | return IRQ_RETVAL(handled); | 707 | return IRQ_RETVAL(handled); |
709 | } | 708 | } |
710 | 709 | ||
710 | static inline dma_addr_t desc_to_dma(struct netdev_desc *desc) | ||
711 | { | ||
712 | return le64_to_cpu(desc->fraginfo) & DMA_48BIT_MASK; | ||
713 | } | ||
714 | |||
711 | static void | 715 | static void |
712 | rio_free_tx (struct net_device *dev, int irq) | 716 | rio_free_tx (struct net_device *dev, int irq) |
713 | { | 717 | { |
@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq) | |||
725 | while (entry != np->cur_tx) { | 729 | while (entry != np->cur_tx) { |
726 | struct sk_buff *skb; | 730 | struct sk_buff *skb; |
727 | 731 | ||
728 | if (!(np->tx_ring[entry].status & TFDDone)) | 732 | if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone))) |
729 | break; | 733 | break; |
730 | skb = np->tx_skbuff[entry]; | 734 | skb = np->tx_skbuff[entry]; |
731 | pci_unmap_single (np->pdev, | 735 | pci_unmap_single (np->pdev, |
732 | np->tx_ring[entry].fraginfo & DMA_48BIT_MASK, | 736 | desc_to_dma(&np->tx_ring[entry]), |
733 | skb->len, PCI_DMA_TODEVICE); | 737 | skb->len, PCI_DMA_TODEVICE); |
734 | if (irq) | 738 | if (irq) |
735 | dev_kfree_skb_irq (skb); | 739 | dev_kfree_skb_irq (skb); |
@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev) | |||
831 | int pkt_len; | 835 | int pkt_len; |
832 | u64 frame_status; | 836 | u64 frame_status; |
833 | 837 | ||
834 | if (!(desc->status & RFDDone) || | 838 | if (!(desc->status & cpu_to_le64(RFDDone)) || |
835 | !(desc->status & FrameStart) || !(desc->status & FrameEnd)) | 839 | !(desc->status & cpu_to_le64(FrameStart)) || |
840 | !(desc->status & cpu_to_le64(FrameEnd))) | ||
836 | break; | 841 | break; |
837 | 842 | ||
838 | /* Chip omits the CRC. */ | 843 | /* Chip omits the CRC. */ |
839 | pkt_len = le64_to_cpu (desc->status & 0xffff); | 844 | frame_status = le64_to_cpu(desc->status); |
840 | frame_status = le64_to_cpu (desc->status); | 845 | pkt_len = frame_status & 0xffff; |
841 | if (--cnt < 0) | 846 | if (--cnt < 0) |
842 | break; | 847 | break; |
843 | /* Update rx error statistics, drop packet. */ | 848 | /* Update rx error statistics, drop packet. */ |
@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev) | |||
857 | /* Small skbuffs for short packets */ | 862 | /* Small skbuffs for short packets */ |
858 | if (pkt_len > copy_thresh) { | 863 | if (pkt_len > copy_thresh) { |
859 | pci_unmap_single (np->pdev, | 864 | pci_unmap_single (np->pdev, |
860 | desc->fraginfo & DMA_48BIT_MASK, | 865 | desc_to_dma(desc), |
861 | np->rx_buf_sz, | 866 | np->rx_buf_sz, |
862 | PCI_DMA_FROMDEVICE); | 867 | PCI_DMA_FROMDEVICE); |
863 | skb_put (skb = np->rx_skbuff[entry], pkt_len); | 868 | skb_put (skb = np->rx_skbuff[entry], pkt_len); |
864 | np->rx_skbuff[entry] = NULL; | 869 | np->rx_skbuff[entry] = NULL; |
865 | } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { | 870 | } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { |
866 | pci_dma_sync_single_for_cpu(np->pdev, | 871 | pci_dma_sync_single_for_cpu(np->pdev, |
867 | desc->fraginfo & | 872 | desc_to_dma(desc), |
868 | DMA_48BIT_MASK, | ||
869 | np->rx_buf_sz, | 873 | np->rx_buf_sz, |
870 | PCI_DMA_FROMDEVICE); | 874 | PCI_DMA_FROMDEVICE); |
871 | /* 16 byte align the IP header */ | 875 | /* 16 byte align the IP header */ |
@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev) | |||
875 | pkt_len); | 879 | pkt_len); |
876 | skb_put (skb, pkt_len); | 880 | skb_put (skb, pkt_len); |
877 | pci_dma_sync_single_for_device(np->pdev, | 881 | pci_dma_sync_single_for_device(np->pdev, |
878 | desc->fraginfo & | 882 | desc_to_dma(desc), |
879 | DMA_48BIT_MASK, | ||
880 | np->rx_buf_sz, | 883 | np->rx_buf_sz, |
881 | PCI_DMA_FROMDEVICE); | 884 | PCI_DMA_FROMDEVICE); |
882 | } | 885 | } |
@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev) | |||
919 | PCI_DMA_FROMDEVICE)); | 922 | PCI_DMA_FROMDEVICE)); |
920 | } | 923 | } |
921 | np->rx_ring[entry].fraginfo |= | 924 | np->rx_ring[entry].fraginfo |= |
922 | cpu_to_le64 (np->rx_buf_sz) << 48; | 925 | cpu_to_le64((u64)np->rx_buf_sz << 48); |
923 | np->rx_ring[entry].status = 0; | 926 | np->rx_ring[entry].status = 0; |
924 | entry = (entry + 1) % RX_RING_SIZE; | 927 | entry = (entry + 1) % RX_RING_SIZE; |
925 | } | 928 | } |
@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev) | |||
1121 | 1124 | ||
1122 | hash_table[0] = hash_table[1] = 0; | 1125 | hash_table[0] = hash_table[1] = 0; |
1123 | /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ | 1126 | /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ |
1124 | hash_table[1] |= cpu_to_le32(0x02000000); | 1127 | hash_table[1] |= 0x02000000; |
1125 | if (dev->flags & IFF_PROMISC) { | 1128 | if (dev->flags & IFF_PROMISC) { |
1126 | /* Receive all frames promiscuously. */ | 1129 | /* Receive all frames promiscuously. */ |
1127 | rx_mode = ReceiveAllFrames; | 1130 | rx_mode = ReceiveAllFrames; |
@@ -1313,9 +1316,10 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1313 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | 1316 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", |
1314 | i, | 1317 | i, |
1315 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), | 1318 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), |
1316 | (u32) desc->next_desc, | 1319 | (u32)le64_to_cpu(desc->next_desc), |
1317 | (u32) desc->status, (u32) (desc->fraginfo >> 32), | 1320 | (u32)le64_to_cpu(desc->status), |
1318 | (u32) desc->fraginfo); | 1321 | (u32)(le64_to_cpu(desc->fraginfo) >> 32), |
1322 | (u32)le64_to_cpu(desc->fraginfo)); | ||
1319 | printk ("\n"); | 1323 | printk ("\n"); |
1320 | } | 1324 | } |
1321 | printk ("\n"); | 1325 | printk ("\n"); |
@@ -1432,7 +1436,7 @@ mii_write (struct net_device *dev, int phy_addr, int reg_num, u16 data) | |||
1432 | static int | 1436 | static int |
1433 | mii_wait_link (struct net_device *dev, int wait) | 1437 | mii_wait_link (struct net_device *dev, int wait) |
1434 | { | 1438 | { |
1435 | BMSR_t bmsr; | 1439 | __u16 bmsr; |
1436 | int phy_addr; | 1440 | int phy_addr; |
1437 | struct netdev_private *np; | 1441 | struct netdev_private *np; |
1438 | 1442 | ||
@@ -1440,8 +1444,8 @@ mii_wait_link (struct net_device *dev, int wait) | |||
1440 | phy_addr = np->phy_addr; | 1444 | phy_addr = np->phy_addr; |
1441 | 1445 | ||
1442 | do { | 1446 | do { |
1443 | bmsr.image = mii_read (dev, phy_addr, MII_BMSR); | 1447 | bmsr = mii_read (dev, phy_addr, MII_BMSR); |
1444 | if (bmsr.bits.link_status) | 1448 | if (bmsr & MII_BMSR_LINK_STATUS) |
1445 | return 0; | 1449 | return 0; |
1446 | mdelay (1); | 1450 | mdelay (1); |
1447 | } while (--wait > 0); | 1451 | } while (--wait > 0); |
@@ -1450,70 +1454,72 @@ mii_wait_link (struct net_device *dev, int wait) | |||
1450 | static int | 1454 | static int |
1451 | mii_get_media (struct net_device *dev) | 1455 | mii_get_media (struct net_device *dev) |
1452 | { | 1456 | { |
1453 | ANAR_t negotiate; | 1457 | __u16 negotiate; |
1454 | BMSR_t bmsr; | 1458 | __u16 bmsr; |
1455 | BMCR_t bmcr; | 1459 | __u16 mscr; |
1456 | MSCR_t mscr; | 1460 | __u16 mssr; |
1457 | MSSR_t mssr; | ||
1458 | int phy_addr; | 1461 | int phy_addr; |
1459 | struct netdev_private *np; | 1462 | struct netdev_private *np; |
1460 | 1463 | ||
1461 | np = netdev_priv(dev); | 1464 | np = netdev_priv(dev); |
1462 | phy_addr = np->phy_addr; | 1465 | phy_addr = np->phy_addr; |
1463 | 1466 | ||
1464 | bmsr.image = mii_read (dev, phy_addr, MII_BMSR); | 1467 | bmsr = mii_read (dev, phy_addr, MII_BMSR); |
1465 | if (np->an_enable) { | 1468 | if (np->an_enable) { |
1466 | if (!bmsr.bits.an_complete) { | 1469 | if (!(bmsr & MII_BMSR_AN_COMPLETE)) { |
1467 | /* Auto-Negotiation not completed */ | 1470 | /* Auto-Negotiation not completed */ |
1468 | return -1; | 1471 | return -1; |
1469 | } | 1472 | } |
1470 | negotiate.image = mii_read (dev, phy_addr, MII_ANAR) & | 1473 | negotiate = mii_read (dev, phy_addr, MII_ANAR) & |
1471 | mii_read (dev, phy_addr, MII_ANLPAR); | 1474 | mii_read (dev, phy_addr, MII_ANLPAR); |
1472 | mscr.image = mii_read (dev, phy_addr, MII_MSCR); | 1475 | mscr = mii_read (dev, phy_addr, MII_MSCR); |
1473 | mssr.image = mii_read (dev, phy_addr, MII_MSSR); | 1476 | mssr = mii_read (dev, phy_addr, MII_MSSR); |
1474 | if (mscr.bits.media_1000BT_FD & mssr.bits.lp_1000BT_FD) { | 1477 | if (mscr & MII_MSCR_1000BT_FD && mssr & MII_MSSR_LP_1000BT_FD) { |
1475 | np->speed = 1000; | 1478 | np->speed = 1000; |
1476 | np->full_duplex = 1; | 1479 | np->full_duplex = 1; |
1477 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); | 1480 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); |
1478 | } else if (mscr.bits.media_1000BT_HD & mssr.bits.lp_1000BT_HD) { | 1481 | } else if (mscr & MII_MSCR_1000BT_HD && mssr & MII_MSSR_LP_1000BT_HD) { |
1479 | np->speed = 1000; | 1482 | np->speed = 1000; |
1480 | np->full_duplex = 0; | 1483 | np->full_duplex = 0; |
1481 | printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n"); | 1484 | printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n"); |
1482 | } else if (negotiate.bits.media_100BX_FD) { | 1485 | } else if (negotiate & MII_ANAR_100BX_FD) { |
1483 | np->speed = 100; | 1486 | np->speed = 100; |
1484 | np->full_duplex = 1; | 1487 | np->full_duplex = 1; |
1485 | printk (KERN_INFO "Auto 100 Mbps, Full duplex\n"); | 1488 | printk (KERN_INFO "Auto 100 Mbps, Full duplex\n"); |
1486 | } else if (negotiate.bits.media_100BX_HD) { | 1489 | } else if (negotiate & MII_ANAR_100BX_HD) { |
1487 | np->speed = 100; | 1490 | np->speed = 100; |
1488 | np->full_duplex = 0; | 1491 | np->full_duplex = 0; |
1489 | printk (KERN_INFO "Auto 100 Mbps, Half duplex\n"); | 1492 | printk (KERN_INFO "Auto 100 Mbps, Half duplex\n"); |
1490 | } else if (negotiate.bits.media_10BT_FD) { | 1493 | } else if (negotiate & MII_ANAR_10BT_FD) { |
1491 | np->speed = 10; | 1494 | np->speed = 10; |
1492 | np->full_duplex = 1; | 1495 | np->full_duplex = 1; |
1493 | printk (KERN_INFO "Auto 10 Mbps, Full duplex\n"); | 1496 | printk (KERN_INFO "Auto 10 Mbps, Full duplex\n"); |
1494 | } else if (negotiate.bits.media_10BT_HD) { | 1497 | } else if (negotiate & MII_ANAR_10BT_HD) { |
1495 | np->speed = 10; | 1498 | np->speed = 10; |
1496 | np->full_duplex = 0; | 1499 | np->full_duplex = 0; |
1497 | printk (KERN_INFO "Auto 10 Mbps, Half duplex\n"); | 1500 | printk (KERN_INFO "Auto 10 Mbps, Half duplex\n"); |
1498 | } | 1501 | } |
1499 | if (negotiate.bits.pause) { | 1502 | if (negotiate & MII_ANAR_PAUSE) { |
1500 | np->tx_flow &= 1; | 1503 | np->tx_flow &= 1; |
1501 | np->rx_flow &= 1; | 1504 | np->rx_flow &= 1; |
1502 | } else if (negotiate.bits.asymmetric) { | 1505 | } else if (negotiate & MII_ANAR_ASYMMETRIC) { |
1503 | np->tx_flow = 0; | 1506 | np->tx_flow = 0; |
1504 | np->rx_flow &= 1; | 1507 | np->rx_flow &= 1; |
1505 | } | 1508 | } |
1506 | /* else tx_flow, rx_flow = user select */ | 1509 | /* else tx_flow, rx_flow = user select */ |
1507 | } else { | 1510 | } else { |
1508 | bmcr.image = mii_read (dev, phy_addr, MII_BMCR); | 1511 | __u16 bmcr = mii_read (dev, phy_addr, MII_BMCR); |
1509 | if (bmcr.bits.speed100 == 1 && bmcr.bits.speed1000 == 0) { | 1512 | switch (bmcr & (MII_BMCR_SPEED_100 | MII_BMCR_SPEED_1000)) { |
1513 | case MII_BMCR_SPEED_1000: | ||
1514 | printk (KERN_INFO "Operating at 1000 Mbps, "); | ||
1515 | break; | ||
1516 | case MII_BMCR_SPEED_100: | ||
1510 | printk (KERN_INFO "Operating at 100 Mbps, "); | 1517 | printk (KERN_INFO "Operating at 100 Mbps, "); |
1511 | } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 0) { | 1518 | break; |
1519 | case 0: | ||
1512 | printk (KERN_INFO "Operating at 10 Mbps, "); | 1520 | printk (KERN_INFO "Operating at 10 Mbps, "); |
1513 | } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 1) { | ||
1514 | printk (KERN_INFO "Operating at 1000 Mbps, "); | ||
1515 | } | 1521 | } |
1516 | if (bmcr.bits.duplex_mode) { | 1522 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1517 | printk ("Full duplex\n"); | 1523 | printk ("Full duplex\n"); |
1518 | } else { | 1524 | } else { |
1519 | printk ("Half duplex\n"); | 1525 | printk ("Half duplex\n"); |
@@ -1534,10 +1540,10 @@ mii_get_media (struct net_device *dev) | |||
1534 | static int | 1540 | static int |
1535 | mii_set_media (struct net_device *dev) | 1541 | mii_set_media (struct net_device *dev) |
1536 | { | 1542 | { |
1537 | PHY_SCR_t pscr; | 1543 | __u16 pscr; |
1538 | BMCR_t bmcr; | 1544 | __u16 bmcr; |
1539 | BMSR_t bmsr; | 1545 | __u16 bmsr; |
1540 | ANAR_t anar; | 1546 | __u16 anar; |
1541 | int phy_addr; | 1547 | int phy_addr; |
1542 | struct netdev_private *np; | 1548 | struct netdev_private *np; |
1543 | np = netdev_priv(dev); | 1549 | np = netdev_priv(dev); |
@@ -1546,76 +1552,77 @@ mii_set_media (struct net_device *dev) | |||
1546 | /* Does user set speed? */ | 1552 | /* Does user set speed? */ |
1547 | if (np->an_enable) { | 1553 | if (np->an_enable) { |
1548 | /* Advertise capabilities */ | 1554 | /* Advertise capabilities */ |
1549 | bmsr.image = mii_read (dev, phy_addr, MII_BMSR); | 1555 | bmsr = mii_read (dev, phy_addr, MII_BMSR); |
1550 | anar.image = mii_read (dev, phy_addr, MII_ANAR); | 1556 | anar = mii_read (dev, phy_addr, MII_ANAR) & |
1551 | anar.bits.media_100BX_FD = bmsr.bits.media_100BX_FD; | 1557 | ~MII_ANAR_100BX_FD & |
1552 | anar.bits.media_100BX_HD = bmsr.bits.media_100BX_HD; | 1558 | ~MII_ANAR_100BX_HD & |
1553 | anar.bits.media_100BT4 = bmsr.bits.media_100BT4; | 1559 | ~MII_ANAR_100BT4 & |
1554 | anar.bits.media_10BT_FD = bmsr.bits.media_10BT_FD; | 1560 | ~MII_ANAR_10BT_FD & |
1555 | anar.bits.media_10BT_HD = bmsr.bits.media_10BT_HD; | 1561 | ~MII_ANAR_10BT_HD; |
1556 | anar.bits.pause = 1; | 1562 | if (bmsr & MII_BMSR_100BX_FD) |
1557 | anar.bits.asymmetric = 1; | 1563 | anar |= MII_ANAR_100BX_FD; |
1558 | mii_write (dev, phy_addr, MII_ANAR, anar.image); | 1564 | if (bmsr & MII_BMSR_100BX_HD) |
1565 | anar |= MII_ANAR_100BX_HD; | ||
1566 | if (bmsr & MII_BMSR_100BT4) | ||
1567 | anar |= MII_ANAR_100BT4; | ||
1568 | if (bmsr & MII_BMSR_10BT_FD) | ||
1569 | anar |= MII_ANAR_10BT_FD; | ||
1570 | if (bmsr & MII_BMSR_10BT_HD) | ||
1571 | anar |= MII_ANAR_10BT_HD; | ||
1572 | anar |= MII_ANAR_PAUSE | MII_ANAR_ASYMMETRIC; | ||
1573 | mii_write (dev, phy_addr, MII_ANAR, anar); | ||
1559 | 1574 | ||
1560 | /* Enable Auto crossover */ | 1575 | /* Enable Auto crossover */ |
1561 | pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); | 1576 | pscr = mii_read (dev, phy_addr, MII_PHY_SCR); |
1562 | pscr.bits.mdi_crossover_mode = 3; /* 11'b */ | 1577 | pscr |= 3 << 5; /* 11'b */ |
1563 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); | 1578 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr); |
1564 | 1579 | ||
1565 | /* Soft reset PHY */ | 1580 | /* Soft reset PHY */ |
1566 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); | 1581 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); |
1567 | bmcr.image = 0; | 1582 | bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN | MII_BMCR_RESET; |
1568 | bmcr.bits.an_enable = 1; | 1583 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1569 | bmcr.bits.restart_an = 1; | ||
1570 | bmcr.bits.reset = 1; | ||
1571 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | ||
1572 | mdelay(1); | 1584 | mdelay(1); |
1573 | } else { | 1585 | } else { |
1574 | /* Force speed setting */ | 1586 | /* Force speed setting */ |
1575 | /* 1) Disable Auto crossover */ | 1587 | /* 1) Disable Auto crossover */ |
1576 | pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); | 1588 | pscr = mii_read (dev, phy_addr, MII_PHY_SCR); |
1577 | pscr.bits.mdi_crossover_mode = 0; | 1589 | pscr &= ~(3 << 5); |
1578 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); | 1590 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr); |
1579 | 1591 | ||
1580 | /* 2) PHY Reset */ | 1592 | /* 2) PHY Reset */ |
1581 | bmcr.image = mii_read (dev, phy_addr, MII_BMCR); | 1593 | bmcr = mii_read (dev, phy_addr, MII_BMCR); |
1582 | bmcr.bits.reset = 1; | 1594 | bmcr |= MII_BMCR_RESET; |
1583 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1595 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1584 | 1596 | ||
1585 | /* 3) Power Down */ | 1597 | /* 3) Power Down */ |
1586 | bmcr.image = 0x1940; /* must be 0x1940 */ | 1598 | bmcr = 0x1940; /* must be 0x1940 */ |
1587 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1599 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1588 | mdelay (100); /* wait a certain time */ | 1600 | mdelay (100); /* wait a certain time */ |
1589 | 1601 | ||
1590 | /* 4) Advertise nothing */ | 1602 | /* 4) Advertise nothing */ |
1591 | mii_write (dev, phy_addr, MII_ANAR, 0); | 1603 | mii_write (dev, phy_addr, MII_ANAR, 0); |
1592 | 1604 | ||
1593 | /* 5) Set media and Power Up */ | 1605 | /* 5) Set media and Power Up */ |
1594 | bmcr.image = 0; | 1606 | bmcr = MII_BMCR_POWER_DOWN; |
1595 | bmcr.bits.power_down = 1; | ||
1596 | if (np->speed == 100) { | 1607 | if (np->speed == 100) { |
1597 | bmcr.bits.speed100 = 1; | 1608 | bmcr |= MII_BMCR_SPEED_100; |
1598 | bmcr.bits.speed1000 = 0; | ||
1599 | printk (KERN_INFO "Manual 100 Mbps, "); | 1609 | printk (KERN_INFO "Manual 100 Mbps, "); |
1600 | } else if (np->speed == 10) { | 1610 | } else if (np->speed == 10) { |
1601 | bmcr.bits.speed100 = 0; | ||
1602 | bmcr.bits.speed1000 = 0; | ||
1603 | printk (KERN_INFO "Manual 10 Mbps, "); | 1611 | printk (KERN_INFO "Manual 10 Mbps, "); |
1604 | } | 1612 | } |
1605 | if (np->full_duplex) { | 1613 | if (np->full_duplex) { |
1606 | bmcr.bits.duplex_mode = 1; | 1614 | bmcr |= MII_BMCR_DUPLEX_MODE; |
1607 | printk ("Full duplex\n"); | 1615 | printk ("Full duplex\n"); |
1608 | } else { | 1616 | } else { |
1609 | bmcr.bits.duplex_mode = 0; | ||
1610 | printk ("Half duplex\n"); | 1617 | printk ("Half duplex\n"); |
1611 | } | 1618 | } |
1612 | #if 0 | 1619 | #if 0 |
1613 | /* Set 1000BaseT Master/Slave setting */ | 1620 | /* Set 1000BaseT Master/Slave setting */ |
1614 | mscr.image = mii_read (dev, phy_addr, MII_MSCR); | 1621 | mscr = mii_read (dev, phy_addr, MII_MSCR); |
1615 | mscr.bits.cfg_enable = 1; | 1622 | mscr |= MII_MSCR_CFG_ENABLE; |
1616 | mscr.bits.cfg_value = 0; | 1623 | mscr &= ~MII_MSCR_CFG_VALUE = 0; |
1617 | #endif | 1624 | #endif |
1618 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1625 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1619 | mdelay(10); | 1626 | mdelay(10); |
1620 | } | 1627 | } |
1621 | return 0; | 1628 | return 0; |
@@ -1624,43 +1631,42 @@ mii_set_media (struct net_device *dev) | |||
1624 | static int | 1631 | static int |
1625 | mii_get_media_pcs (struct net_device *dev) | 1632 | mii_get_media_pcs (struct net_device *dev) |
1626 | { | 1633 | { |
1627 | ANAR_PCS_t negotiate; | 1634 | __u16 negotiate; |
1628 | BMSR_t bmsr; | 1635 | __u16 bmsr; |
1629 | BMCR_t bmcr; | ||
1630 | int phy_addr; | 1636 | int phy_addr; |
1631 | struct netdev_private *np; | 1637 | struct netdev_private *np; |
1632 | 1638 | ||
1633 | np = netdev_priv(dev); | 1639 | np = netdev_priv(dev); |
1634 | phy_addr = np->phy_addr; | 1640 | phy_addr = np->phy_addr; |
1635 | 1641 | ||
1636 | bmsr.image = mii_read (dev, phy_addr, PCS_BMSR); | 1642 | bmsr = mii_read (dev, phy_addr, PCS_BMSR); |
1637 | if (np->an_enable) { | 1643 | if (np->an_enable) { |
1638 | if (!bmsr.bits.an_complete) { | 1644 | if (!(bmsr & MII_BMSR_AN_COMPLETE)) { |
1639 | /* Auto-Negotiation not completed */ | 1645 | /* Auto-Negotiation not completed */ |
1640 | return -1; | 1646 | return -1; |
1641 | } | 1647 | } |
1642 | negotiate.image = mii_read (dev, phy_addr, PCS_ANAR) & | 1648 | negotiate = mii_read (dev, phy_addr, PCS_ANAR) & |
1643 | mii_read (dev, phy_addr, PCS_ANLPAR); | 1649 | mii_read (dev, phy_addr, PCS_ANLPAR); |
1644 | np->speed = 1000; | 1650 | np->speed = 1000; |
1645 | if (negotiate.bits.full_duplex) { | 1651 | if (negotiate & PCS_ANAR_FULL_DUPLEX) { |
1646 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); | 1652 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); |
1647 | np->full_duplex = 1; | 1653 | np->full_duplex = 1; |
1648 | } else { | 1654 | } else { |
1649 | printk (KERN_INFO "Auto 1000 Mbps, half duplex\n"); | 1655 | printk (KERN_INFO "Auto 1000 Mbps, half duplex\n"); |
1650 | np->full_duplex = 0; | 1656 | np->full_duplex = 0; |
1651 | } | 1657 | } |
1652 | if (negotiate.bits.pause) { | 1658 | if (negotiate & PCS_ANAR_PAUSE) { |
1653 | np->tx_flow &= 1; | 1659 | np->tx_flow &= 1; |
1654 | np->rx_flow &= 1; | 1660 | np->rx_flow &= 1; |
1655 | } else if (negotiate.bits.asymmetric) { | 1661 | } else if (negotiate & PCS_ANAR_ASYMMETRIC) { |
1656 | np->tx_flow = 0; | 1662 | np->tx_flow = 0; |
1657 | np->rx_flow &= 1; | 1663 | np->rx_flow &= 1; |
1658 | } | 1664 | } |
1659 | /* else tx_flow, rx_flow = user select */ | 1665 | /* else tx_flow, rx_flow = user select */ |
1660 | } else { | 1666 | } else { |
1661 | bmcr.image = mii_read (dev, phy_addr, PCS_BMCR); | 1667 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); |
1662 | printk (KERN_INFO "Operating at 1000 Mbps, "); | 1668 | printk (KERN_INFO "Operating at 1000 Mbps, "); |
1663 | if (bmcr.bits.duplex_mode) { | 1669 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1664 | printk ("Full duplex\n"); | 1670 | printk ("Full duplex\n"); |
1665 | } else { | 1671 | } else { |
1666 | printk ("Half duplex\n"); | 1672 | printk ("Half duplex\n"); |
@@ -1681,9 +1687,9 @@ mii_get_media_pcs (struct net_device *dev) | |||
1681 | static int | 1687 | static int |
1682 | mii_set_media_pcs (struct net_device *dev) | 1688 | mii_set_media_pcs (struct net_device *dev) |
1683 | { | 1689 | { |
1684 | BMCR_t bmcr; | 1690 | __u16 bmcr; |
1685 | ESR_t esr; | 1691 | __u16 esr; |
1686 | ANAR_PCS_t anar; | 1692 | __u16 anar; |
1687 | int phy_addr; | 1693 | int phy_addr; |
1688 | struct netdev_private *np; | 1694 | struct netdev_private *np; |
1689 | np = netdev_priv(dev); | 1695 | np = netdev_priv(dev); |
@@ -1692,41 +1698,37 @@ mii_set_media_pcs (struct net_device *dev) | |||
1692 | /* Auto-Negotiation? */ | 1698 | /* Auto-Negotiation? */ |
1693 | if (np->an_enable) { | 1699 | if (np->an_enable) { |
1694 | /* Advertise capabilities */ | 1700 | /* Advertise capabilities */ |
1695 | esr.image = mii_read (dev, phy_addr, PCS_ESR); | 1701 | esr = mii_read (dev, phy_addr, PCS_ESR); |
1696 | anar.image = mii_read (dev, phy_addr, MII_ANAR); | 1702 | anar = mii_read (dev, phy_addr, MII_ANAR) & |
1697 | anar.bits.half_duplex = | 1703 | ~PCS_ANAR_HALF_DUPLEX & |
1698 | esr.bits.media_1000BT_HD | esr.bits.media_1000BX_HD; | 1704 | ~PCS_ANAR_FULL_DUPLEX; |
1699 | anar.bits.full_duplex = | 1705 | if (esr & (MII_ESR_1000BT_HD | MII_ESR_1000BX_HD)) |
1700 | esr.bits.media_1000BT_FD | esr.bits.media_1000BX_FD; | 1706 | anar |= PCS_ANAR_HALF_DUPLEX; |
1701 | anar.bits.pause = 1; | 1707 | if (esr & (MII_ESR_1000BT_FD | MII_ESR_1000BX_FD)) |
1702 | anar.bits.asymmetric = 1; | 1708 | anar |= PCS_ANAR_FULL_DUPLEX; |
1703 | mii_write (dev, phy_addr, MII_ANAR, anar.image); | 1709 | anar |= PCS_ANAR_PAUSE | PCS_ANAR_ASYMMETRIC; |
1710 | mii_write (dev, phy_addr, MII_ANAR, anar); | ||
1704 | 1711 | ||
1705 | /* Soft reset PHY */ | 1712 | /* Soft reset PHY */ |
1706 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); | 1713 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); |
1707 | bmcr.image = 0; | 1714 | bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN | |
1708 | bmcr.bits.an_enable = 1; | 1715 | MII_BMCR_RESET; |
1709 | bmcr.bits.restart_an = 1; | 1716 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1710 | bmcr.bits.reset = 1; | ||
1711 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | ||
1712 | mdelay(1); | 1717 | mdelay(1); |
1713 | } else { | 1718 | } else { |
1714 | /* Force speed setting */ | 1719 | /* Force speed setting */ |
1715 | /* PHY Reset */ | 1720 | /* PHY Reset */ |
1716 | bmcr.image = 0; | 1721 | bmcr = MII_BMCR_RESET; |
1717 | bmcr.bits.reset = 1; | 1722 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1718 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | ||
1719 | mdelay(10); | 1723 | mdelay(10); |
1720 | bmcr.image = 0; | ||
1721 | bmcr.bits.an_enable = 0; | ||
1722 | if (np->full_duplex) { | 1724 | if (np->full_duplex) { |
1723 | bmcr.bits.duplex_mode = 1; | 1725 | bmcr = MII_BMCR_DUPLEX_MODE; |
1724 | printk (KERN_INFO "Manual full duplex\n"); | 1726 | printk (KERN_INFO "Manual full duplex\n"); |
1725 | } else { | 1727 | } else { |
1726 | bmcr.bits.duplex_mode = 0; | 1728 | bmcr = 0; |
1727 | printk (KERN_INFO "Manual half duplex\n"); | 1729 | printk (KERN_INFO "Manual half duplex\n"); |
1728 | } | 1730 | } |
1729 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1731 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1730 | mdelay(10); | 1732 | mdelay(10); |
1731 | 1733 | ||
1732 | /* Advertise nothing */ | 1734 | /* Advertise nothing */ |
@@ -1762,7 +1764,7 @@ rio_close (struct net_device *dev) | |||
1762 | skb = np->rx_skbuff[i]; | 1764 | skb = np->rx_skbuff[i]; |
1763 | if (skb) { | 1765 | if (skb) { |
1764 | pci_unmap_single(np->pdev, | 1766 | pci_unmap_single(np->pdev, |
1765 | np->rx_ring[i].fraginfo & DMA_48BIT_MASK, | 1767 | desc_to_dma(&np->rx_ring[i]), |
1766 | skb->len, PCI_DMA_FROMDEVICE); | 1768 | skb->len, PCI_DMA_FROMDEVICE); |
1767 | dev_kfree_skb (skb); | 1769 | dev_kfree_skb (skb); |
1768 | np->rx_skbuff[i] = NULL; | 1770 | np->rx_skbuff[i] = NULL; |
@@ -1772,7 +1774,7 @@ rio_close (struct net_device *dev) | |||
1772 | skb = np->tx_skbuff[i]; | 1774 | skb = np->tx_skbuff[i]; |
1773 | if (skb) { | 1775 | if (skb) { |
1774 | pci_unmap_single(np->pdev, | 1776 | pci_unmap_single(np->pdev, |
1775 | np->tx_ring[i].fraginfo & DMA_48BIT_MASK, | 1777 | desc_to_dma(&np->tx_ring[i]), |
1776 | skb->len, PCI_DMA_TODEVICE); | 1778 | skb->len, PCI_DMA_TODEVICE); |
1777 | dev_kfree_skb (skb); | 1779 | dev_kfree_skb (skb); |
1778 | np->tx_skbuff[i] = NULL; | 1780 | np->tx_skbuff[i] = NULL; |
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h index 5b801775f42d..d66c605b4075 100644 --- a/drivers/net/dl2k.h +++ b/drivers/net/dl2k.h | |||
@@ -298,23 +298,6 @@ enum _pcs_reg { | |||
298 | }; | 298 | }; |
299 | 299 | ||
300 | /* Basic Mode Control Register */ | 300 | /* Basic Mode Control Register */ |
301 | typedef union t_MII_BMCR { | ||
302 | u16 image; | ||
303 | struct { | ||
304 | u16 _bit_5_0:6; // bit 5:0 | ||
305 | u16 speed1000:1; // bit 6 | ||
306 | u16 col_test_enable:1; // bit 7 | ||
307 | u16 duplex_mode:1; // bit 8 | ||
308 | u16 restart_an:1; // bit 9 | ||
309 | u16 isolate:1; // bit 10 | ||
310 | u16 power_down:1; // bit 11 | ||
311 | u16 an_enable:1; // bit 12 | ||
312 | u16 speed100:1; // bit 13 | ||
313 | u16 loopback:1; // bit 14 | ||
314 | u16 reset:1; // bit 15 | ||
315 | } bits; | ||
316 | } BMCR_t, *PBMCR_t; | ||
317 | |||
318 | enum _mii_bmcr { | 301 | enum _mii_bmcr { |
319 | MII_BMCR_RESET = 0x8000, | 302 | MII_BMCR_RESET = 0x8000, |
320 | MII_BMCR_LOOP_BACK = 0x4000, | 303 | MII_BMCR_LOOP_BACK = 0x4000, |
@@ -333,28 +316,6 @@ enum _mii_bmcr { | |||
333 | }; | 316 | }; |
334 | 317 | ||
335 | /* Basic Mode Status Register */ | 318 | /* Basic Mode Status Register */ |
336 | typedef union t_MII_BMSR { | ||
337 | u16 image; | ||
338 | struct { | ||
339 | u16 ext_capability:1; // bit 0 | ||
340 | u16 japper_detect:1; // bit 1 | ||
341 | u16 link_status:1; // bit 2 | ||
342 | u16 an_ability:1; // bit 3 | ||
343 | u16 remote_fault:1; // bit 4 | ||
344 | u16 an_complete:1; // bit 5 | ||
345 | u16 preamble_supp:1; // bit 6 | ||
346 | u16 _bit_7:1; // bit 7 | ||
347 | u16 ext_status:1; // bit 8 | ||
348 | u16 media_100BT2_HD:1; // bit 9 | ||
349 | u16 media_100BT2_FD:1; // bit 10 | ||
350 | u16 media_10BT_HD:1; // bit 11 | ||
351 | u16 media_10BT_FD:1; // bit 12 | ||
352 | u16 media_100BX_HD:1; // bit 13 | ||
353 | u16 media_100BX_FD:1; // bit 14 | ||
354 | u16 media_100BT4:1; // bit 15 | ||
355 | } bits; | ||
356 | } BMSR_t, *PBMSR_t; | ||
357 | |||
358 | enum _mii_bmsr { | 319 | enum _mii_bmsr { |
359 | MII_BMSR_100BT4 = 0x8000, | 320 | MII_BMSR_100BT4 = 0x8000, |
360 | MII_BMSR_100BX_FD = 0x4000, | 321 | MII_BMSR_100BX_FD = 0x4000, |
@@ -374,24 +335,6 @@ enum _mii_bmsr { | |||
374 | }; | 335 | }; |
375 | 336 | ||
376 | /* ANAR */ | 337 | /* ANAR */ |
377 | typedef union t_MII_ANAR { | ||
378 | u16 image; | ||
379 | struct { | ||
380 | u16 selector:5; // bit 4:0 | ||
381 | u16 media_10BT_HD:1; // bit 5 | ||
382 | u16 media_10BT_FD:1; // bit 6 | ||
383 | u16 media_100BX_HD:1; // bit 7 | ||
384 | u16 media_100BX_FD:1; // bit 8 | ||
385 | u16 media_100BT4:1; // bit 9 | ||
386 | u16 pause:1; // bit 10 | ||
387 | u16 asymmetric:1; // bit 11 | ||
388 | u16 _bit12:1; // bit 12 | ||
389 | u16 remote_fault:1; // bit 13 | ||
390 | u16 _bit14:1; // bit 14 | ||
391 | u16 next_page:1; // bit 15 | ||
392 | } bits; | ||
393 | } ANAR_t, *PANAR_t; | ||
394 | |||
395 | enum _mii_anar { | 338 | enum _mii_anar { |
396 | MII_ANAR_NEXT_PAGE = 0x8000, | 339 | MII_ANAR_NEXT_PAGE = 0x8000, |
397 | MII_ANAR_REMOTE_FAULT = 0x4000, | 340 | MII_ANAR_REMOTE_FAULT = 0x4000, |
@@ -407,24 +350,6 @@ enum _mii_anar { | |||
407 | }; | 350 | }; |
408 | 351 | ||
409 | /* ANLPAR */ | 352 | /* ANLPAR */ |
410 | typedef union t_MII_ANLPAR { | ||
411 | u16 image; | ||
412 | struct { | ||
413 | u16 selector:5; // bit 4:0 | ||
414 | u16 media_10BT_HD:1; // bit 5 | ||
415 | u16 media_10BT_FD:1; // bit 6 | ||
416 | u16 media_100BX_HD:1; // bit 7 | ||
417 | u16 media_100BX_FD:1; // bit 8 | ||
418 | u16 media_100BT4:1; // bit 9 | ||
419 | u16 pause:1; // bit 10 | ||
420 | u16 asymmetric:1; // bit 11 | ||
421 | u16 _bit12:1; // bit 12 | ||
422 | u16 remote_fault:1; // bit 13 | ||
423 | u16 _bit14:1; // bit 14 | ||
424 | u16 next_page:1; // bit 15 | ||
425 | } bits; | ||
426 | } ANLPAR_t, *PANLPAR_t; | ||
427 | |||
428 | enum _mii_anlpar { | 353 | enum _mii_anlpar { |
429 | MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE, | 354 | MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE, |
430 | MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT, | 355 | MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT, |
@@ -439,18 +364,6 @@ enum _mii_anlpar { | |||
439 | }; | 364 | }; |
440 | 365 | ||
441 | /* Auto-Negotiation Expansion Register */ | 366 | /* Auto-Negotiation Expansion Register */ |
442 | typedef union t_MII_ANER { | ||
443 | u16 image; | ||
444 | struct { | ||
445 | u16 lp_negotiable:1; // bit 0 | ||
446 | u16 page_received:1; // bit 1 | ||
447 | u16 nextpagable:1; // bit 2 | ||
448 | u16 lp_nextpagable:1; // bit 3 | ||
449 | u16 pdetect_fault:1; // bit 4 | ||
450 | u16 _bit15_5:11; // bit 15:5 | ||
451 | } bits; | ||
452 | } ANER_t, *PANER_t; | ||
453 | |||
454 | enum _mii_aner { | 367 | enum _mii_aner { |
455 | MII_ANER_PAR_DETECT_FAULT = 0x0010, | 368 | MII_ANER_PAR_DETECT_FAULT = 0x0010, |
456 | MII_ANER_LP_NEXTPAGABLE = 0x0008, | 369 | MII_ANER_LP_NEXTPAGABLE = 0x0008, |
@@ -460,19 +373,6 @@ enum _mii_aner { | |||
460 | }; | 373 | }; |
461 | 374 | ||
462 | /* MASTER-SLAVE Control Register */ | 375 | /* MASTER-SLAVE Control Register */ |
463 | typedef union t_MII_MSCR { | ||
464 | u16 image; | ||
465 | struct { | ||
466 | u16 _bit_7_0:8; // bit 7:0 | ||
467 | u16 media_1000BT_HD:1; // bit 8 | ||
468 | u16 media_1000BT_FD:1; // bit 9 | ||
469 | u16 port_type:1; // bit 10 | ||
470 | u16 cfg_value:1; // bit 11 | ||
471 | u16 cfg_enable:1; // bit 12 | ||
472 | u16 test_mode:3; // bit 15:13 | ||
473 | } bits; | ||
474 | } MSCR_t, *PMSCR_t; | ||
475 | |||
476 | enum _mii_mscr { | 376 | enum _mii_mscr { |
477 | MII_MSCR_TEST_MODE = 0xe000, | 377 | MII_MSCR_TEST_MODE = 0xe000, |
478 | MII_MSCR_CFG_ENABLE = 0x1000, | 378 | MII_MSCR_CFG_ENABLE = 0x1000, |
@@ -483,20 +383,6 @@ enum _mii_mscr { | |||
483 | }; | 383 | }; |
484 | 384 | ||
485 | /* MASTER-SLAVE Status Register */ | 385 | /* MASTER-SLAVE Status Register */ |
486 | typedef union t_MII_MSSR { | ||
487 | u16 image; | ||
488 | struct { | ||
489 | u16 idle_err_count:8; // bit 7:0 | ||
490 | u16 _bit_9_8:2; // bit 9:8 | ||
491 | u16 lp_1000BT_HD:1; // bit 10 | ||
492 | u16 lp_1000BT_FD:1; // bit 11 | ||
493 | u16 remote_rcv_status:1; // bit 12 | ||
494 | u16 local_rcv_status:1; // bit 13 | ||
495 | u16 cfg_resolution:1; // bit 14 | ||
496 | u16 cfg_fault:1; // bit 15 | ||
497 | } bits; | ||
498 | } MSSR_t, *PMSSR_t; | ||
499 | |||
500 | enum _mii_mssr { | 386 | enum _mii_mssr { |
501 | MII_MSSR_CFG_FAULT = 0x8000, | 387 | MII_MSSR_CFG_FAULT = 0x8000, |
502 | MII_MSSR_CFG_RES = 0x4000, | 388 | MII_MSSR_CFG_RES = 0x4000, |
@@ -508,17 +394,6 @@ enum _mii_mssr { | |||
508 | }; | 394 | }; |
509 | 395 | ||
510 | /* IEEE Extened Status Register */ | 396 | /* IEEE Extened Status Register */ |
511 | typedef union t_MII_ESR { | ||
512 | u16 image; | ||
513 | struct { | ||
514 | u16 _bit_11_0:12; // bit 11:0 | ||
515 | u16 media_1000BT_HD:2; // bit 12 | ||
516 | u16 media_1000BT_FD:1; // bit 13 | ||
517 | u16 media_1000BX_HD:1; // bit 14 | ||
518 | u16 media_1000BX_FD:1; // bit 15 | ||
519 | } bits; | ||
520 | } ESR_t, *PESR_t; | ||
521 | |||
522 | enum _mii_esr { | 397 | enum _mii_esr { |
523 | MII_ESR_1000BX_FD = 0x8000, | 398 | MII_ESR_1000BX_FD = 0x8000, |
524 | MII_ESR_1000BX_HD = 0x4000, | 399 | MII_ESR_1000BX_HD = 0x4000, |
@@ -526,6 +401,7 @@ enum _mii_esr { | |||
526 | MII_ESR_1000BT_HD = 0x1000, | 401 | MII_ESR_1000BT_HD = 0x1000, |
527 | }; | 402 | }; |
528 | /* PHY Specific Control Register */ | 403 | /* PHY Specific Control Register */ |
404 | #if 0 | ||
529 | typedef union t_MII_PHY_SCR { | 405 | typedef union t_MII_PHY_SCR { |
530 | u16 image; | 406 | u16 image; |
531 | struct { | 407 | struct { |
@@ -543,6 +419,7 @@ typedef union t_MII_PHY_SCR { | |||
543 | u16 xmit_fifo_depth:2; // bit 15:14 | 419 | u16 xmit_fifo_depth:2; // bit 15:14 |
544 | } bits; | 420 | } bits; |
545 | } PHY_SCR_t, *PPHY_SCR_t; | 421 | } PHY_SCR_t, *PPHY_SCR_t; |
422 | #endif | ||
546 | 423 | ||
547 | typedef enum t_MII_ADMIN_STATUS { | 424 | typedef enum t_MII_ADMIN_STATUS { |
548 | adm_reset, | 425 | adm_reset, |
@@ -556,21 +433,6 @@ typedef enum t_MII_ADMIN_STATUS { | |||
556 | /* PCS control and status registers bitmap as the same as MII */ | 433 | /* PCS control and status registers bitmap as the same as MII */ |
557 | /* PCS Extended Status register bitmap as the same as MII */ | 434 | /* PCS Extended Status register bitmap as the same as MII */ |
558 | /* PCS ANAR */ | 435 | /* PCS ANAR */ |
559 | typedef union t_PCS_ANAR { | ||
560 | u16 image; | ||
561 | struct { | ||
562 | u16 _bit_4_0:5; // bit 4:0 | ||
563 | u16 full_duplex:1; // bit 5 | ||
564 | u16 half_duplex:1; // bit 6 | ||
565 | u16 asymmetric:1; // bit 7 | ||
566 | u16 pause:1; // bit 8 | ||
567 | u16 _bit_11_9:3; // bit 11:9 | ||
568 | u16 remote_fault:2; // bit 13:12 | ||
569 | u16 _bit_14:1; // bit 14 | ||
570 | u16 next_page:1; // bit 15 | ||
571 | } bits; | ||
572 | } ANAR_PCS_t, *PANAR_PCS_t; | ||
573 | |||
574 | enum _pcs_anar { | 436 | enum _pcs_anar { |
575 | PCS_ANAR_NEXT_PAGE = 0x8000, | 437 | PCS_ANAR_NEXT_PAGE = 0x8000, |
576 | PCS_ANAR_REMOTE_FAULT = 0x3000, | 438 | PCS_ANAR_REMOTE_FAULT = 0x3000, |
@@ -580,21 +442,6 @@ enum _pcs_anar { | |||
580 | PCS_ANAR_FULL_DUPLEX = 0x0020, | 442 | PCS_ANAR_FULL_DUPLEX = 0x0020, |
581 | }; | 443 | }; |
582 | /* PCS ANLPAR */ | 444 | /* PCS ANLPAR */ |
583 | typedef union t_PCS_ANLPAR { | ||
584 | u16 image; | ||
585 | struct { | ||
586 | u16 _bit_4_0:5; // bit 4:0 | ||
587 | u16 full_duplex:1; // bit 5 | ||
588 | u16 half_duplex:1; // bit 6 | ||
589 | u16 asymmetric:1; // bit 7 | ||
590 | u16 pause:1; // bit 8 | ||
591 | u16 _bit_11_9:3; // bit 11:9 | ||
592 | u16 remote_fault:2; // bit 13:12 | ||
593 | u16 _bit_14:1; // bit 14 | ||
594 | u16 next_page:1; // bit 15 | ||
595 | } bits; | ||
596 | } ANLPAR_PCS_t, *PANLPAR_PCS_t; | ||
597 | |||
598 | enum _pcs_anlpar { | 445 | enum _pcs_anlpar { |
599 | PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE, | 446 | PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE, |
600 | PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT, | 447 | PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT, |
@@ -633,9 +480,9 @@ struct mii_data { | |||
633 | 480 | ||
634 | /* The Rx and Tx buffer descriptors. */ | 481 | /* The Rx and Tx buffer descriptors. */ |
635 | struct netdev_desc { | 482 | struct netdev_desc { |
636 | u64 next_desc; | 483 | __le64 next_desc; |
637 | u64 status; | 484 | __le64 status; |
638 | u64 fraginfo; | 485 | __le64 fraginfo; |
639 | }; | 486 | }; |
640 | 487 | ||
641 | #define PRIV_ALIGN 15 /* Required alignment mask */ | 488 | #define PRIV_ALIGN 15 /* Required alignment mask */ |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 3dbaec680b46..b87402bc8308 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1991,13 +1991,12 @@ static int e100_poll(struct napi_struct *napi, int budget) | |||
1991 | struct nic *nic = container_of(napi, struct nic, napi); | 1991 | struct nic *nic = container_of(napi, struct nic, napi); |
1992 | struct net_device *netdev = nic->netdev; | 1992 | struct net_device *netdev = nic->netdev; |
1993 | unsigned int work_done = 0; | 1993 | unsigned int work_done = 0; |
1994 | int tx_cleaned; | ||
1995 | 1994 | ||
1996 | e100_rx_clean(nic, &work_done, budget); | 1995 | e100_rx_clean(nic, &work_done, budget); |
1997 | tx_cleaned = e100_tx_clean(nic); | 1996 | e100_tx_clean(nic); |
1998 | 1997 | ||
1999 | /* If no Rx and Tx cleanup work was done, exit polling mode. */ | 1998 | /* If budget not fully consumed, exit the polling mode */ |
2000 | if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { | 1999 | if (work_done < budget) { |
2001 | netif_rx_complete(netdev, napi); | 2000 | netif_rx_complete(netdev, napi); |
2002 | e100_enable_irq(nic); | 2001 | e100_enable_irq(nic); |
2003 | } | 2002 | } |
@@ -2214,13 +2213,11 @@ static void e100_get_drvinfo(struct net_device *netdev, | |||
2214 | strcpy(info->bus_info, pci_name(nic->pdev)); | 2213 | strcpy(info->bus_info, pci_name(nic->pdev)); |
2215 | } | 2214 | } |
2216 | 2215 | ||
2216 | #define E100_PHY_REGS 0x1C | ||
2217 | static int e100_get_regs_len(struct net_device *netdev) | 2217 | static int e100_get_regs_len(struct net_device *netdev) |
2218 | { | 2218 | { |
2219 | struct nic *nic = netdev_priv(netdev); | 2219 | struct nic *nic = netdev_priv(netdev); |
2220 | #define E100_PHY_REGS 0x1C | 2220 | return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf); |
2221 | #define E100_REGS_LEN 1 + E100_PHY_REGS + \ | ||
2222 | sizeof(nic->mem->dump_buf) / sizeof(u32) | ||
2223 | return E100_REGS_LEN * sizeof(u32); | ||
2224 | } | 2221 | } |
2225 | 2222 | ||
2226 | static void e100_get_regs(struct net_device *netdev, | 2223 | static void e100_get_regs(struct net_device *netdev, |
@@ -2739,8 +2736,9 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2739 | pci_enable_wake(pdev, PCI_D3cold, 0); | 2736 | pci_enable_wake(pdev, PCI_D3cold, 0); |
2740 | } | 2737 | } |
2741 | 2738 | ||
2742 | pci_disable_device(pdev); | ||
2743 | free_irq(pdev->irq, netdev); | 2739 | free_irq(pdev->irq, netdev); |
2740 | |||
2741 | pci_disable_device(pdev); | ||
2744 | pci_set_power_state(pdev, PCI_D3hot); | 2742 | pci_set_power_state(pdev, PCI_D3hot); |
2745 | 2743 | ||
2746 | return 0; | 2744 | return 0; |
@@ -2782,6 +2780,8 @@ static void e100_shutdown(struct pci_dev *pdev) | |||
2782 | pci_enable_wake(pdev, PCI_D3cold, 0); | 2780 | pci_enable_wake(pdev, PCI_D3cold, 0); |
2783 | } | 2781 | } |
2784 | 2782 | ||
2783 | free_irq(pdev->irq, netdev); | ||
2784 | |||
2785 | pci_disable_device(pdev); | 2785 | pci_disable_device(pdev); |
2786 | pci_set_power_state(pdev, PCI_D3hot); | 2786 | pci_set_power_state(pdev, PCI_D3hot); |
2787 | } | 2787 | } |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 667f18bcc172..b83ccce8a9b7 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -1923,7 +1923,7 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | |||
1923 | switch (stringset) { | 1923 | switch (stringset) { |
1924 | case ETH_SS_TEST: | 1924 | case ETH_SS_TEST: |
1925 | memcpy(data, *e1000_gstrings_test, | 1925 | memcpy(data, *e1000_gstrings_test, |
1926 | E1000_TEST_LEN*ETH_GSTRING_LEN); | 1926 | sizeof(e1000_gstrings_test)); |
1927 | break; | 1927 | break; |
1928 | case ETH_SS_STATS: | 1928 | case ETH_SS_STATS: |
1929 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 1929 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index cf39473ef90a..76c0fa690cc6 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -632,6 +632,7 @@ e1000_down(struct e1000_adapter *adapter) | |||
632 | 632 | ||
633 | #ifdef CONFIG_E1000_NAPI | 633 | #ifdef CONFIG_E1000_NAPI |
634 | napi_disable(&adapter->napi); | 634 | napi_disable(&adapter->napi); |
635 | atomic_set(&adapter->irq_sem, 0); | ||
635 | #endif | 636 | #endif |
636 | e1000_irq_disable(adapter); | 637 | e1000_irq_disable(adapter); |
637 | 638 | ||
@@ -3924,27 +3925,24 @@ e1000_clean(struct napi_struct *napi, int budget) | |||
3924 | /* Must NOT use netdev_priv macro here. */ | 3925 | /* Must NOT use netdev_priv macro here. */ |
3925 | adapter = poll_dev->priv; | 3926 | adapter = poll_dev->priv; |
3926 | 3927 | ||
3927 | /* Keep link state information with original netdev */ | ||
3928 | if (!netif_carrier_ok(poll_dev)) | ||
3929 | goto quit_polling; | ||
3930 | |||
3931 | /* e1000_clean is called per-cpu. This lock protects | 3928 | /* e1000_clean is called per-cpu. This lock protects |
3932 | * tx_ring[0] from being cleaned by multiple cpus | 3929 | * tx_ring[0] from being cleaned by multiple cpus |
3933 | * simultaneously. A failure obtaining the lock means | 3930 | * simultaneously. A failure obtaining the lock means |
3934 | * tx_ring[0] is currently being cleaned anyway. */ | 3931 | * tx_ring[0] is currently being cleaned anyway. */ |
3935 | if (spin_trylock(&adapter->tx_queue_lock)) { | 3932 | if (spin_trylock(&adapter->tx_queue_lock)) { |
3936 | tx_cleaned = e1000_clean_tx_irq(adapter, | 3933 | tx_cleaned = e1000_clean_tx_irq(adapter, |
3937 | &adapter->tx_ring[0]); | 3934 | &adapter->tx_ring[0]); |
3938 | spin_unlock(&adapter->tx_queue_lock); | 3935 | spin_unlock(&adapter->tx_queue_lock); |
3939 | } | 3936 | } |
3940 | 3937 | ||
3941 | adapter->clean_rx(adapter, &adapter->rx_ring[0], | 3938 | adapter->clean_rx(adapter, &adapter->rx_ring[0], |
3942 | &work_done, budget); | 3939 | &work_done, budget); |
3943 | 3940 | ||
3944 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 3941 | if (tx_cleaned) |
3945 | if ((!tx_cleaned && (work_done < budget)) || | 3942 | work_done = budget; |
3946 | !netif_running(poll_dev)) { | 3943 | |
3947 | quit_polling: | 3944 | /* If budget not fully consumed, exit the polling mode */ |
3945 | if (work_done < budget) { | ||
3948 | if (likely(adapter->itr_setting & 3)) | 3946 | if (likely(adapter->itr_setting & 3)) |
3949 | e1000_set_itr(adapter); | 3947 | e1000_set_itr(adapter); |
3950 | netif_rx_complete(poll_dev, napi); | 3948 | netif_rx_complete(poll_dev, napi); |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 6a39784e7ee2..87f9da1b6b4e 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -1739,7 +1739,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset, | |||
1739 | switch (stringset) { | 1739 | switch (stringset) { |
1740 | case ETH_SS_TEST: | 1740 | case ETH_SS_TEST: |
1741 | memcpy(data, *e1000_gstrings_test, | 1741 | memcpy(data, *e1000_gstrings_test, |
1742 | E1000_TEST_LEN*ETH_GSTRING_LEN); | 1742 | sizeof(e1000_gstrings_test)); |
1743 | break; | 1743 | break; |
1744 | case ETH_SS_STATS: | 1744 | case ETH_SS_STATS: |
1745 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 1745 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 4fd2e23720b6..9cc5a6b01bc1 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -1389,10 +1389,6 @@ static int e1000_clean(struct napi_struct *napi, int budget) | |||
1389 | /* Must NOT use netdev_priv macro here. */ | 1389 | /* Must NOT use netdev_priv macro here. */ |
1390 | adapter = poll_dev->priv; | 1390 | adapter = poll_dev->priv; |
1391 | 1391 | ||
1392 | /* Keep link state information with original netdev */ | ||
1393 | if (!netif_carrier_ok(poll_dev)) | ||
1394 | goto quit_polling; | ||
1395 | |||
1396 | /* e1000_clean is called per-cpu. This lock protects | 1392 | /* e1000_clean is called per-cpu. This lock protects |
1397 | * tx_ring from being cleaned by multiple cpus | 1393 | * tx_ring from being cleaned by multiple cpus |
1398 | * simultaneously. A failure obtaining the lock means | 1394 | * simultaneously. A failure obtaining the lock means |
@@ -1404,10 +1400,11 @@ static int e1000_clean(struct napi_struct *napi, int budget) | |||
1404 | 1400 | ||
1405 | adapter->clean_rx(adapter, &work_done, budget); | 1401 | adapter->clean_rx(adapter, &work_done, budget); |
1406 | 1402 | ||
1407 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 1403 | if (tx_cleaned) |
1408 | if ((!tx_cleaned && (work_done < budget)) || | 1404 | work_done = budget; |
1409 | !netif_running(poll_dev)) { | 1405 | |
1410 | quit_polling: | 1406 | /* If budget not fully consumed, exit the polling mode */ |
1407 | if (work_done < budget) { | ||
1411 | if (adapter->itr_setting & 3) | 1408 | if (adapter->itr_setting & 3) |
1412 | e1000_set_itr(adapter); | 1409 | e1000_set_itr(adapter); |
1413 | netif_rx_complete(poll_dev, napi); | 1410 | netif_rx_complete(poll_dev, napi); |
@@ -2186,6 +2183,7 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
2186 | msleep(10); | 2183 | msleep(10); |
2187 | 2184 | ||
2188 | napi_disable(&adapter->napi); | 2185 | napi_disable(&adapter->napi); |
2186 | atomic_set(&adapter->irq_sem, 0); | ||
2189 | e1000_irq_disable(adapter); | 2187 | e1000_irq_disable(adapter); |
2190 | 2188 | ||
2191 | del_timer_sync(&adapter->watchdog_timer); | 2189 | del_timer_sync(&adapter->watchdog_timer); |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index f78e5bf7cb33..5f82a4647eee 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0080" | 43 | #define DRV_VERSION "EHEA_0083" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f0319f1e8e05..869e1604b16e 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -136,7 +136,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev) | |||
136 | struct ehea_port *port = netdev_priv(dev); | 136 | struct ehea_port *port = netdev_priv(dev); |
137 | struct net_device_stats *stats = &port->stats; | 137 | struct net_device_stats *stats = &port->stats; |
138 | struct hcp_ehea_port_cb2 *cb2; | 138 | struct hcp_ehea_port_cb2 *cb2; |
139 | u64 hret, rx_packets; | 139 | u64 hret, rx_packets, tx_packets; |
140 | int i; | 140 | int i; |
141 | 141 | ||
142 | memset(stats, 0, sizeof(*stats)); | 142 | memset(stats, 0, sizeof(*stats)); |
@@ -162,7 +162,11 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev) | |||
162 | for (i = 0; i < port->num_def_qps; i++) | 162 | for (i = 0; i < port->num_def_qps; i++) |
163 | rx_packets += port->port_res[i].rx_packets; | 163 | rx_packets += port->port_res[i].rx_packets; |
164 | 164 | ||
165 | stats->tx_packets = cb2->txucp + cb2->txmcp + cb2->txbcp; | 165 | tx_packets = 0; |
166 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) | ||
167 | tx_packets += port->port_res[i].tx_packets; | ||
168 | |||
169 | stats->tx_packets = tx_packets; | ||
166 | stats->multicast = cb2->rxmcp; | 170 | stats->multicast = cb2->rxmcp; |
167 | stats->rx_errors = cb2->rxuerr; | 171 | stats->rx_errors = cb2->rxuerr; |
168 | stats->rx_bytes = cb2->rxo; | 172 | stats->rx_bytes = cb2->rxo; |
@@ -406,11 +410,6 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq, | |||
406 | if (cqe->status & EHEA_CQE_STAT_ERR_CRC) | 410 | if (cqe->status & EHEA_CQE_STAT_ERR_CRC) |
407 | pr->p_stats.err_frame_crc++; | 411 | pr->p_stats.err_frame_crc++; |
408 | 412 | ||
409 | if (netif_msg_rx_err(pr->port)) { | ||
410 | ehea_error("CQE Error for QP %d", pr->qp->init_attr.qp_nr); | ||
411 | ehea_dump(cqe, sizeof(*cqe), "CQE"); | ||
412 | } | ||
413 | |||
414 | if (rq == 2) { | 413 | if (rq == 2) { |
415 | *processed_rq2 += 1; | 414 | *processed_rq2 += 1; |
416 | skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe); | 415 | skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe); |
@@ -422,7 +421,11 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq, | |||
422 | } | 421 | } |
423 | 422 | ||
424 | if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) { | 423 | if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) { |
425 | ehea_error("Critical receive error. Resetting port."); | 424 | if (netif_msg_rx_err(pr->port)) { |
425 | ehea_error("Critical receive error for QP %d. " | ||
426 | "Resetting port.", pr->qp->init_attr.qp_nr); | ||
427 | ehea_dump(cqe, sizeof(*cqe), "CQE"); | ||
428 | } | ||
426 | schedule_work(&pr->port->reset_task); | 429 | schedule_work(&pr->port->reset_task); |
427 | return 1; | 430 | return 1; |
428 | } | 431 | } |
@@ -2000,6 +2003,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2000 | } | 2003 | } |
2001 | 2004 | ||
2002 | ehea_post_swqe(pr->qp, swqe); | 2005 | ehea_post_swqe(pr->qp, swqe); |
2006 | pr->tx_packets++; | ||
2003 | 2007 | ||
2004 | if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { | 2008 | if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { |
2005 | spin_lock_irqsave(&pr->netif_queue, flags); | 2009 | spin_lock_irqsave(&pr->netif_queue, flags); |
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index 562de0ebdd85..bc62d389c166 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h | |||
@@ -145,8 +145,8 @@ struct ehea_rwqe { | |||
145 | #define EHEA_CQE_VLAN_TAG_XTRACT 0x0400 | 145 | #define EHEA_CQE_VLAN_TAG_XTRACT 0x0400 |
146 | 146 | ||
147 | #define EHEA_CQE_TYPE_RQ 0x60 | 147 | #define EHEA_CQE_TYPE_RQ 0x60 |
148 | #define EHEA_CQE_STAT_ERR_MASK 0x720F | 148 | #define EHEA_CQE_STAT_ERR_MASK 0x700F |
149 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0x1F | 149 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF |
150 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 | 150 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 |
151 | #define EHEA_CQE_STAT_ERR_IP 0x2000 | 151 | #define EHEA_CQE_STAT_ERR_IP 0x2000 |
152 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 | 152 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index ecdd3fc8d70c..0b365b8d947b 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -1273,7 +1273,7 @@ rx_action: | |||
1273 | 1273 | ||
1274 | epic_rx_err(dev, ep); | 1274 | epic_rx_err(dev, ep); |
1275 | 1275 | ||
1276 | if (netif_running(dev) && (work_done < budget)) { | 1276 | if (work_done < budget) { |
1277 | unsigned long flags; | 1277 | unsigned long flags; |
1278 | int more; | 1278 | int more; |
1279 | 1279 | ||
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c index 8d2904fa5789..ab9637ab3a8d 100644 --- a/drivers/net/fec_8xx/fec_main.c +++ b/drivers/net/fec_8xx/fec_main.c | |||
@@ -476,11 +476,6 @@ static int fec_enet_rx_common(struct fec_enet_private *ep, | |||
476 | __u16 pkt_len, sc; | 476 | __u16 pkt_len, sc; |
477 | int curidx; | 477 | int curidx; |
478 | 478 | ||
479 | if (fpi->use_napi) { | ||
480 | if (!netif_running(dev)) | ||
481 | return 0; | ||
482 | } | ||
483 | |||
484 | /* | 479 | /* |
485 | * First, grab all of the stats for the incoming packet. | 480 | * First, grab all of the stats for the incoming packet. |
486 | * These get messed up if we get called due to a busy condition. | 481 | * These get messed up if we get called due to a busy condition. |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index a8a0ee220da6..f91ee700e605 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -422,7 +422,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) | |||
422 | 422 | ||
423 | rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status, | 423 | rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status, |
424 | (struct bcom_bd **)&bd); | 424 | (struct bcom_bd **)&bd); |
425 | dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE); | 425 | dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len, DMA_FROM_DEVICE); |
426 | 426 | ||
427 | /* Test for errors in received frame */ | 427 | /* Test for errors in received frame */ |
428 | if (status & BCOM_FEC_RX_BD_ERRORS) { | 428 | if (status & BCOM_FEC_RX_BD_ERRORS) { |
@@ -467,7 +467,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) | |||
467 | bcom_prepare_next_buffer(priv->rx_dmatsk); | 467 | bcom_prepare_next_buffer(priv->rx_dmatsk); |
468 | 468 | ||
469 | bd->status = FEC_RX_BUFFER_SIZE; | 469 | bd->status = FEC_RX_BUFFER_SIZE; |
470 | bd->skb_pa = dma_map_single(&dev->dev, rskb->data, | 470 | bd->skb_pa = dma_map_single(&dev->dev, skb->data, |
471 | FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); | 471 | FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); |
472 | 472 | ||
473 | bcom_submit_next_buffer(priv->rx_dmatsk, skb); | 473 | bcom_submit_next_buffer(priv->rx_dmatsk, skb); |
@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev) | |||
568 | struct mpc52xx_fec __iomem *fec = priv->fec; | 568 | struct mpc52xx_fec __iomem *fec = priv->fec; |
569 | 569 | ||
570 | out_be32(&fec->mib_control, FEC_MIB_DISABLE); | 570 | out_be32(&fec->mib_control, FEC_MIB_DISABLE); |
571 | memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 - | 571 | memset_io(&fec->rmon_t_drop, 0, |
572 | (__force u32)&fec->rmon_t_drop); | 572 | offsetof(struct mpc52xx_fec, reserved10) - |
573 | offsetof(struct mpc52xx_fec, rmon_t_drop)); | ||
573 | out_be32(&fec->mib_control, 0); | 574 | out_be32(&fec->mib_control, 0); |
574 | 575 | ||
575 | memset(&dev->stats, 0, sizeof(dev->stats)); | 576 | memset(&dev->stats, 0, sizeof(dev->stats)); |
@@ -971,6 +972,8 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) | |||
971 | 972 | ||
972 | mpc52xx_fec_reset_stats(ndev); | 973 | mpc52xx_fec_reset_stats(ndev); |
973 | 974 | ||
975 | SET_NETDEV_DEV(ndev, &op->dev); | ||
976 | |||
974 | /* Register the new network device */ | 977 | /* Register the new network device */ |
975 | rv = register_netdev(ndev); | 978 | rv = register_netdev(ndev); |
976 | if (rv < 0) | 979 | if (rv < 0) |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 92ce2e38f0d5..f84c752997a4 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -5199,10 +5199,6 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5199 | dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; | 5199 | dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; |
5200 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; | 5200 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; |
5201 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; | 5201 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; |
5202 | /* set permanent address to be correct aswell */ | ||
5203 | np->orig_mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) + | ||
5204 | (dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24); | ||
5205 | np->orig_mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8); | ||
5206 | writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); | 5202 | writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); |
5207 | } | 5203 | } |
5208 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 5204 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
@@ -5286,19 +5282,15 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5286 | if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) { | 5282 | if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) { |
5287 | np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST; | 5283 | np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST; |
5288 | dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use); | 5284 | dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use); |
5289 | for (i = 0; i < 5000; i++) { | 5285 | if (nv_mgmt_acquire_sema(dev)) { |
5290 | msleep(1); | 5286 | /* management unit setup the phy already? */ |
5291 | if (nv_mgmt_acquire_sema(dev)) { | 5287 | if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) == |
5292 | /* management unit setup the phy already? */ | 5288 | NVREG_XMITCTL_SYNC_PHY_INIT) { |
5293 | if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) == | 5289 | /* phy is inited by mgmt unit */ |
5294 | NVREG_XMITCTL_SYNC_PHY_INIT) { | 5290 | phyinitialized = 1; |
5295 | /* phy is inited by mgmt unit */ | 5291 | dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev)); |
5296 | phyinitialized = 1; | 5292 | } else { |
5297 | dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev)); | 5293 | /* we need to init the phy */ |
5298 | } else { | ||
5299 | /* we need to init the phy */ | ||
5300 | } | ||
5301 | break; | ||
5302 | } | 5294 | } |
5303 | } | 5295 | } |
5304 | } | 5296 | } |
@@ -5418,6 +5410,8 @@ static void __devexit nv_remove(struct pci_dev *pci_dev) | |||
5418 | */ | 5410 | */ |
5419 | writel(np->orig_mac[0], base + NvRegMacAddrA); | 5411 | writel(np->orig_mac[0], base + NvRegMacAddrA); |
5420 | writel(np->orig_mac[1], base + NvRegMacAddrB); | 5412 | writel(np->orig_mac[1], base + NvRegMacAddrB); |
5413 | writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV, | ||
5414 | base + NvRegTransmitPoll); | ||
5421 | 5415 | ||
5422 | /* free all structures */ | 5416 | /* free all structures */ |
5423 | free_rings(dev); | 5417 | free_rings(dev); |
@@ -5613,6 +5607,22 @@ static struct pci_device_id pci_tbl[] = { | |||
5613 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), | 5607 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), |
5614 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5608 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, |
5615 | }, | 5609 | }, |
5610 | { /* MCP79 Ethernet Controller */ | ||
5611 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), | ||
5612 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5613 | }, | ||
5614 | { /* MCP79 Ethernet Controller */ | ||
5615 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), | ||
5616 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5617 | }, | ||
5618 | { /* MCP79 Ethernet Controller */ | ||
5619 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), | ||
5620 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5621 | }, | ||
5622 | { /* MCP79 Ethernet Controller */ | ||
5623 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), | ||
5624 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5625 | }, | ||
5616 | {0,}, | 5626 | {0,}, |
5617 | }; | 5627 | }; |
5618 | 5628 | ||
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f2a4d399a6e5..c83bd6560088 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -96,9 +96,6 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget) | |||
96 | u16 pkt_len, sc; | 96 | u16 pkt_len, sc; |
97 | int curidx; | 97 | int curidx; |
98 | 98 | ||
99 | if (!netif_running(dev)) | ||
100 | return 0; | ||
101 | |||
102 | /* | 99 | /* |
103 | * First, grab all of the stats for the incoming packet. | 100 | * First, grab all of the stats for the incoming packet. |
104 | * These get messed up if we get called due to a busy condition. | 101 | * These get messed up if we get called due to a busy condition. |
@@ -897,14 +894,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
897 | static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 894 | static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
898 | { | 895 | { |
899 | struct fs_enet_private *fep = netdev_priv(dev); | 896 | struct fs_enet_private *fep = netdev_priv(dev); |
897 | |||
898 | if (!fep->phydev) | ||
899 | return -ENODEV; | ||
900 | |||
900 | return phy_ethtool_gset(fep->phydev, cmd); | 901 | return phy_ethtool_gset(fep->phydev, cmd); |
901 | } | 902 | } |
902 | 903 | ||
903 | static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 904 | static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
904 | { | 905 | { |
905 | struct fs_enet_private *fep = netdev_priv(dev); | 906 | struct fs_enet_private *fep = netdev_priv(dev); |
906 | phy_ethtool_sset(fep->phydev, cmd); | 907 | |
907 | return 0; | 908 | if (!fep->phydev) |
909 | return -ENODEV; | ||
910 | |||
911 | return phy_ethtool_sset(fep->phydev, cmd); | ||
908 | } | 912 | } |
909 | 913 | ||
910 | static int fs_nway_reset(struct net_device *dev) | 914 | static int fs_nway_reset(struct net_device *dev) |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index 03134f47a4eb..48f2f3005935 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -158,7 +158,7 @@ static int setup_data(struct net_device *dev) | |||
158 | { | 158 | { |
159 | struct fs_enet_private *fep = netdev_priv(dev); | 159 | struct fs_enet_private *fep = netdev_priv(dev); |
160 | 160 | ||
161 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | 161 | #ifndef CONFIG_PPC_CPM_NEW_BINDING |
162 | struct fs_platform_info *fpi = fep->fpi; | 162 | struct fs_platform_info *fpi = fep->fpi; |
163 | 163 | ||
164 | fep->scc.idx = fs_get_scc_index(fpi->fs_no); | 164 | fep->scc.idx = fs_get_scc_index(fpi->fs_no); |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 38268d7335a8..0431e9ed0fac 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -696,7 +696,7 @@ int startup_gfar(struct net_device *dev) | |||
696 | { | 696 | { |
697 | struct txbd8 *txbdp; | 697 | struct txbd8 *txbdp; |
698 | struct rxbd8 *rxbdp; | 698 | struct rxbd8 *rxbdp; |
699 | dma_addr_t addr; | 699 | dma_addr_t addr = 0; |
700 | unsigned long vaddr; | 700 | unsigned long vaddr; |
701 | int i; | 701 | int i; |
702 | struct gfar_private *priv = netdev_priv(dev); | 702 | struct gfar_private *priv = netdev_priv(dev); |
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index ed407c85708f..b53f6b6491b3 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -204,8 +204,10 @@ KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu> | |||
204 | /* Condensed bus+endian portability operations. */ | 204 | /* Condensed bus+endian portability operations. */ |
205 | #if ADDRLEN == 64 | 205 | #if ADDRLEN == 64 |
206 | #define cpu_to_leXX(addr) cpu_to_le64(addr) | 206 | #define cpu_to_leXX(addr) cpu_to_le64(addr) |
207 | #define leXX_to_cpu(addr) le64_to_cpu(addr) | ||
207 | #else | 208 | #else |
208 | #define cpu_to_leXX(addr) cpu_to_le32(addr) | 209 | #define cpu_to_leXX(addr) cpu_to_le32(addr) |
210 | #define leXX_to_cpu(addr) le32_to_cpu(addr) | ||
209 | #endif | 211 | #endif |
210 | 212 | ||
211 | 213 | ||
@@ -465,12 +467,12 @@ enum intr_status_bits { | |||
465 | 467 | ||
466 | /* The Hamachi Rx and Tx buffer descriptors. */ | 468 | /* The Hamachi Rx and Tx buffer descriptors. */ |
467 | struct hamachi_desc { | 469 | struct hamachi_desc { |
468 | u32 status_n_length; | 470 | __le32 status_n_length; |
469 | #if ADDRLEN == 64 | 471 | #if ADDRLEN == 64 |
470 | u32 pad; | 472 | u32 pad; |
471 | u64 addr; | 473 | __le64 addr; |
472 | #else | 474 | #else |
473 | u32 addr; | 475 | __le32 addr; |
474 | #endif | 476 | #endif |
475 | }; | 477 | }; |
476 | 478 | ||
@@ -874,13 +876,13 @@ static int hamachi_open(struct net_device *dev) | |||
874 | 876 | ||
875 | #if ADDRLEN == 64 | 877 | #if ADDRLEN == 64 |
876 | /* writellll anyone ? */ | 878 | /* writellll anyone ? */ |
877 | writel(cpu_to_le64(hmp->rx_ring_dma), ioaddr + RxPtr); | 879 | writel(hmp->rx_ring_dma, ioaddr + RxPtr); |
878 | writel(cpu_to_le64(hmp->rx_ring_dma) >> 32, ioaddr + RxPtr + 4); | 880 | writel(hmp->rx_ring_dma >> 32, ioaddr + RxPtr + 4); |
879 | writel(cpu_to_le64(hmp->tx_ring_dma), ioaddr + TxPtr); | 881 | writel(hmp->tx_ring_dma, ioaddr + TxPtr); |
880 | writel(cpu_to_le64(hmp->tx_ring_dma) >> 32, ioaddr + TxPtr + 4); | 882 | writel(hmp->tx_ring_dma >> 32, ioaddr + TxPtr + 4); |
881 | #else | 883 | #else |
882 | writel(cpu_to_le32(hmp->rx_ring_dma), ioaddr + RxPtr); | 884 | writel(hmp->rx_ring_dma, ioaddr + RxPtr); |
883 | writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr); | 885 | writel(hmp->tx_ring_dma, ioaddr + TxPtr); |
884 | #endif | 886 | #endif |
885 | 887 | ||
886 | /* TODO: It would make sense to organize this as words since the card | 888 | /* TODO: It would make sense to organize this as words since the card |
@@ -1019,8 +1021,8 @@ static inline int hamachi_tx(struct net_device *dev) | |||
1019 | skb = hmp->tx_skbuff[entry]; | 1021 | skb = hmp->tx_skbuff[entry]; |
1020 | if (skb) { | 1022 | if (skb) { |
1021 | pci_unmap_single(hmp->pci_dev, | 1023 | pci_unmap_single(hmp->pci_dev, |
1022 | hmp->tx_ring[entry].addr, skb->len, | 1024 | leXX_to_cpu(hmp->tx_ring[entry].addr), |
1023 | PCI_DMA_TODEVICE); | 1025 | skb->len, PCI_DMA_TODEVICE); |
1024 | dev_kfree_skb(skb); | 1026 | dev_kfree_skb(skb); |
1025 | hmp->tx_skbuff[entry] = NULL; | 1027 | hmp->tx_skbuff[entry] = NULL; |
1026 | } | 1028 | } |
@@ -1071,10 +1073,10 @@ static void hamachi_tx_timeout(struct net_device *dev) | |||
1071 | { | 1073 | { |
1072 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); | 1074 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); |
1073 | for (i = 0; i < RX_RING_SIZE; i++) | 1075 | for (i = 0; i < RX_RING_SIZE; i++) |
1074 | printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length); | 1076 | printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length)); |
1075 | printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); | 1077 | printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); |
1076 | for (i = 0; i < TX_RING_SIZE; i++) | 1078 | for (i = 0; i < TX_RING_SIZE; i++) |
1077 | printk(" %4.4x", hmp->tx_ring[i].status_n_length); | 1079 | printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length)); |
1078 | printk("\n"); | 1080 | printk("\n"); |
1079 | } | 1081 | } |
1080 | 1082 | ||
@@ -1099,14 +1101,15 @@ static void hamachi_tx_timeout(struct net_device *dev) | |||
1099 | struct sk_buff *skb; | 1101 | struct sk_buff *skb; |
1100 | 1102 | ||
1101 | if (i >= TX_RING_SIZE - 1) | 1103 | if (i >= TX_RING_SIZE - 1) |
1102 | hmp->tx_ring[i].status_n_length = cpu_to_le32( | 1104 | hmp->tx_ring[i].status_n_length = |
1103 | DescEndRing | | 1105 | cpu_to_le32(DescEndRing) | |
1104 | (hmp->tx_ring[i].status_n_length & 0x0000FFFF)); | 1106 | (hmp->tx_ring[i].status_n_length & |
1107 | cpu_to_le32(0x0000ffff)); | ||
1105 | else | 1108 | else |
1106 | hmp->tx_ring[i].status_n_length &= 0x0000ffff; | 1109 | hmp->tx_ring[i].status_n_length &= cpu_to_le32(0x0000ffff); |
1107 | skb = hmp->tx_skbuff[i]; | 1110 | skb = hmp->tx_skbuff[i]; |
1108 | if (skb){ | 1111 | if (skb){ |
1109 | pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr, | 1112 | pci_unmap_single(hmp->pci_dev, leXX_to_cpu(hmp->tx_ring[i].addr), |
1110 | skb->len, PCI_DMA_TODEVICE); | 1113 | skb->len, PCI_DMA_TODEVICE); |
1111 | dev_kfree_skb(skb); | 1114 | dev_kfree_skb(skb); |
1112 | hmp->tx_skbuff[i] = NULL; | 1115 | hmp->tx_skbuff[i] = NULL; |
@@ -1128,7 +1131,8 @@ static void hamachi_tx_timeout(struct net_device *dev) | |||
1128 | struct sk_buff *skb = hmp->rx_skbuff[i]; | 1131 | struct sk_buff *skb = hmp->rx_skbuff[i]; |
1129 | 1132 | ||
1130 | if (skb){ | 1133 | if (skb){ |
1131 | pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr, | 1134 | pci_unmap_single(hmp->pci_dev, |
1135 | leXX_to_cpu(hmp->rx_ring[i].addr), | ||
1132 | hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1136 | hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1133 | dev_kfree_skb(skb); | 1137 | dev_kfree_skb(skb); |
1134 | hmp->rx_skbuff[i] = NULL; | 1138 | hmp->rx_skbuff[i] = NULL; |
@@ -1420,7 +1424,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance) | |||
1420 | /* Free the original skb. */ | 1424 | /* Free the original skb. */ |
1421 | if (skb){ | 1425 | if (skb){ |
1422 | pci_unmap_single(hmp->pci_dev, | 1426 | pci_unmap_single(hmp->pci_dev, |
1423 | hmp->tx_ring[entry].addr, | 1427 | leXX_to_cpu(hmp->tx_ring[entry].addr), |
1424 | skb->len, | 1428 | skb->len, |
1425 | PCI_DMA_TODEVICE); | 1429 | PCI_DMA_TODEVICE); |
1426 | dev_kfree_skb_irq(skb); | 1430 | dev_kfree_skb_irq(skb); |
@@ -1500,11 +1504,11 @@ static int hamachi_rx(struct net_device *dev) | |||
1500 | if (desc_status & DescOwn) | 1504 | if (desc_status & DescOwn) |
1501 | break; | 1505 | break; |
1502 | pci_dma_sync_single_for_cpu(hmp->pci_dev, | 1506 | pci_dma_sync_single_for_cpu(hmp->pci_dev, |
1503 | desc->addr, | 1507 | leXX_to_cpu(desc->addr), |
1504 | hmp->rx_buf_sz, | 1508 | hmp->rx_buf_sz, |
1505 | PCI_DMA_FROMDEVICE); | 1509 | PCI_DMA_FROMDEVICE); |
1506 | buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; | 1510 | buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; |
1507 | frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12]))); | 1511 | frame_status = le32_to_cpu(get_unaligned((__le32*)&(buf_addr[data_size - 12]))); |
1508 | if (hamachi_debug > 4) | 1512 | if (hamachi_debug > 4) |
1509 | printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", | 1513 | printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", |
1510 | frame_status); | 1514 | frame_status); |
@@ -1518,9 +1522,9 @@ static int hamachi_rx(struct net_device *dev) | |||
1518 | dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]); | 1522 | dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]); |
1519 | printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n", | 1523 | printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n", |
1520 | dev->name, | 1524 | dev->name, |
1521 | hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0xffff0000, | 1525 | le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000, |
1522 | hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0x0000ffff, | 1526 | le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff, |
1523 | hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length); | 1527 | le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length)); |
1524 | hmp->stats.rx_length_errors++; | 1528 | hmp->stats.rx_length_errors++; |
1525 | } /* else Omit for prototype errata??? */ | 1529 | } /* else Omit for prototype errata??? */ |
1526 | if (frame_status & 0x00380000) { | 1530 | if (frame_status & 0x00380000) { |
@@ -1566,7 +1570,7 @@ static int hamachi_rx(struct net_device *dev) | |||
1566 | #endif | 1570 | #endif |
1567 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1571 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1568 | pci_dma_sync_single_for_cpu(hmp->pci_dev, | 1572 | pci_dma_sync_single_for_cpu(hmp->pci_dev, |
1569 | hmp->rx_ring[entry].addr, | 1573 | leXX_to_cpu(hmp->rx_ring[entry].addr), |
1570 | hmp->rx_buf_sz, | 1574 | hmp->rx_buf_sz, |
1571 | PCI_DMA_FROMDEVICE); | 1575 | PCI_DMA_FROMDEVICE); |
1572 | /* Call copy + cksum if available. */ | 1576 | /* Call copy + cksum if available. */ |
@@ -1579,12 +1583,12 @@ static int hamachi_rx(struct net_device *dev) | |||
1579 | + entry*sizeof(*desc), pkt_len); | 1583 | + entry*sizeof(*desc), pkt_len); |
1580 | #endif | 1584 | #endif |
1581 | pci_dma_sync_single_for_device(hmp->pci_dev, | 1585 | pci_dma_sync_single_for_device(hmp->pci_dev, |
1582 | hmp->rx_ring[entry].addr, | 1586 | leXX_to_cpu(hmp->rx_ring[entry].addr), |
1583 | hmp->rx_buf_sz, | 1587 | hmp->rx_buf_sz, |
1584 | PCI_DMA_FROMDEVICE); | 1588 | PCI_DMA_FROMDEVICE); |
1585 | } else { | 1589 | } else { |
1586 | pci_unmap_single(hmp->pci_dev, | 1590 | pci_unmap_single(hmp->pci_dev, |
1587 | hmp->rx_ring[entry].addr, | 1591 | leXX_to_cpu(hmp->rx_ring[entry].addr), |
1588 | hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1592 | hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1589 | skb_put(skb = hmp->rx_skbuff[entry], pkt_len); | 1593 | skb_put(skb = hmp->rx_skbuff[entry], pkt_len); |
1590 | hmp->rx_skbuff[entry] = NULL; | 1594 | hmp->rx_skbuff[entry] = NULL; |
@@ -1787,21 +1791,21 @@ static int hamachi_close(struct net_device *dev) | |||
1787 | for (i = 0; i < RX_RING_SIZE; i++) { | 1791 | for (i = 0; i < RX_RING_SIZE; i++) { |
1788 | skb = hmp->rx_skbuff[i]; | 1792 | skb = hmp->rx_skbuff[i]; |
1789 | hmp->rx_ring[i].status_n_length = 0; | 1793 | hmp->rx_ring[i].status_n_length = 0; |
1790 | hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ | ||
1791 | if (skb) { | 1794 | if (skb) { |
1792 | pci_unmap_single(hmp->pci_dev, | 1795 | pci_unmap_single(hmp->pci_dev, |
1793 | hmp->rx_ring[i].addr, hmp->rx_buf_sz, | 1796 | leXX_to_cpu(hmp->rx_ring[i].addr), |
1794 | PCI_DMA_FROMDEVICE); | 1797 | hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1795 | dev_kfree_skb(skb); | 1798 | dev_kfree_skb(skb); |
1796 | hmp->rx_skbuff[i] = NULL; | 1799 | hmp->rx_skbuff[i] = NULL; |
1797 | } | 1800 | } |
1801 | hmp->rx_ring[i].addr = cpu_to_leXX(0xBADF00D0); /* An invalid address. */ | ||
1798 | } | 1802 | } |
1799 | for (i = 0; i < TX_RING_SIZE; i++) { | 1803 | for (i = 0; i < TX_RING_SIZE; i++) { |
1800 | skb = hmp->tx_skbuff[i]; | 1804 | skb = hmp->tx_skbuff[i]; |
1801 | if (skb) { | 1805 | if (skb) { |
1802 | pci_unmap_single(hmp->pci_dev, | 1806 | pci_unmap_single(hmp->pci_dev, |
1803 | hmp->tx_ring[i].addr, skb->len, | 1807 | leXX_to_cpu(hmp->tx_ring[i].addr), |
1804 | PCI_DMA_TODEVICE); | 1808 | skb->len, PCI_DMA_TODEVICE); |
1805 | dev_kfree_skb(skb); | 1809 | dev_kfree_skb(skb); |
1806 | hmp->tx_skbuff[i] = NULL; | 1810 | hmp->tx_skbuff[i] = NULL; |
1807 | } | 1811 | } |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 0de3aa2a2e44..cb06280dced5 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -402,7 +407,7 @@ static u32 __emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_s | |||
402 | static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) | 407 | static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) |
403 | { | 408 | { |
404 | u32 ret = EMAC_MR1_VLE | EMAC_MR1_IST | EMAC4_MR1_TR | | 409 | u32 ret = EMAC_MR1_VLE | EMAC_MR1_IST | EMAC4_MR1_TR | |
405 | EMAC4_MR1_OBCI(dev->opb_bus_freq); | 410 | EMAC4_MR1_OBCI(dev->opb_bus_freq / 1000000); |
406 | 411 | ||
407 | DBG2(dev, "__emac4_calc_base_mr1" NL); | 412 | DBG2(dev, "__emac4_calc_base_mr1" NL); |
408 | 413 | ||
@@ -464,26 +469,34 @@ static int emac_configure(struct emac_instance *dev) | |||
464 | { | 469 | { |
465 | struct emac_regs __iomem *p = dev->emacp; | 470 | struct emac_regs __iomem *p = dev->emacp; |
466 | struct net_device *ndev = dev->ndev; | 471 | struct net_device *ndev = dev->ndev; |
467 | int tx_size, rx_size; | 472 | int tx_size, rx_size, link = netif_carrier_ok(dev->ndev); |
468 | u32 r, mr1 = 0; | 473 | u32 r, mr1 = 0; |
469 | 474 | ||
470 | DBG(dev, "configure" NL); | 475 | DBG(dev, "configure" NL); |
471 | 476 | ||
472 | if (emac_reset(dev) < 0) | 477 | if (!link) { |
478 | out_be32(&p->mr1, in_be32(&p->mr1) | ||
479 | | EMAC_MR1_FDE | EMAC_MR1_ILE); | ||
480 | udelay(100); | ||
481 | } else if (emac_reset(dev) < 0) | ||
473 | return -ETIMEDOUT; | 482 | return -ETIMEDOUT; |
474 | 483 | ||
475 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) | 484 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) |
476 | tah_reset(dev->tah_dev); | 485 | tah_reset(dev->tah_dev); |
477 | 486 | ||
478 | DBG(dev, " duplex = %d, pause = %d, asym_pause = %d\n", | 487 | DBG(dev, " link = %d duplex = %d, pause = %d, asym_pause = %d\n", |
479 | dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause); | 488 | link, dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause); |
480 | 489 | ||
481 | /* Default fifo sizes */ | 490 | /* Default fifo sizes */ |
482 | tx_size = dev->tx_fifo_size; | 491 | tx_size = dev->tx_fifo_size; |
483 | rx_size = dev->rx_fifo_size; | 492 | rx_size = dev->rx_fifo_size; |
484 | 493 | ||
494 | /* No link, force loopback */ | ||
495 | if (!link) | ||
496 | mr1 = EMAC_MR1_FDE | EMAC_MR1_ILE; | ||
497 | |||
485 | /* Check for full duplex */ | 498 | /* Check for full duplex */ |
486 | if (dev->phy.duplex == DUPLEX_FULL) | 499 | else if (dev->phy.duplex == DUPLEX_FULL) |
487 | mr1 |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001; | 500 | mr1 |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001; |
488 | 501 | ||
489 | /* Adjust fifo sizes, mr1 and timeouts based on link speed */ | 502 | /* Adjust fifo sizes, mr1 and timeouts based on link speed */ |
@@ -642,9 +655,11 @@ static void emac_reset_work(struct work_struct *work) | |||
642 | DBG(dev, "reset_work" NL); | 655 | DBG(dev, "reset_work" NL); |
643 | 656 | ||
644 | mutex_lock(&dev->link_lock); | 657 | mutex_lock(&dev->link_lock); |
645 | emac_netif_stop(dev); | 658 | if (dev->opened) { |
646 | emac_full_tx_reset(dev); | 659 | emac_netif_stop(dev); |
647 | emac_netif_start(dev); | 660 | emac_full_tx_reset(dev); |
661 | emac_netif_start(dev); | ||
662 | } | ||
648 | mutex_unlock(&dev->link_lock); | 663 | mutex_unlock(&dev->link_lock); |
649 | } | 664 | } |
650 | 665 | ||
@@ -701,7 +716,7 @@ static int __emac_mdio_read(struct emac_instance *dev, u8 id, u8 reg) | |||
701 | r = EMAC_STACR_BASE(dev->opb_bus_freq); | 716 | r = EMAC_STACR_BASE(dev->opb_bus_freq); |
702 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) | 717 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) |
703 | r |= EMAC_STACR_OC; | 718 | r |= EMAC_STACR_OC; |
704 | if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) | 719 | if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR)) |
705 | r |= EMACX_STACR_STAC_READ; | 720 | r |= EMACX_STACR_STAC_READ; |
706 | else | 721 | else |
707 | r |= EMAC_STACR_STAC_READ; | 722 | r |= EMAC_STACR_STAC_READ; |
@@ -773,7 +788,7 @@ static void __emac_mdio_write(struct emac_instance *dev, u8 id, u8 reg, | |||
773 | r = EMAC_STACR_BASE(dev->opb_bus_freq); | 788 | r = EMAC_STACR_BASE(dev->opb_bus_freq); |
774 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) | 789 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) |
775 | r |= EMAC_STACR_OC; | 790 | r |= EMAC_STACR_OC; |
776 | if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) | 791 | if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR)) |
777 | r |= EMACX_STACR_STAC_WRITE; | 792 | r |= EMACX_STACR_STAC_WRITE; |
778 | else | 793 | else |
779 | r |= EMAC_STACR_STAC_WRITE; | 794 | r |= EMAC_STACR_STAC_WRITE; |
@@ -1063,10 +1078,9 @@ static int emac_open(struct net_device *ndev) | |||
1063 | dev->rx_sg_skb = NULL; | 1078 | dev->rx_sg_skb = NULL; |
1064 | 1079 | ||
1065 | mutex_lock(&dev->link_lock); | 1080 | mutex_lock(&dev->link_lock); |
1081 | dev->opened = 1; | ||
1066 | 1082 | ||
1067 | /* XXX Start PHY polling now. Shouldn't wr do like sungem instead and | 1083 | /* Start PHY polling now. |
1068 | * always poll the PHY even when the iface is down ? That would allow | ||
1069 | * things like laptop-net to work. --BenH | ||
1070 | */ | 1084 | */ |
1071 | if (dev->phy.address >= 0) { | 1085 | if (dev->phy.address >= 0) { |
1072 | int link_poll_interval; | 1086 | int link_poll_interval; |
@@ -1145,9 +1159,11 @@ static void emac_link_timer(struct work_struct *work) | |||
1145 | int link_poll_interval; | 1159 | int link_poll_interval; |
1146 | 1160 | ||
1147 | mutex_lock(&dev->link_lock); | 1161 | mutex_lock(&dev->link_lock); |
1148 | |||
1149 | DBG2(dev, "link timer" NL); | 1162 | DBG2(dev, "link timer" NL); |
1150 | 1163 | ||
1164 | if (!dev->opened) | ||
1165 | goto bail; | ||
1166 | |||
1151 | if (dev->phy.def->ops->poll_link(&dev->phy)) { | 1167 | if (dev->phy.def->ops->poll_link(&dev->phy)) { |
1152 | if (!netif_carrier_ok(dev->ndev)) { | 1168 | if (!netif_carrier_ok(dev->ndev)) { |
1153 | /* Get new link parameters */ | 1169 | /* Get new link parameters */ |
@@ -1162,21 +1178,22 @@ static void emac_link_timer(struct work_struct *work) | |||
1162 | link_poll_interval = PHY_POLL_LINK_ON; | 1178 | link_poll_interval = PHY_POLL_LINK_ON; |
1163 | } else { | 1179 | } else { |
1164 | if (netif_carrier_ok(dev->ndev)) { | 1180 | if (netif_carrier_ok(dev->ndev)) { |
1165 | emac_reinitialize(dev); | ||
1166 | netif_carrier_off(dev->ndev); | 1181 | netif_carrier_off(dev->ndev); |
1167 | netif_tx_disable(dev->ndev); | 1182 | netif_tx_disable(dev->ndev); |
1183 | emac_reinitialize(dev); | ||
1168 | emac_print_link_status(dev); | 1184 | emac_print_link_status(dev); |
1169 | } | 1185 | } |
1170 | link_poll_interval = PHY_POLL_LINK_OFF; | 1186 | link_poll_interval = PHY_POLL_LINK_OFF; |
1171 | } | 1187 | } |
1172 | schedule_delayed_work(&dev->link_work, link_poll_interval); | 1188 | schedule_delayed_work(&dev->link_work, link_poll_interval); |
1173 | 1189 | bail: | |
1174 | mutex_unlock(&dev->link_lock); | 1190 | mutex_unlock(&dev->link_lock); |
1175 | } | 1191 | } |
1176 | 1192 | ||
1177 | static void emac_force_link_update(struct emac_instance *dev) | 1193 | static void emac_force_link_update(struct emac_instance *dev) |
1178 | { | 1194 | { |
1179 | netif_carrier_off(dev->ndev); | 1195 | netif_carrier_off(dev->ndev); |
1196 | smp_rmb(); | ||
1180 | if (dev->link_polling) { | 1197 | if (dev->link_polling) { |
1181 | cancel_rearming_delayed_work(&dev->link_work); | 1198 | cancel_rearming_delayed_work(&dev->link_work); |
1182 | if (dev->link_polling) | 1199 | if (dev->link_polling) |
@@ -1191,11 +1208,14 @@ static int emac_close(struct net_device *ndev) | |||
1191 | 1208 | ||
1192 | DBG(dev, "close" NL); | 1209 | DBG(dev, "close" NL); |
1193 | 1210 | ||
1194 | if (dev->phy.address >= 0) | 1211 | if (dev->phy.address >= 0) { |
1212 | dev->link_polling = 0; | ||
1195 | cancel_rearming_delayed_work(&dev->link_work); | 1213 | cancel_rearming_delayed_work(&dev->link_work); |
1196 | 1214 | } | |
1215 | mutex_lock(&dev->link_lock); | ||
1197 | emac_netif_stop(dev); | 1216 | emac_netif_stop(dev); |
1198 | flush_scheduled_work(); | 1217 | dev->opened = 0; |
1218 | mutex_unlock(&dev->link_lock); | ||
1199 | 1219 | ||
1200 | emac_rx_disable(dev); | 1220 | emac_rx_disable(dev); |
1201 | emac_tx_disable(dev); | 1221 | emac_tx_disable(dev); |
@@ -2427,7 +2447,7 @@ static int __devinit emac_init_config(struct emac_instance *dev) | |||
2427 | if (emac_read_uint_prop(np, "tah-device", &dev->tah_ph, 0)) | 2447 | if (emac_read_uint_prop(np, "tah-device", &dev->tah_ph, 0)) |
2428 | dev->tah_ph = 0; | 2448 | dev->tah_ph = 0; |
2429 | if (emac_read_uint_prop(np, "tah-channel", &dev->tah_port, 0)) | 2449 | if (emac_read_uint_prop(np, "tah-channel", &dev->tah_port, 0)) |
2430 | dev->tah_ph = 0; | 2450 | dev->tah_port = 0; |
2431 | if (emac_read_uint_prop(np, "mdio-device", &dev->mdio_ph, 0)) | 2451 | if (emac_read_uint_prop(np, "mdio-device", &dev->mdio_ph, 0)) |
2432 | dev->mdio_ph = 0; | 2452 | dev->mdio_ph = 0; |
2433 | if (emac_read_uint_prop(np, "zmii-device", &dev->zmii_ph, 0)) | 2453 | if (emac_read_uint_prop(np, "zmii-device", &dev->zmii_ph, 0)) |
@@ -2465,16 +2485,19 @@ static int __devinit emac_init_config(struct emac_instance *dev) | |||
2465 | /* Check EMAC version */ | 2485 | /* Check EMAC version */ |
2466 | if (of_device_is_compatible(np, "ibm,emac4")) | 2486 | if (of_device_is_compatible(np, "ibm,emac4")) |
2467 | dev->features |= EMAC_FTR_EMAC4; | 2487 | dev->features |= EMAC_FTR_EMAC4; |
2468 | if (of_device_is_compatible(np, "ibm,emac-axon") | 2488 | |
2469 | || of_device_is_compatible(np, "ibm,emac-440epx")) | 2489 | /* Fixup some feature bits based on the device tree */ |
2470 | dev->features |= EMAC_FTR_HAS_AXON_STACR | 2490 | if (of_get_property(np, "has-inverted-stacr-oc", NULL)) |
2471 | | EMAC_FTR_STACR_OC_INVERT; | ||
2472 | if (of_device_is_compatible(np, "ibm,emac-440spe")) | ||
2473 | dev->features |= EMAC_FTR_STACR_OC_INVERT; | 2491 | dev->features |= EMAC_FTR_STACR_OC_INVERT; |
2492 | if (of_get_property(np, "has-new-stacr-staopc", NULL)) | ||
2493 | dev->features |= EMAC_FTR_HAS_NEW_STACR; | ||
2474 | 2494 | ||
2475 | /* Fixup some feature bits based on the device tree and verify | 2495 | /* CAB lacks the appropriate properties */ |
2476 | * we have support for them compiled in | 2496 | if (of_device_is_compatible(np, "ibm,emac-axon")) |
2477 | */ | 2497 | dev->features |= EMAC_FTR_HAS_NEW_STACR | |
2498 | EMAC_FTR_STACR_OC_INVERT; | ||
2499 | |||
2500 | /* Enable TAH/ZMII/RGMII features as found */ | ||
2478 | if (dev->tah_ph != 0) { | 2501 | if (dev->tah_ph != 0) { |
2479 | #ifdef CONFIG_IBM_NEW_EMAC_TAH | 2502 | #ifdef CONFIG_IBM_NEW_EMAC_TAH |
2480 | dev->features |= EMAC_FTR_HAS_TAH; | 2503 | dev->features |= EMAC_FTR_HAS_TAH; |
@@ -2532,6 +2555,10 @@ static int __devinit emac_probe(struct of_device *ofdev, | |||
2532 | struct device_node **blist = NULL; | 2555 | struct device_node **blist = NULL; |
2533 | int err, i; | 2556 | int err, i; |
2534 | 2557 | ||
2558 | /* Skip unused/unwired EMACS */ | ||
2559 | if (of_get_property(np, "unused", NULL)) | ||
2560 | return -ENODEV; | ||
2561 | |||
2535 | /* Find ourselves in the bootlist if we are there */ | 2562 | /* Find ourselves in the bootlist if we are there */ |
2536 | for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++) | 2563 | for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++) |
2537 | if (emac_boot_list[i] == np) | 2564 | if (emac_boot_list[i] == np) |
@@ -2756,6 +2783,8 @@ static int __devexit emac_remove(struct of_device *ofdev) | |||
2756 | 2783 | ||
2757 | unregister_netdev(dev->ndev); | 2784 | unregister_netdev(dev->ndev); |
2758 | 2785 | ||
2786 | flush_scheduled_work(); | ||
2787 | |||
2759 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) | 2788 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) |
2760 | tah_detach(dev->tah_dev, dev->tah_port); | 2789 | tah_detach(dev->tah_dev, dev->tah_port); |
2761 | if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) | 2790 | if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) |
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h index 4011803117ca..4e74d8287c65 100644 --- a/drivers/net/ibm_newemac/core.h +++ b/drivers/net/ibm_newemac/core.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -258,6 +263,7 @@ struct emac_instance { | |||
258 | int stop_timeout; /* in us */ | 263 | int stop_timeout; /* in us */ |
259 | int no_mcast; | 264 | int no_mcast; |
260 | int mcast_pending; | 265 | int mcast_pending; |
266 | int opened; | ||
261 | struct work_struct reset_work; | 267 | struct work_struct reset_work; |
262 | spinlock_t lock; | 268 | spinlock_t lock; |
263 | }; | 269 | }; |
@@ -292,9 +298,9 @@ struct emac_instance { | |||
292 | */ | 298 | */ |
293 | #define EMAC_FTR_HAS_RGMII 0x00000020 | 299 | #define EMAC_FTR_HAS_RGMII 0x00000020 |
294 | /* | 300 | /* |
295 | * Set if we have axon-type STACR | 301 | * Set if we have new type STACR with STAOPC |
296 | */ | 302 | */ |
297 | #define EMAC_FTR_HAS_AXON_STACR 0x00000040 | 303 | #define EMAC_FTR_HAS_NEW_STACR 0x00000040 |
298 | 304 | ||
299 | 305 | ||
300 | /* Right now, we don't quite handle the always/possible masks on the | 306 | /* Right now, we don't quite handle the always/possible masks on the |
@@ -306,7 +312,7 @@ enum { | |||
306 | 312 | ||
307 | EMAC_FTRS_POSSIBLE = | 313 | EMAC_FTRS_POSSIBLE = |
308 | #ifdef CONFIG_IBM_NEW_EMAC_EMAC4 | 314 | #ifdef CONFIG_IBM_NEW_EMAC_EMAC4 |
309 | EMAC_FTR_EMAC4 | EMAC_FTR_HAS_AXON_STACR | | 315 | EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR | |
310 | EMAC_FTR_STACR_OC_INVERT | | 316 | EMAC_FTR_STACR_OC_INVERT | |
311 | #endif | 317 | #endif |
312 | #ifdef CONFIG_IBM_NEW_EMAC_TAH | 318 | #ifdef CONFIG_IBM_NEW_EMAC_TAH |
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c index 170524ee0f19..86b756a30784 100644 --- a/drivers/net/ibm_newemac/debug.c +++ b/drivers/net/ibm_newemac/debug.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies | 11 | * Copyright (c) 2004, 2005 Zultys Technologies |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -21,7 +26,7 @@ | |||
21 | 26 | ||
22 | #include "core.h" | 27 | #include "core.h" |
23 | 28 | ||
24 | static spinlock_t emac_dbg_lock = SPIN_LOCK_UNLOCKED; | 29 | static DEFINE_SPINLOCK(emac_dbg_lock); |
25 | 30 | ||
26 | static void emac_desc_dump(struct emac_instance *p) | 31 | static void emac_desc_dump(struct emac_instance *p) |
27 | { | 32 | { |
diff --git a/drivers/net/ibm_newemac/debug.h b/drivers/net/ibm_newemac/debug.h index 1dd2dcbc157f..b631842ec8d0 100644 --- a/drivers/net/ibm_newemac/debug.h +++ b/drivers/net/ibm_newemac/debug.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies | 11 | * Copyright (c) 2004, 2005 Zultys Technologies |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h index bef92efeeadc..91cb096ab405 100644 --- a/drivers/net/ibm_newemac/emac.h +++ b/drivers/net/ibm_newemac/emac.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Register definitions for PowerPC 4xx on-chip ethernet contoller | 4 | * Register definitions for PowerPC 4xx on-chip ethernet contoller |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c index 9a88f71db004..6869f08c9dcb 100644 --- a/drivers/net/ibm_newemac/mal.c +++ b/drivers/net/ibm_newemac/mal.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Memory Access Layer (MAL) support | 4 | * Memory Access Layer (MAL) support |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h index 784edb8ea822..eaa7262dc079 100644 --- a/drivers/net/ibm_newemac/mal.h +++ b/drivers/net/ibm_newemac/mal.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Memory Access Layer (MAL) support | 4 | * Memory Access Layer (MAL) support |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/phy.c b/drivers/net/ibm_newemac/phy.c index aa1f0ddf1e3e..37bfeea8788a 100644 --- a/drivers/net/ibm_newemac/phy.c +++ b/drivers/net/ibm_newemac/phy.c | |||
@@ -8,6 +8,11 @@ | |||
8 | * This file should be shared with other drivers or eventually | 8 | * This file should be shared with other drivers or eventually |
9 | * merged as the "low level" part of miilib | 9 | * merged as the "low level" part of miilib |
10 | * | 10 | * |
11 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
12 | * <benh@kernel.crashing.org> | ||
13 | * | ||
14 | * Based on the arch/ppc version of the driver: | ||
15 | * | ||
11 | * (c) 2003, Benjamin Herrenscmidt (benh@kernel.crashing.org) | 16 | * (c) 2003, Benjamin Herrenscmidt (benh@kernel.crashing.org) |
12 | * (c) 2004-2005, Eugene Surovegin <ebs@ebshome.net> | 17 | * (c) 2004-2005, Eugene Surovegin <ebs@ebshome.net> |
13 | * | 18 | * |
@@ -306,8 +311,84 @@ static struct mii_phy_def cis8201_phy_def = { | |||
306 | .ops = &cis8201_phy_ops | 311 | .ops = &cis8201_phy_ops |
307 | }; | 312 | }; |
308 | 313 | ||
314 | static struct mii_phy_def bcm5248_phy_def = { | ||
315 | |||
316 | .phy_id = 0x0143bc00, | ||
317 | .phy_id_mask = 0x0ffffff0, | ||
318 | .name = "BCM5248 10/100 SMII Ethernet", | ||
319 | .ops = &generic_phy_ops | ||
320 | }; | ||
321 | |||
322 | static int m88e1111_init(struct mii_phy *phy) | ||
323 | { | ||
324 | pr_debug("%s: Marvell 88E1111 Ethernet\n", __FUNCTION__); | ||
325 | phy_write(phy, 0x14, 0x0ce3); | ||
326 | phy_write(phy, 0x18, 0x4101); | ||
327 | phy_write(phy, 0x09, 0x0e00); | ||
328 | phy_write(phy, 0x04, 0x01e1); | ||
329 | phy_write(phy, 0x00, 0x9140); | ||
330 | phy_write(phy, 0x00, 0x1140); | ||
331 | |||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | static int et1011c_init(struct mii_phy *phy) | ||
336 | { | ||
337 | u16 reg_short; | ||
338 | |||
339 | reg_short = (u16)(phy_read(phy, 0x16)); | ||
340 | reg_short &= ~(0x7); | ||
341 | reg_short |= 0x6; /* RGMII Trace Delay*/ | ||
342 | phy_write(phy, 0x16, reg_short); | ||
343 | |||
344 | reg_short = (u16)(phy_read(phy, 0x17)); | ||
345 | reg_short &= ~(0x40); | ||
346 | phy_write(phy, 0x17, reg_short); | ||
347 | |||
348 | phy_write(phy, 0x1c, 0x74f0); | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | static struct mii_phy_ops et1011c_phy_ops = { | ||
353 | .init = et1011c_init, | ||
354 | .setup_aneg = genmii_setup_aneg, | ||
355 | .setup_forced = genmii_setup_forced, | ||
356 | .poll_link = genmii_poll_link, | ||
357 | .read_link = genmii_read_link | ||
358 | }; | ||
359 | |||
360 | static struct mii_phy_def et1011c_phy_def = { | ||
361 | .phy_id = 0x0282f000, | ||
362 | .phy_id_mask = 0x0fffff00, | ||
363 | .name = "ET1011C Gigabit Ethernet", | ||
364 | .ops = &et1011c_phy_ops | ||
365 | }; | ||
366 | |||
367 | |||
368 | |||
369 | |||
370 | |||
371 | static struct mii_phy_ops m88e1111_phy_ops = { | ||
372 | .init = m88e1111_init, | ||
373 | .setup_aneg = genmii_setup_aneg, | ||
374 | .setup_forced = genmii_setup_forced, | ||
375 | .poll_link = genmii_poll_link, | ||
376 | .read_link = genmii_read_link | ||
377 | }; | ||
378 | |||
379 | static struct mii_phy_def m88e1111_phy_def = { | ||
380 | |||
381 | .phy_id = 0x01410CC0, | ||
382 | .phy_id_mask = 0x0ffffff0, | ||
383 | .name = "Marvell 88E1111 Ethernet", | ||
384 | .ops = &m88e1111_phy_ops, | ||
385 | }; | ||
386 | |||
309 | static struct mii_phy_def *mii_phy_table[] = { | 387 | static struct mii_phy_def *mii_phy_table[] = { |
388 | &et1011c_phy_def, | ||
310 | &cis8201_phy_def, | 389 | &cis8201_phy_def, |
390 | &bcm5248_phy_def, | ||
391 | &m88e1111_phy_def, | ||
311 | &genmii_phy_def, | 392 | &genmii_phy_def, |
312 | NULL | 393 | NULL |
313 | }; | 394 | }; |
diff --git a/drivers/net/ibm_newemac/phy.h b/drivers/net/ibm_newemac/phy.h index 6feca26afedb..1b65c81f6557 100644 --- a/drivers/net/ibm_newemac/phy.h +++ b/drivers/net/ibm_newemac/phy.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, PHY support | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, PHY support |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Benjamin Herrenschmidt <benh@kernel.crashing.org> | 11 | * Benjamin Herrenschmidt <benh@kernel.crashing.org> |
7 | * February 2003 | 12 | * February 2003 |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c index de416951a435..9bc1132fa788 100644 --- a/drivers/net/ibm_newemac/rgmii.c +++ b/drivers/net/ibm_newemac/rgmii.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -140,7 +145,7 @@ void rgmii_get_mdio(struct of_device *ofdev, int input) | |||
140 | 145 | ||
141 | RGMII_DBG2(dev, "get_mdio(%d)" NL, input); | 146 | RGMII_DBG2(dev, "get_mdio(%d)" NL, input); |
142 | 147 | ||
143 | if (dev->type != RGMII_AXON) | 148 | if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) |
144 | return; | 149 | return; |
145 | 150 | ||
146 | mutex_lock(&dev->lock); | 151 | mutex_lock(&dev->lock); |
@@ -161,7 +166,7 @@ void rgmii_put_mdio(struct of_device *ofdev, int input) | |||
161 | 166 | ||
162 | RGMII_DBG2(dev, "put_mdio(%d)" NL, input); | 167 | RGMII_DBG2(dev, "put_mdio(%d)" NL, input); |
163 | 168 | ||
164 | if (dev->type != RGMII_AXON) | 169 | if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) |
165 | return; | 170 | return; |
166 | 171 | ||
167 | fer = in_be32(&p->fer); | 172 | fer = in_be32(&p->fer); |
@@ -250,11 +255,13 @@ static int __devinit rgmii_probe(struct of_device *ofdev, | |||
250 | goto err_free; | 255 | goto err_free; |
251 | } | 256 | } |
252 | 257 | ||
253 | /* Check for RGMII type */ | 258 | /* Check for RGMII flags */ |
259 | if (of_get_property(ofdev->node, "has-mdio", NULL)) | ||
260 | dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; | ||
261 | |||
262 | /* CAB lacks the right properties, fix this up */ | ||
254 | if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) | 263 | if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) |
255 | dev->type = RGMII_AXON; | 264 | dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; |
256 | else | ||
257 | dev->type = RGMII_STANDARD; | ||
258 | 265 | ||
259 | DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", | 266 | DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", |
260 | in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); | 267 | in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); |
@@ -263,9 +270,9 @@ static int __devinit rgmii_probe(struct of_device *ofdev, | |||
263 | out_be32(&dev->base->fer, 0); | 270 | out_be32(&dev->base->fer, 0); |
264 | 271 | ||
265 | printk(KERN_INFO | 272 | printk(KERN_INFO |
266 | "RGMII %s %s initialized\n", | 273 | "RGMII %s initialized with%s MDIO support\n", |
267 | dev->type == RGMII_STANDARD ? "standard" : "axon", | 274 | ofdev->node->full_name, |
268 | ofdev->node->full_name); | 275 | (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); |
269 | 276 | ||
270 | wmb(); | 277 | wmb(); |
271 | dev_set_drvdata(&ofdev->dev, dev); | 278 | dev_set_drvdata(&ofdev->dev, dev); |
diff --git a/drivers/net/ibm_newemac/rgmii.h b/drivers/net/ibm_newemac/rgmii.h index 57806833121e..c4a4b358a270 100644 --- a/drivers/net/ibm_newemac/rgmii.h +++ b/drivers/net/ibm_newemac/rgmii.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Based on ocp_zmii.h/ibm_emac_zmii.h | 11 | * Based on ocp_zmii.h/ibm_emac_zmii.h |
7 | * Armin Kuster akuster@mvista.com | 12 | * Armin Kuster akuster@mvista.com |
8 | * | 13 | * |
@@ -35,8 +40,9 @@ struct rgmii_regs { | |||
35 | struct rgmii_instance { | 40 | struct rgmii_instance { |
36 | struct rgmii_regs __iomem *base; | 41 | struct rgmii_regs __iomem *base; |
37 | 42 | ||
38 | /* Type of RGMII bridge */ | 43 | /* RGMII bridge flags */ |
39 | int type; | 44 | int flags; |
45 | #define EMAC_RGMII_FLAG_HAS_MDIO 0x00000001 | ||
40 | 46 | ||
41 | /* Only one EMAC whacks us at a time */ | 47 | /* Only one EMAC whacks us at a time */ |
42 | struct mutex lock; | 48 | struct mutex lock; |
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c index f161fb100e8e..96417adec326 100644 --- a/drivers/net/ibm_newemac/tah.c +++ b/drivers/net/ibm_newemac/tah.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright 2004 MontaVista Software, Inc. | 11 | * Copyright 2004 MontaVista Software, Inc. |
7 | * Matt Porter <mporter@kernel.crashing.org> | 12 | * Matt Porter <mporter@kernel.crashing.org> |
8 | * | 13 | * |
@@ -116,13 +121,14 @@ static int __devinit tah_probe(struct of_device *ofdev, | |||
116 | goto err_free; | 121 | goto err_free; |
117 | } | 122 | } |
118 | 123 | ||
124 | dev_set_drvdata(&ofdev->dev, dev); | ||
125 | |||
119 | /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ | 126 | /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ |
120 | tah_reset(ofdev); | 127 | tah_reset(ofdev); |
121 | 128 | ||
122 | printk(KERN_INFO | 129 | printk(KERN_INFO |
123 | "TAH %s initialized\n", ofdev->node->full_name); | 130 | "TAH %s initialized\n", ofdev->node->full_name); |
124 | wmb(); | 131 | wmb(); |
125 | dev_set_drvdata(&ofdev->dev, dev); | ||
126 | 132 | ||
127 | return 0; | 133 | return 0; |
128 | 134 | ||
diff --git a/drivers/net/ibm_newemac/tah.h b/drivers/net/ibm_newemac/tah.h index bc41853b6e26..a068b5658dad 100644 --- a/drivers/net/ibm_newemac/tah.h +++ b/drivers/net/ibm_newemac/tah.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright 2004 MontaVista Software, Inc. | 11 | * Copyright 2004 MontaVista Software, Inc. |
7 | * Matt Porter <mporter@kernel.crashing.org> | 12 | * Matt Porter <mporter@kernel.crashing.org> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c index 2219ec2740e0..2ea472aeab06 100644 --- a/drivers/net/ibm_newemac/zmii.c +++ b/drivers/net/ibm_newemac/zmii.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -83,12 +88,14 @@ int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode) | |||
83 | 88 | ||
84 | ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode); | 89 | ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode); |
85 | 90 | ||
86 | if (!zmii_valid_mode(*mode)) | 91 | if (!zmii_valid_mode(*mode)) { |
87 | /* Probably an EMAC connected to RGMII, | 92 | /* Probably an EMAC connected to RGMII, |
88 | * but it still may need ZMII for MDIO so | 93 | * but it still may need ZMII for MDIO so |
89 | * we don't fail here. | 94 | * we don't fail here. |
90 | */ | 95 | */ |
96 | dev->users++; | ||
91 | return 0; | 97 | return 0; |
98 | } | ||
92 | 99 | ||
93 | mutex_lock(&dev->lock); | 100 | mutex_lock(&dev->lock); |
94 | 101 | ||
diff --git a/drivers/net/ibm_newemac/zmii.h b/drivers/net/ibm_newemac/zmii.h index 82a9968b1f74..6c9beba0c4b6 100644 --- a/drivers/net/ibm_newemac/zmii.h +++ b/drivers/net/ibm_newemac/zmii.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 7d7758f3ad8c..57772bebff56 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -1179,13 +1179,15 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ | |||
1179 | 1179 | ||
1180 | for(i = 0; i<IbmVethNumBufferPools; i++) { | 1180 | for(i = 0; i<IbmVethNumBufferPools; i++) { |
1181 | struct kobject *kobj = &adapter->rx_buff_pool[i].kobj; | 1181 | struct kobject *kobj = &adapter->rx_buff_pool[i].kobj; |
1182 | int error; | ||
1183 | |||
1182 | ibmveth_init_buffer_pool(&adapter->rx_buff_pool[i], i, | 1184 | ibmveth_init_buffer_pool(&adapter->rx_buff_pool[i], i, |
1183 | pool_count[i], pool_size[i], | 1185 | pool_count[i], pool_size[i], |
1184 | pool_active[i]); | 1186 | pool_active[i]); |
1185 | kobj->parent = &dev->dev.kobj; | 1187 | error = kobject_init_and_add(kobj, &ktype_veth_pool, |
1186 | kobject_set_name(kobj, "pool%d", i); | 1188 | &dev->dev.kobj, "pool%d", i); |
1187 | kobj->ktype = &ktype_veth_pool; | 1189 | if (!error) |
1188 | kobject_register(kobj); | 1190 | kobject_uevent(kobj, KOBJ_ADD); |
1189 | } | 1191 | } |
1190 | 1192 | ||
1191 | ibmveth_debug_printk("adapter @ 0x%p\n", adapter); | 1193 | ibmveth_debug_printk("adapter @ 0x%p\n", adapter); |
@@ -1234,7 +1236,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev) | |||
1234 | int i; | 1236 | int i; |
1235 | 1237 | ||
1236 | for(i = 0; i<IbmVethNumBufferPools; i++) | 1238 | for(i = 0; i<IbmVethNumBufferPools; i++) |
1237 | kobject_unregister(&adapter->rx_buff_pool[i].kobj); | 1239 | kobject_put(&adapter->rx_buff_pool[i].kobj); |
1238 | 1240 | ||
1239 | unregister_netdev(netdev); | 1241 | unregister_netdev(netdev); |
1240 | 1242 | ||
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index dbd23bb65d1e..50f0c17451b1 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c | |||
@@ -857,21 +857,14 @@ static void init_tfdlist(struct net_device *dev) | |||
857 | static void ipg_nic_txfree(struct net_device *dev) | 857 | static void ipg_nic_txfree(struct net_device *dev) |
858 | { | 858 | { |
859 | struct ipg_nic_private *sp = netdev_priv(dev); | 859 | struct ipg_nic_private *sp = netdev_priv(dev); |
860 | void __iomem *ioaddr = sp->ioaddr; | 860 | unsigned int released, pending, dirty; |
861 | unsigned int curr; | ||
862 | u64 txd_map; | ||
863 | unsigned int released, pending; | ||
864 | |||
865 | txd_map = (u64)sp->txd_map; | ||
866 | curr = ipg_r32(TFD_LIST_PTR_0) - | ||
867 | do_div(txd_map, sizeof(struct ipg_tx)) - 1; | ||
868 | 861 | ||
869 | IPG_DEBUG_MSG("_nic_txfree\n"); | 862 | IPG_DEBUG_MSG("_nic_txfree\n"); |
870 | 863 | ||
871 | pending = sp->tx_current - sp->tx_dirty; | 864 | pending = sp->tx_current - sp->tx_dirty; |
865 | dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH; | ||
872 | 866 | ||
873 | for (released = 0; released < pending; released++) { | 867 | for (released = 0; released < pending; released++) { |
874 | unsigned int dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH; | ||
875 | struct sk_buff *skb = sp->TxBuff[dirty]; | 868 | struct sk_buff *skb = sp->TxBuff[dirty]; |
876 | struct ipg_tx *txfd = sp->txd + dirty; | 869 | struct ipg_tx *txfd = sp->txd + dirty; |
877 | 870 | ||
@@ -882,11 +875,8 @@ static void ipg_nic_txfree(struct net_device *dev) | |||
882 | * If the TFDDone bit is set, free the associated | 875 | * If the TFDDone bit is set, free the associated |
883 | * buffer. | 876 | * buffer. |
884 | */ | 877 | */ |
885 | if (dirty == curr) | 878 | if (!(txfd->tfc & cpu_to_le64(IPG_TFC_TFDDONE))) |
886 | break; | 879 | break; |
887 | |||
888 | /* Setup TFDDONE for compatible issue. */ | ||
889 | txfd->tfc |= cpu_to_le64(IPG_TFC_TFDDONE); | ||
890 | 880 | ||
891 | /* Free the transmit buffer. */ | 881 | /* Free the transmit buffer. */ |
892 | if (skb) { | 882 | if (skb) { |
@@ -898,6 +888,7 @@ static void ipg_nic_txfree(struct net_device *dev) | |||
898 | 888 | ||
899 | sp->TxBuff[dirty] = NULL; | 889 | sp->TxBuff[dirty] = NULL; |
900 | } | 890 | } |
891 | dirty = (dirty + 1) % IPG_TFDLIST_LENGTH; | ||
901 | } | 892 | } |
902 | 893 | ||
903 | sp->tx_dirty += released; | 894 | sp->tx_dirty += released; |
@@ -1630,6 +1621,8 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst) | |||
1630 | #ifdef JUMBO_FRAME | 1621 | #ifdef JUMBO_FRAME |
1631 | ipg_nic_rxrestore(dev); | 1622 | ipg_nic_rxrestore(dev); |
1632 | #endif | 1623 | #endif |
1624 | spin_lock(&sp->lock); | ||
1625 | |||
1633 | /* Get interrupt source information, and acknowledge | 1626 | /* Get interrupt source information, and acknowledge |
1634 | * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly, | 1627 | * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly, |
1635 | * IntRequested, MacControlFrame, LinkEvent) interrupts | 1628 | * IntRequested, MacControlFrame, LinkEvent) interrupts |
@@ -1647,9 +1640,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst) | |||
1647 | handled = 1; | 1640 | handled = 1; |
1648 | 1641 | ||
1649 | if (unlikely(!netif_running(dev))) | 1642 | if (unlikely(!netif_running(dev))) |
1650 | goto out; | 1643 | goto out_unlock; |
1651 | |||
1652 | spin_lock(&sp->lock); | ||
1653 | 1644 | ||
1654 | /* If RFDListEnd interrupt, restore all used RFDs. */ | 1645 | /* If RFDListEnd interrupt, restore all used RFDs. */ |
1655 | if (status & IPG_IS_RFD_LIST_END) { | 1646 | if (status & IPG_IS_RFD_LIST_END) { |
@@ -1733,9 +1724,9 @@ out_enable: | |||
1733 | ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE | | 1724 | ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE | |
1734 | IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE | | 1725 | IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE | |
1735 | IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE); | 1726 | IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE); |
1736 | 1727 | out_unlock: | |
1737 | spin_unlock(&sp->lock); | 1728 | spin_unlock(&sp->lock); |
1738 | out: | 1729 | |
1739 | return IRQ_RETVAL(handled); | 1730 | return IRQ_RETVAL(handled); |
1740 | } | 1731 | } |
1741 | 1732 | ||
@@ -1943,10 +1934,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1943 | */ | 1934 | */ |
1944 | if (sp->tenmbpsmode) | 1935 | if (sp->tenmbpsmode) |
1945 | txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE); | 1936 | txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE); |
1946 | else if (!((sp->tx_current - sp->tx_dirty + 1) > | 1937 | txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE); |
1947 | IPG_FRAMESBETWEENTXDMACOMPLETES)) { | ||
1948 | txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE); | ||
1949 | } | ||
1950 | /* Based on compilation option, determine if FCS is to be | 1938 | /* Based on compilation option, determine if FCS is to be |
1951 | * appended to transmit frame by IPG. | 1939 | * appended to transmit frame by IPG. |
1952 | */ | 1940 | */ |
@@ -2003,7 +1991,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2003 | ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL); | 1991 | ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL); |
2004 | 1992 | ||
2005 | if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH)) | 1993 | if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH)) |
2006 | netif_wake_queue(dev); | 1994 | netif_stop_queue(dev); |
2007 | 1995 | ||
2008 | spin_unlock_irqrestore(&sp->lock, flags); | 1996 | spin_unlock_irqrestore(&sp->lock, flags); |
2009 | 1997 | ||
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index c6355c00fd7a..9081234ab458 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1168,6 +1168,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) | |||
1168 | static int irda_usb_net_open(struct net_device *netdev) | 1168 | static int irda_usb_net_open(struct net_device *netdev) |
1169 | { | 1169 | { |
1170 | struct irda_usb_cb *self; | 1170 | struct irda_usb_cb *self; |
1171 | unsigned long flags; | ||
1171 | char hwname[16]; | 1172 | char hwname[16]; |
1172 | int i; | 1173 | int i; |
1173 | 1174 | ||
@@ -1177,13 +1178,16 @@ static int irda_usb_net_open(struct net_device *netdev) | |||
1177 | self = (struct irda_usb_cb *) netdev->priv; | 1178 | self = (struct irda_usb_cb *) netdev->priv; |
1178 | IRDA_ASSERT(self != NULL, return -1;); | 1179 | IRDA_ASSERT(self != NULL, return -1;); |
1179 | 1180 | ||
1181 | spin_lock_irqsave(&self->lock, flags); | ||
1180 | /* Can only open the device if it's there */ | 1182 | /* Can only open the device if it's there */ |
1181 | if(!self->present) { | 1183 | if(!self->present) { |
1184 | spin_unlock_irqrestore(&self->lock, flags); | ||
1182 | IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); | 1185 | IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); |
1183 | return -1; | 1186 | return -1; |
1184 | } | 1187 | } |
1185 | 1188 | ||
1186 | if(self->needspatch) { | 1189 | if(self->needspatch) { |
1190 | spin_unlock_irqrestore(&self->lock, flags); | ||
1187 | IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ; | 1191 | IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ; |
1188 | return -EIO ; | 1192 | return -EIO ; |
1189 | } | 1193 | } |
@@ -1198,6 +1202,7 @@ static int irda_usb_net_open(struct net_device *netdev) | |||
1198 | /* To do *before* submitting Rx urbs and starting net Tx queue | 1202 | /* To do *before* submitting Rx urbs and starting net Tx queue |
1199 | * Jean II */ | 1203 | * Jean II */ |
1200 | self->netopen = 1; | 1204 | self->netopen = 1; |
1205 | spin_unlock_irqrestore(&self->lock, flags); | ||
1201 | 1206 | ||
1202 | /* | 1207 | /* |
1203 | * Now that everything should be initialized properly, | 1208 | * Now that everything should be initialized properly, |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index 0b769192d4ce..93916cf33f29 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -677,6 +677,8 @@ static int mcs_net_close(struct net_device *netdev) | |||
677 | /* Stop transmit processing */ | 677 | /* Stop transmit processing */ |
678 | netif_stop_queue(netdev); | 678 | netif_stop_queue(netdev); |
679 | 679 | ||
680 | kfree_skb(mcs->rx_buff.skb); | ||
681 | |||
680 | /* kill and free the receive and transmit URBs */ | 682 | /* kill and free the receive and transmit URBs */ |
681 | usb_kill_urb(mcs->rx_urb); | 683 | usb_kill_urb(mcs->rx_urb); |
682 | usb_free_urb(mcs->rx_urb); | 684 | usb_free_urb(mcs->rx_urb); |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 042bc2f0417d..e59c485bc497 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -142,9 +142,6 @@ enum StirCtrl2Mask { | |||
142 | }; | 142 | }; |
143 | 143 | ||
144 | enum StirFifoCtlMask { | 144 | enum StirFifoCtlMask { |
145 | FIFOCTL_EOF = 0x80, | ||
146 | FIFOCTL_UNDER = 0x40, | ||
147 | FIFOCTL_OVER = 0x20, | ||
148 | FIFOCTL_DIR = 0x10, | 145 | FIFOCTL_DIR = 0x10, |
149 | FIFOCTL_CLR = 0x08, | 146 | FIFOCTL_CLR = 0x08, |
150 | FIFOCTL_EMPTY = 0x04, | 147 | FIFOCTL_EMPTY = 0x04, |
@@ -594,9 +591,10 @@ static int fifo_txwait(struct stir_cb *stir, int space) | |||
594 | { | 591 | { |
595 | int err; | 592 | int err; |
596 | unsigned long count, status; | 593 | unsigned long count, status; |
594 | unsigned long prev_count = 0x1fff; | ||
597 | 595 | ||
598 | /* Read FIFO status and count */ | 596 | /* Read FIFO status and count */ |
599 | for(;;) { | 597 | for (;; prev_count = count) { |
600 | err = read_reg(stir, REG_FIFOCTL, stir->fifo_status, | 598 | err = read_reg(stir, REG_FIFOCTL, stir->fifo_status, |
601 | FIFO_REGS_SIZE); | 599 | FIFO_REGS_SIZE); |
602 | if (unlikely(err != FIFO_REGS_SIZE)) { | 600 | if (unlikely(err != FIFO_REGS_SIZE)) { |
@@ -629,6 +627,10 @@ static int fifo_txwait(struct stir_cb *stir, int space) | |||
629 | if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count) | 627 | if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count) |
630 | return 0; | 628 | return 0; |
631 | 629 | ||
630 | /* queue confused */ | ||
631 | if (prev_count < count) | ||
632 | break; | ||
633 | |||
632 | /* estimate transfer time for remaining chars */ | 634 | /* estimate transfer time for remaining chars */ |
633 | msleep((count * 8000) / stir->speed); | 635 | msleep((count * 8000) / stir->speed); |
634 | } | 636 | } |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 97bd9dc2e52e..419861cbc65e 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -815,7 +815,7 @@ static int veth_init_connection(u8 rlp) | |||
815 | { | 815 | { |
816 | struct veth_lpar_connection *cnx; | 816 | struct veth_lpar_connection *cnx; |
817 | struct veth_msg *msgs; | 817 | struct veth_msg *msgs; |
818 | int i, rc; | 818 | int i; |
819 | 819 | ||
820 | if ( (rlp == this_lp) | 820 | if ( (rlp == this_lp) |
821 | || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) | 821 | || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) |
@@ -844,11 +844,7 @@ static int veth_init_connection(u8 rlp) | |||
844 | 844 | ||
845 | /* This gets us 1 reference, which is held on behalf of the driver | 845 | /* This gets us 1 reference, which is held on behalf of the driver |
846 | * infrastructure. It's released at module unload. */ | 846 | * infrastructure. It's released at module unload. */ |
847 | kobject_init(&cnx->kobject); | 847 | kobject_init(&cnx->kobject, &veth_lpar_connection_ktype); |
848 | cnx->kobject.ktype = &veth_lpar_connection_ktype; | ||
849 | rc = kobject_set_name(&cnx->kobject, "cnx%.2d", rlp); | ||
850 | if (rc != 0) | ||
851 | return rc; | ||
852 | 848 | ||
853 | msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); | 849 | msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); |
854 | if (! msgs) { | 850 | if (! msgs) { |
@@ -1087,11 +1083,8 @@ static struct net_device * __init veth_probe_one(int vlan, | |||
1087 | return NULL; | 1083 | return NULL; |
1088 | } | 1084 | } |
1089 | 1085 | ||
1090 | kobject_init(&port->kobject); | 1086 | kobject_init(&port->kobject, &veth_port_ktype); |
1091 | port->kobject.parent = &dev->dev.kobj; | 1087 | if (0 != kobject_add(&port->kobject, &dev->dev.kobj, "veth_port")) |
1092 | port->kobject.ktype = &veth_port_ktype; | ||
1093 | kobject_set_name(&port->kobject, "veth_port"); | ||
1094 | if (0 != kobject_add(&port->kobject)) | ||
1095 | veth_error("Failed adding port for %s to sysfs.\n", dev->name); | 1088 | veth_error("Failed adding port for %s to sysfs.\n", dev->name); |
1096 | 1089 | ||
1097 | veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", | 1090 | veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", |
@@ -1711,9 +1704,9 @@ static int __init veth_module_init(void) | |||
1711 | continue; | 1704 | continue; |
1712 | 1705 | ||
1713 | kobj = &veth_cnx[i]->kobject; | 1706 | kobj = &veth_cnx[i]->kobject; |
1714 | kobj->parent = &veth_driver.driver.kobj; | ||
1715 | /* If the add failes, complain but otherwise continue */ | 1707 | /* If the add failes, complain but otherwise continue */ |
1716 | if (0 != kobject_add(kobj)) | 1708 | if (0 != driver_add_kobj(&veth_driver.driver, kobj, |
1709 | "cnx%.2d", veth_cnx[i]->remote_lp)) | ||
1717 | veth_error("cnx %d: Failed adding to sysfs.\n", i); | 1710 | veth_error("cnx %d: Failed adding to sysfs.\n", i); |
1718 | } | 1711 | } |
1719 | 1712 | ||
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 3021234b1e17..4f63839051b0 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -296,6 +296,11 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) | |||
296 | { | 296 | { |
297 | struct net_device *netdev = adapter->netdev; | 297 | struct net_device *netdev = adapter->netdev; |
298 | 298 | ||
299 | #ifdef CONFIG_IXGB_NAPI | ||
300 | napi_disable(&adapter->napi); | ||
301 | atomic_set(&adapter->irq_sem, 0); | ||
302 | #endif | ||
303 | |||
299 | ixgb_irq_disable(adapter); | 304 | ixgb_irq_disable(adapter); |
300 | free_irq(adapter->pdev->irq, netdev); | 305 | free_irq(adapter->pdev->irq, netdev); |
301 | 306 | ||
@@ -304,9 +309,7 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) | |||
304 | 309 | ||
305 | if(kill_watchdog) | 310 | if(kill_watchdog) |
306 | del_timer_sync(&adapter->watchdog_timer); | 311 | del_timer_sync(&adapter->watchdog_timer); |
307 | #ifdef CONFIG_IXGB_NAPI | 312 | |
308 | napi_disable(&adapter->napi); | ||
309 | #endif | ||
310 | adapter->link_speed = 0; | 313 | adapter->link_speed = 0; |
311 | adapter->link_duplex = 0; | 314 | adapter->link_duplex = 0; |
312 | netif_carrier_off(netdev); | 315 | netif_carrier_off(netdev); |
@@ -320,10 +323,22 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) | |||
320 | void | 323 | void |
321 | ixgb_reset(struct ixgb_adapter *adapter) | 324 | ixgb_reset(struct ixgb_adapter *adapter) |
322 | { | 325 | { |
326 | struct ixgb_hw *hw = &adapter->hw; | ||
323 | 327 | ||
324 | ixgb_adapter_stop(&adapter->hw); | 328 | ixgb_adapter_stop(hw); |
325 | if(!ixgb_init_hw(&adapter->hw)) | 329 | if (!ixgb_init_hw(hw)) |
326 | DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n"); | 330 | DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n"); |
331 | |||
332 | /* restore frame size information */ | ||
333 | IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT); | ||
334 | if (hw->max_frame_size > | ||
335 | IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) { | ||
336 | u32 ctrl0 = IXGB_READ_REG(hw, CTRL0); | ||
337 | if (!(ctrl0 & IXGB_CTRL0_JFE)) { | ||
338 | ctrl0 |= IXGB_CTRL0_JFE; | ||
339 | IXGB_WRITE_REG(hw, CTRL0, ctrl0); | ||
340 | } | ||
341 | } | ||
327 | } | 342 | } |
328 | 343 | ||
329 | /** | 344 | /** |
@@ -1775,14 +1790,13 @@ ixgb_clean(struct napi_struct *napi, int budget) | |||
1775 | { | 1790 | { |
1776 | struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi); | 1791 | struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi); |
1777 | struct net_device *netdev = adapter->netdev; | 1792 | struct net_device *netdev = adapter->netdev; |
1778 | int tx_cleaned; | ||
1779 | int work_done = 0; | 1793 | int work_done = 0; |
1780 | 1794 | ||
1781 | tx_cleaned = ixgb_clean_tx_irq(adapter); | 1795 | ixgb_clean_tx_irq(adapter); |
1782 | ixgb_clean_rx_irq(adapter, &work_done, budget); | 1796 | ixgb_clean_rx_irq(adapter, &work_done, budget); |
1783 | 1797 | ||
1784 | /* if no Tx and not enough Rx work done, exit the polling mode */ | 1798 | /* If budget not fully consumed, exit the polling mode */ |
1785 | if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { | 1799 | if (work_done < budget) { |
1786 | netif_rx_complete(netdev, napi); | 1800 | netif_rx_complete(netdev, napi); |
1787 | ixgb_irq_enable(adapter); | 1801 | ixgb_irq_enable(adapter); |
1788 | } | 1802 | } |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 00bc525c6560..a4265bc1cebb 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -1409,9 +1409,11 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
1409 | IXGBE_WRITE_FLUSH(&adapter->hw); | 1409 | IXGBE_WRITE_FLUSH(&adapter->hw); |
1410 | msleep(10); | 1410 | msleep(10); |
1411 | 1411 | ||
1412 | napi_disable(&adapter->napi); | ||
1413 | atomic_set(&adapter->irq_sem, 0); | ||
1414 | |||
1412 | ixgbe_irq_disable(adapter); | 1415 | ixgbe_irq_disable(adapter); |
1413 | 1416 | ||
1414 | napi_disable(&adapter->napi); | ||
1415 | del_timer_sync(&adapter->watchdog_timer); | 1417 | del_timer_sync(&adapter->watchdog_timer); |
1416 | 1418 | ||
1417 | netif_carrier_off(netdev); | 1419 | netif_carrier_off(netdev); |
@@ -1470,19 +1472,16 @@ static int ixgbe_clean(struct napi_struct *napi, int budget) | |||
1470 | struct net_device *netdev = adapter->netdev; | 1472 | struct net_device *netdev = adapter->netdev; |
1471 | int tx_cleaned = 0, work_done = 0; | 1473 | int tx_cleaned = 0, work_done = 0; |
1472 | 1474 | ||
1473 | /* Keep link state information with original netdev */ | ||
1474 | if (!netif_carrier_ok(adapter->netdev)) | ||
1475 | goto quit_polling; | ||
1476 | |||
1477 | /* In non-MSIX case, there is no multi-Tx/Rx queue */ | 1475 | /* In non-MSIX case, there is no multi-Tx/Rx queue */ |
1478 | tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); | 1476 | tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); |
1479 | ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, | 1477 | ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, |
1480 | budget); | 1478 | budget); |
1481 | 1479 | ||
1482 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 1480 | if (tx_cleaned) |
1483 | if ((!tx_cleaned && (work_done < budget)) || | 1481 | work_done = budget; |
1484 | !netif_running(adapter->netdev)) { | 1482 | |
1485 | quit_polling: | 1483 | /* If budget not fully consumed, exit the polling mode */ |
1484 | if (work_done < budget) { | ||
1486 | netif_rx_complete(netdev, napi); | 1485 | netif_rx_complete(netdev, napi); |
1487 | ixgbe_irq_enable(adapter); | 1486 | ixgbe_irq_enable(adapter); |
1488 | } | 1487 | } |
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c index 6c0dd49149d0..484cb2ba717f 100644 --- a/drivers/net/ixp2000/ixpdev.c +++ b/drivers/net/ixp2000/ixpdev.c | |||
@@ -135,8 +135,6 @@ static int ixpdev_poll(struct napi_struct *napi, int budget) | |||
135 | struct net_device *dev = ip->dev; | 135 | struct net_device *dev = ip->dev; |
136 | int rx; | 136 | int rx; |
137 | 137 | ||
138 | /* @@@ Have to stop polling when nds[0] is administratively | ||
139 | * downed while we are polling. */ | ||
140 | rx = 0; | 138 | rx = 0; |
141 | do { | 139 | do { |
142 | ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff); | 140 | ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff); |
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c index 9a855e512147..b59f442bbf36 100644 --- a/drivers/net/lib82596.c +++ b/drivers/net/lib82596.c | |||
@@ -176,8 +176,8 @@ struct i596_reg { | |||
176 | struct i596_tbd { | 176 | struct i596_tbd { |
177 | unsigned short size; | 177 | unsigned short size; |
178 | unsigned short pad; | 178 | unsigned short pad; |
179 | dma_addr_t next; | 179 | u32 next; |
180 | dma_addr_t data; | 180 | u32 data; |
181 | u32 cache_pad[5]; /* Total 32 bytes... */ | 181 | u32 cache_pad[5]; /* Total 32 bytes... */ |
182 | }; | 182 | }; |
183 | 183 | ||
@@ -195,12 +195,12 @@ struct i596_cmd { | |||
195 | struct i596_cmd *v_next; /* Address from CPUs viewpoint */ | 195 | struct i596_cmd *v_next; /* Address from CPUs viewpoint */ |
196 | unsigned short status; | 196 | unsigned short status; |
197 | unsigned short command; | 197 | unsigned short command; |
198 | dma_addr_t b_next; /* Address from i596 viewpoint */ | 198 | u32 b_next; /* Address from i596 viewpoint */ |
199 | }; | 199 | }; |
200 | 200 | ||
201 | struct tx_cmd { | 201 | struct tx_cmd { |
202 | struct i596_cmd cmd; | 202 | struct i596_cmd cmd; |
203 | dma_addr_t tbd; | 203 | u32 tbd; |
204 | unsigned short size; | 204 | unsigned short size; |
205 | unsigned short pad; | 205 | unsigned short pad; |
206 | struct sk_buff *skb; /* So we can free it after tx */ | 206 | struct sk_buff *skb; /* So we can free it after tx */ |
@@ -237,8 +237,8 @@ struct cf_cmd { | |||
237 | struct i596_rfd { | 237 | struct i596_rfd { |
238 | unsigned short stat; | 238 | unsigned short stat; |
239 | unsigned short cmd; | 239 | unsigned short cmd; |
240 | dma_addr_t b_next; /* Address from i596 viewpoint */ | 240 | u32 b_next; /* Address from i596 viewpoint */ |
241 | dma_addr_t rbd; | 241 | u32 rbd; |
242 | unsigned short count; | 242 | unsigned short count; |
243 | unsigned short size; | 243 | unsigned short size; |
244 | struct i596_rfd *v_next; /* Address from CPUs viewpoint */ | 244 | struct i596_rfd *v_next; /* Address from CPUs viewpoint */ |
@@ -249,18 +249,18 @@ struct i596_rfd { | |||
249 | }; | 249 | }; |
250 | 250 | ||
251 | struct i596_rbd { | 251 | struct i596_rbd { |
252 | /* hardware data */ | 252 | /* hardware data */ |
253 | unsigned short count; | 253 | unsigned short count; |
254 | unsigned short zero1; | 254 | unsigned short zero1; |
255 | dma_addr_t b_next; | 255 | u32 b_next; |
256 | dma_addr_t b_data; /* Address from i596 viewpoint */ | 256 | u32 b_data; /* Address from i596 viewpoint */ |
257 | unsigned short size; | 257 | unsigned short size; |
258 | unsigned short zero2; | 258 | unsigned short zero2; |
259 | /* driver data */ | 259 | /* driver data */ |
260 | struct sk_buff *skb; | 260 | struct sk_buff *skb; |
261 | struct i596_rbd *v_next; | 261 | struct i596_rbd *v_next; |
262 | dma_addr_t b_addr; /* This rbd addr from i596 view */ | 262 | u32 b_addr; /* This rbd addr from i596 view */ |
263 | unsigned char *v_data; /* Address from CPUs viewpoint */ | 263 | unsigned char *v_data; /* Address from CPUs viewpoint */ |
264 | /* Total 32 bytes... */ | 264 | /* Total 32 bytes... */ |
265 | #ifdef __LP64__ | 265 | #ifdef __LP64__ |
266 | u32 cache_pad[4]; | 266 | u32 cache_pad[4]; |
@@ -275,8 +275,8 @@ struct i596_rbd { | |||
275 | struct i596_scb { | 275 | struct i596_scb { |
276 | unsigned short status; | 276 | unsigned short status; |
277 | unsigned short command; | 277 | unsigned short command; |
278 | dma_addr_t cmd; | 278 | u32 cmd; |
279 | dma_addr_t rfd; | 279 | u32 rfd; |
280 | u32 crc_err; | 280 | u32 crc_err; |
281 | u32 align_err; | 281 | u32 align_err; |
282 | u32 resource_err; | 282 | u32 resource_err; |
@@ -288,14 +288,14 @@ struct i596_scb { | |||
288 | }; | 288 | }; |
289 | 289 | ||
290 | struct i596_iscp { | 290 | struct i596_iscp { |
291 | u32 stat; | 291 | u32 stat; |
292 | dma_addr_t scb; | 292 | u32 scb; |
293 | }; | 293 | }; |
294 | 294 | ||
295 | struct i596_scp { | 295 | struct i596_scp { |
296 | u32 sysbus; | 296 | u32 sysbus; |
297 | u32 pad; | 297 | u32 pad; |
298 | dma_addr_t iscp; | 298 | u32 iscp; |
299 | }; | 299 | }; |
300 | 300 | ||
301 | struct i596_dma { | 301 | struct i596_dma { |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 662b8d16803c..fa147cd5d68c 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -242,7 +242,7 @@ static void loopback_setup(struct net_device *dev) | |||
242 | | NETIF_F_NO_CSUM | 242 | | NETIF_F_NO_CSUM |
243 | | NETIF_F_HIGHDMA | 243 | | NETIF_F_HIGHDMA |
244 | | NETIF_F_LLTX | 244 | | NETIF_F_LLTX |
245 | | NETIF_F_NETNS_LOCAL, | 245 | | NETIF_F_NETNS_LOCAL; |
246 | dev->ethtool_ops = &loopback_ethtool_ops; | 246 | dev->ethtool_ops = &loopback_ethtool_ops; |
247 | dev->header_ops = ð_header_ops; | 247 | dev->header_ops = ð_header_ops; |
248 | dev->init = loopback_dev_init; | 248 | dev->init = loopback_dev_init; |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 047ea7be4850..e10528ed9081 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp) | |||
307 | (unsigned long)status); | 307 | (unsigned long)status); |
308 | 308 | ||
309 | if (status & MACB_BIT(UND)) { | 309 | if (status & MACB_BIT(UND)) { |
310 | int i; | ||
310 | printk(KERN_ERR "%s: TX underrun, resetting buffers\n", | 311 | printk(KERN_ERR "%s: TX underrun, resetting buffers\n", |
311 | bp->dev->name); | 312 | bp->dev->name); |
313 | |||
314 | head = bp->tx_head; | ||
315 | |||
316 | /*Mark all the buffer as used to avoid sending a lost buffer*/ | ||
317 | for (i = 0; i < TX_RING_SIZE; i++) | ||
318 | bp->tx_ring[i].ctrl = MACB_BIT(TX_USED); | ||
319 | |||
320 | /* free transmit buffer in upper layer*/ | ||
321 | for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) { | ||
322 | struct ring_info *rp = &bp->tx_skb[tail]; | ||
323 | struct sk_buff *skb = rp->skb; | ||
324 | |||
325 | BUG_ON(skb == NULL); | ||
326 | |||
327 | rmb(); | ||
328 | |||
329 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, | ||
330 | DMA_TO_DEVICE); | ||
331 | rp->skb = NULL; | ||
332 | dev_kfree_skb_irq(skb); | ||
333 | } | ||
334 | |||
312 | bp->tx_head = bp->tx_tail = 0; | 335 | bp->tx_head = bp->tx_tail = 0; |
313 | } | 336 | } |
314 | 337 | ||
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 2e4bcd5654c4..e8dc2f44fec9 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev, | |||
384 | if (lowerdev == NULL) | 384 | if (lowerdev == NULL) |
385 | return -ENODEV; | 385 | return -ENODEV; |
386 | 386 | ||
387 | /* Don't allow macvlans on top of other macvlans - its not really | ||
388 | * wrong, but lockdep can't handle it and its not useful for anything | ||
389 | * you couldn't do directly on top of the real device. | ||
390 | */ | ||
391 | if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) | ||
392 | return -ENODEV; | ||
393 | |||
387 | if (!tb[IFLA_MTU]) | 394 | if (!tb[IFLA_MTU]) |
388 | dev->mtu = lowerdev->mtu; | 395 | dev->mtu = lowerdev->mtu; |
389 | else if (dev->mtu > lowerdev->mtu) | 396 | else if (dev->mtu > lowerdev->mtu) |
diff --git a/drivers/net/meth.c b/drivers/net/meth.c index 0c89b028a80c..cdaa8fc21809 100644 --- a/drivers/net/meth.c +++ b/drivers/net/meth.c | |||
@@ -95,11 +95,14 @@ static inline void load_eaddr(struct net_device *dev) | |||
95 | { | 95 | { |
96 | int i; | 96 | int i; |
97 | DECLARE_MAC_BUF(mac); | 97 | DECLARE_MAC_BUF(mac); |
98 | u64 macaddr; | ||
98 | 99 | ||
99 | for (i = 0; i < 6; i++) | ||
100 | dev->dev_addr[i] = o2meth_eaddr[i]; | ||
101 | DPRINTK("Loading MAC Address: %s\n", print_mac(mac, dev->dev_addr)); | 100 | DPRINTK("Loading MAC Address: %s\n", print_mac(mac, dev->dev_addr)); |
102 | mace->eth.mac_addr = (*(unsigned long*)o2meth_eaddr) >> 16; | 101 | macaddr = 0; |
102 | for (i = 0; i < 6; i++) | ||
103 | macaddr |= dev->dev_addr[i] << ((5 - i) * 8); | ||
104 | |||
105 | mace->eth.mac_addr = macaddr; | ||
103 | } | 106 | } |
104 | 107 | ||
105 | /* | 108 | /* |
@@ -794,6 +797,7 @@ static int __init meth_probe(struct platform_device *pdev) | |||
794 | #endif | 797 | #endif |
795 | dev->irq = MACE_ETHERNET_IRQ; | 798 | dev->irq = MACE_ETHERNET_IRQ; |
796 | dev->base_addr = (unsigned long)&mace->eth; | 799 | dev->base_addr = (unsigned long)&mace->eth; |
800 | memcpy(dev->dev_addr, o2meth_eaddr, 6); | ||
797 | 801 | ||
798 | priv = netdev_priv(dev); | 802 | priv = netdev_priv(dev); |
799 | spin_lock_init(&priv->meth_lock); | 803 | spin_lock_init(&priv->meth_lock); |
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c index 42b47639c81c..fa24e6597591 100644 --- a/drivers/net/mlx4/qp.c +++ b/drivers/net/mlx4/qp.c | |||
@@ -113,7 +113,7 @@ int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | |||
113 | struct mlx4_cmd_mailbox *mailbox; | 113 | struct mlx4_cmd_mailbox *mailbox; |
114 | int ret = 0; | 114 | int ret = 0; |
115 | 115 | ||
116 | if (cur_state >= MLX4_QP_NUM_STATE || cur_state >= MLX4_QP_NUM_STATE || | 116 | if (cur_state >= MLX4_QP_NUM_STATE || new_state >= MLX4_QP_NUM_STATE || |
117 | !op[cur_state][new_state]) | 117 | !op[cur_state][new_state]) |
118 | return -EINVAL; | 118 | return -EINVAL; |
119 | 119 | ||
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 0f306ddb5630..c90958f6d3fe 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -1239,7 +1239,7 @@ static int myri10ge_poll(struct napi_struct *napi, int budget) | |||
1239 | /* process as many rx events as NAPI will allow */ | 1239 | /* process as many rx events as NAPI will allow */ |
1240 | work_done = myri10ge_clean_rx_done(mgp, budget); | 1240 | work_done = myri10ge_clean_rx_done(mgp, budget); |
1241 | 1241 | ||
1242 | if (work_done < budget || !netif_running(netdev)) { | 1242 | if (work_done < budget) { |
1243 | netif_rx_complete(netdev, napi); | 1243 | netif_rx_complete(netdev, napi); |
1244 | put_be32(htonl(3), mgp->irq_claim); | 1244 | put_be32(htonl(3), mgp->irq_claim); |
1245 | } | 1245 | } |
@@ -1979,6 +1979,7 @@ static int myri10ge_open(struct net_device *dev) | |||
1979 | lro_mgr->lro_arr = mgp->rx_done.lro_desc; | 1979 | lro_mgr->lro_arr = mgp->rx_done.lro_desc; |
1980 | lro_mgr->get_frag_header = myri10ge_get_frag_header; | 1980 | lro_mgr->get_frag_header = myri10ge_get_frag_header; |
1981 | lro_mgr->max_aggr = myri10ge_lro_max_pkts; | 1981 | lro_mgr->max_aggr = myri10ge_lro_max_pkts; |
1982 | lro_mgr->frag_align_pad = 2; | ||
1982 | if (lro_mgr->max_aggr > MAX_SKB_FRAGS) | 1983 | if (lro_mgr->max_aggr > MAX_SKB_FRAGS) |
1983 | lro_mgr->max_aggr = MAX_SKB_FRAGS; | 1984 | lro_mgr->max_aggr = MAX_SKB_FRAGS; |
1984 | 1985 | ||
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 87cde062fd63..c329a4f5840c 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -2266,7 +2266,7 @@ static int natsemi_poll(struct napi_struct *napi, int budget) | |||
2266 | /* Reenable interrupts providing nothing is trying to shut | 2266 | /* Reenable interrupts providing nothing is trying to shut |
2267 | * the chip down. */ | 2267 | * the chip down. */ |
2268 | spin_lock(&np->lock); | 2268 | spin_lock(&np->lock); |
2269 | if (!np->hands_off && netif_running(dev)) | 2269 | if (!np->hands_off) |
2270 | natsemi_irq_enable(dev); | 2270 | natsemi_irq_enable(dev); |
2271 | spin_unlock(&np->lock); | 2271 | spin_unlock(&np->lock); |
2272 | 2272 | ||
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c index 5267e031daa0..78d34af13a1c 100644 --- a/drivers/net/netx-eth.c +++ b/drivers/net/netx-eth.c | |||
@@ -169,8 +169,8 @@ static void netx_eth_receive(struct net_device *ndev) | |||
169 | ndev->last_rx = jiffies; | 169 | ndev->last_rx = jiffies; |
170 | skb->protocol = eth_type_trans(skb, ndev); | 170 | skb->protocol = eth_type_trans(skb, ndev); |
171 | netif_rx(skb); | 171 | netif_rx(skb); |
172 | dev->stats.rx_packets++; | 172 | ndev->stats.rx_packets++; |
173 | dev->stats.rx_bytes += len; | 173 | ndev->stats.rx_bytes += len; |
174 | } | 174 | } |
175 | 175 | ||
176 | static irqreturn_t | 176 | static irqreturn_t |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index fbc2553275dc..a8f63c47b3cd 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -65,8 +65,8 @@ | |||
65 | 65 | ||
66 | #define _NETXEN_NIC_LINUX_MAJOR 3 | 66 | #define _NETXEN_NIC_LINUX_MAJOR 3 |
67 | #define _NETXEN_NIC_LINUX_MINOR 4 | 67 | #define _NETXEN_NIC_LINUX_MINOR 4 |
68 | #define _NETXEN_NIC_LINUX_SUBVERSION 2 | 68 | #define _NETXEN_NIC_LINUX_SUBVERSION 18 |
69 | #define NETXEN_NIC_LINUX_VERSIONID "3.4.2" | 69 | #define NETXEN_NIC_LINUX_VERSIONID "3.4.18" |
70 | 70 | ||
71 | #define NETXEN_NUM_FLASH_SECTORS (64) | 71 | #define NETXEN_NUM_FLASH_SECTORS (64) |
72 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) | 72 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) |
@@ -309,23 +309,26 @@ struct netxen_ring_ctx { | |||
309 | ((cmd_desc)->port_ctxid |= ((var) & 0xF0)) | 309 | ((cmd_desc)->port_ctxid |= ((var) & 0xF0)) |
310 | 310 | ||
311 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ | 311 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ |
312 | ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ | 312 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ |
313 | (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) | 313 | ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f) |
314 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ | 314 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ |
315 | ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ | 315 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ |
316 | (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7))) | 316 | ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7) |
317 | 317 | ||
318 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ | 318 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ |
319 | ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ | 319 | (cmd_desc)->num_of_buffers_total_length = \ |
320 | (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) | 320 | ((cmd_desc)->num_of_buffers_total_length & \ |
321 | ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff) | ||
321 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ | 322 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ |
322 | ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \ | 323 | (cmd_desc)->num_of_buffers_total_length = \ |
323 | (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8)) | 324 | ((cmd_desc)->num_of_buffers_total_length & \ |
325 | ~cpu_to_le32((u32)0xffffff << 8)) | \ | ||
326 | cpu_to_le32(((val) & 0xffffff) << 8) | ||
324 | 327 | ||
325 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ | 328 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ |
326 | ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) | 329 | ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f) |
327 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ | 330 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ |
328 | (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) | 331 | ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff) |
329 | 332 | ||
330 | struct cmd_desc_type0 { | 333 | struct cmd_desc_type0 { |
331 | u8 tcp_hdr_offset; /* For LSO only */ | 334 | u8 tcp_hdr_offset; /* For LSO only */ |
@@ -412,29 +415,29 @@ struct rcv_desc { | |||
412 | #define netxen_get_sts_desc_lro_last_frag(status_desc) \ | 415 | #define netxen_get_sts_desc_lro_last_frag(status_desc) \ |
413 | (((status_desc)->lro & 0x80) >> 7) | 416 | (((status_desc)->lro & 0x80) >> 7) |
414 | 417 | ||
415 | #define netxen_get_sts_port(status_desc) \ | 418 | #define netxen_get_sts_port(sts_data) \ |
416 | (le64_to_cpu((status_desc)->status_desc_data) & 0x0F) | 419 | ((sts_data) & 0x0F) |
417 | #define netxen_get_sts_status(status_desc) \ | 420 | #define netxen_get_sts_status(sts_data) \ |
418 | ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F) | 421 | (((sts_data) >> 4) & 0x0F) |
419 | #define netxen_get_sts_type(status_desc) \ | 422 | #define netxen_get_sts_type(sts_data) \ |
420 | ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F) | 423 | (((sts_data) >> 8) & 0x0F) |
421 | #define netxen_get_sts_totallength(status_desc) \ | 424 | #define netxen_get_sts_totallength(sts_data) \ |
422 | ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF) | 425 | (((sts_data) >> 12) & 0xFFFF) |
423 | #define netxen_get_sts_refhandle(status_desc) \ | 426 | #define netxen_get_sts_refhandle(sts_data) \ |
424 | ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF) | 427 | (((sts_data) >> 28) & 0xFFFF) |
425 | #define netxen_get_sts_prot(status_desc) \ | 428 | #define netxen_get_sts_prot(sts_data) \ |
426 | ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F) | 429 | (((sts_data) >> 44) & 0x0F) |
430 | #define netxen_get_sts_opcode(sts_data) \ | ||
431 | (((sts_data) >> 58) & 0x03F) | ||
432 | |||
427 | #define netxen_get_sts_owner(status_desc) \ | 433 | #define netxen_get_sts_owner(status_desc) \ |
428 | ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) | 434 | ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) |
429 | #define netxen_get_sts_opcode(status_desc) \ | 435 | #define netxen_set_sts_owner(status_desc, val) { \ |
430 | ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F) | 436 | (status_desc)->status_desc_data = \ |
431 | 437 | ((status_desc)->status_desc_data & \ | |
432 | #define netxen_clear_sts_owner(status_desc) \ | 438 | ~cpu_to_le64(0x3ULL << 56)) | \ |
433 | ((status_desc)->status_desc_data &= \ | 439 | cpu_to_le64((u64)((val) & 0x3) << 56); \ |
434 | ~cpu_to_le64(((unsigned long long)3) << 56 )) | 440 | } |
435 | #define netxen_set_sts_owner(status_desc, val) \ | ||
436 | ((status_desc)->status_desc_data |= \ | ||
437 | cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 )) | ||
438 | 441 | ||
439 | struct status_desc { | 442 | struct status_desc { |
440 | /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length | 443 | /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 37589265297e..485ff9398910 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -1070,16 +1070,17 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
1070 | { | 1070 | { |
1071 | struct pci_dev *pdev = adapter->pdev; | 1071 | struct pci_dev *pdev = adapter->pdev; |
1072 | struct net_device *netdev = adapter->netdev; | 1072 | struct net_device *netdev = adapter->netdev; |
1073 | int index = netxen_get_sts_refhandle(desc); | 1073 | u64 sts_data = le64_to_cpu(desc->status_desc_data); |
1074 | int index = netxen_get_sts_refhandle(sts_data); | ||
1074 | struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); | 1075 | struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); |
1075 | struct netxen_rx_buffer *buffer; | 1076 | struct netxen_rx_buffer *buffer; |
1076 | struct sk_buff *skb; | 1077 | struct sk_buff *skb; |
1077 | u32 length = netxen_get_sts_totallength(desc); | 1078 | u32 length = netxen_get_sts_totallength(sts_data); |
1078 | u32 desc_ctx; | 1079 | u32 desc_ctx; |
1079 | struct netxen_rcv_desc_ctx *rcv_desc; | 1080 | struct netxen_rcv_desc_ctx *rcv_desc; |
1080 | int ret; | 1081 | int ret; |
1081 | 1082 | ||
1082 | desc_ctx = netxen_get_sts_type(desc); | 1083 | desc_ctx = netxen_get_sts_type(sts_data); |
1083 | if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { | 1084 | if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { |
1084 | printk("%s: %s Bad Rcv descriptor ring\n", | 1085 | printk("%s: %s Bad Rcv descriptor ring\n", |
1085 | netxen_nic_driver_name, netdev->name); | 1086 | netxen_nic_driver_name, netdev->name); |
@@ -1119,7 +1120,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
1119 | skb = (struct sk_buff *)buffer->skb; | 1120 | skb = (struct sk_buff *)buffer->skb; |
1120 | 1121 | ||
1121 | if (likely(adapter->rx_csum && | 1122 | if (likely(adapter->rx_csum && |
1122 | netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { | 1123 | netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) { |
1123 | adapter->stats.csummed++; | 1124 | adapter->stats.csummed++; |
1124 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1125 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1125 | } else | 1126 | } else |
@@ -1209,7 +1210,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
1209 | break; | 1210 | break; |
1210 | } | 1211 | } |
1211 | netxen_process_rcv(adapter, ctxid, desc); | 1212 | netxen_process_rcv(adapter, ctxid, desc); |
1212 | netxen_clear_sts_owner(desc); | ||
1213 | netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); | 1213 | netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); |
1214 | consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); | 1214 | consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); |
1215 | count++; | 1215 | count++; |
@@ -1248,7 +1248,6 @@ int netxen_process_cmd_ring(unsigned long data) | |||
1248 | struct pci_dev *pdev; | 1248 | struct pci_dev *pdev; |
1249 | struct netxen_skb_frag *frag; | 1249 | struct netxen_skb_frag *frag; |
1250 | u32 i; | 1250 | u32 i; |
1251 | struct sk_buff *skb = NULL; | ||
1252 | int done; | 1251 | int done; |
1253 | 1252 | ||
1254 | spin_lock(&adapter->tx_lock); | 1253 | spin_lock(&adapter->tx_lock); |
@@ -1278,9 +1277,8 @@ int netxen_process_cmd_ring(unsigned long data) | |||
1278 | while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { | 1277 | while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { |
1279 | buffer = &adapter->cmd_buf_arr[last_consumer]; | 1278 | buffer = &adapter->cmd_buf_arr[last_consumer]; |
1280 | pdev = adapter->pdev; | 1279 | pdev = adapter->pdev; |
1281 | frag = &buffer->frag_array[0]; | 1280 | if (buffer->skb) { |
1282 | skb = buffer->skb; | 1281 | frag = &buffer->frag_array[0]; |
1283 | if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) { | ||
1284 | pci_unmap_single(pdev, frag->dma, frag->length, | 1282 | pci_unmap_single(pdev, frag->dma, frag->length, |
1285 | PCI_DMA_TODEVICE); | 1283 | PCI_DMA_TODEVICE); |
1286 | frag->dma = 0ULL; | 1284 | frag->dma = 0ULL; |
@@ -1293,8 +1291,8 @@ int netxen_process_cmd_ring(unsigned long data) | |||
1293 | } | 1291 | } |
1294 | 1292 | ||
1295 | adapter->stats.skbfreed++; | 1293 | adapter->stats.skbfreed++; |
1296 | dev_kfree_skb_any(skb); | 1294 | dev_kfree_skb_any(buffer->skb); |
1297 | skb = NULL; | 1295 | buffer->skb = NULL; |
1298 | } else if (adapter->proc_cmd_buf_counter == 1) { | 1296 | } else if (adapter->proc_cmd_buf_counter == 1) { |
1299 | adapter->stats.txnullskb++; | 1297 | adapter->stats.txnullskb++; |
1300 | } | 1298 | } |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index a80f0cd6b528..263b55e36c7a 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -732,11 +732,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
732 | 732 | ||
733 | unregister_netdev(netdev); | 733 | unregister_netdev(netdev); |
734 | 734 | ||
735 | if (adapter->stop_port) | ||
736 | adapter->stop_port(adapter); | ||
737 | |||
738 | netxen_nic_disable_int(adapter); | ||
739 | |||
740 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { | 735 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { |
741 | init_firmware_done++; | 736 | init_firmware_done++; |
742 | netxen_free_hw_resources(adapter); | 737 | netxen_free_hw_resources(adapter); |
@@ -919,6 +914,9 @@ static int netxen_nic_close(struct net_device *netdev) | |||
919 | netif_stop_queue(netdev); | 914 | netif_stop_queue(netdev); |
920 | napi_disable(&adapter->napi); | 915 | napi_disable(&adapter->napi); |
921 | 916 | ||
917 | if (adapter->stop_port) | ||
918 | adapter->stop_port(adapter); | ||
919 | |||
922 | netxen_nic_disable_int(adapter); | 920 | netxen_nic_disable_int(adapter); |
923 | 921 | ||
924 | cmd_buff = adapter->cmd_buf_arr; | 922 | cmd_buff = adapter->cmd_buf_arr; |
@@ -996,28 +994,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
996 | return NETDEV_TX_OK; | 994 | return NETDEV_TX_OK; |
997 | } | 995 | } |
998 | 996 | ||
999 | /* | ||
1000 | * Everything is set up. Now, we just need to transmit it out. | ||
1001 | * Note that we have to copy the contents of buffer over to | ||
1002 | * right place. Later on, this can be optimized out by de-coupling the | ||
1003 | * producer index from the buffer index. | ||
1004 | */ | ||
1005 | retry_getting_window: | ||
1006 | spin_lock_bh(&adapter->tx_lock); | ||
1007 | if (adapter->total_threads >= MAX_XMIT_PRODUCERS) { | ||
1008 | spin_unlock_bh(&adapter->tx_lock); | ||
1009 | /* | ||
1010 | * Yield CPU | ||
1011 | */ | ||
1012 | if (!in_atomic()) | ||
1013 | schedule(); | ||
1014 | else { | ||
1015 | for (i = 0; i < 20; i++) | ||
1016 | cpu_relax(); /*This a nop instr on i386 */ | ||
1017 | } | ||
1018 | goto retry_getting_window; | ||
1019 | } | ||
1020 | local_producer = adapter->cmd_producer; | ||
1021 | /* There 4 fragments per descriptor */ | 997 | /* There 4 fragments per descriptor */ |
1022 | no_of_desc = (frag_count + 3) >> 2; | 998 | no_of_desc = (frag_count + 3) >> 2; |
1023 | if (netdev->features & NETIF_F_TSO) { | 999 | if (netdev->features & NETIF_F_TSO) { |
@@ -1031,16 +1007,19 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1031 | } | 1007 | } |
1032 | } | 1008 | } |
1033 | } | 1009 | } |
1010 | |||
1011 | spin_lock_bh(&adapter->tx_lock); | ||
1012 | if (adapter->total_threads >= MAX_XMIT_PRODUCERS) { | ||
1013 | goto out_requeue; | ||
1014 | } | ||
1015 | local_producer = adapter->cmd_producer; | ||
1034 | k = adapter->cmd_producer; | 1016 | k = adapter->cmd_producer; |
1035 | max_tx_desc_count = adapter->max_tx_desc_count; | 1017 | max_tx_desc_count = adapter->max_tx_desc_count; |
1036 | last_cmd_consumer = adapter->last_cmd_consumer; | 1018 | last_cmd_consumer = adapter->last_cmd_consumer; |
1037 | if ((k + no_of_desc) >= | 1019 | if ((k + no_of_desc) >= |
1038 | ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : | 1020 | ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : |
1039 | last_cmd_consumer)) { | 1021 | last_cmd_consumer)) { |
1040 | netif_stop_queue(netdev); | 1022 | goto out_requeue; |
1041 | adapter->flags |= NETXEN_NETDEV_STATUS; | ||
1042 | spin_unlock_bh(&adapter->tx_lock); | ||
1043 | return NETDEV_TX_BUSY; | ||
1044 | } | 1023 | } |
1045 | k = get_index_range(k, max_tx_desc_count, no_of_desc); | 1024 | k = get_index_range(k, max_tx_desc_count, no_of_desc); |
1046 | adapter->cmd_producer = k; | 1025 | adapter->cmd_producer = k; |
@@ -1093,6 +1072,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1093 | adapter->max_tx_desc_count); | 1072 | adapter->max_tx_desc_count); |
1094 | hwdesc = &hw->cmd_desc_head[producer]; | 1073 | hwdesc = &hw->cmd_desc_head[producer]; |
1095 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); | 1074 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); |
1075 | pbuf = &adapter->cmd_buf_arr[producer]; | ||
1076 | pbuf->skb = NULL; | ||
1096 | } | 1077 | } |
1097 | frag = &skb_shinfo(skb)->frags[i - 1]; | 1078 | frag = &skb_shinfo(skb)->frags[i - 1]; |
1098 | len = frag->size; | 1079 | len = frag->size; |
@@ -1148,6 +1129,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1148 | } | 1129 | } |
1149 | /* copy the MAC/IP/TCP headers to the cmd descriptor list */ | 1130 | /* copy the MAC/IP/TCP headers to the cmd descriptor list */ |
1150 | hwdesc = &hw->cmd_desc_head[producer]; | 1131 | hwdesc = &hw->cmd_desc_head[producer]; |
1132 | pbuf = &adapter->cmd_buf_arr[producer]; | ||
1133 | pbuf->skb = NULL; | ||
1151 | 1134 | ||
1152 | /* copy the first 64 bytes */ | 1135 | /* copy the first 64 bytes */ |
1153 | memcpy(((void *)hwdesc) + 2, | 1136 | memcpy(((void *)hwdesc) + 2, |
@@ -1156,6 +1139,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1156 | 1139 | ||
1157 | if (more_hdr) { | 1140 | if (more_hdr) { |
1158 | hwdesc = &hw->cmd_desc_head[producer]; | 1141 | hwdesc = &hw->cmd_desc_head[producer]; |
1142 | pbuf = &adapter->cmd_buf_arr[producer]; | ||
1143 | pbuf->skb = NULL; | ||
1159 | /* copy the next 64 bytes - should be enough except | 1144 | /* copy the next 64 bytes - should be enough except |
1160 | * for pathological case | 1145 | * for pathological case |
1161 | */ | 1146 | */ |
@@ -1167,16 +1152,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1167 | } | 1152 | } |
1168 | } | 1153 | } |
1169 | 1154 | ||
1170 | i = netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]); | ||
1171 | |||
1172 | hw->cmd_desc_head[saved_producer].flags_opcode = | ||
1173 | cpu_to_le16(hw->cmd_desc_head[saved_producer].flags_opcode); | ||
1174 | hw->cmd_desc_head[saved_producer].num_of_buffers_total_length = | ||
1175 | cpu_to_le32(hw->cmd_desc_head[saved_producer]. | ||
1176 | num_of_buffers_total_length); | ||
1177 | |||
1178 | spin_lock_bh(&adapter->tx_lock); | 1155 | spin_lock_bh(&adapter->tx_lock); |
1179 | adapter->stats.txbytes += i; | 1156 | adapter->stats.txbytes += skb->len; |
1180 | 1157 | ||
1181 | /* Code to update the adapter considering how many producer threads | 1158 | /* Code to update the adapter considering how many producer threads |
1182 | are currently working */ | 1159 | are currently working */ |
@@ -1189,14 +1166,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1189 | } | 1166 | } |
1190 | 1167 | ||
1191 | adapter->stats.xmitfinished++; | 1168 | adapter->stats.xmitfinished++; |
1192 | spin_unlock_bh(&adapter->tx_lock); | ||
1193 | |||
1194 | netdev->trans_start = jiffies; | 1169 | netdev->trans_start = jiffies; |
1195 | 1170 | ||
1196 | DPRINTK(INFO, "wrote CMD producer %x to phantom\n", producer); | 1171 | spin_unlock_bh(&adapter->tx_lock); |
1197 | |||
1198 | DPRINTK(INFO, "Done. Send\n"); | ||
1199 | return NETDEV_TX_OK; | 1172 | return NETDEV_TX_OK; |
1173 | |||
1174 | out_requeue: | ||
1175 | netif_stop_queue(netdev); | ||
1176 | adapter->flags |= NETXEN_NETDEV_STATUS; | ||
1177 | |||
1178 | spin_unlock_bh(&adapter->tx_lock); | ||
1179 | return NETDEV_TX_BUSY; | ||
1200 | } | 1180 | } |
1201 | 1181 | ||
1202 | static void netxen_watchdog(unsigned long v) | 1182 | static void netxen_watchdog(unsigned long v) |
@@ -1321,7 +1301,7 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) | |||
1321 | budget / MAX_RCV_CTX); | 1301 | budget / MAX_RCV_CTX); |
1322 | } | 1302 | } |
1323 | 1303 | ||
1324 | if (work_done >= budget && netxen_nic_rx_has_work(adapter) != 0) | 1304 | if (work_done >= budget) |
1325 | done = 0; | 1305 | done = 0; |
1326 | 1306 | ||
1327 | if (netxen_process_cmd_ring((unsigned long)adapter) == 0) | 1307 | if (netxen_process_cmd_ring((unsigned long)adapter) == 0) |
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 5b9e1b300fab..d04ecb77d08c 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -736,12 +736,12 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | |||
736 | __u32 mac_cfg; | 736 | __u32 mac_cfg; |
737 | u32 port = physical_port[adapter->portnum]; | 737 | u32 port = physical_port[adapter->portnum]; |
738 | 738 | ||
739 | if (port != 0) | 739 | if (port > NETXEN_NIU_MAX_XG_PORTS) |
740 | return -EINVAL; | 740 | return -EINVAL; |
741 | |||
741 | mac_cfg = 0; | 742 | mac_cfg = 0; |
742 | netxen_xg_soft_reset(mac_cfg); | 743 | if (netxen_nic_hw_write_wx(adapter, |
743 | if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0, | 744 | NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4)) |
744 | &mac_cfg, 4)) | ||
745 | return -EIO; | 745 | return -EIO; |
746 | return 0; | 746 | return 0; |
747 | } | 747 | } |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 112ab079ce7d..5f6beabf2d17 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -33,8 +33,8 @@ | |||
33 | 33 | ||
34 | #define DRV_MODULE_NAME "niu" | 34 | #define DRV_MODULE_NAME "niu" |
35 | #define PFX DRV_MODULE_NAME ": " | 35 | #define PFX DRV_MODULE_NAME ": " |
36 | #define DRV_MODULE_VERSION "0.5" | 36 | #define DRV_MODULE_VERSION "0.6" |
37 | #define DRV_MODULE_RELDATE "October 5, 2007" | 37 | #define DRV_MODULE_RELDATE "January 5, 2008" |
38 | 38 | ||
39 | static char version[] __devinitdata = | 39 | static char version[] __devinitdata = |
40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
@@ -801,22 +801,90 @@ static int bcm8704_init_user_dev3(struct niu *np) | |||
801 | return 0; | 801 | return 0; |
802 | } | 802 | } |
803 | 803 | ||
804 | static int xcvr_init_10g(struct niu *np) | 804 | static int mrvl88x2011_act_led(struct niu *np, int val) |
805 | { | ||
806 | int err; | ||
807 | |||
808 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, | ||
809 | MRVL88X2011_LED_8_TO_11_CTL); | ||
810 | if (err < 0) | ||
811 | return err; | ||
812 | |||
813 | err &= ~MRVL88X2011_LED(MRVL88X2011_LED_ACT,MRVL88X2011_LED_CTL_MASK); | ||
814 | err |= MRVL88X2011_LED(MRVL88X2011_LED_ACT,val); | ||
815 | |||
816 | return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, | ||
817 | MRVL88X2011_LED_8_TO_11_CTL, err); | ||
818 | } | ||
819 | |||
820 | static int mrvl88x2011_led_blink_rate(struct niu *np, int rate) | ||
821 | { | ||
822 | int err; | ||
823 | |||
824 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, | ||
825 | MRVL88X2011_LED_BLINK_CTL); | ||
826 | if (err >= 0) { | ||
827 | err &= ~MRVL88X2011_LED_BLKRATE_MASK; | ||
828 | err |= (rate << 4); | ||
829 | |||
830 | err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, | ||
831 | MRVL88X2011_LED_BLINK_CTL, err); | ||
832 | } | ||
833 | |||
834 | return err; | ||
835 | } | ||
836 | |||
837 | static int xcvr_init_10g_mrvl88x2011(struct niu *np) | ||
838 | { | ||
839 | int err; | ||
840 | |||
841 | /* Set LED functions */ | ||
842 | err = mrvl88x2011_led_blink_rate(np, MRVL88X2011_LED_BLKRATE_134MS); | ||
843 | if (err) | ||
844 | return err; | ||
845 | |||
846 | /* led activity */ | ||
847 | err = mrvl88x2011_act_led(np, MRVL88X2011_LED_CTL_OFF); | ||
848 | if (err) | ||
849 | return err; | ||
850 | |||
851 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, | ||
852 | MRVL88X2011_GENERAL_CTL); | ||
853 | if (err < 0) | ||
854 | return err; | ||
855 | |||
856 | err |= MRVL88X2011_ENA_XFPREFCLK; | ||
857 | |||
858 | err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, | ||
859 | MRVL88X2011_GENERAL_CTL, err); | ||
860 | if (err < 0) | ||
861 | return err; | ||
862 | |||
863 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, | ||
864 | MRVL88X2011_PMA_PMD_CTL_1); | ||
865 | if (err < 0) | ||
866 | return err; | ||
867 | |||
868 | if (np->link_config.loopback_mode == LOOPBACK_MAC) | ||
869 | err |= MRVL88X2011_LOOPBACK; | ||
870 | else | ||
871 | err &= ~MRVL88X2011_LOOPBACK; | ||
872 | |||
873 | err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, | ||
874 | MRVL88X2011_PMA_PMD_CTL_1, err); | ||
875 | if (err < 0) | ||
876 | return err; | ||
877 | |||
878 | /* Enable PMD */ | ||
879 | return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, | ||
880 | MRVL88X2011_10G_PMD_TX_DIS, MRVL88X2011_ENA_PMDTX); | ||
881 | } | ||
882 | |||
883 | static int xcvr_init_10g_bcm8704(struct niu *np) | ||
805 | { | 884 | { |
806 | struct niu_link_config *lp = &np->link_config; | 885 | struct niu_link_config *lp = &np->link_config; |
807 | u16 analog_stat0, tx_alarm_status; | 886 | u16 analog_stat0, tx_alarm_status; |
808 | int err; | 887 | int err; |
809 | u64 val; | ||
810 | |||
811 | val = nr64_mac(XMAC_CONFIG); | ||
812 | val &= ~XMAC_CONFIG_LED_POLARITY; | ||
813 | val |= XMAC_CONFIG_FORCE_LED_ON; | ||
814 | nw64_mac(XMAC_CONFIG, val); | ||
815 | |||
816 | /* XXX shared resource, lock parent XXX */ | ||
817 | val = nr64(MIF_CONFIG); | ||
818 | val |= MIF_CONFIG_INDIRECT_MODE; | ||
819 | nw64(MIF_CONFIG, val); | ||
820 | 888 | ||
821 | err = bcm8704_reset(np); | 889 | err = bcm8704_reset(np); |
822 | if (err) | 890 | if (err) |
@@ -896,6 +964,38 @@ static int xcvr_init_10g(struct niu *np) | |||
896 | return 0; | 964 | return 0; |
897 | } | 965 | } |
898 | 966 | ||
967 | static int xcvr_init_10g(struct niu *np) | ||
968 | { | ||
969 | int phy_id, err; | ||
970 | u64 val; | ||
971 | |||
972 | val = nr64_mac(XMAC_CONFIG); | ||
973 | val &= ~XMAC_CONFIG_LED_POLARITY; | ||
974 | val |= XMAC_CONFIG_FORCE_LED_ON; | ||
975 | nw64_mac(XMAC_CONFIG, val); | ||
976 | |||
977 | /* XXX shared resource, lock parent XXX */ | ||
978 | val = nr64(MIF_CONFIG); | ||
979 | val |= MIF_CONFIG_INDIRECT_MODE; | ||
980 | nw64(MIF_CONFIG, val); | ||
981 | |||
982 | phy_id = phy_decode(np->parent->port_phy, np->port); | ||
983 | phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port]; | ||
984 | |||
985 | /* handle different phy types */ | ||
986 | switch (phy_id & NIU_PHY_ID_MASK) { | ||
987 | case NIU_PHY_ID_MRVL88X2011: | ||
988 | err = xcvr_init_10g_mrvl88x2011(np); | ||
989 | break; | ||
990 | |||
991 | default: /* bcom 8704 */ | ||
992 | err = xcvr_init_10g_bcm8704(np); | ||
993 | break; | ||
994 | } | ||
995 | |||
996 | return 0; | ||
997 | } | ||
998 | |||
899 | static int mii_reset(struct niu *np) | 999 | static int mii_reset(struct niu *np) |
900 | { | 1000 | { |
901 | int limit, err; | 1001 | int limit, err; |
@@ -1045,6 +1145,7 @@ static int niu_serdes_init(struct niu *np) | |||
1045 | } | 1145 | } |
1046 | 1146 | ||
1047 | static void niu_init_xif(struct niu *); | 1147 | static void niu_init_xif(struct niu *); |
1148 | static void niu_handle_led(struct niu *, int status); | ||
1048 | 1149 | ||
1049 | static int niu_link_status_common(struct niu *np, int link_up) | 1150 | static int niu_link_status_common(struct niu *np, int link_up) |
1050 | { | 1151 | { |
@@ -1066,30 +1167,83 @@ static int niu_link_status_common(struct niu *np, int link_up) | |||
1066 | 1167 | ||
1067 | spin_lock_irqsave(&np->lock, flags); | 1168 | spin_lock_irqsave(&np->lock, flags); |
1068 | niu_init_xif(np); | 1169 | niu_init_xif(np); |
1170 | niu_handle_led(np, 1); | ||
1069 | spin_unlock_irqrestore(&np->lock, flags); | 1171 | spin_unlock_irqrestore(&np->lock, flags); |
1070 | 1172 | ||
1071 | netif_carrier_on(dev); | 1173 | netif_carrier_on(dev); |
1072 | } else if (netif_carrier_ok(dev) && !link_up) { | 1174 | } else if (netif_carrier_ok(dev) && !link_up) { |
1073 | niuwarn(LINK, "%s: Link is down\n", dev->name); | 1175 | niuwarn(LINK, "%s: Link is down\n", dev->name); |
1176 | spin_lock_irqsave(&np->lock, flags); | ||
1177 | niu_handle_led(np, 0); | ||
1178 | spin_unlock_irqrestore(&np->lock, flags); | ||
1074 | netif_carrier_off(dev); | 1179 | netif_carrier_off(dev); |
1075 | } | 1180 | } |
1076 | 1181 | ||
1077 | return 0; | 1182 | return 0; |
1078 | } | 1183 | } |
1079 | 1184 | ||
1080 | static int link_status_10g(struct niu *np, int *link_up_p) | 1185 | static int link_status_10g_mrvl(struct niu *np, int *link_up_p) |
1081 | { | 1186 | { |
1082 | unsigned long flags; | 1187 | int err, link_up, pma_status, pcs_status; |
1083 | int err, link_up; | ||
1084 | 1188 | ||
1085 | link_up = 0; | 1189 | link_up = 0; |
1086 | 1190 | ||
1087 | spin_lock_irqsave(&np->lock, flags); | 1191 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, |
1192 | MRVL88X2011_10G_PMD_STATUS_2); | ||
1193 | if (err < 0) | ||
1194 | goto out; | ||
1088 | 1195 | ||
1089 | err = -EINVAL; | 1196 | /* Check PMA/PMD Register: 1.0001.2 == 1 */ |
1090 | if (np->link_config.loopback_mode != LOOPBACK_DISABLED) | 1197 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, |
1198 | MRVL88X2011_PMA_PMD_STATUS_1); | ||
1199 | if (err < 0) | ||
1200 | goto out; | ||
1201 | |||
1202 | pma_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0); | ||
1203 | |||
1204 | /* Check PMC Register : 3.0001.2 == 1: read twice */ | ||
1205 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, | ||
1206 | MRVL88X2011_PMA_PMD_STATUS_1); | ||
1207 | if (err < 0) | ||
1091 | goto out; | 1208 | goto out; |
1092 | 1209 | ||
1210 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, | ||
1211 | MRVL88X2011_PMA_PMD_STATUS_1); | ||
1212 | if (err < 0) | ||
1213 | goto out; | ||
1214 | |||
1215 | pcs_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0); | ||
1216 | |||
1217 | /* Check XGXS Register : 4.0018.[0-3,12] */ | ||
1218 | err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV4_ADDR, | ||
1219 | MRVL88X2011_10G_XGXS_LANE_STAT); | ||
1220 | if (err < 0) | ||
1221 | goto out; | ||
1222 | |||
1223 | if (err == (PHYXS_XGXS_LANE_STAT_ALINGED | PHYXS_XGXS_LANE_STAT_LANE3 | | ||
1224 | PHYXS_XGXS_LANE_STAT_LANE2 | PHYXS_XGXS_LANE_STAT_LANE1 | | ||
1225 | PHYXS_XGXS_LANE_STAT_LANE0 | PHYXS_XGXS_LANE_STAT_MAGIC | | ||
1226 | 0x800)) | ||
1227 | link_up = (pma_status && pcs_status) ? 1 : 0; | ||
1228 | |||
1229 | np->link_config.active_speed = SPEED_10000; | ||
1230 | np->link_config.active_duplex = DUPLEX_FULL; | ||
1231 | err = 0; | ||
1232 | out: | ||
1233 | mrvl88x2011_act_led(np, (link_up ? | ||
1234 | MRVL88X2011_LED_CTL_PCS_ACT : | ||
1235 | MRVL88X2011_LED_CTL_OFF)); | ||
1236 | |||
1237 | *link_up_p = link_up; | ||
1238 | return err; | ||
1239 | } | ||
1240 | |||
1241 | static int link_status_10g_bcom(struct niu *np, int *link_up_p) | ||
1242 | { | ||
1243 | int err, link_up; | ||
1244 | |||
1245 | link_up = 0; | ||
1246 | |||
1093 | err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, | 1247 | err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, |
1094 | BCM8704_PMD_RCV_SIGDET); | 1248 | BCM8704_PMD_RCV_SIGDET); |
1095 | if (err < 0) | 1249 | if (err < 0) |
@@ -1129,14 +1283,43 @@ static int link_status_10g(struct niu *np, int *link_up_p) | |||
1129 | err = 0; | 1283 | err = 0; |
1130 | 1284 | ||
1131 | out: | 1285 | out: |
1286 | *link_up_p = link_up; | ||
1287 | return err; | ||
1288 | } | ||
1289 | |||
1290 | static int link_status_10g(struct niu *np, int *link_up_p) | ||
1291 | { | ||
1292 | unsigned long flags; | ||
1293 | int err = -EINVAL; | ||
1294 | |||
1295 | spin_lock_irqsave(&np->lock, flags); | ||
1296 | |||
1297 | if (np->link_config.loopback_mode == LOOPBACK_DISABLED) { | ||
1298 | int phy_id; | ||
1299 | |||
1300 | phy_id = phy_decode(np->parent->port_phy, np->port); | ||
1301 | phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port]; | ||
1302 | |||
1303 | /* handle different phy types */ | ||
1304 | switch (phy_id & NIU_PHY_ID_MASK) { | ||
1305 | case NIU_PHY_ID_MRVL88X2011: | ||
1306 | err = link_status_10g_mrvl(np, link_up_p); | ||
1307 | break; | ||
1308 | |||
1309 | default: /* bcom 8704 */ | ||
1310 | err = link_status_10g_bcom(np, link_up_p); | ||
1311 | break; | ||
1312 | } | ||
1313 | } | ||
1314 | |||
1132 | spin_unlock_irqrestore(&np->lock, flags); | 1315 | spin_unlock_irqrestore(&np->lock, flags); |
1133 | 1316 | ||
1134 | *link_up_p = link_up; | ||
1135 | return err; | 1317 | return err; |
1136 | } | 1318 | } |
1137 | 1319 | ||
1138 | static int link_status_1g(struct niu *np, int *link_up_p) | 1320 | static int link_status_1g(struct niu *np, int *link_up_p) |
1139 | { | 1321 | { |
1322 | struct niu_link_config *lp = &np->link_config; | ||
1140 | u16 current_speed, bmsr; | 1323 | u16 current_speed, bmsr; |
1141 | unsigned long flags; | 1324 | unsigned long flags; |
1142 | u8 current_duplex; | 1325 | u8 current_duplex; |
@@ -1204,6 +1387,8 @@ static int link_status_1g(struct niu *np, int *link_up_p) | |||
1204 | link_up = 0; | 1387 | link_up = 0; |
1205 | } | 1388 | } |
1206 | } | 1389 | } |
1390 | lp->active_speed = current_speed; | ||
1391 | lp->active_duplex = current_duplex; | ||
1207 | err = 0; | 1392 | err = 0; |
1208 | 1393 | ||
1209 | out: | 1394 | out: |
@@ -2236,6 +2421,8 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp) | |||
2236 | skb->protocol = eth_type_trans(skb, np->dev); | 2421 | skb->protocol = eth_type_trans(skb, np->dev); |
2237 | netif_receive_skb(skb); | 2422 | netif_receive_skb(skb); |
2238 | 2423 | ||
2424 | np->dev->last_rx = jiffies; | ||
2425 | |||
2239 | return num_rcr; | 2426 | return num_rcr; |
2240 | } | 2427 | } |
2241 | 2428 | ||
@@ -2503,15 +2690,19 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) | |||
2503 | u64 stat = nr64(RX_DMA_CTL_STAT(rp->rx_channel)); | 2690 | u64 stat = nr64(RX_DMA_CTL_STAT(rp->rx_channel)); |
2504 | int err = 0; | 2691 | int err = 0; |
2505 | 2692 | ||
2506 | dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n", | ||
2507 | np->dev->name, rp->rx_channel, (unsigned long long) stat); | ||
2508 | |||
2509 | niu_log_rxchan_errors(np, rp, stat); | ||
2510 | 2693 | ||
2511 | if (stat & (RX_DMA_CTL_STAT_CHAN_FATAL | | 2694 | if (stat & (RX_DMA_CTL_STAT_CHAN_FATAL | |
2512 | RX_DMA_CTL_STAT_PORT_FATAL)) | 2695 | RX_DMA_CTL_STAT_PORT_FATAL)) |
2513 | err = -EINVAL; | 2696 | err = -EINVAL; |
2514 | 2697 | ||
2698 | if (err) { | ||
2699 | dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n", | ||
2700 | np->dev->name, rp->rx_channel, | ||
2701 | (unsigned long long) stat); | ||
2702 | |||
2703 | niu_log_rxchan_errors(np, rp, stat); | ||
2704 | } | ||
2705 | |||
2515 | nw64(RX_DMA_CTL_STAT(rp->rx_channel), | 2706 | nw64(RX_DMA_CTL_STAT(rp->rx_channel), |
2516 | stat & RX_DMA_CTL_WRITE_CLEAR_ERRS); | 2707 | stat & RX_DMA_CTL_WRITE_CLEAR_ERRS); |
2517 | 2708 | ||
@@ -2744,13 +2935,16 @@ static int niu_device_error(struct niu *np) | |||
2744 | return -ENODEV; | 2935 | return -ENODEV; |
2745 | } | 2936 | } |
2746 | 2937 | ||
2747 | static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp) | 2938 | static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp, |
2939 | u64 v0, u64 v1, u64 v2) | ||
2748 | { | 2940 | { |
2749 | u64 v0 = lp->v0; | 2941 | |
2750 | u64 v1 = lp->v1; | ||
2751 | u64 v2 = lp->v2; | ||
2752 | int i, err = 0; | 2942 | int i, err = 0; |
2753 | 2943 | ||
2944 | lp->v0 = v0; | ||
2945 | lp->v1 = v1; | ||
2946 | lp->v2 = v2; | ||
2947 | |||
2754 | if (v1 & 0x00000000ffffffffULL) { | 2948 | if (v1 & 0x00000000ffffffffULL) { |
2755 | u32 rx_vec = (v1 & 0xffffffff); | 2949 | u32 rx_vec = (v1 & 0xffffffff); |
2756 | 2950 | ||
@@ -2759,8 +2953,13 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp) | |||
2759 | 2953 | ||
2760 | if (rx_vec & (1 << rp->rx_channel)) { | 2954 | if (rx_vec & (1 << rp->rx_channel)) { |
2761 | int r = niu_rx_error(np, rp); | 2955 | int r = niu_rx_error(np, rp); |
2762 | if (r) | 2956 | if (r) { |
2763 | err = r; | 2957 | err = r; |
2958 | } else { | ||
2959 | if (!v0) | ||
2960 | nw64(RX_DMA_CTL_STAT(rp->rx_channel), | ||
2961 | RX_DMA_CTL_STAT_MEX); | ||
2962 | } | ||
2764 | } | 2963 | } |
2765 | } | 2964 | } |
2766 | } | 2965 | } |
@@ -2798,7 +2997,7 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp) | |||
2798 | if (err) | 2997 | if (err) |
2799 | niu_enable_interrupts(np, 0); | 2998 | niu_enable_interrupts(np, 0); |
2800 | 2999 | ||
2801 | return -EINVAL; | 3000 | return err; |
2802 | } | 3001 | } |
2803 | 3002 | ||
2804 | static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp, | 3003 | static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp, |
@@ -2900,7 +3099,7 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id) | |||
2900 | } | 3099 | } |
2901 | 3100 | ||
2902 | if (unlikely((v0 & ((u64)1 << LDN_MIF)) || v1 || v2)) { | 3101 | if (unlikely((v0 & ((u64)1 << LDN_MIF)) || v1 || v2)) { |
2903 | int err = niu_slowpath_interrupt(np, lp); | 3102 | int err = niu_slowpath_interrupt(np, lp, v0, v1, v2); |
2904 | if (err) | 3103 | if (err) |
2905 | goto out; | 3104 | goto out; |
2906 | } | 3105 | } |
@@ -3915,16 +4114,14 @@ static int niu_init_ipp(struct niu *np) | |||
3915 | return 0; | 4114 | return 0; |
3916 | } | 4115 | } |
3917 | 4116 | ||
3918 | static void niu_init_xif_xmac(struct niu *np) | 4117 | static void niu_handle_led(struct niu *np, int status) |
3919 | { | 4118 | { |
3920 | struct niu_link_config *lp = &np->link_config; | ||
3921 | u64 val; | 4119 | u64 val; |
3922 | |||
3923 | val = nr64_mac(XMAC_CONFIG); | 4120 | val = nr64_mac(XMAC_CONFIG); |
3924 | 4121 | ||
3925 | if ((np->flags & NIU_FLAGS_10G) != 0 && | 4122 | if ((np->flags & NIU_FLAGS_10G) != 0 && |
3926 | (np->flags & NIU_FLAGS_FIBER) != 0) { | 4123 | (np->flags & NIU_FLAGS_FIBER) != 0) { |
3927 | if (netif_carrier_ok(np->dev)) { | 4124 | if (status) { |
3928 | val |= XMAC_CONFIG_LED_POLARITY; | 4125 | val |= XMAC_CONFIG_LED_POLARITY; |
3929 | val &= ~XMAC_CONFIG_FORCE_LED_ON; | 4126 | val &= ~XMAC_CONFIG_FORCE_LED_ON; |
3930 | } else { | 4127 | } else { |
@@ -3933,6 +4130,15 @@ static void niu_init_xif_xmac(struct niu *np) | |||
3933 | } | 4130 | } |
3934 | } | 4131 | } |
3935 | 4132 | ||
4133 | nw64_mac(XMAC_CONFIG, val); | ||
4134 | } | ||
4135 | |||
4136 | static void niu_init_xif_xmac(struct niu *np) | ||
4137 | { | ||
4138 | struct niu_link_config *lp = &np->link_config; | ||
4139 | u64 val; | ||
4140 | |||
4141 | val = nr64_mac(XMAC_CONFIG); | ||
3936 | val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC; | 4142 | val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC; |
3937 | 4143 | ||
3938 | val |= XMAC_CONFIG_TX_OUTPUT_EN; | 4144 | val |= XMAC_CONFIG_TX_OUTPUT_EN; |
@@ -4776,6 +4982,8 @@ static int niu_close(struct net_device *dev) | |||
4776 | 4982 | ||
4777 | niu_free_channels(np); | 4983 | niu_free_channels(np); |
4778 | 4984 | ||
4985 | niu_handle_led(np, 0); | ||
4986 | |||
4779 | return 0; | 4987 | return 0; |
4780 | } | 4988 | } |
4781 | 4989 | ||
@@ -5180,7 +5388,8 @@ static int niu_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
5180 | } | 5388 | } |
5181 | kfree_skb(skb); | 5389 | kfree_skb(skb); |
5182 | skb = skb_new; | 5390 | skb = skb_new; |
5183 | } | 5391 | } else |
5392 | skb_orphan(skb); | ||
5184 | 5393 | ||
5185 | align = ((unsigned long) skb->data & (16 - 1)); | 5394 | align = ((unsigned long) skb->data & (16 - 1)); |
5186 | headroom = align + sizeof(struct tx_pkt_hdr); | 5395 | headroom = align + sizeof(struct tx_pkt_hdr); |
@@ -6268,7 +6477,8 @@ static int __devinit phy_record(struct niu_parent *parent, | |||
6268 | if (dev_id_1 < 0 || dev_id_2 < 0) | 6477 | if (dev_id_1 < 0 || dev_id_2 < 0) |
6269 | return 0; | 6478 | return 0; |
6270 | if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) { | 6479 | if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) { |
6271 | if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) | 6480 | if (((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) && |
6481 | ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011)) | ||
6272 | return 0; | 6482 | return 0; |
6273 | } else { | 6483 | } else { |
6274 | if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R) | 6484 | if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R) |
diff --git a/drivers/net/niu.h b/drivers/net/niu.h index 10e3f111b6d5..0e8626adc573 100644 --- a/drivers/net/niu.h +++ b/drivers/net/niu.h | |||
@@ -2538,6 +2538,39 @@ struct fcram_hash_ipv6 { | |||
2538 | #define NIU_PHY_ID_MASK 0xfffff0f0 | 2538 | #define NIU_PHY_ID_MASK 0xfffff0f0 |
2539 | #define NIU_PHY_ID_BCM8704 0x00206030 | 2539 | #define NIU_PHY_ID_BCM8704 0x00206030 |
2540 | #define NIU_PHY_ID_BCM5464R 0x002060b0 | 2540 | #define NIU_PHY_ID_BCM5464R 0x002060b0 |
2541 | #define NIU_PHY_ID_MRVL88X2011 0x01410020 | ||
2542 | |||
2543 | /* MRVL88X2011 register addresses */ | ||
2544 | #define MRVL88X2011_USER_DEV1_ADDR 1 | ||
2545 | #define MRVL88X2011_USER_DEV2_ADDR 2 | ||
2546 | #define MRVL88X2011_USER_DEV3_ADDR 3 | ||
2547 | #define MRVL88X2011_USER_DEV4_ADDR 4 | ||
2548 | #define MRVL88X2011_PMA_PMD_CTL_1 0x0000 | ||
2549 | #define MRVL88X2011_PMA_PMD_STATUS_1 0x0001 | ||
2550 | #define MRVL88X2011_10G_PMD_STATUS_2 0x0008 | ||
2551 | #define MRVL88X2011_10G_PMD_TX_DIS 0x0009 | ||
2552 | #define MRVL88X2011_10G_XGXS_LANE_STAT 0x0018 | ||
2553 | #define MRVL88X2011_GENERAL_CTL 0x8300 | ||
2554 | #define MRVL88X2011_LED_BLINK_CTL 0x8303 | ||
2555 | #define MRVL88X2011_LED_8_TO_11_CTL 0x8306 | ||
2556 | |||
2557 | /* MRVL88X2011 register control */ | ||
2558 | #define MRVL88X2011_ENA_XFPREFCLK 0x0001 | ||
2559 | #define MRVL88X2011_ENA_PMDTX 0x0000 | ||
2560 | #define MRVL88X2011_LOOPBACK 0x1 | ||
2561 | #define MRVL88X2011_LED_ACT 0x1 | ||
2562 | #define MRVL88X2011_LNK_STATUS_OK 0x4 | ||
2563 | #define MRVL88X2011_LED_BLKRATE_MASK 0x70 | ||
2564 | #define MRVL88X2011_LED_BLKRATE_034MS 0x0 | ||
2565 | #define MRVL88X2011_LED_BLKRATE_067MS 0x1 | ||
2566 | #define MRVL88X2011_LED_BLKRATE_134MS 0x2 | ||
2567 | #define MRVL88X2011_LED_BLKRATE_269MS 0x3 | ||
2568 | #define MRVL88X2011_LED_BLKRATE_538MS 0x4 | ||
2569 | #define MRVL88X2011_LED_CTL_OFF 0x0 | ||
2570 | #define MRVL88X2011_LED_CTL_PCS_ACT 0x5 | ||
2571 | #define MRVL88X2011_LED_CTL_MASK 0x7 | ||
2572 | #define MRVL88X2011_LED(n,v) ((v)<<((n)*4)) | ||
2573 | #define MRVL88X2011_LED_STAT(n,v) ((v)>>((n)*4)) | ||
2541 | 2574 | ||
2542 | #define BCM8704_PMA_PMD_DEV_ADDR 1 | 2575 | #define BCM8704_PMA_PMD_DEV_ADDR 1 |
2543 | #define BCM8704_PCS_DEV_ADDR 2 | 2576 | #define BCM8704_PCS_DEV_ADDR 2 |
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 09b4fde8d924..816a59e801b2 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -586,7 +586,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
586 | /* CRC error flagged */ | 586 | /* CRC error flagged */ |
587 | mac->netdev->stats.rx_errors++; | 587 | mac->netdev->stats.rx_errors++; |
588 | mac->netdev->stats.rx_crc_errors++; | 588 | mac->netdev->stats.rx_crc_errors++; |
589 | dev_kfree_skb_irq(skb); | 589 | /* No need to free skb, it'll be reused */ |
590 | goto next; | 590 | goto next; |
591 | } | 591 | } |
592 | 592 | ||
@@ -1362,7 +1362,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1362 | 1362 | ||
1363 | netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); | 1363 | netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); |
1364 | 1364 | ||
1365 | dev->features = NETIF_F_HW_CSUM | NETIF_F_LLTX | NETIF_F_SG; | 1365 | dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG; |
1366 | 1366 | ||
1367 | /* These should come out of the device tree eventually */ | 1367 | /* These should come out of the device tree eventually */ |
1368 | mac->dma_txch = index; | 1368 | mac->dma_txch = index; |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index ad134a61302a..36a7ba3134ce 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -187,14 +187,16 @@ enum Window1 { | |||
187 | enum Window3 { /* Window 3: MAC/config bits. */ | 187 | enum Window3 { /* Window 3: MAC/config bits. */ |
188 | Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8, | 188 | Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8, |
189 | }; | 189 | }; |
190 | union wn3_config { | 190 | enum wn3_config { |
191 | int i; | 191 | Ram_size = 7, |
192 | struct w3_config_fields { | 192 | Ram_width = 8, |
193 | unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; | 193 | Ram_speed = 0x30, |
194 | int pad8:8; | 194 | Rom_size = 0xc0, |
195 | unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; | 195 | Ram_split_shift = 16, |
196 | int pad24:7; | 196 | Ram_split = 3 << Ram_split_shift, |
197 | } u; | 197 | Xcvr_shift = 20, |
198 | Xcvr = 7 << Xcvr_shift, | ||
199 | Autoselect = 0x1000000, | ||
198 | }; | 200 | }; |
199 | 201 | ||
200 | enum Window4 { /* Window 4: Xcvr/media bits. */ | 202 | enum Window4 { /* Window 4: Xcvr/media bits. */ |
@@ -337,15 +339,15 @@ static int tc574_config(struct pcmcia_device *link) | |||
337 | struct net_device *dev = link->priv; | 339 | struct net_device *dev = link->priv; |
338 | struct el3_private *lp = netdev_priv(dev); | 340 | struct el3_private *lp = netdev_priv(dev); |
339 | tuple_t tuple; | 341 | tuple_t tuple; |
340 | unsigned short buf[32]; | 342 | __le16 buf[32]; |
341 | int last_fn, last_ret, i, j; | 343 | int last_fn, last_ret, i, j; |
342 | kio_addr_t ioaddr; | 344 | kio_addr_t ioaddr; |
343 | u16 *phys_addr; | 345 | __be16 *phys_addr; |
344 | char *cardname; | 346 | char *cardname; |
345 | union wn3_config config; | 347 | __u32 config; |
346 | DECLARE_MAC_BUF(mac); | 348 | DECLARE_MAC_BUF(mac); |
347 | 349 | ||
348 | phys_addr = (u16 *)dev->dev_addr; | 350 | phys_addr = (__be16 *)dev->dev_addr; |
349 | 351 | ||
350 | DEBUG(0, "3c574_config(0x%p)\n", link); | 352 | DEBUG(0, "3c574_config(0x%p)\n", link); |
351 | 353 | ||
@@ -378,12 +380,12 @@ static int tc574_config(struct pcmcia_device *link) | |||
378 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 380 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { |
379 | pcmcia_get_tuple_data(link, &tuple); | 381 | pcmcia_get_tuple_data(link, &tuple); |
380 | for (i = 0; i < 3; i++) | 382 | for (i = 0; i < 3; i++) |
381 | phys_addr[i] = htons(buf[i]); | 383 | phys_addr[i] = htons(le16_to_cpu(buf[i])); |
382 | } else { | 384 | } else { |
383 | EL3WINDOW(0); | 385 | EL3WINDOW(0); |
384 | for (i = 0; i < 3; i++) | 386 | for (i = 0; i < 3; i++) |
385 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); | 387 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); |
386 | if (phys_addr[0] == 0x6060) { | 388 | if (phys_addr[0] == htons(0x6060)) { |
387 | printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" | 389 | printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" |
388 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); | 390 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); |
389 | goto failed; | 391 | goto failed; |
@@ -401,9 +403,9 @@ static int tc574_config(struct pcmcia_device *link) | |||
401 | outw(0<<11, ioaddr + RunnerRdCtrl); | 403 | outw(0<<11, ioaddr + RunnerRdCtrl); |
402 | printk(KERN_INFO " ASIC rev %d,", mcr>>3); | 404 | printk(KERN_INFO " ASIC rev %d,", mcr>>3); |
403 | EL3WINDOW(3); | 405 | EL3WINDOW(3); |
404 | config.i = inl(ioaddr + Wn3_Config); | 406 | config = inl(ioaddr + Wn3_Config); |
405 | lp->default_media = config.u.xcvr; | 407 | lp->default_media = (config & Xcvr) >> Xcvr_shift; |
406 | lp->autoselect = config.u.autoselect; | 408 | lp->autoselect = config & Autoselect ? 1 : 0; |
407 | } | 409 | } |
408 | 410 | ||
409 | init_timer(&lp->media); | 411 | init_timer(&lp->media); |
@@ -464,8 +466,9 @@ static int tc574_config(struct pcmcia_device *link) | |||
464 | dev->name, cardname, dev->base_addr, dev->irq, | 466 | dev->name, cardname, dev->base_addr, dev->irq, |
465 | print_mac(mac, dev->dev_addr)); | 467 | print_mac(mac, dev->dev_addr)); |
466 | printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n", | 468 | printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n", |
467 | 8 << config.u.ram_size, ram_split[config.u.ram_split], | 469 | 8 << config & Ram_size, |
468 | config.u.autoselect ? "autoselect " : ""); | 470 | ram_split[(config & Ram_split) >> Ram_split_shift], |
471 | config & Autoselect ? "autoselect " : ""); | ||
469 | 472 | ||
470 | return 0; | 473 | return 0; |
471 | 474 | ||
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index a98fe07cce70..e862d14ece79 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link) | |||
251 | struct net_device *dev = link->priv; | 251 | struct net_device *dev = link->priv; |
252 | struct el3_private *lp = netdev_priv(dev); | 252 | struct el3_private *lp = netdev_priv(dev); |
253 | tuple_t tuple; | 253 | tuple_t tuple; |
254 | u16 buf[32], *phys_addr; | 254 | __le16 buf[32]; |
255 | __be16 *phys_addr; | ||
255 | int last_fn, last_ret, i, j, multi = 0, fifo; | 256 | int last_fn, last_ret, i, j, multi = 0, fifo; |
256 | kio_addr_t ioaddr; | 257 | kio_addr_t ioaddr; |
257 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 258 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
259 | 260 | ||
260 | DEBUG(0, "3c589_config(0x%p)\n", link); | 261 | DEBUG(0, "3c589_config(0x%p)\n", link); |
261 | 262 | ||
262 | phys_addr = (u16 *)dev->dev_addr; | 263 | phys_addr = (__be16 *)dev->dev_addr; |
263 | tuple.Attributes = 0; | 264 | tuple.Attributes = 0; |
264 | tuple.TupleData = (cisdata_t *)buf; | 265 | tuple.TupleData = (cisdata_t *)buf; |
265 | tuple.TupleDataMax = sizeof(buf); | 266 | tuple.TupleDataMax = sizeof(buf); |
@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link) | |||
298 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 299 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { |
299 | pcmcia_get_tuple_data(link, &tuple); | 300 | pcmcia_get_tuple_data(link, &tuple); |
300 | for (i = 0; i < 3; i++) | 301 | for (i = 0; i < 3; i++) |
301 | phys_addr[i] = htons(buf[i]); | 302 | phys_addr[i] = htons(le16_to_cpu(buf[i])); |
302 | } else { | 303 | } else { |
303 | for (i = 0; i < 3; i++) | 304 | for (i = 0; i < 3; i++) |
304 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); | 305 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); |
305 | if (phys_addr[0] == 0x6060) { | 306 | if (phys_addr[0] == htons(0x6060)) { |
306 | printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" | 307 | printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" |
307 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); | 308 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); |
308 | goto failed; | 309 | goto failed; |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index db6a97d1d7b1..51bbd582f16c 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1746,6 +1746,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1746 | PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), | 1746 | PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), |
1747 | PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), | 1747 | PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), |
1748 | PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"), | 1748 | PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"), |
1749 | PCMCIA_DEVICE_PROD_ID12("Ethernet", "CF Size PC Card", 0x00b2e941, 0x43ac239b), | ||
1749 | PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0", | 1750 | PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0", |
1750 | 0xb4be14e3, 0x43ac239b, 0x0877b627), | 1751 | 0xb4be14e3, 0x43ac239b, 0x0877b627), |
1751 | PCMCIA_DEVICE_NULL | 1752 | PCMCIA_DEVICE_NULL |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index ff92aca0a7b3..90498ffe26f2 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -455,9 +455,14 @@ static void pcnet32_netif_start(struct net_device *dev) | |||
455 | { | 455 | { |
456 | #ifdef CONFIG_PCNET32_NAPI | 456 | #ifdef CONFIG_PCNET32_NAPI |
457 | struct pcnet32_private *lp = netdev_priv(dev); | 457 | struct pcnet32_private *lp = netdev_priv(dev); |
458 | ulong ioaddr = dev->base_addr; | ||
459 | u16 val; | ||
458 | #endif | 460 | #endif |
459 | netif_wake_queue(dev); | 461 | netif_wake_queue(dev); |
460 | #ifdef CONFIG_PCNET32_NAPI | 462 | #ifdef CONFIG_PCNET32_NAPI |
463 | val = lp->a.read_csr(ioaddr, CSR3); | ||
464 | val &= 0x00ff; | ||
465 | lp->a.write_csr(ioaddr, CSR3, val); | ||
461 | napi_enable(&lp->napi); | 466 | napi_enable(&lp->napi); |
462 | #endif | 467 | #endif |
463 | } | 468 | } |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 035fd41fb61f..f0574073a2a3 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -143,21 +143,29 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
143 | int err; | 143 | int err; |
144 | 144 | ||
145 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || | 145 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
146 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { | 146 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
147 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || | ||
148 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { | ||
147 | int temp; | 149 | int temp; |
148 | 150 | ||
149 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { | 151 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); |
150 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); | 152 | if (temp < 0) |
151 | if (temp < 0) | 153 | return temp; |
152 | return temp; | ||
153 | 154 | ||
155 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { | ||
154 | temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); | 156 | temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); |
155 | 157 | } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { | |
156 | err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); | 158 | temp &= ~MII_M1111_TX_DELAY; |
157 | if (err < 0) | 159 | temp |= MII_M1111_RX_DELAY; |
158 | return err; | 160 | } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { |
161 | temp &= ~MII_M1111_RX_DELAY; | ||
162 | temp |= MII_M1111_TX_DELAY; | ||
159 | } | 163 | } |
160 | 164 | ||
165 | err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); | ||
166 | if (err < 0) | ||
167 | return err; | ||
168 | |||
161 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | 169 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); |
162 | if (temp < 0) | 170 | if (temp < 0) |
163 | return temp; | 171 | return temp; |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index fc2f0e695a13..c30196d0ad16 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus) | |||
91 | 91 | ||
92 | err = device_register(&phydev->dev); | 92 | err = device_register(&phydev->dev); |
93 | 93 | ||
94 | if (err) | 94 | if (err) { |
95 | printk(KERN_ERR "phy %d failed to register\n", | 95 | printk(KERN_ERR "phy %d failed to register\n", |
96 | i); | 96 | i); |
97 | phy_device_free(phydev); | ||
98 | phydev = NULL; | ||
99 | } | ||
97 | } | 100 | } |
98 | 101 | ||
99 | bus->phy_map[i] = phydev; | 102 | bus->phy_map[i] = phydev; |
@@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus) | |||
110 | int i; | 113 | int i; |
111 | 114 | ||
112 | for (i = 0; i < PHY_MAX_ADDR; i++) { | 115 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
113 | if (bus->phy_map[i]) { | 116 | if (bus->phy_map[i]) |
114 | device_unregister(&bus->phy_map[i]->dev); | 117 | device_unregister(&bus->phy_map[i]->dev); |
115 | kfree(bus->phy_map[i]); | ||
116 | } | ||
117 | } | 118 | } |
118 | } | 119 | } |
119 | EXPORT_SYMBOL(mdiobus_unregister); | 120 | EXPORT_SYMBOL(mdiobus_unregister); |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 9bc11773705b..7c9e6e349503 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -406,6 +406,9 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
406 | && phydev->drv->config_init) | 406 | && phydev->drv->config_init) |
407 | phydev->drv->config_init(phydev); | 407 | phydev->drv->config_init(phydev); |
408 | break; | 408 | break; |
409 | |||
410 | default: | ||
411 | return -ENOTTY; | ||
409 | } | 412 | } |
410 | 413 | ||
411 | return 0; | 414 | return 0; |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f6e484812a98..5b9e1751e1b4 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -44,6 +44,16 @@ static struct phy_driver genphy_driver; | |||
44 | extern int mdio_bus_init(void); | 44 | extern int mdio_bus_init(void); |
45 | extern void mdio_bus_exit(void); | 45 | extern void mdio_bus_exit(void); |
46 | 46 | ||
47 | void phy_device_free(struct phy_device *phydev) | ||
48 | { | ||
49 | kfree(phydev); | ||
50 | } | ||
51 | |||
52 | static void phy_device_release(struct device *dev) | ||
53 | { | ||
54 | phy_device_free(to_phy_device(dev)); | ||
55 | } | ||
56 | |||
47 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | 57 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) |
48 | { | 58 | { |
49 | struct phy_device *dev; | 59 | struct phy_device *dev; |
@@ -54,6 +64,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | |||
54 | if (NULL == dev) | 64 | if (NULL == dev) |
55 | return (struct phy_device*) PTR_ERR((void*)-ENOMEM); | 65 | return (struct phy_device*) PTR_ERR((void*)-ENOMEM); |
56 | 66 | ||
67 | dev->dev.release = phy_device_release; | ||
68 | |||
57 | dev->speed = 0; | 69 | dev->speed = 0; |
58 | dev->duplex = -1; | 70 | dev->duplex = -1; |
59 | dev->pause = dev->asym_pause = 0; | 71 | dev->pause = dev->asym_pause = 0; |
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 5071fcd8a0bd..57c98669984d 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -663,7 +663,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl, | |||
663 | case PLIP_PK_DONE: | 663 | case PLIP_PK_DONE: |
664 | /* Inform the upper layer for the arrival of a packet. */ | 664 | /* Inform the upper layer for the arrival of a packet. */ |
665 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); | 665 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); |
666 | netif_rx(rcv->skb); | 666 | netif_rx_ni(rcv->skb); |
667 | dev->last_rx = jiffies; | 667 | dev->last_rx = jiffies; |
668 | dev->stats.rx_bytes += rcv->length.h; | 668 | dev->stats.rx_bytes += rcv->length.h; |
669 | dev->stats.rx_packets++; | 669 | dev->stats.rx_packets++; |
@@ -1269,7 +1269,7 @@ static void plip_attach (struct parport *port) | |||
1269 | 1269 | ||
1270 | nl = netdev_priv(dev); | 1270 | nl = netdev_priv(dev); |
1271 | nl->dev = dev; | 1271 | nl->dev = dev; |
1272 | nl->pardev = parport_register_device(port, name, plip_preempt, | 1272 | nl->pardev = parport_register_device(port, dev->name, plip_preempt, |
1273 | plip_wakeup, plip_interrupt, | 1273 | plip_wakeup, plip_interrupt, |
1274 | 0, dev); | 1274 | 0, dev); |
1275 | 1275 | ||
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index a5791114b7bd..cf0774de6c41 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -2320,14 +2320,9 @@ static int ql_poll(struct napi_struct *napi, int budget) | |||
2320 | unsigned long hw_flags; | 2320 | unsigned long hw_flags; |
2321 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | 2321 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; |
2322 | 2322 | ||
2323 | if (!netif_carrier_ok(ndev)) | ||
2324 | goto quit_polling; | ||
2325 | |||
2326 | ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget); | 2323 | ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget); |
2327 | 2324 | ||
2328 | if (tx_cleaned + rx_cleaned != budget || | 2325 | if (tx_cleaned + rx_cleaned != budget) { |
2329 | !netif_running(ndev)) { | ||
2330 | quit_polling: | ||
2331 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | 2326 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); |
2332 | __netif_rx_complete(ndev, napi); | 2327 | __netif_rx_complete(ndev, napi); |
2333 | ql_update_small_bufq_prod_index(qdev); | 2328 | ql_update_small_bufq_prod_index(qdev); |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 1f647b9ce352..3acfeeabdee1 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2002,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) | |||
2002 | u32 clk; | 2002 | u32 clk; |
2003 | 2003 | ||
2004 | clk = RTL_R8(Config2) & PCI_Clock_66MHz; | 2004 | clk = RTL_R8(Config2) & PCI_Clock_66MHz; |
2005 | for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { | 2005 | for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) { |
2006 | if ((p->mac_version == mac_version) && (p->clk == clk)) { | 2006 | if ((p->mac_version == mac_version) && (p->clk == clk)) { |
2007 | RTL_W32(0x7c, p->val); | 2007 | RTL_W32(0x7c, p->val); |
2008 | break; | 2008 | break; |
@@ -2211,7 +2211,7 @@ out: | |||
2211 | 2211 | ||
2212 | static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) | 2212 | static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) |
2213 | { | 2213 | { |
2214 | desc->addr = 0x0badbadbadbadbadull; | 2214 | desc->addr = cpu_to_le64(0x0badbadbadbadbadull); |
2215 | desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); | 2215 | desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); |
2216 | } | 2216 | } |
2217 | 2217 | ||
@@ -2398,6 +2398,8 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev) | |||
2398 | rtl8169_irq_mask_and_ack(ioaddr); | 2398 | rtl8169_irq_mask_and_ack(ioaddr); |
2399 | 2399 | ||
2400 | #ifdef CONFIG_R8169_NAPI | 2400 | #ifdef CONFIG_R8169_NAPI |
2401 | tp->intr_mask = 0xffff; | ||
2402 | RTL_W16(IntrMask, tp->intr_event); | ||
2401 | napi_enable(&tp->napi); | 2403 | napi_enable(&tp->napi); |
2402 | #endif | 2404 | #endif |
2403 | } | 2405 | } |
@@ -2835,7 +2837,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
2835 | } | 2837 | } |
2836 | 2838 | ||
2837 | /* Work around for AMD plateform. */ | 2839 | /* Work around for AMD plateform. */ |
2838 | if ((desc->opts2 & 0xfffe000) && | 2840 | if ((desc->opts2 & cpu_to_le32(0xfffe000)) && |
2839 | (tp->mac_version == RTL_GIGA_MAC_VER_05)) { | 2841 | (tp->mac_version == RTL_GIGA_MAC_VER_05)) { |
2840 | desc->opts2 = 0; | 2842 | desc->opts2 = 0; |
2841 | cur_rx++; | 2843 | cur_rx++; |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 73a7e6529ee0..55a590ab1e17 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev) | |||
294 | { | 294 | { |
295 | struct rr_private *rrpriv; | 295 | struct rr_private *rrpriv; |
296 | struct rr_regs __iomem *regs; | 296 | struct rr_regs __iomem *regs; |
297 | struct eeprom *hw = NULL; | ||
298 | u32 start_pc; | 297 | u32 start_pc; |
299 | int i; | 298 | int i; |
300 | 299 | ||
@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev) | |||
381 | writel(RBURST_64|WBURST_64, ®s->PciState); | 380 | writel(RBURST_64|WBURST_64, ®s->PciState); |
382 | wmb(); | 381 | wmb(); |
383 | 382 | ||
384 | start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart); | 383 | start_pc = rr_read_eeprom_word(rrpriv, |
384 | offsetof(struct eeprom, rncd_info.FwStart)); | ||
385 | 385 | ||
386 | #if (DEBUG > 1) | 386 | #if (DEBUG > 1) |
387 | printk("%s: Executing firmware at address 0x%06x\n", | 387 | printk("%s: Executing firmware at address 0x%06x\n", |
@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv, | |||
438 | * it to our CPU byte-order. | 438 | * it to our CPU byte-order. |
439 | */ | 439 | */ |
440 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, | 440 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, |
441 | void * offset) | 441 | size_t offset) |
442 | { | 442 | { |
443 | u32 word; | 443 | __be32 word; |
444 | 444 | ||
445 | if ((rr_read_eeprom(rrpriv, (unsigned long)offset, | 445 | if ((rr_read_eeprom(rrpriv, offset, |
446 | (char *)&word, 4) == 4)) | 446 | (unsigned char *)&word, 4) == 4)) |
447 | return be32_to_cpu(word); | 447 | return be32_to_cpu(word); |
448 | return 0; | 448 | return 0; |
449 | } | 449 | } |
@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev) | |||
510 | { | 510 | { |
511 | struct rr_private *rrpriv; | 511 | struct rr_private *rrpriv; |
512 | struct rr_regs __iomem *regs; | 512 | struct rr_regs __iomem *regs; |
513 | struct eeprom *hw = NULL; | ||
514 | u32 sram_size, rev; | 513 | u32 sram_size, rev; |
515 | DECLARE_MAC_BUF(mac); | 514 | DECLARE_MAC_BUF(mac); |
516 | 515 | ||
@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev) | |||
545 | * other method I've seen. -VAL | 544 | * other method I've seen. -VAL |
546 | */ | 545 | */ |
547 | 546 | ||
548 | *(u16 *)(dev->dev_addr) = | 547 | *(__be16 *)(dev->dev_addr) = |
549 | htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA)); | 548 | htons(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA))); |
550 | *(u32 *)(dev->dev_addr+2) = | 549 | *(__be32 *)(dev->dev_addr+2) = |
551 | htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4])); | 550 | htonl(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA[4]))); |
552 | 551 | ||
553 | printk(" MAC: %s\n", print_mac(mac, dev->dev_addr)); | 552 | printk(" MAC: %s\n", print_mac(mac, dev->dev_addr)); |
554 | 553 | ||
555 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); | 554 | sram_size = rr_read_eeprom_word(rrpriv, 8); |
556 | printk(" SRAM size 0x%06x\n", sram_size); | 555 | printk(" SRAM size 0x%06x\n", sram_size); |
557 | 556 | ||
558 | return 0; | 557 | return 0; |
@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev) | |||
1477 | { | 1476 | { |
1478 | struct rr_private *rrpriv; | 1477 | struct rr_private *rrpriv; |
1479 | struct rr_regs __iomem *regs; | 1478 | struct rr_regs __iomem *regs; |
1480 | unsigned long eptr, segptr; | 1479 | size_t eptr, segptr; |
1481 | int i, j; | 1480 | int i, j; |
1482 | u32 localctrl, sptr, len, tmp; | 1481 | u32 localctrl, sptr, len, tmp; |
1483 | u32 p2len, p2size, nr_seg, revision, io, sram_size; | 1482 | u32 p2len, p2size, nr_seg, revision, io, sram_size; |
1484 | struct eeprom *hw = NULL; | ||
1485 | 1483 | ||
1486 | rrpriv = netdev_priv(dev); | 1484 | rrpriv = netdev_priv(dev); |
1487 | regs = rrpriv->regs; | 1485 | regs = rrpriv->regs; |
@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev) | |||
1509 | */ | 1507 | */ |
1510 | io = readl(®s->ExtIo); | 1508 | io = readl(®s->ExtIo); |
1511 | writel(0, ®s->ExtIo); | 1509 | writel(0, ®s->ExtIo); |
1512 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); | 1510 | sram_size = rr_read_eeprom_word(rrpriv, 8); |
1513 | 1511 | ||
1514 | for (i = 200; i < sram_size / 4; i++){ | 1512 | for (i = 200; i < sram_size / 4; i++){ |
1515 | writel(i * 4, ®s->WinBase); | 1513 | writel(i * 4, ®s->WinBase); |
@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev) | |||
1520 | writel(io, ®s->ExtIo); | 1518 | writel(io, ®s->ExtIo); |
1521 | mb(); | 1519 | mb(); |
1522 | 1520 | ||
1523 | eptr = (unsigned long)rr_read_eeprom_word(rrpriv, | 1521 | eptr = rr_read_eeprom_word(rrpriv, |
1524 | &hw->rncd_info.AddrRunCodeSegs); | 1522 | offsetof(struct eeprom, rncd_info.AddrRunCodeSegs)); |
1525 | eptr = ((eptr & 0x1fffff) >> 3); | 1523 | eptr = ((eptr & 0x1fffff) >> 3); |
1526 | 1524 | ||
1527 | p2len = rr_read_eeprom_word(rrpriv, (void *)(0x83*4)); | 1525 | p2len = rr_read_eeprom_word(rrpriv, 0x83*4); |
1528 | p2len = (p2len << 2); | 1526 | p2len = (p2len << 2); |
1529 | p2size = rr_read_eeprom_word(rrpriv, (void *)(0x84*4)); | 1527 | p2size = rr_read_eeprom_word(rrpriv, 0x84*4); |
1530 | p2size = ((p2size & 0x1fffff) >> 3); | 1528 | p2size = ((p2size & 0x1fffff) >> 3); |
1531 | 1529 | ||
1532 | if ((eptr < p2size) || (eptr > (p2size + p2len))){ | 1530 | if ((eptr < p2size) || (eptr > (p2size + p2len))){ |
@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev) | |||
1534 | goto out; | 1532 | goto out; |
1535 | } | 1533 | } |
1536 | 1534 | ||
1537 | revision = rr_read_eeprom_word(rrpriv, &hw->manf.HeaderFmt); | 1535 | revision = rr_read_eeprom_word(rrpriv, |
1536 | offsetof(struct eeprom, manf.HeaderFmt)); | ||
1538 | 1537 | ||
1539 | if (revision != 1){ | 1538 | if (revision != 1){ |
1540 | printk("%s: invalid firmware format (%i)\n", | 1539 | printk("%s: invalid firmware format (%i)\n", |
@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev) | |||
1542 | goto out; | 1541 | goto out; |
1543 | } | 1542 | } |
1544 | 1543 | ||
1545 | nr_seg = rr_read_eeprom_word(rrpriv, (void *)eptr); | 1544 | nr_seg = rr_read_eeprom_word(rrpriv, eptr); |
1546 | eptr +=4; | 1545 | eptr +=4; |
1547 | #if (DEBUG > 1) | 1546 | #if (DEBUG > 1) |
1548 | printk("%s: nr_seg %i\n", dev->name, nr_seg); | 1547 | printk("%s: nr_seg %i\n", dev->name, nr_seg); |
1549 | #endif | 1548 | #endif |
1550 | 1549 | ||
1551 | for (i = 0; i < nr_seg; i++){ | 1550 | for (i = 0; i < nr_seg; i++){ |
1552 | sptr = rr_read_eeprom_word(rrpriv, (void *)eptr); | 1551 | sptr = rr_read_eeprom_word(rrpriv, eptr); |
1553 | eptr += 4; | 1552 | eptr += 4; |
1554 | len = rr_read_eeprom_word(rrpriv, (void *)eptr); | 1553 | len = rr_read_eeprom_word(rrpriv, eptr); |
1555 | eptr += 4; | 1554 | eptr += 4; |
1556 | segptr = (unsigned long)rr_read_eeprom_word(rrpriv, (void *)eptr); | 1555 | segptr = rr_read_eeprom_word(rrpriv, eptr); |
1557 | segptr = ((segptr & 0x1fffff) >> 3); | 1556 | segptr = ((segptr & 0x1fffff) >> 3); |
1558 | eptr += 4; | 1557 | eptr += 4; |
1559 | #if (DEBUG > 1) | 1558 | #if (DEBUG > 1) |
@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev) | |||
1561 | dev->name, i, sptr, len, segptr); | 1560 | dev->name, i, sptr, len, segptr); |
1562 | #endif | 1561 | #endif |
1563 | for (j = 0; j < len; j++){ | 1562 | for (j = 0; j < len; j++){ |
1564 | tmp = rr_read_eeprom_word(rrpriv, (void *)segptr); | 1563 | tmp = rr_read_eeprom_word(rrpriv, segptr); |
1565 | writel(sptr, ®s->WinBase); | 1564 | writel(sptr, ®s->WinBase); |
1566 | mb(); | 1565 | mb(); |
1567 | writel(tmp, ®s->WinData); | 1566 | writel(tmp, ®s->WinData); |
diff --git a/drivers/net/rrunner.h b/drivers/net/rrunner.h index 6a79825bc8cf..6173f11218df 100644 --- a/drivers/net/rrunner.h +++ b/drivers/net/rrunner.h | |||
@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv, | |||
838 | unsigned long offset, | 838 | unsigned long offset, |
839 | unsigned char *buf, | 839 | unsigned char *buf, |
840 | unsigned long length); | 840 | unsigned long length); |
841 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset); | 841 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset); |
842 | static int rr_load_firmware(struct net_device *dev); | 842 | static int rr_load_firmware(struct net_device *dev); |
843 | static inline void rr_raz_tx(struct rr_private *, struct net_device *); | 843 | static inline void rr_raz_tx(struct rr_private *, struct net_device *); |
844 | static inline void rr_raz_rx(struct rr_private *, struct net_device *); | 844 | static inline void rr_raz_rx(struct rr_private *, struct net_device *); |
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h index 01f08d726ace..f25264f2638e 100644 --- a/drivers/net/s2io-regs.h +++ b/drivers/net/s2io-regs.h | |||
@@ -66,6 +66,7 @@ struct XENA_dev_config { | |||
66 | #define ADAPTER_STATUS_RC_PRC_QUIESCENT vBIT(0xFF,16,8) | 66 | #define ADAPTER_STATUS_RC_PRC_QUIESCENT vBIT(0xFF,16,8) |
67 | #define ADAPTER_STATUS_MC_DRAM_READY s2BIT(24) | 67 | #define ADAPTER_STATUS_MC_DRAM_READY s2BIT(24) |
68 | #define ADAPTER_STATUS_MC_QUEUES_READY s2BIT(25) | 68 | #define ADAPTER_STATUS_MC_QUEUES_READY s2BIT(25) |
69 | #define ADAPTER_STATUS_RIC_RUNNING s2BIT(26) | ||
69 | #define ADAPTER_STATUS_M_PLL_LOCK s2BIT(30) | 70 | #define ADAPTER_STATUS_M_PLL_LOCK s2BIT(30) |
70 | #define ADAPTER_STATUS_P_PLL_LOCK s2BIT(31) | 71 | #define ADAPTER_STATUS_P_PLL_LOCK s2BIT(31) |
71 | 72 | ||
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 632666706247..f2ba944e035e 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -84,7 +84,7 @@ | |||
84 | #include "s2io.h" | 84 | #include "s2io.h" |
85 | #include "s2io-regs.h" | 85 | #include "s2io-regs.h" |
86 | 86 | ||
87 | #define DRV_VERSION "2.0.26.6" | 87 | #define DRV_VERSION "2.0.26.17" |
88 | 88 | ||
89 | /* S2io Driver name & version. */ | 89 | /* S2io Driver name & version. */ |
90 | static char s2io_driver_name[] = "Neterion"; | 90 | static char s2io_driver_name[] = "Neterion"; |
@@ -1081,7 +1081,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1081 | /* to set the swapper controle on the card */ | 1081 | /* to set the swapper controle on the card */ |
1082 | if(s2io_set_swapper(nic)) { | 1082 | if(s2io_set_swapper(nic)) { |
1083 | DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); | 1083 | DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); |
1084 | return -1; | 1084 | return -EIO; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | /* | 1087 | /* |
@@ -1100,6 +1100,20 @@ static int init_nic(struct s2io_nic *nic) | |||
1100 | msleep(500); | 1100 | msleep(500); |
1101 | val64 = readq(&bar0->sw_reset); | 1101 | val64 = readq(&bar0->sw_reset); |
1102 | 1102 | ||
1103 | /* Ensure that it's safe to access registers by checking | ||
1104 | * RIC_RUNNING bit is reset. Check is valid only for XframeII. | ||
1105 | */ | ||
1106 | if (nic->device_type == XFRAME_II_DEVICE) { | ||
1107 | for (i = 0; i < 50; i++) { | ||
1108 | val64 = readq(&bar0->adapter_status); | ||
1109 | if (!(val64 & ADAPTER_STATUS_RIC_RUNNING)) | ||
1110 | break; | ||
1111 | msleep(10); | ||
1112 | } | ||
1113 | if (i == 50) | ||
1114 | return -ENODEV; | ||
1115 | } | ||
1116 | |||
1103 | /* Enable Receiving broadcasts */ | 1117 | /* Enable Receiving broadcasts */ |
1104 | add = &bar0->mac_cfg; | 1118 | add = &bar0->mac_cfg; |
1105 | val64 = readq(&bar0->mac_cfg); | 1119 | val64 = readq(&bar0->mac_cfg); |
@@ -1503,7 +1517,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1503 | DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", | 1517 | DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", |
1504 | dev->name); | 1518 | dev->name); |
1505 | DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); | 1519 | DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); |
1506 | return FAILURE; | 1520 | return -ENODEV; |
1507 | } | 1521 | } |
1508 | } | 1522 | } |
1509 | 1523 | ||
@@ -1570,7 +1584,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1570 | if (time > 10) { | 1584 | if (time > 10) { |
1571 | DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", | 1585 | DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", |
1572 | dev->name); | 1586 | dev->name); |
1573 | return -1; | 1587 | return -ENODEV; |
1574 | } | 1588 | } |
1575 | msleep(50); | 1589 | msleep(50); |
1576 | time++; | 1590 | time++; |
@@ -1623,7 +1637,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1623 | if (time > 10) { | 1637 | if (time > 10) { |
1624 | DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", | 1638 | DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", |
1625 | dev->name); | 1639 | dev->name); |
1626 | return -1; | 1640 | return -ENODEV; |
1627 | } | 1641 | } |
1628 | time++; | 1642 | time++; |
1629 | msleep(50); | 1643 | msleep(50); |
@@ -2690,9 +2704,6 @@ static int s2io_poll(struct napi_struct *napi, int budget) | |||
2690 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | 2704 | struct XENA_dev_config __iomem *bar0 = nic->bar0; |
2691 | int i; | 2705 | int i; |
2692 | 2706 | ||
2693 | if (!is_s2io_card_up(nic)) | ||
2694 | return 0; | ||
2695 | |||
2696 | mac_control = &nic->mac_control; | 2707 | mac_control = &nic->mac_control; |
2697 | config = &nic->config; | 2708 | config = &nic->config; |
2698 | 2709 | ||
@@ -3723,7 +3734,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic) | |||
3723 | } | 3734 | } |
3724 | 3735 | ||
3725 | /* Handle software interrupt used during MSI(X) test */ | 3736 | /* Handle software interrupt used during MSI(X) test */ |
3726 | static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id) | 3737 | static irqreturn_t s2io_test_intr(int irq, void *dev_id) |
3727 | { | 3738 | { |
3728 | struct s2io_nic *sp = dev_id; | 3739 | struct s2io_nic *sp = dev_id; |
3729 | 3740 | ||
@@ -3734,7 +3745,7 @@ static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id) | |||
3734 | } | 3745 | } |
3735 | 3746 | ||
3736 | /* Test interrupt path by forcing a a software IRQ */ | 3747 | /* Test interrupt path by forcing a a software IRQ */ |
3737 | static int __devinit s2io_test_msi(struct s2io_nic *sp) | 3748 | static int s2io_test_msi(struct s2io_nic *sp) |
3738 | { | 3749 | { |
3739 | struct pci_dev *pdev = sp->pdev; | 3750 | struct pci_dev *pdev = sp->pdev; |
3740 | struct XENA_dev_config __iomem *bar0 = sp->bar0; | 3751 | struct XENA_dev_config __iomem *bar0 = sp->bar0; |
@@ -3837,8 +3848,6 @@ static int s2io_open(struct net_device *dev) | |||
3837 | netif_carrier_off(dev); | 3848 | netif_carrier_off(dev); |
3838 | sp->last_link_state = 0; | 3849 | sp->last_link_state = 0; |
3839 | 3850 | ||
3840 | napi_enable(&sp->napi); | ||
3841 | |||
3842 | if (sp->config.intr_type == MSI_X) { | 3851 | if (sp->config.intr_type == MSI_X) { |
3843 | int ret = s2io_enable_msi_x(sp); | 3852 | int ret = s2io_enable_msi_x(sp); |
3844 | 3853 | ||
@@ -3881,7 +3890,6 @@ static int s2io_open(struct net_device *dev) | |||
3881 | return 0; | 3890 | return 0; |
3882 | 3891 | ||
3883 | hw_init_failed: | 3892 | hw_init_failed: |
3884 | napi_disable(&sp->napi); | ||
3885 | if (sp->config.intr_type == MSI_X) { | 3893 | if (sp->config.intr_type == MSI_X) { |
3886 | if (sp->entries) { | 3894 | if (sp->entries) { |
3887 | kfree(sp->entries); | 3895 | kfree(sp->entries); |
@@ -3914,8 +3922,13 @@ static int s2io_close(struct net_device *dev) | |||
3914 | { | 3922 | { |
3915 | struct s2io_nic *sp = dev->priv; | 3923 | struct s2io_nic *sp = dev->priv; |
3916 | 3924 | ||
3925 | /* Return if the device is already closed * | ||
3926 | * Can happen when s2io_card_up failed in change_mtu * | ||
3927 | */ | ||
3928 | if (!is_s2io_card_up(sp)) | ||
3929 | return 0; | ||
3930 | |||
3917 | netif_stop_queue(dev); | 3931 | netif_stop_queue(dev); |
3918 | napi_disable(&sp->napi); | ||
3919 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ | 3932 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ |
3920 | s2io_card_down(sp); | 3933 | s2io_card_down(sp); |
3921 | 3934 | ||
@@ -6355,6 +6368,7 @@ static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
6355 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) | 6368 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) |
6356 | { | 6369 | { |
6357 | struct s2io_nic *sp = dev->priv; | 6370 | struct s2io_nic *sp = dev->priv; |
6371 | int ret = 0; | ||
6358 | 6372 | ||
6359 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { | 6373 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { |
6360 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", | 6374 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", |
@@ -6366,9 +6380,11 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
6366 | if (netif_running(dev)) { | 6380 | if (netif_running(dev)) { |
6367 | s2io_card_down(sp); | 6381 | s2io_card_down(sp); |
6368 | netif_stop_queue(dev); | 6382 | netif_stop_queue(dev); |
6369 | if (s2io_card_up(sp)) { | 6383 | ret = s2io_card_up(sp); |
6384 | if (ret) { | ||
6370 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", | 6385 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", |
6371 | __FUNCTION__); | 6386 | __FUNCTION__); |
6387 | return ret; | ||
6372 | } | 6388 | } |
6373 | if (netif_queue_stopped(dev)) | 6389 | if (netif_queue_stopped(dev)) |
6374 | netif_wake_queue(dev); | 6390 | netif_wake_queue(dev); |
@@ -6379,7 +6395,7 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
6379 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); | 6395 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); |
6380 | } | 6396 | } |
6381 | 6397 | ||
6382 | return 0; | 6398 | return ret; |
6383 | } | 6399 | } |
6384 | 6400 | ||
6385 | /** | 6401 | /** |
@@ -6776,6 +6792,11 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | |||
6776 | struct XENA_dev_config __iomem *bar0 = sp->bar0; | 6792 | struct XENA_dev_config __iomem *bar0 = sp->bar0; |
6777 | unsigned long flags; | 6793 | unsigned long flags; |
6778 | register u64 val64 = 0; | 6794 | register u64 val64 = 0; |
6795 | struct config_param *config; | ||
6796 | config = &sp->config; | ||
6797 | |||
6798 | if (!is_s2io_card_up(sp)) | ||
6799 | return; | ||
6779 | 6800 | ||
6780 | del_timer_sync(&sp->alarm_timer); | 6801 | del_timer_sync(&sp->alarm_timer); |
6781 | /* If s2io_set_link task is executing, wait till it completes. */ | 6802 | /* If s2io_set_link task is executing, wait till it completes. */ |
@@ -6784,6 +6805,10 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | |||
6784 | } | 6805 | } |
6785 | clear_bit(__S2IO_STATE_CARD_UP, &sp->state); | 6806 | clear_bit(__S2IO_STATE_CARD_UP, &sp->state); |
6786 | 6807 | ||
6808 | /* Disable napi */ | ||
6809 | if (config->napi) | ||
6810 | napi_disable(&sp->napi); | ||
6811 | |||
6787 | /* disable Tx and Rx traffic on the NIC */ | 6812 | /* disable Tx and Rx traffic on the NIC */ |
6788 | if (do_io) | 6813 | if (do_io) |
6789 | stop_nic(sp); | 6814 | stop_nic(sp); |
@@ -6850,11 +6875,13 @@ static int s2io_card_up(struct s2io_nic * sp) | |||
6850 | u16 interruptible; | 6875 | u16 interruptible; |
6851 | 6876 | ||
6852 | /* Initialize the H/W I/O registers */ | 6877 | /* Initialize the H/W I/O registers */ |
6853 | if (init_nic(sp) != 0) { | 6878 | ret = init_nic(sp); |
6879 | if (ret != 0) { | ||
6854 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", | 6880 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", |
6855 | dev->name); | 6881 | dev->name); |
6856 | s2io_reset(sp); | 6882 | if (ret != -EIO) |
6857 | return -ENODEV; | 6883 | s2io_reset(sp); |
6884 | return ret; | ||
6858 | } | 6885 | } |
6859 | 6886 | ||
6860 | /* | 6887 | /* |
@@ -6875,6 +6902,11 @@ static int s2io_card_up(struct s2io_nic * sp) | |||
6875 | DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i, | 6902 | DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i, |
6876 | atomic_read(&sp->rx_bufs_left[i])); | 6903 | atomic_read(&sp->rx_bufs_left[i])); |
6877 | } | 6904 | } |
6905 | |||
6906 | /* Initialise napi */ | ||
6907 | if (config->napi) | ||
6908 | napi_enable(&sp->napi); | ||
6909 | |||
6878 | /* Maintain the state prior to the open */ | 6910 | /* Maintain the state prior to the open */ |
6879 | if (sp->promisc_flg) | 6911 | if (sp->promisc_flg) |
6880 | sp->promisc_flg = 0; | 6912 | sp->promisc_flg = 0; |
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 720088396bb9..b570402f7fed 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -372,7 +372,7 @@ static void __mdio_cmd(void __iomem *ioaddr, u32 ctl) | |||
372 | msleep(1); | 372 | msleep(1); |
373 | } | 373 | } |
374 | 374 | ||
375 | if (i > 999) | 375 | if (i > 99) |
376 | printk(KERN_ERR PFX "PHY command failed !\n"); | 376 | printk(KERN_ERR PFX "PHY command failed !\n"); |
377 | } | 377 | } |
378 | 378 | ||
@@ -474,7 +474,7 @@ static inline void sis190_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, | |||
474 | static inline void sis190_make_unusable_by_asic(struct RxDesc *desc) | 474 | static inline void sis190_make_unusable_by_asic(struct RxDesc *desc) |
475 | { | 475 | { |
476 | desc->PSize = 0x0; | 476 | desc->PSize = 0x0; |
477 | desc->addr = 0xdeadbeef; | 477 | desc->addr = cpu_to_le32(0xdeadbeef); |
478 | desc->size &= cpu_to_le32(RingEnd); | 478 | desc->size &= cpu_to_le32(RingEnd); |
479 | wmb(); | 479 | wmb(); |
480 | desc->status = 0x0; | 480 | desc->status = 0x0; |
@@ -580,7 +580,7 @@ static int sis190_rx_interrupt(struct net_device *dev, | |||
580 | struct RxDesc *desc = tp->RxDescRing + entry; | 580 | struct RxDesc *desc = tp->RxDescRing + entry; |
581 | u32 status; | 581 | u32 status; |
582 | 582 | ||
583 | if (desc->status & OWNbit) | 583 | if (le32_to_cpu(desc->status) & OWNbit) |
584 | break; | 584 | break; |
585 | 585 | ||
586 | status = le32_to_cpu(desc->PSize); | 586 | status = le32_to_cpu(desc->PSize); |
@@ -847,10 +847,8 @@ static void sis190_soft_reset(void __iomem *ioaddr) | |||
847 | { | 847 | { |
848 | SIS_W32(IntrControl, 0x8000); | 848 | SIS_W32(IntrControl, 0x8000); |
849 | SIS_PCI_COMMIT(); | 849 | SIS_PCI_COMMIT(); |
850 | msleep(1); | ||
851 | SIS_W32(IntrControl, 0x0); | 850 | SIS_W32(IntrControl, 0x0); |
852 | sis190_asic_down(ioaddr); | 851 | sis190_asic_down(ioaddr); |
853 | msleep(1); | ||
854 | } | 852 | } |
855 | 853 | ||
856 | static void sis190_hw_start(struct net_device *dev) | 854 | static void sis190_hw_start(struct net_device *dev) |
@@ -1041,8 +1039,6 @@ static int sis190_open(struct net_device *dev) | |||
1041 | if (rc < 0) | 1039 | if (rc < 0) |
1042 | goto err_free_rx_1; | 1040 | goto err_free_rx_1; |
1043 | 1041 | ||
1044 | INIT_WORK(&tp->phy_task, sis190_phy_task); | ||
1045 | |||
1046 | sis190_request_timer(dev); | 1042 | sis190_request_timer(dev); |
1047 | 1043 | ||
1048 | rc = request_irq(dev->irq, sis190_interrupt, IRQF_SHARED, dev->name, dev); | 1044 | rc = request_irq(dev->irq, sis190_interrupt, IRQF_SHARED, dev->name, dev); |
@@ -1381,7 +1377,7 @@ out: | |||
1381 | return rc; | 1377 | return rc; |
1382 | } | 1378 | } |
1383 | 1379 | ||
1384 | static void __devexit sis190_mii_remove(struct net_device *dev) | 1380 | static void sis190_mii_remove(struct net_device *dev) |
1385 | { | 1381 | { |
1386 | struct sis190_private *tp = netdev_priv(dev); | 1382 | struct sis190_private *tp = netdev_priv(dev); |
1387 | 1383 | ||
@@ -1538,9 +1534,9 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev, | |||
1538 | 1534 | ||
1539 | /* Get MAC address from EEPROM */ | 1535 | /* Get MAC address from EEPROM */ |
1540 | for (i = 0; i < MAC_ADDR_LEN / 2; i++) { | 1536 | for (i = 0; i < MAC_ADDR_LEN / 2; i++) { |
1541 | __le16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i); | 1537 | u16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i); |
1542 | 1538 | ||
1543 | ((u16 *)dev->dev_addr)[i] = le16_to_cpu(w); | 1539 | ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(w); |
1544 | } | 1540 | } |
1545 | 1541 | ||
1546 | sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo)); | 1542 | sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo)); |
@@ -1549,28 +1545,31 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev, | |||
1549 | } | 1545 | } |
1550 | 1546 | ||
1551 | /** | 1547 | /** |
1552 | * sis190_get_mac_addr_from_apc - Get MAC address for SiS965 model | 1548 | * sis190_get_mac_addr_from_apc - Get MAC address for SiS96x model |
1553 | * @pdev: PCI device | 1549 | * @pdev: PCI device |
1554 | * @dev: network device to get address for | 1550 | * @dev: network device to get address for |
1555 | * | 1551 | * |
1556 | * SiS965 model, use APC CMOS RAM to store MAC address. | 1552 | * SiS96x model, use APC CMOS RAM to store MAC address. |
1557 | * APC CMOS RAM is accessed through ISA bridge. | 1553 | * APC CMOS RAM is accessed through ISA bridge. |
1558 | * MAC address is read into @net_dev->dev_addr. | 1554 | * MAC address is read into @net_dev->dev_addr. |
1559 | */ | 1555 | */ |
1560 | static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev, | 1556 | static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev, |
1561 | struct net_device *dev) | 1557 | struct net_device *dev) |
1562 | { | 1558 | { |
1559 | static const u16 __devinitdata ids[] = { 0x0965, 0x0966, 0x0968 }; | ||
1563 | struct sis190_private *tp = netdev_priv(dev); | 1560 | struct sis190_private *tp = netdev_priv(dev); |
1564 | struct pci_dev *isa_bridge; | 1561 | struct pci_dev *isa_bridge; |
1565 | u8 reg, tmp8; | 1562 | u8 reg, tmp8; |
1566 | int i; | 1563 | unsigned int i; |
1567 | 1564 | ||
1568 | net_probe(tp, KERN_INFO "%s: Read MAC address from APC.\n", | 1565 | net_probe(tp, KERN_INFO "%s: Read MAC address from APC.\n", |
1569 | pci_name(pdev)); | 1566 | pci_name(pdev)); |
1570 | 1567 | ||
1571 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL); | 1568 | for (i = 0; i < ARRAY_SIZE(ids); i++) { |
1572 | if (!isa_bridge) | 1569 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, ids[i], NULL); |
1573 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0966, NULL); | 1570 | if (isa_bridge) |
1571 | break; | ||
1572 | } | ||
1574 | 1573 | ||
1575 | if (!isa_bridge) { | 1574 | if (!isa_bridge) { |
1576 | net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n", | 1575 | net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n", |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 6d62250fba07..186eb8ebfda6 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "skge.h" | 44 | #include "skge.h" |
45 | 45 | ||
46 | #define DRV_NAME "skge" | 46 | #define DRV_NAME "skge" |
47 | #define DRV_VERSION "1.12" | 47 | #define DRV_VERSION "1.13" |
48 | #define PFX DRV_NAME " " | 48 | #define PFX DRV_NAME " " |
49 | 49 | ||
50 | #define DEFAULT_TX_RING_SIZE 128 | 50 | #define DEFAULT_TX_RING_SIZE 128 |
@@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw *hw, int port) | |||
1095 | { | 1095 | { |
1096 | struct net_device *dev = hw->dev[port]; | 1096 | struct net_device *dev = hw->dev[port]; |
1097 | struct skge_port *skge = netdev_priv(dev); | 1097 | struct skge_port *skge = netdev_priv(dev); |
1098 | u16 cmd = xm_read16(hw, port, XM_MMU_CMD); | ||
1099 | 1098 | ||
1100 | xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE); | 1099 | xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE); |
1101 | 1100 | ||
1102 | cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX); | ||
1103 | xm_write16(hw, port, XM_MMU_CMD, cmd); | ||
1104 | |||
1105 | /* dummy read to ensure writing */ | ||
1106 | xm_read16(hw, port, XM_MMU_CMD); | ||
1107 | |||
1108 | if (netif_carrier_ok(dev)) | 1101 | if (netif_carrier_ok(dev)) |
1109 | skge_link_down(skge); | 1102 | skge_link_down(skge); |
1110 | } | 1103 | } |
@@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_hw *hw) | |||
1194 | static void genesis_reset(struct skge_hw *hw, int port) | 1187 | static void genesis_reset(struct skge_hw *hw, int port) |
1195 | { | 1188 | { |
1196 | const u8 zero[8] = { 0 }; | 1189 | const u8 zero[8] = { 0 }; |
1190 | u32 reg; | ||
1197 | 1191 | ||
1198 | skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); | 1192 | skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); |
1199 | 1193 | ||
@@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw *hw, int port) | |||
1209 | xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); | 1203 | xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); |
1210 | 1204 | ||
1211 | xm_outhash(hw, port, XM_HSM, zero); | 1205 | xm_outhash(hw, port, XM_HSM, zero); |
1206 | |||
1207 | /* Flush TX and RX fifo */ | ||
1208 | reg = xm_read32(hw, port, XM_MODE); | ||
1209 | xm_write32(hw, port, XM_MODE, reg | XM_MD_FTF); | ||
1210 | xm_write32(hw, port, XM_MODE, reg | XM_MD_FRF); | ||
1212 | } | 1211 | } |
1213 | 1212 | ||
1214 | 1213 | ||
@@ -1634,15 +1633,14 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1634 | } | 1633 | } |
1635 | xm_write16(hw, port, XM_RX_CMD, r); | 1634 | xm_write16(hw, port, XM_RX_CMD, r); |
1636 | 1635 | ||
1637 | |||
1638 | /* We want short frames padded to 60 bytes. */ | 1636 | /* We want short frames padded to 60 bytes. */ |
1639 | xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD); | 1637 | xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD); |
1640 | 1638 | ||
1641 | /* | 1639 | /* Increase threshold for jumbo frames on dual port */ |
1642 | * Bump up the transmit threshold. This helps hold off transmit | 1640 | if (hw->ports > 1 && jumbo) |
1643 | * underruns when we're blasting traffic from both ports at once. | 1641 | xm_write16(hw, port, XM_TX_THR, 1020); |
1644 | */ | 1642 | else |
1645 | xm_write16(hw, port, XM_TX_THR, 512); | 1643 | xm_write16(hw, port, XM_TX_THR, 512); |
1646 | 1644 | ||
1647 | /* | 1645 | /* |
1648 | * Enable the reception of all error frames. This is is | 1646 | * Enable the reception of all error frames. This is is |
@@ -1713,7 +1711,13 @@ static void genesis_stop(struct skge_port *skge) | |||
1713 | { | 1711 | { |
1714 | struct skge_hw *hw = skge->hw; | 1712 | struct skge_hw *hw = skge->hw; |
1715 | int port = skge->port; | 1713 | int port = skge->port; |
1716 | u32 reg; | 1714 | unsigned retries = 1000; |
1715 | u16 cmd; | ||
1716 | |||
1717 | /* Disable Tx and Rx */ | ||
1718 | cmd = xm_read16(hw, port, XM_MMU_CMD); | ||
1719 | cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX); | ||
1720 | xm_write16(hw, port, XM_MMU_CMD, cmd); | ||
1717 | 1721 | ||
1718 | genesis_reset(hw, port); | 1722 | genesis_reset(hw, port); |
1719 | 1723 | ||
@@ -1721,20 +1725,17 @@ static void genesis_stop(struct skge_port *skge) | |||
1721 | skge_write16(hw, B3_PA_CTRL, | 1725 | skge_write16(hw, B3_PA_CTRL, |
1722 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); | 1726 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); |
1723 | 1727 | ||
1724 | /* | ||
1725 | * If the transfer sticks at the MAC the STOP command will not | ||
1726 | * terminate if we don't flush the XMAC's transmit FIFO ! | ||
1727 | */ | ||
1728 | xm_write32(hw, port, XM_MODE, | ||
1729 | xm_read32(hw, port, XM_MODE)|XM_MD_FTF); | ||
1730 | |||
1731 | |||
1732 | /* Reset the MAC */ | 1728 | /* Reset the MAC */ |
1733 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); | 1729 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); |
1730 | do { | ||
1731 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); | ||
1732 | if (!(skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST)) | ||
1733 | break; | ||
1734 | } while (--retries > 0); | ||
1734 | 1735 | ||
1735 | /* For external PHYs there must be special handling */ | 1736 | /* For external PHYs there must be special handling */ |
1736 | if (hw->phy_type != SK_PHY_XMAC) { | 1737 | if (hw->phy_type != SK_PHY_XMAC) { |
1737 | reg = skge_read32(hw, B2_GP_IO); | 1738 | u32 reg = skge_read32(hw, B2_GP_IO); |
1738 | if (port == 0) { | 1739 | if (port == 0) { |
1739 | reg |= GP_DIR_0; | 1740 | reg |= GP_DIR_0; |
1740 | reg &= ~GP_IO_0; | 1741 | reg &= ~GP_IO_0; |
@@ -1801,11 +1802,6 @@ static void genesis_mac_intr(struct skge_hw *hw, int port) | |||
1801 | xm_write32(hw, port, XM_MODE, XM_MD_FTF); | 1802 | xm_write32(hw, port, XM_MODE, XM_MD_FTF); |
1802 | ++dev->stats.tx_fifo_errors; | 1803 | ++dev->stats.tx_fifo_errors; |
1803 | } | 1804 | } |
1804 | |||
1805 | if (status & XM_IS_RXF_OV) { | ||
1806 | xm_write32(hw, port, XM_MODE, XM_MD_FRF); | ||
1807 | ++dev->stats.rx_fifo_errors; | ||
1808 | } | ||
1809 | } | 1805 | } |
1810 | 1806 | ||
1811 | static void genesis_link_up(struct skge_port *skge) | 1807 | static void genesis_link_up(struct skge_port *skge) |
@@ -1862,9 +1858,9 @@ static void genesis_link_up(struct skge_port *skge) | |||
1862 | 1858 | ||
1863 | xm_write32(hw, port, XM_MODE, mode); | 1859 | xm_write32(hw, port, XM_MODE, mode); |
1864 | 1860 | ||
1865 | /* Turn on detection of Tx underrun, Rx overrun */ | 1861 | /* Turn on detection of Tx underrun */ |
1866 | msk = xm_read16(hw, port, XM_IMSK); | 1862 | msk = xm_read16(hw, port, XM_IMSK); |
1867 | msk &= ~(XM_IS_RXF_OV | XM_IS_TXF_UR); | 1863 | msk &= ~XM_IS_TXF_UR; |
1868 | xm_write16(hw, port, XM_IMSK, msk); | 1864 | xm_write16(hw, port, XM_IMSK, msk); |
1869 | 1865 | ||
1870 | xm_read16(hw, port, XM_ISRC); | 1866 | xm_read16(hw, port, XM_ISRC); |
@@ -2194,9 +2190,12 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
2194 | TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | | 2190 | TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | |
2195 | TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); | 2191 | TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); |
2196 | 2192 | ||
2197 | /* serial mode register */ | 2193 | /* configure the Serial Mode Register */ |
2198 | reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); | 2194 | reg = DATA_BLIND_VAL(DATA_BLIND_DEF) |
2199 | if (hw->dev[port]->mtu > 1500) | 2195 | | GM_SMOD_VLAN_ENA |
2196 | | IPG_DATA_VAL(IPG_DATA_DEF); | ||
2197 | |||
2198 | if (hw->dev[port]->mtu > ETH_DATA_LEN) | ||
2200 | reg |= GM_SMOD_JUMBO_ENA; | 2199 | reg |= GM_SMOD_JUMBO_ENA; |
2201 | 2200 | ||
2202 | gma_write16(hw, port, GM_SERIAL_MODE, reg); | 2201 | gma_write16(hw, port, GM_SERIAL_MODE, reg); |
@@ -2619,8 +2618,8 @@ static int skge_up(struct net_device *dev) | |||
2619 | yukon_mac_init(hw, port); | 2618 | yukon_mac_init(hw, port); |
2620 | spin_unlock_bh(&hw->phy_lock); | 2619 | spin_unlock_bh(&hw->phy_lock); |
2621 | 2620 | ||
2622 | /* Configure RAMbuffers */ | 2621 | /* Configure RAMbuffers - equally between ports and tx/rx */ |
2623 | chunk = hw->ram_size / ((hw->ports + 1)*2); | 2622 | chunk = (hw->ram_size - hw->ram_offset) / (hw->ports * 2); |
2624 | ram_addr = hw->ram_offset + 2 * chunk * port; | 2623 | ram_addr = hw->ram_offset + 2 * chunk * port; |
2625 | 2624 | ||
2626 | skge_ramset(hw, rxqaddr[port], ram_addr, chunk); | 2625 | skge_ramset(hw, rxqaddr[port], ram_addr, chunk); |
@@ -2897,11 +2896,7 @@ static void skge_tx_timeout(struct net_device *dev) | |||
2897 | 2896 | ||
2898 | static int skge_change_mtu(struct net_device *dev, int new_mtu) | 2897 | static int skge_change_mtu(struct net_device *dev, int new_mtu) |
2899 | { | 2898 | { |
2900 | struct skge_port *skge = netdev_priv(dev); | ||
2901 | struct skge_hw *hw = skge->hw; | ||
2902 | int port = skge->port; | ||
2903 | int err; | 2899 | int err; |
2904 | u16 ctl, reg; | ||
2905 | 2900 | ||
2906 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) | 2901 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) |
2907 | return -EINVAL; | 2902 | return -EINVAL; |
@@ -2911,40 +2906,13 @@ static int skge_change_mtu(struct net_device *dev, int new_mtu) | |||
2911 | return 0; | 2906 | return 0; |
2912 | } | 2907 | } |
2913 | 2908 | ||
2914 | skge_write32(hw, B0_IMSK, 0); | 2909 | skge_down(dev); |
2915 | dev->trans_start = jiffies; /* prevent tx timeout */ | ||
2916 | netif_stop_queue(dev); | ||
2917 | napi_disable(&skge->napi); | ||
2918 | |||
2919 | ctl = gma_read16(hw, port, GM_GP_CTRL); | ||
2920 | gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); | ||
2921 | |||
2922 | skge_rx_clean(skge); | ||
2923 | skge_rx_stop(hw, port); | ||
2924 | 2910 | ||
2925 | dev->mtu = new_mtu; | 2911 | dev->mtu = new_mtu; |
2926 | 2912 | ||
2927 | reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); | 2913 | err = skge_up(dev); |
2928 | if (new_mtu > 1500) | ||
2929 | reg |= GM_SMOD_JUMBO_ENA; | ||
2930 | gma_write16(hw, port, GM_SERIAL_MODE, reg); | ||
2931 | |||
2932 | skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD); | ||
2933 | |||
2934 | err = skge_rx_fill(dev); | ||
2935 | wmb(); | ||
2936 | if (!err) | ||
2937 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); | ||
2938 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
2939 | |||
2940 | if (err) | 2914 | if (err) |
2941 | dev_close(dev); | 2915 | dev_close(dev); |
2942 | else { | ||
2943 | gma_write16(hw, port, GM_GP_CTRL, ctl); | ||
2944 | |||
2945 | napi_enable(&skge->napi); | ||
2946 | netif_wake_queue(dev); | ||
2947 | } | ||
2948 | 2916 | ||
2949 | return err; | 2917 | return err; |
2950 | } | 2918 | } |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index a2070db725c9..bc15940ce1bc 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
32 | #include <linux/ethtool.h> | 32 | #include <linux/ethtool.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/aer.h> | ||
35 | #include <linux/ip.h> | 34 | #include <linux/ip.h> |
36 | #include <net/ip.h> | 35 | #include <net/ip.h> |
37 | #include <linux/tcp.h> | 36 | #include <linux/tcp.h> |
@@ -240,22 +239,21 @@ static void sky2_power_on(struct sky2_hw *hw) | |||
240 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); | 239 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); |
241 | 240 | ||
242 | if (hw->flags & SKY2_HW_ADV_POWER_CTL) { | 241 | if (hw->flags & SKY2_HW_ADV_POWER_CTL) { |
243 | struct pci_dev *pdev = hw->pdev; | ||
244 | u32 reg; | 242 | u32 reg; |
245 | 243 | ||
246 | pci_write_config_dword(pdev, PCI_DEV_REG3, 0); | 244 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
247 | 245 | ||
248 | pci_read_config_dword(pdev, PCI_DEV_REG4, ®); | 246 | reg = sky2_pci_read32(hw, PCI_DEV_REG4); |
249 | /* set all bits to 0 except bits 15..12 and 8 */ | 247 | /* set all bits to 0 except bits 15..12 and 8 */ |
250 | reg &= P_ASPM_CONTROL_MSK; | 248 | reg &= P_ASPM_CONTROL_MSK; |
251 | pci_write_config_dword(pdev, PCI_DEV_REG4, reg); | 249 | sky2_pci_write32(hw, PCI_DEV_REG4, reg); |
252 | 250 | ||
253 | pci_read_config_dword(pdev, PCI_DEV_REG5, ®); | 251 | reg = sky2_pci_read32(hw, PCI_DEV_REG5); |
254 | /* set all bits to 0 except bits 28 & 27 */ | 252 | /* set all bits to 0 except bits 28 & 27 */ |
255 | reg &= P_CTL_TIM_VMAIN_AV_MSK; | 253 | reg &= P_CTL_TIM_VMAIN_AV_MSK; |
256 | pci_write_config_dword(pdev, PCI_DEV_REG5, reg); | 254 | sky2_pci_write32(hw, PCI_DEV_REG5, reg); |
257 | 255 | ||
258 | pci_write_config_dword(pdev, PCI_CFG_REG_1, 0); | 256 | sky2_pci_write32(hw, PCI_CFG_REG_1, 0); |
259 | 257 | ||
260 | /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */ | 258 | /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */ |
261 | reg = sky2_read32(hw, B2_GP_IO); | 259 | reg = sky2_read32(hw, B2_GP_IO); |
@@ -619,12 +617,11 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
619 | 617 | ||
620 | static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) | 618 | static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) |
621 | { | 619 | { |
622 | struct pci_dev *pdev = hw->pdev; | ||
623 | u32 reg1; | 620 | u32 reg1; |
624 | static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; | 621 | static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; |
625 | static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; | 622 | static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; |
626 | 623 | ||
627 | pci_read_config_dword(pdev, PCI_DEV_REG1, ®1); | 624 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
628 | /* Turn on/off phy power saving */ | 625 | /* Turn on/off phy power saving */ |
629 | if (onoff) | 626 | if (onoff) |
630 | reg1 &= ~phy_power[port]; | 627 | reg1 &= ~phy_power[port]; |
@@ -634,8 +631,8 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) | |||
634 | if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | 631 | if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) |
635 | reg1 |= coma_mode[port]; | 632 | reg1 |= coma_mode[port]; |
636 | 633 | ||
637 | pci_write_config_dword(pdev, PCI_DEV_REG1, reg1); | 634 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
638 | pci_read_config_dword(pdev, PCI_DEV_REG1, ®1); | 635 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
639 | 636 | ||
640 | udelay(100); | 637 | udelay(100); |
641 | } | 638 | } |
@@ -704,9 +701,9 @@ static void sky2_wol_init(struct sky2_port *sky2) | |||
704 | sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); | 701 | sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); |
705 | 702 | ||
706 | /* Turn on legacy PCI-Express PME mode */ | 703 | /* Turn on legacy PCI-Express PME mode */ |
707 | pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®1); | 704 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
708 | reg1 |= PCI_Y2_PME_LEGACY; | 705 | reg1 |= PCI_Y2_PME_LEGACY; |
709 | pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1); | 706 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
710 | 707 | ||
711 | /* block receiver */ | 708 | /* block receiver */ |
712 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); | 709 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); |
@@ -825,8 +822,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
825 | 822 | ||
826 | sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg); | 823 | sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg); |
827 | 824 | ||
828 | /* Flush Rx MAC FIFO on any flow control or error */ | 825 | if (hw->chip_id == CHIP_ID_YUKON_XL) { |
829 | sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); | 826 | /* Hardware errata - clear flush mask */ |
827 | sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), 0); | ||
828 | } else { | ||
829 | /* Flush Rx MAC FIFO on any flow control or error */ | ||
830 | sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); | ||
831 | } | ||
830 | 832 | ||
831 | /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */ | 833 | /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */ |
832 | reg = RX_GMF_FL_THR_DEF + 1; | 834 | reg = RX_GMF_FL_THR_DEF + 1; |
@@ -848,6 +850,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
848 | sky2_set_tx_stfwd(hw, port); | 850 | sky2_set_tx_stfwd(hw, port); |
849 | } | 851 | } |
850 | 852 | ||
853 | if (hw->chip_id == CHIP_ID_YUKON_FE_P && | ||
854 | hw->chip_rev == CHIP_REV_YU_FE2_A0) { | ||
855 | /* disable dynamic watermark */ | ||
856 | reg = sky2_read16(hw, SK_REG(port, TX_GMF_EA)); | ||
857 | reg &= ~TX_DYN_WM_ENA; | ||
858 | sky2_write16(hw, SK_REG(port, TX_GMF_EA), reg); | ||
859 | } | ||
851 | } | 860 | } |
852 | 861 | ||
853 | /* Assign Ram Buffer allocation to queue */ | 862 | /* Assign Ram Buffer allocation to queue */ |
@@ -935,7 +944,6 @@ static void tx_init(struct sky2_port *sky2) | |||
935 | le = get_tx_le(sky2); | 944 | le = get_tx_le(sky2); |
936 | le->addr = 0; | 945 | le->addr = 0; |
937 | le->opcode = OP_ADDR64 | HW_OWNER; | 946 | le->opcode = OP_ADDR64 | HW_OWNER; |
938 | sky2->tx_addr64 = 0; | ||
939 | } | 947 | } |
940 | 948 | ||
941 | static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, | 949 | static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, |
@@ -969,13 +977,11 @@ static void sky2_rx_add(struct sky2_port *sky2, u8 op, | |||
969 | dma_addr_t map, unsigned len) | 977 | dma_addr_t map, unsigned len) |
970 | { | 978 | { |
971 | struct sky2_rx_le *le; | 979 | struct sky2_rx_le *le; |
972 | u32 hi = upper_32_bits(map); | ||
973 | 980 | ||
974 | if (sky2->rx_addr64 != hi) { | 981 | if (sizeof(dma_addr_t) > sizeof(u32)) { |
975 | le = sky2_next_rx(sky2); | 982 | le = sky2_next_rx(sky2); |
976 | le->addr = cpu_to_le32(hi); | 983 | le->addr = cpu_to_le32(upper_32_bits(map)); |
977 | le->opcode = OP_ADDR64 | HW_OWNER; | 984 | le->opcode = OP_ADDR64 | HW_OWNER; |
978 | sky2->rx_addr64 = upper_32_bits(map + len); | ||
979 | } | 985 | } |
980 | 986 | ||
981 | le = sky2_next_rx(sky2); | 987 | le = sky2_next_rx(sky2); |
@@ -1159,6 +1165,7 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp | |||
1159 | TX_VLAN_TAG_OFF); | 1165 | TX_VLAN_TAG_OFF); |
1160 | } | 1166 | } |
1161 | 1167 | ||
1168 | sky2_read32(hw, B0_Y2_SP_LISR); | ||
1162 | napi_enable(&hw->napi); | 1169 | napi_enable(&hw->napi); |
1163 | netif_tx_unlock_bh(dev); | 1170 | netif_tx_unlock_bh(dev); |
1164 | } | 1171 | } |
@@ -1320,15 +1327,12 @@ static int sky2_up(struct net_device *dev) | |||
1320 | */ | 1327 | */ |
1321 | if (otherdev && netif_running(otherdev) && | 1328 | if (otherdev && netif_running(otherdev) && |
1322 | (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { | 1329 | (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { |
1323 | struct sky2_port *osky2 = netdev_priv(otherdev); | ||
1324 | u16 cmd; | 1330 | u16 cmd; |
1325 | 1331 | ||
1326 | pci_read_config_word(hw->pdev, cap + PCI_X_CMD, &cmd); | 1332 | cmd = sky2_pci_read16(hw, cap + PCI_X_CMD); |
1327 | cmd &= ~PCI_X_CMD_MAX_SPLIT; | 1333 | cmd &= ~PCI_X_CMD_MAX_SPLIT; |
1328 | pci_write_config_word(hw->pdev, cap + PCI_X_CMD, cmd); | 1334 | sky2_pci_write16(hw, cap + PCI_X_CMD, cmd); |
1329 | 1335 | ||
1330 | sky2->rx_csum = 0; | ||
1331 | osky2->rx_csum = 0; | ||
1332 | } | 1336 | } |
1333 | 1337 | ||
1334 | if (netif_msg_ifup(sky2)) | 1338 | if (netif_msg_ifup(sky2)) |
@@ -1473,7 +1477,6 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1473 | struct tx_ring_info *re; | 1477 | struct tx_ring_info *re; |
1474 | unsigned i, len; | 1478 | unsigned i, len; |
1475 | dma_addr_t mapping; | 1479 | dma_addr_t mapping; |
1476 | u32 addr64; | ||
1477 | u16 mss; | 1480 | u16 mss; |
1478 | u8 ctrl; | 1481 | u8 ctrl; |
1479 | 1482 | ||
@@ -1486,15 +1489,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1486 | 1489 | ||
1487 | len = skb_headlen(skb); | 1490 | len = skb_headlen(skb); |
1488 | mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); | 1491 | mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); |
1489 | addr64 = upper_32_bits(mapping); | ||
1490 | 1492 | ||
1491 | /* Send high bits if changed or crosses boundary */ | 1493 | /* Send high bits if needed */ |
1492 | if (addr64 != sky2->tx_addr64 || | 1494 | if (sizeof(dma_addr_t) > sizeof(u32)) { |
1493 | upper_32_bits(mapping + len) != sky2->tx_addr64) { | ||
1494 | le = get_tx_le(sky2); | 1495 | le = get_tx_le(sky2); |
1495 | le->addr = cpu_to_le32(addr64); | 1496 | le->addr = cpu_to_le32(upper_32_bits(mapping)); |
1496 | le->opcode = OP_ADDR64 | HW_OWNER; | 1497 | le->opcode = OP_ADDR64 | HW_OWNER; |
1497 | sky2->tx_addr64 = upper_32_bits(mapping + len); | ||
1498 | } | 1498 | } |
1499 | 1499 | ||
1500 | /* Check for TCP Segmentation Offload */ | 1500 | /* Check for TCP Segmentation Offload */ |
@@ -1575,13 +1575,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1575 | 1575 | ||
1576 | mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, | 1576 | mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, |
1577 | frag->size, PCI_DMA_TODEVICE); | 1577 | frag->size, PCI_DMA_TODEVICE); |
1578 | addr64 = upper_32_bits(mapping); | 1578 | |
1579 | if (addr64 != sky2->tx_addr64) { | 1579 | if (sizeof(dma_addr_t) > sizeof(u32)) { |
1580 | le = get_tx_le(sky2); | 1580 | le = get_tx_le(sky2); |
1581 | le->addr = cpu_to_le32(addr64); | 1581 | le->addr = cpu_to_le32(upper_32_bits(mapping)); |
1582 | le->ctrl = 0; | 1582 | le->ctrl = 0; |
1583 | le->opcode = OP_ADDR64 | HW_OWNER; | 1583 | le->opcode = OP_ADDR64 | HW_OWNER; |
1584 | sky2->tx_addr64 = addr64; | ||
1585 | } | 1584 | } |
1586 | 1585 | ||
1587 | le = get_tx_le(sky2); | 1586 | le = get_tx_le(sky2); |
@@ -2037,6 +2036,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
2037 | err = sky2_rx_start(sky2); | 2036 | err = sky2_rx_start(sky2); |
2038 | sky2_write32(hw, B0_IMSK, imask); | 2037 | sky2_write32(hw, B0_IMSK, imask); |
2039 | 2038 | ||
2039 | sky2_read32(hw, B0_Y2_SP_LISR); | ||
2040 | napi_enable(&hw->napi); | 2040 | napi_enable(&hw->napi); |
2041 | 2041 | ||
2042 | if (err) | 2042 | if (err) |
@@ -2426,37 +2426,26 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2426 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { | 2426 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { |
2427 | u16 pci_err; | 2427 | u16 pci_err; |
2428 | 2428 | ||
2429 | pci_read_config_word(pdev, PCI_STATUS, &pci_err); | 2429 | pci_err = sky2_pci_read16(hw, PCI_STATUS); |
2430 | if (net_ratelimit()) | 2430 | if (net_ratelimit()) |
2431 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", | 2431 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", |
2432 | pci_err); | 2432 | pci_err); |
2433 | 2433 | ||
2434 | pci_write_config_word(pdev, PCI_STATUS, | 2434 | sky2_pci_write16(hw, PCI_STATUS, |
2435 | pci_err | PCI_STATUS_ERROR_BITS); | 2435 | pci_err | PCI_STATUS_ERROR_BITS); |
2436 | } | 2436 | } |
2437 | 2437 | ||
2438 | if (status & Y2_IS_PCI_EXP) { | 2438 | if (status & Y2_IS_PCI_EXP) { |
2439 | /* PCI-Express uncorrectable Error occurred */ | 2439 | /* PCI-Express uncorrectable Error occurred */ |
2440 | int aer = pci_find_aer_capability(hw->pdev); | ||
2441 | u32 err; | 2440 | u32 err; |
2442 | 2441 | ||
2443 | if (aer) { | 2442 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2444 | pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, | 2443 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, |
2445 | &err); | 2444 | 0xfffffffful); |
2446 | pci_cleanup_aer_uncorrect_error_status(pdev); | ||
2447 | } else { | ||
2448 | /* Either AER not configured, or not working | ||
2449 | * because of bad MMCONFIG, so just do recover | ||
2450 | * manually. | ||
2451 | */ | ||
2452 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | ||
2453 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, | ||
2454 | 0xfffffffful); | ||
2455 | } | ||
2456 | |||
2457 | if (net_ratelimit()) | 2445 | if (net_ratelimit()) |
2458 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); | 2446 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); |
2459 | 2447 | ||
2448 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | ||
2460 | } | 2449 | } |
2461 | 2450 | ||
2462 | if (status & Y2_HWE_L1_MASK) | 2451 | if (status & Y2_HWE_L1_MASK) |
@@ -2703,13 +2692,10 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk) | |||
2703 | 2692 | ||
2704 | static int __devinit sky2_init(struct sky2_hw *hw) | 2693 | static int __devinit sky2_init(struct sky2_hw *hw) |
2705 | { | 2694 | { |
2706 | int rc; | ||
2707 | u8 t8; | 2695 | u8 t8; |
2708 | 2696 | ||
2709 | /* Enable all clocks and check for bad PCI access */ | 2697 | /* Enable all clocks and check for bad PCI access */ |
2710 | rc = pci_write_config_dword(hw->pdev, PCI_DEV_REG3, 0); | 2698 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
2711 | if (rc) | ||
2712 | return rc; | ||
2713 | 2699 | ||
2714 | sky2_write8(hw, B0_CTST, CS_RST_CLR); | 2700 | sky2_write8(hw, B0_CTST, CS_RST_CLR); |
2715 | 2701 | ||
@@ -2806,32 +2792,21 @@ static void sky2_reset(struct sky2_hw *hw) | |||
2806 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 2792 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
2807 | 2793 | ||
2808 | /* clear PCI errors, if any */ | 2794 | /* clear PCI errors, if any */ |
2809 | pci_read_config_word(pdev, PCI_STATUS, &status); | 2795 | status = sky2_pci_read16(hw, PCI_STATUS); |
2810 | status |= PCI_STATUS_ERROR_BITS; | 2796 | status |= PCI_STATUS_ERROR_BITS; |
2811 | pci_write_config_word(pdev, PCI_STATUS, status); | 2797 | sky2_pci_write16(hw, PCI_STATUS, status); |
2812 | 2798 | ||
2813 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); | 2799 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); |
2814 | 2800 | ||
2815 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 2801 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
2816 | if (cap) { | 2802 | if (cap) { |
2817 | if (pci_find_aer_capability(pdev)) { | 2803 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, |
2818 | /* Check for advanced error reporting */ | 2804 | 0xfffffffful); |
2819 | pci_cleanup_aer_uncorrect_error_status(pdev); | ||
2820 | pci_cleanup_aer_correct_error_status(pdev); | ||
2821 | } else { | ||
2822 | dev_warn(&pdev->dev, | ||
2823 | "PCI Express Advanced Error Reporting" | ||
2824 | " not configured or MMCONFIG problem?\n"); | ||
2825 | |||
2826 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, | ||
2827 | 0xfffffffful); | ||
2828 | } | ||
2829 | 2805 | ||
2830 | /* If error bit is stuck on ignore it */ | 2806 | /* If error bit is stuck on ignore it */ |
2831 | if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) | 2807 | if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) |
2832 | dev_info(&pdev->dev, "ignoring stuck error report bit\n"); | 2808 | dev_info(&pdev->dev, "ignoring stuck error report bit\n"); |
2833 | 2809 | else | |
2834 | else if (pci_enable_pcie_error_reporting(pdev)) | ||
2835 | hwe_mask |= Y2_IS_PCI_EXP; | 2810 | hwe_mask |= Y2_IS_PCI_EXP; |
2836 | } | 2811 | } |
2837 | 2812 | ||
@@ -2930,16 +2905,14 @@ static void sky2_restart(struct work_struct *work) | |||
2930 | int i, err; | 2905 | int i, err; |
2931 | 2906 | ||
2932 | rtnl_lock(); | 2907 | rtnl_lock(); |
2933 | sky2_write32(hw, B0_IMSK, 0); | ||
2934 | sky2_read32(hw, B0_IMSK); | ||
2935 | napi_disable(&hw->napi); | ||
2936 | |||
2937 | for (i = 0; i < hw->ports; i++) { | 2908 | for (i = 0; i < hw->ports; i++) { |
2938 | dev = hw->dev[i]; | 2909 | dev = hw->dev[i]; |
2939 | if (netif_running(dev)) | 2910 | if (netif_running(dev)) |
2940 | sky2_down(dev); | 2911 | sky2_down(dev); |
2941 | } | 2912 | } |
2942 | 2913 | ||
2914 | napi_disable(&hw->napi); | ||
2915 | sky2_write32(hw, B0_IMSK, 0); | ||
2943 | sky2_reset(hw); | 2916 | sky2_reset(hw); |
2944 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 2917 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
2945 | napi_enable(&hw->napi); | 2918 | napi_enable(&hw->napi); |
@@ -3672,32 +3645,33 @@ static int sky2_set_tso(struct net_device *dev, u32 data) | |||
3672 | static int sky2_get_eeprom_len(struct net_device *dev) | 3645 | static int sky2_get_eeprom_len(struct net_device *dev) |
3673 | { | 3646 | { |
3674 | struct sky2_port *sky2 = netdev_priv(dev); | 3647 | struct sky2_port *sky2 = netdev_priv(dev); |
3648 | struct sky2_hw *hw = sky2->hw; | ||
3675 | u16 reg2; | 3649 | u16 reg2; |
3676 | 3650 | ||
3677 | pci_read_config_word(sky2->hw->pdev, PCI_DEV_REG2, ®2); | 3651 | reg2 = sky2_pci_read16(hw, PCI_DEV_REG2); |
3678 | return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8); | 3652 | return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8); |
3679 | } | 3653 | } |
3680 | 3654 | ||
3681 | static u32 sky2_vpd_read(struct pci_dev *pdev, int cap, u16 offset) | 3655 | static u32 sky2_vpd_read(struct sky2_hw *hw, int cap, u16 offset) |
3682 | { | 3656 | { |
3683 | u32 val; | 3657 | u32 val; |
3684 | 3658 | ||
3685 | pci_write_config_word(pdev, cap + PCI_VPD_ADDR, offset); | 3659 | sky2_pci_write16(hw, cap + PCI_VPD_ADDR, offset); |
3686 | 3660 | ||
3687 | do { | 3661 | do { |
3688 | pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); | 3662 | offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR); |
3689 | } while (!(offset & PCI_VPD_ADDR_F)); | 3663 | } while (!(offset & PCI_VPD_ADDR_F)); |
3690 | 3664 | ||
3691 | pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &val); | 3665 | val = sky2_pci_read32(hw, cap + PCI_VPD_DATA); |
3692 | return val; | 3666 | return val; |
3693 | } | 3667 | } |
3694 | 3668 | ||
3695 | static void sky2_vpd_write(struct pci_dev *pdev, int cap, u16 offset, u32 val) | 3669 | static void sky2_vpd_write(struct sky2_hw *hw, int cap, u16 offset, u32 val) |
3696 | { | 3670 | { |
3697 | pci_write_config_word(pdev, cap + PCI_VPD_DATA, val); | 3671 | sky2_pci_write16(hw, cap + PCI_VPD_DATA, val); |
3698 | pci_write_config_dword(pdev, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F); | 3672 | sky2_pci_write32(hw, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F); |
3699 | do { | 3673 | do { |
3700 | pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); | 3674 | offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR); |
3701 | } while (offset & PCI_VPD_ADDR_F); | 3675 | } while (offset & PCI_VPD_ADDR_F); |
3702 | } | 3676 | } |
3703 | 3677 | ||
@@ -3715,7 +3689,7 @@ static int sky2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom | |||
3715 | eeprom->magic = SKY2_EEPROM_MAGIC; | 3689 | eeprom->magic = SKY2_EEPROM_MAGIC; |
3716 | 3690 | ||
3717 | while (length > 0) { | 3691 | while (length > 0) { |
3718 | u32 val = sky2_vpd_read(sky2->hw->pdev, cap, offset); | 3692 | u32 val = sky2_vpd_read(sky2->hw, cap, offset); |
3719 | int n = min_t(int, length, sizeof(val)); | 3693 | int n = min_t(int, length, sizeof(val)); |
3720 | 3694 | ||
3721 | memcpy(data, &val, n); | 3695 | memcpy(data, &val, n); |
@@ -3745,10 +3719,10 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom | |||
3745 | int n = min_t(int, length, sizeof(val)); | 3719 | int n = min_t(int, length, sizeof(val)); |
3746 | 3720 | ||
3747 | if (n < sizeof(val)) | 3721 | if (n < sizeof(val)) |
3748 | val = sky2_vpd_read(sky2->hw->pdev, cap, offset); | 3722 | val = sky2_vpd_read(sky2->hw, cap, offset); |
3749 | memcpy(&val, data, n); | 3723 | memcpy(&val, data, n); |
3750 | 3724 | ||
3751 | sky2_vpd_write(sky2->hw->pdev, cap, offset, val); | 3725 | sky2_vpd_write(sky2->hw, cap, offset, val); |
3752 | 3726 | ||
3753 | length -= n; | 3727 | length -= n; |
3754 | data += n; | 3728 | data += n; |
@@ -3881,6 +3855,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v) | |||
3881 | last = sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_PUT_IDX)), | 3855 | last = sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_PUT_IDX)), |
3882 | sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_LAST_IDX))); | 3856 | sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_LAST_IDX))); |
3883 | 3857 | ||
3858 | sky2_read32(hw, B0_Y2_SP_LISR); | ||
3884 | napi_enable(&hw->napi); | 3859 | napi_enable(&hw->napi); |
3885 | return 0; | 3860 | return 0; |
3886 | } | 3861 | } |
@@ -4013,7 +3988,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
4013 | sky2->duplex = -1; | 3988 | sky2->duplex = -1; |
4014 | sky2->speed = -1; | 3989 | sky2->speed = -1; |
4015 | sky2->advertising = sky2_supported_modes(hw); | 3990 | sky2->advertising = sky2_supported_modes(hw); |
4016 | sky2->rx_csum = 1; | 3991 | sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); |
4017 | sky2->wol = wol; | 3992 | sky2->wol = wol; |
4018 | 3993 | ||
4019 | spin_lock_init(&sky2->phy_lock); | 3994 | spin_lock_init(&sky2->phy_lock); |
@@ -4184,9 +4159,9 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4184 | */ | 4159 | */ |
4185 | { | 4160 | { |
4186 | u32 reg; | 4161 | u32 reg; |
4187 | pci_read_config_dword(pdev,PCI_DEV_REG2, ®); | 4162 | reg = sky2_pci_read32(hw, PCI_DEV_REG2); |
4188 | reg &= ~PCI_REV_DESC; | 4163 | reg &= ~PCI_REV_DESC; |
4189 | pci_write_config_dword(pdev, PCI_DEV_REG2, reg); | 4164 | sky2_pci_write32(hw, PCI_DEV_REG2, reg); |
4190 | } | 4165 | } |
4191 | #endif | 4166 | #endif |
4192 | 4167 | ||
@@ -4377,7 +4352,7 @@ static int sky2_resume(struct pci_dev *pdev) | |||
4377 | if (hw->chip_id == CHIP_ID_YUKON_EX || | 4352 | if (hw->chip_id == CHIP_ID_YUKON_EX || |
4378 | hw->chip_id == CHIP_ID_YUKON_EC_U || | 4353 | hw->chip_id == CHIP_ID_YUKON_EC_U || |
4379 | hw->chip_id == CHIP_ID_YUKON_FE_P) | 4354 | hw->chip_id == CHIP_ID_YUKON_FE_P) |
4380 | pci_write_config_dword(pdev, PCI_DEV_REG3, 0); | 4355 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
4381 | 4356 | ||
4382 | sky2_reset(hw); | 4357 | sky2_reset(hw); |
4383 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 4358 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 69525fd7908d..ffe9b8a50a1b 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -1991,14 +1991,14 @@ struct sky2_port { | |||
1991 | u16 tx_cons; /* next le to check */ | 1991 | u16 tx_cons; /* next le to check */ |
1992 | u16 tx_prod; /* next le to use */ | 1992 | u16 tx_prod; /* next le to use */ |
1993 | u16 tx_next; /* debug only */ | 1993 | u16 tx_next; /* debug only */ |
1994 | u32 tx_addr64; | 1994 | |
1995 | u16 tx_pending; | 1995 | u16 tx_pending; |
1996 | u16 tx_last_mss; | 1996 | u16 tx_last_mss; |
1997 | u32 tx_tcpsum; | 1997 | u32 tx_tcpsum; |
1998 | 1998 | ||
1999 | struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; | 1999 | struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; |
2000 | struct sky2_rx_le *rx_le; | 2000 | struct sky2_rx_le *rx_le; |
2001 | u32 rx_addr64; | 2001 | |
2002 | u16 rx_next; /* next re to check */ | 2002 | u16 rx_next; /* next re to check */ |
2003 | u16 rx_put; /* next le index to use */ | 2003 | u16 rx_put; /* next le index to use */ |
2004 | u16 rx_pending; | 2004 | u16 rx_pending; |
@@ -2128,4 +2128,25 @@ static inline void gma_set_addr(struct sky2_hw *hw, unsigned port, unsigned reg, | |||
2128 | gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); | 2128 | gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); |
2129 | gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); | 2129 | gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); |
2130 | } | 2130 | } |
2131 | |||
2132 | /* PCI config space access */ | ||
2133 | static inline u32 sky2_pci_read32(const struct sky2_hw *hw, unsigned reg) | ||
2134 | { | ||
2135 | return sky2_read32(hw, Y2_CFG_SPC + reg); | ||
2136 | } | ||
2137 | |||
2138 | static inline u16 sky2_pci_read16(const struct sky2_hw *hw, unsigned reg) | ||
2139 | { | ||
2140 | return sky2_read16(hw, Y2_CFG_SPC + reg); | ||
2141 | } | ||
2142 | |||
2143 | static inline void sky2_pci_write32(struct sky2_hw *hw, unsigned reg, u32 val) | ||
2144 | { | ||
2145 | sky2_write32(hw, Y2_CFG_SPC + reg, val); | ||
2146 | } | ||
2147 | |||
2148 | static inline void sky2_pci_write16(struct sky2_hw *hw, unsigned reg, u16 val) | ||
2149 | { | ||
2150 | sky2_write16(hw, Y2_CFG_SPC + reg, val); | ||
2151 | } | ||
2131 | #endif | 2152 | #endif |
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index dd18af0ce676..76cc1d3adf71 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -428,7 +428,6 @@ static inline void smc911x_drop_pkt(struct net_device *dev) | |||
428 | */ | 428 | */ |
429 | static inline void smc911x_rcv(struct net_device *dev) | 429 | static inline void smc911x_rcv(struct net_device *dev) |
430 | { | 430 | { |
431 | struct smc911x_local *lp = netdev_priv(dev); | ||
432 | unsigned long ioaddr = dev->base_addr; | 431 | unsigned long ioaddr = dev->base_addr; |
433 | unsigned int pkt_len, status; | 432 | unsigned int pkt_len, status; |
434 | struct sk_buff *skb; | 433 | struct sk_buff *skb; |
@@ -473,6 +472,7 @@ static inline void smc911x_rcv(struct net_device *dev) | |||
473 | skb_put(skb,pkt_len-4); | 472 | skb_put(skb,pkt_len-4); |
474 | #ifdef SMC_USE_DMA | 473 | #ifdef SMC_USE_DMA |
475 | { | 474 | { |
475 | struct smc911x_local *lp = netdev_priv(dev); | ||
476 | unsigned int fifo; | 476 | unsigned int fifo; |
477 | /* Lower the FIFO threshold if possible */ | 477 | /* Lower the FIFO threshold if possible */ |
478 | fifo = SMC_GET_FIFO_INT(); | 478 | fifo = SMC_GET_FIFO_INT(); |
@@ -1299,9 +1299,9 @@ smc911x_rx_dma_irq(int dma, void *data) | |||
1299 | PRINT_PKT(skb->data, skb->len); | 1299 | PRINT_PKT(skb->data, skb->len); |
1300 | dev->last_rx = jiffies; | 1300 | dev->last_rx = jiffies; |
1301 | skb->protocol = eth_type_trans(skb, dev); | 1301 | skb->protocol = eth_type_trans(skb, dev); |
1302 | netif_rx(skb); | ||
1303 | dev->stats.rx_packets++; | 1302 | dev->stats.rx_packets++; |
1304 | dev->stats.rx_bytes += skb->len; | 1303 | dev->stats.rx_bytes += skb->len; |
1304 | netif_rx(skb); | ||
1305 | 1305 | ||
1306 | spin_lock_irqsave(&lp->lock, flags); | 1306 | spin_lock_irqsave(&lp->lock, flags); |
1307 | pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; | 1307 | pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; |
@@ -1379,13 +1379,6 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1379 | unsigned int multicast_table[2]; | 1379 | unsigned int multicast_table[2]; |
1380 | unsigned int mcr, update_multicast = 0; | 1380 | unsigned int mcr, update_multicast = 0; |
1381 | unsigned long flags; | 1381 | unsigned long flags; |
1382 | /* table for flipping the order of 5 bits */ | ||
1383 | static const unsigned char invert5[] = | ||
1384 | {0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0C, 0x1C, | ||
1385 | 0x02, 0x12, 0x0A, 0x1A, 0x06, 0x16, 0x0E, 0x1E, | ||
1386 | 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0D, 0x1D, | ||
1387 | 0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F}; | ||
1388 | |||
1389 | 1382 | ||
1390 | DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); | 1383 | DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); |
1391 | 1384 | ||
@@ -1432,7 +1425,7 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1432 | 1425 | ||
1433 | cur_addr = dev->mc_list; | 1426 | cur_addr = dev->mc_list; |
1434 | for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) { | 1427 | for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) { |
1435 | int position; | 1428 | u32 position; |
1436 | 1429 | ||
1437 | /* do we have a pointer here? */ | 1430 | /* do we have a pointer here? */ |
1438 | if (!cur_addr) | 1431 | if (!cur_addr) |
@@ -1442,12 +1435,10 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1442 | if (!(*cur_addr->dmi_addr & 1)) | 1435 | if (!(*cur_addr->dmi_addr & 1)) |
1443 | continue; | 1436 | continue; |
1444 | 1437 | ||
1445 | /* only use the low order bits */ | 1438 | /* upper 6 bits are used as hash index */ |
1446 | position = crc32_le(~0, cur_addr->dmi_addr, 6) & 0x3f; | 1439 | position = ether_crc(ETH_ALEN, cur_addr->dmi_addr)>>26; |
1447 | 1440 | ||
1448 | /* do some messy swapping to put the bit in the right spot */ | 1441 | multicast_table[position>>5] |= 1 << (position&0x1f); |
1449 | multicast_table[invert5[position&0x1F]&0x1] |= | ||
1450 | (1<<invert5[(position>>1)&0x1F]); | ||
1451 | } | 1442 | } |
1452 | 1443 | ||
1453 | /* be sure I get rid of flags I might have set */ | 1444 | /* be sure I get rid of flags I might have set */ |
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index 16a0edc078fd..7defa63b9c74 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #define SMC_USE_16BIT 0 | 37 | #define SMC_USE_16BIT 0 |
38 | #define SMC_USE_32BIT 1 | 38 | #define SMC_USE_32BIT 1 |
39 | #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING | 39 | #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING |
40 | #elif CONFIG_SH_MAGIC_PANEL_R2 | 40 | #elif defined(CONFIG_SH_MAGIC_PANEL_R2) |
41 | #define SMC_USE_SH_DMA 0 | 41 | #define SMC_USE_SH_DMA 0 |
42 | #define SMC_USE_16BIT 0 | 42 | #define SMC_USE_16BIT 0 |
43 | #define SMC_USE_32BIT 1 | 43 | #define SMC_USE_32BIT 1 |
@@ -76,7 +76,7 @@ | |||
76 | 76 | ||
77 | 77 | ||
78 | 78 | ||
79 | #if SMC_USE_PXA_DMA | 79 | #ifdef SMC_USE_PXA_DMA |
80 | #define SMC_USE_DMA | 80 | #define SMC_USE_DMA |
81 | 81 | ||
82 | /* | 82 | /* |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index db34e1eb67e9..07b7f7120e37 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -55,7 +55,7 @@ | |||
55 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | 55 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) |
56 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 56 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
57 | 57 | ||
58 | #elif defined(CONFIG_BFIN) | 58 | #elif defined(CONFIG_BLACKFIN) |
59 | 59 | ||
60 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH | 60 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH |
61 | #define RPC_LSA_DEFAULT RPC_LED_100_10 | 61 | #define RPC_LSA_DEFAULT RPC_LED_100_10 |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index bcc430bd9e49..6e00dc857afa 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -1742,7 +1742,7 @@ static void set_rx_mode(struct net_device *dev) | |||
1742 | if (vlan_group_get_device(np->vlgrp, i)) { | 1742 | if (vlan_group_get_device(np->vlgrp, i)) { |
1743 | if (vlan_count >= 32) | 1743 | if (vlan_count >= 32) |
1744 | break; | 1744 | break; |
1745 | writew(cpu_to_be16(i), filter_addr); | 1745 | writew(i, filter_addr); |
1746 | filter_addr += 16; | 1746 | filter_addr += 16; |
1747 | vlan_count++; | 1747 | vlan_count++; |
1748 | } | 1748 | } |
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index ff98f5d597f1..0a6186d4a48e 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -340,9 +340,9 @@ enum mac_ctrl1_bits { | |||
340 | /* Note that using only 32 bit fields simplifies conversion to big-endian | 340 | /* Note that using only 32 bit fields simplifies conversion to big-endian |
341 | architectures. */ | 341 | architectures. */ |
342 | struct netdev_desc { | 342 | struct netdev_desc { |
343 | u32 next_desc; | 343 | __le32 next_desc; |
344 | u32 status; | 344 | __le32 status; |
345 | struct desc_frag { u32 addr, length; } frag[1]; | 345 | struct desc_frag { __le32 addr, length; } frag[1]; |
346 | }; | 346 | }; |
347 | 347 | ||
348 | /* Bits in netdev_desc.status */ | 348 | /* Bits in netdev_desc.status */ |
@@ -495,8 +495,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
495 | goto err_out_res; | 495 | goto err_out_res; |
496 | 496 | ||
497 | for (i = 0; i < 3; i++) | 497 | for (i = 0; i < 3; i++) |
498 | ((u16 *)dev->dev_addr)[i] = | 498 | ((__le16 *)dev->dev_addr)[i] = |
499 | le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); | 499 | cpu_to_le16(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); |
500 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 500 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
501 | 501 | ||
502 | dev->base_addr = (unsigned long)ioaddr; | 502 | dev->base_addr = (unsigned long)ioaddr; |
@@ -1090,8 +1090,8 @@ reset_tx (struct net_device *dev) | |||
1090 | skb = np->tx_skbuff[i]; | 1090 | skb = np->tx_skbuff[i]; |
1091 | if (skb) { | 1091 | if (skb) { |
1092 | pci_unmap_single(np->pci_dev, | 1092 | pci_unmap_single(np->pci_dev, |
1093 | np->tx_ring[i].frag[0].addr, skb->len, | 1093 | le32_to_cpu(np->tx_ring[i].frag[0].addr), |
1094 | PCI_DMA_TODEVICE); | 1094 | skb->len, PCI_DMA_TODEVICE); |
1095 | if (irq) | 1095 | if (irq) |
1096 | dev_kfree_skb_irq (skb); | 1096 | dev_kfree_skb_irq (skb); |
1097 | else | 1097 | else |
@@ -1214,7 +1214,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1214 | skb = np->tx_skbuff[entry]; | 1214 | skb = np->tx_skbuff[entry]; |
1215 | /* Free the original skb. */ | 1215 | /* Free the original skb. */ |
1216 | pci_unmap_single(np->pci_dev, | 1216 | pci_unmap_single(np->pci_dev, |
1217 | np->tx_ring[entry].frag[0].addr, | 1217 | le32_to_cpu(np->tx_ring[entry].frag[0].addr), |
1218 | skb->len, PCI_DMA_TODEVICE); | 1218 | skb->len, PCI_DMA_TODEVICE); |
1219 | dev_kfree_skb_irq (np->tx_skbuff[entry]); | 1219 | dev_kfree_skb_irq (np->tx_skbuff[entry]); |
1220 | np->tx_skbuff[entry] = NULL; | 1220 | np->tx_skbuff[entry] = NULL; |
@@ -1233,7 +1233,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1233 | skb = np->tx_skbuff[entry]; | 1233 | skb = np->tx_skbuff[entry]; |
1234 | /* Free the original skb. */ | 1234 | /* Free the original skb. */ |
1235 | pci_unmap_single(np->pci_dev, | 1235 | pci_unmap_single(np->pci_dev, |
1236 | np->tx_ring[entry].frag[0].addr, | 1236 | le32_to_cpu(np->tx_ring[entry].frag[0].addr), |
1237 | skb->len, PCI_DMA_TODEVICE); | 1237 | skb->len, PCI_DMA_TODEVICE); |
1238 | dev_kfree_skb_irq (np->tx_skbuff[entry]); | 1238 | dev_kfree_skb_irq (np->tx_skbuff[entry]); |
1239 | np->tx_skbuff[entry] = NULL; | 1239 | np->tx_skbuff[entry] = NULL; |
@@ -1311,19 +1311,19 @@ static void rx_poll(unsigned long data) | |||
1311 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1311 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1312 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1312 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1313 | pci_dma_sync_single_for_cpu(np->pci_dev, | 1313 | pci_dma_sync_single_for_cpu(np->pci_dev, |
1314 | desc->frag[0].addr, | 1314 | le32_to_cpu(desc->frag[0].addr), |
1315 | np->rx_buf_sz, | 1315 | np->rx_buf_sz, |
1316 | PCI_DMA_FROMDEVICE); | 1316 | PCI_DMA_FROMDEVICE); |
1317 | 1317 | ||
1318 | skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len); | 1318 | skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len); |
1319 | pci_dma_sync_single_for_device(np->pci_dev, | 1319 | pci_dma_sync_single_for_device(np->pci_dev, |
1320 | desc->frag[0].addr, | 1320 | le32_to_cpu(desc->frag[0].addr), |
1321 | np->rx_buf_sz, | 1321 | np->rx_buf_sz, |
1322 | PCI_DMA_FROMDEVICE); | 1322 | PCI_DMA_FROMDEVICE); |
1323 | skb_put(skb, pkt_len); | 1323 | skb_put(skb, pkt_len); |
1324 | } else { | 1324 | } else { |
1325 | pci_unmap_single(np->pci_dev, | 1325 | pci_unmap_single(np->pci_dev, |
1326 | desc->frag[0].addr, | 1326 | le32_to_cpu(desc->frag[0].addr), |
1327 | np->rx_buf_sz, | 1327 | np->rx_buf_sz, |
1328 | PCI_DMA_FROMDEVICE); | 1328 | PCI_DMA_FROMDEVICE); |
1329 | skb_put(skb = np->rx_skbuff[entry], pkt_len); | 1329 | skb_put(skb = np->rx_skbuff[entry], pkt_len); |
@@ -1709,23 +1709,23 @@ static int netdev_close(struct net_device *dev) | |||
1709 | /* Free all the skbuffs in the Rx queue. */ | 1709 | /* Free all the skbuffs in the Rx queue. */ |
1710 | for (i = 0; i < RX_RING_SIZE; i++) { | 1710 | for (i = 0; i < RX_RING_SIZE; i++) { |
1711 | np->rx_ring[i].status = 0; | 1711 | np->rx_ring[i].status = 0; |
1712 | np->rx_ring[i].frag[0].addr = 0xBADF00D0; /* An invalid address. */ | ||
1713 | skb = np->rx_skbuff[i]; | 1712 | skb = np->rx_skbuff[i]; |
1714 | if (skb) { | 1713 | if (skb) { |
1715 | pci_unmap_single(np->pci_dev, | 1714 | pci_unmap_single(np->pci_dev, |
1716 | np->rx_ring[i].frag[0].addr, np->rx_buf_sz, | 1715 | le32_to_cpu(np->rx_ring[i].frag[0].addr), |
1717 | PCI_DMA_FROMDEVICE); | 1716 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1718 | dev_kfree_skb(skb); | 1717 | dev_kfree_skb(skb); |
1719 | np->rx_skbuff[i] = NULL; | 1718 | np->rx_skbuff[i] = NULL; |
1720 | } | 1719 | } |
1720 | np->rx_ring[i].frag[0].addr = cpu_to_le32(0xBADF00D0); /* poison */ | ||
1721 | } | 1721 | } |
1722 | for (i = 0; i < TX_RING_SIZE; i++) { | 1722 | for (i = 0; i < TX_RING_SIZE; i++) { |
1723 | np->tx_ring[i].next_desc = 0; | 1723 | np->tx_ring[i].next_desc = 0; |
1724 | skb = np->tx_skbuff[i]; | 1724 | skb = np->tx_skbuff[i]; |
1725 | if (skb) { | 1725 | if (skb) { |
1726 | pci_unmap_single(np->pci_dev, | 1726 | pci_unmap_single(np->pci_dev, |
1727 | np->tx_ring[i].frag[0].addr, skb->len, | 1727 | le32_to_cpu(np->tx_ring[i].frag[0].addr), |
1728 | PCI_DMA_TODEVICE); | 1728 | skb->len, PCI_DMA_TODEVICE); |
1729 | dev_kfree_skb(skb); | 1729 | dev_kfree_skb(skb); |
1730 | np->tx_skbuff[i] = NULL; | 1730 | np->tx_skbuff[i] = NULL; |
1731 | } | 1731 | } |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index f6fedcc32de1..68872142530b 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2281,14 +2281,12 @@ static void gem_reset_task(struct work_struct *work) | |||
2281 | 2281 | ||
2282 | mutex_lock(&gp->pm_mutex); | 2282 | mutex_lock(&gp->pm_mutex); |
2283 | 2283 | ||
2284 | napi_disable(&gp->napi); | 2284 | if (gp->opened) |
2285 | napi_disable(&gp->napi); | ||
2285 | 2286 | ||
2286 | spin_lock_irq(&gp->lock); | 2287 | spin_lock_irq(&gp->lock); |
2287 | spin_lock(&gp->tx_lock); | 2288 | spin_lock(&gp->tx_lock); |
2288 | 2289 | ||
2289 | if (gp->running == 0) | ||
2290 | goto not_running; | ||
2291 | |||
2292 | if (gp->running) { | 2290 | if (gp->running) { |
2293 | netif_stop_queue(gp->dev); | 2291 | netif_stop_queue(gp->dev); |
2294 | 2292 | ||
@@ -2298,13 +2296,14 @@ static void gem_reset_task(struct work_struct *work) | |||
2298 | gem_set_link_modes(gp); | 2296 | gem_set_link_modes(gp); |
2299 | netif_wake_queue(gp->dev); | 2297 | netif_wake_queue(gp->dev); |
2300 | } | 2298 | } |
2301 | not_running: | 2299 | |
2302 | gp->reset_task_pending = 0; | 2300 | gp->reset_task_pending = 0; |
2303 | 2301 | ||
2304 | spin_unlock(&gp->tx_lock); | 2302 | spin_unlock(&gp->tx_lock); |
2305 | spin_unlock_irq(&gp->lock); | 2303 | spin_unlock_irq(&gp->lock); |
2306 | 2304 | ||
2307 | napi_enable(&gp->napi); | 2305 | if (gp->opened) |
2306 | napi_enable(&gp->napi); | ||
2308 | 2307 | ||
2309 | mutex_unlock(&gp->pm_mutex); | 2308 | mutex_unlock(&gp->pm_mutex); |
2310 | } | 2309 | } |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index d887c05588d5..370d329d15d9 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -611,7 +611,7 @@ static int __devinit tc35815_mac_match(struct device *dev, void *data) | |||
611 | { | 611 | { |
612 | struct platform_device *plat_dev = to_platform_device(dev); | 612 | struct platform_device *plat_dev = to_platform_device(dev); |
613 | struct pci_dev *pci_dev = data; | 613 | struct pci_dev *pci_dev = data; |
614 | unsigned int id = (pci_dev->bus->number << 8) | pci_dev->devfn; | 614 | unsigned int id = pci_dev->irq; |
615 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; | 615 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; |
616 | } | 616 | } |
617 | 617 | ||
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 4942f7d18937..22eb7c8c1a25 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -8189,6 +8189,7 @@ static int tg3_get_eeprom_len(struct net_device *dev) | |||
8189 | } | 8189 | } |
8190 | 8190 | ||
8191 | static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val); | 8191 | static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val); |
8192 | static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val); | ||
8192 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val); | 8193 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val); |
8193 | 8194 | ||
8194 | static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) | 8195 | static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) |
@@ -8196,7 +8197,8 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8196 | struct tg3 *tp = netdev_priv(dev); | 8197 | struct tg3 *tp = netdev_priv(dev); |
8197 | int ret; | 8198 | int ret; |
8198 | u8 *pd; | 8199 | u8 *pd; |
8199 | u32 i, offset, len, val, b_offset, b_count; | 8200 | u32 i, offset, len, b_offset, b_count; |
8201 | __le32 val; | ||
8200 | 8202 | ||
8201 | if (tp->link_config.phy_is_low_power) | 8203 | if (tp->link_config.phy_is_low_power) |
8202 | return -EAGAIN; | 8204 | return -EAGAIN; |
@@ -8215,10 +8217,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8215 | /* i.e. offset=1 len=2 */ | 8217 | /* i.e. offset=1 len=2 */ |
8216 | b_count = len; | 8218 | b_count = len; |
8217 | } | 8219 | } |
8218 | ret = tg3_nvram_read(tp, offset-b_offset, &val); | 8220 | ret = tg3_nvram_read_le(tp, offset-b_offset, &val); |
8219 | if (ret) | 8221 | if (ret) |
8220 | return ret; | 8222 | return ret; |
8221 | val = cpu_to_le32(val); | ||
8222 | memcpy(data, ((char*)&val) + b_offset, b_count); | 8223 | memcpy(data, ((char*)&val) + b_offset, b_count); |
8223 | len -= b_count; | 8224 | len -= b_count; |
8224 | offset += b_count; | 8225 | offset += b_count; |
@@ -8228,12 +8229,11 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8228 | /* read bytes upto the last 4 byte boundary */ | 8229 | /* read bytes upto the last 4 byte boundary */ |
8229 | pd = &data[eeprom->len]; | 8230 | pd = &data[eeprom->len]; |
8230 | for (i = 0; i < (len - (len & 3)); i += 4) { | 8231 | for (i = 0; i < (len - (len & 3)); i += 4) { |
8231 | ret = tg3_nvram_read(tp, offset + i, &val); | 8232 | ret = tg3_nvram_read_le(tp, offset + i, &val); |
8232 | if (ret) { | 8233 | if (ret) { |
8233 | eeprom->len += i; | 8234 | eeprom->len += i; |
8234 | return ret; | 8235 | return ret; |
8235 | } | 8236 | } |
8236 | val = cpu_to_le32(val); | ||
8237 | memcpy(pd + i, &val, 4); | 8237 | memcpy(pd + i, &val, 4); |
8238 | } | 8238 | } |
8239 | eeprom->len += i; | 8239 | eeprom->len += i; |
@@ -8243,11 +8243,10 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8243 | pd = &data[eeprom->len]; | 8243 | pd = &data[eeprom->len]; |
8244 | b_count = len & 3; | 8244 | b_count = len & 3; |
8245 | b_offset = offset + len - b_count; | 8245 | b_offset = offset + len - b_count; |
8246 | ret = tg3_nvram_read(tp, b_offset, &val); | 8246 | ret = tg3_nvram_read_le(tp, b_offset, &val); |
8247 | if (ret) | 8247 | if (ret) |
8248 | return ret; | 8248 | return ret; |
8249 | val = cpu_to_le32(val); | 8249 | memcpy(pd, &val, b_count); |
8250 | memcpy(pd, ((char*)&val), b_count); | ||
8251 | eeprom->len += b_count; | 8250 | eeprom->len += b_count; |
8252 | } | 8251 | } |
8253 | return 0; | 8252 | return 0; |
@@ -8259,8 +8258,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8259 | { | 8258 | { |
8260 | struct tg3 *tp = netdev_priv(dev); | 8259 | struct tg3 *tp = netdev_priv(dev); |
8261 | int ret; | 8260 | int ret; |
8262 | u32 offset, len, b_offset, odd_len, start, end; | 8261 | u32 offset, len, b_offset, odd_len; |
8263 | u8 *buf; | 8262 | u8 *buf; |
8263 | __le32 start, end; | ||
8264 | 8264 | ||
8265 | if (tp->link_config.phy_is_low_power) | 8265 | if (tp->link_config.phy_is_low_power) |
8266 | return -EAGAIN; | 8266 | return -EAGAIN; |
@@ -8273,10 +8273,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8273 | 8273 | ||
8274 | if ((b_offset = (offset & 3))) { | 8274 | if ((b_offset = (offset & 3))) { |
8275 | /* adjustments to start on required 4 byte boundary */ | 8275 | /* adjustments to start on required 4 byte boundary */ |
8276 | ret = tg3_nvram_read(tp, offset-b_offset, &start); | 8276 | ret = tg3_nvram_read_le(tp, offset-b_offset, &start); |
8277 | if (ret) | 8277 | if (ret) |
8278 | return ret; | 8278 | return ret; |
8279 | start = cpu_to_le32(start); | ||
8280 | len += b_offset; | 8279 | len += b_offset; |
8281 | offset &= ~3; | 8280 | offset &= ~3; |
8282 | if (len < 4) | 8281 | if (len < 4) |
@@ -8288,10 +8287,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8288 | /* adjustments to end on required 4 byte boundary */ | 8287 | /* adjustments to end on required 4 byte boundary */ |
8289 | odd_len = 1; | 8288 | odd_len = 1; |
8290 | len = (len + 3) & ~3; | 8289 | len = (len + 3) & ~3; |
8291 | ret = tg3_nvram_read(tp, offset+len-4, &end); | 8290 | ret = tg3_nvram_read_le(tp, offset+len-4, &end); |
8292 | if (ret) | 8291 | if (ret) |
8293 | return ret; | 8292 | return ret; |
8294 | end = cpu_to_le32(end); | ||
8295 | } | 8293 | } |
8296 | 8294 | ||
8297 | buf = data; | 8295 | buf = data; |
@@ -8734,7 +8732,8 @@ static void tg3_get_ethtool_stats (struct net_device *dev, | |||
8734 | 8732 | ||
8735 | static int tg3_test_nvram(struct tg3 *tp) | 8733 | static int tg3_test_nvram(struct tg3 *tp) |
8736 | { | 8734 | { |
8737 | u32 *buf, csum, magic; | 8735 | u32 csum, magic; |
8736 | __le32 *buf; | ||
8738 | int i, j, k, err = 0, size; | 8737 | int i, j, k, err = 0, size; |
8739 | 8738 | ||
8740 | if (tg3_nvram_read_swab(tp, 0, &magic) != 0) | 8739 | if (tg3_nvram_read_swab(tp, 0, &magic) != 0) |
@@ -8771,21 +8770,19 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8771 | 8770 | ||
8772 | err = -EIO; | 8771 | err = -EIO; |
8773 | for (i = 0, j = 0; i < size; i += 4, j++) { | 8772 | for (i = 0, j = 0; i < size; i += 4, j++) { |
8774 | u32 val; | 8773 | if ((err = tg3_nvram_read_le(tp, i, &buf[j])) != 0) |
8775 | |||
8776 | if ((err = tg3_nvram_read(tp, i, &val)) != 0) | ||
8777 | break; | 8774 | break; |
8778 | buf[j] = cpu_to_le32(val); | ||
8779 | } | 8775 | } |
8780 | if (i < size) | 8776 | if (i < size) |
8781 | goto out; | 8777 | goto out; |
8782 | 8778 | ||
8783 | /* Selfboot format */ | 8779 | /* Selfboot format */ |
8784 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_FW_MSK) == | 8780 | magic = swab32(le32_to_cpu(buf[0])); |
8781 | if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == | ||
8785 | TG3_EEPROM_MAGIC_FW) { | 8782 | TG3_EEPROM_MAGIC_FW) { |
8786 | u8 *buf8 = (u8 *) buf, csum8 = 0; | 8783 | u8 *buf8 = (u8 *) buf, csum8 = 0; |
8787 | 8784 | ||
8788 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) == | 8785 | if ((magic & TG3_EEPROM_SB_REVISION_MASK) == |
8789 | TG3_EEPROM_SB_REVISION_2) { | 8786 | TG3_EEPROM_SB_REVISION_2) { |
8790 | /* For rev 2, the csum doesn't include the MBA. */ | 8787 | /* For rev 2, the csum doesn't include the MBA. */ |
8791 | for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++) | 8788 | for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++) |
@@ -8806,7 +8803,7 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8806 | goto out; | 8803 | goto out; |
8807 | } | 8804 | } |
8808 | 8805 | ||
8809 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_HW_MSK) == | 8806 | if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == |
8810 | TG3_EEPROM_MAGIC_HW) { | 8807 | TG3_EEPROM_MAGIC_HW) { |
8811 | u8 data[NVRAM_SELFBOOT_DATA_SIZE]; | 8808 | u8 data[NVRAM_SELFBOOT_DATA_SIZE]; |
8812 | u8 parity[NVRAM_SELFBOOT_DATA_SIZE]; | 8809 | u8 parity[NVRAM_SELFBOOT_DATA_SIZE]; |
@@ -8852,12 +8849,12 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8852 | 8849 | ||
8853 | /* Bootstrap checksum at offset 0x10 */ | 8850 | /* Bootstrap checksum at offset 0x10 */ |
8854 | csum = calc_crc((unsigned char *) buf, 0x10); | 8851 | csum = calc_crc((unsigned char *) buf, 0x10); |
8855 | if(csum != cpu_to_le32(buf[0x10/4])) | 8852 | if(csum != le32_to_cpu(buf[0x10/4])) |
8856 | goto out; | 8853 | goto out; |
8857 | 8854 | ||
8858 | /* Manufacturing block starts at offset 0x74, checksum at 0xfc */ | 8855 | /* Manufacturing block starts at offset 0x74, checksum at 0xfc */ |
8859 | csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88); | 8856 | csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88); |
8860 | if (csum != cpu_to_le32(buf[0xfc/4])) | 8857 | if (csum != le32_to_cpu(buf[0xfc/4])) |
8861 | goto out; | 8858 | goto out; |
8862 | 8859 | ||
8863 | err = 0; | 8860 | err = 0; |
@@ -10171,6 +10168,15 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) | |||
10171 | return ret; | 10168 | return ret; |
10172 | } | 10169 | } |
10173 | 10170 | ||
10171 | static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val) | ||
10172 | { | ||
10173 | u32 v; | ||
10174 | int res = tg3_nvram_read(tp, offset, &v); | ||
10175 | if (!res) | ||
10176 | *val = cpu_to_le32(v); | ||
10177 | return res; | ||
10178 | } | ||
10179 | |||
10174 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val) | 10180 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val) |
10175 | { | 10181 | { |
10176 | int err; | 10182 | int err; |
@@ -10188,13 +10194,14 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp, | |||
10188 | u32 val; | 10194 | u32 val; |
10189 | 10195 | ||
10190 | for (i = 0; i < len; i += 4) { | 10196 | for (i = 0; i < len; i += 4) { |
10191 | u32 addr, data; | 10197 | u32 addr; |
10198 | __le32 data; | ||
10192 | 10199 | ||
10193 | addr = offset + i; | 10200 | addr = offset + i; |
10194 | 10201 | ||
10195 | memcpy(&data, buf + i, 4); | 10202 | memcpy(&data, buf + i, 4); |
10196 | 10203 | ||
10197 | tw32(GRC_EEPROM_DATA, cpu_to_le32(data)); | 10204 | tw32(GRC_EEPROM_DATA, le32_to_cpu(data)); |
10198 | 10205 | ||
10199 | val = tr32(GRC_EEPROM_ADDR); | 10206 | val = tr32(GRC_EEPROM_ADDR); |
10200 | tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); | 10207 | tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); |
@@ -10244,8 +10251,8 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, | |||
10244 | phy_addr = offset & ~pagemask; | 10251 | phy_addr = offset & ~pagemask; |
10245 | 10252 | ||
10246 | for (j = 0; j < pagesize; j += 4) { | 10253 | for (j = 0; j < pagesize; j += 4) { |
10247 | if ((ret = tg3_nvram_read(tp, phy_addr + j, | 10254 | if ((ret = tg3_nvram_read_le(tp, phy_addr + j, |
10248 | (u32 *) (tmp + j)))) | 10255 | (__le32 *) (tmp + j)))) |
10249 | break; | 10256 | break; |
10250 | } | 10257 | } |
10251 | if (ret) | 10258 | if (ret) |
@@ -10289,10 +10296,11 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, | |||
10289 | break; | 10296 | break; |
10290 | 10297 | ||
10291 | for (j = 0; j < pagesize; j += 4) { | 10298 | for (j = 0; j < pagesize; j += 4) { |
10292 | u32 data; | 10299 | __be32 data; |
10293 | 10300 | ||
10294 | data = *((u32 *) (tmp + j)); | 10301 | data = *((__be32 *) (tmp + j)); |
10295 | tw32(NVRAM_WRDATA, cpu_to_be32(data)); | 10302 | /* swab32(le32_to_cpu(data)), actually */ |
10303 | tw32(NVRAM_WRDATA, be32_to_cpu(data)); | ||
10296 | 10304 | ||
10297 | tw32(NVRAM_ADDR, phy_addr + j); | 10305 | tw32(NVRAM_ADDR, phy_addr + j); |
10298 | 10306 | ||
@@ -10326,10 +10334,11 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len, | |||
10326 | int i, ret = 0; | 10334 | int i, ret = 0; |
10327 | 10335 | ||
10328 | for (i = 0; i < len; i += 4, offset += 4) { | 10336 | for (i = 0; i < len; i += 4, offset += 4) { |
10329 | u32 data, page_off, phy_addr, nvram_cmd; | 10337 | u32 page_off, phy_addr, nvram_cmd; |
10338 | __be32 data; | ||
10330 | 10339 | ||
10331 | memcpy(&data, buf + i, 4); | 10340 | memcpy(&data, buf + i, 4); |
10332 | tw32(NVRAM_WRDATA, cpu_to_be32(data)); | 10341 | tw32(NVRAM_WRDATA, be32_to_cpu(data)); |
10333 | 10342 | ||
10334 | page_off = offset % tp->nvram_pagesize; | 10343 | page_off = offset % tp->nvram_pagesize; |
10335 | 10344 | ||
@@ -10831,6 +10840,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
10831 | vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD); | 10840 | vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD); |
10832 | for (i = 0; i < 256; i += 4) { | 10841 | for (i = 0; i < 256; i += 4) { |
10833 | u32 tmp, j = 0; | 10842 | u32 tmp, j = 0; |
10843 | __le32 v; | ||
10834 | u16 tmp16; | 10844 | u16 tmp16; |
10835 | 10845 | ||
10836 | pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR, | 10846 | pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR, |
@@ -10847,8 +10857,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
10847 | 10857 | ||
10848 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, | 10858 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, |
10849 | &tmp); | 10859 | &tmp); |
10850 | tmp = cpu_to_le32(tmp); | 10860 | v = cpu_to_le32(tmp); |
10851 | memcpy(&vpd_data[i], &tmp, 4); | 10861 | memcpy(&vpd_data[i], &v, 4); |
10852 | } | 10862 | } |
10853 | } | 10863 | } |
10854 | 10864 | ||
@@ -10941,11 +10951,11 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
10941 | 10951 | ||
10942 | offset = offset + ver_offset - start; | 10952 | offset = offset + ver_offset - start; |
10943 | for (i = 0; i < 16; i += 4) { | 10953 | for (i = 0; i < 16; i += 4) { |
10944 | if (tg3_nvram_read(tp, offset + i, &val)) | 10954 | __le32 v; |
10955 | if (tg3_nvram_read_le(tp, offset + i, &v)) | ||
10945 | return; | 10956 | return; |
10946 | 10957 | ||
10947 | val = le32_to_cpu(val); | 10958 | memcpy(tp->fw_ver + i, &v, 4); |
10948 | memcpy(tp->fw_ver + i, &val, 4); | ||
10949 | } | 10959 | } |
10950 | 10960 | ||
10951 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || | 10961 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || |
@@ -10983,19 +10993,19 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
10983 | tp->fw_ver[bcnt++] = ' '; | 10993 | tp->fw_ver[bcnt++] = ' '; |
10984 | 10994 | ||
10985 | for (i = 0; i < 4; i++) { | 10995 | for (i = 0; i < 4; i++) { |
10986 | if (tg3_nvram_read(tp, offset, &val)) | 10996 | __le32 v; |
10997 | if (tg3_nvram_read_le(tp, offset, &v)) | ||
10987 | return; | 10998 | return; |
10988 | 10999 | ||
10989 | val = le32_to_cpu(val); | 11000 | offset += sizeof(v); |
10990 | offset += sizeof(val); | ||
10991 | 11001 | ||
10992 | if (bcnt > TG3_VER_SIZE - sizeof(val)) { | 11002 | if (bcnt > TG3_VER_SIZE - sizeof(v)) { |
10993 | memcpy(&tp->fw_ver[bcnt], &val, TG3_VER_SIZE - bcnt); | 11003 | memcpy(&tp->fw_ver[bcnt], &v, TG3_VER_SIZE - bcnt); |
10994 | break; | 11004 | break; |
10995 | } | 11005 | } |
10996 | 11006 | ||
10997 | memcpy(&tp->fw_ver[bcnt], &val, sizeof(val)); | 11007 | memcpy(&tp->fw_ver[bcnt], &v, sizeof(v)); |
10998 | bcnt += sizeof(val); | 11008 | bcnt += sizeof(v); |
10999 | } | 11009 | } |
11000 | 11010 | ||
11001 | tp->fw_ver[TG3_VER_SIZE - 1] = 0; | 11011 | tp->fw_ver[TG3_VER_SIZE - 1] = 0; |
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 5d31519a6c67..44a06f8b588f 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c | |||
@@ -570,7 +570,7 @@ static int xl_open(struct net_device *dev) | |||
570 | struct xl_private *xl_priv=netdev_priv(dev); | 570 | struct xl_private *xl_priv=netdev_priv(dev); |
571 | u8 __iomem *xl_mmio = xl_priv->xl_mmio ; | 571 | u8 __iomem *xl_mmio = xl_priv->xl_mmio ; |
572 | u8 i ; | 572 | u8 i ; |
573 | u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */ | 573 | __le16 hwaddr[3] ; /* Should be u8[6] but we get word return values */ |
574 | int open_err ; | 574 | int open_err ; |
575 | 575 | ||
576 | u16 switchsettings, switchsettings_eeprom ; | 576 | u16 switchsettings, switchsettings_eeprom ; |
@@ -580,15 +580,12 @@ static int xl_open(struct net_device *dev) | |||
580 | } | 580 | } |
581 | 581 | ||
582 | /* | 582 | /* |
583 | * Read the information from the EEPROM that we need. I know we | 583 | * Read the information from the EEPROM that we need. |
584 | * should use ntohs, but the word gets stored reversed in the 16 | ||
585 | * bit field anyway and it all works its self out when we memcpy | ||
586 | * it into dev->dev_addr. | ||
587 | */ | 584 | */ |
588 | 585 | ||
589 | hwaddr[0] = xl_ee_read(dev,0x10) ; | 586 | hwaddr[0] = cpu_to_le16(xl_ee_read(dev,0x10)); |
590 | hwaddr[1] = xl_ee_read(dev,0x11) ; | 587 | hwaddr[1] = cpu_to_le16(xl_ee_read(dev,0x11)); |
591 | hwaddr[2] = xl_ee_read(dev,0x12) ; | 588 | hwaddr[2] = cpu_to_le16(xl_ee_read(dev,0x12)); |
592 | 589 | ||
593 | /* Ring speed */ | 590 | /* Ring speed */ |
594 | 591 | ||
@@ -665,8 +662,8 @@ static int xl_open(struct net_device *dev) | |||
665 | break ; | 662 | break ; |
666 | 663 | ||
667 | skb->dev = dev ; | 664 | skb->dev = dev ; |
668 | xl_priv->xl_rx_ring[i].upfragaddr = pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; | 665 | xl_priv->xl_rx_ring[i].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE)); |
669 | xl_priv->xl_rx_ring[i].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG; | 666 | xl_priv->xl_rx_ring[i].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG; |
670 | xl_priv->rx_ring_skb[i] = skb ; | 667 | xl_priv->rx_ring_skb[i] = skb ; |
671 | } | 668 | } |
672 | 669 | ||
@@ -680,7 +677,7 @@ static int xl_open(struct net_device *dev) | |||
680 | xl_priv->rx_ring_tail = 0 ; | 677 | xl_priv->rx_ring_tail = 0 ; |
681 | xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; | 678 | xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; |
682 | for (i=0;i<(xl_priv->rx_ring_no-1);i++) { | 679 | for (i=0;i<(xl_priv->rx_ring_no-1);i++) { |
683 | xl_priv->xl_rx_ring[i].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)) ; | 680 | xl_priv->xl_rx_ring[i].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1))); |
684 | } | 681 | } |
685 | xl_priv->xl_rx_ring[i].upnextptr = 0 ; | 682 | xl_priv->xl_rx_ring[i].upnextptr = 0 ; |
686 | 683 | ||
@@ -698,7 +695,7 @@ static int xl_open(struct net_device *dev) | |||
698 | * Setup the first dummy DPD entry for polling to start working. | 695 | * Setup the first dummy DPD entry for polling to start working. |
699 | */ | 696 | */ |
700 | 697 | ||
701 | xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY ; | 698 | xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY; |
702 | xl_priv->xl_tx_ring[0].buffer = 0 ; | 699 | xl_priv->xl_tx_ring[0].buffer = 0 ; |
703 | xl_priv->xl_tx_ring[0].buffer_length = 0 ; | 700 | xl_priv->xl_tx_ring[0].buffer_length = 0 ; |
704 | xl_priv->xl_tx_ring[0].dnnextptr = 0 ; | 701 | xl_priv->xl_tx_ring[0].dnnextptr = 0 ; |
@@ -811,17 +808,17 @@ static int xl_open_hw(struct net_device *dev) | |||
811 | return open_err ; | 808 | return open_err ; |
812 | } else { | 809 | } else { |
813 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 810 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
814 | xl_priv->asb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 811 | xl_priv->asb = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
815 | printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; | 812 | printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; |
816 | printk("ASB: %04x",xl_priv->asb ) ; | 813 | printk("ASB: %04x",xl_priv->asb ) ; |
817 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 814 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
818 | printk(", SRB: %04x",ntohs(readw(xl_mmio + MMIO_MACDATA)) ) ; | 815 | printk(", SRB: %04x",swab16(readw(xl_mmio + MMIO_MACDATA)) ) ; |
819 | 816 | ||
820 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 817 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
821 | xl_priv->arb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 818 | xl_priv->arb = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
822 | printk(", ARB: %04x \n",xl_priv->arb ) ; | 819 | printk(", ARB: %04x \n",xl_priv->arb ) ; |
823 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 820 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
824 | vsoff = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 821 | vsoff = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
825 | 822 | ||
826 | /* | 823 | /* |
827 | * Interesting, sending the individual characters directly to printk was causing klogd to use | 824 | * Interesting, sending the individual characters directly to printk was causing klogd to use |
@@ -873,16 +870,15 @@ static int xl_open_hw(struct net_device *dev) | |||
873 | static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ | 870 | static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ |
874 | { | 871 | { |
875 | struct xl_private *xl_priv=netdev_priv(dev); | 872 | struct xl_private *xl_priv=netdev_priv(dev); |
876 | int prev_ring_loc ; | 873 | int n = xl_priv->rx_ring_tail; |
877 | 874 | int prev_ring_loc; | |
878 | prev_ring_loc = (xl_priv->rx_ring_tail + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1); | 875 | |
879 | xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * xl_priv->rx_ring_tail) ; | 876 | prev_ring_loc = (n + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1); |
880 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus = 0 ; | 877 | xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * n)); |
881 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upnextptr = 0 ; | 878 | xl_priv->xl_rx_ring[n].framestatus = 0; |
882 | xl_priv->rx_ring_tail++ ; | 879 | xl_priv->xl_rx_ring[n].upnextptr = 0; |
883 | xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1) ; | 880 | xl_priv->rx_ring_tail++; |
884 | 881 | xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1); | |
885 | return ; | ||
886 | } | 882 | } |
887 | 883 | ||
888 | static void xl_rx(struct net_device *dev) | 884 | static void xl_rx(struct net_device *dev) |
@@ -914,7 +910,7 @@ static void xl_rx(struct net_device *dev) | |||
914 | temp_ring_loc &= (XL_RX_RING_SIZE-1) ; | 910 | temp_ring_loc &= (XL_RX_RING_SIZE-1) ; |
915 | } | 911 | } |
916 | 912 | ||
917 | frame_length = xl_priv->xl_rx_ring[temp_ring_loc].framestatus & 0x7FFF ; | 913 | frame_length = le32_to_cpu(xl_priv->xl_rx_ring[temp_ring_loc].framestatus) & 0x7FFF; |
918 | 914 | ||
919 | skb = dev_alloc_skb(frame_length) ; | 915 | skb = dev_alloc_skb(frame_length) ; |
920 | 916 | ||
@@ -931,29 +927,29 @@ static void xl_rx(struct net_device *dev) | |||
931 | } | 927 | } |
932 | 928 | ||
933 | while (xl_priv->rx_ring_tail != temp_ring_loc) { | 929 | while (xl_priv->rx_ring_tail != temp_ring_loc) { |
934 | copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; | 930 | copy_len = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen) & 0x7FFF; |
935 | frame_length -= copy_len ; | 931 | frame_length -= copy_len ; |
936 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 932 | pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
937 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], | 933 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], |
938 | skb_put(skb, copy_len), | 934 | skb_put(skb, copy_len), |
939 | copy_len); | 935 | copy_len); |
940 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 936 | pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
941 | adv_rx_ring(dev) ; | 937 | adv_rx_ring(dev) ; |
942 | } | 938 | } |
943 | 939 | ||
944 | /* Now we have found the last fragment */ | 940 | /* Now we have found the last fragment */ |
945 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 941 | pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
946 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], | 942 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], |
947 | skb_put(skb,copy_len), frame_length); | 943 | skb_put(skb,copy_len), frame_length); |
948 | /* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ | 944 | /* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ |
949 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 945 | pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
950 | adv_rx_ring(dev) ; | 946 | adv_rx_ring(dev) ; |
951 | skb->protocol = tr_type_trans(skb,dev) ; | 947 | skb->protocol = tr_type_trans(skb,dev) ; |
952 | netif_rx(skb) ; | 948 | netif_rx(skb) ; |
953 | 949 | ||
954 | } else { /* Single Descriptor Used, simply swap buffers over, fast path */ | 950 | } else { /* Single Descriptor Used, simply swap buffers over, fast path */ |
955 | 951 | ||
956 | frame_length = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus & 0x7FFF ; | 952 | frame_length = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus) & 0x7FFF; |
957 | 953 | ||
958 | skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; | 954 | skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; |
959 | 955 | ||
@@ -966,13 +962,13 @@ static void xl_rx(struct net_device *dev) | |||
966 | } | 962 | } |
967 | 963 | ||
968 | skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; | 964 | skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; |
969 | pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 965 | pci_unmap_single(xl_priv->pdev, le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
970 | skb_put(skb2, frame_length) ; | 966 | skb_put(skb2, frame_length) ; |
971 | skb2->protocol = tr_type_trans(skb2,dev) ; | 967 | skb2->protocol = tr_type_trans(skb2,dev) ; |
972 | 968 | ||
973 | xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ; | 969 | xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ; |
974 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; | 970 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE)); |
975 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG ; | 971 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG; |
976 | adv_rx_ring(dev) ; | 972 | adv_rx_ring(dev) ; |
977 | xl_priv->xl_stats.rx_packets++ ; | 973 | xl_priv->xl_stats.rx_packets++ ; |
978 | xl_priv->xl_stats.rx_bytes += frame_length ; | 974 | xl_priv->xl_stats.rx_bytes += frame_length ; |
@@ -1022,7 +1018,7 @@ static void xl_freemem(struct net_device *dev) | |||
1022 | 1018 | ||
1023 | for (i=0;i<XL_RX_RING_SIZE;i++) { | 1019 | for (i=0;i<XL_RX_RING_SIZE;i++) { |
1024 | dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; | 1020 | dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; |
1025 | pci_unmap_single(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; | 1021 | pci_unmap_single(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE); |
1026 | xl_priv->rx_ring_tail++ ; | 1022 | xl_priv->rx_ring_tail++ ; |
1027 | xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; | 1023 | xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; |
1028 | } | 1024 | } |
@@ -1181,9 +1177,9 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1181 | 1177 | ||
1182 | txd = &(xl_priv->xl_tx_ring[tx_head]) ; | 1178 | txd = &(xl_priv->xl_tx_ring[tx_head]) ; |
1183 | txd->dnnextptr = 0 ; | 1179 | txd->dnnextptr = 0 ; |
1184 | txd->framestartheader = skb->len | TXDNINDICATE ; | 1180 | txd->framestartheader = cpu_to_le32(skb->len) | TXDNINDICATE; |
1185 | txd->buffer = pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE) ; | 1181 | txd->buffer = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE)); |
1186 | txd->buffer_length = skb->len | TXDNFRAGLAST ; | 1182 | txd->buffer_length = cpu_to_le32(skb->len) | TXDNFRAGLAST; |
1187 | xl_priv->tx_ring_skb[tx_head] = skb ; | 1183 | xl_priv->tx_ring_skb[tx_head] = skb ; |
1188 | xl_priv->xl_stats.tx_packets++ ; | 1184 | xl_priv->xl_stats.tx_packets++ ; |
1189 | xl_priv->xl_stats.tx_bytes += skb->len ; | 1185 | xl_priv->xl_stats.tx_bytes += skb->len ; |
@@ -1199,7 +1195,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1199 | xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ; | 1195 | xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ; |
1200 | xl_priv->free_ring_entries-- ; | 1196 | xl_priv->free_ring_entries-- ; |
1201 | 1197 | ||
1202 | xl_priv->xl_tx_ring[tx_prev].dnnextptr = xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head) ; | 1198 | xl_priv->xl_tx_ring[tx_prev].dnnextptr = cpu_to_le32(xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head)); |
1203 | 1199 | ||
1204 | /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */ | 1200 | /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */ |
1205 | /* readl(xl_mmio + MMIO_DNLISTPTR) ; */ | 1201 | /* readl(xl_mmio + MMIO_DNLISTPTR) ; */ |
@@ -1237,9 +1233,9 @@ static void xl_dn_comp(struct net_device *dev) | |||
1237 | 1233 | ||
1238 | while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { | 1234 | while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { |
1239 | txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ; | 1235 | txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ; |
1240 | pci_unmap_single(xl_priv->pdev,txd->buffer, xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE) ; | 1236 | pci_unmap_single(xl_priv->pdev, le32_to_cpu(txd->buffer), xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE); |
1241 | txd->framestartheader = 0 ; | 1237 | txd->framestartheader = 0 ; |
1242 | txd->buffer = 0xdeadbeef ; | 1238 | txd->buffer = cpu_to_le32(0xdeadbeef); |
1243 | txd->buffer_length = 0 ; | 1239 | txd->buffer_length = 0 ; |
1244 | dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ; | 1240 | dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ; |
1245 | xl_priv->tx_ring_tail++ ; | 1241 | xl_priv->tx_ring_tail++ ; |
@@ -1507,9 +1503,9 @@ static void xl_arb_cmd(struct net_device *dev) | |||
1507 | if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */ | 1503 | if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */ |
1508 | writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 1504 | writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
1509 | 1505 | ||
1510 | printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, ntohs(readw(xl_mmio + MMIO_MACDATA) )) ; | 1506 | printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, swab16(readw(xl_mmio + MMIO_MACDATA) )) ; |
1511 | 1507 | ||
1512 | lan_status = ntohs(readw(xl_mmio + MMIO_MACDATA)); | 1508 | lan_status = swab16(readw(xl_mmio + MMIO_MACDATA)); |
1513 | 1509 | ||
1514 | /* Acknowledge interrupt, this tells nic we are done with the arb */ | 1510 | /* Acknowledge interrupt, this tells nic we are done with the arb */ |
1515 | writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; | 1511 | writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; |
@@ -1573,7 +1569,7 @@ static void xl_arb_cmd(struct net_device *dev) | |||
1573 | printk(KERN_INFO "Received.Data \n") ; | 1569 | printk(KERN_INFO "Received.Data \n") ; |
1574 | #endif | 1570 | #endif |
1575 | writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 1571 | writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
1576 | xl_priv->mac_buffer = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 1572 | xl_priv->mac_buffer = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
1577 | 1573 | ||
1578 | /* Now we are going to be really basic here and not do anything | 1574 | /* Now we are going to be really basic here and not do anything |
1579 | * with the data at all. The tech docs do not give me enough | 1575 | * with the data at all. The tech docs do not give me enough |
@@ -1634,7 +1630,7 @@ static void xl_asb_cmd(struct net_device *dev) | |||
1634 | writeb(0x81, xl_mmio + MMIO_MACDATA) ; | 1630 | writeb(0x81, xl_mmio + MMIO_MACDATA) ; |
1635 | 1631 | ||
1636 | writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 1632 | writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
1637 | writew(ntohs(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; | 1633 | writew(swab16(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; |
1638 | 1634 | ||
1639 | xl_wait_misr_flags(dev) ; | 1635 | xl_wait_misr_flags(dev) ; |
1640 | 1636 | ||
diff --git a/drivers/net/tokenring/3c359.h b/drivers/net/tokenring/3c359.h index 05c860368852..b880cba0f6fd 100644 --- a/drivers/net/tokenring/3c359.h +++ b/drivers/net/tokenring/3c359.h | |||
@@ -156,19 +156,19 @@ | |||
156 | #define HOSTERRINT (1<<1) | 156 | #define HOSTERRINT (1<<1) |
157 | 157 | ||
158 | /* Receive descriptor bits */ | 158 | /* Receive descriptor bits */ |
159 | #define RXOVERRUN (1<<19) | 159 | #define RXOVERRUN cpu_to_le32(1<<19) |
160 | #define RXFC (1<<21) | 160 | #define RXFC cpu_to_le32(1<<21) |
161 | #define RXAR (1<<22) | 161 | #define RXAR cpu_to_le32(1<<22) |
162 | #define RXUPDCOMPLETE (1<<23) | 162 | #define RXUPDCOMPLETE cpu_to_le32(1<<23) |
163 | #define RXUPDFULL (1<<24) | 163 | #define RXUPDFULL cpu_to_le32(1<<24) |
164 | #define RXUPLASTFRAG (1<<31) | 164 | #define RXUPLASTFRAG cpu_to_le32(1<<31) |
165 | 165 | ||
166 | /* Transmit descriptor bits */ | 166 | /* Transmit descriptor bits */ |
167 | #define TXDNCOMPLETE (1<<16) | 167 | #define TXDNCOMPLETE cpu_to_le32(1<<16) |
168 | #define TXTXINDICATE (1<<27) | 168 | #define TXTXINDICATE cpu_to_le32(1<<27) |
169 | #define TXDPDEMPTY (1<<29) | 169 | #define TXDPDEMPTY cpu_to_le32(1<<29) |
170 | #define TXDNINDICATE (1<<31) | 170 | #define TXDNINDICATE cpu_to_le32(1<<31) |
171 | #define TXDNFRAGLAST (1<<31) | 171 | #define TXDNFRAGLAST cpu_to_le32(1<<31) |
172 | 172 | ||
173 | /* Interrupts to Acknowledge */ | 173 | /* Interrupts to Acknowledge */ |
174 | #define LATCH_ACK 1 | 174 | #define LATCH_ACK 1 |
@@ -232,17 +232,17 @@ | |||
232 | /* 3c359 data structures */ | 232 | /* 3c359 data structures */ |
233 | 233 | ||
234 | struct xl_tx_desc { | 234 | struct xl_tx_desc { |
235 | u32 dnnextptr ; | 235 | __le32 dnnextptr; |
236 | u32 framestartheader ; | 236 | __le32 framestartheader; |
237 | u32 buffer ; | 237 | __le32 buffer; |
238 | u32 buffer_length ; | 238 | __le32 buffer_length; |
239 | }; | 239 | }; |
240 | 240 | ||
241 | struct xl_rx_desc { | 241 | struct xl_rx_desc { |
242 | u32 upnextptr ; | 242 | __le32 upnextptr; |
243 | u32 framestatus ; | 243 | __le32 framestatus; |
244 | u32 upfragaddr ; | 244 | __le32 upfragaddr; |
245 | u32 upfraglen ; | 245 | __le32 upfraglen; |
246 | }; | 246 | }; |
247 | 247 | ||
248 | struct xl_private { | 248 | struct xl_private { |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 41f34bb91cad..6e8b18a3b3cc 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -911,7 +911,7 @@ static int de4x5_init(struct net_device *dev); | |||
911 | static int de4x5_sw_reset(struct net_device *dev); | 911 | static int de4x5_sw_reset(struct net_device *dev); |
912 | static int de4x5_rx(struct net_device *dev); | 912 | static int de4x5_rx(struct net_device *dev); |
913 | static int de4x5_tx(struct net_device *dev); | 913 | static int de4x5_tx(struct net_device *dev); |
914 | static int de4x5_ast(struct net_device *dev); | 914 | static void de4x5_ast(struct net_device *dev); |
915 | static int de4x5_txur(struct net_device *dev); | 915 | static int de4x5_txur(struct net_device *dev); |
916 | static int de4x5_rx_ovfc(struct net_device *dev); | 916 | static int de4x5_rx_ovfc(struct net_device *dev); |
917 | 917 | ||
@@ -984,11 +984,9 @@ static int test_bad_enet(struct net_device *dev, int status); | |||
984 | static int an_exception(struct de4x5_private *lp); | 984 | static int an_exception(struct de4x5_private *lp); |
985 | static char *build_setup_frame(struct net_device *dev, int mode); | 985 | static char *build_setup_frame(struct net_device *dev, int mode); |
986 | static void disable_ast(struct net_device *dev); | 986 | static void disable_ast(struct net_device *dev); |
987 | static void enable_ast(struct net_device *dev, u32 time_out); | ||
988 | static long de4x5_switch_mac_port(struct net_device *dev); | 987 | static long de4x5_switch_mac_port(struct net_device *dev); |
989 | static int gep_rd(struct net_device *dev); | 988 | static int gep_rd(struct net_device *dev); |
990 | static void gep_wr(s32 data, struct net_device *dev); | 989 | static void gep_wr(s32 data, struct net_device *dev); |
991 | static void timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec); | ||
992 | static void yawn(struct net_device *dev, int state); | 990 | static void yawn(struct net_device *dev, int state); |
993 | static void de4x5_parse_params(struct net_device *dev); | 991 | static void de4x5_parse_params(struct net_device *dev); |
994 | static void de4x5_dbg_open(struct net_device *dev); | 992 | static void de4x5_dbg_open(struct net_device *dev); |
@@ -1139,6 +1137,8 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | |||
1139 | lp->gendev = gendev; | 1137 | lp->gendev = gendev; |
1140 | spin_lock_init(&lp->lock); | 1138 | spin_lock_init(&lp->lock); |
1141 | init_timer(&lp->timer); | 1139 | init_timer(&lp->timer); |
1140 | lp->timer.function = (void (*)(unsigned long))de4x5_ast; | ||
1141 | lp->timer.data = (unsigned long)dev; | ||
1142 | de4x5_parse_params(dev); | 1142 | de4x5_parse_params(dev); |
1143 | 1143 | ||
1144 | /* | 1144 | /* |
@@ -1311,7 +1311,7 @@ de4x5_open(struct net_device *dev) | |||
1311 | lp->state = OPEN; | 1311 | lp->state = OPEN; |
1312 | de4x5_dbg_open(dev); | 1312 | de4x5_dbg_open(dev); |
1313 | 1313 | ||
1314 | if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED, | 1314 | if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED, |
1315 | lp->adapter_name, dev)) { | 1315 | lp->adapter_name, dev)) { |
1316 | printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); | 1316 | printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); |
1317 | if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, | 1317 | if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, |
@@ -1737,27 +1737,29 @@ de4x5_tx(struct net_device *dev) | |||
1737 | return 0; | 1737 | return 0; |
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | static int | 1740 | static void |
1741 | de4x5_ast(struct net_device *dev) | 1741 | de4x5_ast(struct net_device *dev) |
1742 | { | 1742 | { |
1743 | struct de4x5_private *lp = netdev_priv(dev); | 1743 | struct de4x5_private *lp = netdev_priv(dev); |
1744 | int next_tick = DE4X5_AUTOSENSE_MS; | 1744 | int next_tick = DE4X5_AUTOSENSE_MS; |
1745 | int dt; | ||
1745 | 1746 | ||
1746 | disable_ast(dev); | 1747 | if (lp->useSROM) |
1748 | next_tick = srom_autoconf(dev); | ||
1749 | else if (lp->chipset == DC21140) | ||
1750 | next_tick = dc21140m_autoconf(dev); | ||
1751 | else if (lp->chipset == DC21041) | ||
1752 | next_tick = dc21041_autoconf(dev); | ||
1753 | else if (lp->chipset == DC21040) | ||
1754 | next_tick = dc21040_autoconf(dev); | ||
1755 | lp->linkOK = 0; | ||
1747 | 1756 | ||
1748 | if (lp->useSROM) { | 1757 | dt = (next_tick * HZ) / 1000; |
1749 | next_tick = srom_autoconf(dev); | ||
1750 | } else if (lp->chipset == DC21140) { | ||
1751 | next_tick = dc21140m_autoconf(dev); | ||
1752 | } else if (lp->chipset == DC21041) { | ||
1753 | next_tick = dc21041_autoconf(dev); | ||
1754 | } else if (lp->chipset == DC21040) { | ||
1755 | next_tick = dc21040_autoconf(dev); | ||
1756 | } | ||
1757 | lp->linkOK = 0; | ||
1758 | enable_ast(dev, next_tick); | ||
1759 | 1758 | ||
1760 | return 0; | 1759 | if (!dt) |
1760 | dt = 1; | ||
1761 | |||
1762 | mod_timer(&lp->timer, jiffies + dt); | ||
1761 | } | 1763 | } |
1762 | 1764 | ||
1763 | static int | 1765 | static int |
@@ -2174,7 +2176,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev) | |||
2174 | for (j=0, i=0; i<ETH_ALEN; i++) { | 2176 | for (j=0, i=0; i<ETH_ALEN; i++) { |
2175 | j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i); | 2177 | j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i); |
2176 | } | 2178 | } |
2177 | if ((j != 0) && (j != 0x5fa)) { | 2179 | if (j != 0 && j != 6 * 0xff) { |
2178 | last.chipset = device; | 2180 | last.chipset = device; |
2179 | last.bus = pb; | 2181 | last.bus = pb; |
2180 | last.irq = irq; | 2182 | last.irq = irq; |
@@ -2371,30 +2373,19 @@ static struct pci_driver de4x5_pci_driver = { | |||
2371 | static int | 2373 | static int |
2372 | autoconf_media(struct net_device *dev) | 2374 | autoconf_media(struct net_device *dev) |
2373 | { | 2375 | { |
2374 | struct de4x5_private *lp = netdev_priv(dev); | 2376 | struct de4x5_private *lp = netdev_priv(dev); |
2375 | u_long iobase = dev->base_addr; | 2377 | u_long iobase = dev->base_addr; |
2376 | int next_tick = DE4X5_AUTOSENSE_MS; | ||
2377 | 2378 | ||
2378 | lp->linkOK = 0; | 2379 | disable_ast(dev); |
2379 | lp->c_media = AUTO; /* Bogus last media */ | ||
2380 | disable_ast(dev); | ||
2381 | inl(DE4X5_MFC); /* Zero the lost frames counter */ | ||
2382 | lp->media = INIT; | ||
2383 | lp->tcount = 0; | ||
2384 | 2380 | ||
2385 | if (lp->useSROM) { | 2381 | lp->c_media = AUTO; /* Bogus last media */ |
2386 | next_tick = srom_autoconf(dev); | 2382 | inl(DE4X5_MFC); /* Zero the lost frames counter */ |
2387 | } else if (lp->chipset == DC21040) { | 2383 | lp->media = INIT; |
2388 | next_tick = dc21040_autoconf(dev); | 2384 | lp->tcount = 0; |
2389 | } else if (lp->chipset == DC21041) { | ||
2390 | next_tick = dc21041_autoconf(dev); | ||
2391 | } else if (lp->chipset == DC21140) { | ||
2392 | next_tick = dc21140m_autoconf(dev); | ||
2393 | } | ||
2394 | 2385 | ||
2395 | enable_ast(dev, next_tick); | 2386 | de4x5_ast(dev); |
2396 | 2387 | ||
2397 | return (lp->media); | 2388 | return lp->media; |
2398 | } | 2389 | } |
2399 | 2390 | ||
2400 | /* | 2391 | /* |
@@ -4018,20 +4009,22 @@ DevicePresent(struct net_device *dev, u_long aprom_addr) | |||
4018 | outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */ | 4009 | outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */ |
4019 | } | 4010 | } |
4020 | } else { /* Read new srom */ | 4011 | } else { /* Read new srom */ |
4021 | u_short tmp, *p = (short *)((char *)&lp->srom + SROM_HWADD); | 4012 | u_short tmp; |
4013 | __le16 *p = (__le16 *)((char *)&lp->srom + SROM_HWADD); | ||
4022 | for (i=0; i<(ETH_ALEN>>1); i++) { | 4014 | for (i=0; i<(ETH_ALEN>>1); i++) { |
4023 | tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i); | 4015 | tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i); |
4024 | *p = le16_to_cpu(tmp); | 4016 | j += tmp; /* for check for 0:0:0:0:0:0 or ff:ff:ff:ff:ff:ff */ |
4025 | j += *p++; | 4017 | *p = cpu_to_le16(tmp); |
4026 | } | 4018 | } |
4027 | if ((j == 0) || (j == 0x2fffd)) { | 4019 | if (j == 0 || j == 3 * 0xffff) { |
4028 | return; | 4020 | /* could get 0 only from all-0 and 3 * 0xffff only from all-1 */ |
4021 | return; | ||
4029 | } | 4022 | } |
4030 | 4023 | ||
4031 | p=(short *)&lp->srom; | 4024 | p = (__le16 *)&lp->srom; |
4032 | for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) { | 4025 | for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) { |
4033 | tmp = srom_rd(aprom_addr, i); | 4026 | tmp = srom_rd(aprom_addr, i); |
4034 | *p++ = le16_to_cpu(tmp); | 4027 | *p++ = cpu_to_le16(tmp); |
4035 | } | 4028 | } |
4036 | de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); | 4029 | de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); |
4037 | } | 4030 | } |
@@ -5161,21 +5154,10 @@ build_setup_frame(struct net_device *dev, int mode) | |||
5161 | } | 5154 | } |
5162 | 5155 | ||
5163 | static void | 5156 | static void |
5164 | enable_ast(struct net_device *dev, u32 time_out) | ||
5165 | { | ||
5166 | timeout(dev, (void *)&de4x5_ast, (u_long)dev, time_out); | ||
5167 | |||
5168 | return; | ||
5169 | } | ||
5170 | |||
5171 | static void | ||
5172 | disable_ast(struct net_device *dev) | 5157 | disable_ast(struct net_device *dev) |
5173 | { | 5158 | { |
5174 | struct de4x5_private *lp = netdev_priv(dev); | 5159 | struct de4x5_private *lp = netdev_priv(dev); |
5175 | 5160 | del_timer_sync(&lp->timer); | |
5176 | del_timer(&lp->timer); | ||
5177 | |||
5178 | return; | ||
5179 | } | 5161 | } |
5180 | 5162 | ||
5181 | static long | 5163 | static long |
@@ -5245,29 +5227,6 @@ gep_rd(struct net_device *dev) | |||
5245 | } | 5227 | } |
5246 | 5228 | ||
5247 | static void | 5229 | static void |
5248 | timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec) | ||
5249 | { | ||
5250 | struct de4x5_private *lp = netdev_priv(dev); | ||
5251 | int dt; | ||
5252 | |||
5253 | /* First, cancel any pending timer events */ | ||
5254 | del_timer(&lp->timer); | ||
5255 | |||
5256 | /* Convert msec to ticks */ | ||
5257 | dt = (msec * HZ) / 1000; | ||
5258 | if (dt==0) dt=1; | ||
5259 | |||
5260 | /* Set up timer */ | ||
5261 | init_timer(&lp->timer); | ||
5262 | lp->timer.expires = jiffies + dt; | ||
5263 | lp->timer.function = fn; | ||
5264 | lp->timer.data = data; | ||
5265 | add_timer(&lp->timer); | ||
5266 | |||
5267 | return; | ||
5268 | } | ||
5269 | |||
5270 | static void | ||
5271 | yawn(struct net_device *dev, int state) | 5230 | yawn(struct net_device *dev, int state) |
5272 | { | 5231 | { |
5273 | struct de4x5_private *lp = netdev_priv(dev); | 5232 | struct de4x5_private *lp = netdev_priv(dev); |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index ca90566d5bcd..656200472fa1 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -1909,7 +1909,7 @@ static void dmfe_parse_srom(struct dmfe_board_info * db) | |||
1909 | if ( ( (int) srom[18] & 0xff) == SROM_V41_CODE) { | 1909 | if ( ( (int) srom[18] & 0xff) == SROM_V41_CODE) { |
1910 | /* SROM V4.01 */ | 1910 | /* SROM V4.01 */ |
1911 | /* Get NIC support media mode */ | 1911 | /* Get NIC support media mode */ |
1912 | db->NIC_capability = le16_to_cpup((__le16 *)srom + 34/2); | 1912 | db->NIC_capability = le16_to_cpup((__le16 *) (srom + 34)); |
1913 | db->PHY_reg4 = 0; | 1913 | db->PHY_reg4 = 0; |
1914 | for (tmp_reg = 1; tmp_reg < 0x10; tmp_reg <<= 1) { | 1914 | for (tmp_reg = 1; tmp_reg < 0x10; tmp_reg <<= 1) { |
1915 | switch( db->NIC_capability & tmp_reg ) { | 1915 | switch( db->NIC_capability & tmp_reg ) { |
@@ -1921,8 +1921,8 @@ static void dmfe_parse_srom(struct dmfe_board_info * db) | |||
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | /* Media Mode Force or not check */ | 1923 | /* Media Mode Force or not check */ |
1924 | dmfe_mode = le32_to_cpup((__le32 *)srom + 34/4) & | 1924 | dmfe_mode = (le32_to_cpup((__le32 *) (srom + 34)) & |
1925 | le32_to_cpup((__le32 *)srom + 36/4); | 1925 | le32_to_cpup((__le32 *) (srom + 36))); |
1926 | switch(dmfe_mode) { | 1926 | switch(dmfe_mode) { |
1927 | case 0x4: dmfe_media_mode = DMFE_100MHF; break; /* 100MHF */ | 1927 | case 0x4: dmfe_media_mode = DMFE_100MHF; break; /* 100MHF */ |
1928 | case 0x2: dmfe_media_mode = DMFE_10MFD; break; /* 10MFD */ | 1928 | case 0x2: dmfe_media_mode = DMFE_10MFD; break; /* 10MFD */ |
@@ -2118,8 +2118,8 @@ static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
2118 | pci_enable_wake(pci_dev, PCI_D3cold, 1); | 2118 | pci_enable_wake(pci_dev, PCI_D3cold, 1); |
2119 | 2119 | ||
2120 | /* Power down device*/ | 2120 | /* Power down device*/ |
2121 | pci_set_power_state(pci_dev, pci_choose_state (pci_dev,state)); | ||
2122 | pci_save_state(pci_dev); | 2121 | pci_save_state(pci_dev); |
2122 | pci_set_power_state(pci_dev, pci_choose_state (pci_dev, state)); | ||
2123 | 2123 | ||
2124 | return 0; | 2124 | return 0; |
2125 | } | 2125 | } |
@@ -2129,8 +2129,8 @@ static int dmfe_resume(struct pci_dev *pci_dev) | |||
2129 | struct net_device *dev = pci_get_drvdata(pci_dev); | 2129 | struct net_device *dev = pci_get_drvdata(pci_dev); |
2130 | u32 tmp; | 2130 | u32 tmp; |
2131 | 2131 | ||
2132 | pci_restore_state(pci_dev); | ||
2133 | pci_set_power_state(pci_dev, PCI_D0); | 2132 | pci_set_power_state(pci_dev, PCI_D0); |
2133 | pci_restore_state(pci_dev); | ||
2134 | 2134 | ||
2135 | /* Re-initilize DM910X board */ | 2135 | /* Re-initilize DM910X board */ |
2136 | dmfe_init_dm910x(dev); | 2136 | dmfe_init_dm910x(dev); |
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index 365331446387..6284afd14bbb 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c | |||
@@ -117,9 +117,6 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
117 | int received = 0; | 117 | int received = 0; |
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | if (!netif_running(dev)) | ||
121 | goto done; | ||
122 | |||
123 | #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION | 120 | #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION |
124 | 121 | ||
125 | /* that one buffer is needed for mit activation; or might be a | 122 | /* that one buffer is needed for mit activation; or might be a |
@@ -151,7 +148,8 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
151 | if (tulip_debug > 5) | 148 | if (tulip_debug > 5) |
152 | printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n", | 149 | printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n", |
153 | dev->name, entry, status); | 150 | dev->name, entry, status); |
154 | if (work_done++ >= budget) | 151 | |
152 | if (++work_done >= budget) | ||
155 | goto not_done; | 153 | goto not_done; |
156 | 154 | ||
157 | if ((status & 0x38008300) != 0x0300) { | 155 | if ((status & 0x38008300) != 0x0300) { |
@@ -260,8 +258,6 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
260 | * finally: amount of IO did not increase at all. */ | 258 | * finally: amount of IO did not increase at all. */ |
261 | } while ((ioread32(tp->base_addr + CSR5) & RxIntr)); | 259 | } while ((ioread32(tp->base_addr + CSR5) & RxIntr)); |
262 | 260 | ||
263 | done: | ||
264 | |||
265 | #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION | 261 | #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION |
266 | 262 | ||
267 | /* We use this simplistic scheme for IM. It's proven by | 263 | /* We use this simplistic scheme for IM. It's proven by |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index e5e2c9c4ebfe..ed600bf56e78 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -797,7 +797,8 @@ static int tulip_close (struct net_device *dev) | |||
797 | 797 | ||
798 | tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */ | 798 | tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */ |
799 | tp->rx_ring[i].length = 0; | 799 | tp->rx_ring[i].length = 0; |
800 | tp->rx_ring[i].buffer1 = 0xBADF00D0; /* An invalid address. */ | 800 | /* An invalid address. */ |
801 | tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0); | ||
801 | if (skb) { | 802 | if (skb) { |
802 | pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, | 803 | pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, |
803 | PCI_DMA_FROMDEVICE); | 804 | PCI_DMA_FROMDEVICE); |
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 70befe33e454..8fc7274642eb 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c | |||
@@ -83,8 +83,8 @@ static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144}; | |||
83 | struct xircom_private { | 83 | struct xircom_private { |
84 | /* Send and receive buffers, kernel-addressable and dma addressable forms */ | 84 | /* Send and receive buffers, kernel-addressable and dma addressable forms */ |
85 | 85 | ||
86 | unsigned int *rx_buffer; | 86 | __le32 *rx_buffer; |
87 | unsigned int *tx_buffer; | 87 | __le32 *tx_buffer; |
88 | 88 | ||
89 | dma_addr_t rx_dma_handle; | 89 | dma_addr_t rx_dma_handle; |
90 | dma_addr_t tx_dma_handle; | 90 | dma_addr_t tx_dma_handle; |
@@ -412,19 +412,20 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
412 | /* FIXME: The specification tells us that the length we send HAS to be a multiple of | 412 | /* FIXME: The specification tells us that the length we send HAS to be a multiple of |
413 | 4 bytes. */ | 413 | 4 bytes. */ |
414 | 414 | ||
415 | card->tx_buffer[4*desc+1] = skb->len; | 415 | card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len); |
416 | if (desc == NUMDESCRIPTORS-1) | 416 | if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */ |
417 | card->tx_buffer[4*desc+1] |= (1<<25); /* bit 25: last descriptor of the ring */ | 417 | card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25); |
418 | 418 | ||
419 | card->tx_buffer[4*desc+1] |= 0xF0000000; | 419 | card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000); |
420 | /* 0xF0... means want interrupts*/ | 420 | /* 0xF0... means want interrupts*/ |
421 | card->tx_skb[desc] = skb; | 421 | card->tx_skb[desc] = skb; |
422 | 422 | ||
423 | wmb(); | 423 | wmb(); |
424 | /* This gives the descriptor to the card */ | 424 | /* This gives the descriptor to the card */ |
425 | card->tx_buffer[4*desc] = 0x80000000; | 425 | card->tx_buffer[4*desc] = cpu_to_le32(0x80000000); |
426 | trigger_transmit(card); | 426 | trigger_transmit(card); |
427 | if (((int)card->tx_buffer[nextdescriptor*4])<0) { /* next descriptor is occupied... */ | 427 | if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) { |
428 | /* next descriptor is occupied... */ | ||
428 | netif_stop_queue(dev); | 429 | netif_stop_queue(dev); |
429 | } | 430 | } |
430 | card->transmit_used = nextdescriptor; | 431 | card->transmit_used = nextdescriptor; |
@@ -590,8 +591,7 @@ descriptors and programs the addresses into the card. | |||
590 | */ | 591 | */ |
591 | static void setup_descriptors(struct xircom_private *card) | 592 | static void setup_descriptors(struct xircom_private *card) |
592 | { | 593 | { |
593 | unsigned int val; | 594 | u32 address; |
594 | unsigned int address; | ||
595 | int i; | 595 | int i; |
596 | enter("setup_descriptors"); | 596 | enter("setup_descriptors"); |
597 | 597 | ||
@@ -604,16 +604,16 @@ static void setup_descriptors(struct xircom_private *card) | |||
604 | for (i=0;i<NUMDESCRIPTORS;i++ ) { | 604 | for (i=0;i<NUMDESCRIPTORS;i++ ) { |
605 | 605 | ||
606 | /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */ | 606 | /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */ |
607 | card->rx_buffer[i*4 + 0] = 0x80000000; | 607 | card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000); |
608 | /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ | 608 | /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ |
609 | card->rx_buffer[i*4 + 1] = 1536; | 609 | card->rx_buffer[i*4 + 1] = cpu_to_le32(1536); |
610 | if (i==NUMDESCRIPTORS-1) | 610 | if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */ |
611 | card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ | 611 | card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25); |
612 | 612 | ||
613 | /* Rx Descr2: address of the buffer | 613 | /* Rx Descr2: address of the buffer |
614 | we store the buffer at the 2nd half of the page */ | 614 | we store the buffer at the 2nd half of the page */ |
615 | 615 | ||
616 | address = (unsigned long) card->rx_dma_handle; | 616 | address = card->rx_dma_handle; |
617 | card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); | 617 | card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); |
618 | /* Rx Desc3: address of 2nd buffer -> 0 */ | 618 | /* Rx Desc3: address of 2nd buffer -> 0 */ |
619 | card->rx_buffer[i*4 + 3] = 0; | 619 | card->rx_buffer[i*4 + 3] = 0; |
@@ -621,9 +621,8 @@ static void setup_descriptors(struct xircom_private *card) | |||
621 | 621 | ||
622 | wmb(); | 622 | wmb(); |
623 | /* Write the receive descriptor ring address to the card */ | 623 | /* Write the receive descriptor ring address to the card */ |
624 | address = (unsigned long) card->rx_dma_handle; | 624 | address = card->rx_dma_handle; |
625 | val = cpu_to_le32(address); | 625 | outl(address, card->io_port + CSR3); /* Receive descr list address */ |
626 | outl(val, card->io_port + CSR3); /* Receive descr list address */ | ||
627 | 626 | ||
628 | 627 | ||
629 | /* transmit descriptors */ | 628 | /* transmit descriptors */ |
@@ -633,13 +632,13 @@ static void setup_descriptors(struct xircom_private *card) | |||
633 | /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ | 632 | /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ |
634 | card->tx_buffer[i*4 + 0] = 0x00000000; | 633 | card->tx_buffer[i*4 + 0] = 0x00000000; |
635 | /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ | 634 | /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ |
636 | card->tx_buffer[i*4 + 1] = 1536; | 635 | card->tx_buffer[i*4 + 1] = cpu_to_le32(1536); |
637 | if (i==NUMDESCRIPTORS-1) | 636 | if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */ |
638 | card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ | 637 | card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25); |
639 | 638 | ||
640 | /* Tx Descr2: address of the buffer | 639 | /* Tx Descr2: address of the buffer |
641 | we store the buffer at the 2nd half of the page */ | 640 | we store the buffer at the 2nd half of the page */ |
642 | address = (unsigned long) card->tx_dma_handle; | 641 | address = card->tx_dma_handle; |
643 | card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); | 642 | card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); |
644 | /* Tx Desc3: address of 2nd buffer -> 0 */ | 643 | /* Tx Desc3: address of 2nd buffer -> 0 */ |
645 | card->tx_buffer[i*4 + 3] = 0; | 644 | card->tx_buffer[i*4 + 3] = 0; |
@@ -647,9 +646,8 @@ static void setup_descriptors(struct xircom_private *card) | |||
647 | 646 | ||
648 | wmb(); | 647 | wmb(); |
649 | /* wite the transmit descriptor ring to the card */ | 648 | /* wite the transmit descriptor ring to the card */ |
650 | address = (unsigned long) card->tx_dma_handle; | 649 | address = card->tx_dma_handle; |
651 | val =cpu_to_le32(address); | 650 | outl(address, card->io_port + CSR4); /* xmit descr list address */ |
652 | outl(val, card->io_port + CSR4); /* xmit descr list address */ | ||
653 | 651 | ||
654 | leave("setup_descriptors"); | 652 | leave("setup_descriptors"); |
655 | } | 653 | } |
@@ -1180,7 +1178,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri | |||
1180 | int status; | 1178 | int status; |
1181 | 1179 | ||
1182 | enter("investigate_read_descriptor"); | 1180 | enter("investigate_read_descriptor"); |
1183 | status = card->rx_buffer[4*descnr]; | 1181 | status = le32_to_cpu(card->rx_buffer[4*descnr]); |
1184 | 1182 | ||
1185 | if ((status > 0)) { /* packet received */ | 1183 | if ((status > 0)) { /* packet received */ |
1186 | 1184 | ||
@@ -1210,7 +1208,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri | |||
1210 | 1208 | ||
1211 | out: | 1209 | out: |
1212 | /* give the buffer back to the card */ | 1210 | /* give the buffer back to the card */ |
1213 | card->rx_buffer[4*descnr] = 0x80000000; | 1211 | card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000); |
1214 | trigger_receive(card); | 1212 | trigger_receive(card); |
1215 | } | 1213 | } |
1216 | 1214 | ||
@@ -1226,7 +1224,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p | |||
1226 | 1224 | ||
1227 | enter("investigate_write_descriptor"); | 1225 | enter("investigate_write_descriptor"); |
1228 | 1226 | ||
1229 | status = card->tx_buffer[4*descnr]; | 1227 | status = le32_to_cpu(card->tx_buffer[4*descnr]); |
1230 | #if 0 | 1228 | #if 0 |
1231 | if (status & 0x8000) { /* Major error */ | 1229 | if (status & 0x8000) { /* Major error */ |
1232 | printk(KERN_ERR "Major transmit error status %x \n", status); | 1230 | printk(KERN_ERR "Major transmit error status %x \n", status); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 1f7644695976..f8b8c71187a0 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -610,7 +610,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
610 | tun->flags &= ~TUN_PERSIST; | 610 | tun->flags &= ~TUN_PERSIST; |
611 | 611 | ||
612 | DBG(KERN_INFO "%s: persist %s\n", | 612 | DBG(KERN_INFO "%s: persist %s\n", |
613 | tun->dev->name, arg ? "disabled" : "enabled"); | 613 | tun->dev->name, arg ? "enabled" : "disabled"); |
614 | break; | 614 | break; |
615 | 615 | ||
616 | case TUNSETOWNER: | 616 | case TUNSETOWNER: |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 94ac5869bb18..f50cb520dffb 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
813 | first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; | 813 | first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; |
814 | first_txd->numDesc = 0; | 814 | first_txd->numDesc = 0; |
815 | first_txd->len = 0; | 815 | first_txd->len = 0; |
816 | first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff; | 816 | first_txd->tx_addr = (u64)((unsigned long) skb); |
817 | first_txd->addrHi = (u64)((unsigned long) skb) >> 32; | ||
818 | first_txd->processFlags = 0; | 817 | first_txd->processFlags = 0; |
819 | 818 | ||
820 | if(skb->ip_summed == CHECKSUM_PARTIAL) { | 819 | if(skb->ip_summed == CHECKSUM_PARTIAL) { |
@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
850 | PCI_DMA_TODEVICE); | 849 | PCI_DMA_TODEVICE); |
851 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 850 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
852 | txd->len = cpu_to_le16(skb->len); | 851 | txd->len = cpu_to_le16(skb->len); |
853 | txd->addr = cpu_to_le32(skb_dma); | 852 | txd->frag.addr = cpu_to_le32(skb_dma); |
854 | txd->addrHi = 0; | 853 | txd->frag.addrHi = 0; |
855 | first_txd->numDesc++; | 854 | first_txd->numDesc++; |
856 | } else { | 855 | } else { |
857 | int i, len; | 856 | int i, len; |
@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
861 | PCI_DMA_TODEVICE); | 860 | PCI_DMA_TODEVICE); |
862 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 861 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
863 | txd->len = cpu_to_le16(len); | 862 | txd->len = cpu_to_le16(len); |
864 | txd->addr = cpu_to_le32(skb_dma); | 863 | txd->frag.addr = cpu_to_le32(skb_dma); |
865 | txd->addrHi = 0; | 864 | txd->frag.addrHi = 0; |
866 | first_txd->numDesc++; | 865 | first_txd->numDesc++; |
867 | 866 | ||
868 | for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 867 | for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
880 | PCI_DMA_TODEVICE); | 879 | PCI_DMA_TODEVICE); |
881 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 880 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
882 | txd->len = cpu_to_le16(len); | 881 | txd->len = cpu_to_le16(len); |
883 | txd->addr = cpu_to_le32(skb_dma); | 882 | txd->frag.addr = cpu_to_le32(skb_dma); |
884 | txd->addrHi = 0; | 883 | txd->frag.addrHi = 0; |
885 | first_txd->numDesc++; | 884 | first_txd->numDesc++; |
886 | } | 885 | } |
887 | } | 886 | } |
@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp) | |||
977 | * ethtool_ops->get_{strings,stats}() | 976 | * ethtool_ops->get_{strings,stats}() |
978 | */ | 977 | */ |
979 | stats->tx_packets = le32_to_cpu(s->txPackets); | 978 | stats->tx_packets = le32_to_cpu(s->txPackets); |
980 | stats->tx_bytes = le32_to_cpu(s->txBytes); | 979 | stats->tx_bytes = le64_to_cpu(s->txBytes); |
981 | stats->tx_errors = le32_to_cpu(s->txCarrierLost); | 980 | stats->tx_errors = le32_to_cpu(s->txCarrierLost); |
982 | stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost); | 981 | stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost); |
983 | stats->collisions = le32_to_cpu(s->txMultipleCollisions); | 982 | stats->collisions = le32_to_cpu(s->txMultipleCollisions); |
984 | stats->rx_packets = le32_to_cpu(s->rxPacketsGood); | 983 | stats->rx_packets = le32_to_cpu(s->rxPacketsGood); |
985 | stats->rx_bytes = le32_to_cpu(s->rxBytesGood); | 984 | stats->rx_bytes = le64_to_cpu(s->rxBytesGood); |
986 | stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns); | 985 | stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns); |
987 | stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) + | 986 | stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) + |
988 | le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors); | 987 | le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors); |
@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
1056 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { | 1055 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { |
1057 | strcpy(info->fw_version, "Unknown runtime"); | 1056 | strcpy(info->fw_version, "Unknown runtime"); |
1058 | } else { | 1057 | } else { |
1059 | u32 sleep_ver = xp_resp[0].parm2; | 1058 | u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); |
1060 | snprintf(info->fw_version, 32, "%02x.%03x.%03x", | 1059 | snprintf(info->fw_version, 32, "%02x.%03x.%03x", |
1061 | sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, | 1060 | sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, |
1062 | sleep_ver & 0xfff); | 1061 | sleep_ver & 0xfff); |
@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1157 | } | 1156 | } |
1158 | 1157 | ||
1159 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT); | 1158 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT); |
1160 | xp_cmd.parm1 = cpu_to_le16(xcvr); | 1159 | xp_cmd.parm1 = xcvr; |
1161 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); | 1160 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); |
1162 | if(err < 0) | 1161 | if(err < 0) |
1163 | goto out; | 1162 | goto out; |
@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp) | |||
1320 | tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY; | 1319 | tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY; |
1321 | tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY; | 1320 | tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY; |
1322 | 1321 | ||
1323 | tp->txlo_dma_addr = iface->txLoAddr; | 1322 | tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr); |
1324 | tp->card_state = Sleeping; | 1323 | tp->card_state = Sleeping; |
1325 | smp_wmb(); | 1324 | smp_wmb(); |
1326 | 1325 | ||
@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1358 | u8 *image_data; | 1357 | u8 *image_data; |
1359 | void *dpage; | 1358 | void *dpage; |
1360 | dma_addr_t dpage_dma; | 1359 | dma_addr_t dpage_dma; |
1361 | unsigned int csum; | 1360 | __sum16 csum; |
1362 | u32 irqEnabled; | 1361 | u32 irqEnabled; |
1363 | u32 irqMasked; | 1362 | u32 irqMasked; |
1364 | u32 numSections; | 1363 | u32 numSections; |
@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1450 | * summing. Fortunately, due to the properties of | 1449 | * summing. Fortunately, due to the properties of |
1451 | * the checksum, we can do this once, at the end. | 1450 | * the checksum, we can do this once, at the end. |
1452 | */ | 1451 | */ |
1453 | csum = csum_partial_copy_nocheck(image_data, dpage, | 1452 | csum = csum_fold(csum_partial_copy_nocheck(image_data, |
1454 | len, 0); | 1453 | dpage, len, |
1455 | csum = csum_fold(csum); | 1454 | 0)); |
1456 | csum = le16_to_cpu(csum); | ||
1457 | 1455 | ||
1458 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); | 1456 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); |
1459 | iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM); | 1457 | iowrite32(le16_to_cpu((__force __le16)csum), |
1458 | ioaddr + TYPHOON_REG_BOOT_CHECKSUM); | ||
1460 | iowrite32(load_addr, | 1459 | iowrite32(load_addr, |
1461 | ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); | 1460 | ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); |
1462 | iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); | 1461 | iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); |
@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing, | |||
1551 | if(type == TYPHOON_TX_DESC) { | 1550 | if(type == TYPHOON_TX_DESC) { |
1552 | /* This tx_desc describes a packet. | 1551 | /* This tx_desc describes a packet. |
1553 | */ | 1552 | */ |
1554 | unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32); | 1553 | unsigned long ptr = tx->tx_addr; |
1555 | struct sk_buff *skb = (struct sk_buff *) ptr; | 1554 | struct sk_buff *skb = (struct sk_buff *) ptr; |
1556 | dev_kfree_skb_irq(skb); | 1555 | dev_kfree_skb_irq(skb); |
1557 | } else if(type == TYPHOON_FRAG_DESC) { | 1556 | } else if(type == TYPHOON_FRAG_DESC) { |
1558 | /* This tx_desc describes a memory mapping. Free it. | 1557 | /* This tx_desc describes a memory mapping. Free it. |
1559 | */ | 1558 | */ |
1560 | skb_dma = (dma_addr_t) le32_to_cpu(tx->addr); | 1559 | skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr); |
1561 | dma_len = le16_to_cpu(tx->len); | 1560 | dma_len = le16_to_cpu(tx->len); |
1562 | pci_unmap_single(tp->pdev, skb_dma, dma_len, | 1561 | pci_unmap_single(tp->pdev, skb_dma, dma_len, |
1563 | PCI_DMA_TODEVICE); | 1562 | PCI_DMA_TODEVICE); |
@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx) | |||
1596 | struct rx_free *r; | 1595 | struct rx_free *r; |
1597 | 1596 | ||
1598 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == | 1597 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == |
1599 | indexes->rxBuffCleared) { | 1598 | le32_to_cpu(indexes->rxBuffCleared)) { |
1600 | /* no room in ring, just drop the skb | 1599 | /* no room in ring, just drop the skb |
1601 | */ | 1600 | */ |
1602 | dev_kfree_skb_any(rxb->skb); | 1601 | dev_kfree_skb_any(rxb->skb); |
@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx) | |||
1627 | rxb->skb = NULL; | 1626 | rxb->skb = NULL; |
1628 | 1627 | ||
1629 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == | 1628 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == |
1630 | indexes->rxBuffCleared) | 1629 | le32_to_cpu(indexes->rxBuffCleared)) |
1631 | return -ENOMEM; | 1630 | return -ENOMEM; |
1632 | 1631 | ||
1633 | skb = dev_alloc_skb(PKT_BUF_SZ); | 1632 | skb = dev_alloc_skb(PKT_BUF_SZ); |
diff --git a/drivers/net/typhoon.h b/drivers/net/typhoon.h index 19df20889b82..dd7022ca7354 100644 --- a/drivers/net/typhoon.h +++ b/drivers/net/typhoon.h | |||
@@ -73,7 +73,7 @@ struct typhoon_indexes { | |||
73 | volatile __le32 txLoCleared; | 73 | volatile __le32 txLoCleared; |
74 | volatile __le32 txHiCleared; | 74 | volatile __le32 txHiCleared; |
75 | volatile __le32 rxLoReady; | 75 | volatile __le32 rxLoReady; |
76 | volatile __u32 rxBuffCleared; /* AV: really? */ | 76 | volatile __le32 rxBuffCleared; |
77 | volatile __le32 cmdCleared; | 77 | volatile __le32 cmdCleared; |
78 | volatile __le32 respReady; | 78 | volatile __le32 respReady; |
79 | volatile __le32 rxHiReady; | 79 | volatile __le32 rxHiReady; |
@@ -166,8 +166,13 @@ struct tx_desc { | |||
166 | #define TYPHOON_DESC_VALID 0x80 | 166 | #define TYPHOON_DESC_VALID 0x80 |
167 | u8 numDesc; | 167 | u8 numDesc; |
168 | __le16 len; | 168 | __le16 len; |
169 | u32 addr; | 169 | union { |
170 | u32 addrHi; | 170 | struct { |
171 | __le32 addr; | ||
172 | __le32 addrHi; | ||
173 | } frag; | ||
174 | u64 tx_addr; /* opaque for hardware, for TX_DESC */ | ||
175 | }; | ||
171 | __le32 processFlags; | 176 | __le32 processFlags; |
172 | #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) | 177 | #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) |
173 | #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) | 178 | #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) |
@@ -240,8 +245,8 @@ struct rx_desc { | |||
240 | u8 flags; | 245 | u8 flags; |
241 | u8 numDesc; | 246 | u8 numDesc; |
242 | __le16 frameLen; | 247 | __le16 frameLen; |
243 | u32 addr; | 248 | u32 addr; /* opaque, comes from virtAddr */ |
244 | u32 addrHi; | 249 | u32 addrHi; /* opaque, comes from virtAddrHi */ |
245 | __le32 rxStatus; | 250 | __le32 rxStatus; |
246 | #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) | 251 | #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) |
247 | #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) | 252 | #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index a3ff270593f1..abac7db3819e 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -1460,6 +1460,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) | |||
1460 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || | 1460 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || |
1461 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || | 1461 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || |
1462 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || | 1462 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || |
1463 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || | ||
1464 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || | ||
1463 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { | 1465 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { |
1464 | upsmr |= UPSMR_RPM; | 1466 | upsmr |= UPSMR_RPM; |
1465 | switch (ugeth->max_speed) { | 1467 | switch (ugeth->max_speed) { |
@@ -1557,6 +1559,8 @@ static void adjust_link(struct net_device *dev) | |||
1557 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || | 1559 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || |
1558 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || | 1560 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || |
1559 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || | 1561 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || |
1562 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || | ||
1563 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || | ||
1560 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { | 1564 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { |
1561 | if (phydev->speed == SPEED_10) | 1565 | if (phydev->speed == SPEED_10) |
1562 | upsmr |= UPSMR_R10M; | 1566 | upsmr |= UPSMR_R10M; |
@@ -3443,7 +3447,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3443 | u16 length, howmany = 0; | 3447 | u16 length, howmany = 0; |
3444 | u32 bd_status; | 3448 | u32 bd_status; |
3445 | u8 *bdBuffer; | 3449 | u8 *bdBuffer; |
3446 | struct net_device * dev; | 3450 | struct net_device *dev; |
3447 | 3451 | ||
3448 | ugeth_vdbg("%s: IN", __FUNCTION__); | 3452 | ugeth_vdbg("%s: IN", __FUNCTION__); |
3449 | 3453 | ||
@@ -3795,6 +3799,10 @@ static phy_interface_t to_phy_interface(const char *phy_connection_type) | |||
3795 | return PHY_INTERFACE_MODE_RGMII; | 3799 | return PHY_INTERFACE_MODE_RGMII; |
3796 | if (strcasecmp(phy_connection_type, "rgmii-id") == 0) | 3800 | if (strcasecmp(phy_connection_type, "rgmii-id") == 0) |
3797 | return PHY_INTERFACE_MODE_RGMII_ID; | 3801 | return PHY_INTERFACE_MODE_RGMII_ID; |
3802 | if (strcasecmp(phy_connection_type, "rgmii-txid") == 0) | ||
3803 | return PHY_INTERFACE_MODE_RGMII_TXID; | ||
3804 | if (strcasecmp(phy_connection_type, "rgmii-rxid") == 0) | ||
3805 | return PHY_INTERFACE_MODE_RGMII_RXID; | ||
3798 | if (strcasecmp(phy_connection_type, "rtbi") == 0) | 3806 | if (strcasecmp(phy_connection_type, "rtbi") == 0) |
3799 | return PHY_INTERFACE_MODE_RTBI; | 3807 | return PHY_INTERFACE_MODE_RTBI; |
3800 | 3808 | ||
@@ -3889,6 +3897,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3889 | case PHY_INTERFACE_MODE_GMII: | 3897 | case PHY_INTERFACE_MODE_GMII: |
3890 | case PHY_INTERFACE_MODE_RGMII: | 3898 | case PHY_INTERFACE_MODE_RGMII: |
3891 | case PHY_INTERFACE_MODE_RGMII_ID: | 3899 | case PHY_INTERFACE_MODE_RGMII_ID: |
3900 | case PHY_INTERFACE_MODE_RGMII_RXID: | ||
3901 | case PHY_INTERFACE_MODE_RGMII_TXID: | ||
3892 | case PHY_INTERFACE_MODE_TBI: | 3902 | case PHY_INTERFACE_MODE_TBI: |
3893 | case PHY_INTERFACE_MODE_RTBI: | 3903 | case PHY_INTERFACE_MODE_RTBI: |
3894 | max_speed = SPEED_1000; | 3904 | max_speed = SPEED_1000; |
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h index d83437039919..1e45b2028a50 100644 --- a/drivers/net/ucc_geth_mii.h +++ b/drivers/net/ucc_geth_mii.h | |||
@@ -96,5 +96,5 @@ enum enet_tbi_mii_reg { | |||
96 | int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum); | 96 | int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum); |
97 | int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); | 97 | int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); |
98 | int __init uec_mdio_init(void); | 98 | int __init uec_mdio_init(void); |
99 | void __exit uec_mdio_exit(void); | 99 | void uec_mdio_exit(void); |
100 | #endif /* __UEC_MII_H */ | 100 | #endif /* __UEC_MII_H */ |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 61daa096de66..569028b2baf2 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -172,45 +172,76 @@ struct asix_data { | |||
172 | }; | 172 | }; |
173 | 173 | ||
174 | struct ax88172_int_data { | 174 | struct ax88172_int_data { |
175 | u16 res1; | 175 | __le16 res1; |
176 | u8 link; | 176 | u8 link; |
177 | u16 res2; | 177 | __le16 res2; |
178 | u8 status; | 178 | u8 status; |
179 | u16 res3; | 179 | __le16 res3; |
180 | } __attribute__ ((packed)); | 180 | } __attribute__ ((packed)); |
181 | 181 | ||
182 | static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | 182 | static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, |
183 | u16 size, void *data) | 183 | u16 size, void *data) |
184 | { | 184 | { |
185 | void *buf; | ||
186 | int err = -ENOMEM; | ||
187 | |||
185 | devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", | 188 | devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", |
186 | cmd, value, index, size); | 189 | cmd, value, index, size); |
187 | return usb_control_msg( | 190 | |
191 | buf = kmalloc(size, GFP_KERNEL); | ||
192 | if (!buf) | ||
193 | goto out; | ||
194 | |||
195 | err = usb_control_msg( | ||
188 | dev->udev, | 196 | dev->udev, |
189 | usb_rcvctrlpipe(dev->udev, 0), | 197 | usb_rcvctrlpipe(dev->udev, 0), |
190 | cmd, | 198 | cmd, |
191 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 199 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
192 | value, | 200 | value, |
193 | index, | 201 | index, |
194 | data, | 202 | buf, |
195 | size, | 203 | size, |
196 | USB_CTRL_GET_TIMEOUT); | 204 | USB_CTRL_GET_TIMEOUT); |
205 | if (err == size) | ||
206 | memcpy(data, buf, size); | ||
207 | else if (err >= 0) | ||
208 | err = -EINVAL; | ||
209 | kfree(buf); | ||
210 | |||
211 | out: | ||
212 | return err; | ||
197 | } | 213 | } |
198 | 214 | ||
199 | static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | 215 | static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, |
200 | u16 size, void *data) | 216 | u16 size, void *data) |
201 | { | 217 | { |
218 | void *buf = NULL; | ||
219 | int err = -ENOMEM; | ||
220 | |||
202 | devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", | 221 | devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", |
203 | cmd, value, index, size); | 222 | cmd, value, index, size); |
204 | return usb_control_msg( | 223 | |
224 | if (data) { | ||
225 | buf = kmalloc(size, GFP_KERNEL); | ||
226 | if (!buf) | ||
227 | goto out; | ||
228 | memcpy(buf, data, size); | ||
229 | } | ||
230 | |||
231 | err = usb_control_msg( | ||
205 | dev->udev, | 232 | dev->udev, |
206 | usb_sndctrlpipe(dev->udev, 0), | 233 | usb_sndctrlpipe(dev->udev, 0), |
207 | cmd, | 234 | cmd, |
208 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 235 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
209 | value, | 236 | value, |
210 | index, | 237 | index, |
211 | data, | 238 | buf, |
212 | size, | 239 | size, |
213 | USB_CTRL_SET_TIMEOUT); | 240 | USB_CTRL_SET_TIMEOUT); |
241 | kfree(buf); | ||
242 | |||
243 | out: | ||
244 | return err; | ||
214 | } | 245 | } |
215 | 246 | ||
216 | static void asix_async_cmd_callback(struct urb *urb) | 247 | static void asix_async_cmd_callback(struct urb *urb) |
@@ -402,25 +433,19 @@ static inline int asix_set_hw_mii(struct usbnet *dev) | |||
402 | 433 | ||
403 | static inline int asix_get_phy_addr(struct usbnet *dev) | 434 | static inline int asix_get_phy_addr(struct usbnet *dev) |
404 | { | 435 | { |
405 | int ret = 0; | 436 | u8 buf[2]; |
406 | void *buf; | 437 | int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf); |
407 | 438 | ||
408 | devdbg(dev, "asix_get_phy_addr()"); | 439 | devdbg(dev, "asix_get_phy_addr()"); |
409 | 440 | ||
410 | buf = kmalloc(2, GFP_KERNEL); | 441 | if (ret < 0) { |
411 | if (!buf) | ||
412 | goto out1; | ||
413 | |||
414 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, | ||
415 | 0, 0, 2, buf)) < 2) { | ||
416 | deverr(dev, "Error reading PHYID register: %02x", ret); | 442 | deverr(dev, "Error reading PHYID register: %02x", ret); |
417 | goto out2; | 443 | goto out; |
418 | } | 444 | } |
419 | devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((u16 *)buf)); | 445 | devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((__le16 *)buf)); |
420 | ret = *((u8 *)buf + 1); | 446 | ret = buf[1]; |
421 | out2: | 447 | |
422 | kfree(buf); | 448 | out: |
423 | out1: | ||
424 | return ret; | 449 | return ret; |
425 | } | 450 | } |
426 | 451 | ||
@@ -437,22 +462,15 @@ static int asix_sw_reset(struct usbnet *dev, u8 flags) | |||
437 | 462 | ||
438 | static u16 asix_read_rx_ctl(struct usbnet *dev) | 463 | static u16 asix_read_rx_ctl(struct usbnet *dev) |
439 | { | 464 | { |
440 | u16 ret = 0; | 465 | __le16 v; |
441 | void *buf; | 466 | int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v); |
442 | |||
443 | buf = kmalloc(2, GFP_KERNEL); | ||
444 | if (!buf) | ||
445 | goto out1; | ||
446 | 467 | ||
447 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, | 468 | if (ret < 0) { |
448 | 0, 0, 2, buf)) < 2) { | ||
449 | deverr(dev, "Error reading RX_CTL register: %02x", ret); | 469 | deverr(dev, "Error reading RX_CTL register: %02x", ret); |
450 | goto out2; | 470 | goto out; |
451 | } | 471 | } |
452 | ret = le16_to_cpu(*((u16 *)buf)); | 472 | ret = le16_to_cpu(v); |
453 | out2: | 473 | out: |
454 | kfree(buf); | ||
455 | out1: | ||
456 | return ret; | 474 | return ret; |
457 | } | 475 | } |
458 | 476 | ||
@@ -471,22 +489,15 @@ static int asix_write_rx_ctl(struct usbnet *dev, u16 mode) | |||
471 | 489 | ||
472 | static u16 asix_read_medium_status(struct usbnet *dev) | 490 | static u16 asix_read_medium_status(struct usbnet *dev) |
473 | { | 491 | { |
474 | u16 ret = 0; | 492 | __le16 v; |
475 | void *buf; | 493 | int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v); |
476 | 494 | ||
477 | buf = kmalloc(2, GFP_KERNEL); | 495 | if (ret < 0) { |
478 | if (!buf) | ||
479 | goto out1; | ||
480 | |||
481 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, | ||
482 | 0, 0, 2, buf)) < 2) { | ||
483 | deverr(dev, "Error reading Medium Status register: %02x", ret); | 496 | deverr(dev, "Error reading Medium Status register: %02x", ret); |
484 | goto out2; | 497 | goto out; |
485 | } | 498 | } |
486 | ret = le16_to_cpu(*((u16 *)buf)); | 499 | ret = le16_to_cpu(v); |
487 | out2: | 500 | out: |
488 | kfree(buf); | ||
489 | out1: | ||
490 | return ret; | 501 | return ret; |
491 | } | 502 | } |
492 | 503 | ||
@@ -568,31 +579,30 @@ static void asix_set_multicast(struct net_device *net) | |||
568 | static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) | 579 | static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) |
569 | { | 580 | { |
570 | struct usbnet *dev = netdev_priv(netdev); | 581 | struct usbnet *dev = netdev_priv(netdev); |
571 | u16 res; | 582 | __le16 res; |
572 | 583 | ||
573 | mutex_lock(&dev->phy_mutex); | 584 | mutex_lock(&dev->phy_mutex); |
574 | asix_set_sw_mii(dev); | 585 | asix_set_sw_mii(dev); |
575 | asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, | 586 | asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, |
576 | (__u16)loc, 2, (u16 *)&res); | 587 | (__u16)loc, 2, &res); |
577 | asix_set_hw_mii(dev); | 588 | asix_set_hw_mii(dev); |
578 | mutex_unlock(&dev->phy_mutex); | 589 | mutex_unlock(&dev->phy_mutex); |
579 | 590 | ||
580 | devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff)); | 591 | devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res)); |
581 | 592 | ||
582 | return le16_to_cpu(res & 0xffff); | 593 | return le16_to_cpu(res); |
583 | } | 594 | } |
584 | 595 | ||
585 | static void | 596 | static void |
586 | asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) | 597 | asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) |
587 | { | 598 | { |
588 | struct usbnet *dev = netdev_priv(netdev); | 599 | struct usbnet *dev = netdev_priv(netdev); |
589 | u16 res = cpu_to_le16(val); | 600 | __le16 res = cpu_to_le16(val); |
590 | 601 | ||
591 | devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); | 602 | devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); |
592 | mutex_lock(&dev->phy_mutex); | 603 | mutex_lock(&dev->phy_mutex); |
593 | asix_set_sw_mii(dev); | 604 | asix_set_sw_mii(dev); |
594 | asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, | 605 | asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res); |
595 | (__u16)loc, 2, (u16 *)&res); | ||
596 | asix_set_hw_mii(dev); | 606 | asix_set_hw_mii(dev); |
597 | mutex_unlock(&dev->phy_mutex); | 607 | mutex_unlock(&dev->phy_mutex); |
598 | } | 608 | } |
@@ -644,7 +654,6 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | |||
644 | { | 654 | { |
645 | struct usbnet *dev = netdev_priv(net); | 655 | struct usbnet *dev = netdev_priv(net); |
646 | u8 opt = 0; | 656 | u8 opt = 0; |
647 | u8 buf[1]; | ||
648 | 657 | ||
649 | if (wolinfo->wolopts & WAKE_PHY) | 658 | if (wolinfo->wolopts & WAKE_PHY) |
650 | opt |= AX_MONITOR_LINK; | 659 | opt |= AX_MONITOR_LINK; |
@@ -654,7 +663,7 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | |||
654 | opt |= AX_MONITOR_MODE; | 663 | opt |= AX_MONITOR_MODE; |
655 | 664 | ||
656 | if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, | 665 | if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, |
657 | opt, 0, 0, &buf) < 0) | 666 | opt, 0, 0, NULL) < 0) |
658 | return -EINVAL; | 667 | return -EINVAL; |
659 | 668 | ||
660 | return 0; | 669 | return 0; |
@@ -672,7 +681,7 @@ static int asix_get_eeprom(struct net_device *net, | |||
672 | struct ethtool_eeprom *eeprom, u8 *data) | 681 | struct ethtool_eeprom *eeprom, u8 *data) |
673 | { | 682 | { |
674 | struct usbnet *dev = netdev_priv(net); | 683 | struct usbnet *dev = netdev_priv(net); |
675 | u16 *ebuf = (u16 *)data; | 684 | __le16 *ebuf = (__le16 *)data; |
676 | int i; | 685 | int i; |
677 | 686 | ||
678 | /* Crude hack to ensure that we don't overwrite memory | 687 | /* Crude hack to ensure that we don't overwrite memory |
@@ -801,7 +810,7 @@ static int ax88172_link_reset(struct usbnet *dev) | |||
801 | static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) | 810 | static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) |
802 | { | 811 | { |
803 | int ret = 0; | 812 | int ret = 0; |
804 | void *buf; | 813 | u8 buf[ETH_ALEN]; |
805 | int i; | 814 | int i; |
806 | unsigned long gpio_bits = dev->driver_info->data; | 815 | unsigned long gpio_bits = dev->driver_info->data; |
807 | struct asix_data *data = (struct asix_data *)&dev->data; | 816 | struct asix_data *data = (struct asix_data *)&dev->data; |
@@ -810,30 +819,23 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) | |||
810 | 819 | ||
811 | usbnet_get_endpoints(dev,intf); | 820 | usbnet_get_endpoints(dev,intf); |
812 | 821 | ||
813 | buf = kmalloc(ETH_ALEN, GFP_KERNEL); | ||
814 | if(!buf) { | ||
815 | ret = -ENOMEM; | ||
816 | goto out1; | ||
817 | } | ||
818 | |||
819 | /* Toggle the GPIOs in a manufacturer/model specific way */ | 822 | /* Toggle the GPIOs in a manufacturer/model specific way */ |
820 | for (i = 2; i >= 0; i--) { | 823 | for (i = 2; i >= 0; i--) { |
821 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, | 824 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, |
822 | (gpio_bits >> (i * 8)) & 0xff, 0, 0, | 825 | (gpio_bits >> (i * 8)) & 0xff, 0, 0, |
823 | buf)) < 0) | 826 | NULL)) < 0) |
824 | goto out2; | 827 | goto out; |
825 | msleep(5); | 828 | msleep(5); |
826 | } | 829 | } |
827 | 830 | ||
828 | if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0) | 831 | if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0) |
829 | goto out2; | 832 | goto out; |
830 | 833 | ||
831 | /* Get the MAC address */ | 834 | /* Get the MAC address */ |
832 | memset(buf, 0, ETH_ALEN); | ||
833 | if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, | 835 | if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, |
834 | 0, 0, 6, buf)) < 0) { | 836 | 0, 0, ETH_ALEN, buf)) < 0) { |
835 | dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); | 837 | dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); |
836 | goto out2; | 838 | goto out; |
837 | } | 839 | } |
838 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 840 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
839 | 841 | ||
@@ -855,9 +857,8 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) | |||
855 | mii_nway_restart(&dev->mii); | 857 | mii_nway_restart(&dev->mii); |
856 | 858 | ||
857 | return 0; | 859 | return 0; |
858 | out2: | 860 | |
859 | kfree(buf); | 861 | out: |
860 | out1: | ||
861 | return ret; | 862 | return ret; |
862 | } | 863 | } |
863 | 864 | ||
@@ -900,66 +901,58 @@ static int ax88772_link_reset(struct usbnet *dev) | |||
900 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | 901 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) |
901 | { | 902 | { |
902 | int ret, embd_phy; | 903 | int ret, embd_phy; |
903 | void *buf; | ||
904 | u16 rx_ctl; | 904 | u16 rx_ctl; |
905 | struct asix_data *data = (struct asix_data *)&dev->data; | 905 | struct asix_data *data = (struct asix_data *)&dev->data; |
906 | u8 buf[ETH_ALEN]; | ||
906 | u32 phyid; | 907 | u32 phyid; |
907 | 908 | ||
908 | data->eeprom_len = AX88772_EEPROM_LEN; | 909 | data->eeprom_len = AX88772_EEPROM_LEN; |
909 | 910 | ||
910 | usbnet_get_endpoints(dev,intf); | 911 | usbnet_get_endpoints(dev,intf); |
911 | 912 | ||
912 | buf = kmalloc(6, GFP_KERNEL); | ||
913 | if(!buf) { | ||
914 | dbg ("Cannot allocate memory for buffer"); | ||
915 | ret = -ENOMEM; | ||
916 | goto out1; | ||
917 | } | ||
918 | |||
919 | if ((ret = asix_write_gpio(dev, | 913 | if ((ret = asix_write_gpio(dev, |
920 | AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0) | 914 | AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0) |
921 | goto out2; | 915 | goto out; |
922 | 916 | ||
923 | /* 0x10 is the phy id of the embedded 10/100 ethernet phy */ | 917 | /* 0x10 is the phy id of the embedded 10/100 ethernet phy */ |
924 | embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0); | 918 | embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0); |
925 | if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, | 919 | if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, |
926 | embd_phy, 0, 0, buf)) < 0) { | 920 | embd_phy, 0, 0, NULL)) < 0) { |
927 | dbg("Select PHY #1 failed: %d", ret); | 921 | dbg("Select PHY #1 failed: %d", ret); |
928 | goto out2; | 922 | goto out; |
929 | } | 923 | } |
930 | 924 | ||
931 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0) | 925 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0) |
932 | goto out2; | 926 | goto out; |
933 | 927 | ||
934 | msleep(150); | 928 | msleep(150); |
935 | if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) | 929 | if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) |
936 | goto out2; | 930 | goto out; |
937 | 931 | ||
938 | msleep(150); | 932 | msleep(150); |
939 | if (embd_phy) { | 933 | if (embd_phy) { |
940 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0) | 934 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0) |
941 | goto out2; | 935 | goto out; |
942 | } | 936 | } |
943 | else { | 937 | else { |
944 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0) | 938 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0) |
945 | goto out2; | 939 | goto out; |
946 | } | 940 | } |
947 | 941 | ||
948 | msleep(150); | 942 | msleep(150); |
949 | rx_ctl = asix_read_rx_ctl(dev); | 943 | rx_ctl = asix_read_rx_ctl(dev); |
950 | dbg("RX_CTL is 0x%04x after software reset", rx_ctl); | 944 | dbg("RX_CTL is 0x%04x after software reset", rx_ctl); |
951 | if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0) | 945 | if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0) |
952 | goto out2; | 946 | goto out; |
953 | 947 | ||
954 | rx_ctl = asix_read_rx_ctl(dev); | 948 | rx_ctl = asix_read_rx_ctl(dev); |
955 | dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); | 949 | dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); |
956 | 950 | ||
957 | /* Get the MAC address */ | 951 | /* Get the MAC address */ |
958 | memset(buf, 0, ETH_ALEN); | ||
959 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, | 952 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, |
960 | 0, 0, ETH_ALEN, buf)) < 0) { | 953 | 0, 0, ETH_ALEN, buf)) < 0) { |
961 | dbg("Failed to read MAC address: %d", ret); | 954 | dbg("Failed to read MAC address: %d", ret); |
962 | goto out2; | 955 | goto out; |
963 | } | 956 | } |
964 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 957 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
965 | 958 | ||
@@ -976,12 +969,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
976 | dbg("PHYID=0x%08x", phyid); | 969 | dbg("PHYID=0x%08x", phyid); |
977 | 970 | ||
978 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) | 971 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) |
979 | goto out2; | 972 | goto out; |
980 | 973 | ||
981 | msleep(150); | 974 | msleep(150); |
982 | 975 | ||
983 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) | 976 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) |
984 | goto out2; | 977 | goto out; |
985 | 978 | ||
986 | msleep(150); | 979 | msleep(150); |
987 | 980 | ||
@@ -994,18 +987,18 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
994 | mii_nway_restart(&dev->mii); | 987 | mii_nway_restart(&dev->mii); |
995 | 988 | ||
996 | if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0) | 989 | if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0) |
997 | goto out2; | 990 | goto out; |
998 | 991 | ||
999 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, | 992 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, |
1000 | AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, | 993 | AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, |
1001 | AX88772_IPG2_DEFAULT, 0, buf)) < 0) { | 994 | AX88772_IPG2_DEFAULT, 0, NULL)) < 0) { |
1002 | dbg("Write IPG,IPG1,IPG2 failed: %d", ret); | 995 | dbg("Write IPG,IPG1,IPG2 failed: %d", ret); |
1003 | goto out2; | 996 | goto out; |
1004 | } | 997 | } |
1005 | 998 | ||
1006 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ | 999 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ |
1007 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) | 1000 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) |
1008 | goto out2; | 1001 | goto out; |
1009 | 1002 | ||
1010 | rx_ctl = asix_read_rx_ctl(dev); | 1003 | rx_ctl = asix_read_rx_ctl(dev); |
1011 | dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); | 1004 | dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); |
@@ -1013,20 +1006,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1013 | rx_ctl = asix_read_medium_status(dev); | 1006 | rx_ctl = asix_read_medium_status(dev); |
1014 | dbg("Medium Status is 0x%04x after all initializations", rx_ctl); | 1007 | dbg("Medium Status is 0x%04x after all initializations", rx_ctl); |
1015 | 1008 | ||
1016 | kfree(buf); | ||
1017 | |||
1018 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ | 1009 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ |
1019 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1010 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
1020 | /* hard_mtu is still the default - the device does not support | 1011 | /* hard_mtu is still the default - the device does not support |
1021 | jumbo eth frames */ | 1012 | jumbo eth frames */ |
1022 | dev->rx_urb_size = 2048; | 1013 | dev->rx_urb_size = 2048; |
1023 | } | 1014 | } |
1024 | |||
1025 | return 0; | 1015 | return 0; |
1026 | 1016 | ||
1027 | out2: | 1017 | out: |
1028 | kfree(buf); | ||
1029 | out1: | ||
1030 | return ret; | 1018 | return ret; |
1031 | } | 1019 | } |
1032 | 1020 | ||
@@ -1195,23 +1183,16 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1195 | { | 1183 | { |
1196 | struct asix_data *data = (struct asix_data *)&dev->data; | 1184 | struct asix_data *data = (struct asix_data *)&dev->data; |
1197 | int ret; | 1185 | int ret; |
1198 | void *buf; | 1186 | u8 buf[ETH_ALEN]; |
1199 | u16 eeprom; | 1187 | __le16 eeprom; |
1188 | u8 status; | ||
1200 | int gpio0 = 0; | 1189 | int gpio0 = 0; |
1201 | u32 phyid; | 1190 | u32 phyid; |
1202 | 1191 | ||
1203 | usbnet_get_endpoints(dev,intf); | 1192 | usbnet_get_endpoints(dev,intf); |
1204 | 1193 | ||
1205 | buf = kmalloc(6, GFP_KERNEL); | 1194 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); |
1206 | if(!buf) { | 1195 | dbg("GPIO Status: 0x%04x", status); |
1207 | dbg ("Cannot allocate memory for buffer"); | ||
1208 | ret = -ENOMEM; | ||
1209 | goto out1; | ||
1210 | } | ||
1211 | |||
1212 | eeprom = 0; | ||
1213 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &eeprom); | ||
1214 | dbg("GPIO Status: 0x%04x", eeprom); | ||
1215 | 1196 | ||
1216 | asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); | 1197 | asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); |
1217 | asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); | 1198 | asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); |
@@ -1219,19 +1200,19 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1219 | 1200 | ||
1220 | dbg("EEPROM index 0x17 is 0x%04x", eeprom); | 1201 | dbg("EEPROM index 0x17 is 0x%04x", eeprom); |
1221 | 1202 | ||
1222 | if (eeprom == 0xffff) { | 1203 | if (eeprom == cpu_to_le16(0xffff)) { |
1223 | data->phymode = PHY_MODE_MARVELL; | 1204 | data->phymode = PHY_MODE_MARVELL; |
1224 | data->ledmode = 0; | 1205 | data->ledmode = 0; |
1225 | gpio0 = 1; | 1206 | gpio0 = 1; |
1226 | } else { | 1207 | } else { |
1227 | data->phymode = eeprom & 7; | 1208 | data->phymode = le16_to_cpu(eeprom) & 7; |
1228 | data->ledmode = eeprom >> 8; | 1209 | data->ledmode = le16_to_cpu(eeprom) >> 8; |
1229 | gpio0 = (eeprom & 0x80) ? 0 : 1; | 1210 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; |
1230 | } | 1211 | } |
1231 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); | 1212 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); |
1232 | 1213 | ||
1233 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); | 1214 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); |
1234 | if ((eeprom >> 8) != 1) { | 1215 | if ((le16_to_cpu(eeprom) >> 8) != 1) { |
1235 | asix_write_gpio(dev, 0x003c, 30); | 1216 | asix_write_gpio(dev, 0x003c, 30); |
1236 | asix_write_gpio(dev, 0x001c, 300); | 1217 | asix_write_gpio(dev, 0x001c, 300); |
1237 | asix_write_gpio(dev, 0x003c, 30); | 1218 | asix_write_gpio(dev, 0x003c, 30); |
@@ -1250,11 +1231,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1250 | asix_write_rx_ctl(dev, 0); | 1231 | asix_write_rx_ctl(dev, 0); |
1251 | 1232 | ||
1252 | /* Get the MAC address */ | 1233 | /* Get the MAC address */ |
1253 | memset(buf, 0, ETH_ALEN); | ||
1254 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, | 1234 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, |
1255 | 0, 0, ETH_ALEN, buf)) < 0) { | 1235 | 0, 0, ETH_ALEN, buf)) < 0) { |
1256 | dbg("Failed to read MAC address: %d", ret); | 1236 | dbg("Failed to read MAC address: %d", ret); |
1257 | goto out2; | 1237 | goto out; |
1258 | } | 1238 | } |
1259 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 1239 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
1260 | 1240 | ||
@@ -1289,12 +1269,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1289 | mii_nway_restart(&dev->mii); | 1269 | mii_nway_restart(&dev->mii); |
1290 | 1270 | ||
1291 | if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0) | 1271 | if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0) |
1292 | goto out2; | 1272 | goto out; |
1293 | 1273 | ||
1294 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) | 1274 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) |
1295 | goto out2; | 1275 | goto out; |
1296 | |||
1297 | kfree(buf); | ||
1298 | 1276 | ||
1299 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ | 1277 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ |
1300 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1278 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
@@ -1302,12 +1280,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1302 | jumbo eth frames */ | 1280 | jumbo eth frames */ |
1303 | dev->rx_urb_size = 2048; | 1281 | dev->rx_urb_size = 2048; |
1304 | } | 1282 | } |
1305 | |||
1306 | return 0; | 1283 | return 0; |
1307 | 1284 | ||
1308 | out2: | 1285 | out: |
1309 | kfree(buf); | ||
1310 | out1: | ||
1311 | return ret; | 1286 | return ret; |
1312 | } | 1287 | } |
1313 | 1288 | ||
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 2c685734b7a4..1ffdd106f4c4 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -94,7 +94,7 @@ static void dm_write_async_callback(struct urb *urb) | |||
94 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; | 94 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; |
95 | 95 | ||
96 | if (urb->status < 0) | 96 | if (urb->status < 0) |
97 | printk(KERN_DEBUG "dm_write_async_callback() failed with %d", | 97 | printk(KERN_DEBUG "dm_write_async_callback() failed with %d\n", |
98 | urb->status); | 98 | urb->status); |
99 | 99 | ||
100 | kfree(req); | 100 | kfree(req); |
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 58a53a641754..569ad8bfd383 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -70,7 +70,7 @@ | |||
70 | #define KAWETH_TX_TIMEOUT (5 * HZ) | 70 | #define KAWETH_TX_TIMEOUT (5 * HZ) |
71 | #define KAWETH_SCRATCH_SIZE 32 | 71 | #define KAWETH_SCRATCH_SIZE 32 |
72 | #define KAWETH_FIRMWARE_BUF_SIZE 4096 | 72 | #define KAWETH_FIRMWARE_BUF_SIZE 4096 |
73 | #define KAWETH_CONTROL_TIMEOUT (30 * HZ) | 73 | #define KAWETH_CONTROL_TIMEOUT (30000) |
74 | 74 | ||
75 | #define KAWETH_STATUS_BROKEN 0x0000001 | 75 | #define KAWETH_STATUS_BROKEN 0x0000001 |
76 | #define KAWETH_STATUS_CLOSING 0x0000002 | 76 | #define KAWETH_STATUS_CLOSING 0x0000002 |
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index f55a5951733a..5ea7411e1337 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c | |||
@@ -94,7 +94,7 @@ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) | |||
94 | 94 | ||
95 | ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ, | 95 | ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ, |
96 | MCS7830_RD_BMREQ, 0x0000, index, data, | 96 | MCS7830_RD_BMREQ, 0x0000, index, data, |
97 | size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT)); | 97 | size, MCS7830_CTRL_TIMEOUT); |
98 | return ret; | 98 | return ret; |
99 | } | 99 | } |
100 | 100 | ||
@@ -105,7 +105,7 @@ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, void *data) | |||
105 | 105 | ||
106 | ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ, | 106 | ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ, |
107 | MCS7830_WR_BMREQ, 0x0000, index, data, | 107 | MCS7830_WR_BMREQ, 0x0000, index, data, |
108 | size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT)); | 108 | size, MCS7830_CTRL_TIMEOUT); |
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
111 | 111 | ||
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index fdd1e034569d..3f67a29593bc 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <net/dst.h> | 16 | #include <net/dst.h> |
17 | #include <net/xfrm.h> | 17 | #include <net/xfrm.h> |
18 | #include <net/veth.h> | 18 | #include <linux/veth.h> |
19 | 19 | ||
20 | #define DRV_NAME "veth" | 20 | #define DRV_NAME "veth" |
21 | #define DRV_VERSION "1.0" | 21 | #define DRV_VERSION "1.0" |
@@ -459,19 +459,7 @@ static __init int veth_init(void) | |||
459 | 459 | ||
460 | static __exit void veth_exit(void) | 460 | static __exit void veth_exit(void) |
461 | { | 461 | { |
462 | struct veth_priv *priv, *next; | 462 | rtnl_link_unregister(&veth_link_ops); |
463 | |||
464 | rtnl_lock(); | ||
465 | /* | ||
466 | * cannot trust __rtnl_link_unregister() to unregister all | ||
467 | * devices, as each ->dellink call will remove two devices | ||
468 | * from the list at once. | ||
469 | */ | ||
470 | list_for_each_entry_safe(priv, next, &veth_list, list) | ||
471 | veth_dellink(priv->dev); | ||
472 | |||
473 | __rtnl_link_unregister(&veth_link_ops); | ||
474 | rtnl_unlock(); | ||
475 | } | 463 | } |
476 | 464 | ||
477 | module_init(veth_init); | 465 | module_init(veth_init); |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 450e29d7a9f3..35cd65d6b9ed 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1242,6 +1242,9 @@ static int velocity_rx_refill(struct velocity_info *vptr) | |||
1242 | static int velocity_init_rd_ring(struct velocity_info *vptr) | 1242 | static int velocity_init_rd_ring(struct velocity_info *vptr) |
1243 | { | 1243 | { |
1244 | int ret; | 1244 | int ret; |
1245 | int mtu = vptr->dev->mtu; | ||
1246 | |||
1247 | vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32; | ||
1245 | 1248 | ||
1246 | vptr->rd_info = kcalloc(vptr->options.numrx, | 1249 | vptr->rd_info = kcalloc(vptr->options.numrx, |
1247 | sizeof(struct velocity_rd_info), GFP_KERNEL); | 1250 | sizeof(struct velocity_rd_info), GFP_KERNEL); |
@@ -1898,8 +1901,6 @@ static int velocity_open(struct net_device *dev) | |||
1898 | struct velocity_info *vptr = netdev_priv(dev); | 1901 | struct velocity_info *vptr = netdev_priv(dev); |
1899 | int ret; | 1902 | int ret; |
1900 | 1903 | ||
1901 | vptr->rx_buf_sz = (dev->mtu <= 1504 ? PKT_BUF_SZ : dev->mtu + 32); | ||
1902 | |||
1903 | ret = velocity_init_rings(vptr); | 1904 | ret = velocity_init_rings(vptr); |
1904 | if (ret < 0) | 1905 | if (ret < 0) |
1905 | goto out; | 1906 | goto out; |
@@ -1978,12 +1979,6 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
1978 | velocity_free_rd_ring(vptr); | 1979 | velocity_free_rd_ring(vptr); |
1979 | 1980 | ||
1980 | dev->mtu = new_mtu; | 1981 | dev->mtu = new_mtu; |
1981 | if (new_mtu > 8192) | ||
1982 | vptr->rx_buf_sz = 9 * 1024; | ||
1983 | else if (new_mtu > 4096) | ||
1984 | vptr->rx_buf_sz = 8192; | ||
1985 | else | ||
1986 | vptr->rx_buf_sz = 4 * 1024; | ||
1987 | 1982 | ||
1988 | ret = velocity_init_rd_ring(vptr); | 1983 | ret = velocity_init_rd_ring(vptr); |
1989 | if (ret < 0) | 1984 | if (ret < 0) |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a75be57fb209..5413dbf3d4ac 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -198,8 +198,8 @@ again: | |||
198 | if (vi->num < vi->max / 2) | 198 | if (vi->num < vi->max / 2) |
199 | try_fill_recv(vi); | 199 | try_fill_recv(vi); |
200 | 200 | ||
201 | /* All done? */ | 201 | /* Out of packets? */ |
202 | if (!skb) { | 202 | if (received < budget) { |
203 | netif_rx_complete(vi->dev, napi); | 203 | netif_rx_complete(vi->dev, napi); |
204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) | 204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) |
205 | && netif_rx_reschedule(vi->dev, napi)) | 205 | && netif_rx_reschedule(vi->dev, napi)) |
@@ -404,8 +404,12 @@ free: | |||
404 | 404 | ||
405 | static void virtnet_remove(struct virtio_device *vdev) | 405 | static void virtnet_remove(struct virtio_device *vdev) |
406 | { | 406 | { |
407 | unregister_netdev(vdev->priv); | 407 | struct virtnet_info *vi = vdev->priv; |
408 | free_netdev(vdev->priv); | 408 | |
409 | vdev->config->del_vq(vi->svq); | ||
410 | vdev->config->del_vq(vi->rvq); | ||
411 | unregister_netdev(vi->dev); | ||
412 | free_netdev(vi->dev); | ||
409 | } | 413 | } |
410 | 414 | ||
411 | static struct virtio_device_id id_table[] = { | 415 | static struct virtio_device_id id_table[] = { |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index ff37bf437a99..1d706eae3052 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -395,8 +395,7 @@ static int __init cosa_init(void) | |||
395 | goto out_chrdev; | 395 | goto out_chrdev; |
396 | } | 396 | } |
397 | for (i=0; i<nr_cards; i++) { | 397 | for (i=0; i<nr_cards; i++) { |
398 | class_device_create(cosa_class, NULL, MKDEV(cosa_major, i), | 398 | device_create(cosa_class, NULL, MKDEV(cosa_major, i), "cosa%d", i); |
399 | NULL, "cosa%d", i); | ||
400 | } | 399 | } |
401 | err = 0; | 400 | err = 0; |
402 | goto out; | 401 | goto out; |
@@ -415,7 +414,7 @@ static void __exit cosa_exit(void) | |||
415 | printk(KERN_INFO "Unloading the cosa module\n"); | 414 | printk(KERN_INFO "Unloading the cosa module\n"); |
416 | 415 | ||
417 | for (i=0; i<nr_cards; i++) | 416 | for (i=0; i<nr_cards; i++) |
418 | class_device_destroy(cosa_class, MKDEV(cosa_major, i)); | 417 | device_destroy(cosa_class, MKDEV(cosa_major, i)); |
419 | class_destroy(cosa_class); | 418 | class_destroy(cosa_class); |
420 | for (cosa=cosa_cards; nr_cards--; cosa++) { | 419 | for (cosa=cosa_cards; nr_cards--; cosa++) { |
421 | /* Clean up the per-channel data */ | 420 | /* Clean up the per-channel data */ |
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index 8a1778cf98d1..d3b28b01b9f9 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c | |||
@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev) | |||
503 | dev->addr_len = 0; /* hardware address length */ | 503 | dev->addr_len = 0; /* hardware address length */ |
504 | 504 | ||
505 | if (!chan->svc) | 505 | if (!chan->svc) |
506 | *(u16*)dev->dev_addr = htons(chan->lcn); | 506 | *(__be16*)dev->dev_addr = htons(chan->lcn); |
507 | 507 | ||
508 | /* Initialize hardware parameters (just for reference) */ | 508 | /* Initialize hardware parameters (just for reference) */ |
509 | dev->irq = wandev->irq; | 509 | dev->irq = wandev->irq; |
@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb, | |||
565 | const void *daddr, const void *saddr, | 565 | const void *daddr, const void *saddr, |
566 | unsigned len) | 566 | unsigned len) |
567 | { | 567 | { |
568 | skb->protocol = type; | 568 | skb->protocol = htons(type); |
569 | 569 | ||
570 | return dev->hard_header_len; | 570 | return dev->hard_header_len; |
571 | } | 571 | } |
@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb, | |||
600 | struct cycx_device *card = chan->card; | 600 | struct cycx_device *card = chan->card; |
601 | 601 | ||
602 | if (!chan->svc) | 602 | if (!chan->svc) |
603 | chan->protocol = skb->protocol; | 603 | chan->protocol = ntohs(skb->protocol); |
604 | 604 | ||
605 | if (card->wandev.state != WAN_CONNECTED) | 605 | if (card->wandev.state != WAN_CONNECTED) |
606 | ++chan->ifstats.tx_dropped; | 606 | ++chan->ifstats.tx_dropped; |
607 | else if (chan->svc && chan->protocol && | 607 | else if (chan->svc && chan->protocol && |
608 | chan->protocol != skb->protocol) { | 608 | chan->protocol != ntohs(skb->protocol)) { |
609 | printk(KERN_INFO | 609 | printk(KERN_INFO |
610 | "%s: unsupported Ethertype 0x%04X on interface %s!\n", | 610 | "%s: unsupported Ethertype 0x%04X on interface %s!\n", |
611 | card->devname, skb->protocol, dev->name); | 611 | card->devname, ntohs(skb->protocol), dev->name); |
612 | ++chan->ifstats.tx_errors; | 612 | ++chan->ifstats.tx_errors; |
613 | } else if (chan->protocol == ETH_P_IP) { | 613 | } else if (chan->protocol == ETH_P_IP) { |
614 | switch (chan->state) { | 614 | switch (chan->state) { |
@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state) | |||
1401 | switch (state) { | 1401 | switch (state) { |
1402 | case WAN_CONNECTED: | 1402 | case WAN_CONNECTED: |
1403 | string_state = "connected!"; | 1403 | string_state = "connected!"; |
1404 | *(u16*)dev->dev_addr = htons(chan->lcn); | 1404 | *(__be16*)dev->dev_addr = htons(chan->lcn); |
1405 | netif_wake_queue(dev); | 1405 | netif_wake_queue(dev); |
1406 | reset_timer(dev); | 1406 | reset_timer(dev); |
1407 | 1407 | ||
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 33dc713b5301..c6f26e28e376 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -139,19 +139,21 @@ struct thingie { | |||
139 | }; | 139 | }; |
140 | 140 | ||
141 | struct TxFD { | 141 | struct TxFD { |
142 | u32 state; | 142 | __le32 state; |
143 | u32 next; | 143 | __le32 next; |
144 | u32 data; | 144 | __le32 data; |
145 | u32 complete; | 145 | __le32 complete; |
146 | u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */ | 146 | u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */ |
147 | /* FWIW, datasheet calls that "dummy" and says that card | ||
148 | * never looks at it; neither does the driver */ | ||
147 | }; | 149 | }; |
148 | 150 | ||
149 | struct RxFD { | 151 | struct RxFD { |
150 | u32 state1; | 152 | __le32 state1; |
151 | u32 next; | 153 | __le32 next; |
152 | u32 data; | 154 | __le32 data; |
153 | u32 state2; | 155 | __le32 state2; |
154 | u32 end; | 156 | __le32 end; |
155 | }; | 157 | }; |
156 | 158 | ||
157 | #define DUMMY_SKB_SIZE 64 | 159 | #define DUMMY_SKB_SIZE 64 |
@@ -181,7 +183,7 @@ struct RxFD { | |||
181 | #define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET) | 183 | #define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET) |
182 | 184 | ||
183 | struct dscc4_pci_priv { | 185 | struct dscc4_pci_priv { |
184 | u32 *iqcfg; | 186 | __le32 *iqcfg; |
185 | int cfg_cur; | 187 | int cfg_cur; |
186 | spinlock_t lock; | 188 | spinlock_t lock; |
187 | struct pci_dev *pdev; | 189 | struct pci_dev *pdev; |
@@ -197,8 +199,8 @@ struct dscc4_dev_priv { | |||
197 | 199 | ||
198 | struct RxFD *rx_fd; | 200 | struct RxFD *rx_fd; |
199 | struct TxFD *tx_fd; | 201 | struct TxFD *tx_fd; |
200 | u32 *iqrx; | 202 | __le32 *iqrx; |
201 | u32 *iqtx; | 203 | __le32 *iqtx; |
202 | 204 | ||
203 | /* FIXME: check all the volatile are required */ | 205 | /* FIXME: check all the volatile are required */ |
204 | volatile u32 tx_current; | 206 | volatile u32 tx_current; |
@@ -298,7 +300,7 @@ struct dscc4_dev_priv { | |||
298 | #define BrrExpMask 0x00000f00 | 300 | #define BrrExpMask 0x00000f00 |
299 | #define BrrMultMask 0x0000003f | 301 | #define BrrMultMask 0x0000003f |
300 | #define EncodingMask 0x00700000 | 302 | #define EncodingMask 0x00700000 |
301 | #define Hold 0x40000000 | 303 | #define Hold cpu_to_le32(0x40000000) |
302 | #define SccBusy 0x10000000 | 304 | #define SccBusy 0x10000000 |
303 | #define PowerUp 0x80000000 | 305 | #define PowerUp 0x80000000 |
304 | #define Vis 0x00001000 | 306 | #define Vis 0x00001000 |
@@ -307,14 +309,14 @@ struct dscc4_dev_priv { | |||
307 | #define FrameRdo 0x40 | 309 | #define FrameRdo 0x40 |
308 | #define FrameCrc 0x20 | 310 | #define FrameCrc 0x20 |
309 | #define FrameRab 0x10 | 311 | #define FrameRab 0x10 |
310 | #define FrameAborted 0x00000200 | 312 | #define FrameAborted cpu_to_le32(0x00000200) |
311 | #define FrameEnd 0x80000000 | 313 | #define FrameEnd cpu_to_le32(0x80000000) |
312 | #define DataComplete 0x40000000 | 314 | #define DataComplete cpu_to_le32(0x40000000) |
313 | #define LengthCheck 0x00008000 | 315 | #define LengthCheck 0x00008000 |
314 | #define SccEvt 0x02000000 | 316 | #define SccEvt 0x02000000 |
315 | #define NoAck 0x00000200 | 317 | #define NoAck 0x00000200 |
316 | #define Action 0x00000001 | 318 | #define Action 0x00000001 |
317 | #define HiDesc 0x20000000 | 319 | #define HiDesc cpu_to_le32(0x20000000) |
318 | 320 | ||
319 | /* SCC events */ | 321 | /* SCC events */ |
320 | #define RxEvt 0xf0000000 | 322 | #define RxEvt 0xf0000000 |
@@ -489,8 +491,8 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv) | |||
489 | skbuff = dpriv->tx_skbuff; | 491 | skbuff = dpriv->tx_skbuff; |
490 | for (i = 0; i < TX_RING_SIZE; i++) { | 492 | for (i = 0; i < TX_RING_SIZE; i++) { |
491 | if (*skbuff) { | 493 | if (*skbuff) { |
492 | pci_unmap_single(pdev, tx_fd->data, (*skbuff)->len, | 494 | pci_unmap_single(pdev, le32_to_cpu(tx_fd->data), |
493 | PCI_DMA_TODEVICE); | 495 | (*skbuff)->len, PCI_DMA_TODEVICE); |
494 | dev_kfree_skb(*skbuff); | 496 | dev_kfree_skb(*skbuff); |
495 | } | 497 | } |
496 | skbuff++; | 498 | skbuff++; |
@@ -500,7 +502,7 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv) | |||
500 | skbuff = dpriv->rx_skbuff; | 502 | skbuff = dpriv->rx_skbuff; |
501 | for (i = 0; i < RX_RING_SIZE; i++) { | 503 | for (i = 0; i < RX_RING_SIZE; i++) { |
502 | if (*skbuff) { | 504 | if (*skbuff) { |
503 | pci_unmap_single(pdev, rx_fd->data, | 505 | pci_unmap_single(pdev, le32_to_cpu(rx_fd->data), |
504 | RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); | 506 | RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); |
505 | dev_kfree_skb(*skbuff); | 507 | dev_kfree_skb(*skbuff); |
506 | } | 508 | } |
@@ -522,10 +524,10 @@ static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv, | |||
522 | dpriv->rx_skbuff[dirty] = skb; | 524 | dpriv->rx_skbuff[dirty] = skb; |
523 | if (skb) { | 525 | if (skb) { |
524 | skb->protocol = hdlc_type_trans(skb, dev); | 526 | skb->protocol = hdlc_type_trans(skb, dev); |
525 | rx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, | 527 | rx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev, |
526 | len, PCI_DMA_FROMDEVICE); | 528 | skb->data, len, PCI_DMA_FROMDEVICE)); |
527 | } else { | 529 | } else { |
528 | rx_fd->data = (u32) NULL; | 530 | rx_fd->data = 0; |
529 | ret = -1; | 531 | ret = -1; |
530 | } | 532 | } |
531 | return ret; | 533 | return ret; |
@@ -587,7 +589,7 @@ static inline int dscc4_xpr_ack(struct dscc4_dev_priv *dpriv) | |||
587 | 589 | ||
588 | do { | 590 | do { |
589 | if (!(dpriv->flags & (NeedIDR | NeedIDT)) || | 591 | if (!(dpriv->flags & (NeedIDR | NeedIDT)) || |
590 | (dpriv->iqtx[cur] & Xpr)) | 592 | (dpriv->iqtx[cur] & cpu_to_le32(Xpr))) |
591 | break; | 593 | break; |
592 | smp_rmb(); | 594 | smp_rmb(); |
593 | schedule_timeout_uninterruptible(10); | 595 | schedule_timeout_uninterruptible(10); |
@@ -650,8 +652,9 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv, | |||
650 | printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__); | 652 | printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__); |
651 | goto refill; | 653 | goto refill; |
652 | } | 654 | } |
653 | pkt_len = TO_SIZE(rx_fd->state2); | 655 | pkt_len = TO_SIZE(le32_to_cpu(rx_fd->state2)); |
654 | pci_unmap_single(pdev, rx_fd->data, RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); | 656 | pci_unmap_single(pdev, le32_to_cpu(rx_fd->data), |
657 | RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); | ||
655 | if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { | 658 | if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { |
656 | stats->rx_packets++; | 659 | stats->rx_packets++; |
657 | stats->rx_bytes += pkt_len; | 660 | stats->rx_bytes += pkt_len; |
@@ -679,7 +682,7 @@ refill: | |||
679 | } | 682 | } |
680 | dscc4_rx_update(dpriv, dev); | 683 | dscc4_rx_update(dpriv, dev); |
681 | rx_fd->state2 = 0x00000000; | 684 | rx_fd->state2 = 0x00000000; |
682 | rx_fd->end = 0xbabeface; | 685 | rx_fd->end = cpu_to_le32(0xbabeface); |
683 | } | 686 | } |
684 | 687 | ||
685 | static void dscc4_free1(struct pci_dev *pdev) | 688 | static void dscc4_free1(struct pci_dev *pdev) |
@@ -772,8 +775,8 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, | |||
772 | } | 775 | } |
773 | /* Global interrupt queue */ | 776 | /* Global interrupt queue */ |
774 | writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1); | 777 | writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1); |
775 | priv->iqcfg = (u32 *) pci_alloc_consistent(pdev, | 778 | priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev, |
776 | IRQ_RING_SIZE*sizeof(u32), &priv->iqcfg_dma); | 779 | IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma); |
777 | if (!priv->iqcfg) | 780 | if (!priv->iqcfg) |
778 | goto err_free_irq_5; | 781 | goto err_free_irq_5; |
779 | writel(priv->iqcfg_dma, ioaddr + IQCFG); | 782 | writel(priv->iqcfg_dma, ioaddr + IQCFG); |
@@ -786,7 +789,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, | |||
786 | */ | 789 | */ |
787 | for (i = 0; i < dev_per_card; i++) { | 790 | for (i = 0; i < dev_per_card; i++) { |
788 | dpriv = priv->root + i; | 791 | dpriv = priv->root + i; |
789 | dpriv->iqtx = (u32 *) pci_alloc_consistent(pdev, | 792 | dpriv->iqtx = (__le32 *) pci_alloc_consistent(pdev, |
790 | IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma); | 793 | IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma); |
791 | if (!dpriv->iqtx) | 794 | if (!dpriv->iqtx) |
792 | goto err_free_iqtx_6; | 795 | goto err_free_iqtx_6; |
@@ -794,7 +797,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, | |||
794 | } | 797 | } |
795 | for (i = 0; i < dev_per_card; i++) { | 798 | for (i = 0; i < dev_per_card; i++) { |
796 | dpriv = priv->root + i; | 799 | dpriv = priv->root + i; |
797 | dpriv->iqrx = (u32 *) pci_alloc_consistent(pdev, | 800 | dpriv->iqrx = (__le32 *) pci_alloc_consistent(pdev, |
798 | IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma); | 801 | IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma); |
799 | if (!dpriv->iqrx) | 802 | if (!dpriv->iqrx) |
800 | goto err_free_iqrx_7; | 803 | goto err_free_iqrx_7; |
@@ -1156,8 +1159,8 @@ static int dscc4_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1156 | dpriv->tx_skbuff[next] = skb; | 1159 | dpriv->tx_skbuff[next] = skb; |
1157 | tx_fd = dpriv->tx_fd + next; | 1160 | tx_fd = dpriv->tx_fd + next; |
1158 | tx_fd->state = FrameEnd | TO_STATE_TX(skb->len); | 1161 | tx_fd->state = FrameEnd | TO_STATE_TX(skb->len); |
1159 | tx_fd->data = pci_map_single(ppriv->pdev, skb->data, skb->len, | 1162 | tx_fd->data = cpu_to_le32(pci_map_single(ppriv->pdev, skb->data, skb->len, |
1160 | PCI_DMA_TODEVICE); | 1163 | PCI_DMA_TODEVICE)); |
1161 | tx_fd->complete = 0x00000000; | 1164 | tx_fd->complete = 0x00000000; |
1162 | tx_fd->jiffies = jiffies; | 1165 | tx_fd->jiffies = jiffies; |
1163 | mb(); | 1166 | mb(); |
@@ -1508,7 +1511,7 @@ static irqreturn_t dscc4_irq(int irq, void *token) | |||
1508 | if (state & Cfg) { | 1511 | if (state & Cfg) { |
1509 | if (debug > 0) | 1512 | if (debug > 0) |
1510 | printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME); | 1513 | printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME); |
1511 | if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & Arf) | 1514 | if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & cpu_to_le32(Arf)) |
1512 | printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG"); | 1515 | printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG"); |
1513 | if (!(state &= ~Cfg)) | 1516 | if (!(state &= ~Cfg)) |
1514 | goto out; | 1517 | goto out; |
@@ -1541,7 +1544,7 @@ static void dscc4_tx_irq(struct dscc4_pci_priv *ppriv, | |||
1541 | 1544 | ||
1542 | try: | 1545 | try: |
1543 | cur = dpriv->iqtx_current%IRQ_RING_SIZE; | 1546 | cur = dpriv->iqtx_current%IRQ_RING_SIZE; |
1544 | state = dpriv->iqtx[cur]; | 1547 | state = le32_to_cpu(dpriv->iqtx[cur]); |
1545 | if (!state) { | 1548 | if (!state) { |
1546 | if (debug > 4) | 1549 | if (debug > 4) |
1547 | printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name, | 1550 | printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name, |
@@ -1580,7 +1583,7 @@ try: | |||
1580 | tx_fd = dpriv->tx_fd + cur; | 1583 | tx_fd = dpriv->tx_fd + cur; |
1581 | skb = dpriv->tx_skbuff[cur]; | 1584 | skb = dpriv->tx_skbuff[cur]; |
1582 | if (skb) { | 1585 | if (skb) { |
1583 | pci_unmap_single(ppriv->pdev, tx_fd->data, | 1586 | pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data), |
1584 | skb->len, PCI_DMA_TODEVICE); | 1587 | skb->len, PCI_DMA_TODEVICE); |
1585 | if (tx_fd->state & FrameEnd) { | 1588 | if (tx_fd->state & FrameEnd) { |
1586 | stats->tx_packets++; | 1589 | stats->tx_packets++; |
@@ -1711,7 +1714,7 @@ static void dscc4_rx_irq(struct dscc4_pci_priv *priv, | |||
1711 | 1714 | ||
1712 | try: | 1715 | try: |
1713 | cur = dpriv->iqrx_current%IRQ_RING_SIZE; | 1716 | cur = dpriv->iqrx_current%IRQ_RING_SIZE; |
1714 | state = dpriv->iqrx[cur]; | 1717 | state = le32_to_cpu(dpriv->iqrx[cur]); |
1715 | if (!state) | 1718 | if (!state) |
1716 | return; | 1719 | return; |
1717 | dpriv->iqrx[cur] = 0; | 1720 | dpriv->iqrx[cur] = 0; |
@@ -1755,7 +1758,7 @@ try: | |||
1755 | goto try; | 1758 | goto try; |
1756 | rx_fd->state1 &= ~Hold; | 1759 | rx_fd->state1 &= ~Hold; |
1757 | rx_fd->state2 = 0x00000000; | 1760 | rx_fd->state2 = 0x00000000; |
1758 | rx_fd->end = 0xbabeface; | 1761 | rx_fd->end = cpu_to_le32(0xbabeface); |
1759 | //} | 1762 | //} |
1760 | goto try; | 1763 | goto try; |
1761 | } | 1764 | } |
@@ -1834,7 +1837,7 @@ try: | |||
1834 | hdlc_stats(dev)->rx_over_errors++; | 1837 | hdlc_stats(dev)->rx_over_errors++; |
1835 | rx_fd->state1 |= Hold; | 1838 | rx_fd->state1 |= Hold; |
1836 | rx_fd->state2 = 0x00000000; | 1839 | rx_fd->state2 = 0x00000000; |
1837 | rx_fd->end = 0xbabeface; | 1840 | rx_fd->end = cpu_to_le32(0xbabeface); |
1838 | } else | 1841 | } else |
1839 | dscc4_rx_skb(dpriv, dev); | 1842 | dscc4_rx_skb(dpriv, dev); |
1840 | } while (1); | 1843 | } while (1); |
@@ -1904,8 +1907,9 @@ static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv) | |||
1904 | skb_copy_to_linear_data(skb, version, | 1907 | skb_copy_to_linear_data(skb, version, |
1905 | strlen(version) % DUMMY_SKB_SIZE); | 1908 | strlen(version) % DUMMY_SKB_SIZE); |
1906 | tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); | 1909 | tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); |
1907 | tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, | 1910 | tx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev, |
1908 | DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); | 1911 | skb->data, DUMMY_SKB_SIZE, |
1912 | PCI_DMA_TODEVICE)); | ||
1909 | dpriv->tx_skbuff[last] = skb; | 1913 | dpriv->tx_skbuff[last] = skb; |
1910 | } | 1914 | } |
1911 | return skb; | 1915 | return skb; |
@@ -1937,8 +1941,8 @@ static int dscc4_init_ring(struct net_device *dev) | |||
1937 | tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE); | 1941 | tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE); |
1938 | tx_fd->complete = 0x00000000; | 1942 | tx_fd->complete = 0x00000000; |
1939 | /* FIXME: NULL should be ok - to be tried */ | 1943 | /* FIXME: NULL should be ok - to be tried */ |
1940 | tx_fd->data = dpriv->tx_fd_dma; | 1944 | tx_fd->data = cpu_to_le32(dpriv->tx_fd_dma); |
1941 | (tx_fd++)->next = (u32)(dpriv->tx_fd_dma + | 1945 | (tx_fd++)->next = cpu_to_le32(dpriv->tx_fd_dma + |
1942 | (++i%TX_RING_SIZE)*sizeof(*tx_fd)); | 1946 | (++i%TX_RING_SIZE)*sizeof(*tx_fd)); |
1943 | } while (i < TX_RING_SIZE); | 1947 | } while (i < TX_RING_SIZE); |
1944 | 1948 | ||
@@ -1951,12 +1955,12 @@ static int dscc4_init_ring(struct net_device *dev) | |||
1951 | /* size set by the host. Multiple of 4 bytes please */ | 1955 | /* size set by the host. Multiple of 4 bytes please */ |
1952 | rx_fd->state1 = HiDesc; | 1956 | rx_fd->state1 = HiDesc; |
1953 | rx_fd->state2 = 0x00000000; | 1957 | rx_fd->state2 = 0x00000000; |
1954 | rx_fd->end = 0xbabeface; | 1958 | rx_fd->end = cpu_to_le32(0xbabeface); |
1955 | rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU); | 1959 | rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU); |
1956 | // FIXME: return value verifiee mais traitement suspect | 1960 | // FIXME: return value verifiee mais traitement suspect |
1957 | if (try_get_rx_skb(dpriv, dev) >= 0) | 1961 | if (try_get_rx_skb(dpriv, dev) >= 0) |
1958 | dpriv->rx_dirty++; | 1962 | dpriv->rx_dirty++; |
1959 | (rx_fd++)->next = (u32)(dpriv->rx_fd_dma + | 1963 | (rx_fd++)->next = cpu_to_le32(dpriv->rx_fd_dma + |
1960 | (++i%RX_RING_SIZE)*sizeof(*rx_fd)); | 1964 | (++i%RX_RING_SIZE)*sizeof(*rx_fd)); |
1961 | } while (i < RX_RING_SIZE); | 1965 | } while (i < RX_RING_SIZE); |
1962 | 1966 | ||
diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c index 574737b55f39..c9c878cd5c72 100644 --- a/drivers/net/wan/lmc/lmc_media.c +++ b/drivers/net/wan/lmc/lmc_media.c | |||
@@ -890,16 +890,8 @@ write_av9110 (lmc_softc_t * sc, u_int32_t n, u_int32_t m, u_int32_t v, | |||
890 | static void | 890 | static void |
891 | lmc_ssi_watchdog (lmc_softc_t * const sc) | 891 | lmc_ssi_watchdog (lmc_softc_t * const sc) |
892 | { | 892 | { |
893 | u_int16_t mii17; | 893 | u_int16_t mii17 = lmc_mii_readreg (sc, 0, 17); |
894 | struct ssicsr2 | 894 | if (((mii17 >> 3) & 7) == 7) |
895 | { | ||
896 | unsigned short dtr:1, dsr:1, rts:1, cable:3, crc:1, led0:1, led1:1, | ||
897 | led2:1, led3:1, fifo:1, ll:1, rl:1, tm:1, loop:1; | ||
898 | }; | ||
899 | struct ssicsr2 *ssicsr; | ||
900 | mii17 = lmc_mii_readreg (sc, 0, 17); | ||
901 | ssicsr = (struct ssicsr2 *) &mii17; | ||
902 | if (ssicsr->cable == 7) | ||
903 | { | 895 | { |
904 | lmc_led_off (sc, LMC_MII16_LED2); | 896 | lmc_led_off (sc, LMC_MII16_LED2); |
905 | } | 897 | } |
diff --git a/drivers/net/wan/sbni.h b/drivers/net/wan/sbni.h index 27715e70f28b..84264510a8ed 100644 --- a/drivers/net/wan/sbni.h +++ b/drivers/net/wan/sbni.h | |||
@@ -44,9 +44,15 @@ enum { | |||
44 | #define PR_RES 0x80 | 44 | #define PR_RES 0x80 |
45 | 45 | ||
46 | struct sbni_csr1 { | 46 | struct sbni_csr1 { |
47 | unsigned rxl : 5; | 47 | #ifdef __LITTLE_ENDIAN_BITFIELD |
48 | unsigned rate : 2; | 48 | u8 rxl : 5; |
49 | unsigned : 1; | 49 | u8 rate : 2; |
50 | u8 : 1; | ||
51 | #else | ||
52 | u8 : 1; | ||
53 | u8 rate : 2; | ||
54 | u8 rxl : 5; | ||
55 | #endif | ||
50 | }; | 56 | }; |
51 | 57 | ||
52 | /* fields in frame header */ | 58 | /* fields in frame header */ |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 232ecba5340f..61e24b7a45a3 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -107,24 +107,24 @@ | |||
107 | struct ppp_header { | 107 | struct ppp_header { |
108 | u8 address; | 108 | u8 address; |
109 | u8 control; | 109 | u8 control; |
110 | u16 protocol; | 110 | __be16 protocol; |
111 | }; | 111 | }; |
112 | #define PPP_HEADER_LEN sizeof (struct ppp_header) | 112 | #define PPP_HEADER_LEN sizeof (struct ppp_header) |
113 | 113 | ||
114 | struct lcp_header { | 114 | struct lcp_header { |
115 | u8 type; | 115 | u8 type; |
116 | u8 ident; | 116 | u8 ident; |
117 | u16 len; | 117 | __be16 len; |
118 | }; | 118 | }; |
119 | #define LCP_HEADER_LEN sizeof (struct lcp_header) | 119 | #define LCP_HEADER_LEN sizeof (struct lcp_header) |
120 | 120 | ||
121 | struct cisco_packet { | 121 | struct cisco_packet { |
122 | u32 type; | 122 | __be32 type; |
123 | u32 par1; | 123 | __be32 par1; |
124 | u32 par2; | 124 | __be32 par2; |
125 | u16 rel; | 125 | __be16 rel; |
126 | u16 time0; | 126 | __be16 time0; |
127 | u16 time1; | 127 | __be16 time1; |
128 | }; | 128 | }; |
129 | #define CISCO_PACKET_LEN 18 | 129 | #define CISCO_PACKET_LEN 18 |
130 | #define CISCO_BIG_PACKET_LEN 20 | 130 | #define CISCO_BIG_PACKET_LEN 20 |
@@ -139,7 +139,7 @@ static struct sk_buff_head tx_queue; | |||
139 | static void sppp_keepalive (unsigned long dummy); | 139 | static void sppp_keepalive (unsigned long dummy); |
140 | static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, | 140 | static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, |
141 | u8 ident, u16 len, void *data); | 141 | u8 ident, u16 len, void *data); |
142 | static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2); | 142 | static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2); |
143 | static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); | 143 | static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); |
144 | static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); | 144 | static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); |
145 | static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); | 145 | static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); |
@@ -447,7 +447,7 @@ static void sppp_keepalive (unsigned long dummy) | |||
447 | sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, | 447 | sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, |
448 | sp->pp_rseq); | 448 | sp->pp_rseq); |
449 | else if (sp->lcp.state == LCP_STATE_OPENED) { | 449 | else if (sp->lcp.state == LCP_STATE_OPENED) { |
450 | long nmagic = htonl (sp->lcp.magic); | 450 | __be32 nmagic = htonl (sp->lcp.magic); |
451 | sp->lcp.echoid = ++sp->pp_seq; | 451 | sp->lcp.echoid = ++sp->pp_seq; |
452 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, | 452 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, |
453 | sp->lcp.echoid, 4, &nmagic); | 453 | sp->lcp.echoid, 4, &nmagic); |
@@ -667,7 +667,7 @@ badreq: | |||
667 | dev->name, len); | 667 | dev->name, len); |
668 | break; | 668 | break; |
669 | } | 669 | } |
670 | if (ntohl (*(long*)(h+1)) == sp->lcp.magic) { | 670 | if (ntohl (*(__be32*)(h+1)) == sp->lcp.magic) { |
671 | /* Line loopback mode detected. */ | 671 | /* Line loopback mode detected. */ |
672 | printk (KERN_WARNING "%s: loopback\n", dev->name); | 672 | printk (KERN_WARNING "%s: loopback\n", dev->name); |
673 | if_down (dev); | 673 | if_down (dev); |
@@ -680,7 +680,7 @@ badreq: | |||
680 | sppp_lcp_open (sp); | 680 | sppp_lcp_open (sp); |
681 | break; | 681 | break; |
682 | } | 682 | } |
683 | *(long*)(h+1) = htonl (sp->lcp.magic); | 683 | *(__be32 *)(h+1) = htonl (sp->lcp.magic); |
684 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); | 684 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); |
685 | break; | 685 | break; |
686 | case LCP_ECHO_REPLY: | 686 | case LCP_ECHO_REPLY: |
@@ -692,7 +692,7 @@ badreq: | |||
692 | dev->name, len); | 692 | dev->name, len); |
693 | break; | 693 | break; |
694 | } | 694 | } |
695 | if (ntohl (*(long*)(h+1)) != sp->lcp.magic) | 695 | if (ntohl(*(__be32 *)(h+1)) != sp->lcp.magic) |
696 | sp->pp_alivecnt = 0; | 696 | sp->pp_alivecnt = 0; |
697 | break; | 697 | break; |
698 | } | 698 | } |
@@ -765,7 +765,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) | |||
765 | { | 765 | { |
766 | struct in_device *in_dev; | 766 | struct in_device *in_dev; |
767 | struct in_ifaddr *ifa; | 767 | struct in_ifaddr *ifa; |
768 | __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ | 768 | __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */ |
769 | #ifdef CONFIG_INET | 769 | #ifdef CONFIG_INET |
770 | rcu_read_lock(); | 770 | rcu_read_lock(); |
771 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) | 771 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) |
@@ -782,8 +782,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) | |||
782 | } | 782 | } |
783 | rcu_read_unlock(); | 783 | rcu_read_unlock(); |
784 | #endif | 784 | #endif |
785 | /* I hope both addr and mask are in the net order */ | 785 | sppp_cisco_send (sp, CISCO_ADDR_REPLY, ntohl(addr), ntohl(mask)); |
786 | sppp_cisco_send (sp, CISCO_ADDR_REPLY, addr, mask); | ||
787 | break; | 786 | break; |
788 | } | 787 | } |
789 | } | 788 | } |
@@ -844,7 +843,7 @@ static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, | |||
844 | * Send Cisco keepalive packet. | 843 | * Send Cisco keepalive packet. |
845 | */ | 844 | */ |
846 | 845 | ||
847 | static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) | 846 | static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2) |
848 | { | 847 | { |
849 | struct ppp_header *h; | 848 | struct ppp_header *h; |
850 | struct cisco_packet *ch; | 849 | struct cisco_packet *ch; |
@@ -868,7 +867,7 @@ static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) | |||
868 | ch->type = htonl (type); | 867 | ch->type = htonl (type); |
869 | ch->par1 = htonl (par1); | 868 | ch->par1 = htonl (par1); |
870 | ch->par2 = htonl (par2); | 869 | ch->par2 = htonl (par2); |
871 | ch->rel = -1; | 870 | ch->rel = htons(0xffff); |
872 | ch->time0 = htons ((u16) (t >> 16)); | 871 | ch->time0 = htons ((u16) (t >> 16)); |
873 | ch->time1 = htons ((u16) t); | 872 | ch->time1 = htons ((u16) t); |
874 | 873 | ||
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 2b733c582915..2c08c0a5a0df 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -68,7 +68,7 @@ config WAVELAN | |||
68 | <http://www.tldp.org/docs.html#howto>. Some more specific | 68 | <http://www.tldp.org/docs.html#howto>. Some more specific |
69 | information is contained in | 69 | information is contained in |
70 | <file:Documentation/networking/wavelan.txt> and in the source code | 70 | <file:Documentation/networking/wavelan.txt> and in the source code |
71 | <file:drivers/net/wavelan.p.h>. | 71 | <file:drivers/net/wireless/wavelan.p.h>. |
72 | 72 | ||
73 | You will also need the wireless tools package available from | 73 | You will also need the wireless tools package available from |
74 | <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. | 74 | <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. |
@@ -264,6 +264,7 @@ config IPW2200_DEBUG | |||
264 | config LIBERTAS | 264 | config LIBERTAS |
265 | tristate "Marvell 8xxx Libertas WLAN driver support" | 265 | tristate "Marvell 8xxx Libertas WLAN driver support" |
266 | depends on WLAN_80211 | 266 | depends on WLAN_80211 |
267 | select WIRELESS_EXT | ||
267 | select IEEE80211 | 268 | select IEEE80211 |
268 | select FW_LOADER | 269 | select FW_LOADER |
269 | ---help--- | 270 | ---help--- |
@@ -586,15 +587,66 @@ config ADM8211 | |||
586 | config P54_COMMON | 587 | config P54_COMMON |
587 | tristate "Softmac Prism54 support" | 588 | tristate "Softmac Prism54 support" |
588 | depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL | 589 | depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL |
590 | ---help--- | ||
591 | This is common code for isl38xx based cards. | ||
592 | This module does nothing by itself - the USB/PCI frontends | ||
593 | also need to be enabled in order to support any devices. | ||
594 | |||
595 | These devices require softmac firmware which can be found at | ||
596 | http://prism54.org/ | ||
597 | |||
598 | If you choose to build a module, it'll be called p54common. | ||
589 | 599 | ||
590 | config P54_USB | 600 | config P54_USB |
591 | tristate "Prism54 USB support" | 601 | tristate "Prism54 USB support" |
592 | depends on P54_COMMON && USB | 602 | depends on P54_COMMON && USB |
593 | select CRC32 | 603 | select CRC32 |
604 | ---help--- | ||
605 | This driver is for USB isl38xx based wireless cards. | ||
606 | These are USB based adapters found in devices such as: | ||
607 | |||
608 | 3COM 3CRWE254G72 | ||
609 | SMC 2862W-G | ||
610 | Accton 802.11g WN4501 USB | ||
611 | Siemens Gigaset USB | ||
612 | Netgear WG121 | ||
613 | Netgear WG111 | ||
614 | Medion 40900, Roper Europe | ||
615 | Shuttle PN15, Airvast WM168g, IOGear GWU513 | ||
616 | Linksys WUSB54G | ||
617 | Linksys WUSB54G Portable | ||
618 | DLink DWL-G120 Spinnaker | ||
619 | DLink DWL-G122 | ||
620 | Belkin F5D7050 ver 1000 | ||
621 | Cohiba Proto board | ||
622 | SMC 2862W-G version 2 | ||
623 | U.S. Robotics U5 802.11g Adapter | ||
624 | FUJITSU E-5400 USB D1700 | ||
625 | Sagem XG703A | ||
626 | DLink DWL-G120 Cohiba | ||
627 | Spinnaker Proto board | ||
628 | Linksys WUSB54AG | ||
629 | Inventel UR054G | ||
630 | Spinnaker DUT | ||
631 | |||
632 | These devices require softmac firmware which can be found at | ||
633 | http://prism54.org/ | ||
634 | |||
635 | If you choose to build a module, it'll be called p54usb. | ||
594 | 636 | ||
595 | config P54_PCI | 637 | config P54_PCI |
596 | tristate "Prism54 PCI support" | 638 | tristate "Prism54 PCI support" |
597 | depends on P54_COMMON && PCI | 639 | depends on P54_COMMON && PCI |
640 | ---help--- | ||
641 | This driver is for PCI isl38xx based wireless cards. | ||
642 | This driver supports most devices that are supported by the | ||
643 | fullmac prism54 driver plus many devices which are not | ||
644 | supported by the fullmac driver/firmware. | ||
645 | |||
646 | This driver requires softmac firmware which can be found at | ||
647 | http://prism54.org/ | ||
648 | |||
649 | If you choose to build a module, it'll be called p54pci. | ||
598 | 650 | ||
599 | source "drivers/net/wireless/iwlwifi/Kconfig" | 651 | source "drivers/net/wireless/iwlwifi/Kconfig" |
600 | source "drivers/net/wireless/hostap/Kconfig" | 652 | source "drivers/net/wireless/hostap/Kconfig" |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index a28ad230d63e..7b6fc1ab2b90 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -273,6 +273,8 @@ enum { | |||
273 | #define B43_PHYTYPE_A 0x00 | 273 | #define B43_PHYTYPE_A 0x00 |
274 | #define B43_PHYTYPE_B 0x01 | 274 | #define B43_PHYTYPE_B 0x01 |
275 | #define B43_PHYTYPE_G 0x02 | 275 | #define B43_PHYTYPE_G 0x02 |
276 | #define B43_PHYTYPE_N 0x04 | ||
277 | #define B43_PHYTYPE_LP 0x05 | ||
276 | 278 | ||
277 | /* PHYRegisters */ | 279 | /* PHYRegisters */ |
278 | #define B43_PHY_ILT_A_CTRL 0x0072 | 280 | #define B43_PHY_ILT_A_CTRL 0x0072 |
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c index 19e588582c7c..6c0e2b9f7760 100644 --- a/drivers/net/wireless/b43/leds.c +++ b/drivers/net/wireless/b43/leds.c | |||
@@ -163,6 +163,9 @@ static void b43_map_led(struct b43_wldev *dev, | |||
163 | b43_register_led(dev, &dev->led_radio, name, | 163 | b43_register_led(dev, &dev->led_radio, name, |
164 | b43_rfkill_led_name(dev), | 164 | b43_rfkill_led_name(dev), |
165 | led_index, activelow); | 165 | led_index, activelow); |
166 | /* Sync the RF-kill LED state with the switch state. */ | ||
167 | if (dev->radio_hw_enable) | ||
168 | b43_led_turn_on(dev, led_index, activelow); | ||
166 | break; | 169 | break; |
167 | case B43_LED_WEIRD: | 170 | case B43_LED_WEIRD: |
168 | case B43_LED_ASSOC: | 171 | case B43_LED_ASSOC: |
@@ -232,4 +235,5 @@ void b43_leds_exit(struct b43_wldev *dev) | |||
232 | b43_unregister_led(&dev->led_tx); | 235 | b43_unregister_led(&dev->led_tx); |
233 | b43_unregister_led(&dev->led_rx); | 236 | b43_unregister_led(&dev->led_rx); |
234 | b43_unregister_led(&dev->led_assoc); | 237 | b43_unregister_led(&dev->led_assoc); |
238 | b43_unregister_led(&dev->led_radio); | ||
235 | } | 239 | } |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 2b17c1dc46f1..1c93b4f4bfe3 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1566,7 +1566,7 @@ static void b43_release_firmware(struct b43_wldev *dev) | |||
1566 | static void b43_print_fw_helptext(struct b43_wl *wl) | 1566 | static void b43_print_fw_helptext(struct b43_wl *wl) |
1567 | { | 1567 | { |
1568 | b43err(wl, "You must go to " | 1568 | b43err(wl, "You must go to " |
1569 | "http://linuxwireless.org/en/users/Drivers/bcm43xx#devicefirmware " | 1569 | "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware " |
1570 | "and download the correct firmware (version 4).\n"); | 1570 | "and download the correct firmware (version 4).\n"); |
1571 | } | 1571 | } |
1572 | 1572 | ||
@@ -2163,7 +2163,6 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna) | |||
2163 | static void b43_chip_exit(struct b43_wldev *dev) | 2163 | static void b43_chip_exit(struct b43_wldev *dev) |
2164 | { | 2164 | { |
2165 | b43_radio_turn_off(dev, 1); | 2165 | b43_radio_turn_off(dev, 1); |
2166 | b43_leds_exit(dev); | ||
2167 | b43_gpio_cleanup(dev); | 2166 | b43_gpio_cleanup(dev); |
2168 | /* firmware is released later */ | 2167 | /* firmware is released later */ |
2169 | } | 2168 | } |
@@ -2191,11 +2190,10 @@ static int b43_chip_init(struct b43_wldev *dev) | |||
2191 | err = b43_gpio_init(dev); | 2190 | err = b43_gpio_init(dev); |
2192 | if (err) | 2191 | if (err) |
2193 | goto out; /* firmware is released later */ | 2192 | goto out; /* firmware is released later */ |
2194 | b43_leds_init(dev); | ||
2195 | 2193 | ||
2196 | err = b43_upload_initvals(dev); | 2194 | err = b43_upload_initvals(dev); |
2197 | if (err) | 2195 | if (err) |
2198 | goto err_leds_exit; | 2196 | goto err_gpio_clean; |
2199 | b43_radio_turn_on(dev); | 2197 | b43_radio_turn_on(dev); |
2200 | 2198 | ||
2201 | b43_write16(dev, 0x03E6, 0x0000); | 2199 | b43_write16(dev, 0x03E6, 0x0000); |
@@ -2271,8 +2269,7 @@ out: | |||
2271 | 2269 | ||
2272 | err_radio_off: | 2270 | err_radio_off: |
2273 | b43_radio_turn_off(dev, 1); | 2271 | b43_radio_turn_off(dev, 1); |
2274 | err_leds_exit: | 2272 | err_gpio_clean: |
2275 | b43_leds_exit(dev); | ||
2276 | b43_gpio_cleanup(dev); | 2273 | b43_gpio_cleanup(dev); |
2277 | return err; | 2274 | return err; |
2278 | } | 2275 | } |
@@ -3273,10 +3270,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev) | |||
3273 | return; | 3270 | return; |
3274 | b43_set_status(dev, B43_STAT_UNINIT); | 3271 | b43_set_status(dev, B43_STAT_UNINIT); |
3275 | 3272 | ||
3276 | mutex_unlock(&dev->wl->mutex); | 3273 | b43_leds_exit(dev); |
3277 | b43_rfkill_exit(dev); | ||
3278 | mutex_lock(&dev->wl->mutex); | ||
3279 | |||
3280 | b43_rng_exit(dev->wl); | 3274 | b43_rng_exit(dev->wl); |
3281 | b43_pio_free(dev); | 3275 | b43_pio_free(dev); |
3282 | b43_dma_free(dev); | 3276 | b43_dma_free(dev); |
@@ -3405,12 +3399,12 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
3405 | memset(wl->mac_addr, 0, ETH_ALEN); | 3399 | memset(wl->mac_addr, 0, ETH_ALEN); |
3406 | b43_upload_card_macaddress(dev); | 3400 | b43_upload_card_macaddress(dev); |
3407 | b43_security_init(dev); | 3401 | b43_security_init(dev); |
3408 | b43_rfkill_init(dev); | ||
3409 | b43_rng_init(wl); | 3402 | b43_rng_init(wl); |
3410 | 3403 | ||
3411 | b43_set_status(dev, B43_STAT_INITIALIZED); | 3404 | b43_set_status(dev, B43_STAT_INITIALIZED); |
3412 | 3405 | ||
3413 | out: | 3406 | b43_leds_init(dev); |
3407 | out: | ||
3414 | return err; | 3408 | return err; |
3415 | 3409 | ||
3416 | err_chip_exit: | 3410 | err_chip_exit: |
@@ -3499,6 +3493,10 @@ static int b43_start(struct ieee80211_hw *hw) | |||
3499 | int did_init = 0; | 3493 | int did_init = 0; |
3500 | int err = 0; | 3494 | int err = 0; |
3501 | 3495 | ||
3496 | /* First register RFkill. | ||
3497 | * LEDs that are registered later depend on it. */ | ||
3498 | b43_rfkill_init(dev); | ||
3499 | |||
3502 | mutex_lock(&wl->mutex); | 3500 | mutex_lock(&wl->mutex); |
3503 | 3501 | ||
3504 | if (b43_status(dev) < B43_STAT_INITIALIZED) { | 3502 | if (b43_status(dev) < B43_STAT_INITIALIZED) { |
@@ -3528,6 +3526,8 @@ static void b43_stop(struct ieee80211_hw *hw) | |||
3528 | struct b43_wl *wl = hw_to_b43_wl(hw); | 3526 | struct b43_wl *wl = hw_to_b43_wl(hw); |
3529 | struct b43_wldev *dev = wl->current_dev; | 3527 | struct b43_wldev *dev = wl->current_dev; |
3530 | 3528 | ||
3529 | b43_rfkill_exit(dev); | ||
3530 | |||
3531 | mutex_lock(&wl->mutex); | 3531 | mutex_lock(&wl->mutex); |
3532 | if (b43_status(dev) >= B43_STAT_STARTED) | 3532 | if (b43_status(dev) >= B43_STAT_STARTED) |
3533 | b43_wireless_core_stop(dev); | 3533 | b43_wireless_core_stop(dev); |
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h index 284d17da17d1..08e2e56e48f4 100644 --- a/drivers/net/wireless/b43/main.h +++ b/drivers/net/wireless/b43/main.h | |||
@@ -39,11 +39,11 @@ | |||
39 | #define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes)) | 39 | #define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes)) |
40 | 40 | ||
41 | /* Lightweight function to convert a frequency (in Mhz) to a channel number. */ | 41 | /* Lightweight function to convert a frequency (in Mhz) to a channel number. */ |
42 | static inline u8 b43_freq_to_channel_a(int freq) | 42 | static inline u8 b43_freq_to_channel_5ghz(int freq) |
43 | { | 43 | { |
44 | return ((freq - 5000) / 5); | 44 | return ((freq - 5000) / 5); |
45 | } | 45 | } |
46 | static inline u8 b43_freq_to_channel_bg(int freq) | 46 | static inline u8 b43_freq_to_channel_2ghz(int freq) |
47 | { | 47 | { |
48 | u8 channel; | 48 | u8 channel; |
49 | 49 | ||
@@ -54,19 +54,13 @@ static inline u8 b43_freq_to_channel_bg(int freq) | |||
54 | 54 | ||
55 | return channel; | 55 | return channel; |
56 | } | 56 | } |
57 | static inline u8 b43_freq_to_channel(struct b43_wldev *dev, int freq) | ||
58 | { | ||
59 | if (dev->phy.type == B43_PHYTYPE_A) | ||
60 | return b43_freq_to_channel_a(freq); | ||
61 | return b43_freq_to_channel_bg(freq); | ||
62 | } | ||
63 | 57 | ||
64 | /* Lightweight function to convert a channel number to a frequency (in Mhz). */ | 58 | /* Lightweight function to convert a channel number to a frequency (in Mhz). */ |
65 | static inline int b43_channel_to_freq_a(u8 channel) | 59 | static inline int b43_channel_to_freq_5ghz(u8 channel) |
66 | { | 60 | { |
67 | return (5000 + (5 * channel)); | 61 | return (5000 + (5 * channel)); |
68 | } | 62 | } |
69 | static inline int b43_channel_to_freq_bg(u8 channel) | 63 | static inline int b43_channel_to_freq_2ghz(u8 channel) |
70 | { | 64 | { |
71 | int freq; | 65 | int freq; |
72 | 66 | ||
@@ -77,12 +71,6 @@ static inline int b43_channel_to_freq_bg(u8 channel) | |||
77 | 71 | ||
78 | return freq; | 72 | return freq; |
79 | } | 73 | } |
80 | static inline int b43_channel_to_freq(struct b43_wldev *dev, u8 channel) | ||
81 | { | ||
82 | if (dev->phy.type == B43_PHYTYPE_A) | ||
83 | return b43_channel_to_freq_a(channel); | ||
84 | return b43_channel_to_freq_bg(channel); | ||
85 | } | ||
86 | 74 | ||
87 | static inline int b43_is_cck_rate(int rate) | 75 | static inline int b43_is_cck_rate(int rate) |
88 | { | 76 | { |
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index 3d4ed647c311..7ff091e69f05 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c | |||
@@ -2214,7 +2214,7 @@ int b43_phy_init_tssi2dbm_table(struct b43_wldev *dev) | |||
2214 | } | 2214 | } |
2215 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); | 2215 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); |
2216 | if (dyn_tssi2dbm == NULL) { | 2216 | if (dyn_tssi2dbm == NULL) { |
2217 | b43err(dev->wl, "Could not allocate memory" | 2217 | b43err(dev->wl, "Could not allocate memory " |
2218 | "for tssi2dbm table\n"); | 2218 | "for tssi2dbm table\n"); |
2219 | return -ENOMEM; | 2219 | return -ENOMEM; |
2220 | } | 2220 | } |
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 9b1f905ffbf4..11f53cb1139e 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include "rfkill.h" | 25 | #include "rfkill.h" |
26 | #include "b43.h" | 26 | #include "b43.h" |
27 | 27 | ||
28 | #include <linux/kmod.h> | ||
29 | |||
28 | 30 | ||
29 | /* Returns TRUE, if the radio is enabled in hardware. */ | 31 | /* Returns TRUE, if the radio is enabled in hardware. */ |
30 | static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) | 32 | static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) |
@@ -50,7 +52,10 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | |||
50 | bool report_change = 0; | 52 | bool report_change = 0; |
51 | 53 | ||
52 | mutex_lock(&wl->mutex); | 54 | mutex_lock(&wl->mutex); |
53 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); | 55 | if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) { |
56 | mutex_unlock(&wl->mutex); | ||
57 | return; | ||
58 | } | ||
54 | enabled = b43_is_hw_radio_enabled(dev); | 59 | enabled = b43_is_hw_radio_enabled(dev); |
55 | if (unlikely(enabled != dev->radio_hw_enable)) { | 60 | if (unlikely(enabled != dev->radio_hw_enable)) { |
56 | dev->radio_hw_enable = enabled; | 61 | dev->radio_hw_enable = enabled; |
@@ -60,8 +65,12 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | |||
60 | } | 65 | } |
61 | mutex_unlock(&wl->mutex); | 66 | mutex_unlock(&wl->mutex); |
62 | 67 | ||
63 | if (unlikely(report_change)) | 68 | /* send the radio switch event to the system - note both a key press |
64 | input_report_key(poll_dev->input, KEY_WLAN, enabled); | 69 | * and a release are required */ |
70 | if (unlikely(report_change)) { | ||
71 | input_report_key(poll_dev->input, KEY_WLAN, 1); | ||
72 | input_report_key(poll_dev->input, KEY_WLAN, 0); | ||
73 | } | ||
65 | } | 74 | } |
66 | 75 | ||
67 | /* Called when the RFKILL toggled in software. */ | 76 | /* Called when the RFKILL toggled in software. */ |
@@ -69,13 +78,15 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) | |||
69 | { | 78 | { |
70 | struct b43_wldev *dev = data; | 79 | struct b43_wldev *dev = data; |
71 | struct b43_wl *wl = dev->wl; | 80 | struct b43_wl *wl = dev->wl; |
72 | int err = 0; | 81 | int err = -EBUSY; |
73 | 82 | ||
74 | if (!wl->rfkill.registered) | 83 | if (!wl->rfkill.registered) |
75 | return 0; | 84 | return 0; |
76 | 85 | ||
77 | mutex_lock(&wl->mutex); | 86 | mutex_lock(&wl->mutex); |
78 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); | 87 | if (b43_status(dev) < B43_STAT_INITIALIZED) |
88 | goto out_unlock; | ||
89 | err = 0; | ||
79 | switch (state) { | 90 | switch (state) { |
80 | case RFKILL_STATE_ON: | 91 | case RFKILL_STATE_ON: |
81 | if (!dev->radio_hw_enable) { | 92 | if (!dev->radio_hw_enable) { |
@@ -127,15 +138,34 @@ void b43_rfkill_init(struct b43_wldev *dev) | |||
127 | rfk->rfkill->user_claim_unsupported = 1; | 138 | rfk->rfkill->user_claim_unsupported = 1; |
128 | 139 | ||
129 | rfk->poll_dev = input_allocate_polled_device(); | 140 | rfk->poll_dev = input_allocate_polled_device(); |
130 | if (!rfk->poll_dev) | 141 | if (!rfk->poll_dev) { |
131 | goto err_free_rfk; | 142 | rfkill_free(rfk->rfkill); |
143 | goto err_freed_rfk; | ||
144 | } | ||
145 | |||
132 | rfk->poll_dev->private = dev; | 146 | rfk->poll_dev->private = dev; |
133 | rfk->poll_dev->poll = b43_rfkill_poll; | 147 | rfk->poll_dev->poll = b43_rfkill_poll; |
134 | rfk->poll_dev->poll_interval = 1000; /* msecs */ | 148 | rfk->poll_dev->poll_interval = 1000; /* msecs */ |
135 | 149 | ||
150 | rfk->poll_dev->input->name = rfk->name; | ||
151 | rfk->poll_dev->input->id.bustype = BUS_HOST; | ||
152 | rfk->poll_dev->input->id.vendor = dev->dev->bus->boardinfo.vendor; | ||
153 | rfk->poll_dev->input->evbit[0] = BIT(EV_KEY); | ||
154 | set_bit(KEY_WLAN, rfk->poll_dev->input->keybit); | ||
155 | |||
136 | err = rfkill_register(rfk->rfkill); | 156 | err = rfkill_register(rfk->rfkill); |
137 | if (err) | 157 | if (err) |
138 | goto err_free_polldev; | 158 | goto err_free_polldev; |
159 | |||
160 | #ifdef CONFIG_RFKILL_INPUT_MODULE | ||
161 | /* B43 RF-kill isn't useful without the rfkill-input subsystem. | ||
162 | * Try to load the module. */ | ||
163 | err = request_module("rfkill-input"); | ||
164 | if (err) | ||
165 | b43warn(wl, "Failed to load the rfkill-input module. " | ||
166 | "The built-in radio LED will not work.\n"); | ||
167 | #endif /* CONFIG_RFKILL_INPUT */ | ||
168 | |||
139 | err = input_register_polled_device(rfk->poll_dev); | 169 | err = input_register_polled_device(rfk->poll_dev); |
140 | if (err) | 170 | if (err) |
141 | goto err_unreg_rfk; | 171 | goto err_unreg_rfk; |
@@ -148,8 +178,7 @@ err_unreg_rfk: | |||
148 | err_free_polldev: | 178 | err_free_polldev: |
149 | input_free_polled_device(rfk->poll_dev); | 179 | input_free_polled_device(rfk->poll_dev); |
150 | rfk->poll_dev = NULL; | 180 | rfk->poll_dev = NULL; |
151 | err_free_rfk: | 181 | err_freed_rfk: |
152 | rfkill_free(rfk->rfkill); | ||
153 | rfk->rfkill = NULL; | 182 | rfk->rfkill = NULL; |
154 | out_error: | 183 | out_error: |
155 | rfk->registered = 0; | 184 | rfk->registered = 0; |
@@ -168,6 +197,5 @@ void b43_rfkill_exit(struct b43_wldev *dev) | |||
168 | rfkill_unregister(rfk->rfkill); | 197 | rfkill_unregister(rfk->rfkill); |
169 | input_free_polled_device(rfk->poll_dev); | 198 | input_free_polled_device(rfk->poll_dev); |
170 | rfk->poll_dev = NULL; | 199 | rfk->poll_dev = NULL; |
171 | rfkill_free(rfk->rfkill); | ||
172 | rfk->rfkill = NULL; | 200 | rfk->rfkill = NULL; |
173 | } | 201 | } |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 0bd6f8a348a8..3307ba1856b1 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -531,21 +531,32 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
531 | switch (chanstat & B43_RX_CHAN_PHYTYPE) { | 531 | switch (chanstat & B43_RX_CHAN_PHYTYPE) { |
532 | case B43_PHYTYPE_A: | 532 | case B43_PHYTYPE_A: |
533 | status.phymode = MODE_IEEE80211A; | 533 | status.phymode = MODE_IEEE80211A; |
534 | status.freq = chanid; | 534 | B43_WARN_ON(1); |
535 | status.channel = b43_freq_to_channel_a(chanid); | 535 | /* FIXME: We don't really know which value the "chanid" contains. |
536 | break; | 536 | * So the following assignment might be wrong. */ |
537 | case B43_PHYTYPE_B: | 537 | status.channel = chanid; |
538 | status.phymode = MODE_IEEE80211B; | 538 | status.freq = b43_channel_to_freq_5ghz(status.channel); |
539 | status.freq = chanid + 2400; | ||
540 | status.channel = b43_freq_to_channel_bg(chanid + 2400); | ||
541 | break; | 539 | break; |
542 | case B43_PHYTYPE_G: | 540 | case B43_PHYTYPE_G: |
543 | status.phymode = MODE_IEEE80211G; | 541 | status.phymode = MODE_IEEE80211G; |
542 | /* chanid is the radio channel cookie value as used | ||
543 | * to tune the radio. */ | ||
544 | status.freq = chanid + 2400; | 544 | status.freq = chanid + 2400; |
545 | status.channel = b43_freq_to_channel_bg(chanid + 2400); | 545 | status.channel = b43_freq_to_channel_2ghz(status.freq); |
546 | break; | ||
547 | case B43_PHYTYPE_N: | ||
548 | status.phymode = 0xDEAD /*FIXME MODE_IEEE80211N*/; | ||
549 | /* chanid is the SHM channel cookie. Which is the plain | ||
550 | * channel number in b43. */ | ||
551 | status.channel = chanid; | ||
552 | if (chanstat & B43_RX_CHAN_5GHZ) | ||
553 | status.freq = b43_freq_to_channel_5ghz(status.freq); | ||
554 | else | ||
555 | status.freq = b43_freq_to_channel_2ghz(status.freq); | ||
546 | break; | 556 | break; |
547 | default: | 557 | default: |
548 | B43_WARN_ON(1); | 558 | B43_WARN_ON(1); |
559 | goto drop; | ||
549 | } | 560 | } |
550 | 561 | ||
551 | dev->stats.last_rx = jiffies; | 562 | dev->stats.last_rx = jiffies; |
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h index 03bddd251618..6dc079382f7f 100644 --- a/drivers/net/wireless/b43/xmit.h +++ b/drivers/net/wireless/b43/xmit.h | |||
@@ -142,49 +142,56 @@ struct b43_rxhdr_fw4 { | |||
142 | } __attribute__ ((__packed__)); | 142 | } __attribute__ ((__packed__)); |
143 | 143 | ||
144 | /* PHY RX Status 0 */ | 144 | /* PHY RX Status 0 */ |
145 | #define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ | 145 | #define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ |
146 | #define B43_RX_PHYST0_PLCPHCF 0x0200 | 146 | #define B43_RX_PHYST0_PLCPHCF 0x0200 |
147 | #define B43_RX_PHYST0_PLCPFV 0x0100 | 147 | #define B43_RX_PHYST0_PLCPFV 0x0100 |
148 | #define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ | 148 | #define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ |
149 | #define B43_RX_PHYST0_LCRS 0x0040 | 149 | #define B43_RX_PHYST0_LCRS 0x0040 |
150 | #define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ | 150 | #define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ |
151 | #define B43_RX_PHYST0_UNSRATE 0x0010 | 151 | #define B43_RX_PHYST0_UNSRATE 0x0010 |
152 | #define B43_RX_PHYST0_CLIP 0x000C | 152 | #define B43_RX_PHYST0_CLIP 0x000C |
153 | #define B43_RX_PHYST0_CLIP_SHIFT 2 | 153 | #define B43_RX_PHYST0_CLIP_SHIFT 2 |
154 | #define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */ | 154 | #define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */ |
155 | #define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ | 155 | #define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ |
156 | #define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ | 156 | #define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ |
157 | #define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ | 157 | #define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ |
158 | #define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ | 158 | #define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ |
159 | 159 | ||
160 | /* PHY RX Status 2 */ | 160 | /* PHY RX Status 2 */ |
161 | #define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ | 161 | #define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ |
162 | #define B43_RX_PHYST2_LNAG_SHIFT 14 | 162 | #define B43_RX_PHYST2_LNAG_SHIFT 14 |
163 | #define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ | 163 | #define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ |
164 | #define B43_RX_PHYST2_PNAG_SHIFT 10 | 164 | #define B43_RX_PHYST2_PNAG_SHIFT 10 |
165 | #define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ | 165 | #define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ |
166 | 166 | ||
167 | /* PHY RX Status 3 */ | 167 | /* PHY RX Status 3 */ |
168 | #define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ | 168 | #define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ |
169 | #define B43_RX_PHYST3_DIGG_SHIFT 11 | 169 | #define B43_RX_PHYST3_DIGG_SHIFT 11 |
170 | #define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */ | 170 | #define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */ |
171 | 171 | ||
172 | /* MAC RX Status */ | 172 | /* MAC RX Status */ |
173 | #define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon send flag */ | 173 | #define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */ |
174 | #define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */ | 174 | #define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */ |
175 | #define B43_RX_MAC_KEYIDX_SHIFT 5 | 175 | #define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */ |
176 | #define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */ | 176 | #define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */ |
177 | #define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */ | 177 | #define B43_RX_MAC_AGGTYPE_SHIFT 17 |
178 | #define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ | 178 | #define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */ |
179 | #define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */ | 179 | #define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */ |
180 | #define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */ | 180 | #define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */ |
181 | #define B43_RX_MAC_KEYIDX_SHIFT 5 | ||
182 | #define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */ | ||
183 | #define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */ | ||
184 | #define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ | ||
185 | #define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */ | ||
186 | #define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */ | ||
181 | 187 | ||
182 | /* RX channel */ | 188 | /* RX channel */ |
183 | #define B43_RX_CHAN_GAIN 0xFC00 /* Gain */ | 189 | #define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */ |
184 | #define B43_RX_CHAN_GAIN_SHIFT 10 | 190 | #define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */ |
185 | #define B43_RX_CHAN_ID 0x03FC /* Channel ID */ | 191 | #define B43_RX_CHAN_ID 0x07F8 /* Channel ID */ |
186 | #define B43_RX_CHAN_ID_SHIFT 2 | 192 | #define B43_RX_CHAN_ID_SHIFT 3 |
187 | #define B43_RX_CHAN_PHYTYPE 0x0003 /* PHY type */ | 193 | #define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */ |
194 | |||
188 | 195 | ||
189 | u8 b43_plcp_get_ratecode_cck(const u8 bitrate); | 196 | u8 b43_plcp_get_ratecode_cck(const u8 bitrate); |
190 | u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); | 197 | u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); |
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c index 8cb3dc4c4745..83161d9af813 100644 --- a/drivers/net/wireless/b43legacy/dma.c +++ b/drivers/net/wireless/b43legacy/dma.c | |||
@@ -996,7 +996,7 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev) | |||
996 | 996 | ||
997 | err = ssb_dma_set_mask(dev->dev, dmamask); | 997 | err = ssb_dma_set_mask(dev->dev, dmamask); |
998 | if (err) { | 998 | if (err) { |
999 | #ifdef BCM43XX_PIO | 999 | #ifdef CONFIG_B43LEGACY_PIO |
1000 | b43legacywarn(dev->wl, "DMA for this device not supported. " | 1000 | b43legacywarn(dev->wl, "DMA for this device not supported. " |
1001 | "Falling back to PIO\n"); | 1001 | "Falling back to PIO\n"); |
1002 | dev->__using_pio = 1; | 1002 | dev->__using_pio = 1; |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 3bde1e9ab428..32d5e1785bda 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -1419,7 +1419,7 @@ static void b43legacy_release_firmware(struct b43legacy_wldev *dev) | |||
1419 | static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) | 1419 | static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) |
1420 | { | 1420 | { |
1421 | b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/" | 1421 | b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/" |
1422 | "Drivers/bcm43xx#devicefirmware " | 1422 | "Drivers/b43#devicefirmware " |
1423 | "and download the correct firmware (version 3).\n"); | 1423 | "and download the correct firmware (version 3).\n"); |
1424 | } | 1424 | } |
1425 | 1425 | ||
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c index 22a4b3d0186d..491e518e4aeb 100644 --- a/drivers/net/wireless/b43legacy/phy.c +++ b/drivers/net/wireless/b43legacy/phy.c | |||
@@ -2020,7 +2020,7 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev) | |||
2020 | phy->idle_tssi = 62; | 2020 | phy->idle_tssi = 62; |
2021 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); | 2021 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); |
2022 | if (dyn_tssi2dbm == NULL) { | 2022 | if (dyn_tssi2dbm == NULL) { |
2023 | b43legacyerr(dev->wl, "Could not allocate memory" | 2023 | b43legacyerr(dev->wl, "Could not allocate memory " |
2024 | "for tssi2dbm table\n"); | 2024 | "for tssi2dbm table\n"); |
2025 | return -ENOMEM; | 2025 | return -ENOMEM; |
2026 | } | 2026 | } |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c index 35dbe4554513..76e9dd843faa 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c | |||
@@ -219,7 +219,7 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf, | |||
219 | ssize_t buf_size; | 219 | ssize_t buf_size; |
220 | ssize_t res; | 220 | ssize_t res; |
221 | unsigned long flags; | 221 | unsigned long flags; |
222 | u64 tsf; | 222 | unsigned long long tsf; |
223 | 223 | ||
224 | buf_size = min(count, sizeof (really_big_buffer) - 1); | 224 | buf_size = min(count, sizeof (really_big_buffer) - 1); |
225 | down(&big_buffer_sem); | 225 | down(&big_buffer_sem); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index b37f1e348700..af3de3343650 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -2149,7 +2149,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm) | |||
2149 | } | 2149 | } |
2150 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); | 2150 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); |
2151 | if (dyn_tssi2dbm == NULL) { | 2151 | if (dyn_tssi2dbm == NULL) { |
2152 | printk(KERN_ERR PFX "Could not allocate memory" | 2152 | printk(KERN_ERR PFX "Could not allocate memory " |
2153 | "for tssi2dbm table\n"); | 2153 | "for tssi2dbm table\n"); |
2154 | return -ENOMEM; | 2154 | return -ENOMEM; |
2155 | } | 2155 | } |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index 040dc3e36410..cbf15d703201 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -608,7 +608,7 @@ static void prism2_plx_remove(struct pci_dev *pdev) | |||
608 | 608 | ||
609 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); | 609 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); |
610 | 610 | ||
611 | static struct pci_driver prism2_plx_drv_id = { | 611 | static struct pci_driver prism2_plx_driver = { |
612 | .name = "hostap_plx", | 612 | .name = "hostap_plx", |
613 | .id_table = prism2_plx_id_table, | 613 | .id_table = prism2_plx_id_table, |
614 | .probe = prism2_plx_probe, | 614 | .probe = prism2_plx_probe, |
@@ -618,13 +618,13 @@ static struct pci_driver prism2_plx_drv_id = { | |||
618 | 618 | ||
619 | static int __init init_prism2_plx(void) | 619 | static int __init init_prism2_plx(void) |
620 | { | 620 | { |
621 | return pci_register_driver(&prism2_plx_drv_id); | 621 | return pci_register_driver(&prism2_plx_driver); |
622 | } | 622 | } |
623 | 623 | ||
624 | 624 | ||
625 | static void __exit exit_prism2_plx(void) | 625 | static void __exit exit_prism2_plx(void) |
626 | { | 626 | { |
627 | pci_unregister_driver(&prism2_plx_drv_id); | 627 | pci_unregister_driver(&prism2_plx_driver); |
628 | } | 628 | } |
629 | 629 | ||
630 | 630 | ||
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 54f44e5473c0..003f73f89efa 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d, | |||
1233 | { | 1233 | { |
1234 | struct ipw_priv *priv = dev_get_drvdata(d); | 1234 | struct ipw_priv *priv = dev_get_drvdata(d); |
1235 | u32 log_len = ipw_get_event_log_len(priv); | 1235 | u32 log_len = ipw_get_event_log_len(priv); |
1236 | struct ipw_event log[log_len]; | 1236 | u32 log_size; |
1237 | struct ipw_event *log; | ||
1237 | u32 len = 0, i; | 1238 | u32 len = 0, i; |
1238 | 1239 | ||
1240 | /* not using min() because of its strict type checking */ | ||
1241 | log_size = PAGE_SIZE / sizeof(*log) > log_len ? | ||
1242 | sizeof(*log) * log_len : PAGE_SIZE; | ||
1243 | log = kzalloc(log_size, GFP_KERNEL); | ||
1244 | if (!log) { | ||
1245 | IPW_ERROR("Unable to allocate memory for log\n"); | ||
1246 | return 0; | ||
1247 | } | ||
1248 | log_len = log_size / sizeof(*log); | ||
1239 | ipw_capture_event_log(priv, log_len, log); | 1249 | ipw_capture_event_log(priv, log_len, log); |
1240 | 1250 | ||
1241 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); | 1251 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); |
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d, | |||
1244 | "\n%08X%08X%08X", | 1254 | "\n%08X%08X%08X", |
1245 | log[i].time, log[i].event, log[i].data); | 1255 | log[i].time, log[i].event, log[i].data); |
1246 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | 1256 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); |
1257 | kfree(log); | ||
1247 | return len; | 1258 | return len; |
1248 | } | 1259 | } |
1249 | 1260 | ||
@@ -4924,7 +4935,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
4924 | /** | 4935 | /** |
4925 | * Reclaim Tx queue entries no more used by NIC. | 4936 | * Reclaim Tx queue entries no more used by NIC. |
4926 | * | 4937 | * |
4927 | * When FW adwances 'R' index, all entries between old and | 4938 | * When FW advances 'R' index, all entries between old and |
4928 | * new 'R' index need to be reclaimed. As result, some free space | 4939 | * new 'R' index need to be reclaimed. As result, some free space |
4929 | * forms. If there is enough free space (> low mark), wake Tx queue. | 4940 | * forms. If there is enough free space (> low mark), wake Tx queue. |
4930 | * | 4941 | * |
@@ -10751,7 +10762,7 @@ static void ipw_bg_link_down(struct work_struct *work) | |||
10751 | mutex_unlock(&priv->mutex); | 10762 | mutex_unlock(&priv->mutex); |
10752 | } | 10763 | } |
10753 | 10764 | ||
10754 | static int ipw_setup_deferred_work(struct ipw_priv *priv) | 10765 | static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv) |
10755 | { | 10766 | { |
10756 | int ret = 0; | 10767 | int ret = 0; |
10757 | 10768 | ||
@@ -11600,7 +11611,8 @@ static void ipw_prom_free(struct ipw_priv *priv) | |||
11600 | #endif | 11611 | #endif |
11601 | 11612 | ||
11602 | 11613 | ||
11603 | static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 11614 | static int __devinit ipw_pci_probe(struct pci_dev *pdev, |
11615 | const struct pci_device_id *ent) | ||
11604 | { | 11616 | { |
11605 | int err = 0; | 11617 | int err = 0; |
11606 | struct net_device *net_dev; | 11618 | struct net_device *net_dev; |
@@ -11767,7 +11779,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
11767 | return err; | 11779 | return err; |
11768 | } | 11780 | } |
11769 | 11781 | ||
11770 | static void ipw_pci_remove(struct pci_dev *pdev) | 11782 | static void __devexit ipw_pci_remove(struct pci_dev *pdev) |
11771 | { | 11783 | { |
11772 | struct ipw_priv *priv = pci_get_drvdata(pdev); | 11784 | struct ipw_priv *priv = pci_get_drvdata(pdev); |
11773 | struct list_head *p, *q; | 11785 | struct list_head *p, *q; |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 465da4f67ce7..0b3ec7e4d93b 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2915,6 +2915,10 @@ static void iwl_set_rate(struct iwl_priv *priv) | |||
2915 | int i; | 2915 | int i; |
2916 | 2916 | ||
2917 | hw = iwl_get_hw_mode(priv, priv->phymode); | 2917 | hw = iwl_get_hw_mode(priv, priv->phymode); |
2918 | if (!hw) { | ||
2919 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); | ||
2920 | return; | ||
2921 | } | ||
2918 | 2922 | ||
2919 | priv->active_rate = 0; | 2923 | priv->active_rate = 0; |
2920 | priv->active_rate_basic = 0; | 2924 | priv->active_rate_basic = 0; |
@@ -4739,8 +4743,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
4739 | * when we loaded driver, and is now set to "enable". | 4743 | * when we loaded driver, and is now set to "enable". |
4740 | * After we're Alive, RF_KILL gets handled by | 4744 | * After we're Alive, RF_KILL gets handled by |
4741 | * iwl_rx_card_state_notif() */ | 4745 | * iwl_rx_card_state_notif() */ |
4742 | if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) | 4746 | if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) { |
4747 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | ||
4743 | queue_work(priv->workqueue, &priv->restart); | 4748 | queue_work(priv->workqueue, &priv->restart); |
4749 | } | ||
4744 | 4750 | ||
4745 | handled |= CSR_INT_BIT_RF_KILL; | 4751 | handled |= CSR_INT_BIT_RF_KILL; |
4746 | } | 4752 | } |
@@ -6167,6 +6173,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
6167 | mutex_lock(&priv->mutex); | 6173 | mutex_lock(&priv->mutex); |
6168 | 6174 | ||
6169 | if (rc) { | 6175 | if (rc) { |
6176 | iwl_rate_control_unregister(priv->hw); | ||
6170 | IWL_ERROR("Failed to register network " | 6177 | IWL_ERROR("Failed to register network " |
6171 | "device (error %d)\n", rc); | 6178 | "device (error %d)\n", rc); |
6172 | return; | 6179 | return; |
@@ -6239,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv) | |||
6239 | /* Unblock any waiting calls */ | 6246 | /* Unblock any waiting calls */ |
6240 | wake_up_interruptible_all(&priv->wait_command_queue); | 6247 | wake_up_interruptible_all(&priv->wait_command_queue); |
6241 | 6248 | ||
6242 | iwl_cancel_deferred_work(priv); | ||
6243 | |||
6244 | /* Wipe out the EXIT_PENDING status bit if we are not actually | 6249 | /* Wipe out the EXIT_PENDING status bit if we are not actually |
6245 | * exiting the module */ | 6250 | * exiting the module */ |
6246 | if (!exit_pending) | 6251 | if (!exit_pending) |
@@ -6315,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv) | |||
6315 | mutex_lock(&priv->mutex); | 6320 | mutex_lock(&priv->mutex); |
6316 | __iwl_down(priv); | 6321 | __iwl_down(priv); |
6317 | mutex_unlock(&priv->mutex); | 6322 | mutex_unlock(&priv->mutex); |
6323 | |||
6324 | iwl_cancel_deferred_work(priv); | ||
6318 | } | 6325 | } |
6319 | 6326 | ||
6320 | #define MAX_HW_RESTARTS 5 | 6327 | #define MAX_HW_RESTARTS 5 |
@@ -6335,6 +6342,11 @@ static int __iwl_up(struct iwl_priv *priv) | |||
6335 | return 0; | 6342 | return 0; |
6336 | } | 6343 | } |
6337 | 6344 | ||
6345 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | ||
6346 | IWL_ERROR("ucode not available for device bringup\n"); | ||
6347 | return -EIO; | ||
6348 | } | ||
6349 | |||
6338 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 6350 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
6339 | 6351 | ||
6340 | rc = iwl_hw_nic_init(priv); | 6352 | rc = iwl_hw_nic_init(priv); |
@@ -6936,13 +6948,10 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
6936 | DECLARE_MAC_BUF(mac); | 6948 | DECLARE_MAC_BUF(mac); |
6937 | 6949 | ||
6938 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 6950 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); |
6939 | if (conf->mac_addr) | ||
6940 | IWL_DEBUG_MAC80211("enter: MAC %s\n", | ||
6941 | print_mac(mac, conf->mac_addr)); | ||
6942 | 6951 | ||
6943 | if (priv->interface_id) { | 6952 | if (priv->interface_id) { |
6944 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 6953 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); |
6945 | return 0; | 6954 | return -EOPNOTSUPP; |
6946 | } | 6955 | } |
6947 | 6956 | ||
6948 | spin_lock_irqsave(&priv->lock, flags); | 6957 | spin_lock_irqsave(&priv->lock, flags); |
@@ -6951,6 +6960,12 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
6951 | spin_unlock_irqrestore(&priv->lock, flags); | 6960 | spin_unlock_irqrestore(&priv->lock, flags); |
6952 | 6961 | ||
6953 | mutex_lock(&priv->mutex); | 6962 | mutex_lock(&priv->mutex); |
6963 | |||
6964 | if (conf->mac_addr) { | ||
6965 | IWL_DEBUG_MAC80211("Set: %s\n", print_mac(mac, conf->mac_addr)); | ||
6966 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | ||
6967 | } | ||
6968 | |||
6954 | iwl_set_mode(priv, conf->type); | 6969 | iwl_set_mode(priv, conf->type); |
6955 | 6970 | ||
6956 | IWL_DEBUG_MAC80211("leave\n"); | 6971 | IWL_DEBUG_MAC80211("leave\n"); |
@@ -8270,6 +8285,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
8270 | { | 8285 | { |
8271 | iwl_hw_cancel_deferred_work(priv); | 8286 | iwl_hw_cancel_deferred_work(priv); |
8272 | 8287 | ||
8288 | cancel_delayed_work_sync(&priv->init_alive_start); | ||
8273 | cancel_delayed_work(&priv->scan_check); | 8289 | cancel_delayed_work(&priv->scan_check); |
8274 | cancel_delayed_work(&priv->alive_start); | 8290 | cancel_delayed_work(&priv->alive_start); |
8275 | cancel_delayed_work(&priv->post_associate); | 8291 | cancel_delayed_work(&priv->post_associate); |
@@ -8569,10 +8585,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
8569 | 8585 | ||
8570 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); | 8586 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); |
8571 | 8587 | ||
8572 | mutex_lock(&priv->mutex); | ||
8573 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 8588 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
8574 | __iwl_down(priv); | 8589 | |
8575 | mutex_unlock(&priv->mutex); | 8590 | iwl_down(priv); |
8576 | 8591 | ||
8577 | /* Free MAC hash list for ADHOC */ | 8592 | /* Free MAC hash list for ADHOC */ |
8578 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { | 8593 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { |
@@ -8631,12 +8646,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
8631 | { | 8646 | { |
8632 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 8647 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
8633 | 8648 | ||
8634 | mutex_lock(&priv->mutex); | ||
8635 | |||
8636 | set_bit(STATUS_IN_SUSPEND, &priv->status); | 8649 | set_bit(STATUS_IN_SUSPEND, &priv->status); |
8637 | 8650 | ||
8638 | /* Take down the device; powers it off, etc. */ | 8651 | /* Take down the device; powers it off, etc. */ |
8639 | __iwl_down(priv); | 8652 | iwl_down(priv); |
8640 | 8653 | ||
8641 | if (priv->mac80211_registered) | 8654 | if (priv->mac80211_registered) |
8642 | ieee80211_stop_queues(priv->hw); | 8655 | ieee80211_stop_queues(priv->hw); |
@@ -8645,8 +8658,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
8645 | pci_disable_device(pdev); | 8658 | pci_disable_device(pdev); |
8646 | pci_set_power_state(pdev, PCI_D3hot); | 8659 | pci_set_power_state(pdev, PCI_D3hot); |
8647 | 8660 | ||
8648 | mutex_unlock(&priv->mutex); | ||
8649 | |||
8650 | return 0; | 8661 | return 0; |
8651 | } | 8662 | } |
8652 | 8663 | ||
@@ -8704,8 +8715,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
8704 | 8715 | ||
8705 | printk(KERN_INFO "Coming out of suspend...\n"); | 8716 | printk(KERN_INFO "Coming out of suspend...\n"); |
8706 | 8717 | ||
8707 | mutex_lock(&priv->mutex); | ||
8708 | |||
8709 | pci_set_power_state(pdev, PCI_D0); | 8718 | pci_set_power_state(pdev, PCI_D0); |
8710 | err = pci_enable_device(pdev); | 8719 | err = pci_enable_device(pdev); |
8711 | pci_restore_state(pdev); | 8720 | pci_restore_state(pdev); |
@@ -8719,7 +8728,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
8719 | pci_write_config_byte(pdev, 0x41, 0x00); | 8728 | pci_write_config_byte(pdev, 0x41, 0x00); |
8720 | 8729 | ||
8721 | iwl_resume(priv); | 8730 | iwl_resume(priv); |
8722 | mutex_unlock(&priv->mutex); | ||
8723 | 8731 | ||
8724 | return 0; | 8732 | return 0; |
8725 | } | 8733 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 9918780f5e86..15a45f471710 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -3003,6 +3003,10 @@ static void iwl_set_rate(struct iwl_priv *priv) | |||
3003 | int i; | 3003 | int i; |
3004 | 3004 | ||
3005 | hw = iwl_get_hw_mode(priv, priv->phymode); | 3005 | hw = iwl_get_hw_mode(priv, priv->phymode); |
3006 | if (!hw) { | ||
3007 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); | ||
3008 | return; | ||
3009 | } | ||
3006 | 3010 | ||
3007 | priv->active_rate = 0; | 3011 | priv->active_rate = 0; |
3008 | priv->active_rate_basic = 0; | 3012 | priv->active_rate_basic = 0; |
@@ -5055,8 +5059,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
5055 | * when we loaded driver, and is now set to "enable". | 5059 | * when we loaded driver, and is now set to "enable". |
5056 | * After we're Alive, RF_KILL gets handled by | 5060 | * After we're Alive, RF_KILL gets handled by |
5057 | * iwl_rx_card_state_notif() */ | 5061 | * iwl_rx_card_state_notif() */ |
5058 | if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) | 5062 | if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) { |
5063 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | ||
5059 | queue_work(priv->workqueue, &priv->restart); | 5064 | queue_work(priv->workqueue, &priv->restart); |
5065 | } | ||
5060 | 5066 | ||
5061 | handled |= CSR_INT_BIT_RF_KILL; | 5067 | handled |= CSR_INT_BIT_RF_KILL; |
5062 | } | 5068 | } |
@@ -6523,6 +6529,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
6523 | mutex_lock(&priv->mutex); | 6529 | mutex_lock(&priv->mutex); |
6524 | 6530 | ||
6525 | if (rc) { | 6531 | if (rc) { |
6532 | iwl_rate_control_unregister(priv->hw); | ||
6526 | IWL_ERROR("Failed to register network " | 6533 | IWL_ERROR("Failed to register network " |
6527 | "device (error %d)\n", rc); | 6534 | "device (error %d)\n", rc); |
6528 | return; | 6535 | return; |
@@ -6594,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv) | |||
6594 | /* Unblock any waiting calls */ | 6601 | /* Unblock any waiting calls */ |
6595 | wake_up_interruptible_all(&priv->wait_command_queue); | 6602 | wake_up_interruptible_all(&priv->wait_command_queue); |
6596 | 6603 | ||
6597 | iwl_cancel_deferred_work(priv); | ||
6598 | |||
6599 | /* Wipe out the EXIT_PENDING status bit if we are not actually | 6604 | /* Wipe out the EXIT_PENDING status bit if we are not actually |
6600 | * exiting the module */ | 6605 | * exiting the module */ |
6601 | if (!exit_pending) | 6606 | if (!exit_pending) |
@@ -6670,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv) | |||
6670 | mutex_lock(&priv->mutex); | 6675 | mutex_lock(&priv->mutex); |
6671 | __iwl_down(priv); | 6676 | __iwl_down(priv); |
6672 | mutex_unlock(&priv->mutex); | 6677 | mutex_unlock(&priv->mutex); |
6678 | |||
6679 | iwl_cancel_deferred_work(priv); | ||
6673 | } | 6680 | } |
6674 | 6681 | ||
6675 | #define MAX_HW_RESTARTS 5 | 6682 | #define MAX_HW_RESTARTS 5 |
@@ -6691,6 +6698,11 @@ static int __iwl_up(struct iwl_priv *priv) | |||
6691 | return 0; | 6698 | return 0; |
6692 | } | 6699 | } |
6693 | 6700 | ||
6701 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | ||
6702 | IWL_ERROR("ucode not available for device bringup\n"); | ||
6703 | return -EIO; | ||
6704 | } | ||
6705 | |||
6694 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 6706 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
6695 | 6707 | ||
6696 | rc = iwl_hw_nic_init(priv); | 6708 | rc = iwl_hw_nic_init(priv); |
@@ -7326,9 +7338,6 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
7326 | DECLARE_MAC_BUF(mac); | 7338 | DECLARE_MAC_BUF(mac); |
7327 | 7339 | ||
7328 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 7340 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); |
7329 | if (conf->mac_addr) | ||
7330 | IWL_DEBUG_MAC80211("enter: MAC %s\n", | ||
7331 | print_mac(mac, conf->mac_addr)); | ||
7332 | 7341 | ||
7333 | if (priv->interface_id) { | 7342 | if (priv->interface_id) { |
7334 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 7343 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); |
@@ -7341,6 +7350,11 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
7341 | spin_unlock_irqrestore(&priv->lock, flags); | 7350 | spin_unlock_irqrestore(&priv->lock, flags); |
7342 | 7351 | ||
7343 | mutex_lock(&priv->mutex); | 7352 | mutex_lock(&priv->mutex); |
7353 | |||
7354 | if (conf->mac_addr) { | ||
7355 | IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr)); | ||
7356 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | ||
7357 | } | ||
7344 | iwl_set_mode(priv, conf->type); | 7358 | iwl_set_mode(priv, conf->type); |
7345 | 7359 | ||
7346 | IWL_DEBUG_MAC80211("leave\n"); | 7360 | IWL_DEBUG_MAC80211("leave\n"); |
@@ -8864,6 +8878,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
8864 | { | 8878 | { |
8865 | iwl_hw_cancel_deferred_work(priv); | 8879 | iwl_hw_cancel_deferred_work(priv); |
8866 | 8880 | ||
8881 | cancel_delayed_work_sync(&priv->init_alive_start); | ||
8867 | cancel_delayed_work(&priv->scan_check); | 8882 | cancel_delayed_work(&priv->scan_check); |
8868 | cancel_delayed_work(&priv->alive_start); | 8883 | cancel_delayed_work(&priv->alive_start); |
8869 | cancel_delayed_work(&priv->post_associate); | 8884 | cancel_delayed_work(&priv->post_associate); |
@@ -9164,10 +9179,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
9164 | 9179 | ||
9165 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); | 9180 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); |
9166 | 9181 | ||
9167 | mutex_lock(&priv->mutex); | ||
9168 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 9182 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
9169 | __iwl_down(priv); | 9183 | |
9170 | mutex_unlock(&priv->mutex); | 9184 | iwl_down(priv); |
9171 | 9185 | ||
9172 | /* Free MAC hash list for ADHOC */ | 9186 | /* Free MAC hash list for ADHOC */ |
9173 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { | 9187 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { |
@@ -9226,12 +9240,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
9226 | { | 9240 | { |
9227 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 9241 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
9228 | 9242 | ||
9229 | mutex_lock(&priv->mutex); | ||
9230 | |||
9231 | set_bit(STATUS_IN_SUSPEND, &priv->status); | 9243 | set_bit(STATUS_IN_SUSPEND, &priv->status); |
9232 | 9244 | ||
9233 | /* Take down the device; powers it off, etc. */ | 9245 | /* Take down the device; powers it off, etc. */ |
9234 | __iwl_down(priv); | 9246 | iwl_down(priv); |
9235 | 9247 | ||
9236 | if (priv->mac80211_registered) | 9248 | if (priv->mac80211_registered) |
9237 | ieee80211_stop_queues(priv->hw); | 9249 | ieee80211_stop_queues(priv->hw); |
@@ -9240,8 +9252,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
9240 | pci_disable_device(pdev); | 9252 | pci_disable_device(pdev); |
9241 | pci_set_power_state(pdev, PCI_D3hot); | 9253 | pci_set_power_state(pdev, PCI_D3hot); |
9242 | 9254 | ||
9243 | mutex_unlock(&priv->mutex); | ||
9244 | |||
9245 | return 0; | 9255 | return 0; |
9246 | } | 9256 | } |
9247 | 9257 | ||
@@ -9299,8 +9309,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
9299 | 9309 | ||
9300 | printk(KERN_INFO "Coming out of suspend...\n"); | 9310 | printk(KERN_INFO "Coming out of suspend...\n"); |
9301 | 9311 | ||
9302 | mutex_lock(&priv->mutex); | ||
9303 | |||
9304 | pci_set_power_state(pdev, PCI_D0); | 9312 | pci_set_power_state(pdev, PCI_D0); |
9305 | err = pci_enable_device(pdev); | 9313 | err = pci_enable_device(pdev); |
9306 | pci_restore_state(pdev); | 9314 | pci_restore_state(pdev); |
@@ -9314,7 +9322,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
9314 | pci_write_config_byte(pdev, 0x41, 0x00); | 9322 | pci_write_config_byte(pdev, 0x41, 0x00); |
9315 | 9323 | ||
9316 | iwl_resume(priv); | 9324 | iwl_resume(priv); |
9317 | mutex_unlock(&priv->mutex); | ||
9318 | 9325 | ||
9319 | return 0; | 9326 | return 0; |
9320 | } | 9327 | } |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index ec89dabc412c..ba4fc2b3bf0a 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -170,7 +170,8 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r | |||
170 | #define IF_CS_H_IC_TX_OVER 0x0001 | 170 | #define IF_CS_H_IC_TX_OVER 0x0001 |
171 | #define IF_CS_H_IC_RX_OVER 0x0002 | 171 | #define IF_CS_H_IC_RX_OVER 0x0002 |
172 | #define IF_CS_H_IC_DNLD_OVER 0x0004 | 172 | #define IF_CS_H_IC_DNLD_OVER 0x0004 |
173 | #define IF_CS_H_IC_HOST_EVENT 0x0008 | 173 | #define IF_CS_H_IC_POWER_DOWN 0x0008 |
174 | #define IF_CS_H_IC_HOST_EVENT 0x0010 | ||
174 | #define IF_CS_H_IC_MASK 0x001f | 175 | #define IF_CS_H_IC_MASK 0x001f |
175 | 176 | ||
176 | #define IF_CS_H_INT_MASK 0x00000004 | 177 | #define IF_CS_H_INT_MASK 0x00000004 |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index b24425f74883..4f1efb108c28 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -871,6 +871,10 @@ static int if_sdio_probe(struct sdio_func *func, | |||
871 | if (sscanf(func->card->info[i], | 871 | if (sscanf(func->card->info[i], |
872 | "ID: %x", &model) == 1) | 872 | "ID: %x", &model) == 1) |
873 | break; | 873 | break; |
874 | if (!strcmp(func->card->info[i], "IBIS Wireless SDIO Card")) { | ||
875 | model = 4; | ||
876 | break; | ||
877 | } | ||
874 | } | 878 | } |
875 | 879 | ||
876 | if (i == func->card->num_info) { | 880 | if (i == func->card->num_info) { |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 5ead08312e1e..1823b48a8ba7 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -1165,8 +1165,6 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev) | |||
1165 | #ifdef WIRELESS_EXT | 1165 | #ifdef WIRELESS_EXT |
1166 | dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; | 1166 | dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; |
1167 | #endif | 1167 | #endif |
1168 | #define NETIF_F_DYNALLOC 16 | ||
1169 | dev->features |= NETIF_F_DYNALLOC; | ||
1170 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; | 1168 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; |
1171 | dev->set_multicast_list = libertas_set_multicast_list; | 1169 | dev->set_multicast_list = libertas_set_multicast_list; |
1172 | 1170 | ||
@@ -1348,8 +1346,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev) | |||
1348 | #ifdef WIRELESS_EXT | 1346 | #ifdef WIRELESS_EXT |
1349 | mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; | 1347 | mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; |
1350 | #endif | 1348 | #endif |
1351 | #define NETIF_F_DYNALLOC 16 | ||
1352 | |||
1353 | /* Register virtual mesh interface */ | 1349 | /* Register virtual mesh interface */ |
1354 | ret = register_netdev(mesh_dev); | 1350 | ret = register_netdev(mesh_dev); |
1355 | if (ret) { | 1351 | if (ret) { |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index c6f5aa3cb465..395b7882d4d6 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -1528,7 +1528,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1528 | && (ext->key_len != KEY_LEN_WPA_TKIP)) | 1528 | && (ext->key_len != KEY_LEN_WPA_TKIP)) |
1529 | || ((alg == IW_ENCODE_ALG_CCMP) | 1529 | || ((alg == IW_ENCODE_ALG_CCMP) |
1530 | && (ext->key_len != KEY_LEN_WPA_AES))) { | 1530 | && (ext->key_len != KEY_LEN_WPA_AES))) { |
1531 | lbs_deb_wext("invalid size %d for key of alg" | 1531 | lbs_deb_wext("invalid size %d for key of alg " |
1532 | "type %d\n", | 1532 | "type %d\n", |
1533 | ext->key_len, | 1533 | ext->key_len, |
1534 | alg); | 1534 | alg); |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 2402cb8dd328..d2fa079fbc4c 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -806,7 +806,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
806 | for (i = 0; i < 6; i++) | 806 | for (i = 0; i < 6; i++) |
807 | dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); | 807 | dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); |
808 | 808 | ||
809 | printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx" | 809 | printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx, " |
810 | "id %c%c, hw_addr %s\n", | 810 | "id %c%c, hw_addr %s\n", |
811 | dev->name, dev->base_addr, dev->irq, | 811 | dev->name, dev->base_addr, dev->irq, |
812 | (u_long) ramBase, | 812 | (u_long) ramBase, |
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c index 755482a5a938..60d286eb0b8b 100644 --- a/drivers/net/wireless/p54usb.c +++ b/drivers/net/wireless/p54usb.c | |||
@@ -308,7 +308,7 @@ static int p54u_read_eeprom(struct ieee80211_hw *dev) | |||
308 | 308 | ||
309 | buf = kmalloc(0x2020, GFP_KERNEL); | 309 | buf = kmalloc(0x2020, GFP_KERNEL); |
310 | if (!buf) { | 310 | if (!buf) { |
311 | printk(KERN_ERR "prism54usb: cannot allocate memory for" | 311 | printk(KERN_ERR "prism54usb: cannot allocate memory for " |
312 | "eeprom readback!\n"); | 312 | "eeprom readback!\n"); |
313 | return -ENOMEM; | 313 | return -ENOMEM; |
314 | } | 314 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 277a020b35e9..18b1f9145389 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { | |||
257 | static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, | 257 | static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, |
258 | __le32 *mac) | 258 | __le32 *mac) |
259 | { | 259 | { |
260 | rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac, | 260 | rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac, |
261 | (3 * sizeof(__le16))); | 261 | (3 * sizeof(__le16))); |
262 | } | 262 | } |
263 | 263 | ||
@@ -1032,7 +1032,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | 1034 | static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, |
1035 | int maxpacket, struct sk_buff *skb) | 1035 | struct sk_buff *skb) |
1036 | { | 1036 | { |
1037 | int length; | 1037 | int length; |
1038 | 1038 | ||
@@ -1041,7 +1041,7 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | |||
1041 | * but it must _not_ be a multiple of the USB packet size. | 1041 | * but it must _not_ be a multiple of the USB packet size. |
1042 | */ | 1042 | */ |
1043 | length = roundup(skb->len, 2); | 1043 | length = roundup(skb->len, 2); |
1044 | length += (2 * !(length % maxpacket)); | 1044 | length += (2 * !(length % rt2x00dev->usb_maxpacket)); |
1045 | 1045 | ||
1046 | return length; | 1046 | return length; |
1047 | } | 1047 | } |
@@ -1643,7 +1643,6 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1643 | struct data_entry *beacon; | 1643 | struct data_entry *beacon; |
1644 | struct data_entry *guardian; | 1644 | struct data_entry *guardian; |
1645 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 1645 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
1646 | int max_packet = usb_maxpacket(usb_dev, pipe, 1); | ||
1647 | int length; | 1646 | int length; |
1648 | 1647 | ||
1649 | /* | 1648 | /* |
@@ -1672,7 +1671,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1672 | ring->desc_size), | 1671 | ring->desc_size), |
1673 | skb->len - ring->desc_size, control); | 1672 | skb->len - ring->desc_size, control); |
1674 | 1673 | ||
1675 | length = rt2500usb_get_tx_data_len(rt2x00dev, max_packet, skb); | 1674 | length = rt2500usb_get_tx_data_len(rt2x00dev, skb); |
1676 | 1675 | ||
1677 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, | 1676 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, |
1678 | skb->data, length, rt2500usb_beacondone, beacon); | 1677 | skb->data, length, rt2500usb_beacondone, beacon); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index d1ad5251a77a..c8f16f161c28 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -418,7 +418,7 @@ struct rt2x00lib_ops { | |||
418 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, | 418 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, |
419 | struct data_ring *ring, struct sk_buff *skb, | 419 | struct data_ring *ring, struct sk_buff *skb, |
420 | struct ieee80211_tx_control *control); | 420 | struct ieee80211_tx_control *control); |
421 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, int maxpacket, | 421 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, |
422 | struct sk_buff *skb); | 422 | struct sk_buff *skb); |
423 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | 423 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, |
424 | unsigned int queue); | 424 | unsigned int queue); |
@@ -599,6 +599,11 @@ struct rt2x00_dev { | |||
599 | u32 *rf; | 599 | u32 *rf; |
600 | 600 | ||
601 | /* | 601 | /* |
602 | * USB Max frame size (for rt2500usb & rt73usb). | ||
603 | */ | ||
604 | u16 usb_maxpacket; | ||
605 | |||
606 | /* | ||
602 | * Current TX power value. | 607 | * Current TX power value. |
603 | */ | 608 | */ |
604 | u16 tx_power; | 609 | u16 tx_power; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 2780df00623c..04663eb31950 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -124,7 +124,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
124 | struct data_entry *entry; | 124 | struct data_entry *entry; |
125 | struct data_desc *rxd; | 125 | struct data_desc *rxd; |
126 | struct sk_buff *skb; | 126 | struct sk_buff *skb; |
127 | struct ieee80211_hdr *hdr; | ||
127 | struct rxdata_entry_desc desc; | 128 | struct rxdata_entry_desc desc; |
129 | int header_size; | ||
130 | int align; | ||
128 | u32 word; | 131 | u32 word; |
129 | 132 | ||
130 | while (1) { | 133 | while (1) { |
@@ -138,17 +141,26 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
138 | memset(&desc, 0x00, sizeof(desc)); | 141 | memset(&desc, 0x00, sizeof(desc)); |
139 | rt2x00dev->ops->lib->fill_rxdone(entry, &desc); | 142 | rt2x00dev->ops->lib->fill_rxdone(entry, &desc); |
140 | 143 | ||
144 | hdr = (struct ieee80211_hdr *)entry->data_addr; | ||
145 | header_size = | ||
146 | ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)); | ||
147 | |||
148 | /* | ||
149 | * The data behind the ieee80211 header must be | ||
150 | * aligned on a 4 byte boundary. | ||
151 | */ | ||
152 | align = header_size % 4; | ||
153 | |||
141 | /* | 154 | /* |
142 | * Allocate the sk_buffer, initialize it and copy | 155 | * Allocate the sk_buffer, initialize it and copy |
143 | * all data into it. | 156 | * all data into it. |
144 | */ | 157 | */ |
145 | skb = dev_alloc_skb(desc.size + NET_IP_ALIGN); | 158 | skb = dev_alloc_skb(desc.size + align); |
146 | if (!skb) | 159 | if (!skb) |
147 | return; | 160 | return; |
148 | 161 | ||
149 | skb_reserve(skb, NET_IP_ALIGN); | 162 | skb_reserve(skb, align); |
150 | skb_put(skb, desc.size); | 163 | memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size); |
151 | memcpy(skb->data, entry->data_addr, desc.size); | ||
152 | 164 | ||
153 | /* | 165 | /* |
154 | * Send the frame to rt2x00lib for further processing. | 166 | * Send the frame to rt2x00lib for further processing. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 73cc726c4046..568d73847dca 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -159,7 +159,6 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
159 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); | 159 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); |
160 | struct data_entry *entry = rt2x00_get_data_entry(ring); | 160 | struct data_entry *entry = rt2x00_get_data_entry(ring); |
161 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 161 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
162 | int max_packet = usb_maxpacket(usb_dev, pipe, 1); | ||
163 | u32 length; | 162 | u32 length; |
164 | 163 | ||
165 | if (rt2x00_ring_full(ring)) { | 164 | if (rt2x00_ring_full(ring)) { |
@@ -194,8 +193,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
194 | * length of the data to usb_fill_bulk_urb. Pass the skb | 193 | * length of the data to usb_fill_bulk_urb. Pass the skb |
195 | * to the driver to determine what the length should be. | 194 | * to the driver to determine what the length should be. |
196 | */ | 195 | */ |
197 | length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, | 196 | length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, skb); |
198 | max_packet, skb); | ||
199 | 197 | ||
200 | /* | 198 | /* |
201 | * Initialize URB and send the frame to the device. | 199 | * Initialize URB and send the frame to the device. |
@@ -223,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
223 | struct data_ring *ring = entry->ring; | 221 | struct data_ring *ring = entry->ring; |
224 | struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; | 222 | struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; |
225 | struct sk_buff *skb; | 223 | struct sk_buff *skb; |
224 | struct ieee80211_hdr *hdr; | ||
226 | struct rxdata_entry_desc desc; | 225 | struct rxdata_entry_desc desc; |
226 | int header_size; | ||
227 | int frame_size; | 227 | int frame_size; |
228 | 228 | ||
229 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || | 229 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || |
@@ -245,19 +245,37 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
245 | * Allocate a new sk buffer to replace the current one. | 245 | * Allocate a new sk buffer to replace the current one. |
246 | * If allocation fails, we should drop the current frame | 246 | * If allocation fails, we should drop the current frame |
247 | * so we can recycle the existing sk buffer for the new frame. | 247 | * so we can recycle the existing sk buffer for the new frame. |
248 | * As alignment we use 2 and not NET_IP_ALIGN because we need | ||
249 | * to be sure we have 2 bytes room in the head. (NET_IP_ALIGN | ||
250 | * can be 0 on some hardware). We use these 2 bytes for frame | ||
251 | * alignment later, we assume that the chance that | ||
252 | * header_size % 4 == 2 is bigger then header_size % 2 == 0 | ||
253 | * and thus optimize alignment by reserving the 2 bytes in | ||
254 | * advance. | ||
248 | */ | 255 | */ |
249 | frame_size = entry->ring->data_size + entry->ring->desc_size; | 256 | frame_size = entry->ring->data_size + entry->ring->desc_size; |
250 | skb = dev_alloc_skb(frame_size + NET_IP_ALIGN); | 257 | skb = dev_alloc_skb(frame_size + 2); |
251 | if (!skb) | 258 | if (!skb) |
252 | goto skip_entry; | 259 | goto skip_entry; |
253 | 260 | ||
254 | skb_reserve(skb, NET_IP_ALIGN); | 261 | skb_reserve(skb, 2); |
255 | skb_put(skb, frame_size); | 262 | skb_put(skb, frame_size); |
256 | 263 | ||
257 | /* | 264 | /* |
258 | * Trim the skb_buffer to only contain the valid | 265 | * The data behind the ieee80211 header must be |
259 | * frame data (so ignore the device's descriptor). | 266 | * aligned on a 4 byte boundary. |
267 | * After that trim the entire buffer down to only | ||
268 | * contain the valid frame data excluding the device | ||
269 | * descriptor. | ||
260 | */ | 270 | */ |
271 | hdr = (struct ieee80211_hdr *)entry->skb->data; | ||
272 | header_size = | ||
273 | ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)); | ||
274 | |||
275 | if (header_size % 4 == 0) { | ||
276 | skb_push(entry->skb, 2); | ||
277 | memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2); | ||
278 | } | ||
261 | skb_trim(entry->skb, desc.size); | 279 | skb_trim(entry->skb, desc.size); |
262 | 280 | ||
263 | /* | 281 | /* |
@@ -490,6 +508,11 @@ int rt2x00usb_probe(struct usb_interface *usb_intf, | |||
490 | rt2x00dev->ops = ops; | 508 | rt2x00dev->ops = ops; |
491 | rt2x00dev->hw = hw; | 509 | rt2x00dev->hw = hw; |
492 | 510 | ||
511 | rt2x00dev->usb_maxpacket = | ||
512 | usb_maxpacket(usb_dev, usb_sndbulkpipe(usb_dev, 1), 1); | ||
513 | if (!rt2x00dev->usb_maxpacket) | ||
514 | rt2x00dev->usb_maxpacket = 1; | ||
515 | |||
493 | retval = rt2x00usb_alloc_reg(rt2x00dev); | 516 | retval = rt2x00usb_alloc_reg(rt2x00dev); |
494 | if (retval) | 517 | if (retval) |
495 | goto exit_free_device; | 518 | goto exit_free_device; |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 01dbef19d651..ecae968ce091 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1738,6 +1738,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
1738 | { | 1738 | { |
1739 | struct data_ring *ring; | 1739 | struct data_ring *ring; |
1740 | struct data_entry *entry; | 1740 | struct data_entry *entry; |
1741 | struct data_entry *entry_done; | ||
1741 | struct data_desc *txd; | 1742 | struct data_desc *txd; |
1742 | u32 word; | 1743 | u32 word; |
1743 | u32 reg; | 1744 | u32 reg; |
@@ -1791,6 +1792,17 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
1791 | !rt2x00_get_field32(word, TXD_W0_VALID)) | 1792 | !rt2x00_get_field32(word, TXD_W0_VALID)) |
1792 | return; | 1793 | return; |
1793 | 1794 | ||
1795 | entry_done = rt2x00_get_data_entry_done(ring); | ||
1796 | while (entry != entry_done) { | ||
1797 | /* Catch up. Just report any entries we missed as | ||
1798 | * failed. */ | ||
1799 | WARNING(rt2x00dev, | ||
1800 | "TX status report missed for entry %p\n", | ||
1801 | entry_done); | ||
1802 | rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0); | ||
1803 | entry_done = rt2x00_get_data_entry_done(ring); | ||
1804 | } | ||
1805 | |||
1794 | /* | 1806 | /* |
1795 | * Obtain the status about this packet. | 1807 | * Obtain the status about this packet. |
1796 | */ | 1808 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index dc640bf6b5eb..c0671c2e6e73 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1251,7 +1251,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | 1253 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, |
1254 | int maxpacket, struct sk_buff *skb) | 1254 | struct sk_buff *skb) |
1255 | { | 1255 | { |
1256 | int length; | 1256 | int length; |
1257 | 1257 | ||
@@ -1260,7 +1260,7 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | |||
1260 | * but it must _not_ be a multiple of the USB packet size. | 1260 | * but it must _not_ be a multiple of the USB packet size. |
1261 | */ | 1261 | */ |
1262 | length = roundup(skb->len, 4); | 1262 | length = roundup(skb->len, 4); |
1263 | length += (4 * !(length % maxpacket)); | 1263 | length += (4 * !(length % rt2x00dev->usb_maxpacket)); |
1264 | 1264 | ||
1265 | return length; | 1265 | return length; |
1266 | } | 1266 | } |
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index e454ae83e97a..bd1ab3b3afc0 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = { | |||
38 | {USB_DEVICE(0x0846, 0x6a00)}, | 38 | {USB_DEVICE(0x0846, 0x6a00)}, |
39 | /* HP */ | 39 | /* HP */ |
40 | {USB_DEVICE(0x03f0, 0xca02)}, | 40 | {USB_DEVICE(0x03f0, 0xca02)}, |
41 | /* Sitecom */ | ||
42 | {USB_DEVICE(0x0df6, 0x000d)}, | ||
41 | {} | 43 | {} |
42 | }; | 44 | }; |
43 | 45 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index a903645e157a..5298a8bf1129 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -1130,6 +1130,8 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb) | |||
1130 | __skb_trim(skb, skb->len - | 1130 | __skb_trim(skb, skb->len - |
1131 | (IEEE80211_FCS_LEN + sizeof(struct rx_status))); | 1131 | (IEEE80211_FCS_LEN + sizeof(struct rx_status))); |
1132 | 1132 | ||
1133 | ZD_ASSERT(IS_ALIGNED((unsigned long)skb->data, 4)); | ||
1134 | |||
1133 | update_qual_rssi(mac, skb->data, skb->len, stats.signal, | 1135 | update_qual_rssi(mac, skb->data, skb->len, stats.signal, |
1134 | status->signal_strength); | 1136 | status->signal_strength); |
1135 | 1137 | ||
@@ -1166,15 +1168,19 @@ static void do_rx(unsigned long mac_ptr) | |||
1166 | int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length) | 1168 | int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length) |
1167 | { | 1169 | { |
1168 | struct sk_buff *skb; | 1170 | struct sk_buff *skb; |
1171 | unsigned int reserved = | ||
1172 | ALIGN(max_t(unsigned int, | ||
1173 | sizeof(struct zd_rt_hdr), ZD_PLCP_HEADER_SIZE), 4) - | ||
1174 | ZD_PLCP_HEADER_SIZE; | ||
1169 | 1175 | ||
1170 | skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); | 1176 | skb = dev_alloc_skb(reserved + length); |
1171 | if (!skb) { | 1177 | if (!skb) { |
1172 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); | 1178 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
1173 | dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); | 1179 | dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); |
1174 | ieee->stats.rx_dropped++; | 1180 | ieee->stats.rx_dropped++; |
1175 | return -ENOMEM; | 1181 | return -ENOMEM; |
1176 | } | 1182 | } |
1177 | skb_reserve(skb, sizeof(struct zd_rt_hdr)); | 1183 | skb_reserve(skb, reserved); |
1178 | memcpy(__skb_put(skb, length), buffer, length); | 1184 | memcpy(__skb_put(skb, length), buffer, length); |
1179 | skb_queue_tail(&mac->rx_queue, skb); | 1185 | skb_queue_tail(&mac->rx_queue, skb); |
1180 | tasklet_schedule(&mac->rx_tasklet); | 1186 | tasklet_schedule(&mac->rx_tasklet); |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 2a8fc431099f..bca37bf0f545 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -852,11 +852,6 @@ static int xennet_poll(struct napi_struct *napi, int budget) | |||
852 | 852 | ||
853 | spin_lock(&np->rx_lock); | 853 | spin_lock(&np->rx_lock); |
854 | 854 | ||
855 | if (unlikely(!netif_carrier_ok(dev))) { | ||
856 | spin_unlock(&np->rx_lock); | ||
857 | return 0; | ||
858 | } | ||
859 | |||
860 | skb_queue_head_init(&rxq); | 855 | skb_queue_head_init(&rxq); |
861 | skb_queue_head_init(&errq); | 856 | skb_queue_head_init(&errq); |
862 | skb_queue_head_init(&tmpq); | 857 | skb_queue_head_init(&tmpq); |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 87f002ade531..fe6ff3e3d525 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -265,10 +265,10 @@ enum yellowfin_offsets { | |||
265 | /* The Yellowfin Rx and Tx buffer descriptors. | 265 | /* The Yellowfin Rx and Tx buffer descriptors. |
266 | Elements are written as 32 bit for endian portability. */ | 266 | Elements are written as 32 bit for endian portability. */ |
267 | struct yellowfin_desc { | 267 | struct yellowfin_desc { |
268 | u32 dbdma_cmd; | 268 | __le32 dbdma_cmd; |
269 | u32 addr; | 269 | __le32 addr; |
270 | u32 branch_addr; | 270 | __le32 branch_addr; |
271 | u32 result_status; | 271 | __le32 result_status; |
272 | }; | 272 | }; |
273 | 273 | ||
274 | struct tx_status_words { | 274 | struct tx_status_words { |
@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance) | |||
922 | dev->stats.tx_packets++; | 922 | dev->stats.tx_packets++; |
923 | dev->stats.tx_bytes += skb->len; | 923 | dev->stats.tx_bytes += skb->len; |
924 | /* Free the original skb. */ | 924 | /* Free the original skb. */ |
925 | pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, | 925 | pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr), |
926 | skb->len, PCI_DMA_TODEVICE); | 926 | skb->len, PCI_DMA_TODEVICE); |
927 | dev_kfree_skb_irq(skb); | 927 | dev_kfree_skb_irq(skb); |
928 | yp->tx_skbuff[entry] = NULL; | 928 | yp->tx_skbuff[entry] = NULL; |
@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev) | |||
1056 | 1056 | ||
1057 | if(!desc->result_status) | 1057 | if(!desc->result_status) |
1058 | break; | 1058 | break; |
1059 | pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, | 1059 | pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr), |
1060 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1060 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1061 | desc_status = le32_to_cpu(desc->result_status) >> 16; | 1061 | desc_status = le32_to_cpu(desc->result_status) >> 16; |
1062 | buf_addr = rx_skb->data; | 1062 | buf_addr = rx_skb->data; |
1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - | 1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - |
1064 | le32_to_cpu(desc->result_status)) & 0xffff; | 1064 | le32_to_cpu(desc->result_status)) & 0xffff; |
1065 | frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); | 1065 | frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2]))); |
1066 | if (yellowfin_debug > 4) | 1066 | if (yellowfin_debug > 4) |
1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", | 1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", |
1068 | frame_status); | 1068 | frame_status); |
@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1123 | if (pkt_len > rx_copybreak) { | 1123 | if (pkt_len > rx_copybreak) { |
1124 | skb_put(skb = rx_skb, pkt_len); | 1124 | skb_put(skb = rx_skb, pkt_len); |
1125 | pci_unmap_single(yp->pci_dev, | 1125 | pci_unmap_single(yp->pci_dev, |
1126 | yp->rx_ring[entry].addr, | 1126 | le32_to_cpu(yp->rx_ring[entry].addr), |
1127 | yp->rx_buf_sz, | 1127 | yp->rx_buf_sz, |
1128 | PCI_DMA_FROMDEVICE); | 1128 | PCI_DMA_FROMDEVICE); |
1129 | yp->rx_skbuff[entry] = NULL; | 1129 | yp->rx_skbuff[entry] = NULL; |
@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev) | |||
1134 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1134 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1135 | skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); | 1135 | skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); |
1136 | skb_put(skb, pkt_len); | 1136 | skb_put(skb, pkt_len); |
1137 | pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, | 1137 | pci_dma_sync_single_for_device(yp->pci_dev, |
1138 | yp->rx_buf_sz, | 1138 | le32_to_cpu(desc->addr), |
1139 | PCI_DMA_FROMDEVICE); | 1139 | yp->rx_buf_sz, |
1140 | PCI_DMA_FROMDEVICE); | ||
1140 | } | 1141 | } |
1141 | skb->protocol = eth_type_trans(skb, dev); | 1142 | skb->protocol = eth_type_trans(skb, dev); |
1142 | netif_rx(skb); | 1143 | netif_rx(skb); |
@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev) | |||
1252 | /* Free all the skbuffs in the Rx queue. */ | 1253 | /* Free all the skbuffs in the Rx queue. */ |
1253 | for (i = 0; i < RX_RING_SIZE; i++) { | 1254 | for (i = 0; i < RX_RING_SIZE; i++) { |
1254 | yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); | 1255 | yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); |
1255 | yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ | 1256 | yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ |
1256 | if (yp->rx_skbuff[i]) { | 1257 | if (yp->rx_skbuff[i]) { |
1257 | dev_kfree_skb(yp->rx_skbuff[i]); | 1258 | dev_kfree_skb(yp->rx_skbuff[i]); |
1258 | } | 1259 | } |