aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-05-20 14:06:24 -0400
committerThomas Gleixner <tglx@linutronix.de>2011-05-20 14:08:05 -0400
commit250f972d85effad5b6e10da4bbd877e6a4b503b6 (patch)
tree007393a6fc6439af7e0121dd99a6f9f9fb8405bc /drivers/net
parent7372b0b122af0f6675f3ab65bfd91c8a438e0480 (diff)
parentbbe7b8bef48c567f5ff3f6041c1fb011292e8f12 (diff)
Merge branch 'timers/urgent' into timers/core
Reason: Get upstream fixes and kfree_rcu which is necessary for a follow up patch. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/Kconfig15
-rw-r--r--drivers/net/Makefile7
-rw-r--r--drivers/net/amd8111e.c2
-rw-r--r--drivers/net/arm/etherh.c4
-rw-r--r--drivers/net/atarilance.c2
-rw-r--r--drivers/net/atl1c/atl1c.h6
-rw-r--r--drivers/net/atl1c/atl1c_main.c14
-rw-r--r--drivers/net/benet/be.h2
-rw-r--r--drivers/net/benet/be_cmds.c2
-rw-r--r--drivers/net/benet/be_main.c19
-rw-r--r--drivers/net/bnx2.c2
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.c34
-rw-r--r--drivers/net/bonding/bond_3ad.c7
-rw-r--r--drivers/net/bonding/bond_3ad.h10
-rw-r--r--drivers/net/can/mscan/mpc5xxx_can.c7
-rw-r--r--drivers/net/can/sja1000/sja1000.c2
-rw-r--r--drivers/net/can/slcan.c4
-rw-r--r--drivers/net/ehea/ehea_ethtool.c21
-rw-r--r--drivers/net/ehea/ehea_main.c15
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c9
-rw-r--r--drivers/net/fs_enet/mac-fec.c8
-rw-r--r--drivers/net/fs_enet/mii-fec.c7
-rw-r--r--drivers/net/ftmac100.c8
-rw-r--r--drivers/net/hydra.c14
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c7
-rw-r--r--drivers/net/lantiq_etop.c805
-rw-r--r--drivers/net/macvlan.c10
-rw-r--r--drivers/net/mii.c4
-rw-r--r--drivers/net/ne-h8300.c16
-rw-r--r--drivers/net/netconsole.c8
-rw-r--r--drivers/net/pch_gbe/pch_gbe_main.c23
-rw-r--r--drivers/net/r8169.c99
-rw-r--r--drivers/net/sfc/mcdi.c49
-rw-r--r--drivers/net/sfc/nic.c7
-rw-r--r--drivers/net/sfc/nic.h2
-rw-r--r--drivers/net/sfc/siena.c25
-rw-r--r--drivers/net/slip.c4
-rw-r--r--drivers/net/sunhme.c7
-rw-r--r--drivers/net/tg3.c8
-rw-r--r--drivers/net/usb/cdc_ether.c16
-rw-r--r--drivers/net/usb/cdc_ncm.c4
-rw-r--r--drivers/net/usb/ipheth.c14
-rw-r--r--drivers/net/usb/smsc95xx.c2
-rw-r--r--drivers/net/usb/usbnet.c18
-rw-r--r--drivers/net/veth.c12
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c10
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c2
-rw-r--r--drivers/net/wireless/b43/main.c1
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-tx.c28
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c7
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-dev.h6
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-led.c20
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c27
-rw-r--r--drivers/net/wireless/libertas/cmd.c6
-rw-r--r--drivers/net/zorro8390.c12
59 files changed, 1281 insertions, 225 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index dc280bc8eba2..19f04a34783a 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2017,6 +2017,13 @@ config FTMAC100
2017 from Faraday. It is used on Faraday A320, Andes AG101 and some 2017 from Faraday. It is used on Faraday A320, Andes AG101 and some
2018 other ARM/NDS32 SoC's. 2018 other ARM/NDS32 SoC's.
2019 2019
2020config LANTIQ_ETOP
2021 tristate "Lantiq SoC ETOP driver"
2022 depends on SOC_TYPE_XWAY
2023 help
2024 Support for the MII0 inside the Lantiq SoC
2025
2026
2020source "drivers/net/fs_enet/Kconfig" 2027source "drivers/net/fs_enet/Kconfig"
2021 2028
2022source "drivers/net/octeon/Kconfig" 2029source "drivers/net/octeon/Kconfig"
@@ -2536,7 +2543,7 @@ config S6GMAC
2536source "drivers/net/stmmac/Kconfig" 2543source "drivers/net/stmmac/Kconfig"
2537 2544
2538config PCH_GBE 2545config PCH_GBE
2539 tristate "PCH Gigabit Ethernet" 2546 tristate "Intel EG20T PCH / OKI SEMICONDUCTOR ML7223 IOH GbE"
2540 depends on PCI 2547 depends on PCI
2541 select MII 2548 select MII
2542 ---help--- 2549 ---help---
@@ -2548,6 +2555,12 @@ config PCH_GBE
2548 to Gigabit Ethernet. 2555 to Gigabit Ethernet.
2549 This driver enables Gigabit Ethernet function. 2556 This driver enables Gigabit Ethernet function.
2550 2557
2558 This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
2559 Output Hub), ML7223.
2560 ML7223 IOH is for MP(Media Phone) use.
2561 ML7223 is companion chip for Intel Atom E6xx series.
2562 ML7223 is completely compatible for Intel EG20T PCH.
2563
2551endif # NETDEV_1000 2564endif # NETDEV_1000
2552 2565
2553# 2566#
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 01b604ad155e..209fbb70619b 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -144,7 +144,7 @@ obj-$(CONFIG_NE3210) += ne3210.o 8390.o
144obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o 144obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
145obj-$(CONFIG_B44) += b44.o 145obj-$(CONFIG_B44) += b44.o
146obj-$(CONFIG_FORCEDETH) += forcedeth.o 146obj-$(CONFIG_FORCEDETH) += forcedeth.o
147obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o 147obj-$(CONFIG_NE_H8300) += ne-h8300.o
148obj-$(CONFIG_AX88796) += ax88796.o 148obj-$(CONFIG_AX88796) += ax88796.o
149obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o 149obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
150obj-$(CONFIG_FTMAC100) += ftmac100.o 150obj-$(CONFIG_FTMAC100) += ftmac100.o
@@ -219,7 +219,7 @@ obj-$(CONFIG_SC92031) += sc92031.o
219obj-$(CONFIG_LP486E) += lp486e.o 219obj-$(CONFIG_LP486E) += lp486e.o
220 220
221obj-$(CONFIG_ETH16I) += eth16i.o 221obj-$(CONFIG_ETH16I) += eth16i.o
222obj-$(CONFIG_ZORRO8390) += zorro8390.o 8390.o 222obj-$(CONFIG_ZORRO8390) += zorro8390.o
223obj-$(CONFIG_HPLANCE) += hplance.o 7990.o 223obj-$(CONFIG_HPLANCE) += hplance.o 7990.o
224obj-$(CONFIG_MVME147_NET) += mvme147.o 7990.o 224obj-$(CONFIG_MVME147_NET) += mvme147.o 7990.o
225obj-$(CONFIG_EQUALIZER) += eql.o 225obj-$(CONFIG_EQUALIZER) += eql.o
@@ -231,7 +231,7 @@ obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o
231obj-$(CONFIG_DECLANCE) += declance.o 231obj-$(CONFIG_DECLANCE) += declance.o
232obj-$(CONFIG_ATARILANCE) += atarilance.o 232obj-$(CONFIG_ATARILANCE) += atarilance.o
233obj-$(CONFIG_A2065) += a2065.o 233obj-$(CONFIG_A2065) += a2065.o
234obj-$(CONFIG_HYDRA) += hydra.o 8390.o 234obj-$(CONFIG_HYDRA) += hydra.o
235obj-$(CONFIG_ARIADNE) += ariadne.o 235obj-$(CONFIG_ARIADNE) += ariadne.o
236obj-$(CONFIG_CS89x0) += cs89x0.o 236obj-$(CONFIG_CS89x0) += cs89x0.o
237obj-$(CONFIG_MACSONIC) += macsonic.o 237obj-$(CONFIG_MACSONIC) += macsonic.o
@@ -259,6 +259,7 @@ obj-$(CONFIG_MLX4_CORE) += mlx4/
259obj-$(CONFIG_ENC28J60) += enc28j60.o 259obj-$(CONFIG_ENC28J60) += enc28j60.o
260obj-$(CONFIG_ETHOC) += ethoc.o 260obj-$(CONFIG_ETHOC) += ethoc.o
261obj-$(CONFIG_GRETH) += greth.o 261obj-$(CONFIG_GRETH) += greth.o
262obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o
262 263
263obj-$(CONFIG_XTENSA_XT2000_SONIC) += xtsonic.o 264obj-$(CONFIG_XTENSA_XT2000_SONIC) += xtsonic.o
264 265
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 88495c48a81d..241b185e6569 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -106,7 +106,7 @@ MODULE_DESCRIPTION ("AMD8111 based 10/100 Ethernet Controller. Driver Version "M
106MODULE_LICENSE("GPL"); 106MODULE_LICENSE("GPL");
107MODULE_DEVICE_TABLE(pci, amd8111e_pci_tbl); 107MODULE_DEVICE_TABLE(pci, amd8111e_pci_tbl);
108module_param_array(speed_duplex, int, NULL, 0); 108module_param_array(speed_duplex, int, NULL, 0);
109MODULE_PARM_DESC(speed_duplex, "Set device speed and duplex modes, 0: Auto Negotitate, 1: 10Mbps Half Duplex, 2: 10Mbps Full Duplex, 3: 100Mbps Half Duplex, 4: 100Mbps Full Duplex"); 109MODULE_PARM_DESC(speed_duplex, "Set device speed and duplex modes, 0: Auto Negotiate, 1: 10Mbps Half Duplex, 2: 10Mbps Full Duplex, 3: 100Mbps Half Duplex, 4: 100Mbps Full Duplex");
110module_param_array(coalesce, bool, NULL, 0); 110module_param_array(coalesce, bool, NULL, 0);
111MODULE_PARM_DESC(coalesce, "Enable or Disable interrupt coalescing, 1: Enable, 0: Disable"); 111MODULE_PARM_DESC(coalesce, "Enable or Disable interrupt coalescing, 1: Enable, 0: Disable");
112module_param_array(dynamic_ipg, bool, NULL, 0); 112module_param_array(dynamic_ipg, bool, NULL, 0);
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 4af235d41fda..fbfb5b47c506 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -527,7 +527,7 @@ static void __init etherh_banner(void)
527 * Read the ethernet address string from the on board rom. 527 * Read the ethernet address string from the on board rom.
528 * This is an ascii string... 528 * This is an ascii string...
529 */ 529 */
530static int __init etherh_addr(char *addr, struct expansion_card *ec) 530static int __devinit etherh_addr(char *addr, struct expansion_card *ec)
531{ 531{
532 struct in_chunk_dir cd; 532 struct in_chunk_dir cd;
533 char *s; 533 char *s;
@@ -655,7 +655,7 @@ static const struct net_device_ops etherh_netdev_ops = {
655static u32 etherh_regoffsets[16]; 655static u32 etherh_regoffsets[16];
656static u32 etherm_regoffsets[16]; 656static u32 etherm_regoffsets[16];
657 657
658static int __init 658static int __devinit
659etherh_probe(struct expansion_card *ec, const struct ecard_id *id) 659etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
660{ 660{
661 const struct etherh_data *data = id->data; 661 const struct etherh_data *data = id->data;
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index ce0091eb06f5..1264d781b554 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -554,7 +554,7 @@ static unsigned long __init lance_probe1( struct net_device *dev,
554 memaddr == (unsigned short *)0xffe00000) { 554 memaddr == (unsigned short *)0xffe00000) {
555 /* PAMs card and Riebl on ST use level 5 autovector */ 555 /* PAMs card and Riebl on ST use level 5 autovector */
556 if (request_irq(IRQ_AUTO_5, lance_interrupt, IRQ_TYPE_PRIO, 556 if (request_irq(IRQ_AUTO_5, lance_interrupt, IRQ_TYPE_PRIO,
557 "PAM/Riebl-ST Ethernet", dev)) { 557 "PAM,Riebl-ST Ethernet", dev)) {
558 printk( "Lance: request for irq %d failed\n", IRQ_AUTO_5 ); 558 printk( "Lance: request for irq %d failed\n", IRQ_AUTO_5 );
559 return 0; 559 return 0;
560 } 560 }
diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
index 7cb375e0e29c..925929d764ca 100644
--- a/drivers/net/atl1c/atl1c.h
+++ b/drivers/net/atl1c/atl1c.h
@@ -566,9 +566,9 @@ struct atl1c_adapter {
566#define __AT_TESTING 0x0001 566#define __AT_TESTING 0x0001
567#define __AT_RESETTING 0x0002 567#define __AT_RESETTING 0x0002
568#define __AT_DOWN 0x0003 568#define __AT_DOWN 0x0003
569 u8 work_event; 569 unsigned long work_event;
570#define ATL1C_WORK_EVENT_RESET 0x01 570#define ATL1C_WORK_EVENT_RESET 0
571#define ATL1C_WORK_EVENT_LINK_CHANGE 0x02 571#define ATL1C_WORK_EVENT_LINK_CHANGE 1
572 u32 msg_enable; 572 u32 msg_enable;
573 573
574 bool have_msi; 574 bool have_msi;
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 7d9d5067a65c..a6e1c36e48e6 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -325,7 +325,7 @@ static void atl1c_link_chg_event(struct atl1c_adapter *adapter)
325 } 325 }
326 } 326 }
327 327
328 adapter->work_event |= ATL1C_WORK_EVENT_LINK_CHANGE; 328 set_bit(ATL1C_WORK_EVENT_LINK_CHANGE, &adapter->work_event);
329 schedule_work(&adapter->common_task); 329 schedule_work(&adapter->common_task);
330} 330}
331 331
@@ -337,20 +337,16 @@ static void atl1c_common_task(struct work_struct *work)
337 adapter = container_of(work, struct atl1c_adapter, common_task); 337 adapter = container_of(work, struct atl1c_adapter, common_task);
338 netdev = adapter->netdev; 338 netdev = adapter->netdev;
339 339
340 if (adapter->work_event & ATL1C_WORK_EVENT_RESET) { 340 if (test_and_clear_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event)) {
341 adapter->work_event &= ~ATL1C_WORK_EVENT_RESET;
342 netif_device_detach(netdev); 341 netif_device_detach(netdev);
343 atl1c_down(adapter); 342 atl1c_down(adapter);
344 atl1c_up(adapter); 343 atl1c_up(adapter);
345 netif_device_attach(netdev); 344 netif_device_attach(netdev);
346 return;
347 } 345 }
348 346
349 if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE) { 347 if (test_and_clear_bit(ATL1C_WORK_EVENT_LINK_CHANGE,
350 adapter->work_event &= ~ATL1C_WORK_EVENT_LINK_CHANGE; 348 &adapter->work_event))
351 atl1c_check_link_status(adapter); 349 atl1c_check_link_status(adapter);
352 }
353 return;
354} 350}
355 351
356 352
@@ -369,7 +365,7 @@ static void atl1c_tx_timeout(struct net_device *netdev)
369 struct atl1c_adapter *adapter = netdev_priv(netdev); 365 struct atl1c_adapter *adapter = netdev_priv(netdev);
370 366
371 /* Do the reset outside of interrupt context */ 367 /* Do the reset outside of interrupt context */
372 adapter->work_event |= ATL1C_WORK_EVENT_RESET; 368 set_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event);
373 schedule_work(&adapter->common_task); 369 schedule_work(&adapter->common_task);
374} 370}
375 371
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 66823eded7a3..2353eca32593 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -213,7 +213,7 @@ struct be_rx_stats {
213 213
214struct be_rx_compl_info { 214struct be_rx_compl_info {
215 u32 rss_hash; 215 u32 rss_hash;
216 u16 vid; 216 u16 vlan_tag;
217 u16 pkt_size; 217 u16 pkt_size;
218 u16 rxq_idx; 218 u16 rxq_idx;
219 u16 mac_id; 219 u16 mac_id;
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 1e2d825bb94a..9dc9394fd4ca 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -132,7 +132,7 @@ static void be_async_grp5_pvid_state_process(struct be_adapter *adapter,
132 struct be_async_event_grp5_pvid_state *evt) 132 struct be_async_event_grp5_pvid_state *evt)
133{ 133{
134 if (evt->enabled) 134 if (evt->enabled)
135 adapter->pvid = evt->tag; 135 adapter->pvid = le16_to_cpu(evt->tag);
136 else 136 else
137 adapter->pvid = 0; 137 adapter->pvid = 0;
138} 138}
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 7cb5a114c733..9187fb4e08f1 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1018,7 +1018,8 @@ static void be_rx_compl_process(struct be_adapter *adapter,
1018 kfree_skb(skb); 1018 kfree_skb(skb);
1019 return; 1019 return;
1020 } 1020 }
1021 vlan_hwaccel_receive_skb(skb, adapter->vlan_grp, rxcp->vid); 1021 vlan_hwaccel_receive_skb(skb, adapter->vlan_grp,
1022 rxcp->vlan_tag);
1022 } else { 1023 } else {
1023 netif_receive_skb(skb); 1024 netif_receive_skb(skb);
1024 } 1025 }
@@ -1076,7 +1077,8 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1076 if (likely(!rxcp->vlanf)) 1077 if (likely(!rxcp->vlanf))
1077 napi_gro_frags(&eq_obj->napi); 1078 napi_gro_frags(&eq_obj->napi);
1078 else 1079 else
1079 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, rxcp->vid); 1080 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp,
1081 rxcp->vlan_tag);
1080} 1082}
1081 1083
1082static void be_parse_rx_compl_v1(struct be_adapter *adapter, 1084static void be_parse_rx_compl_v1(struct be_adapter *adapter,
@@ -1102,7 +1104,8 @@ static void be_parse_rx_compl_v1(struct be_adapter *adapter,
1102 rxcp->pkt_type = 1104 rxcp->pkt_type =
1103 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, cast_enc, compl); 1105 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, cast_enc, compl);
1104 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtm, compl); 1106 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtm, compl);
1105 rxcp->vid = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag, compl); 1107 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag,
1108 compl);
1106} 1109}
1107 1110
1108static void be_parse_rx_compl_v0(struct be_adapter *adapter, 1111static void be_parse_rx_compl_v0(struct be_adapter *adapter,
@@ -1128,7 +1131,8 @@ static void be_parse_rx_compl_v0(struct be_adapter *adapter,
1128 rxcp->pkt_type = 1131 rxcp->pkt_type =
1129 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, cast_enc, compl); 1132 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, cast_enc, compl);
1130 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtm, compl); 1133 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtm, compl);
1131 rxcp->vid = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag, compl); 1134 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag,
1135 compl);
1132} 1136}
1133 1137
1134static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) 1138static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
@@ -1155,9 +1159,11 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
1155 rxcp->vlanf = 0; 1159 rxcp->vlanf = 0;
1156 1160
1157 if (!lancer_chip(adapter)) 1161 if (!lancer_chip(adapter))
1158 rxcp->vid = swab16(rxcp->vid); 1162 rxcp->vlan_tag = swab16(rxcp->vlan_tag);
1159 1163
1160 if ((adapter->pvid == rxcp->vid) && !adapter->vlan_tag[rxcp->vid]) 1164 if (((adapter->pvid & VLAN_VID_MASK) ==
1165 (rxcp->vlan_tag & VLAN_VID_MASK)) &&
1166 !adapter->vlan_tag[rxcp->vlan_tag])
1161 rxcp->vlanf = 0; 1167 rxcp->vlanf = 0;
1162 1168
1163 /* As the compl has been parsed, reset it; we wont touch it again */ 1169 /* As the compl has been parsed, reset it; we wont touch it again */
@@ -1873,6 +1879,7 @@ static void be_worker(struct work_struct *work)
1873 be_detect_dump_ue(adapter); 1879 be_detect_dump_ue(adapter);
1874 1880
1875reschedule: 1881reschedule:
1882 adapter->work_counter++;
1876 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); 1883 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
1877} 1884}
1878 1885
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 8e6d618b5305..d8383a9af9ad 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -8413,6 +8413,8 @@ bnx2_remove_one(struct pci_dev *pdev)
8413 8413
8414 unregister_netdev(dev); 8414 unregister_netdev(dev);
8415 8415
8416 del_timer_sync(&bp->timer);
8417
8416 if (bp->mips_firmware) 8418 if (bp->mips_firmware)
8417 release_firmware(bp->mips_firmware); 8419 release_firmware(bp->mips_firmware);
8418 if (bp->rv2p_firmware) 8420 if (bp->rv2p_firmware)
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index e83ac6dd6fc0..16581df5ee4e 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -2019,15 +2019,23 @@ static inline void bnx2x_set_pbd_gso(struct sk_buff *skb,
2019static inline u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb, 2019static inline u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb,
2020 u32 *parsing_data, u32 xmit_type) 2020 u32 *parsing_data, u32 xmit_type)
2021{ 2021{
2022 *parsing_data |= ((tcp_hdrlen(skb)/4) << 2022 *parsing_data |=
2023 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT) & 2023 ((((u8 *)skb_transport_header(skb) - skb->data) >> 1) <<
2024 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW; 2024 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT) &
2025 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W;
2025 2026
2026 *parsing_data |= ((((u8 *)tcp_hdr(skb) - skb->data) / 2) << 2027 if (xmit_type & XMIT_CSUM_TCP) {
2027 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT) & 2028 *parsing_data |= ((tcp_hdrlen(skb) / 4) <<
2028 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W; 2029 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT) &
2030 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW;
2029 2031
2030 return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data; 2032 return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data;
2033 } else
2034 /* We support checksum offload for TCP and UDP only.
2035 * No need to pass the UDP header length - it's a constant.
2036 */
2037 return skb_transport_header(skb) +
2038 sizeof(struct udphdr) - skb->data;
2031} 2039}
2032 2040
2033/** 2041/**
@@ -2043,7 +2051,7 @@ static inline u8 bnx2x_set_pbd_csum(struct bnx2x *bp, struct sk_buff *skb,
2043 struct eth_tx_parse_bd_e1x *pbd, 2051 struct eth_tx_parse_bd_e1x *pbd,
2044 u32 xmit_type) 2052 u32 xmit_type)
2045{ 2053{
2046 u8 hlen = (skb_network_header(skb) - skb->data) / 2; 2054 u8 hlen = (skb_network_header(skb) - skb->data) >> 1;
2047 2055
2048 /* for now NS flag is not used in Linux */ 2056 /* for now NS flag is not used in Linux */
2049 pbd->global_data = 2057 pbd->global_data =
@@ -2051,9 +2059,15 @@ static inline u8 bnx2x_set_pbd_csum(struct bnx2x *bp, struct sk_buff *skb,
2051 ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT)); 2059 ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT));
2052 2060
2053 pbd->ip_hlen_w = (skb_transport_header(skb) - 2061 pbd->ip_hlen_w = (skb_transport_header(skb) -
2054 skb_network_header(skb)) / 2; 2062 skb_network_header(skb)) >> 1;
2055 2063
2056 hlen += pbd->ip_hlen_w + tcp_hdrlen(skb) / 2; 2064 hlen += pbd->ip_hlen_w;
2065
2066 /* We support checksum offload for TCP and UDP only */
2067 if (xmit_type & XMIT_CSUM_TCP)
2068 hlen += tcp_hdrlen(skb) / 2;
2069 else
2070 hlen += sizeof(struct udphdr) / 2;
2057 2071
2058 pbd->total_hlen_w = cpu_to_le16(hlen); 2072 pbd->total_hlen_w = cpu_to_le16(hlen);
2059 hlen = hlen*2; 2073 hlen = hlen*2;
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 494bf960442d..31912f17653f 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1482,8 +1482,11 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
1482 1482
1483static int agg_device_up(const struct aggregator *agg) 1483static int agg_device_up(const struct aggregator *agg)
1484{ 1484{
1485 return (netif_running(agg->slave->dev) && 1485 struct port *port = agg->lag_ports;
1486 netif_carrier_ok(agg->slave->dev)); 1486 if (!port)
1487 return 0;
1488 return (netif_running(port->slave->dev) &&
1489 netif_carrier_ok(port->slave->dev));
1487} 1490}
1488 1491
1489/** 1492/**
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
index b28baff70864..01b8a6af275b 100644
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -39,7 +39,7 @@
39 39
40typedef struct mac_addr { 40typedef struct mac_addr {
41 u8 mac_addr_value[ETH_ALEN]; 41 u8 mac_addr_value[ETH_ALEN];
42} mac_addr_t; 42} __packed mac_addr_t;
43 43
44enum { 44enum {
45 BOND_AD_STABLE = 0, 45 BOND_AD_STABLE = 0,
@@ -134,12 +134,12 @@ typedef struct lacpdu {
134 u8 tlv_type_terminator; // = terminator 134 u8 tlv_type_terminator; // = terminator
135 u8 terminator_length; // = 0 135 u8 terminator_length; // = 0
136 u8 reserved_50[50]; // = 0 136 u8 reserved_50[50]; // = 0
137} lacpdu_t; 137} __packed lacpdu_t;
138 138
139typedef struct lacpdu_header { 139typedef struct lacpdu_header {
140 struct ethhdr hdr; 140 struct ethhdr hdr;
141 struct lacpdu lacpdu; 141 struct lacpdu lacpdu;
142} lacpdu_header_t; 142} __packed lacpdu_header_t;
143 143
144// Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard) 144// Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard)
145typedef struct bond_marker { 145typedef struct bond_marker {
@@ -155,12 +155,12 @@ typedef struct bond_marker {
155 u8 tlv_type_terminator; // = 0x00 155 u8 tlv_type_terminator; // = 0x00
156 u8 terminator_length; // = 0x00 156 u8 terminator_length; // = 0x00
157 u8 reserved_90[90]; // = 0 157 u8 reserved_90[90]; // = 0
158} bond_marker_t; 158} __packed bond_marker_t;
159 159
160typedef struct bond_marker_header { 160typedef struct bond_marker_header {
161 struct ethhdr hdr; 161 struct ethhdr hdr;
162 struct bond_marker marker; 162 struct bond_marker marker;
163} bond_marker_header_t; 163} __packed bond_marker_header_t;
164 164
165#pragma pack() 165#pragma pack()
166 166
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index bd1d811c204f..5fedc3375562 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -247,8 +247,10 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
247} 247}
248#endif /* CONFIG_PPC_MPC512x */ 248#endif /* CONFIG_PPC_MPC512x */
249 249
250static struct of_device_id mpc5xxx_can_table[];
250static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) 251static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
251{ 252{
253 const struct of_device_id *match;
252 struct mpc5xxx_can_data *data; 254 struct mpc5xxx_can_data *data;
253 struct device_node *np = ofdev->dev.of_node; 255 struct device_node *np = ofdev->dev.of_node;
254 struct net_device *dev; 256 struct net_device *dev;
@@ -258,9 +260,10 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
258 int irq, mscan_clksrc = 0; 260 int irq, mscan_clksrc = 0;
259 int err = -ENOMEM; 261 int err = -ENOMEM;
260 262
261 if (!ofdev->dev.of_match) 263 match = of_match_device(mpc5xxx_can_table, &ofdev->dev);
264 if (!match)
262 return -EINVAL; 265 return -EINVAL;
263 data = (struct mpc5xxx_can_data *)ofdev->dev.of_match->data; 266 data = match->data;
264 267
265 base = of_iomap(np, 0); 268 base = of_iomap(np, 0);
266 if (!base) { 269 if (!base) {
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index a358ea9445a2..f501bba1fc6f 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -346,10 +346,10 @@ static void sja1000_rx(struct net_device *dev)
346 | (priv->read_reg(priv, REG_ID2) >> 5); 346 | (priv->read_reg(priv, REG_ID2) >> 5);
347 } 347 }
348 348
349 cf->can_dlc = get_can_dlc(fi & 0x0F);
349 if (fi & FI_RTR) { 350 if (fi & FI_RTR) {
350 id |= CAN_RTR_FLAG; 351 id |= CAN_RTR_FLAG;
351 } else { 352 } else {
352 cf->can_dlc = get_can_dlc(fi & 0x0F);
353 for (i = 0; i < cf->can_dlc; i++) 353 for (i = 0; i < cf->can_dlc; i++)
354 cf->data[i] = priv->read_reg(priv, dreg++); 354 cf->data[i] = priv->read_reg(priv, dreg++);
355 } 355 }
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index b423965a78d1..1b49df6b2470 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -583,7 +583,9 @@ static int slcan_open(struct tty_struct *tty)
583 /* Done. We have linked the TTY line to a channel. */ 583 /* Done. We have linked the TTY line to a channel. */
584 rtnl_unlock(); 584 rtnl_unlock();
585 tty->receive_room = 65536; /* We don't flow control */ 585 tty->receive_room = 65536; /* We don't flow control */
586 return sl->dev->base_addr; 586
587 /* TTY layer expects 0 on success */
588 return 0;
587 589
588err_free_chan: 590err_free_chan:
589 sl->tty = NULL; 591 sl->tty = NULL;
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 3e2e734fecb7..f3bbdcef338c 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -55,15 +55,20 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
55 cmd->duplex = -1; 55 cmd->duplex = -1;
56 } 56 }
57 57
58 cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full 58 if (cmd->speed == SPEED_10000) {
59 | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half 59 cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
60 | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half 60 cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
61 | SUPPORTED_Autoneg | SUPPORTED_FIBRE); 61 cmd->port = PORT_FIBRE;
62 62 } else {
63 cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_Autoneg 63 cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full
64 | ADVERTISED_FIBRE); 64 | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full
65 | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg
66 | SUPPORTED_TP);
67 cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg
68 | ADVERTISED_TP);
69 cmd->port = PORT_TP;
70 }
65 71
66 cmd->port = PORT_FIBRE;
67 cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE; 72 cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE;
68 73
69 return 0; 74 return 0;
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f75d3144b8a5..cf79cf759e13 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2688,9 +2688,6 @@ static int ehea_open(struct net_device *dev)
2688 netif_start_queue(dev); 2688 netif_start_queue(dev);
2689 } 2689 }
2690 2690
2691 init_waitqueue_head(&port->swqe_avail_wq);
2692 init_waitqueue_head(&port->restart_wq);
2693
2694 mutex_unlock(&port->port_lock); 2691 mutex_unlock(&port->port_lock);
2695 2692
2696 return ret; 2693 return ret;
@@ -3040,11 +3037,14 @@ static void ehea_rereg_mrs(void)
3040 3037
3041 if (dev->flags & IFF_UP) { 3038 if (dev->flags & IFF_UP) {
3042 mutex_lock(&port->port_lock); 3039 mutex_lock(&port->port_lock);
3043 port_napi_enable(port);
3044 ret = ehea_restart_qps(dev); 3040 ret = ehea_restart_qps(dev);
3045 check_sqs(port); 3041 if (!ret) {
3046 if (!ret) 3042 check_sqs(port);
3043 port_napi_enable(port);
3047 netif_wake_queue(dev); 3044 netif_wake_queue(dev);
3045 } else {
3046 netdev_err(dev, "Unable to restart QPS\n");
3047 }
3048 mutex_unlock(&port->port_lock); 3048 mutex_unlock(&port->port_lock);
3049 } 3049 }
3050 } 3050 }
@@ -3273,6 +3273,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3273 3273
3274 INIT_WORK(&port->reset_task, ehea_reset_port); 3274 INIT_WORK(&port->reset_task, ehea_reset_port);
3275 3275
3276 init_waitqueue_head(&port->swqe_avail_wq);
3277 init_waitqueue_head(&port->restart_wq);
3278
3276 ret = register_netdev(dev); 3279 ret = register_netdev(dev);
3277 if (ret) { 3280 if (ret) {
3278 pr_err("register_netdev failed. ret=%d\n", ret); 3281 pr_err("register_netdev failed. ret=%d\n", ret);
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 24cb953900dd..5131e61c358c 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -998,8 +998,10 @@ static const struct net_device_ops fs_enet_netdev_ops = {
998#endif 998#endif
999}; 999};
1000 1000
1001static struct of_device_id fs_enet_match[];
1001static int __devinit fs_enet_probe(struct platform_device *ofdev) 1002static int __devinit fs_enet_probe(struct platform_device *ofdev)
1002{ 1003{
1004 const struct of_device_id *match;
1003 struct net_device *ndev; 1005 struct net_device *ndev;
1004 struct fs_enet_private *fep; 1006 struct fs_enet_private *fep;
1005 struct fs_platform_info *fpi; 1007 struct fs_platform_info *fpi;
@@ -1007,14 +1009,15 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1007 const u8 *mac_addr; 1009 const u8 *mac_addr;
1008 int privsize, len, ret = -ENODEV; 1010 int privsize, len, ret = -ENODEV;
1009 1011
1010 if (!ofdev->dev.of_match) 1012 match = of_match_device(fs_enet_match, &ofdev->dev);
1013 if (!match)
1011 return -EINVAL; 1014 return -EINVAL;
1012 1015
1013 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL); 1016 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL);
1014 if (!fpi) 1017 if (!fpi)
1015 return -ENOMEM; 1018 return -ENOMEM;
1016 1019
1017 if (!IS_FEC(ofdev->dev.of_match)) { 1020 if (!IS_FEC(match)) {
1018 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len); 1021 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
1019 if (!data || len != 4) 1022 if (!data || len != 4)
1020 goto out_free_fpi; 1023 goto out_free_fpi;
@@ -1049,7 +1052,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1049 fep->dev = &ofdev->dev; 1052 fep->dev = &ofdev->dev;
1050 fep->ndev = ndev; 1053 fep->ndev = ndev;
1051 fep->fpi = fpi; 1054 fep->fpi = fpi;
1052 fep->ops = ofdev->dev.of_match->data; 1055 fep->ops = match->data;
1053 1056
1054 ret = fep->ops->setup_data(ndev); 1057 ret = fep->ops->setup_data(ndev);
1055 if (ret) 1058 if (ret)
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 61035fc5599b..b9fbc83d64a7 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -226,8 +226,8 @@ static void set_multicast_finish(struct net_device *dev)
226 } 226 }
227 227
228 FC(fecp, r_cntrl, FEC_RCNTRL_PROM); 228 FC(fecp, r_cntrl, FEC_RCNTRL_PROM);
229 FW(fecp, hash_table_high, fep->fec.hthi); 229 FW(fecp, grp_hash_table_high, fep->fec.hthi);
230 FW(fecp, hash_table_low, fep->fec.htlo); 230 FW(fecp, grp_hash_table_low, fep->fec.htlo);
231} 231}
232 232
233static void set_multicast_list(struct net_device *dev) 233static void set_multicast_list(struct net_device *dev)
@@ -273,8 +273,8 @@ static void restart(struct net_device *dev)
273 /* 273 /*
274 * Reset all multicast. 274 * Reset all multicast.
275 */ 275 */
276 FW(fecp, hash_table_high, fep->fec.hthi); 276 FW(fecp, grp_hash_table_high, fep->fec.hthi);
277 FW(fecp, hash_table_low, fep->fec.htlo); 277 FW(fecp, grp_hash_table_low, fep->fec.htlo);
278 278
279 /* 279 /*
280 * Set maximum receive buffer size. 280 * Set maximum receive buffer size.
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 7e840d373ab3..6a2e150e75bb 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -101,17 +101,20 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus)
101 return 0; 101 return 0;
102} 102}
103 103
104static struct of_device_id fs_enet_mdio_fec_match[];
104static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) 105static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
105{ 106{
107 const struct of_device_id *match;
106 struct resource res; 108 struct resource res;
107 struct mii_bus *new_bus; 109 struct mii_bus *new_bus;
108 struct fec_info *fec; 110 struct fec_info *fec;
109 int (*get_bus_freq)(struct device_node *); 111 int (*get_bus_freq)(struct device_node *);
110 int ret = -ENOMEM, clock, speed; 112 int ret = -ENOMEM, clock, speed;
111 113
112 if (!ofdev->dev.of_match) 114 match = of_match_device(fs_enet_mdio_fec_match, &ofdev->dev);
115 if (!match)
113 return -EINVAL; 116 return -EINVAL;
114 get_bus_freq = ofdev->dev.of_match->data; 117 get_bus_freq = match->data;
115 118
116 new_bus = mdiobus_alloc(); 119 new_bus = mdiobus_alloc();
117 if (!new_bus) 120 if (!new_bus)
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index a31661948c42..9bd7746cbfcf 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -139,11 +139,11 @@ static int ftmac100_reset(struct ftmac100 *priv)
139 * that hardware reset completed (what the f*ck). 139 * that hardware reset completed (what the f*ck).
140 * We still need to wait for a while. 140 * We still need to wait for a while.
141 */ 141 */
142 usleep_range(500, 1000); 142 udelay(500);
143 return 0; 143 return 0;
144 } 144 }
145 145
146 usleep_range(1000, 10000); 146 udelay(1000);
147 } 147 }
148 148
149 netdev_err(netdev, "software reset failed\n"); 149 netdev_err(netdev, "software reset failed\n");
@@ -772,7 +772,7 @@ static int ftmac100_mdio_read(struct net_device *netdev, int phy_id, int reg)
772 if ((phycr & FTMAC100_PHYCR_MIIRD) == 0) 772 if ((phycr & FTMAC100_PHYCR_MIIRD) == 0)
773 return phycr & FTMAC100_PHYCR_MIIRDATA; 773 return phycr & FTMAC100_PHYCR_MIIRDATA;
774 774
775 usleep_range(100, 1000); 775 udelay(100);
776 } 776 }
777 777
778 netdev_err(netdev, "mdio read timed out\n"); 778 netdev_err(netdev, "mdio read timed out\n");
@@ -801,7 +801,7 @@ static void ftmac100_mdio_write(struct net_device *netdev, int phy_id, int reg,
801 if ((phycr & FTMAC100_PHYCR_MIIWR) == 0) 801 if ((phycr & FTMAC100_PHYCR_MIIWR) == 0)
802 return; 802 return;
803 803
804 usleep_range(100, 1000); 804 udelay(100);
805 } 805 }
806 806
807 netdev_err(netdev, "mdio write timed out\n"); 807 netdev_err(netdev, "mdio write timed out\n");
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c
index c5ef62ceb840..1cd481c04202 100644
--- a/drivers/net/hydra.c
+++ b/drivers/net/hydra.c
@@ -98,15 +98,15 @@ static const struct net_device_ops hydra_netdev_ops = {
98 .ndo_open = hydra_open, 98 .ndo_open = hydra_open,
99 .ndo_stop = hydra_close, 99 .ndo_stop = hydra_close,
100 100
101 .ndo_start_xmit = ei_start_xmit, 101 .ndo_start_xmit = __ei_start_xmit,
102 .ndo_tx_timeout = ei_tx_timeout, 102 .ndo_tx_timeout = __ei_tx_timeout,
103 .ndo_get_stats = ei_get_stats, 103 .ndo_get_stats = __ei_get_stats,
104 .ndo_set_multicast_list = ei_set_multicast_list, 104 .ndo_set_multicast_list = __ei_set_multicast_list,
105 .ndo_validate_addr = eth_validate_addr, 105 .ndo_validate_addr = eth_validate_addr,
106 .ndo_set_mac_address = eth_mac_addr, 106 .ndo_set_mac_address = eth_mac_addr,
107 .ndo_change_mtu = eth_change_mtu, 107 .ndo_change_mtu = eth_change_mtu,
108#ifdef CONFIG_NET_POLL_CONTROLLER 108#ifdef CONFIG_NET_POLL_CONTROLLER
109 .ndo_poll_controller = ei_poll, 109 .ndo_poll_controller = __ei_poll,
110#endif 110#endif
111}; 111};
112 112
@@ -125,7 +125,7 @@ static int __devinit hydra_init(struct zorro_dev *z)
125 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 125 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
126 }; 126 };
127 127
128 dev = alloc_ei_netdev(); 128 dev = ____alloc_ei_netdev(0);
129 if (!dev) 129 if (!dev)
130 return -ENOMEM; 130 return -ENOMEM;
131 131
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 6f8adc7f5d7c..e145f2c455cb 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5100,11 +5100,6 @@ err_set_interrupt:
5100 return err; 5100 return err;
5101} 5101}
5102 5102
5103static void ring_free_rcu(struct rcu_head *head)
5104{
5105 kfree(container_of(head, struct ixgbe_ring, rcu));
5106}
5107
5108/** 5103/**
5109 * ixgbe_clear_interrupt_scheme - Clear the current interrupt scheme settings 5104 * ixgbe_clear_interrupt_scheme - Clear the current interrupt scheme settings
5110 * @adapter: board private structure to clear interrupt scheme on 5105 * @adapter: board private structure to clear interrupt scheme on
@@ -5126,7 +5121,7 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter)
5126 /* ixgbe_get_stats64() might access this ring, we must wait 5121 /* ixgbe_get_stats64() might access this ring, we must wait
5127 * a grace period before freeing it. 5122 * a grace period before freeing it.
5128 */ 5123 */
5129 call_rcu(&ring->rcu, ring_free_rcu); 5124 kfree_rcu(ring, rcu);
5130 adapter->rx_ring[i] = NULL; 5125 adapter->rx_ring[i] = NULL;
5131 } 5126 }
5132 5127
diff --git a/drivers/net/lantiq_etop.c b/drivers/net/lantiq_etop.c
new file mode 100644
index 000000000000..45f252b7da30
--- /dev/null
+++ b/drivers/net/lantiq_etop.c
@@ -0,0 +1,805 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
14 *
15 * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
16 */
17
18#include <linux/kernel.h>
19#include <linux/slab.h>
20#include <linux/errno.h>
21#include <linux/types.h>
22#include <linux/interrupt.h>
23#include <linux/uaccess.h>
24#include <linux/in.h>
25#include <linux/netdevice.h>
26#include <linux/etherdevice.h>
27#include <linux/phy.h>
28#include <linux/ip.h>
29#include <linux/tcp.h>
30#include <linux/skbuff.h>
31#include <linux/mm.h>
32#include <linux/platform_device.h>
33#include <linux/ethtool.h>
34#include <linux/init.h>
35#include <linux/delay.h>
36#include <linux/io.h>
37
38#include <asm/checksum.h>
39
40#include <lantiq_soc.h>
41#include <xway_dma.h>
42#include <lantiq_platform.h>
43
44#define LTQ_ETOP_MDIO 0x11804
45#define MDIO_REQUEST 0x80000000
46#define MDIO_READ 0x40000000
47#define MDIO_ADDR_MASK 0x1f
48#define MDIO_ADDR_OFFSET 0x15
49#define MDIO_REG_MASK 0x1f
50#define MDIO_REG_OFFSET 0x10
51#define MDIO_VAL_MASK 0xffff
52
53#define PPE32_CGEN 0x800
54#define LQ_PPE32_ENET_MAC_CFG 0x1840
55
56#define LTQ_ETOP_ENETS0 0x11850
57#define LTQ_ETOP_MAC_DA0 0x1186C
58#define LTQ_ETOP_MAC_DA1 0x11870
59#define LTQ_ETOP_CFG 0x16020
60#define LTQ_ETOP_IGPLEN 0x16080
61
62#define MAX_DMA_CHAN 0x8
63#define MAX_DMA_CRC_LEN 0x4
64#define MAX_DMA_DATA_LEN 0x600
65
66#define ETOP_FTCU BIT(28)
67#define ETOP_MII_MASK 0xf
68#define ETOP_MII_NORMAL 0xd
69#define ETOP_MII_REVERSE 0xe
70#define ETOP_PLEN_UNDER 0x40
71#define ETOP_CGEN 0x800
72
73/* use 2 static channels for TX/RX */
74#define LTQ_ETOP_TX_CHANNEL 1
75#define LTQ_ETOP_RX_CHANNEL 6
76#define IS_TX(x) (x == LTQ_ETOP_TX_CHANNEL)
77#define IS_RX(x) (x == LTQ_ETOP_RX_CHANNEL)
78
79#define ltq_etop_r32(x) ltq_r32(ltq_etop_membase + (x))
80#define ltq_etop_w32(x, y) ltq_w32(x, ltq_etop_membase + (y))
81#define ltq_etop_w32_mask(x, y, z) \
82 ltq_w32_mask(x, y, ltq_etop_membase + (z))
83
84#define DRV_VERSION "1.0"
85
86static void __iomem *ltq_etop_membase;
87
88struct ltq_etop_chan {
89 int idx;
90 int tx_free;
91 struct net_device *netdev;
92 struct napi_struct napi;
93 struct ltq_dma_channel dma;
94 struct sk_buff *skb[LTQ_DESC_NUM];
95};
96
97struct ltq_etop_priv {
98 struct net_device *netdev;
99 struct ltq_eth_data *pldata;
100 struct resource *res;
101
102 struct mii_bus *mii_bus;
103 struct phy_device *phydev;
104
105 struct ltq_etop_chan ch[MAX_DMA_CHAN];
106 int tx_free[MAX_DMA_CHAN >> 1];
107
108 spinlock_t lock;
109};
110
111static int
112ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
113{
114 ch->skb[ch->dma.desc] = dev_alloc_skb(MAX_DMA_DATA_LEN);
115 if (!ch->skb[ch->dma.desc])
116 return -ENOMEM;
117 ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL,
118 ch->skb[ch->dma.desc]->data, MAX_DMA_DATA_LEN,
119 DMA_FROM_DEVICE);
120 ch->dma.desc_base[ch->dma.desc].addr =
121 CPHYSADDR(ch->skb[ch->dma.desc]->data);
122 ch->dma.desc_base[ch->dma.desc].ctl =
123 LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) |
124 MAX_DMA_DATA_LEN;
125 skb_reserve(ch->skb[ch->dma.desc], NET_IP_ALIGN);
126 return 0;
127}
128
129static void
130ltq_etop_hw_receive(struct ltq_etop_chan *ch)
131{
132 struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
133 struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
134 struct sk_buff *skb = ch->skb[ch->dma.desc];
135 int len = (desc->ctl & LTQ_DMA_SIZE_MASK) - MAX_DMA_CRC_LEN;
136 unsigned long flags;
137
138 spin_lock_irqsave(&priv->lock, flags);
139 if (ltq_etop_alloc_skb(ch)) {
140 netdev_err(ch->netdev,
141 "failed to allocate new rx buffer, stopping DMA\n");
142 ltq_dma_close(&ch->dma);
143 }
144 ch->dma.desc++;
145 ch->dma.desc %= LTQ_DESC_NUM;
146 spin_unlock_irqrestore(&priv->lock, flags);
147
148 skb_put(skb, len);
149 skb->dev = ch->netdev;
150 skb->protocol = eth_type_trans(skb, ch->netdev);
151 netif_receive_skb(skb);
152}
153
154static int
155ltq_etop_poll_rx(struct napi_struct *napi, int budget)
156{
157 struct ltq_etop_chan *ch = container_of(napi,
158 struct ltq_etop_chan, napi);
159 int rx = 0;
160 int complete = 0;
161
162 while ((rx < budget) && !complete) {
163 struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
164
165 if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) {
166 ltq_etop_hw_receive(ch);
167 rx++;
168 } else {
169 complete = 1;
170 }
171 }
172 if (complete || !rx) {
173 napi_complete(&ch->napi);
174 ltq_dma_ack_irq(&ch->dma);
175 }
176 return rx;
177}
178
179static int
180ltq_etop_poll_tx(struct napi_struct *napi, int budget)
181{
182 struct ltq_etop_chan *ch =
183 container_of(napi, struct ltq_etop_chan, napi);
184 struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
185 struct netdev_queue *txq =
186 netdev_get_tx_queue(ch->netdev, ch->idx >> 1);
187 unsigned long flags;
188
189 spin_lock_irqsave(&priv->lock, flags);
190 while ((ch->dma.desc_base[ch->tx_free].ctl &
191 (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) {
192 dev_kfree_skb_any(ch->skb[ch->tx_free]);
193 ch->skb[ch->tx_free] = NULL;
194 memset(&ch->dma.desc_base[ch->tx_free], 0,
195 sizeof(struct ltq_dma_desc));
196 ch->tx_free++;
197 ch->tx_free %= LTQ_DESC_NUM;
198 }
199 spin_unlock_irqrestore(&priv->lock, flags);
200
201 if (netif_tx_queue_stopped(txq))
202 netif_tx_start_queue(txq);
203 napi_complete(&ch->napi);
204 ltq_dma_ack_irq(&ch->dma);
205 return 1;
206}
207
208static irqreturn_t
209ltq_etop_dma_irq(int irq, void *_priv)
210{
211 struct ltq_etop_priv *priv = _priv;
212 int ch = irq - LTQ_DMA_CH0_INT;
213
214 napi_schedule(&priv->ch[ch].napi);
215 return IRQ_HANDLED;
216}
217
218static void
219ltq_etop_free_channel(struct net_device *dev, struct ltq_etop_chan *ch)
220{
221 struct ltq_etop_priv *priv = netdev_priv(dev);
222
223 ltq_dma_free(&ch->dma);
224 if (ch->dma.irq)
225 free_irq(ch->dma.irq, priv);
226 if (IS_RX(ch->idx)) {
227 int desc;
228 for (desc = 0; desc < LTQ_DESC_NUM; desc++)
229 dev_kfree_skb_any(ch->skb[ch->dma.desc]);
230 }
231}
232
233static void
234ltq_etop_hw_exit(struct net_device *dev)
235{
236 struct ltq_etop_priv *priv = netdev_priv(dev);
237 int i;
238
239 ltq_pmu_disable(PMU_PPE);
240 for (i = 0; i < MAX_DMA_CHAN; i++)
241 if (IS_TX(i) || IS_RX(i))
242 ltq_etop_free_channel(dev, &priv->ch[i]);
243}
244
245static int
246ltq_etop_hw_init(struct net_device *dev)
247{
248 struct ltq_etop_priv *priv = netdev_priv(dev);
249 int i;
250
251 ltq_pmu_enable(PMU_PPE);
252
253 switch (priv->pldata->mii_mode) {
254 case PHY_INTERFACE_MODE_RMII:
255 ltq_etop_w32_mask(ETOP_MII_MASK,
256 ETOP_MII_REVERSE, LTQ_ETOP_CFG);
257 break;
258
259 case PHY_INTERFACE_MODE_MII:
260 ltq_etop_w32_mask(ETOP_MII_MASK,
261 ETOP_MII_NORMAL, LTQ_ETOP_CFG);
262 break;
263
264 default:
265 netdev_err(dev, "unknown mii mode %d\n",
266 priv->pldata->mii_mode);
267 return -ENOTSUPP;
268 }
269
270 /* enable crc generation */
271 ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG);
272
273 ltq_dma_init_port(DMA_PORT_ETOP);
274
275 for (i = 0; i < MAX_DMA_CHAN; i++) {
276 int irq = LTQ_DMA_CH0_INT + i;
277 struct ltq_etop_chan *ch = &priv->ch[i];
278
279 ch->idx = ch->dma.nr = i;
280
281 if (IS_TX(i)) {
282 ltq_dma_alloc_tx(&ch->dma);
283 request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
284 "etop_tx", priv);
285 } else if (IS_RX(i)) {
286 ltq_dma_alloc_rx(&ch->dma);
287 for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM;
288 ch->dma.desc++)
289 if (ltq_etop_alloc_skb(ch))
290 return -ENOMEM;
291 ch->dma.desc = 0;
292 request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
293 "etop_rx", priv);
294 }
295 ch->dma.irq = irq;
296 }
297 return 0;
298}
299
300static void
301ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
302{
303 strcpy(info->driver, "Lantiq ETOP");
304 strcpy(info->bus_info, "internal");
305 strcpy(info->version, DRV_VERSION);
306}
307
308static int
309ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
310{
311 struct ltq_etop_priv *priv = netdev_priv(dev);
312
313 return phy_ethtool_gset(priv->phydev, cmd);
314}
315
316static int
317ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
318{
319 struct ltq_etop_priv *priv = netdev_priv(dev);
320
321 return phy_ethtool_sset(priv->phydev, cmd);
322}
323
324static int
325ltq_etop_nway_reset(struct net_device *dev)
326{
327 struct ltq_etop_priv *priv = netdev_priv(dev);
328
329 return phy_start_aneg(priv->phydev);
330}
331
332static const struct ethtool_ops ltq_etop_ethtool_ops = {
333 .get_drvinfo = ltq_etop_get_drvinfo,
334 .get_settings = ltq_etop_get_settings,
335 .set_settings = ltq_etop_set_settings,
336 .nway_reset = ltq_etop_nway_reset,
337};
338
339static int
340ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, int phy_reg, u16 phy_data)
341{
342 u32 val = MDIO_REQUEST |
343 ((phy_addr & MDIO_ADDR_MASK) << MDIO_ADDR_OFFSET) |
344 ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET) |
345 phy_data;
346
347 while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST)
348 ;
349 ltq_etop_w32(val, LTQ_ETOP_MDIO);
350 return 0;
351}
352
353static int
354ltq_etop_mdio_rd(struct mii_bus *bus, int phy_addr, int phy_reg)
355{
356 u32 val = MDIO_REQUEST | MDIO_READ |
357 ((phy_addr & MDIO_ADDR_MASK) << MDIO_ADDR_OFFSET) |
358 ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET);
359
360 while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST)
361 ;
362 ltq_etop_w32(val, LTQ_ETOP_MDIO);
363 while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST)
364 ;
365 val = ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_VAL_MASK;
366 return val;
367}
368
369static void
370ltq_etop_mdio_link(struct net_device *dev)
371{
372 /* nothing to do */
373}
374
375static int
376ltq_etop_mdio_probe(struct net_device *dev)
377{
378 struct ltq_etop_priv *priv = netdev_priv(dev);
379 struct phy_device *phydev = NULL;
380 int phy_addr;
381
382 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
383 if (priv->mii_bus->phy_map[phy_addr]) {
384 phydev = priv->mii_bus->phy_map[phy_addr];
385 break;
386 }
387 }
388
389 if (!phydev) {
390 netdev_err(dev, "no PHY found\n");
391 return -ENODEV;
392 }
393
394 phydev = phy_connect(dev, dev_name(&phydev->dev), &ltq_etop_mdio_link,
395 0, priv->pldata->mii_mode);
396
397 if (IS_ERR(phydev)) {
398 netdev_err(dev, "Could not attach to PHY\n");
399 return PTR_ERR(phydev);
400 }
401
402 phydev->supported &= (SUPPORTED_10baseT_Half
403 | SUPPORTED_10baseT_Full
404 | SUPPORTED_100baseT_Half
405 | SUPPORTED_100baseT_Full
406 | SUPPORTED_Autoneg
407 | SUPPORTED_MII
408 | SUPPORTED_TP);
409
410 phydev->advertising = phydev->supported;
411 priv->phydev = phydev;
412 pr_info("%s: attached PHY [%s] (phy_addr=%s, irq=%d)\n",
413 dev->name, phydev->drv->name,
414 dev_name(&phydev->dev), phydev->irq);
415
416 return 0;
417}
418
419static int
420ltq_etop_mdio_init(struct net_device *dev)
421{
422 struct ltq_etop_priv *priv = netdev_priv(dev);
423 int i;
424 int err;
425
426 priv->mii_bus = mdiobus_alloc();
427 if (!priv->mii_bus) {
428 netdev_err(dev, "failed to allocate mii bus\n");
429 err = -ENOMEM;
430 goto err_out;
431 }
432
433 priv->mii_bus->priv = dev;
434 priv->mii_bus->read = ltq_etop_mdio_rd;
435 priv->mii_bus->write = ltq_etop_mdio_wr;
436 priv->mii_bus->name = "ltq_mii";
437 snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0);
438 priv->mii_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
439 if (!priv->mii_bus->irq) {
440 err = -ENOMEM;
441 goto err_out_free_mdiobus;
442 }
443
444 for (i = 0; i < PHY_MAX_ADDR; ++i)
445 priv->mii_bus->irq[i] = PHY_POLL;
446
447 if (mdiobus_register(priv->mii_bus)) {
448 err = -ENXIO;
449 goto err_out_free_mdio_irq;
450 }
451
452 if (ltq_etop_mdio_probe(dev)) {
453 err = -ENXIO;
454 goto err_out_unregister_bus;
455 }
456 return 0;
457
458err_out_unregister_bus:
459 mdiobus_unregister(priv->mii_bus);
460err_out_free_mdio_irq:
461 kfree(priv->mii_bus->irq);
462err_out_free_mdiobus:
463 mdiobus_free(priv->mii_bus);
464err_out:
465 return err;
466}
467
468static void
469ltq_etop_mdio_cleanup(struct net_device *dev)
470{
471 struct ltq_etop_priv *priv = netdev_priv(dev);
472
473 phy_disconnect(priv->phydev);
474 mdiobus_unregister(priv->mii_bus);
475 kfree(priv->mii_bus->irq);
476 mdiobus_free(priv->mii_bus);
477}
478
479static int
480ltq_etop_open(struct net_device *dev)
481{
482 struct ltq_etop_priv *priv = netdev_priv(dev);
483 int i;
484
485 for (i = 0; i < MAX_DMA_CHAN; i++) {
486 struct ltq_etop_chan *ch = &priv->ch[i];
487
488 if (!IS_TX(i) && (!IS_RX(i)))
489 continue;
490 ltq_dma_open(&ch->dma);
491 napi_enable(&ch->napi);
492 }
493 phy_start(priv->phydev);
494 netif_tx_start_all_queues(dev);
495 return 0;
496}
497
498static int
499ltq_etop_stop(struct net_device *dev)
500{
501 struct ltq_etop_priv *priv = netdev_priv(dev);
502 int i;
503
504 netif_tx_stop_all_queues(dev);
505 phy_stop(priv->phydev);
506 for (i = 0; i < MAX_DMA_CHAN; i++) {
507 struct ltq_etop_chan *ch = &priv->ch[i];
508
509 if (!IS_RX(i) && !IS_TX(i))
510 continue;
511 napi_disable(&ch->napi);
512 ltq_dma_close(&ch->dma);
513 }
514 return 0;
515}
516
517static int
518ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
519{
520 int queue = skb_get_queue_mapping(skb);
521 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue);
522 struct ltq_etop_priv *priv = netdev_priv(dev);
523 struct ltq_etop_chan *ch = &priv->ch[(queue << 1) | 1];
524 struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
525 int len;
526 unsigned long flags;
527 u32 byte_offset;
528
529 len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
530
531 if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
532 dev_kfree_skb_any(skb);
533 netdev_err(dev, "tx ring full\n");
534 netif_tx_stop_queue(txq);
535 return NETDEV_TX_BUSY;
536 }
537
538 /* dma needs to start on a 16 byte aligned address */
539 byte_offset = CPHYSADDR(skb->data) % 16;
540 ch->skb[ch->dma.desc] = skb;
541
542 dev->trans_start = jiffies;
543
544 spin_lock_irqsave(&priv->lock, flags);
545 desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len,
546 DMA_TO_DEVICE)) - byte_offset;
547 wmb();
548 desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP |
549 LTQ_DMA_TX_OFFSET(byte_offset) | (len & LTQ_DMA_SIZE_MASK);
550 ch->dma.desc++;
551 ch->dma.desc %= LTQ_DESC_NUM;
552 spin_unlock_irqrestore(&priv->lock, flags);
553
554 if (ch->dma.desc_base[ch->dma.desc].ctl & LTQ_DMA_OWN)
555 netif_tx_stop_queue(txq);
556
557 return NETDEV_TX_OK;
558}
559
560static int
561ltq_etop_change_mtu(struct net_device *dev, int new_mtu)
562{
563 int ret = eth_change_mtu(dev, new_mtu);
564
565 if (!ret) {
566 struct ltq_etop_priv *priv = netdev_priv(dev);
567 unsigned long flags;
568
569 spin_lock_irqsave(&priv->lock, flags);
570 ltq_etop_w32((ETOP_PLEN_UNDER << 16) | new_mtu,
571 LTQ_ETOP_IGPLEN);
572 spin_unlock_irqrestore(&priv->lock, flags);
573 }
574 return ret;
575}
576
577static int
578ltq_etop_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
579{
580 struct ltq_etop_priv *priv = netdev_priv(dev);
581
582 /* TODO: mii-toll reports "No MII transceiver present!." ?!*/
583 return phy_mii_ioctl(priv->phydev, rq, cmd);
584}
585
586static int
587ltq_etop_set_mac_address(struct net_device *dev, void *p)
588{
589 int ret = eth_mac_addr(dev, p);
590
591 if (!ret) {
592 struct ltq_etop_priv *priv = netdev_priv(dev);
593 unsigned long flags;
594
595 /* store the mac for the unicast filter */
596 spin_lock_irqsave(&priv->lock, flags);
597 ltq_etop_w32(*((u32 *)dev->dev_addr), LTQ_ETOP_MAC_DA0);
598 ltq_etop_w32(*((u16 *)&dev->dev_addr[4]) << 16,
599 LTQ_ETOP_MAC_DA1);
600 spin_unlock_irqrestore(&priv->lock, flags);
601 }
602 return ret;
603}
604
605static void
606ltq_etop_set_multicast_list(struct net_device *dev)
607{
608 struct ltq_etop_priv *priv = netdev_priv(dev);
609 unsigned long flags;
610
611 /* ensure that the unicast filter is not enabled in promiscious mode */
612 spin_lock_irqsave(&priv->lock, flags);
613 if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI))
614 ltq_etop_w32_mask(ETOP_FTCU, 0, LTQ_ETOP_ENETS0);
615 else
616 ltq_etop_w32_mask(0, ETOP_FTCU, LTQ_ETOP_ENETS0);
617 spin_unlock_irqrestore(&priv->lock, flags);
618}
619
620static u16
621ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb)
622{
623 /* we are currently only using the first queue */
624 return 0;
625}
626
627static int
628ltq_etop_init(struct net_device *dev)
629{
630 struct ltq_etop_priv *priv = netdev_priv(dev);
631 struct sockaddr mac;
632 int err;
633
634 ether_setup(dev);
635 dev->watchdog_timeo = 10 * HZ;
636 err = ltq_etop_hw_init(dev);
637 if (err)
638 goto err_hw;
639 ltq_etop_change_mtu(dev, 1500);
640
641 memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr));
642 if (!is_valid_ether_addr(mac.sa_data)) {
643 pr_warn("etop: invalid MAC, using random\n");
644 random_ether_addr(mac.sa_data);
645 }
646
647 err = ltq_etop_set_mac_address(dev, &mac);
648 if (err)
649 goto err_netdev;
650 ltq_etop_set_multicast_list(dev);
651 err = ltq_etop_mdio_init(dev);
652 if (err)
653 goto err_netdev;
654 return 0;
655
656err_netdev:
657 unregister_netdev(dev);
658 free_netdev(dev);
659err_hw:
660 ltq_etop_hw_exit(dev);
661 return err;
662}
663
664static void
665ltq_etop_tx_timeout(struct net_device *dev)
666{
667 int err;
668
669 ltq_etop_hw_exit(dev);
670 err = ltq_etop_hw_init(dev);
671 if (err)
672 goto err_hw;
673 dev->trans_start = jiffies;
674 netif_wake_queue(dev);
675 return;
676
677err_hw:
678 ltq_etop_hw_exit(dev);
679 netdev_err(dev, "failed to restart etop after TX timeout\n");
680}
681
682static const struct net_device_ops ltq_eth_netdev_ops = {
683 .ndo_open = ltq_etop_open,
684 .ndo_stop = ltq_etop_stop,
685 .ndo_start_xmit = ltq_etop_tx,
686 .ndo_change_mtu = ltq_etop_change_mtu,
687 .ndo_do_ioctl = ltq_etop_ioctl,
688 .ndo_set_mac_address = ltq_etop_set_mac_address,
689 .ndo_validate_addr = eth_validate_addr,
690 .ndo_set_multicast_list = ltq_etop_set_multicast_list,
691 .ndo_select_queue = ltq_etop_select_queue,
692 .ndo_init = ltq_etop_init,
693 .ndo_tx_timeout = ltq_etop_tx_timeout,
694};
695
696static int __init
697ltq_etop_probe(struct platform_device *pdev)
698{
699 struct net_device *dev;
700 struct ltq_etop_priv *priv;
701 struct resource *res;
702 int err;
703 int i;
704
705 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
706 if (!res) {
707 dev_err(&pdev->dev, "failed to get etop resource\n");
708 err = -ENOENT;
709 goto err_out;
710 }
711
712 res = devm_request_mem_region(&pdev->dev, res->start,
713 resource_size(res), dev_name(&pdev->dev));
714 if (!res) {
715 dev_err(&pdev->dev, "failed to request etop resource\n");
716 err = -EBUSY;
717 goto err_out;
718 }
719
720 ltq_etop_membase = devm_ioremap_nocache(&pdev->dev,
721 res->start, resource_size(res));
722 if (!ltq_etop_membase) {
723 dev_err(&pdev->dev, "failed to remap etop engine %d\n",
724 pdev->id);
725 err = -ENOMEM;
726 goto err_out;
727 }
728
729 dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4);
730 strcpy(dev->name, "eth%d");
731 dev->netdev_ops = &ltq_eth_netdev_ops;
732 dev->ethtool_ops = &ltq_etop_ethtool_ops;
733 priv = netdev_priv(dev);
734 priv->res = res;
735 priv->pldata = dev_get_platdata(&pdev->dev);
736 priv->netdev = dev;
737 spin_lock_init(&priv->lock);
738
739 for (i = 0; i < MAX_DMA_CHAN; i++) {
740 if (IS_TX(i))
741 netif_napi_add(dev, &priv->ch[i].napi,
742 ltq_etop_poll_tx, 8);
743 else if (IS_RX(i))
744 netif_napi_add(dev, &priv->ch[i].napi,
745 ltq_etop_poll_rx, 32);
746 priv->ch[i].netdev = dev;
747 }
748
749 err = register_netdev(dev);
750 if (err)
751 goto err_free;
752
753 platform_set_drvdata(pdev, dev);
754 return 0;
755
756err_free:
757 kfree(dev);
758err_out:
759 return err;
760}
761
762static int __devexit
763ltq_etop_remove(struct platform_device *pdev)
764{
765 struct net_device *dev = platform_get_drvdata(pdev);
766
767 if (dev) {
768 netif_tx_stop_all_queues(dev);
769 ltq_etop_hw_exit(dev);
770 ltq_etop_mdio_cleanup(dev);
771 unregister_netdev(dev);
772 }
773 return 0;
774}
775
776static struct platform_driver ltq_mii_driver = {
777 .remove = __devexit_p(ltq_etop_remove),
778 .driver = {
779 .name = "ltq_etop",
780 .owner = THIS_MODULE,
781 },
782};
783
784int __init
785init_ltq_etop(void)
786{
787 int ret = platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
788
789 if (ret)
790 pr_err("ltq_etop: Error registering platfom driver!");
791 return ret;
792}
793
794static void __exit
795exit_ltq_etop(void)
796{
797 platform_driver_unregister(&ltq_mii_driver);
798}
799
800module_init(init_ltq_etop);
801module_exit(exit_ltq_etop);
802
803MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
804MODULE_DESCRIPTION("Lantiq SoC ETOP");
805MODULE_LICENSE("GPL");
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 78e34e9e4f00..d8e4e69ad0b9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -603,21 +603,13 @@ static int macvlan_port_create(struct net_device *dev)
603 return err; 603 return err;
604} 604}
605 605
606static void macvlan_port_rcu_free(struct rcu_head *head)
607{
608 struct macvlan_port *port;
609
610 port = container_of(head, struct macvlan_port, rcu);
611 kfree(port);
612}
613
614static void macvlan_port_destroy(struct net_device *dev) 606static void macvlan_port_destroy(struct net_device *dev)
615{ 607{
616 struct macvlan_port *port = macvlan_port_get(dev); 608 struct macvlan_port *port = macvlan_port_get(dev);
617 609
618 dev->priv_flags &= ~IFF_MACVLAN_PORT; 610 dev->priv_flags &= ~IFF_MACVLAN_PORT;
619 netdev_rx_handler_unregister(dev); 611 netdev_rx_handler_unregister(dev);
620 call_rcu(&port->rcu, macvlan_port_rcu_free); 612 kfree_rcu(port, rcu);
621} 613}
622 614
623static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[]) 615static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])
diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index 0a6c6a2e7550..d4fc00b1ff93 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -49,6 +49,10 @@ static u32 mii_get_an(struct mii_if_info *mii, u16 addr)
49 result |= ADVERTISED_100baseT_Half; 49 result |= ADVERTISED_100baseT_Half;
50 if (advert & ADVERTISE_100FULL) 50 if (advert & ADVERTISE_100FULL)
51 result |= ADVERTISED_100baseT_Full; 51 result |= ADVERTISED_100baseT_Full;
52 if (advert & ADVERTISE_PAUSE_CAP)
53 result |= ADVERTISED_Pause;
54 if (advert & ADVERTISE_PAUSE_ASYM)
55 result |= ADVERTISED_Asym_Pause;
52 56
53 return result; 57 return result;
54} 58}
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c
index 30be8c634ebd..7298a34bc795 100644
--- a/drivers/net/ne-h8300.c
+++ b/drivers/net/ne-h8300.c
@@ -167,7 +167,7 @@ static void cleanup_card(struct net_device *dev)
167#ifndef MODULE 167#ifndef MODULE
168struct net_device * __init ne_probe(int unit) 168struct net_device * __init ne_probe(int unit)
169{ 169{
170 struct net_device *dev = alloc_ei_netdev(); 170 struct net_device *dev = ____alloc_ei_netdev(0);
171 int err; 171 int err;
172 172
173 if (!dev) 173 if (!dev)
@@ -197,15 +197,15 @@ static const struct net_device_ops ne_netdev_ops = {
197 .ndo_open = ne_open, 197 .ndo_open = ne_open,
198 .ndo_stop = ne_close, 198 .ndo_stop = ne_close,
199 199
200 .ndo_start_xmit = ei_start_xmit, 200 .ndo_start_xmit = __ei_start_xmit,
201 .ndo_tx_timeout = ei_tx_timeout, 201 .ndo_tx_timeout = __ei_tx_timeout,
202 .ndo_get_stats = ei_get_stats, 202 .ndo_get_stats = __ei_get_stats,
203 .ndo_set_multicast_list = ei_set_multicast_list, 203 .ndo_set_multicast_list = __ei_set_multicast_list,
204 .ndo_validate_addr = eth_validate_addr, 204 .ndo_validate_addr = eth_validate_addr,
205 .ndo_set_mac_address = eth_mac_addr, 205 .ndo_set_mac_address = eth_mac_addr,
206 .ndo_change_mtu = eth_change_mtu, 206 .ndo_change_mtu = eth_change_mtu,
207#ifdef CONFIG_NET_POLL_CONTROLLER 207#ifdef CONFIG_NET_POLL_CONTROLLER
208 .ndo_poll_controller = ei_poll, 208 .ndo_poll_controller = __ei_poll,
209#endif 209#endif
210}; 210};
211 211
@@ -637,7 +637,7 @@ int init_module(void)
637 int err; 637 int err;
638 638
639 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { 639 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
640 struct net_device *dev = alloc_ei_netdev(); 640 struct net_device *dev = ____alloc_ei_netdev(0);
641 if (!dev) 641 if (!dev)
642 break; 642 break;
643 if (io[this_dev]) { 643 if (io[this_dev]) {
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index dfb67eb2a94b..eb41e44921e6 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -671,6 +671,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
671 goto done; 671 goto done;
672 672
673 spin_lock_irqsave(&target_list_lock, flags); 673 spin_lock_irqsave(&target_list_lock, flags);
674restart:
674 list_for_each_entry(nt, &target_list, list) { 675 list_for_each_entry(nt, &target_list, list) {
675 netconsole_target_get(nt); 676 netconsole_target_get(nt);
676 if (nt->np.dev == dev) { 677 if (nt->np.dev == dev) {
@@ -683,9 +684,16 @@ static int netconsole_netdev_event(struct notifier_block *this,
683 * rtnl_lock already held 684 * rtnl_lock already held
684 */ 685 */
685 if (nt->np.dev) { 686 if (nt->np.dev) {
687 spin_unlock_irqrestore(
688 &target_list_lock,
689 flags);
686 __netpoll_cleanup(&nt->np); 690 __netpoll_cleanup(&nt->np);
691 spin_lock_irqsave(&target_list_lock,
692 flags);
687 dev_put(nt->np.dev); 693 dev_put(nt->np.dev);
688 nt->np.dev = NULL; 694 nt->np.dev = NULL;
695 netconsole_target_put(nt);
696 goto restart;
689 } 697 }
690 /* Fall through */ 698 /* Fall through */
691 case NETDEV_GOING_DOWN: 699 case NETDEV_GOING_DOWN:
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index 2ef2f9cdefa6..56d049a472da 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -34,6 +34,10 @@ const char pch_driver_version[] = DRV_VERSION;
34#define PCH_GBE_COPYBREAK_DEFAULT 256 34#define PCH_GBE_COPYBREAK_DEFAULT 256
35#define PCH_GBE_PCI_BAR 1 35#define PCH_GBE_PCI_BAR 1
36 36
37/* Macros for ML7223 */
38#define PCI_VENDOR_ID_ROHM 0x10db
39#define PCI_DEVICE_ID_ROHM_ML7223_GBE 0x8013
40
37#define PCH_GBE_TX_WEIGHT 64 41#define PCH_GBE_TX_WEIGHT 64
38#define PCH_GBE_RX_WEIGHT 64 42#define PCH_GBE_RX_WEIGHT 64
39#define PCH_GBE_RX_BUFFER_WRITE 16 43#define PCH_GBE_RX_BUFFER_WRITE 16
@@ -43,8 +47,7 @@ const char pch_driver_version[] = DRV_VERSION;
43 47
44#define PCH_GBE_MAC_RGMII_CTRL_SETTING ( \ 48#define PCH_GBE_MAC_RGMII_CTRL_SETTING ( \
45 PCH_GBE_CHIP_TYPE_INTERNAL | \ 49 PCH_GBE_CHIP_TYPE_INTERNAL | \
46 PCH_GBE_RGMII_MODE_RGMII | \ 50 PCH_GBE_RGMII_MODE_RGMII \
47 PCH_GBE_CRS_SEL \
48 ) 51 )
49 52
50/* Ethertype field values */ 53/* Ethertype field values */
@@ -1494,12 +1497,11 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter,
1494 /* Write meta date of skb */ 1497 /* Write meta date of skb */
1495 skb_put(skb, length); 1498 skb_put(skb, length);
1496 skb->protocol = eth_type_trans(skb, netdev); 1499 skb->protocol = eth_type_trans(skb, netdev);
1497 if ((tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) == 1500 if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK)
1498 PCH_GBE_RXD_ACC_STAT_TCPIPOK) {
1499 skb->ip_summed = CHECKSUM_UNNECESSARY;
1500 } else {
1501 skb->ip_summed = CHECKSUM_NONE; 1501 skb->ip_summed = CHECKSUM_NONE;
1502 } 1502 else
1503 skb->ip_summed = CHECKSUM_UNNECESSARY;
1504
1503 napi_gro_receive(&adapter->napi, skb); 1505 napi_gro_receive(&adapter->napi, skb);
1504 (*work_done)++; 1506 (*work_done)++;
1505 pr_debug("Receive skb->ip_summed: %d length: %d\n", 1507 pr_debug("Receive skb->ip_summed: %d length: %d\n",
@@ -2420,6 +2422,13 @@ static DEFINE_PCI_DEVICE_TABLE(pch_gbe_pcidev_id) = {
2420 .class = (PCI_CLASS_NETWORK_ETHERNET << 8), 2422 .class = (PCI_CLASS_NETWORK_ETHERNET << 8),
2421 .class_mask = (0xFFFF00) 2423 .class_mask = (0xFFFF00)
2422 }, 2424 },
2425 {.vendor = PCI_VENDOR_ID_ROHM,
2426 .device = PCI_DEVICE_ID_ROHM_ML7223_GBE,
2427 .subvendor = PCI_ANY_ID,
2428 .subdevice = PCI_ANY_ID,
2429 .class = (PCI_CLASS_NETWORK_ETHERNET << 8),
2430 .class_mask = (0xFFFF00)
2431 },
2423 /* required last entry */ 2432 /* required last entry */
2424 {0} 2433 {0}
2425}; 2434};
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 493b0de3848b..397c36810a15 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -170,6 +170,16 @@ static const struct {
170}; 170};
171#undef _R 171#undef _R
172 172
173static const struct rtl_firmware_info {
174 int mac_version;
175 const char *fw_name;
176} rtl_firmware_infos[] = {
177 { .mac_version = RTL_GIGA_MAC_VER_25, .fw_name = FIRMWARE_8168D_1 },
178 { .mac_version = RTL_GIGA_MAC_VER_26, .fw_name = FIRMWARE_8168D_2 },
179 { .mac_version = RTL_GIGA_MAC_VER_29, .fw_name = FIRMWARE_8105E_1 },
180 { .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 }
181};
182
173enum cfg_version { 183enum cfg_version {
174 RTL_CFG_0 = 0x00, 184 RTL_CFG_0 = 0x00,
175 RTL_CFG_1, 185 RTL_CFG_1,
@@ -565,6 +575,7 @@ struct rtl8169_private {
565 u32 saved_wolopts; 575 u32 saved_wolopts;
566 576
567 const struct firmware *fw; 577 const struct firmware *fw;
578#define RTL_FIRMWARE_UNKNOWN ERR_PTR(-EAGAIN);
568}; 579};
569 580
570MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); 581MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
@@ -1789,25 +1800,26 @@ rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw)
1789 1800
1790static void rtl_release_firmware(struct rtl8169_private *tp) 1801static void rtl_release_firmware(struct rtl8169_private *tp)
1791{ 1802{
1792 release_firmware(tp->fw); 1803 if (!IS_ERR_OR_NULL(tp->fw))
1793 tp->fw = NULL; 1804 release_firmware(tp->fw);
1805 tp->fw = RTL_FIRMWARE_UNKNOWN;
1794} 1806}
1795 1807
1796static int rtl_apply_firmware(struct rtl8169_private *tp, const char *fw_name) 1808static void rtl_apply_firmware(struct rtl8169_private *tp)
1797{ 1809{
1798 const struct firmware **fw = &tp->fw; 1810 const struct firmware *fw = tp->fw;
1799 int rc = !*fw;
1800
1801 if (rc) {
1802 rc = request_firmware(fw, fw_name, &tp->pci_dev->dev);
1803 if (rc < 0)
1804 goto out;
1805 }
1806 1811
1807 /* TODO: release firmware once rtl_phy_write_fw signals failures. */ 1812 /* TODO: release firmware once rtl_phy_write_fw signals failures. */
1808 rtl_phy_write_fw(tp, *fw); 1813 if (!IS_ERR_OR_NULL(fw))
1809out: 1814 rtl_phy_write_fw(tp, fw);
1810 return rc; 1815}
1816
1817static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)
1818{
1819 if (rtl_readphy(tp, reg) != val)
1820 netif_warn(tp, hw, tp->dev, "chipset not ready for firmware\n");
1821 else
1822 rtl_apply_firmware(tp);
1811} 1823}
1812 1824
1813static void rtl8169s_hw_phy_config(struct rtl8169_private *tp) 1825static void rtl8169s_hw_phy_config(struct rtl8169_private *tp)
@@ -2246,10 +2258,8 @@ static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp)
2246 2258
2247 rtl_writephy(tp, 0x1f, 0x0005); 2259 rtl_writephy(tp, 0x1f, 0x0005);
2248 rtl_writephy(tp, 0x05, 0x001b); 2260 rtl_writephy(tp, 0x05, 0x001b);
2249 if ((rtl_readphy(tp, 0x06) != 0xbf00) || 2261
2250 (rtl_apply_firmware(tp, FIRMWARE_8168D_1) < 0)) { 2262 rtl_apply_firmware_cond(tp, MII_EXPANSION, 0xbf00);
2251 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2252 }
2253 2263
2254 rtl_writephy(tp, 0x1f, 0x0000); 2264 rtl_writephy(tp, 0x1f, 0x0000);
2255} 2265}
@@ -2351,10 +2361,8 @@ static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp)
2351 2361
2352 rtl_writephy(tp, 0x1f, 0x0005); 2362 rtl_writephy(tp, 0x1f, 0x0005);
2353 rtl_writephy(tp, 0x05, 0x001b); 2363 rtl_writephy(tp, 0x05, 0x001b);
2354 if ((rtl_readphy(tp, 0x06) != 0xb300) || 2364
2355 (rtl_apply_firmware(tp, FIRMWARE_8168D_2) < 0)) { 2365 rtl_apply_firmware_cond(tp, MII_EXPANSION, 0xb300);
2356 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2357 }
2358 2366
2359 rtl_writephy(tp, 0x1f, 0x0000); 2367 rtl_writephy(tp, 0x1f, 0x0000);
2360} 2368}
@@ -2474,8 +2482,7 @@ static void rtl8105e_hw_phy_config(struct rtl8169_private *tp)
2474 rtl_writephy(tp, 0x18, 0x0310); 2482 rtl_writephy(tp, 0x18, 0x0310);
2475 msleep(100); 2483 msleep(100);
2476 2484
2477 if (rtl_apply_firmware(tp, FIRMWARE_8105E_1) < 0) 2485 rtl_apply_firmware(tp);
2478 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2479 2486
2480 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init)); 2487 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
2481} 2488}
@@ -3237,6 +3244,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3237 tp->timer.data = (unsigned long) dev; 3244 tp->timer.data = (unsigned long) dev;
3238 tp->timer.function = rtl8169_phy_timer; 3245 tp->timer.function = rtl8169_phy_timer;
3239 3246
3247 tp->fw = RTL_FIRMWARE_UNKNOWN;
3248
3240 rc = register_netdev(dev); 3249 rc = register_netdev(dev);
3241 if (rc < 0) 3250 if (rc < 0)
3242 goto err_out_msi_4; 3251 goto err_out_msi_4;
@@ -3288,10 +3297,10 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
3288 3297
3289 cancel_delayed_work_sync(&tp->task); 3298 cancel_delayed_work_sync(&tp->task);
3290 3299
3291 rtl_release_firmware(tp);
3292
3293 unregister_netdev(dev); 3300 unregister_netdev(dev);
3294 3301
3302 rtl_release_firmware(tp);
3303
3295 if (pci_dev_run_wake(pdev)) 3304 if (pci_dev_run_wake(pdev))
3296 pm_runtime_get_noresume(&pdev->dev); 3305 pm_runtime_get_noresume(&pdev->dev);
3297 3306
@@ -3303,6 +3312,37 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
3303 pci_set_drvdata(pdev, NULL); 3312 pci_set_drvdata(pdev, NULL);
3304} 3313}
3305 3314
3315static void rtl_request_firmware(struct rtl8169_private *tp)
3316{
3317 int i;
3318
3319 /* Return early if the firmware is already loaded / cached. */
3320 if (!IS_ERR(tp->fw))
3321 goto out;
3322
3323 for (i = 0; i < ARRAY_SIZE(rtl_firmware_infos); i++) {
3324 const struct rtl_firmware_info *info = rtl_firmware_infos + i;
3325
3326 if (info->mac_version == tp->mac_version) {
3327 const char *name = info->fw_name;
3328 int rc;
3329
3330 rc = request_firmware(&tp->fw, name, &tp->pci_dev->dev);
3331 if (rc < 0) {
3332 netif_warn(tp, ifup, tp->dev, "unable to load "
3333 "firmware patch %s (%d)\n", name, rc);
3334 goto out_disable_request_firmware;
3335 }
3336 goto out;
3337 }
3338 }
3339
3340out_disable_request_firmware:
3341 tp->fw = NULL;
3342out:
3343 return;
3344}
3345
3306static int rtl8169_open(struct net_device *dev) 3346static int rtl8169_open(struct net_device *dev)
3307{ 3347{
3308 struct rtl8169_private *tp = netdev_priv(dev); 3348 struct rtl8169_private *tp = netdev_priv(dev);
@@ -3334,11 +3374,13 @@ static int rtl8169_open(struct net_device *dev)
3334 3374
3335 smp_mb(); 3375 smp_mb();
3336 3376
3377 rtl_request_firmware(tp);
3378
3337 retval = request_irq(dev->irq, rtl8169_interrupt, 3379 retval = request_irq(dev->irq, rtl8169_interrupt,
3338 (tp->features & RTL_FEATURE_MSI) ? 0 : IRQF_SHARED, 3380 (tp->features & RTL_FEATURE_MSI) ? 0 : IRQF_SHARED,
3339 dev->name, dev); 3381 dev->name, dev);
3340 if (retval < 0) 3382 if (retval < 0)
3341 goto err_release_ring_2; 3383 goto err_release_fw_2;
3342 3384
3343 napi_enable(&tp->napi); 3385 napi_enable(&tp->napi);
3344 3386
@@ -3359,7 +3401,8 @@ static int rtl8169_open(struct net_device *dev)
3359out: 3401out:
3360 return retval; 3402 return retval;
3361 3403
3362err_release_ring_2: 3404err_release_fw_2:
3405 rtl_release_firmware(tp);
3363 rtl8169_rx_clear(tp); 3406 rtl8169_rx_clear(tp);
3364err_free_rx_1: 3407err_free_rx_1:
3365 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, 3408 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c
index d98479030ef2..3dd45ed61f0a 100644
--- a/drivers/net/sfc/mcdi.c
+++ b/drivers/net/sfc/mcdi.c
@@ -50,6 +50,20 @@ static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx)
50 return &nic_data->mcdi; 50 return &nic_data->mcdi;
51} 51}
52 52
53static inline void
54efx_mcdi_readd(struct efx_nic *efx, efx_dword_t *value, unsigned reg)
55{
56 struct siena_nic_data *nic_data = efx->nic_data;
57 value->u32[0] = (__force __le32)__raw_readl(nic_data->mcdi_smem + reg);
58}
59
60static inline void
61efx_mcdi_writed(struct efx_nic *efx, const efx_dword_t *value, unsigned reg)
62{
63 struct siena_nic_data *nic_data = efx->nic_data;
64 __raw_writel((__force u32)value->u32[0], nic_data->mcdi_smem + reg);
65}
66
53void efx_mcdi_init(struct efx_nic *efx) 67void efx_mcdi_init(struct efx_nic *efx)
54{ 68{
55 struct efx_mcdi_iface *mcdi; 69 struct efx_mcdi_iface *mcdi;
@@ -70,8 +84,8 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd,
70 const u8 *inbuf, size_t inlen) 84 const u8 *inbuf, size_t inlen)
71{ 85{
72 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 86 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
73 unsigned pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 87 unsigned pdu = MCDI_PDU(efx);
74 unsigned doorbell = FR_CZ_MC_TREG_SMEM + MCDI_DOORBELL(efx); 88 unsigned doorbell = MCDI_DOORBELL(efx);
75 unsigned int i; 89 unsigned int i;
76 efx_dword_t hdr; 90 efx_dword_t hdr;
77 u32 xflags, seqno; 91 u32 xflags, seqno;
@@ -92,30 +106,28 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd,
92 MCDI_HEADER_SEQ, seqno, 106 MCDI_HEADER_SEQ, seqno,
93 MCDI_HEADER_XFLAGS, xflags); 107 MCDI_HEADER_XFLAGS, xflags);
94 108
95 efx_writed(efx, &hdr, pdu); 109 efx_mcdi_writed(efx, &hdr, pdu);
96 110
97 for (i = 0; i < inlen; i += 4) { 111 for (i = 0; i < inlen; i += 4)
98 _efx_writed(efx, *((__le32 *)(inbuf + i)), pdu + 4 + i); 112 efx_mcdi_writed(efx, (const efx_dword_t *)(inbuf + i),
99 /* use wmb() within loop to inhibit write combining */ 113 pdu + 4 + i);
100 wmb();
101 }
102 114
103 /* ring the doorbell with a distinctive value */ 115 /* ring the doorbell with a distinctive value */
104 _efx_writed(efx, (__force __le32) 0x45789abc, doorbell); 116 EFX_POPULATE_DWORD_1(hdr, EFX_DWORD_0, 0x45789abc);
105 wmb(); 117 efx_mcdi_writed(efx, &hdr, doorbell);
106} 118}
107 119
108static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) 120static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen)
109{ 121{
110 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 122 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
111 unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 123 unsigned int pdu = MCDI_PDU(efx);
112 int i; 124 int i;
113 125
114 BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT); 126 BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT);
115 BUG_ON(outlen & 3 || outlen >= 0x100); 127 BUG_ON(outlen & 3 || outlen >= 0x100);
116 128
117 for (i = 0; i < outlen; i += 4) 129 for (i = 0; i < outlen; i += 4)
118 *((__le32 *)(outbuf + i)) = _efx_readd(efx, pdu + 4 + i); 130 efx_mcdi_readd(efx, (efx_dword_t *)(outbuf + i), pdu + 4 + i);
119} 131}
120 132
121static int efx_mcdi_poll(struct efx_nic *efx) 133static int efx_mcdi_poll(struct efx_nic *efx)
@@ -123,7 +135,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
123 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 135 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
124 unsigned int time, finish; 136 unsigned int time, finish;
125 unsigned int respseq, respcmd, error; 137 unsigned int respseq, respcmd, error;
126 unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 138 unsigned int pdu = MCDI_PDU(efx);
127 unsigned int rc, spins; 139 unsigned int rc, spins;
128 efx_dword_t reg; 140 efx_dword_t reg;
129 141
@@ -149,8 +161,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
149 161
150 time = get_seconds(); 162 time = get_seconds();
151 163
152 rmb(); 164 efx_mcdi_readd(efx, &reg, pdu);
153 efx_readd(efx, &reg, pdu);
154 165
155 /* All 1's indicates that shared memory is in reset (and is 166 /* All 1's indicates that shared memory is in reset (and is
156 * not a valid header). Wait for it to come out reset before 167 * not a valid header). Wait for it to come out reset before
@@ -177,7 +188,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
177 respseq, mcdi->seqno); 188 respseq, mcdi->seqno);
178 rc = EIO; 189 rc = EIO;
179 } else if (error) { 190 } else if (error) {
180 efx_readd(efx, &reg, pdu + 4); 191 efx_mcdi_readd(efx, &reg, pdu + 4);
181 switch (EFX_DWORD_FIELD(reg, EFX_DWORD_0)) { 192 switch (EFX_DWORD_FIELD(reg, EFX_DWORD_0)) {
182#define TRANSLATE_ERROR(name) \ 193#define TRANSLATE_ERROR(name) \
183 case MC_CMD_ERR_ ## name: \ 194 case MC_CMD_ERR_ ## name: \
@@ -211,21 +222,21 @@ out:
211/* Test and clear MC-rebooted flag for this port/function */ 222/* Test and clear MC-rebooted flag for this port/function */
212int efx_mcdi_poll_reboot(struct efx_nic *efx) 223int efx_mcdi_poll_reboot(struct efx_nic *efx)
213{ 224{
214 unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_REBOOT_FLAG(efx); 225 unsigned int addr = MCDI_REBOOT_FLAG(efx);
215 efx_dword_t reg; 226 efx_dword_t reg;
216 uint32_t value; 227 uint32_t value;
217 228
218 if (efx_nic_rev(efx) < EFX_REV_SIENA_A0) 229 if (efx_nic_rev(efx) < EFX_REV_SIENA_A0)
219 return false; 230 return false;
220 231
221 efx_readd(efx, &reg, addr); 232 efx_mcdi_readd(efx, &reg, addr);
222 value = EFX_DWORD_FIELD(reg, EFX_DWORD_0); 233 value = EFX_DWORD_FIELD(reg, EFX_DWORD_0);
223 234
224 if (value == 0) 235 if (value == 0)
225 return 0; 236 return 0;
226 237
227 EFX_ZERO_DWORD(reg); 238 EFX_ZERO_DWORD(reg);
228 efx_writed(efx, &reg, addr); 239 efx_mcdi_writed(efx, &reg, addr);
229 240
230 if (value == MC_STATUS_DWORD_ASSERT) 241 if (value == MC_STATUS_DWORD_ASSERT)
231 return -EINTR; 242 return -EINTR;
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c
index 10f1cb79c147..9b29a8d7c449 100644
--- a/drivers/net/sfc/nic.c
+++ b/drivers/net/sfc/nic.c
@@ -1937,6 +1937,13 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
1937 1937
1938 size = min_t(size_t, table->step, 16); 1938 size = min_t(size_t, table->step, 16);
1939 1939
1940 if (table->offset >= efx->type->mem_map_size) {
1941 /* No longer mapped; return dummy data */
1942 memcpy(buf, "\xde\xc0\xad\xde", 4);
1943 buf += table->rows * size;
1944 continue;
1945 }
1946
1940 for (i = 0; i < table->rows; i++) { 1947 for (i = 0; i < table->rows; i++) {
1941 switch (table->step) { 1948 switch (table->step) {
1942 case 4: /* 32-bit register or SRAM */ 1949 case 4: /* 32-bit register or SRAM */
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h
index a42db6e35be3..d91701abd331 100644
--- a/drivers/net/sfc/nic.h
+++ b/drivers/net/sfc/nic.h
@@ -143,10 +143,12 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx)
143/** 143/**
144 * struct siena_nic_data - Siena NIC state 144 * struct siena_nic_data - Siena NIC state
145 * @mcdi: Management-Controller-to-Driver Interface 145 * @mcdi: Management-Controller-to-Driver Interface
146 * @mcdi_smem: MCDI shared memory mapping. The mapping is always uncacheable.
146 * @wol_filter_id: Wake-on-LAN packet filter id 147 * @wol_filter_id: Wake-on-LAN packet filter id
147 */ 148 */
148struct siena_nic_data { 149struct siena_nic_data {
149 struct efx_mcdi_iface mcdi; 150 struct efx_mcdi_iface mcdi;
151 void __iomem *mcdi_smem;
150 int wol_filter_id; 152 int wol_filter_id;
151}; 153};
152 154
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
index e4dd8986b1fe..837869b71db9 100644
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -220,12 +220,26 @@ static int siena_probe_nic(struct efx_nic *efx)
220 efx_reado(efx, &reg, FR_AZ_CS_DEBUG); 220 efx_reado(efx, &reg, FR_AZ_CS_DEBUG);
221 efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; 221 efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1;
222 222
223 /* Initialise MCDI */
224 nic_data->mcdi_smem = ioremap_nocache(efx->membase_phys +
225 FR_CZ_MC_TREG_SMEM,
226 FR_CZ_MC_TREG_SMEM_STEP *
227 FR_CZ_MC_TREG_SMEM_ROWS);
228 if (!nic_data->mcdi_smem) {
229 netif_err(efx, probe, efx->net_dev,
230 "could not map MCDI at %llx+%x\n",
231 (unsigned long long)efx->membase_phys +
232 FR_CZ_MC_TREG_SMEM,
233 FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS);
234 rc = -ENOMEM;
235 goto fail1;
236 }
223 efx_mcdi_init(efx); 237 efx_mcdi_init(efx);
224 238
225 /* Recover from a failed assertion before probing */ 239 /* Recover from a failed assertion before probing */
226 rc = efx_mcdi_handle_assertion(efx); 240 rc = efx_mcdi_handle_assertion(efx);
227 if (rc) 241 if (rc)
228 goto fail1; 242 goto fail2;
229 243
230 /* Let the BMC know that the driver is now in charge of link and 244 /* Let the BMC know that the driver is now in charge of link and
231 * filter settings. We must do this before we reset the NIC */ 245 * filter settings. We must do this before we reset the NIC */
@@ -280,6 +294,7 @@ fail4:
280fail3: 294fail3:
281 efx_mcdi_drv_attach(efx, false, NULL); 295 efx_mcdi_drv_attach(efx, false, NULL);
282fail2: 296fail2:
297 iounmap(nic_data->mcdi_smem);
283fail1: 298fail1:
284 kfree(efx->nic_data); 299 kfree(efx->nic_data);
285 return rc; 300 return rc;
@@ -359,6 +374,8 @@ static int siena_init_nic(struct efx_nic *efx)
359 374
360static void siena_remove_nic(struct efx_nic *efx) 375static void siena_remove_nic(struct efx_nic *efx)
361{ 376{
377 struct siena_nic_data *nic_data = efx->nic_data;
378
362 efx_nic_free_buffer(efx, &efx->irq_status); 379 efx_nic_free_buffer(efx, &efx->irq_status);
363 380
364 siena_reset_hw(efx, RESET_TYPE_ALL); 381 siena_reset_hw(efx, RESET_TYPE_ALL);
@@ -368,7 +385,8 @@ static void siena_remove_nic(struct efx_nic *efx)
368 efx_mcdi_drv_attach(efx, false, NULL); 385 efx_mcdi_drv_attach(efx, false, NULL);
369 386
370 /* Tear down the private nic state */ 387 /* Tear down the private nic state */
371 kfree(efx->nic_data); 388 iounmap(nic_data->mcdi_smem);
389 kfree(nic_data);
372 efx->nic_data = NULL; 390 efx->nic_data = NULL;
373} 391}
374 392
@@ -606,8 +624,7 @@ struct efx_nic_type siena_a0_nic_type = {
606 .default_mac_ops = &efx_mcdi_mac_operations, 624 .default_mac_ops = &efx_mcdi_mac_operations,
607 625
608 .revision = EFX_REV_SIENA_A0, 626 .revision = EFX_REV_SIENA_A0,
609 .mem_map_size = (FR_CZ_MC_TREG_SMEM + 627 .mem_map_size = FR_CZ_MC_TREG_SMEM, /* MC_TREG_SMEM mapped separately */
610 FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS),
611 .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL, 628 .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL,
612 .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL, 629 .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL,
613 .buf_tbl_base = FR_BZ_BUF_FULL_TBL, 630 .buf_tbl_base = FR_BZ_BUF_FULL_TBL,
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 86cbb9ea2f26..8ec1a9a0bb9a 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -853,7 +853,9 @@ static int slip_open(struct tty_struct *tty)
853 /* Done. We have linked the TTY line to a channel. */ 853 /* Done. We have linked the TTY line to a channel. */
854 rtnl_unlock(); 854 rtnl_unlock();
855 tty->receive_room = 65536; /* We don't flow control */ 855 tty->receive_room = 65536; /* We don't flow control */
856 return sl->dev->base_addr; 856
857 /* TTY layer expects 0 on success */
858 return 0;
857 859
858err_free_bufs: 860err_free_bufs:
859 sl_free_bufs(sl); 861 sl_free_bufs(sl);
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index eb4f59fb01e9..bff2f7999ff0 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3237,15 +3237,18 @@ static void happy_meal_pci_exit(void)
3237#endif 3237#endif
3238 3238
3239#ifdef CONFIG_SBUS 3239#ifdef CONFIG_SBUS
3240static const struct of_device_id hme_sbus_match[];
3240static int __devinit hme_sbus_probe(struct platform_device *op) 3241static int __devinit hme_sbus_probe(struct platform_device *op)
3241{ 3242{
3243 const struct of_device_id *match;
3242 struct device_node *dp = op->dev.of_node; 3244 struct device_node *dp = op->dev.of_node;
3243 const char *model = of_get_property(dp, "model", NULL); 3245 const char *model = of_get_property(dp, "model", NULL);
3244 int is_qfe; 3246 int is_qfe;
3245 3247
3246 if (!op->dev.of_match) 3248 match = of_match_device(hme_sbus_match, &op->dev);
3249 if (!match)
3247 return -EINVAL; 3250 return -EINVAL;
3248 is_qfe = (op->dev.of_match->data != NULL); 3251 is_qfe = (match->data != NULL);
3249 3252
3250 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe")) 3253 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe"))
3251 is_qfe = 1; 3254 is_qfe = 1;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b8c5f35577e4..7a5daefb6f33 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12327,8 +12327,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
12327 if (val & VCPU_CFGSHDW_ASPM_DBNC) 12327 if (val & VCPU_CFGSHDW_ASPM_DBNC)
12328 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND; 12328 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
12329 if ((val & VCPU_CFGSHDW_WOL_ENABLE) && 12329 if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
12330 (val & VCPU_CFGSHDW_WOL_MAGPKT)) 12330 (val & VCPU_CFGSHDW_WOL_MAGPKT)) {
12331 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 12331 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
12332 device_set_wakeup_enable(&tp->pdev->dev, true);
12333 }
12332 goto done; 12334 goto done;
12333 } 12335 }
12334 12336
@@ -12461,8 +12463,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
12461 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP; 12463 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
12462 12464
12463 if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) && 12465 if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
12464 (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) 12466 (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) {
12465 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 12467 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
12468 device_set_wakeup_enable(&tp->pdev->dev, true);
12469 }
12466 12470
12467 if (cfg2 & (1 << 17)) 12471 if (cfg2 & (1 << 17))
12468 tp->phy_flags |= TG3_PHYFLG_CAPACITIVE_COUPLING; 12472 tp->phy_flags |= TG3_PHYFLG_CAPACITIVE_COUPLING;
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 341f7056a800..c924ea2bce07 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -460,7 +460,7 @@ static const struct driver_info cdc_info = {
460 .manage_power = cdc_manage_power, 460 .manage_power = cdc_manage_power,
461}; 461};
462 462
463static const struct driver_info mbm_info = { 463static const struct driver_info wwan_info = {
464 .description = "Mobile Broadband Network Device", 464 .description = "Mobile Broadband Network Device",
465 .flags = FLAG_WWAN, 465 .flags = FLAG_WWAN,
466 .bind = usbnet_cdc_bind, 466 .bind = usbnet_cdc_bind,
@@ -471,6 +471,7 @@ static const struct driver_info mbm_info = {
471 471
472/*-------------------------------------------------------------------------*/ 472/*-------------------------------------------------------------------------*/
473 473
474#define HUAWEI_VENDOR_ID 0x12D1
474 475
475static const struct usb_device_id products [] = { 476static const struct usb_device_id products [] = {
476/* 477/*
@@ -566,7 +567,7 @@ static const struct usb_device_id products [] = {
566{ 567{
567 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, 568 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
568 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), 569 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
569 .driver_info = 0, 570 .driver_info = (unsigned long)&wwan_info,
570}, 571},
571 572
572/* 573/*
@@ -587,8 +588,17 @@ static const struct usb_device_id products [] = {
587}, { 588}, {
588 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM, 589 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
589 USB_CDC_PROTO_NONE), 590 USB_CDC_PROTO_NONE),
590 .driver_info = (unsigned long)&mbm_info, 591 .driver_info = (unsigned long)&wwan_info,
591 592
593}, {
594 /* Various Huawei modems with a network port like the UMG1831 */
595 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
596 | USB_DEVICE_ID_MATCH_INT_INFO,
597 .idVendor = HUAWEI_VENDOR_ID,
598 .bInterfaceClass = USB_CLASS_COMM,
599 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
600 .bInterfaceProtocol = 255,
601 .driver_info = (unsigned long)&wwan_info,
592}, 602},
593 { }, // END 603 { }, // END
594}; 604};
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 967371f04454..1033ef6476a4 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -54,13 +54,13 @@
54#include <linux/usb/usbnet.h> 54#include <linux/usb/usbnet.h>
55#include <linux/usb/cdc.h> 55#include <linux/usb/cdc.h>
56 56
57#define DRIVER_VERSION "7-Feb-2011" 57#define DRIVER_VERSION "23-Apr-2011"
58 58
59/* CDC NCM subclass 3.2.1 */ 59/* CDC NCM subclass 3.2.1 */
60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
61 61
62/* Maximum NTB length */ 62/* Maximum NTB length */
63#define CDC_NCM_NTB_MAX_SIZE_TX 16384 /* bytes */ 63#define CDC_NCM_NTB_MAX_SIZE_TX (16384 + 4) /* bytes, must be short terminated */
64#define CDC_NCM_NTB_MAX_SIZE_RX 16384 /* bytes */ 64#define CDC_NCM_NTB_MAX_SIZE_RX 16384 /* bytes */
65 65
66/* Minimum value for MaxDatagramSize, ch. 6.2.9 */ 66/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 7d42f9a2c068..81126ff85e05 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -65,6 +65,7 @@
65#define IPHETH_USBINTF_PROTO 1 65#define IPHETH_USBINTF_PROTO 1
66 66
67#define IPHETH_BUF_SIZE 1516 67#define IPHETH_BUF_SIZE 1516
68#define IPHETH_IP_ALIGN 2 /* padding at front of URB */
68#define IPHETH_TX_TIMEOUT (5 * HZ) 69#define IPHETH_TX_TIMEOUT (5 * HZ)
69 70
70#define IPHETH_INTFNUM 2 71#define IPHETH_INTFNUM 2
@@ -202,18 +203,21 @@ static void ipheth_rcvbulk_callback(struct urb *urb)
202 return; 203 return;
203 } 204 }
204 205
205 len = urb->actual_length; 206 if (urb->actual_length <= IPHETH_IP_ALIGN) {
206 buf = urb->transfer_buffer; 207 dev->net->stats.rx_length_errors++;
208 return;
209 }
210 len = urb->actual_length - IPHETH_IP_ALIGN;
211 buf = urb->transfer_buffer + IPHETH_IP_ALIGN;
207 212
208 skb = dev_alloc_skb(NET_IP_ALIGN + len); 213 skb = dev_alloc_skb(len);
209 if (!skb) { 214 if (!skb) {
210 err("%s: dev_alloc_skb: -ENOMEM", __func__); 215 err("%s: dev_alloc_skb: -ENOMEM", __func__);
211 dev->net->stats.rx_dropped++; 216 dev->net->stats.rx_dropped++;
212 return; 217 return;
213 } 218 }
214 219
215 skb_reserve(skb, NET_IP_ALIGN); 220 memcpy(skb_put(skb, len), buf, len);
216 memcpy(skb_put(skb, len), buf + NET_IP_ALIGN, len - NET_IP_ALIGN);
217 skb->dev = dev->net; 221 skb->dev = dev->net;
218 skb->protocol = eth_type_trans(skb, dev->net); 222 skb->protocol = eth_type_trans(skb, dev->net);
219 223
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 47a6c870b51f..48d4efdb4959 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -730,7 +730,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
730 msleep(10); 730 msleep(10);
731 bmcr = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); 731 bmcr = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR);
732 timeout++; 732 timeout++;
733 } while ((bmcr & MII_BMCR) && (timeout < 100)); 733 } while ((bmcr & BMCR_RESET) && (timeout < 100));
734 734
735 if (timeout >= 100) { 735 if (timeout >= 100) {
736 netdev_warn(dev->net, "timeout on PHY Reset"); 736 netdev_warn(dev->net, "timeout on PHY Reset");
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 069c1cf0fdf7..9ab439d144ed 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -645,6 +645,7 @@ int usbnet_stop (struct net_device *net)
645 struct driver_info *info = dev->driver_info; 645 struct driver_info *info = dev->driver_info;
646 int retval; 646 int retval;
647 647
648 clear_bit(EVENT_DEV_OPEN, &dev->flags);
648 netif_stop_queue (net); 649 netif_stop_queue (net);
649 650
650 netif_info(dev, ifdown, dev->net, 651 netif_info(dev, ifdown, dev->net,
@@ -736,6 +737,7 @@ int usbnet_open (struct net_device *net)
736 } 737 }
737 } 738 }
738 739
740 set_bit(EVENT_DEV_OPEN, &dev->flags);
739 netif_start_queue (net); 741 netif_start_queue (net);
740 netif_info(dev, ifup, dev->net, 742 netif_info(dev, ifup, dev->net,
741 "open: enable queueing (rx %d, tx %d) mtu %d %s framing\n", 743 "open: enable queueing (rx %d, tx %d) mtu %d %s framing\n",
@@ -1259,6 +1261,9 @@ void usbnet_disconnect (struct usb_interface *intf)
1259 if (dev->driver_info->unbind) 1261 if (dev->driver_info->unbind)
1260 dev->driver_info->unbind (dev, intf); 1262 dev->driver_info->unbind (dev, intf);
1261 1263
1264 usb_kill_urb(dev->interrupt);
1265 usb_free_urb(dev->interrupt);
1266
1262 free_netdev(net); 1267 free_netdev(net);
1263 usb_put_dev (xdev); 1268 usb_put_dev (xdev);
1264} 1269}
@@ -1498,6 +1503,10 @@ int usbnet_resume (struct usb_interface *intf)
1498 int retval; 1503 int retval;
1499 1504
1500 if (!--dev->suspend_count) { 1505 if (!--dev->suspend_count) {
1506 /* resume interrupt URBs */
1507 if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags))
1508 usb_submit_urb(dev->interrupt, GFP_NOIO);
1509
1501 spin_lock_irq(&dev->txq.lock); 1510 spin_lock_irq(&dev->txq.lock);
1502 while ((res = usb_get_from_anchor(&dev->deferred))) { 1511 while ((res = usb_get_from_anchor(&dev->deferred))) {
1503 1512
@@ -1516,9 +1525,12 @@ int usbnet_resume (struct usb_interface *intf)
1516 smp_mb(); 1525 smp_mb();
1517 clear_bit(EVENT_DEV_ASLEEP, &dev->flags); 1526 clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
1518 spin_unlock_irq(&dev->txq.lock); 1527 spin_unlock_irq(&dev->txq.lock);
1519 if (!(dev->txq.qlen >= TX_QLEN(dev))) 1528
1520 netif_start_queue(dev->net); 1529 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
1521 tasklet_schedule (&dev->bh); 1530 if (!(dev->txq.qlen >= TX_QLEN(dev)))
1531 netif_start_queue(dev->net);
1532 tasklet_schedule (&dev->bh);
1533 }
1522 } 1534 }
1523 return 0; 1535 return 0;
1524} 1536}
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 2de9b90c5f8f..3b99f64104fd 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -403,6 +403,17 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
403 if (tb[IFLA_ADDRESS] == NULL) 403 if (tb[IFLA_ADDRESS] == NULL)
404 random_ether_addr(dev->dev_addr); 404 random_ether_addr(dev->dev_addr);
405 405
406 if (tb[IFLA_IFNAME])
407 nla_strlcpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
408 else
409 snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d");
410
411 if (strchr(dev->name, '%')) {
412 err = dev_alloc_name(dev, dev->name);
413 if (err < 0)
414 goto err_alloc_name;
415 }
416
406 err = register_netdevice(dev); 417 err = register_netdevice(dev);
407 if (err < 0) 418 if (err < 0)
408 goto err_register_dev; 419 goto err_register_dev;
@@ -422,6 +433,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
422 433
423err_register_dev: 434err_register_dev:
424 /* nothing to do */ 435 /* nothing to do */
436err_alloc_name:
425err_configure_peer: 437err_configure_peer:
426 unregister_netdevice(peer); 438 unregister_netdevice(peer);
427 return err; 439 return err;
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 0d47c3a05307..c16ed961153a 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -178,6 +178,7 @@ static void
178vmxnet3_process_events(struct vmxnet3_adapter *adapter) 178vmxnet3_process_events(struct vmxnet3_adapter *adapter)
179{ 179{
180 int i; 180 int i;
181 unsigned long flags;
181 u32 events = le32_to_cpu(adapter->shared->ecr); 182 u32 events = le32_to_cpu(adapter->shared->ecr);
182 if (!events) 183 if (!events)
183 return; 184 return;
@@ -190,10 +191,10 @@ vmxnet3_process_events(struct vmxnet3_adapter *adapter)
190 191
191 /* Check if there is an error on xmit/recv queues */ 192 /* Check if there is an error on xmit/recv queues */
192 if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) { 193 if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) {
193 spin_lock(&adapter->cmd_lock); 194 spin_lock_irqsave(&adapter->cmd_lock, flags);
194 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 195 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
195 VMXNET3_CMD_GET_QUEUE_STATUS); 196 VMXNET3_CMD_GET_QUEUE_STATUS);
196 spin_unlock(&adapter->cmd_lock); 197 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
197 198
198 for (i = 0; i < adapter->num_tx_queues; i++) 199 for (i = 0; i < adapter->num_tx_queues; i++)
199 if (adapter->tqd_start[i].status.stopped) 200 if (adapter->tqd_start[i].status.stopped)
@@ -2733,13 +2734,14 @@ static void
2733vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter) 2734vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
2734{ 2735{
2735 u32 cfg; 2736 u32 cfg;
2737 unsigned long flags;
2736 2738
2737 /* intr settings */ 2739 /* intr settings */
2738 spin_lock(&adapter->cmd_lock); 2740 spin_lock_irqsave(&adapter->cmd_lock, flags);
2739 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 2741 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2740 VMXNET3_CMD_GET_CONF_INTR); 2742 VMXNET3_CMD_GET_CONF_INTR);
2741 cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); 2743 cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
2742 spin_unlock(&adapter->cmd_lock); 2744 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
2743 adapter->intr.type = cfg & 0x3; 2745 adapter->intr.type = cfg & 0x3;
2744 adapter->intr.mask_mode = (cfg >> 2) & 0x3; 2746 adapter->intr.mask_mode = (cfg >> 2) & 0x3;
2745 2747
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 51f2ef142a5b..976467253d20 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -311,6 +311,9 @@ vmxnet3_set_flags(struct net_device *netdev, u32 data)
311 /* toggle the LRO feature*/ 311 /* toggle the LRO feature*/
312 netdev->features ^= NETIF_F_LRO; 312 netdev->features ^= NETIF_F_LRO;
313 313
314 /* Update private LRO flag */
315 adapter->lro = lro_requested;
316
314 /* update harware LRO capability accordingly */ 317 /* update harware LRO capability accordingly */
315 if (lro_requested) 318 if (lro_requested)
316 adapter->shared->devRead.misc.uptFeatures |= 319 adapter->shared->devRead.misc.uptFeatures |=
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 17d04ff8d678..1482fa650833 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2141,6 +2141,8 @@ static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
2141static void ath9k_flush(struct ieee80211_hw *hw, bool drop) 2141static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
2142{ 2142{
2143 struct ath_softc *sc = hw->priv; 2143 struct ath_softc *sc = hw->priv;
2144 struct ath_hw *ah = sc->sc_ah;
2145 struct ath_common *common = ath9k_hw_common(ah);
2144 int timeout = 200; /* ms */ 2146 int timeout = 200; /* ms */
2145 int i, j; 2147 int i, j;
2146 2148
@@ -2149,6 +2151,12 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
2149 2151
2150 cancel_delayed_work_sync(&sc->tx_complete_work); 2152 cancel_delayed_work_sync(&sc->tx_complete_work);
2151 2153
2154 if (sc->sc_flags & SC_OP_INVALID) {
2155 ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
2156 mutex_unlock(&sc->mutex);
2157 return;
2158 }
2159
2152 if (drop) 2160 if (drop)
2153 timeout = 1; 2161 timeout = 1;
2154 2162
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index dcd19bc337d1..b29c80def35e 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -506,7 +506,7 @@ bool ath_stoprecv(struct ath_softc *sc)
506 "confusing the DMA engine when we start RX up\n"); 506 "confusing the DMA engine when we start RX up\n");
507 ATH_DBG_WARN_ON_ONCE(!stopped); 507 ATH_DBG_WARN_ON_ONCE(!stopped);
508 } 508 }
509 return stopped || reset; 509 return stopped && !reset;
510} 510}
511 511
512void ath_flushrecv(struct ath_softc *sc) 512void ath_flushrecv(struct ath_softc *sc)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index d59b0168c14a..5af40d9170a0 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -72,6 +72,7 @@ MODULE_FIRMWARE("b43/ucode11.fw");
72MODULE_FIRMWARE("b43/ucode13.fw"); 72MODULE_FIRMWARE("b43/ucode13.fw");
73MODULE_FIRMWARE("b43/ucode14.fw"); 73MODULE_FIRMWARE("b43/ucode14.fw");
74MODULE_FIRMWARE("b43/ucode15.fw"); 74MODULE_FIRMWARE("b43/ucode15.fw");
75MODULE_FIRMWARE("b43/ucode16_mimo.fw");
75MODULE_FIRMWARE("b43/ucode5.fw"); 76MODULE_FIRMWARE("b43/ucode5.fw");
76MODULE_FIRMWARE("b43/ucode9.fw"); 77MODULE_FIRMWARE("b43/ucode9.fw");
77 78
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 5c40502f869a..79ac081832fb 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -316,12 +316,18 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
316 316
317 hdr_len = ieee80211_hdrlen(fc); 317 hdr_len = ieee80211_hdrlen(fc);
318 318
319 /* Find index into station table for destination station */ 319 /* For management frames use broadcast id to do not break aggregation */
320 sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, info->control.sta); 320 if (!ieee80211_is_data(fc))
321 if (sta_id == IWL_INVALID_STATION) { 321 sta_id = ctx->bcast_sta_id;
322 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", 322 else {
323 hdr->addr1); 323 /* Find index into station table for destination station */
324 goto drop_unlock; 324 sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, info->control.sta);
325
326 if (sta_id == IWL_INVALID_STATION) {
327 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
328 hdr->addr1);
329 goto drop_unlock;
330 }
325 } 331 }
326 332
327 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); 333 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);
@@ -1127,12 +1133,16 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1127 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1133 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1128 1134
1129 tx_info = &txq->txb[txq->q.read_ptr]; 1135 tx_info = &txq->txb[txq->q.read_ptr];
1130 iwl4965_tx_status(priv, tx_info, 1136
1131 txq_id >= IWL4965_FIRST_AMPDU_QUEUE); 1137 if (WARN_ON_ONCE(tx_info->skb == NULL))
1138 continue;
1132 1139
1133 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1140 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1134 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1141 if (ieee80211_is_data_qos(hdr->frame_control))
1135 nfreed++; 1142 nfreed++;
1143
1144 iwl4965_tx_status(priv, tx_info,
1145 txq_id >= IWL4965_FIRST_AMPDU_QUEUE);
1136 tx_info->skb = NULL; 1146 tx_info->skb = NULL;
1137 1147
1138 priv->cfg->ops->lib->txq_free_tfd(priv, txq); 1148 priv->cfg->ops->lib->txq_free_tfd(priv, txq);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index c1511b14b239..42db0fc8b921 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -2155,6 +2155,13 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
2155 goto set_ch_out; 2155 goto set_ch_out;
2156 } 2156 }
2157 2157
2158 if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
2159 !iwl_legacy_is_channel_ibss(ch_info)) {
2160 IWL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n");
2161 ret = -EINVAL;
2162 goto set_ch_out;
2163 }
2164
2158 spin_lock_irqsave(&priv->lock, flags); 2165 spin_lock_irqsave(&priv->lock, flags);
2159 2166
2160 for_each_context(priv, ctx) { 2167 for_each_context(priv, ctx) {
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 9ee849d669f3..f43ac1eb9014 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -1411,6 +1411,12 @@ iwl_legacy_is_channel_passive(const struct iwl_channel_info *ch)
1411 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; 1411 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
1412} 1412}
1413 1413
1414static inline int
1415iwl_legacy_is_channel_ibss(const struct iwl_channel_info *ch)
1416{
1417 return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0;
1418}
1419
1414static inline void 1420static inline void
1415__iwl_legacy_free_pages(struct iwl_priv *priv, struct page *page) 1421__iwl_legacy_free_pages(struct iwl_priv *priv, struct page *page)
1416{ 1422{
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c
index 15eb8b707157..bda0d61b2c0d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-led.c
+++ b/drivers/net/wireless/iwlegacy/iwl-led.c
@@ -48,8 +48,21 @@ module_param(led_mode, int, S_IRUGO);
48MODULE_PARM_DESC(led_mode, "0=system default, " 48MODULE_PARM_DESC(led_mode, "0=system default, "
49 "1=On(RF On)/Off(RF Off), 2=blinking"); 49 "1=On(RF On)/Off(RF Off), 2=blinking");
50 50
51/* Throughput OFF time(ms) ON time (ms)
52 * >300 25 25
53 * >200 to 300 40 40
54 * >100 to 200 55 55
55 * >70 to 100 65 65
56 * >50 to 70 75 75
57 * >20 to 50 85 85
58 * >10 to 20 95 95
59 * >5 to 10 110 110
60 * >1 to 5 130 130
61 * >0 to 1 167 167
62 * <=0 SOLID ON
63 */
51static const struct ieee80211_tpt_blink iwl_blink[] = { 64static const struct ieee80211_tpt_blink iwl_blink[] = {
52 { .throughput = 0 * 1024 - 1, .blink_time = 334 }, 65 { .throughput = 0, .blink_time = 334 },
53 { .throughput = 1 * 1024 - 1, .blink_time = 260 }, 66 { .throughput = 1 * 1024 - 1, .blink_time = 260 },
54 { .throughput = 5 * 1024 - 1, .blink_time = 220 }, 67 { .throughput = 5 * 1024 - 1, .blink_time = 220 },
55 { .throughput = 10 * 1024 - 1, .blink_time = 190 }, 68 { .throughput = 10 * 1024 - 1, .blink_time = 190 },
@@ -101,6 +114,11 @@ static int iwl_legacy_led_cmd(struct iwl_priv *priv,
101 if (priv->blink_on == on && priv->blink_off == off) 114 if (priv->blink_on == on && priv->blink_off == off)
102 return 0; 115 return 0;
103 116
117 if (off == 0) {
118 /* led is SOLID_ON */
119 on = IWL_LED_SOLID;
120 }
121
104 IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n", 122 IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n",
105 priv->cfg->base_params->led_compensation); 123 priv->cfg->base_params->led_compensation);
106 led_cmd.on = iwl_legacy_blink_compensation(priv, on, 124 led_cmd.on = iwl_legacy_blink_compensation(priv, on,
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index d484c3678163..a62fe24ee594 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -2984,15 +2984,15 @@ static void iwl4965_bg_txpower_work(struct work_struct *work)
2984 struct iwl_priv *priv = container_of(work, struct iwl_priv, 2984 struct iwl_priv *priv = container_of(work, struct iwl_priv,
2985 txpower_work); 2985 txpower_work);
2986 2986
2987 mutex_lock(&priv->mutex);
2988
2987 /* If a scan happened to start before we got here 2989 /* If a scan happened to start before we got here
2988 * then just return; the statistics notification will 2990 * then just return; the statistics notification will
2989 * kick off another scheduled work to compensate for 2991 * kick off another scheduled work to compensate for
2990 * any temperature delta we missed here. */ 2992 * any temperature delta we missed here. */
2991 if (test_bit(STATUS_EXIT_PENDING, &priv->status) || 2993 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
2992 test_bit(STATUS_SCANNING, &priv->status)) 2994 test_bit(STATUS_SCANNING, &priv->status))
2993 return; 2995 goto out;
2994
2995 mutex_lock(&priv->mutex);
2996 2996
2997 /* Regardless of if we are associated, we must reconfigure the 2997 /* Regardless of if we are associated, we must reconfigure the
2998 * TX power since frames can be sent on non-radar channels while 2998 * TX power since frames can be sent on non-radar channels while
@@ -3002,7 +3002,7 @@ static void iwl4965_bg_txpower_work(struct work_struct *work)
3002 /* Update last_temperature to keep is_calib_needed from running 3002 /* Update last_temperature to keep is_calib_needed from running
3003 * when it isn't needed... */ 3003 * when it isn't needed... */
3004 priv->last_temperature = priv->temperature; 3004 priv->last_temperature = priv->temperature;
3005 3005out:
3006 mutex_unlock(&priv->mutex); 3006 mutex_unlock(&priv->mutex);
3007} 3007}
3008 3008
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index dfdbea6e8f99..fbbde0712fa5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -335,7 +335,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
335 struct ieee80211_channel *channel = conf->channel; 335 struct ieee80211_channel *channel = conf->channel;
336 const struct iwl_channel_info *ch_info; 336 const struct iwl_channel_info *ch_info;
337 int ret = 0; 337 int ret = 0;
338 bool ht_changed[NUM_IWL_RXON_CTX] = {};
339 338
340 IWL_DEBUG_MAC80211(priv, "changed %#x", changed); 339 IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
341 340
@@ -383,10 +382,8 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
383 382
384 for_each_context(priv, ctx) { 383 for_each_context(priv, ctx) {
385 /* Configure HT40 channels */ 384 /* Configure HT40 channels */
386 if (ctx->ht.enabled != conf_is_ht(conf)) { 385 if (ctx->ht.enabled != conf_is_ht(conf))
387 ctx->ht.enabled = conf_is_ht(conf); 386 ctx->ht.enabled = conf_is_ht(conf);
388 ht_changed[ctx->ctxid] = true;
389 }
390 387
391 if (ctx->ht.enabled) { 388 if (ctx->ht.enabled) {
392 if (conf_is_ht40_minus(conf)) { 389 if (conf_is_ht40_minus(conf)) {
@@ -455,8 +452,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
455 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 452 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
456 continue; 453 continue;
457 iwlagn_commit_rxon(priv, ctx); 454 iwlagn_commit_rxon(priv, ctx);
458 if (ht_changed[ctx->ctxid])
459 iwlagn_update_qos(priv, ctx);
460 } 455 }
461 out: 456 out:
462 mutex_unlock(&priv->mutex); 457 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index a709d05c5868..0712b67283a4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -568,12 +568,17 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
568 568
569 hdr_len = ieee80211_hdrlen(fc); 569 hdr_len = ieee80211_hdrlen(fc);
570 570
571 /* Find index into station table for destination station */ 571 /* For management frames use broadcast id to do not break aggregation */
572 sta_id = iwl_sta_id_or_broadcast(priv, ctx, info->control.sta); 572 if (!ieee80211_is_data(fc))
573 if (sta_id == IWL_INVALID_STATION) { 573 sta_id = ctx->bcast_sta_id;
574 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", 574 else {
575 hdr->addr1); 575 /* Find index into station table for destination station */
576 goto drop_unlock; 576 sta_id = iwl_sta_id_or_broadcast(priv, ctx, info->control.sta);
577 if (sta_id == IWL_INVALID_STATION) {
578 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
579 hdr->addr1);
580 goto drop_unlock;
581 }
577 } 582 }
578 583
579 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); 584 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);
@@ -1224,12 +1229,16 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1224 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1229 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1225 1230
1226 tx_info = &txq->txb[txq->q.read_ptr]; 1231 tx_info = &txq->txb[txq->q.read_ptr];
1227 iwlagn_tx_status(priv, tx_info, 1232
1228 txq_id >= IWLAGN_FIRST_AMPDU_QUEUE); 1233 if (WARN_ON_ONCE(tx_info->skb == NULL))
1234 continue;
1229 1235
1230 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1236 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1231 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1237 if (ieee80211_is_data_qos(hdr->frame_control))
1232 nfreed++; 1238 nfreed++;
1239
1240 iwlagn_tx_status(priv, tx_info,
1241 txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);
1233 tx_info->skb = NULL; 1242 tx_info->skb = NULL;
1234 1243
1235 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl) 1244 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 7e8a658b7670..f3ac62431a30 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1339,8 +1339,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
1339 cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { 1339 cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) {
1340 lbs_deb_host( 1340 lbs_deb_host(
1341 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); 1341 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n");
1342 list_del(&cmdnode->list);
1343 spin_lock_irqsave(&priv->driver_lock, flags); 1342 spin_lock_irqsave(&priv->driver_lock, flags);
1343 list_del(&cmdnode->list);
1344 lbs_complete_command(priv, cmdnode, 0); 1344 lbs_complete_command(priv, cmdnode, 0);
1345 spin_unlock_irqrestore(&priv->driver_lock, flags); 1345 spin_unlock_irqrestore(&priv->driver_lock, flags);
1346 1346
@@ -1352,8 +1352,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
1352 (priv->psstate == PS_STATE_PRE_SLEEP)) { 1352 (priv->psstate == PS_STATE_PRE_SLEEP)) {
1353 lbs_deb_host( 1353 lbs_deb_host(
1354 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); 1354 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n");
1355 list_del(&cmdnode->list);
1356 spin_lock_irqsave(&priv->driver_lock, flags); 1355 spin_lock_irqsave(&priv->driver_lock, flags);
1356 list_del(&cmdnode->list);
1357 lbs_complete_command(priv, cmdnode, 0); 1357 lbs_complete_command(priv, cmdnode, 0);
1358 spin_unlock_irqrestore(&priv->driver_lock, flags); 1358 spin_unlock_irqrestore(&priv->driver_lock, flags);
1359 priv->needtowakeup = 1; 1359 priv->needtowakeup = 1;
@@ -1366,7 +1366,9 @@ int lbs_execute_next_command(struct lbs_private *priv)
1366 "EXEC_NEXT_CMD: sending EXIT_PS\n"); 1366 "EXEC_NEXT_CMD: sending EXIT_PS\n");
1367 } 1367 }
1368 } 1368 }
1369 spin_lock_irqsave(&priv->driver_lock, flags);
1369 list_del(&cmdnode->list); 1370 list_del(&cmdnode->list);
1371 spin_unlock_irqrestore(&priv->driver_lock, flags);
1370 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", 1372 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
1371 le16_to_cpu(cmd->command)); 1373 le16_to_cpu(cmd->command));
1372 lbs_submit_command(priv, cmdnode); 1374 lbs_submit_command(priv, cmdnode);
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index b78a38d9172a..8c7c522a056a 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -126,7 +126,7 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z,
126 126
127 board = z->resource.start; 127 board = z->resource.start;
128 ioaddr = board+cards[i].offset; 128 ioaddr = board+cards[i].offset;
129 dev = alloc_ei_netdev(); 129 dev = ____alloc_ei_netdev(0);
130 if (!dev) 130 if (!dev)
131 return -ENOMEM; 131 return -ENOMEM;
132 if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, DRV_NAME)) { 132 if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, DRV_NAME)) {
@@ -146,15 +146,15 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z,
146static const struct net_device_ops zorro8390_netdev_ops = { 146static const struct net_device_ops zorro8390_netdev_ops = {
147 .ndo_open = zorro8390_open, 147 .ndo_open = zorro8390_open,
148 .ndo_stop = zorro8390_close, 148 .ndo_stop = zorro8390_close,
149 .ndo_start_xmit = ei_start_xmit, 149 .ndo_start_xmit = __ei_start_xmit,
150 .ndo_tx_timeout = ei_tx_timeout, 150 .ndo_tx_timeout = __ei_tx_timeout,
151 .ndo_get_stats = ei_get_stats, 151 .ndo_get_stats = __ei_get_stats,
152 .ndo_set_multicast_list = ei_set_multicast_list, 152 .ndo_set_multicast_list = __ei_set_multicast_list,
153 .ndo_validate_addr = eth_validate_addr, 153 .ndo_validate_addr = eth_validate_addr,
154 .ndo_set_mac_address = eth_mac_addr, 154 .ndo_set_mac_address = eth_mac_addr,
155 .ndo_change_mtu = eth_change_mtu, 155 .ndo_change_mtu = eth_change_mtu,
156#ifdef CONFIG_NET_POLL_CONTROLLER 156#ifdef CONFIG_NET_POLL_CONTROLLER
157 .ndo_poll_controller = ei_poll, 157 .ndo_poll_controller = __ei_poll,
158#endif 158#endif
159}; 159};
160 160