aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/arcnet/arc-rimi.c8
-rw-r--r--drivers/net/bonding/bond_3ad.c18
-rw-r--r--drivers/net/bonding/bond_3ad.h2
-rw-r--r--drivers/net/bonding/bond_alb.c12
-rw-r--r--drivers/net/bonding/bond_main.c16
-rw-r--r--drivers/net/bonding/bonding.h2
-rw-r--r--drivers/net/caif/caif_hsi.c9
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_pro.c2
-rw-r--r--drivers/net/dummy.c6
-rw-r--r--drivers/net/ethernet/atheros/atlx/atl1.c12
-rw-r--r--drivers/net/ethernet/atheros/atlx/atl1.h3
-rw-r--r--drivers/net/ethernet/atheros/atlx/atlx.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c12
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c23
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c18
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c92
-rw-r--r--drivers/net/ethernet/dlink/dl2k.c52
-rw-r--r--drivers/net/ethernet/dlink/dl2k.h7
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.c6
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.h2
-rw-r--r--drivers/net/ethernet/ibm/ehea/ehea_main.c62
-rw-r--r--drivers/net/ethernet/ibm/ehea/ehea_phyp.h2
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c10
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c15
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c2
-rw-r--r--drivers/net/ethernet/intel/e1000e/param.c99
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c24
-rw-r--r--drivers/net/ethernet/intel/igbvf/netdev.c4
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c43
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c1
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c10
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c39
-rw-r--r--drivers/net/ethernet/marvell/sky2.c31
-rw-r--r--drivers/net/ethernet/marvell/sky2.h1
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c28
-rw-r--r--drivers/net/ethernet/micrel/ks8851_mll.c2
-rw-r--r--drivers/net/ethernet/micrel/ksz884x.c2
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h2
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c25
-rw-r--r--drivers/net/ethernet/realtek/8139cp.c10
-rw-r--r--drivers/net/ethernet/realtek/r8169.c16
-rw-r--r--drivers/net/ethernet/sfc/efx.c2
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c17
-rw-r--r--drivers/net/ethernet/sun/sungem.c2
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c2
-rw-r--r--drivers/net/ethernet/ti/davinci_mdio.c5
-rw-r--r--drivers/net/ethernet/ti/tlan.c2
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet.h4
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c6
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c6
-rw-r--r--drivers/net/hyperv/netvsc_drv.c38
-rw-r--r--drivers/net/macvlan.c2
-rw-r--r--drivers/net/macvtap.c43
-rw-r--r--drivers/net/phy/icplus.c12
-rw-r--r--drivers/net/ppp/ppp_generic.c15
-rw-r--r--drivers/net/usb/asix.c4
-rw-r--r--drivers/net/usb/cdc_ether.c30
-rw-r--r--drivers/net/usb/qmi_wwan.c30
-rw-r--r--drivers/net/usb/smsc75xx.c36
-rw-r--r--drivers/net/usb/smsc95xx.c3
-rw-r--r--drivers/net/usb/usbnet.c59
-rw-r--r--drivers/net/virtio_net.c7
-rw-r--r--drivers/net/wan/farsync.c1
-rw-r--r--drivers/net/wireless/ath/ath5k/ahb.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_9287.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c17
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c10
-rw-r--r--drivers/net/wireless/b43/main.c10
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c8
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c64
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c11
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rx.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fh.h24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-mac80211.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-prph.h27
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h1
-rw-r--r--drivers/net/wireless/libertas/cfg.c9
-rw-r--r--drivers/net/wireless/mwifiex/pcie.h18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c6
-rw-r--r--drivers/net/wireless/rtlwifi/base.c5
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c24
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/sw.c6
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c44
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h6
-rw-r--r--drivers/net/wireless/wl1251/main.c1
-rw-r--r--drivers/net/wireless/wl1251/sdio.c2
100 files changed, 910 insertions, 573 deletions
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c
index 25197b698dd6..b8b4c7ba884f 100644
--- a/drivers/net/arcnet/arc-rimi.c
+++ b/drivers/net/arcnet/arc-rimi.c
@@ -89,16 +89,16 @@ static int __init arcrimi_probe(struct net_device *dev)
89 BUGLVL(D_NORMAL) printk(VERSION); 89 BUGLVL(D_NORMAL) printk(VERSION);
90 BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); 90 BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n");
91 91
92 BUGMSG(D_NORMAL, "Given: node %02Xh, shmem %lXh, irq %d\n", 92 BUGLVL(D_NORMAL) printk("Given: node %02Xh, shmem %lXh, irq %d\n",
93 dev->dev_addr[0], dev->mem_start, dev->irq); 93 dev->dev_addr[0], dev->mem_start, dev->irq);
94 94
95 if (dev->mem_start <= 0 || dev->irq <= 0) { 95 if (dev->mem_start <= 0 || dev->irq <= 0) {
96 BUGMSG(D_NORMAL, "No autoprobe for RIM I; you " 96 BUGLVL(D_NORMAL) printk("No autoprobe for RIM I; you "
97 "must specify the shmem and irq!\n"); 97 "must specify the shmem and irq!\n");
98 return -ENODEV; 98 return -ENODEV;
99 } 99 }
100 if (dev->dev_addr[0] == 0) { 100 if (dev->dev_addr[0] == 0) {
101 BUGMSG(D_NORMAL, "You need to specify your card's station " 101 BUGLVL(D_NORMAL) printk("You need to specify your card's station "
102 "ID!\n"); 102 "ID!\n");
103 return -ENODEV; 103 return -ENODEV;
104 } 104 }
@@ -109,7 +109,7 @@ static int __init arcrimi_probe(struct net_device *dev)
109 * will be taken. 109 * will be taken.
110 */ 110 */
111 if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { 111 if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) {
112 BUGMSG(D_NORMAL, "Card memory already allocated\n"); 112 BUGLVL(D_NORMAL) printk("Card memory already allocated\n");
113 return -ENODEV; 113 return -ENODEV;
114 } 114 }
115 return arcrimi_found(dev); 115 return arcrimi_found(dev);
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 793b00138275..3463b469e657 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2173,9 +2173,10 @@ re_arm:
2173 * received frames (loopback). Since only the payload is given to this 2173 * received frames (loopback). Since only the payload is given to this
2174 * function, it check for loopback. 2174 * function, it check for loopback.
2175 */ 2175 */
2176static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length) 2176static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length)
2177{ 2177{
2178 struct port *port; 2178 struct port *port;
2179 int ret = RX_HANDLER_ANOTHER;
2179 2180
2180 if (length >= sizeof(struct lacpdu)) { 2181 if (length >= sizeof(struct lacpdu)) {
2181 2182
@@ -2184,11 +2185,12 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
2184 if (!port->slave) { 2185 if (!port->slave) {
2185 pr_warning("%s: Warning: port of slave %s is uninitialized\n", 2186 pr_warning("%s: Warning: port of slave %s is uninitialized\n",
2186 slave->dev->name, slave->dev->master->name); 2187 slave->dev->name, slave->dev->master->name);
2187 return; 2188 return ret;
2188 } 2189 }
2189 2190
2190 switch (lacpdu->subtype) { 2191 switch (lacpdu->subtype) {
2191 case AD_TYPE_LACPDU: 2192 case AD_TYPE_LACPDU:
2193 ret = RX_HANDLER_CONSUMED;
2192 pr_debug("Received LACPDU on port %d\n", 2194 pr_debug("Received LACPDU on port %d\n",
2193 port->actor_port_number); 2195 port->actor_port_number);
2194 /* Protect against concurrent state machines */ 2196 /* Protect against concurrent state machines */
@@ -2198,6 +2200,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
2198 break; 2200 break;
2199 2201
2200 case AD_TYPE_MARKER: 2202 case AD_TYPE_MARKER:
2203 ret = RX_HANDLER_CONSUMED;
2201 // No need to convert fields to Little Endian since we don't use the marker's fields. 2204 // No need to convert fields to Little Endian since we don't use the marker's fields.
2202 2205
2203 switch (((struct bond_marker *)lacpdu)->tlv_type) { 2206 switch (((struct bond_marker *)lacpdu)->tlv_type) {
@@ -2219,6 +2222,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
2219 } 2222 }
2220 } 2223 }
2221 } 2224 }
2225 return ret;
2222} 2226}
2223 2227
2224/** 2228/**
@@ -2456,18 +2460,20 @@ out:
2456 return NETDEV_TX_OK; 2460 return NETDEV_TX_OK;
2457} 2461}
2458 2462
2459void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, 2463int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
2460 struct slave *slave) 2464 struct slave *slave)
2461{ 2465{
2466 int ret = RX_HANDLER_ANOTHER;
2462 if (skb->protocol != PKT_TYPE_LACPDU) 2467 if (skb->protocol != PKT_TYPE_LACPDU)
2463 return; 2468 return ret;
2464 2469
2465 if (!pskb_may_pull(skb, sizeof(struct lacpdu))) 2470 if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
2466 return; 2471 return ret;
2467 2472
2468 read_lock(&bond->lock); 2473 read_lock(&bond->lock);
2469 bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); 2474 ret = bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);
2470 read_unlock(&bond->lock); 2475 read_unlock(&bond->lock);
2476 return ret;
2471} 2477}
2472 2478
2473/* 2479/*
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
index 235b2cc58b28..5ee7e3c45db7 100644
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -274,7 +274,7 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave);
274void bond_3ad_handle_link_change(struct slave *slave, char link); 274void bond_3ad_handle_link_change(struct slave *slave, char link);
275int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); 275int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
276int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); 276int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
277void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, 277int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
278 struct slave *slave); 278 struct slave *slave);
279int bond_3ad_set_carrier(struct bonding *bond); 279int bond_3ad_set_carrier(struct bonding *bond);
280void bond_3ad_update_lacp_rate(struct bonding *bond); 280void bond_3ad_update_lacp_rate(struct bonding *bond);
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 9abfde479316..2e1f8066f1a8 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -342,26 +342,26 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
342 _unlock_rx_hashtbl_bh(bond); 342 _unlock_rx_hashtbl_bh(bond);
343} 343}
344 344
345static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, 345static int rlb_arp_recv(struct sk_buff *skb, struct bonding *bond,
346 struct slave *slave) 346 struct slave *slave)
347{ 347{
348 struct arp_pkt *arp; 348 struct arp_pkt *arp;
349 349
350 if (skb->protocol != cpu_to_be16(ETH_P_ARP)) 350 if (skb->protocol != cpu_to_be16(ETH_P_ARP))
351 return; 351 goto out;
352 352
353 arp = (struct arp_pkt *) skb->data; 353 arp = (struct arp_pkt *) skb->data;
354 if (!arp) { 354 if (!arp) {
355 pr_debug("Packet has no ARP data\n"); 355 pr_debug("Packet has no ARP data\n");
356 return; 356 goto out;
357 } 357 }
358 358
359 if (!pskb_may_pull(skb, arp_hdr_len(bond->dev))) 359 if (!pskb_may_pull(skb, arp_hdr_len(bond->dev)))
360 return; 360 goto out;
361 361
362 if (skb->len < sizeof(struct arp_pkt)) { 362 if (skb->len < sizeof(struct arp_pkt)) {
363 pr_debug("Packet is too small to be an ARP\n"); 363 pr_debug("Packet is too small to be an ARP\n");
364 return; 364 goto out;
365 } 365 }
366 366
367 if (arp->op_code == htons(ARPOP_REPLY)) { 367 if (arp->op_code == htons(ARPOP_REPLY)) {
@@ -369,6 +369,8 @@ static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond,
369 rlb_update_entry_from_arp(bond, arp); 369 rlb_update_entry_from_arp(bond, arp);
370 pr_debug("Server received an ARP Reply from client\n"); 370 pr_debug("Server received an ARP Reply from client\n");
371 } 371 }
372out:
373 return RX_HANDLER_ANOTHER;
372} 374}
373 375
374/* Caller must hold bond lock for read */ 376/* Caller must hold bond lock for read */
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 62d2409bb293..bc13b3d77432 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1444,8 +1444,9 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
1444 struct sk_buff *skb = *pskb; 1444 struct sk_buff *skb = *pskb;
1445 struct slave *slave; 1445 struct slave *slave;
1446 struct bonding *bond; 1446 struct bonding *bond;
1447 void (*recv_probe)(struct sk_buff *, struct bonding *, 1447 int (*recv_probe)(struct sk_buff *, struct bonding *,
1448 struct slave *); 1448 struct slave *);
1449 int ret = RX_HANDLER_ANOTHER;
1449 1450
1450 skb = skb_share_check(skb, GFP_ATOMIC); 1451 skb = skb_share_check(skb, GFP_ATOMIC);
1451 if (unlikely(!skb)) 1452 if (unlikely(!skb))
@@ -1464,8 +1465,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
1464 struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); 1465 struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
1465 1466
1466 if (likely(nskb)) { 1467 if (likely(nskb)) {
1467 recv_probe(nskb, bond, slave); 1468 ret = recv_probe(nskb, bond, slave);
1468 dev_kfree_skb(nskb); 1469 dev_kfree_skb(nskb);
1470 if (ret == RX_HANDLER_CONSUMED) {
1471 consume_skb(skb);
1472 return ret;
1473 }
1469 } 1474 }
1470 } 1475 }
1471 1476
@@ -1487,7 +1492,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
1487 memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN); 1492 memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN);
1488 } 1493 }
1489 1494
1490 return RX_HANDLER_ANOTHER; 1495 return ret;
1491} 1496}
1492 1497
1493/* enslave device <slave> to bond device <master> */ 1498/* enslave device <slave> to bond device <master> */
@@ -2723,7 +2728,7 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
2723 } 2728 }
2724} 2729}
2725 2730
2726static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, 2731static int bond_arp_rcv(struct sk_buff *skb, struct bonding *bond,
2727 struct slave *slave) 2732 struct slave *slave)
2728{ 2733{
2729 struct arphdr *arp; 2734 struct arphdr *arp;
@@ -2731,7 +2736,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond,
2731 __be32 sip, tip; 2736 __be32 sip, tip;
2732 2737
2733 if (skb->protocol != __cpu_to_be16(ETH_P_ARP)) 2738 if (skb->protocol != __cpu_to_be16(ETH_P_ARP))
2734 return; 2739 return RX_HANDLER_ANOTHER;
2735 2740
2736 read_lock(&bond->lock); 2741 read_lock(&bond->lock);
2737 2742
@@ -2776,6 +2781,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond,
2776 2781
2777out_unlock: 2782out_unlock:
2778 read_unlock(&bond->lock); 2783 read_unlock(&bond->lock);
2784 return RX_HANDLER_ANOTHER;
2779} 2785}
2780 2786
2781/* 2787/*
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 9f2bae6616d3..4581aa5ccaba 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -218,7 +218,7 @@ struct bonding {
218 struct slave *primary_slave; 218 struct slave *primary_slave;
219 bool force_primary; 219 bool force_primary;
220 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ 220 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
221 void (*recv_probe)(struct sk_buff *, struct bonding *, 221 int (*recv_probe)(struct sk_buff *, struct bonding *,
222 struct slave *); 222 struct slave *);
223 rwlock_t lock; 223 rwlock_t lock;
224 rwlock_t curr_slave_lock; 224 rwlock_t curr_slave_lock;
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index 9a66e2a910ae..9c1c8cd5223f 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -744,14 +744,14 @@ static void cfhsi_wake_up(struct work_struct *work)
744 size_t fifo_occupancy = 0; 744 size_t fifo_occupancy = 0;
745 745
746 /* Wakeup timeout */ 746 /* Wakeup timeout */
747 dev_err(&cfhsi->ndev->dev, "%s: Timeout.\n", 747 dev_dbg(&cfhsi->ndev->dev, "%s: Timeout.\n",
748 __func__); 748 __func__);
749 749
750 /* Check FIFO to check if modem has sent something. */ 750 /* Check FIFO to check if modem has sent something. */
751 WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, 751 WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev,
752 &fifo_occupancy)); 752 &fifo_occupancy));
753 753
754 dev_err(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", 754 dev_dbg(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n",
755 __func__, (unsigned) fifo_occupancy); 755 __func__, (unsigned) fifo_occupancy);
756 756
757 /* Check if we misssed the interrupt. */ 757 /* Check if we misssed the interrupt. */
@@ -1210,7 +1210,7 @@ int cfhsi_probe(struct platform_device *pdev)
1210 1210
1211static void cfhsi_shutdown(struct cfhsi *cfhsi) 1211static void cfhsi_shutdown(struct cfhsi *cfhsi)
1212{ 1212{
1213 u8 *tx_buf, *rx_buf; 1213 u8 *tx_buf, *rx_buf, *flip_buf;
1214 1214
1215 /* Stop TXing */ 1215 /* Stop TXing */
1216 netif_tx_stop_all_queues(cfhsi->ndev); 1216 netif_tx_stop_all_queues(cfhsi->ndev);
@@ -1234,7 +1234,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi)
1234 /* Store bufferes: will be freed later. */ 1234 /* Store bufferes: will be freed later. */
1235 tx_buf = cfhsi->tx_buf; 1235 tx_buf = cfhsi->tx_buf;
1236 rx_buf = cfhsi->rx_buf; 1236 rx_buf = cfhsi->rx_buf;
1237 1237 flip_buf = cfhsi->rx_flip_buf;
1238 /* Flush transmit queues. */ 1238 /* Flush transmit queues. */
1239 cfhsi_abort_tx(cfhsi); 1239 cfhsi_abort_tx(cfhsi);
1240 1240
@@ -1247,6 +1247,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi)
1247 /* Free buffers. */ 1247 /* Free buffers. */
1248 kfree(tx_buf); 1248 kfree(tx_buf);
1249 kfree(rx_buf); 1249 kfree(rx_buf);
1250 kfree(flip_buf);
1250} 1251}
1251 1252
1252int cfhsi_remove(struct platform_device *pdev) 1253int cfhsi_remove(struct platform_device *pdev)
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
index 5234586dff15..629c4ba5d49d 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
@@ -875,6 +875,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev)
875 PCAN_USBPRO_INFO_FW, 875 PCAN_USBPRO_INFO_FW,
876 &fi, sizeof(fi)); 876 &fi, sizeof(fi));
877 if (err) { 877 if (err) {
878 kfree(usb_if);
878 dev_err(dev->netdev->dev.parent, 879 dev_err(dev->netdev->dev.parent,
879 "unable to read %s firmware info (err %d)\n", 880 "unable to read %s firmware info (err %d)\n",
880 pcan_usb_pro.name, err); 881 pcan_usb_pro.name, err);
@@ -885,6 +886,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev)
885 PCAN_USBPRO_INFO_BL, 886 PCAN_USBPRO_INFO_BL,
886 &bi, sizeof(bi)); 887 &bi, sizeof(bi));
887 if (err) { 888 if (err) {
889 kfree(usb_if);
888 dev_err(dev->netdev->dev.parent, 890 dev_err(dev->netdev->dev.parent,
889 "unable to read %s bootloader info (err %d)\n", 891 "unable to read %s bootloader info (err %d)\n",
890 pcan_usb_pro.name, err); 892 pcan_usb_pro.name, err);
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index d5c6d92f1ee7..442d91a2747b 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -107,14 +107,14 @@ static int dummy_dev_init(struct net_device *dev)
107 return 0; 107 return 0;
108} 108}
109 109
110static void dummy_dev_free(struct net_device *dev) 110static void dummy_dev_uninit(struct net_device *dev)
111{ 111{
112 free_percpu(dev->dstats); 112 free_percpu(dev->dstats);
113 free_netdev(dev);
114} 113}
115 114
116static const struct net_device_ops dummy_netdev_ops = { 115static const struct net_device_ops dummy_netdev_ops = {
117 .ndo_init = dummy_dev_init, 116 .ndo_init = dummy_dev_init,
117 .ndo_uninit = dummy_dev_uninit,
118 .ndo_start_xmit = dummy_xmit, 118 .ndo_start_xmit = dummy_xmit,
119 .ndo_validate_addr = eth_validate_addr, 119 .ndo_validate_addr = eth_validate_addr,
120 .ndo_set_rx_mode = set_multicast_list, 120 .ndo_set_rx_mode = set_multicast_list,
@@ -128,7 +128,7 @@ static void dummy_setup(struct net_device *dev)
128 128
129 /* Initialize the device structure. */ 129 /* Initialize the device structure. */
130 dev->netdev_ops = &dummy_netdev_ops; 130 dev->netdev_ops = &dummy_netdev_ops;
131 dev->destructor = dummy_dev_free; 131 dev->destructor = free_netdev;
132 132
133 /* Fill in device structure with ethernet-generic values. */ 133 /* Fill in device structure with ethernet-generic values. */
134 dev->tx_queue_len = 0; 134 dev->tx_queue_len = 0;
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index 40ac41436549..c926857e8205 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -2476,7 +2476,7 @@ static irqreturn_t atl1_intr(int irq, void *data)
2476 "pcie phy link down %x\n", status); 2476 "pcie phy link down %x\n", status);
2477 if (netif_running(adapter->netdev)) { /* reset MAC */ 2477 if (netif_running(adapter->netdev)) { /* reset MAC */
2478 iowrite32(0, adapter->hw.hw_addr + REG_IMR); 2478 iowrite32(0, adapter->hw.hw_addr + REG_IMR);
2479 schedule_work(&adapter->pcie_dma_to_rst_task); 2479 schedule_work(&adapter->reset_dev_task);
2480 return IRQ_HANDLED; 2480 return IRQ_HANDLED;
2481 } 2481 }
2482 } 2482 }
@@ -2488,7 +2488,7 @@ static irqreturn_t atl1_intr(int irq, void *data)
2488 "pcie DMA r/w error (status = 0x%x)\n", 2488 "pcie DMA r/w error (status = 0x%x)\n",
2489 status); 2489 status);
2490 iowrite32(0, adapter->hw.hw_addr + REG_IMR); 2490 iowrite32(0, adapter->hw.hw_addr + REG_IMR);
2491 schedule_work(&adapter->pcie_dma_to_rst_task); 2491 schedule_work(&adapter->reset_dev_task);
2492 return IRQ_HANDLED; 2492 return IRQ_HANDLED;
2493 } 2493 }
2494 2494
@@ -2633,10 +2633,10 @@ static void atl1_down(struct atl1_adapter *adapter)
2633 atl1_clean_rx_ring(adapter); 2633 atl1_clean_rx_ring(adapter);
2634} 2634}
2635 2635
2636static void atl1_tx_timeout_task(struct work_struct *work) 2636static void atl1_reset_dev_task(struct work_struct *work)
2637{ 2637{
2638 struct atl1_adapter *adapter = 2638 struct atl1_adapter *adapter =
2639 container_of(work, struct atl1_adapter, tx_timeout_task); 2639 container_of(work, struct atl1_adapter, reset_dev_task);
2640 struct net_device *netdev = adapter->netdev; 2640 struct net_device *netdev = adapter->netdev;
2641 2641
2642 netif_device_detach(netdev); 2642 netif_device_detach(netdev);
@@ -3038,12 +3038,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
3038 (unsigned long)adapter); 3038 (unsigned long)adapter);
3039 adapter->phy_timer_pending = false; 3039 adapter->phy_timer_pending = false;
3040 3040
3041 INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); 3041 INIT_WORK(&adapter->reset_dev_task, atl1_reset_dev_task);
3042 3042
3043 INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); 3043 INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task);
3044 3044
3045 INIT_WORK(&adapter->pcie_dma_to_rst_task, atl1_tx_timeout_task);
3046
3047 err = register_netdev(netdev); 3045 err = register_netdev(netdev);
3048 if (err) 3046 if (err)
3049 goto err_common; 3047 goto err_common;
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h
index 109d6da8be97..e04bf4d71e46 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.h
+++ b/drivers/net/ethernet/atheros/atlx/atl1.h
@@ -758,9 +758,8 @@ struct atl1_adapter {
758 u16 link_speed; 758 u16 link_speed;
759 u16 link_duplex; 759 u16 link_duplex;
760 spinlock_t lock; 760 spinlock_t lock;
761 struct work_struct tx_timeout_task; 761 struct work_struct reset_dev_task;
762 struct work_struct link_chg_task; 762 struct work_struct link_chg_task;
763 struct work_struct pcie_dma_to_rst_task;
764 763
765 struct timer_list phy_config_timer; 764 struct timer_list phy_config_timer;
766 bool phy_timer_pending; 765 bool phy_timer_pending;
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c
index 3cd8837236dc..c9e9dc57986c 100644
--- a/drivers/net/ethernet/atheros/atlx/atlx.c
+++ b/drivers/net/ethernet/atheros/atlx/atlx.c
@@ -194,7 +194,7 @@ static void atlx_tx_timeout(struct net_device *netdev)
194{ 194{
195 struct atlx_adapter *adapter = netdev_priv(netdev); 195 struct atlx_adapter *adapter = netdev_priv(netdev);
196 /* Do the reset outside of interrupt context */ 196 /* Do the reset outside of interrupt context */
197 schedule_work(&adapter->tx_timeout_task); 197 schedule_work(&adapter->reset_dev_task);
198} 198}
199 199
200/* 200/*
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index ad95324dc042..64392ec410a3 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -942,6 +942,12 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params,
942 const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 : 942 const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 :
943 DCBX_E3B0_MAX_NUM_COS_PORT0; 943 DCBX_E3B0_MAX_NUM_COS_PORT0;
944 944
945 if (pri >= max_num_of_cos) {
946 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid "
947 "parameter Illegal strict priority\n");
948 return -EINVAL;
949 }
950
945 if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) { 951 if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) {
946 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " 952 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid "
947 "parameter There can't be two COS's with " 953 "parameter There can't be two COS's with "
@@ -949,12 +955,6 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params,
949 return -EINVAL; 955 return -EINVAL;
950 } 956 }
951 957
952 if (pri > max_num_of_cos) {
953 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid "
954 "parameter Illegal strict priority\n");
955 return -EINVAL;
956 }
957
958 sp_pri_to_cos[pri] = cos_entry; 958 sp_pri_to_cos[pri] = cos_entry;
959 return 0; 959 return 0;
960 960
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index e077d2508727..6af310195bae 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9122,13 +9122,34 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp)
9122 return bnx2x_prev_mcp_done(bp); 9122 return bnx2x_prev_mcp_done(bp);
9123} 9123}
9124 9124
9125/* previous driver DMAE transaction may have occurred when pre-boot stage ended
9126 * and boot began, or when kdump kernel was loaded. Either case would invalidate
9127 * the addresses of the transaction, resulting in was-error bit set in the pci
9128 * causing all hw-to-host pcie transactions to timeout. If this happened we want
9129 * to clear the interrupt which detected this from the pglueb and the was done
9130 * bit
9131 */
9132static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp)
9133{
9134 u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS);
9135 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) {
9136 BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing");
9137 REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp));
9138 }
9139}
9140
9125static int __devinit bnx2x_prev_unload(struct bnx2x *bp) 9141static int __devinit bnx2x_prev_unload(struct bnx2x *bp)
9126{ 9142{
9127 int time_counter = 10; 9143 int time_counter = 10;
9128 u32 rc, fw, hw_lock_reg, hw_lock_val; 9144 u32 rc, fw, hw_lock_reg, hw_lock_val;
9129 BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); 9145 BNX2X_DEV_INFO("Entering Previous Unload Flow\n");
9130 9146
9131 /* Release previously held locks */ 9147 /* clear hw from errors which may have resulted from an interrupted
9148 * dmae transaction.
9149 */
9150 bnx2x_prev_interrupted_dmae(bp);
9151
9152 /* Release previously held locks */
9132 hw_lock_reg = (BP_FUNC(bp) <= 5) ? 9153 hw_lock_reg = (BP_FUNC(bp) <= 5) ?
9133 (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) : 9154 (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) :
9134 (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8); 9155 (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8);
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 062ac333fde6..ceeab8e852ef 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -879,8 +879,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi)
879 if (sblk->status & SD_STATUS_LINK_CHG) 879 if (sblk->status & SD_STATUS_LINK_CHG)
880 work_exists = 1; 880 work_exists = 1;
881 } 881 }
882 /* check for RX/TX work to do */ 882
883 if (sblk->idx[0].tx_consumer != tnapi->tx_cons || 883 /* check for TX work to do */
884 if (sblk->idx[0].tx_consumer != tnapi->tx_cons)
885 work_exists = 1;
886
887 /* check for RX work to do */
888 if (tnapi->rx_rcb_prod_idx &&
884 *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) 889 *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr)
885 work_exists = 1; 890 work_exists = 1;
886 891
@@ -6124,6 +6129,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget)
6124 return work_done; 6129 return work_done;
6125 } 6130 }
6126 6131
6132 if (!tnapi->rx_rcb_prod_idx)
6133 return work_done;
6134
6127 /* run RX thread, within the bounds set by NAPI. 6135 /* run RX thread, within the bounds set by NAPI.
6128 * All RX "locking" is done by ensuring outside 6136 * All RX "locking" is done by ensuring outside
6129 * code synchronizes with tg3->napi.poll() 6137 * code synchronizes with tg3->napi.poll()
@@ -7567,6 +7575,12 @@ static int tg3_alloc_consistent(struct tg3 *tp)
7567 */ 7575 */
7568 switch (i) { 7576 switch (i) {
7569 default: 7577 default:
7578 if (tg3_flag(tp, ENABLE_RSS)) {
7579 tnapi->rx_rcb_prod_idx = NULL;
7580 break;
7581 }
7582 /* Fall through */
7583 case 1:
7570 tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; 7584 tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer;
7571 break; 7585 break;
7572 case 2: 7586 case 2:
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index 63bfdd10bd6d..abb6ce7c1b7e 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -1150,6 +1150,48 @@ release_tpsram:
1150} 1150}
1151 1151
1152/** 1152/**
1153 * t3_synchronize_rx - wait for current Rx processing on a port to complete
1154 * @adap: the adapter
1155 * @p: the port
1156 *
1157 * Ensures that current Rx processing on any of the queues associated with
1158 * the given port completes before returning. We do this by acquiring and
1159 * releasing the locks of the response queues associated with the port.
1160 */
1161static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
1162{
1163 int i;
1164
1165 for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) {
1166 struct sge_rspq *q = &adap->sge.qs[i].rspq;
1167
1168 spin_lock_irq(&q->lock);
1169 spin_unlock_irq(&q->lock);
1170 }
1171}
1172
1173static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
1174{
1175 struct port_info *pi = netdev_priv(dev);
1176 struct adapter *adapter = pi->adapter;
1177
1178 if (adapter->params.rev > 0) {
1179 t3_set_vlan_accel(adapter, 1 << pi->port_id,
1180 features & NETIF_F_HW_VLAN_RX);
1181 } else {
1182 /* single control for all ports */
1183 unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX;
1184
1185 for_each_port(adapter, i)
1186 have_vlans |=
1187 adapter->port[i]->features & NETIF_F_HW_VLAN_RX;
1188
1189 t3_set_vlan_accel(adapter, 1, have_vlans);
1190 }
1191 t3_synchronize_rx(adapter, pi);
1192}
1193
1194/**
1153 * cxgb_up - enable the adapter 1195 * cxgb_up - enable the adapter
1154 * @adapter: adapter being enabled 1196 * @adapter: adapter being enabled
1155 * 1197 *
@@ -1161,7 +1203,7 @@ release_tpsram:
1161 */ 1203 */
1162static int cxgb_up(struct adapter *adap) 1204static int cxgb_up(struct adapter *adap)
1163{ 1205{
1164 int err; 1206 int i, err;
1165 1207
1166 if (!(adap->flags & FULL_INIT_DONE)) { 1208 if (!(adap->flags & FULL_INIT_DONE)) {
1167 err = t3_check_fw_version(adap); 1209 err = t3_check_fw_version(adap);
@@ -1198,6 +1240,9 @@ static int cxgb_up(struct adapter *adap)
1198 if (err) 1240 if (err)
1199 goto out; 1241 goto out;
1200 1242
1243 for_each_port(adap, i)
1244 cxgb_vlan_mode(adap->port[i], adap->port[i]->features);
1245
1201 setup_rss(adap); 1246 setup_rss(adap);
1202 if (!(adap->flags & NAPI_INIT)) 1247 if (!(adap->flags & NAPI_INIT))
1203 init_napi(adap); 1248 init_napi(adap);
@@ -2508,48 +2553,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
2508 return 0; 2553 return 0;
2509} 2554}
2510 2555
2511/**
2512 * t3_synchronize_rx - wait for current Rx processing on a port to complete
2513 * @adap: the adapter
2514 * @p: the port
2515 *
2516 * Ensures that current Rx processing on any of the queues associated with
2517 * the given port completes before returning. We do this by acquiring and
2518 * releasing the locks of the response queues associated with the port.
2519 */
2520static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
2521{
2522 int i;
2523
2524 for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) {
2525 struct sge_rspq *q = &adap->sge.qs[i].rspq;
2526
2527 spin_lock_irq(&q->lock);
2528 spin_unlock_irq(&q->lock);
2529 }
2530}
2531
2532static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
2533{
2534 struct port_info *pi = netdev_priv(dev);
2535 struct adapter *adapter = pi->adapter;
2536
2537 if (adapter->params.rev > 0) {
2538 t3_set_vlan_accel(adapter, 1 << pi->port_id,
2539 features & NETIF_F_HW_VLAN_RX);
2540 } else {
2541 /* single control for all ports */
2542 unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX;
2543
2544 for_each_port(adapter, i)
2545 have_vlans |=
2546 adapter->port[i]->features & NETIF_F_HW_VLAN_RX;
2547
2548 t3_set_vlan_accel(adapter, 1, have_vlans);
2549 }
2550 t3_synchronize_rx(adapter, pi);
2551}
2552
2553static netdev_features_t cxgb_fix_features(struct net_device *dev, 2556static netdev_features_t cxgb_fix_features(struct net_device *dev,
2554 netdev_features_t features) 2557 netdev_features_t features)
2555{ 2558{
@@ -3353,9 +3356,6 @@ static int __devinit init_one(struct pci_dev *pdev,
3353 err = sysfs_create_group(&adapter->port[0]->dev.kobj, 3356 err = sysfs_create_group(&adapter->port[0]->dev.kobj,
3354 &cxgb3_attr_group); 3357 &cxgb3_attr_group);
3355 3358
3356 for_each_port(adapter, i)
3357 cxgb_vlan_mode(adapter->port[i], adapter->port[i]->features);
3358
3359 print_port_info(adapter, ai); 3359 print_port_info(adapter, ai);
3360 return 0; 3360 return 0;
3361 3361
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
index b2dc2c81a147..2e09edb9cdf8 100644
--- a/drivers/net/ethernet/dlink/dl2k.c
+++ b/drivers/net/ethernet/dlink/dl2k.c
@@ -1259,55 +1259,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1259{ 1259{
1260 int phy_addr; 1260 int phy_addr;
1261 struct netdev_private *np = netdev_priv(dev); 1261 struct netdev_private *np = netdev_priv(dev);
1262 struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; 1262 struct mii_ioctl_data *miidata = if_mii(rq);
1263
1264 struct netdev_desc *desc;
1265 int i;
1266 1263
1267 phy_addr = np->phy_addr; 1264 phy_addr = np->phy_addr;
1268 switch (cmd) { 1265 switch (cmd) {
1269 case SIOCDEVPRIVATE: 1266 case SIOCGMIIPHY:
1270 break; 1267 miidata->phy_id = phy_addr;
1271
1272 case SIOCDEVPRIVATE + 1:
1273 miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num);
1274 break; 1268 break;
1275 case SIOCDEVPRIVATE + 2: 1269 case SIOCGMIIREG:
1276 mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value); 1270 miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num);
1277 break; 1271 break;
1278 case SIOCDEVPRIVATE + 3: 1272 case SIOCSMIIREG:
1279 break; 1273 if (!capable(CAP_NET_ADMIN))
1280 case SIOCDEVPRIVATE + 4: 1274 return -EPERM;
1281 break; 1275 mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in);
1282 case SIOCDEVPRIVATE + 5:
1283 netif_stop_queue (dev);
1284 break; 1276 break;
1285 case SIOCDEVPRIVATE + 6:
1286 netif_wake_queue (dev);
1287 break;
1288 case SIOCDEVPRIVATE + 7:
1289 printk
1290 ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n",
1291 netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx,
1292 np->old_rx);
1293 break;
1294 case SIOCDEVPRIVATE + 8:
1295 printk("TX ring:\n");
1296 for (i = 0; i < TX_RING_SIZE; i++) {
1297 desc = &np->tx_ring[i];
1298 printk
1299 ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x",
1300 i,
1301 (u32) (np->tx_ring_dma + i * sizeof (*desc)),
1302 (u32)le64_to_cpu(desc->next_desc),
1303 (u32)le64_to_cpu(desc->status),
1304 (u32)(le64_to_cpu(desc->fraginfo) >> 32),
1305 (u32)le64_to_cpu(desc->fraginfo));
1306 printk ("\n");
1307 }
1308 printk ("\n");
1309 break;
1310
1311 default: 1277 default:
1312 return -EOPNOTSUPP; 1278 return -EOPNOTSUPP;
1313 } 1279 }
diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h
index ba0adcafa55a..30c2da3de548 100644
--- a/drivers/net/ethernet/dlink/dl2k.h
+++ b/drivers/net/ethernet/dlink/dl2k.h
@@ -365,13 +365,6 @@ struct ioctl_data {
365 char *data; 365 char *data;
366}; 366};
367 367
368struct mii_data {
369 __u16 reserved;
370 __u16 reg_num;
371 __u16 in_value;
372 __u16 out_value;
373};
374
375/* The Rx and Tx buffer descriptors. */ 368/* The Rx and Tx buffer descriptors. */
376struct netdev_desc { 369struct netdev_desc {
377 __le64 next_desc; 370 __le64 next_desc;
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 17a46e76123f..9ac14f804851 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -116,10 +116,10 @@ static struct ucc_geth_info ugeth_primary_info = {
116 .maxGroupAddrInHash = 4, 116 .maxGroupAddrInHash = 4,
117 .maxIndAddrInHash = 4, 117 .maxIndAddrInHash = 4,
118 .prel = 7, 118 .prel = 7,
119 .maxFrameLength = 1518, 119 .maxFrameLength = 1518+16, /* Add extra bytes for VLANs etc. */
120 .minFrameLength = 64, 120 .minFrameLength = 64,
121 .maxD1Length = 1520, 121 .maxD1Length = 1520+16, /* Add extra bytes for VLANs etc. */
122 .maxD2Length = 1520, 122 .maxD2Length = 1520+16, /* Add extra bytes for VLANs etc. */
123 .vlantype = 0x8100, 123 .vlantype = 0x8100,
124 .ecamptr = ((uint32_t) NULL), 124 .ecamptr = ((uint32_t) NULL),
125 .eventRegMask = UCCE_OTHER, 125 .eventRegMask = UCCE_OTHER,
diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h
index 2e395a2566b8..f71b3e7b12de 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.h
+++ b/drivers/net/ethernet/freescale/ucc_geth.h
@@ -877,7 +877,7 @@ struct ucc_geth_hardware_statistics {
877 877
878/* Driver definitions */ 878/* Driver definitions */
879#define TX_BD_RING_LEN 0x10 879#define TX_BD_RING_LEN 0x10
880#define RX_BD_RING_LEN 0x10 880#define RX_BD_RING_LEN 0x20
881 881
882#define TX_RING_MOD_MASK(size) (size-1) 882#define TX_RING_MOD_MASK(size) (size-1)
883#define RX_RING_MOD_MASK(size) (size-1) 883#define RX_RING_MOD_MASK(size) (size-1)
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 3516e17a399d..f4d2da0db1b1 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -290,16 +290,18 @@ static void ehea_update_bcmc_registrations(void)
290 290
291 arr[i].adh = adapter->handle; 291 arr[i].adh = adapter->handle;
292 arr[i].port_id = port->logical_port_id; 292 arr[i].port_id = port->logical_port_id;
293 arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | 293 arr[i].reg_type = EHEA_BCMC_MULTICAST |
294 EHEA_BCMC_MULTICAST |
295 EHEA_BCMC_UNTAGGED; 294 EHEA_BCMC_UNTAGGED;
295 if (mc_entry->macaddr == 0)
296 arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL;
296 arr[i++].macaddr = mc_entry->macaddr; 297 arr[i++].macaddr = mc_entry->macaddr;
297 298
298 arr[i].adh = adapter->handle; 299 arr[i].adh = adapter->handle;
299 arr[i].port_id = port->logical_port_id; 300 arr[i].port_id = port->logical_port_id;
300 arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | 301 arr[i].reg_type = EHEA_BCMC_MULTICAST |
301 EHEA_BCMC_MULTICAST |
302 EHEA_BCMC_VLANID_ALL; 302 EHEA_BCMC_VLANID_ALL;
303 if (mc_entry->macaddr == 0)
304 arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL;
303 arr[i++].macaddr = mc_entry->macaddr; 305 arr[i++].macaddr = mc_entry->macaddr;
304 num_registrations -= 2; 306 num_registrations -= 2;
305 } 307 }
@@ -1838,8 +1840,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr,
1838 u64 hret; 1840 u64 hret;
1839 u8 reg_type; 1841 u8 reg_type;
1840 1842
1841 reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST 1843 reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_UNTAGGED;
1842 | EHEA_BCMC_UNTAGGED; 1844 if (mc_mac_addr == 0)
1845 reg_type |= EHEA_BCMC_SCOPE_ALL;
1843 1846
1844 hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, 1847 hret = ehea_h_reg_dereg_bcmc(port->adapter->handle,
1845 port->logical_port_id, 1848 port->logical_port_id,
@@ -1847,8 +1850,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr,
1847 if (hret) 1850 if (hret)
1848 goto out; 1851 goto out;
1849 1852
1850 reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST 1853 reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_VLANID_ALL;
1851 | EHEA_BCMC_VLANID_ALL; 1854 if (mc_mac_addr == 0)
1855 reg_type |= EHEA_BCMC_SCOPE_ALL;
1852 1856
1853 hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, 1857 hret = ehea_h_reg_dereg_bcmc(port->adapter->handle,
1854 port->logical_port_id, 1858 port->logical_port_id,
@@ -1898,7 +1902,7 @@ static void ehea_allmulti(struct net_device *dev, int enable)
1898 netdev_err(dev, 1902 netdev_err(dev,
1899 "failed enabling IFF_ALLMULTI\n"); 1903 "failed enabling IFF_ALLMULTI\n");
1900 } 1904 }
1901 } else 1905 } else {
1902 if (!enable) { 1906 if (!enable) {
1903 /* Disable ALLMULTI */ 1907 /* Disable ALLMULTI */
1904 hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); 1908 hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC);
@@ -1908,6 +1912,7 @@ static void ehea_allmulti(struct net_device *dev, int enable)
1908 netdev_err(dev, 1912 netdev_err(dev,
1909 "failed disabling IFF_ALLMULTI\n"); 1913 "failed disabling IFF_ALLMULTI\n");
1910 } 1914 }
1915 }
1911} 1916}
1912 1917
1913static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) 1918static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr)
@@ -1941,11 +1946,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
1941 struct netdev_hw_addr *ha; 1946 struct netdev_hw_addr *ha;
1942 int ret; 1947 int ret;
1943 1948
1944 if (port->promisc) { 1949 ehea_promiscuous(dev, !!(dev->flags & IFF_PROMISC));
1945 ehea_promiscuous(dev, 1);
1946 return;
1947 }
1948 ehea_promiscuous(dev, 0);
1949 1950
1950 if (dev->flags & IFF_ALLMULTI) { 1951 if (dev->flags & IFF_ALLMULTI) {
1951 ehea_allmulti(dev, 1); 1952 ehea_allmulti(dev, 1);
@@ -2463,6 +2464,7 @@ static int ehea_down(struct net_device *dev)
2463 return 0; 2464 return 0;
2464 2465
2465 ehea_drop_multicast_list(dev); 2466 ehea_drop_multicast_list(dev);
2467 ehea_allmulti(dev, 0);
2466 ehea_broadcast_reg_helper(port, H_DEREG_BCMC); 2468 ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
2467 2469
2468 ehea_free_interrupts(dev); 2470 ehea_free_interrupts(dev);
@@ -3261,6 +3263,7 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev,
3261 struct ehea_adapter *adapter; 3263 struct ehea_adapter *adapter;
3262 const u64 *adapter_handle; 3264 const u64 *adapter_handle;
3263 int ret; 3265 int ret;
3266 int i;
3264 3267
3265 if (!dev || !dev->dev.of_node) { 3268 if (!dev || !dev->dev.of_node) {
3266 pr_err("Invalid ibmebus device probed\n"); 3269 pr_err("Invalid ibmebus device probed\n");
@@ -3314,17 +3317,9 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev,
3314 tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, 3317 tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet,
3315 (unsigned long)adapter); 3318 (unsigned long)adapter);
3316 3319
3317 ret = ibmebus_request_irq(adapter->neq->attr.ist1,
3318 ehea_interrupt_neq, IRQF_DISABLED,
3319 "ehea_neq", adapter);
3320 if (ret) {
3321 dev_err(&dev->dev, "requesting NEQ IRQ failed\n");
3322 goto out_kill_eq;
3323 }
3324
3325 ret = ehea_create_device_sysfs(dev); 3320 ret = ehea_create_device_sysfs(dev);
3326 if (ret) 3321 if (ret)
3327 goto out_free_irq; 3322 goto out_kill_eq;
3328 3323
3329 ret = ehea_setup_ports(adapter); 3324 ret = ehea_setup_ports(adapter);
3330 if (ret) { 3325 if (ret) {
@@ -3332,15 +3327,30 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev,
3332 goto out_rem_dev_sysfs; 3327 goto out_rem_dev_sysfs;
3333 } 3328 }
3334 3329
3330 ret = ibmebus_request_irq(adapter->neq->attr.ist1,
3331 ehea_interrupt_neq, IRQF_DISABLED,
3332 "ehea_neq", adapter);
3333 if (ret) {
3334 dev_err(&dev->dev, "requesting NEQ IRQ failed\n");
3335 goto out_shutdown_ports;
3336 }
3337
3338 /* Handle any events that might be pending. */
3339 tasklet_hi_schedule(&adapter->neq_tasklet);
3340
3335 ret = 0; 3341 ret = 0;
3336 goto out; 3342 goto out;
3337 3343
3344out_shutdown_ports:
3345 for (i = 0; i < EHEA_MAX_PORTS; i++)
3346 if (adapter->port[i]) {
3347 ehea_shutdown_single_port(adapter->port[i]);
3348 adapter->port[i] = NULL;
3349 }
3350
3338out_rem_dev_sysfs: 3351out_rem_dev_sysfs:
3339 ehea_remove_device_sysfs(dev); 3352 ehea_remove_device_sysfs(dev);
3340 3353
3341out_free_irq:
3342 ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
3343
3344out_kill_eq: 3354out_kill_eq:
3345 ehea_destroy_eq(adapter->neq); 3355 ehea_destroy_eq(adapter->neq);
3346 3356
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h
index 52c456ec4d6c..8364815c32ff 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h
+++ b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h
@@ -450,7 +450,7 @@ u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num,
450 void *cb_addr); 450 void *cb_addr);
451 451
452#define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) 452#define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63)
453#define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(61, 63) 453#define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(60, 63)
454#define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) 454#define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63)
455#define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) 455#define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63)
456 456
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 4348b6fd44fa..8d8908d2a9b1 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -493,7 +493,11 @@ out:
493static void e1000_down_and_stop(struct e1000_adapter *adapter) 493static void e1000_down_and_stop(struct e1000_adapter *adapter)
494{ 494{
495 set_bit(__E1000_DOWN, &adapter->flags); 495 set_bit(__E1000_DOWN, &adapter->flags);
496 cancel_work_sync(&adapter->reset_task); 496
497 /* Only kill reset task if adapter is not resetting */
498 if (!test_bit(__E1000_RESETTING, &adapter->flags))
499 cancel_work_sync(&adapter->reset_task);
500
497 cancel_delayed_work_sync(&adapter->watchdog_task); 501 cancel_delayed_work_sync(&adapter->watchdog_task);
498 cancel_delayed_work_sync(&adapter->phy_info_task); 502 cancel_delayed_work_sync(&adapter->phy_info_task);
499 cancel_delayed_work_sync(&adapter->fifo_stall_task); 503 cancel_delayed_work_sync(&adapter->fifo_stall_task);
@@ -3380,7 +3384,7 @@ static void e1000_dump(struct e1000_adapter *adapter)
3380 for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { 3384 for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
3381 struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i); 3385 struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i);
3382 struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i]; 3386 struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i];
3383 struct my_u { u64 a; u64 b; }; 3387 struct my_u { __le64 a; __le64 b; };
3384 struct my_u *u = (struct my_u *)tx_desc; 3388 struct my_u *u = (struct my_u *)tx_desc;
3385 const char *type; 3389 const char *type;
3386 3390
@@ -3424,7 +3428,7 @@ rx_ring_summary:
3424 for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { 3428 for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) {
3425 struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i); 3429 struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i);
3426 struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i]; 3430 struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i];
3427 struct my_u { u64 a; u64 b; }; 3431 struct my_u { __le64 a; __le64 b; };
3428 struct my_u *u = (struct my_u *)rx_desc; 3432 struct my_u *u = (struct my_u *)rx_desc;
3429 const char *type; 3433 const char *type;
3430 3434
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 64c76443a7aa..b461c24945e3 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -1310,10 +1310,6 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1310 1310
1311 if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) 1311 if (mac_reg & E1000_PHY_CTRL_D0A_LPLU)
1312 oem_reg |= HV_OEM_BITS_LPLU; 1312 oem_reg |= HV_OEM_BITS_LPLU;
1313
1314 /* Set Restart auto-neg to activate the bits */
1315 if (!hw->phy.ops.check_reset_block(hw))
1316 oem_reg |= HV_OEM_BITS_RESTART_AN;
1317 } else { 1313 } else {
1318 if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | 1314 if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE |
1319 E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) 1315 E1000_PHY_CTRL_NOND0A_GBE_DISABLE))
@@ -1324,6 +1320,11 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1324 oem_reg |= HV_OEM_BITS_LPLU; 1320 oem_reg |= HV_OEM_BITS_LPLU;
1325 } 1321 }
1326 1322
1323 /* Set Restart auto-neg to activate the bits */
1324 if ((d0_state || (hw->mac.type != e1000_pchlan)) &&
1325 !hw->phy.ops.check_reset_block(hw))
1326 oem_reg |= HV_OEM_BITS_RESTART_AN;
1327
1327 ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); 1328 ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg);
1328 1329
1329release: 1330release:
@@ -3682,7 +3683,11 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw)
3682 3683
3683 if (hw->mac.type >= e1000_pchlan) { 3684 if (hw->mac.type >= e1000_pchlan) {
3684 e1000_oem_bits_config_ich8lan(hw, false); 3685 e1000_oem_bits_config_ich8lan(hw, false);
3685 e1000_phy_hw_reset_ich8lan(hw); 3686
3687 /* Reset PHY to activate OEM bits on 82577/8 */
3688 if (hw->mac.type == e1000_pchlan)
3689 e1000e_phy_hw_reset_generic(hw);
3690
3686 ret_val = hw->phy.ops.acquire(hw); 3691 ret_val = hw->phy.ops.acquire(hw);
3687 if (ret_val) 3692 if (ret_val)
3688 return; 3693 return;
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 19ab2154802c..9520a6ac1f30 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3799,7 +3799,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
3799 /* fire an unusual interrupt on the test handler */ 3799 /* fire an unusual interrupt on the test handler */
3800 ew32(ICS, E1000_ICS_RXSEQ); 3800 ew32(ICS, E1000_ICS_RXSEQ);
3801 e1e_flush(); 3801 e1e_flush();
3802 msleep(50); 3802 msleep(100);
3803 3803
3804 e1000_irq_disable(adapter); 3804 e1000_irq_disable(adapter);
3805 3805
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c
index ff796e42c3eb..16adeb9418a8 100644
--- a/drivers/net/ethernet/intel/e1000e/param.c
+++ b/drivers/net/ethernet/intel/e1000e/param.c
@@ -106,7 +106,7 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
106/* 106/*
107 * Interrupt Throttle Rate (interrupts/sec) 107 * Interrupt Throttle Rate (interrupts/sec)
108 * 108 *
109 * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) 109 * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative
110 */ 110 */
111E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); 111E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
112#define DEFAULT_ITR 3 112#define DEFAULT_ITR 3
@@ -344,53 +344,60 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
344 344
345 if (num_InterruptThrottleRate > bd) { 345 if (num_InterruptThrottleRate > bd) {
346 adapter->itr = InterruptThrottleRate[bd]; 346 adapter->itr = InterruptThrottleRate[bd];
347 switch (adapter->itr) { 347
348 case 0: 348 /*
349 e_info("%s turned off\n", opt.name); 349 * Make sure a message is printed for non-special
350 break; 350 * values. And in case of an invalid option, display
351 case 1: 351 * warning, use default and got through itr/itr_setting
352 e_info("%s set to dynamic mode\n", opt.name); 352 * adjustment logic below
353 adapter->itr_setting = adapter->itr; 353 */
354 adapter->itr = 20000; 354 if ((adapter->itr > 4) &&
355 break; 355 e1000_validate_option(&adapter->itr, &opt, adapter))
356 case 3: 356 adapter->itr = opt.def;
357 e_info("%s set to dynamic conservative mode\n",
358 opt.name);
359 adapter->itr_setting = adapter->itr;
360 adapter->itr = 20000;
361 break;
362 case 4:
363 e_info("%s set to simplified (2000-8000 ints) "
364 "mode\n", opt.name);
365 adapter->itr_setting = 4;
366 break;
367 default:
368 /*
369 * Save the setting, because the dynamic bits
370 * change itr.
371 */
372 if (e1000_validate_option(&adapter->itr, &opt,
373 adapter) &&
374 (adapter->itr == 3)) {
375 /*
376 * In case of invalid user value,
377 * default to conservative mode.
378 */
379 adapter->itr_setting = adapter->itr;
380 adapter->itr = 20000;
381 } else {
382 /*
383 * Clear the lower two bits because
384 * they are used as control.
385 */
386 adapter->itr_setting =
387 adapter->itr & ~3;
388 }
389 break;
390 }
391 } else { 357 } else {
392 adapter->itr_setting = opt.def; 358 /*
359 * If no option specified, use default value and go
360 * through the logic below to adjust itr/itr_setting
361 */
362 adapter->itr = opt.def;
363
364 /*
365 * Make sure a message is printed for non-special
366 * default values
367 */
368 if (adapter->itr > 40)
369 e_info("%s set to default %d\n", opt.name,
370 adapter->itr);
371 }
372
373 adapter->itr_setting = adapter->itr;
374 switch (adapter->itr) {
375 case 0:
376 e_info("%s turned off\n", opt.name);
377 break;
378 case 1:
379 e_info("%s set to dynamic mode\n", opt.name);
380 adapter->itr = 20000;
381 break;
382 case 3:
383 e_info("%s set to dynamic conservative mode\n",
384 opt.name);
393 adapter->itr = 20000; 385 adapter->itr = 20000;
386 break;
387 case 4:
388 e_info("%s set to simplified (2000-8000 ints) mode\n",
389 opt.name);
390 break;
391 default:
392 /*
393 * Save the setting, because the dynamic bits
394 * change itr.
395 *
396 * Clear the lower two bits because
397 * they are used as control.
398 */
399 adapter->itr_setting &= ~3;
400 break;
394 } 401 }
395 } 402 }
396 { /* Interrupt Mode */ 403 { /* Interrupt Mode */
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 5ec31598ee47..8683ca4748c8 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1111,9 +1111,12 @@ msi_only:
1111 adapter->flags |= IGB_FLAG_HAS_MSI; 1111 adapter->flags |= IGB_FLAG_HAS_MSI;
1112out: 1112out:
1113 /* Notify the stack of the (possibly) reduced queue counts. */ 1113 /* Notify the stack of the (possibly) reduced queue counts. */
1114 rtnl_lock();
1114 netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); 1115 netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);
1115 return netif_set_real_num_rx_queues(adapter->netdev, 1116 err = netif_set_real_num_rx_queues(adapter->netdev,
1116 adapter->num_rx_queues); 1117 adapter->num_rx_queues);
1118 rtnl_unlock();
1119 return err;
1117} 1120}
1118 1121
1119/** 1122/**
@@ -2771,8 +2774,6 @@ void igb_configure_tx_ring(struct igb_adapter *adapter,
2771 2774
2772 txdctl |= E1000_TXDCTL_QUEUE_ENABLE; 2775 txdctl |= E1000_TXDCTL_QUEUE_ENABLE;
2773 wr32(E1000_TXDCTL(reg_idx), txdctl); 2776 wr32(E1000_TXDCTL(reg_idx), txdctl);
2774
2775 netdev_tx_reset_queue(txring_txq(ring));
2776} 2777}
2777 2778
2778/** 2779/**
@@ -3282,6 +3283,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring)
3282 igb_unmap_and_free_tx_resource(tx_ring, buffer_info); 3283 igb_unmap_and_free_tx_resource(tx_ring, buffer_info);
3283 } 3284 }
3284 3285
3286 netdev_tx_reset_queue(txring_txq(tx_ring));
3287
3285 size = sizeof(struct igb_tx_buffer) * tx_ring->count; 3288 size = sizeof(struct igb_tx_buffer) * tx_ring->count;
3286 memset(tx_ring->tx_buffer_info, 0, size); 3289 memset(tx_ring->tx_buffer_info, 0, size);
3287 3290
@@ -6796,18 +6799,7 @@ static int igb_resume(struct device *dev)
6796 pci_enable_wake(pdev, PCI_D3hot, 0); 6799 pci_enable_wake(pdev, PCI_D3hot, 0);
6797 pci_enable_wake(pdev, PCI_D3cold, 0); 6800 pci_enable_wake(pdev, PCI_D3cold, 0);
6798 6801
6799 if (!rtnl_is_locked()) { 6802 if (igb_init_interrupt_scheme(adapter)) {
6800 /*
6801 * shut up ASSERT_RTNL() warning in
6802 * netif_set_real_num_tx/rx_queues.
6803 */
6804 rtnl_lock();
6805 err = igb_init_interrupt_scheme(adapter);
6806 rtnl_unlock();
6807 } else {
6808 err = igb_init_interrupt_scheme(adapter);
6809 }
6810 if (err) {
6811 dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); 6803 dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
6812 return -ENOMEM; 6804 return -ENOMEM;
6813 } 6805 }
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index d61ca2a732f0..8ec74b07f940 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -2731,14 +2731,14 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
2731 netdev->addr_len); 2731 netdev->addr_len);
2732 } 2732 }
2733 2733
2734 if (!is_valid_ether_addr(netdev->perm_addr)) { 2734 if (!is_valid_ether_addr(netdev->dev_addr)) {
2735 dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", 2735 dev_err(&pdev->dev, "Invalid MAC Address: %pM\n",
2736 netdev->dev_addr); 2736 netdev->dev_addr);
2737 err = -EIO; 2737 err = -EIO;
2738 goto err_hw_init; 2738 goto err_hw_init;
2739 } 2739 }
2740 2740
2741 memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); 2741 memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
2742 2742
2743 setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, 2743 setup_timer(&adapter->watchdog_timer, &igbvf_watchdog,
2744 (unsigned long) adapter); 2744 (unsigned long) adapter);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 74e192107f9a..81b155589532 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -574,9 +574,6 @@ extern struct ixgbe_info ixgbe_82599_info;
574extern struct ixgbe_info ixgbe_X540_info; 574extern struct ixgbe_info ixgbe_X540_info;
575#ifdef CONFIG_IXGBE_DCB 575#ifdef CONFIG_IXGBE_DCB
576extern const struct dcbnl_rtnl_ops dcbnl_ops; 576extern const struct dcbnl_rtnl_ops dcbnl_ops;
577extern int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg,
578 struct ixgbe_dcb_config *dst_dcb_cfg,
579 int tc_max);
580#endif 577#endif
581 578
582extern char ixgbe_driver_name[]; 579extern char ixgbe_driver_name[];
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index 652e4b09546d..32e5c02ff6d0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -44,18 +44,26 @@
44#define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ 44#define DCB_NO_HW_CHG 1 /* DCB configuration did not change */
45#define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ 45#define DCB_HW_CHG 2 /* DCB configuration changed, no reset */
46 46
47int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg, 47static int ixgbe_copy_dcb_cfg(struct ixgbe_adapter *adapter, int tc_max)
48 struct ixgbe_dcb_config *dcfg, int tc_max)
49{ 48{
49 struct ixgbe_dcb_config *scfg = &adapter->temp_dcb_cfg;
50 struct ixgbe_dcb_config *dcfg = &adapter->dcb_cfg;
50 struct tc_configuration *src = NULL; 51 struct tc_configuration *src = NULL;
51 struct tc_configuration *dst = NULL; 52 struct tc_configuration *dst = NULL;
52 int i, j; 53 int i, j;
53 int tx = DCB_TX_CONFIG; 54 int tx = DCB_TX_CONFIG;
54 int rx = DCB_RX_CONFIG; 55 int rx = DCB_RX_CONFIG;
55 int changes = 0; 56 int changes = 0;
57#ifdef IXGBE_FCOE
58 struct dcb_app app = {
59 .selector = DCB_APP_IDTYPE_ETHTYPE,
60 .protocol = ETH_P_FCOE,
61 };
62 u8 up = dcb_getapp(adapter->netdev, &app);
56 63
57 if (!scfg || !dcfg) 64 if (up && !(up & (1 << adapter->fcoe.up)))
58 return changes; 65 changes |= BIT_APP_UPCHG;
66#endif
59 67
60 for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { 68 for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) {
61 src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; 69 src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0];
@@ -332,28 +340,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
332 struct ixgbe_adapter *adapter = netdev_priv(netdev); 340 struct ixgbe_adapter *adapter = netdev_priv(netdev);
333 int ret = DCB_NO_HW_CHG; 341 int ret = DCB_NO_HW_CHG;
334 int i; 342 int i;
335#ifdef IXGBE_FCOE
336 struct dcb_app app = {
337 .selector = DCB_APP_IDTYPE_ETHTYPE,
338 .protocol = ETH_P_FCOE,
339 };
340 u8 up;
341
342 /* In IEEE mode, use the IEEE Ethertype selector value */
343 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) {
344 app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE;
345 up = dcb_ieee_getapp_mask(netdev, &app);
346 } else {
347 up = dcb_getapp(netdev, &app);
348 }
349#endif
350 343
351 /* Fail command if not in CEE mode */ 344 /* Fail command if not in CEE mode */
352 if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 345 if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
353 return ret; 346 return ret;
354 347
355 adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, 348 adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(adapter,
356 &adapter->dcb_cfg,
357 MAX_TRAFFIC_CLASS); 349 MAX_TRAFFIC_CLASS);
358 if (!adapter->dcb_set_bitmap) 350 if (!adapter->dcb_set_bitmap)
359 return ret; 351 return ret;
@@ -440,8 +432,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
440 * FCoE is using changes. This happens if the APP info 432 * FCoE is using changes. This happens if the APP info
441 * changes or the up2tc mapping is updated. 433 * changes or the up2tc mapping is updated.
442 */ 434 */
443 if ((up && !(up & (1 << adapter->fcoe.up))) || 435 if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
444 (adapter->dcb_set_bitmap & BIT_APP_UPCHG)) { 436 struct dcb_app app = {
437 .selector = DCB_APP_IDTYPE_ETHTYPE,
438 .protocol = ETH_P_FCOE,
439 };
440 u8 up = dcb_getapp(netdev, &app);
441
445 adapter->fcoe.up = ffs(up) - 1; 442 adapter->fcoe.up = ffs(up) - 1;
446 ixgbe_dcbnl_devreset(netdev); 443 ixgbe_dcbnl_devreset(netdev);
447 ret = DCB_HW_CHG_RST; 444 ret = DCB_HW_CHG_RST;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 31a2bf76a346..cfe7d269590c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1780,6 +1780,8 @@ static u16 ixgbe_clean_test_rings(struct ixgbe_ring *rx_ring,
1780 rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc); 1780 rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc);
1781 } 1781 }
1782 1782
1783 netdev_tx_reset_queue(txring_txq(tx_ring));
1784
1783 /* re-map buffers to ring, store next to clean values */ 1785 /* re-map buffers to ring, store next to clean values */
1784 ixgbe_alloc_rx_buffers(rx_ring, count); 1786 ixgbe_alloc_rx_buffers(rx_ring, count);
1785 rx_ring->next_to_clean = rx_ntc; 1787 rx_ring->next_to_clean = rx_ntc;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index 77ea4b716535..bc07933d67da 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -437,6 +437,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
437 */ 437 */
438 if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && 438 if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) &&
439 (fctl & FC_FC_END_SEQ)) { 439 (fctl & FC_FC_END_SEQ)) {
440 skb_linearize(skb);
440 crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); 441 crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc));
441 crc->fcoe_eof = FC_EOF_T; 442 crc->fcoe_eof = FC_EOF_T;
442 } 443 }
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 027d7a75be39..ed1b47dc0834 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -622,6 +622,16 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, int v_idx,
622 if (adapter->hw.mac.type == ixgbe_mac_82599EB) 622 if (adapter->hw.mac.type == ixgbe_mac_82599EB)
623 set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); 623 set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state);
624 624
625#ifdef IXGBE_FCOE
626 if (adapter->netdev->features & NETIF_F_FCOE_MTU) {
627 struct ixgbe_ring_feature *f;
628 f = &adapter->ring_feature[RING_F_FCOE];
629 if ((rxr_idx >= f->mask) &&
630 (rxr_idx < f->mask + f->indices))
631 set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state);
632 }
633
634#endif /* IXGBE_FCOE */
625 /* apply Rx specific ring traits */ 635 /* apply Rx specific ring traits */
626 ring->count = adapter->rx_ring_count; 636 ring->count = adapter->rx_ring_count;
627 ring->queue_index = rxr_idx; 637 ring->queue_index = rxr_idx;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 3e26b1f9ac75..467948e9ecd9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2671,8 +2671,6 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
2671 /* enable queue */ 2671 /* enable queue */
2672 IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl); 2672 IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl);
2673 2673
2674 netdev_tx_reset_queue(txring_txq(ring));
2675
2676 /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */ 2674 /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */
2677 if (hw->mac.type == ixgbe_mac_82598EB && 2675 if (hw->mac.type == ixgbe_mac_82598EB &&
2678 !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP)) 2676 !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP))
@@ -3154,14 +3152,6 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)
3154 set_ring_rsc_enabled(rx_ring); 3152 set_ring_rsc_enabled(rx_ring);
3155 else 3153 else
3156 clear_ring_rsc_enabled(rx_ring); 3154 clear_ring_rsc_enabled(rx_ring);
3157#ifdef IXGBE_FCOE
3158 if (netdev->features & NETIF_F_FCOE_MTU) {
3159 struct ixgbe_ring_feature *f;
3160 f = &adapter->ring_feature[RING_F_FCOE];
3161 if ((i >= f->mask) && (i < f->mask + f->indices))
3162 set_bit(__IXGBE_RX_FCOE_BUFSZ, &rx_ring->state);
3163 }
3164#endif /* IXGBE_FCOE */
3165 } 3155 }
3166} 3156}
3167 3157
@@ -4175,6 +4165,8 @@ static void ixgbe_clean_tx_ring(struct ixgbe_ring *tx_ring)
4175 ixgbe_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); 4165 ixgbe_unmap_and_free_tx_resource(tx_ring, tx_buffer_info);
4176 } 4166 }
4177 4167
4168 netdev_tx_reset_queue(txring_txq(tx_ring));
4169
4178 size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; 4170 size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
4179 memset(tx_ring->tx_buffer_info, 0, size); 4171 memset(tx_ring->tx_buffer_info, 0, size);
4180 4172
@@ -4426,8 +4418,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
4426 adapter->dcb_cfg.pfc_mode_enable = false; 4418 adapter->dcb_cfg.pfc_mode_enable = false;
4427 adapter->dcb_set_bitmap = 0x00; 4419 adapter->dcb_set_bitmap = 0x00;
4428 adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE; 4420 adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE;
4429 ixgbe_copy_dcb_cfg(&adapter->dcb_cfg, &adapter->temp_dcb_cfg, 4421 memcpy(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
4430 MAX_TRAFFIC_CLASS); 4422 sizeof(adapter->temp_dcb_cfg));
4431 4423
4432#endif 4424#endif
4433 4425
@@ -4836,7 +4828,9 @@ static int ixgbe_resume(struct pci_dev *pdev)
4836 4828
4837 pci_wake_from_d3(pdev, false); 4829 pci_wake_from_d3(pdev, false);
4838 4830
4831 rtnl_lock();
4839 err = ixgbe_init_interrupt_scheme(adapter); 4832 err = ixgbe_init_interrupt_scheme(adapter);
4833 rtnl_unlock();
4840 if (err) { 4834 if (err) {
4841 e_dev_err("Cannot initialize interrupts for device\n"); 4835 e_dev_err("Cannot initialize interrupts for device\n");
4842 return err; 4836 return err;
@@ -4872,17 +4866,15 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
4872 netif_device_detach(netdev); 4866 netif_device_detach(netdev);
4873 4867
4874 if (netif_running(netdev)) { 4868 if (netif_running(netdev)) {
4869 rtnl_lock();
4875 ixgbe_down(adapter); 4870 ixgbe_down(adapter);
4876 ixgbe_free_irq(adapter); 4871 ixgbe_free_irq(adapter);
4877 ixgbe_free_all_tx_resources(adapter); 4872 ixgbe_free_all_tx_resources(adapter);
4878 ixgbe_free_all_rx_resources(adapter); 4873 ixgbe_free_all_rx_resources(adapter);
4874 rtnl_unlock();
4879 } 4875 }
4880 4876
4881 ixgbe_clear_interrupt_scheme(adapter); 4877 ixgbe_clear_interrupt_scheme(adapter);
4882#ifdef CONFIG_DCB
4883 kfree(adapter->ixgbe_ieee_pfc);
4884 kfree(adapter->ixgbe_ieee_ets);
4885#endif
4886 4878
4887#ifdef CONFIG_PM 4879#ifdef CONFIG_PM
4888 retval = pci_save_state(pdev); 4880 retval = pci_save_state(pdev);
@@ -4893,6 +4885,16 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
4893 if (wufc) { 4885 if (wufc) {
4894 ixgbe_set_rx_mode(netdev); 4886 ixgbe_set_rx_mode(netdev);
4895 4887
4888 /*
4889 * enable the optics for both mult-speed fiber and
4890 * 82599 SFP+ fiber as we can WoL.
4891 */
4892 if (hw->mac.ops.enable_tx_laser &&
4893 (hw->phy.multispeed_fiber ||
4894 (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber &&
4895 hw->mac.type == ixgbe_mac_82599EB)))
4896 hw->mac.ops.enable_tx_laser(hw);
4897
4896 /* turn on all-multi mode if wake on multicast is enabled */ 4898 /* turn on all-multi mode if wake on multicast is enabled */
4897 if (wufc & IXGBE_WUFC_MC) { 4899 if (wufc & IXGBE_WUFC_MC) {
4898 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); 4900 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
@@ -7220,6 +7222,11 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
7220 7222
7221 ixgbe_release_hw_control(adapter); 7223 ixgbe_release_hw_control(adapter);
7222 7224
7225#ifdef CONFIG_DCB
7226 kfree(adapter->ixgbe_ieee_pfc);
7227 kfree(adapter->ixgbe_ieee_ets);
7228
7229#endif
7223 iounmap(adapter->hw.hw_addr); 7230 iounmap(adapter->hw.hw_addr);
7224 pci_release_selected_regions(pdev, pci_select_bars(pdev, 7231 pci_release_selected_regions(pdev, pci_select_bars(pdev,
7225 IORESOURCE_MEM)); 7232 IORESOURCE_MEM));
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index c9b504e2dfc3..487a6c8bd4ec 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -2494,8 +2494,13 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2,
2494 skb_copy_from_linear_data(re->skb, skb->data, length); 2494 skb_copy_from_linear_data(re->skb, skb->data, length);
2495 skb->ip_summed = re->skb->ip_summed; 2495 skb->ip_summed = re->skb->ip_summed;
2496 skb->csum = re->skb->csum; 2496 skb->csum = re->skb->csum;
2497 skb->rxhash = re->skb->rxhash;
2498 skb->vlan_tci = re->skb->vlan_tci;
2499
2497 pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, 2500 pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
2498 length, PCI_DMA_FROMDEVICE); 2501 length, PCI_DMA_FROMDEVICE);
2502 re->skb->vlan_tci = 0;
2503 re->skb->rxhash = 0;
2499 re->skb->ip_summed = CHECKSUM_NONE; 2504 re->skb->ip_summed = CHECKSUM_NONE;
2500 skb_put(skb, length); 2505 skb_put(skb, length);
2501 } 2506 }
@@ -2580,9 +2585,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2580 struct sk_buff *skb = NULL; 2585 struct sk_buff *skb = NULL;
2581 u16 count = (status & GMR_FS_LEN) >> 16; 2586 u16 count = (status & GMR_FS_LEN) >> 16;
2582 2587
2583 if (status & GMR_FS_VLAN)
2584 count -= VLAN_HLEN; /* Account for vlan tag */
2585
2586 netif_printk(sky2, rx_status, KERN_DEBUG, dev, 2588 netif_printk(sky2, rx_status, KERN_DEBUG, dev,
2587 "rx slot %u status 0x%x len %d\n", 2589 "rx slot %u status 0x%x len %d\n",
2588 sky2->rx_next, status, length); 2590 sky2->rx_next, status, length);
@@ -2590,6 +2592,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2590 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; 2592 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
2591 prefetch(sky2->rx_ring + sky2->rx_next); 2593 prefetch(sky2->rx_ring + sky2->rx_next);
2592 2594
2595 if (vlan_tx_tag_present(re->skb))
2596 count -= VLAN_HLEN; /* Account for vlan tag */
2597
2593 /* This chip has hardware problems that generates bogus status. 2598 /* This chip has hardware problems that generates bogus status.
2594 * So do only marginal checking and expect higher level protocols 2599 * So do only marginal checking and expect higher level protocols
2595 * to handle crap frames. 2600 * to handle crap frames.
@@ -2647,11 +2652,8 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
2647} 2652}
2648 2653
2649static inline void sky2_skb_rx(const struct sky2_port *sky2, 2654static inline void sky2_skb_rx(const struct sky2_port *sky2,
2650 u32 status, struct sk_buff *skb) 2655 struct sk_buff *skb)
2651{ 2656{
2652 if (status & GMR_FS_VLAN)
2653 __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag));
2654
2655 if (skb->ip_summed == CHECKSUM_NONE) 2657 if (skb->ip_summed == CHECKSUM_NONE)
2656 netif_receive_skb(skb); 2658 netif_receive_skb(skb);
2657 else 2659 else
@@ -2705,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status)
2705 } 2707 }
2706} 2708}
2707 2709
2710static void sky2_rx_tag(struct sky2_port *sky2, u16 length)
2711{
2712 struct sk_buff *skb;
2713
2714 skb = sky2->rx_ring[sky2->rx_next].skb;
2715 __vlan_hwaccel_put_tag(skb, be16_to_cpu(length));
2716}
2717
2708static void sky2_rx_hash(struct sky2_port *sky2, u32 status) 2718static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
2709{ 2719{
2710 struct sk_buff *skb; 2720 struct sk_buff *skb;
@@ -2763,8 +2773,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2763 } 2773 }
2764 2774
2765 skb->protocol = eth_type_trans(skb, dev); 2775 skb->protocol = eth_type_trans(skb, dev);
2766 2776 sky2_skb_rx(sky2, skb);
2767 sky2_skb_rx(sky2, status, skb);
2768 2777
2769 /* Stop after net poll weight */ 2778 /* Stop after net poll weight */
2770 if (++work_done >= to_do) 2779 if (++work_done >= to_do)
@@ -2772,11 +2781,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2772 break; 2781 break;
2773 2782
2774 case OP_RXVLAN: 2783 case OP_RXVLAN:
2775 sky2->rx_tag = length; 2784 sky2_rx_tag(sky2, length);
2776 break; 2785 break;
2777 2786
2778 case OP_RXCHKSVLAN: 2787 case OP_RXCHKSVLAN:
2779 sky2->rx_tag = length; 2788 sky2_rx_tag(sky2, length);
2780 /* fall through */ 2789 /* fall through */
2781 case OP_RXCHKS: 2790 case OP_RXCHKS:
2782 if (likely(dev->features & NETIF_F_RXCSUM)) 2791 if (likely(dev->features & NETIF_F_RXCSUM))
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h
index ff6f58bf822a..3c896ce80b71 100644
--- a/drivers/net/ethernet/marvell/sky2.h
+++ b/drivers/net/ethernet/marvell/sky2.h
@@ -2241,7 +2241,6 @@ struct sky2_port {
2241 u16 rx_pending; 2241 u16 rx_pending;
2242 u16 rx_data_size; 2242 u16 rx_data_size;
2243 u16 rx_nfrags; 2243 u16 rx_nfrags;
2244 u16 rx_tag;
2245 2244
2246 struct { 2245 struct {
2247 unsigned long last; 2246 unsigned long last;
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index c722aa607d07..5e313e9a252f 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -618,10 +618,8 @@ static void ks8851_irq_work(struct work_struct *work)
618 netif_dbg(ks, intr, ks->netdev, 618 netif_dbg(ks, intr, ks->netdev,
619 "%s: status 0x%04x\n", __func__, status); 619 "%s: status 0x%04x\n", __func__, status);
620 620
621 if (status & IRQ_LCI) { 621 if (status & IRQ_LCI)
622 /* should do something about checking link status */
623 handled |= IRQ_LCI; 622 handled |= IRQ_LCI;
624 }
625 623
626 if (status & IRQ_LDI) { 624 if (status & IRQ_LDI) {
627 u16 pmecr = ks8851_rdreg16(ks, KS_PMECR); 625 u16 pmecr = ks8851_rdreg16(ks, KS_PMECR);
@@ -684,6 +682,9 @@ static void ks8851_irq_work(struct work_struct *work)
684 682
685 mutex_unlock(&ks->lock); 683 mutex_unlock(&ks->lock);
686 684
685 if (status & IRQ_LCI)
686 mii_check_link(&ks->mii);
687
687 if (status & IRQ_TXI) 688 if (status & IRQ_TXI)
688 netif_wake_queue(ks->netdev); 689 netif_wake_queue(ks->netdev);
689 690
@@ -889,16 +890,17 @@ static int ks8851_net_stop(struct net_device *dev)
889 netif_stop_queue(dev); 890 netif_stop_queue(dev);
890 891
891 mutex_lock(&ks->lock); 892 mutex_lock(&ks->lock);
893 /* turn off the IRQs and ack any outstanding */
894 ks8851_wrreg16(ks, KS_IER, 0x0000);
895 ks8851_wrreg16(ks, KS_ISR, 0xffff);
896 mutex_unlock(&ks->lock);
892 897
893 /* stop any outstanding work */ 898 /* stop any outstanding work */
894 flush_work(&ks->irq_work); 899 flush_work(&ks->irq_work);
895 flush_work(&ks->tx_work); 900 flush_work(&ks->tx_work);
896 flush_work(&ks->rxctrl_work); 901 flush_work(&ks->rxctrl_work);
897 902
898 /* turn off the IRQs and ack any outstanding */ 903 mutex_lock(&ks->lock);
899 ks8851_wrreg16(ks, KS_IER, 0x0000);
900 ks8851_wrreg16(ks, KS_ISR, 0xffff);
901
902 /* shutdown RX process */ 904 /* shutdown RX process */
903 ks8851_wrreg16(ks, KS_RXCR1, 0x0000); 905 ks8851_wrreg16(ks, KS_RXCR1, 0x0000);
904 906
@@ -907,6 +909,7 @@ static int ks8851_net_stop(struct net_device *dev)
907 909
908 /* set powermode to soft power down to save power */ 910 /* set powermode to soft power down to save power */
909 ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); 911 ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN);
912 mutex_unlock(&ks->lock);
910 913
911 /* ensure any queued tx buffers are dumped */ 914 /* ensure any queued tx buffers are dumped */
912 while (!skb_queue_empty(&ks->txq)) { 915 while (!skb_queue_empty(&ks->txq)) {
@@ -918,7 +921,6 @@ static int ks8851_net_stop(struct net_device *dev)
918 dev_kfree_skb(txb); 921 dev_kfree_skb(txb);
919 } 922 }
920 923
921 mutex_unlock(&ks->lock);
922 return 0; 924 return 0;
923} 925}
924 926
@@ -1418,6 +1420,7 @@ static int __devinit ks8851_probe(struct spi_device *spi)
1418 struct net_device *ndev; 1420 struct net_device *ndev;
1419 struct ks8851_net *ks; 1421 struct ks8851_net *ks;
1420 int ret; 1422 int ret;
1423 unsigned cider;
1421 1424
1422 ndev = alloc_etherdev(sizeof(struct ks8851_net)); 1425 ndev = alloc_etherdev(sizeof(struct ks8851_net));
1423 if (!ndev) 1426 if (!ndev)
@@ -1484,8 +1487,8 @@ static int __devinit ks8851_probe(struct spi_device *spi)
1484 ks8851_soft_reset(ks, GRR_GSR); 1487 ks8851_soft_reset(ks, GRR_GSR);
1485 1488
1486 /* simple check for a valid chip being connected to the bus */ 1489 /* simple check for a valid chip being connected to the bus */
1487 1490 cider = ks8851_rdreg16(ks, KS_CIDER);
1488 if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { 1491 if ((cider & ~CIDER_REV_MASK) != CIDER_ID) {
1489 dev_err(&spi->dev, "failed to read device ID\n"); 1492 dev_err(&spi->dev, "failed to read device ID\n");
1490 ret = -ENODEV; 1493 ret = -ENODEV;
1491 goto err_id; 1494 goto err_id;
@@ -1516,15 +1519,14 @@ static int __devinit ks8851_probe(struct spi_device *spi)
1516 } 1519 }
1517 1520
1518 netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", 1521 netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n",
1519 CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), 1522 CIDER_REV_GET(cider), ndev->dev_addr, ndev->irq,
1520 ndev->dev_addr, ndev->irq,
1521 ks->rc_ccr & CCR_EEPROM ? "has" : "no"); 1523 ks->rc_ccr & CCR_EEPROM ? "has" : "no");
1522 1524
1523 return 0; 1525 return 0;
1524 1526
1525 1527
1526err_netdev: 1528err_netdev:
1527 free_irq(ndev->irq, ndev); 1529 free_irq(ndev->irq, ks);
1528 1530
1529err_id: 1531err_id:
1530err_irq: 1532err_irq:
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index b8104d9f4081..5ffde23ac8fb 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -40,7 +40,7 @@
40#define DRV_NAME "ks8851_mll" 40#define DRV_NAME "ks8851_mll"
41 41
42static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; 42static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 };
43#define MAX_RECV_FRAMES 32 43#define MAX_RECV_FRAMES 255
44#define MAX_BUF_SIZE 2048 44#define MAX_BUF_SIZE 2048
45#define TX_BUF_SIZE 2000 45#define TX_BUF_SIZE 2000
46#define RX_BUF_SIZE 2000 46#define RX_BUF_SIZE 2000
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index ef723b185d85..eaf9ff0262a9 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5675,7 +5675,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr)
5675 memcpy(hw->override_addr, mac->sa_data, ETH_ALEN); 5675 memcpy(hw->override_addr, mac->sa_data, ETH_ALEN);
5676 } 5676 }
5677 5677
5678 memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN); 5678 memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN);
5679 5679
5680 interrupt = hw_block_intr(hw); 5680 interrupt = hw_block_intr(hw);
5681 5681
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
index dd14915f54bb..ba781747d174 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
@@ -584,7 +584,6 @@ struct pch_gbe_hw_stats {
584/** 584/**
585 * struct pch_gbe_adapter - board specific private data structure 585 * struct pch_gbe_adapter - board specific private data structure
586 * @stats_lock: Spinlock structure for status 586 * @stats_lock: Spinlock structure for status
587 * @tx_queue_lock: Spinlock structure for transmit
588 * @ethtool_lock: Spinlock structure for ethtool 587 * @ethtool_lock: Spinlock structure for ethtool
589 * @irq_sem: Semaphore for interrupt 588 * @irq_sem: Semaphore for interrupt
590 * @netdev: Pointer of network device structure 589 * @netdev: Pointer of network device structure
@@ -609,7 +608,6 @@ struct pch_gbe_hw_stats {
609 608
610struct pch_gbe_adapter { 609struct pch_gbe_adapter {
611 spinlock_t stats_lock; 610 spinlock_t stats_lock;
612 spinlock_t tx_queue_lock;
613 spinlock_t ethtool_lock; 611 spinlock_t ethtool_lock;
614 atomic_t irq_sem; 612 atomic_t irq_sem;
615 struct net_device *netdev; 613 struct net_device *netdev;
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 8035e5ff6e06..1e38d502a062 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -640,14 +640,11 @@ static void pch_gbe_mac_set_pause_packet(struct pch_gbe_hw *hw)
640 */ 640 */
641static int pch_gbe_alloc_queues(struct pch_gbe_adapter *adapter) 641static int pch_gbe_alloc_queues(struct pch_gbe_adapter *adapter)
642{ 642{
643 int size; 643 adapter->tx_ring = kzalloc(sizeof(*adapter->tx_ring), GFP_KERNEL);
644
645 size = (int)sizeof(struct pch_gbe_tx_ring);
646 adapter->tx_ring = kzalloc(size, GFP_KERNEL);
647 if (!adapter->tx_ring) 644 if (!adapter->tx_ring)
648 return -ENOMEM; 645 return -ENOMEM;
649 size = (int)sizeof(struct pch_gbe_rx_ring); 646
650 adapter->rx_ring = kzalloc(size, GFP_KERNEL); 647 adapter->rx_ring = kzalloc(sizeof(*adapter->rx_ring), GFP_KERNEL);
651 if (!adapter->rx_ring) { 648 if (!adapter->rx_ring) {
652 kfree(adapter->tx_ring); 649 kfree(adapter->tx_ring);
653 return -ENOMEM; 650 return -ENOMEM;
@@ -1162,7 +1159,6 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
1162 struct sk_buff *tmp_skb; 1159 struct sk_buff *tmp_skb;
1163 unsigned int frame_ctrl; 1160 unsigned int frame_ctrl;
1164 unsigned int ring_num; 1161 unsigned int ring_num;
1165 unsigned long flags;
1166 1162
1167 /*-- Set frame control --*/ 1163 /*-- Set frame control --*/
1168 frame_ctrl = 0; 1164 frame_ctrl = 0;
@@ -1211,14 +1207,14 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
1211 } 1207 }
1212 } 1208 }
1213 } 1209 }
1214 spin_lock_irqsave(&tx_ring->tx_lock, flags); 1210
1215 ring_num = tx_ring->next_to_use; 1211 ring_num = tx_ring->next_to_use;
1216 if (unlikely((ring_num + 1) == tx_ring->count)) 1212 if (unlikely((ring_num + 1) == tx_ring->count))
1217 tx_ring->next_to_use = 0; 1213 tx_ring->next_to_use = 0;
1218 else 1214 else
1219 tx_ring->next_to_use = ring_num + 1; 1215 tx_ring->next_to_use = ring_num + 1;
1220 1216
1221 spin_unlock_irqrestore(&tx_ring->tx_lock, flags); 1217
1222 buffer_info = &tx_ring->buffer_info[ring_num]; 1218 buffer_info = &tx_ring->buffer_info[ring_num];
1223 tmp_skb = buffer_info->skb; 1219 tmp_skb = buffer_info->skb;
1224 1220
@@ -1518,7 +1514,7 @@ pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter,
1518 &rx_ring->rx_buff_pool_logic, 1514 &rx_ring->rx_buff_pool_logic,
1519 GFP_KERNEL); 1515 GFP_KERNEL);
1520 if (!rx_ring->rx_buff_pool) { 1516 if (!rx_ring->rx_buff_pool) {
1521 pr_err("Unable to allocate memory for the receive poll buffer\n"); 1517 pr_err("Unable to allocate memory for the receive pool buffer\n");
1522 return -ENOMEM; 1518 return -ENOMEM;
1523 } 1519 }
1524 memset(rx_ring->rx_buff_pool, 0, size); 1520 memset(rx_ring->rx_buff_pool, 0, size);
@@ -1637,15 +1633,17 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
1637 pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n", 1633 pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n",
1638 cleaned_count); 1634 cleaned_count);
1639 /* Recover from running out of Tx resources in xmit_frame */ 1635 /* Recover from running out of Tx resources in xmit_frame */
1636 spin_lock(&tx_ring->tx_lock);
1640 if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev)))) { 1637 if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev)))) {
1641 netif_wake_queue(adapter->netdev); 1638 netif_wake_queue(adapter->netdev);
1642 adapter->stats.tx_restart_count++; 1639 adapter->stats.tx_restart_count++;
1643 pr_debug("Tx wake queue\n"); 1640 pr_debug("Tx wake queue\n");
1644 } 1641 }
1645 spin_lock(&adapter->tx_queue_lock); 1642
1646 tx_ring->next_to_clean = i; 1643 tx_ring->next_to_clean = i;
1647 spin_unlock(&adapter->tx_queue_lock); 1644
1648 pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean); 1645 pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean);
1646 spin_unlock(&tx_ring->tx_lock);
1649 return cleaned; 1647 return cleaned;
1650} 1648}
1651 1649
@@ -2037,7 +2035,6 @@ static int pch_gbe_sw_init(struct pch_gbe_adapter *adapter)
2037 return -ENOMEM; 2035 return -ENOMEM;
2038 } 2036 }
2039 spin_lock_init(&adapter->hw.miim_lock); 2037 spin_lock_init(&adapter->hw.miim_lock);
2040 spin_lock_init(&adapter->tx_queue_lock);
2041 spin_lock_init(&adapter->stats_lock); 2038 spin_lock_init(&adapter->stats_lock);
2042 spin_lock_init(&adapter->ethtool_lock); 2039 spin_lock_init(&adapter->ethtool_lock);
2043 atomic_set(&adapter->irq_sem, 0); 2040 atomic_set(&adapter->irq_sem, 0);
@@ -2142,10 +2139,10 @@ static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2142 tx_ring->next_to_use, tx_ring->next_to_clean); 2139 tx_ring->next_to_use, tx_ring->next_to_clean);
2143 return NETDEV_TX_BUSY; 2140 return NETDEV_TX_BUSY;
2144 } 2141 }
2145 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
2146 2142
2147 /* CRC,ITAG no support */ 2143 /* CRC,ITAG no support */
2148 pch_gbe_tx_queue(adapter, tx_ring, skb); 2144 pch_gbe_tx_queue(adapter, tx_ring, skb);
2145 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
2149 return NETDEV_TX_OK; 2146 return NETDEV_TX_OK;
2150} 2147}
2151 2148
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index abc79076f867..b3287c0fe279 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -958,6 +958,11 @@ static inline void cp_start_hw (struct cp_private *cp)
958 cpw8(Cmd, RxOn | TxOn); 958 cpw8(Cmd, RxOn | TxOn);
959} 959}
960 960
961static void cp_enable_irq(struct cp_private *cp)
962{
963 cpw16_f(IntrMask, cp_intr_mask);
964}
965
961static void cp_init_hw (struct cp_private *cp) 966static void cp_init_hw (struct cp_private *cp)
962{ 967{
963 struct net_device *dev = cp->dev; 968 struct net_device *dev = cp->dev;
@@ -997,8 +1002,6 @@ static void cp_init_hw (struct cp_private *cp)
997 1002
998 cpw16(MultiIntr, 0); 1003 cpw16(MultiIntr, 0);
999 1004
1000 cpw16_f(IntrMask, cp_intr_mask);
1001
1002 cpw8_f(Cfg9346, Cfg9346_Lock); 1005 cpw8_f(Cfg9346, Cfg9346_Lock);
1003} 1006}
1004 1007
@@ -1130,6 +1133,8 @@ static int cp_open (struct net_device *dev)
1130 if (rc) 1133 if (rc)
1131 goto err_out_hw; 1134 goto err_out_hw;
1132 1135
1136 cp_enable_irq(cp);
1137
1133 netif_carrier_off(dev); 1138 netif_carrier_off(dev);
1134 mii_check_media(&cp->mii_if, netif_msg_link(cp), true); 1139 mii_check_media(&cp->mii_if, netif_msg_link(cp), true);
1135 netif_start_queue(dev); 1140 netif_start_queue(dev);
@@ -2031,6 +2036,7 @@ static int cp_resume (struct pci_dev *pdev)
2031 /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ 2036 /* FIXME: sh*t may happen if the Rx ring buffer is depleted */
2032 cp_init_rings_index (cp); 2037 cp_init_rings_index (cp);
2033 cp_init_hw (cp); 2038 cp_init_hw (cp);
2039 cp_enable_irq(cp);
2034 netif_start_queue (dev); 2040 netif_start_queue (dev);
2035 2041
2036 spin_lock_irqsave (&cp->lock, flags); 2042 spin_lock_irqsave (&cp->lock, flags);
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index f54509377efa..ce6b44d1f252 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -61,8 +61,12 @@
61#define R8169_MSG_DEFAULT \ 61#define R8169_MSG_DEFAULT \
62 (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) 62 (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN)
63 63
64#define TX_BUFFS_AVAIL(tp) \ 64#define TX_SLOTS_AVAIL(tp) \
65 (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) 65 (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx)
66
67/* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */
68#define TX_FRAGS_READY_FOR(tp,nr_frags) \
69 (TX_SLOTS_AVAIL(tp) >= (nr_frags + 1))
66 70
67/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). 71/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
68 The RTL chips use a 64 element hash table based on the Ethernet CRC. */ 72 The RTL chips use a 64 element hash table based on the Ethernet CRC. */
@@ -5115,7 +5119,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5115 u32 opts[2]; 5119 u32 opts[2];
5116 int frags; 5120 int frags;
5117 5121
5118 if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) { 5122 if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) {
5119 netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); 5123 netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n");
5120 goto err_stop_0; 5124 goto err_stop_0;
5121 } 5125 }
@@ -5169,7 +5173,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5169 5173
5170 mmiowb(); 5174 mmiowb();
5171 5175
5172 if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) { 5176 if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
5173 /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must 5177 /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must
5174 * not miss a ring update when it notices a stopped queue. 5178 * not miss a ring update when it notices a stopped queue.
5175 */ 5179 */
@@ -5183,7 +5187,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5183 * can't. 5187 * can't.
5184 */ 5188 */
5185 smp_mb(); 5189 smp_mb();
5186 if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS) 5190 if (TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS))
5187 netif_wake_queue(dev); 5191 netif_wake_queue(dev);
5188 } 5192 }
5189 5193
@@ -5306,7 +5310,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
5306 */ 5310 */
5307 smp_mb(); 5311 smp_mb();
5308 if (netif_queue_stopped(dev) && 5312 if (netif_queue_stopped(dev) &&
5309 (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) { 5313 TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
5310 netif_wake_queue(dev); 5314 netif_wake_queue(dev);
5311 } 5315 }
5312 /* 5316 /*
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 3cbfbffe3f00..4a0005342e65 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1349,7 +1349,7 @@ static int efx_probe_interrupts(struct efx_nic *efx)
1349 } 1349 }
1350 1350
1351 /* RSS might be usable on VFs even if it is disabled on the PF */ 1351 /* RSS might be usable on VFs even if it is disabled on the PF */
1352 efx->rss_spread = (efx->n_rx_channels > 1 ? 1352 efx->rss_spread = ((efx->n_rx_channels > 1 || !efx_sriov_wanted(efx)) ?
1353 efx->n_rx_channels : efx_vf_size(efx)); 1353 efx->n_rx_channels : efx_vf_size(efx));
1354 1354
1355 return 0; 1355 return 0;
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 4a6971027076..cd3defb11ffb 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1166,10 +1166,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat)
1166 1166
1167/* Quickly dumps bad packets */ 1167/* Quickly dumps bad packets */
1168static void 1168static void
1169smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes) 1169smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords)
1170{ 1170{
1171 unsigned int pktwords = (pktbytes + NET_IP_ALIGN + 3) >> 2;
1172
1173 if (likely(pktwords >= 4)) { 1171 if (likely(pktwords >= 4)) {
1174 unsigned int timeout = 500; 1172 unsigned int timeout = 500;
1175 unsigned int val; 1173 unsigned int val;
@@ -1233,7 +1231,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
1233 continue; 1231 continue;
1234 } 1232 }
1235 1233
1236 skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN); 1234 skb = netdev_alloc_skb(dev, pktwords << 2);
1237 if (unlikely(!skb)) { 1235 if (unlikely(!skb)) {
1238 SMSC_WARN(pdata, rx_err, 1236 SMSC_WARN(pdata, rx_err,
1239 "Unable to allocate skb for rx packet"); 1237 "Unable to allocate skb for rx packet");
@@ -1243,14 +1241,12 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
1243 break; 1241 break;
1244 } 1242 }
1245 1243
1246 skb->data = skb->head; 1244 pdata->ops->rx_readfifo(pdata,
1247 skb_reset_tail_pointer(skb); 1245 (unsigned int *)skb->data, pktwords);
1248 1246
1249 /* Align IP on 16B boundary */ 1247 /* Align IP on 16B boundary */
1250 skb_reserve(skb, NET_IP_ALIGN); 1248 skb_reserve(skb, NET_IP_ALIGN);
1251 skb_put(skb, pktlength - 4); 1249 skb_put(skb, pktlength - 4);
1252 pdata->ops->rx_readfifo(pdata,
1253 (unsigned int *)skb->head, pktwords);
1254 skb->protocol = eth_type_trans(skb, dev); 1250 skb->protocol = eth_type_trans(skb, dev);
1255 skb_checksum_none_assert(skb); 1251 skb_checksum_none_assert(skb);
1256 netif_receive_skb(skb); 1252 netif_receive_skb(skb);
@@ -1565,7 +1561,7 @@ static int smsc911x_open(struct net_device *dev)
1565 smsc911x_reg_write(pdata, FIFO_INT, temp); 1561 smsc911x_reg_write(pdata, FIFO_INT, temp);
1566 1562
1567 /* set RX Data offset to 2 bytes for alignment */ 1563 /* set RX Data offset to 2 bytes for alignment */
1568 smsc911x_reg_write(pdata, RX_CFG, (2 << 8)); 1564 smsc911x_reg_write(pdata, RX_CFG, (NET_IP_ALIGN << 8));
1569 1565
1570 /* enable NAPI polling before enabling RX interrupts */ 1566 /* enable NAPI polling before enabling RX interrupts */
1571 napi_enable(&pdata->napi); 1567 napi_enable(&pdata->napi);
@@ -2382,7 +2378,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2382 SET_NETDEV_DEV(dev, &pdev->dev); 2378 SET_NETDEV_DEV(dev, &pdev->dev);
2383 2379
2384 pdata = netdev_priv(dev); 2380 pdata = netdev_priv(dev);
2385
2386 dev->irq = irq_res->start; 2381 dev->irq = irq_res->start;
2387 irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; 2382 irq_flags = irq_res->flags & IRQF_TRIGGER_MASK;
2388 pdata->ioaddr = ioremap_nocache(res->start, res_size); 2383 pdata->ioaddr = ioremap_nocache(res->start, res_size);
@@ -2446,7 +2441,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2446 if (retval) { 2441 if (retval) {
2447 SMSC_WARN(pdata, probe, 2442 SMSC_WARN(pdata, probe,
2448 "Unable to claim requested irq: %d", dev->irq); 2443 "Unable to claim requested irq: %d", dev->irq);
2449 goto out_free_irq; 2444 goto out_disable_resources;
2450 } 2445 }
2451 2446
2452 retval = register_netdev(dev); 2447 retval = register_netdev(dev);
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
index 558409ff4058..4ba969096717 100644
--- a/drivers/net/ethernet/sun/sungem.c
+++ b/drivers/net/ethernet/sun/sungem.c
@@ -2339,7 +2339,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2339 netif_device_detach(dev); 2339 netif_device_detach(dev);
2340 2340
2341 /* Switch off chip, remember WOL setting */ 2341 /* Switch off chip, remember WOL setting */
2342 gp->asleep_wol = gp->wake_on_lan; 2342 gp->asleep_wol = !!gp->wake_on_lan;
2343 gem_do_stop(dev, gp->asleep_wol); 2343 gem_do_stop(dev, gp->asleep_wol);
2344 2344
2345 /* Unlock the network stack */ 2345 /* Unlock the network stack */
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 174a3348f676..08aff1a2087c 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1511,7 +1511,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
1511 1511
1512static int match_first_device(struct device *dev, void *data) 1512static int match_first_device(struct device *dev, void *data)
1513{ 1513{
1514 return 1; 1514 return !strncmp(dev_name(dev), "davinci_mdio", 12);
1515} 1515}
1516 1516
1517/** 1517/**
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index 2757c7d6e633..e4e47088e26b 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data)
181 __davinci_mdio_reset(data); 181 __davinci_mdio_reset(data);
182 return -EAGAIN; 182 return -EAGAIN;
183 } 183 }
184
185 reg = __raw_readl(&regs->user[0].access);
186 if ((reg & USERACCESS_GO) == 0)
187 return 0;
188
184 dev_err(data->dev, "timed out waiting for user access\n"); 189 dev_err(data->dev, "timed out waiting for user access\n");
185 return -ETIMEDOUT; 190 return -ETIMEDOUT;
186} 191}
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index 817ad3bc4957..efd36691ce54 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -228,7 +228,7 @@ tlan_get_skb(const struct tlan_list *tag)
228 unsigned long addr; 228 unsigned long addr;
229 229
230 addr = tag->buffer[9].address; 230 addr = tag->buffer[9].address;
231 addr |= (tag->buffer[8].address << 16) << 16; 231 addr |= ((unsigned long) tag->buffer[8].address << 16) << 16;
232 return (struct sk_buff *) addr; 232 return (struct sk_buff *) addr;
233} 233}
234 234
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h
index cc83af083fd7..44b8d2bad8c3 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
@@ -2,9 +2,7 @@
2 * Definitions for Xilinx Axi Ethernet device driver. 2 * Definitions for Xilinx Axi Ethernet device driver.
3 * 3 *
4 * Copyright (c) 2009 Secret Lab Technologies, Ltd. 4 * Copyright (c) 2009 Secret Lab Technologies, Ltd.
5 * Copyright (c) 2010 Xilinx, Inc. All rights reserved. 5 * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved.
6 * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch>
7 * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch>
8 */ 6 */
9 7
10#ifndef XILINX_AXIENET_H 8#ifndef XILINX_AXIENET_H
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 2fcbeba6814b..9c365e192a31 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -4,9 +4,9 @@
4 * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi 4 * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi
5 * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> 5 * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net>
6 * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. 6 * Copyright (c) 2008-2009 Secret Lab Technologies Ltd.
7 * Copyright (c) 2010 Xilinx, Inc. All rights reserved. 7 * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu>
8 * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> 8 * Copyright (c) 2010 - 2011 PetaLogix
9 * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> 9 * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved.
10 * 10 *
11 * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 11 * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6
12 * and Spartan6. 12 * and Spartan6.
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
index d70b6e79f6c0..e90e1f46121e 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
@@ -2,9 +2,9 @@
2 * MDIO bus driver for the Xilinx Axi Ethernet device 2 * MDIO bus driver for the Xilinx Axi Ethernet device
3 * 3 *
4 * Copyright (c) 2009 Secret Lab Technologies, Ltd. 4 * Copyright (c) 2009 Secret Lab Technologies, Ltd.
5 * Copyright (c) 2010 Xilinx, Inc. All rights reserved. 5 * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu>
6 * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> 6 * Copyright (c) 2010 - 2011 PetaLogix
7 * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> 7 * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved.
8 */ 8 */
9 9
10#include <linux/of_address.h> 10#include <linux/of_address.h>
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index dd294783b5c5..2d59138db7f3 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -44,6 +44,7 @@ struct net_device_context {
44 /* point back to our device context */ 44 /* point back to our device context */
45 struct hv_device *device_ctx; 45 struct hv_device *device_ctx;
46 struct delayed_work dwork; 46 struct delayed_work dwork;
47 struct work_struct work;
47}; 48};
48 49
49 50
@@ -51,30 +52,22 @@ static int ring_size = 128;
51module_param(ring_size, int, S_IRUGO); 52module_param(ring_size, int, S_IRUGO);
52MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); 53MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
53 54
54struct set_multicast_work {
55 struct work_struct work;
56 struct net_device *net;
57};
58
59static void do_set_multicast(struct work_struct *w) 55static void do_set_multicast(struct work_struct *w)
60{ 56{
61 struct set_multicast_work *swk = 57 struct net_device_context *ndevctx =
62 container_of(w, struct set_multicast_work, work); 58 container_of(w, struct net_device_context, work);
63 struct net_device *net = swk->net;
64
65 struct net_device_context *ndevctx = netdev_priv(net);
66 struct netvsc_device *nvdev; 59 struct netvsc_device *nvdev;
67 struct rndis_device *rdev; 60 struct rndis_device *rdev;
68 61
69 nvdev = hv_get_drvdata(ndevctx->device_ctx); 62 nvdev = hv_get_drvdata(ndevctx->device_ctx);
70 if (nvdev == NULL) 63 if (nvdev == NULL || nvdev->ndev == NULL)
71 goto out; 64 return;
72 65
73 rdev = nvdev->extension; 66 rdev = nvdev->extension;
74 if (rdev == NULL) 67 if (rdev == NULL)
75 goto out; 68 return;
76 69
77 if (net->flags & IFF_PROMISC) 70 if (nvdev->ndev->flags & IFF_PROMISC)
78 rndis_filter_set_packet_filter(rdev, 71 rndis_filter_set_packet_filter(rdev,
79 NDIS_PACKET_TYPE_PROMISCUOUS); 72 NDIS_PACKET_TYPE_PROMISCUOUS);
80 else 73 else
@@ -82,21 +75,13 @@ static void do_set_multicast(struct work_struct *w)
82 NDIS_PACKET_TYPE_BROADCAST | 75 NDIS_PACKET_TYPE_BROADCAST |
83 NDIS_PACKET_TYPE_ALL_MULTICAST | 76 NDIS_PACKET_TYPE_ALL_MULTICAST |
84 NDIS_PACKET_TYPE_DIRECTED); 77 NDIS_PACKET_TYPE_DIRECTED);
85
86out:
87 kfree(w);
88} 78}
89 79
90static void netvsc_set_multicast_list(struct net_device *net) 80static void netvsc_set_multicast_list(struct net_device *net)
91{ 81{
92 struct set_multicast_work *swk = 82 struct net_device_context *net_device_ctx = netdev_priv(net);
93 kmalloc(sizeof(struct set_multicast_work), GFP_ATOMIC);
94 if (swk == NULL)
95 return;
96 83
97 swk->net = net; 84 schedule_work(&net_device_ctx->work);
98 INIT_WORK(&swk->work, do_set_multicast);
99 schedule_work(&swk->work);
100} 85}
101 86
102static int netvsc_open(struct net_device *net) 87static int netvsc_open(struct net_device *net)
@@ -125,6 +110,8 @@ static int netvsc_close(struct net_device *net)
125 110
126 netif_tx_disable(net); 111 netif_tx_disable(net);
127 112
113 /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */
114 cancel_work_sync(&net_device_ctx->work);
128 ret = rndis_filter_close(device_obj); 115 ret = rndis_filter_close(device_obj);
129 if (ret != 0) 116 if (ret != 0)
130 netdev_err(net, "unable to close device (ret %d).\n", ret); 117 netdev_err(net, "unable to close device (ret %d).\n", ret);
@@ -335,6 +322,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
335 322
336 nvdev->start_remove = true; 323 nvdev->start_remove = true;
337 cancel_delayed_work_sync(&ndevctx->dwork); 324 cancel_delayed_work_sync(&ndevctx->dwork);
325 cancel_work_sync(&ndevctx->work);
338 netif_tx_disable(ndev); 326 netif_tx_disable(ndev);
339 rndis_filter_device_remove(hdev); 327 rndis_filter_device_remove(hdev);
340 328
@@ -403,6 +391,7 @@ static int netvsc_probe(struct hv_device *dev,
403 net_device_ctx->device_ctx = dev; 391 net_device_ctx->device_ctx = dev;
404 hv_set_drvdata(dev, net); 392 hv_set_drvdata(dev, net);
405 INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); 393 INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp);
394 INIT_WORK(&net_device_ctx->work, do_set_multicast);
406 395
407 net->netdev_ops = &device_ops; 396 net->netdev_ops = &device_ops;
408 397
@@ -456,6 +445,7 @@ static int netvsc_remove(struct hv_device *dev)
456 445
457 ndev_ctx = netdev_priv(net); 446 ndev_ctx = netdev_priv(net);
458 cancel_delayed_work_sync(&ndev_ctx->dwork); 447 cancel_delayed_work_sync(&ndev_ctx->dwork);
448 cancel_work_sync(&ndev_ctx->work);
459 449
460 /* Stop outbound asap */ 450 /* Stop outbound asap */
461 netif_tx_disable(net); 451 netif_tx_disable(net);
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index f975afdc315c..025367a94add 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -259,7 +259,7 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
259 259
260xmit_world: 260xmit_world:
261 skb->ip_summed = ip_summed; 261 skb->ip_summed = ip_summed;
262 skb_set_dev(skb, vlan->lowerdev); 262 skb->dev = vlan->lowerdev;
263 return dev_queue_xmit(skb); 263 return dev_queue_xmit(skb);
264} 264}
265 265
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 0427c6561c84..cb8fd5069dbe 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -1,5 +1,6 @@
1#include <linux/etherdevice.h> 1#include <linux/etherdevice.h>
2#include <linux/if_macvlan.h> 2#include <linux/if_macvlan.h>
3#include <linux/if_vlan.h>
3#include <linux/interrupt.h> 4#include <linux/interrupt.h>
4#include <linux/nsproxy.h> 5#include <linux/nsproxy.h>
5#include <linux/compat.h> 6#include <linux/compat.h>
@@ -759,6 +760,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
759 struct macvlan_dev *vlan; 760 struct macvlan_dev *vlan;
760 int ret; 761 int ret;
761 int vnet_hdr_len = 0; 762 int vnet_hdr_len = 0;
763 int vlan_offset = 0;
764 int copied;
762 765
763 if (q->flags & IFF_VNET_HDR) { 766 if (q->flags & IFF_VNET_HDR) {
764 struct virtio_net_hdr vnet_hdr; 767 struct virtio_net_hdr vnet_hdr;
@@ -773,18 +776,48 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
773 if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr))) 776 if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr)))
774 return -EFAULT; 777 return -EFAULT;
775 } 778 }
779 copied = vnet_hdr_len;
780
781 if (!vlan_tx_tag_present(skb))
782 len = min_t(int, skb->len, len);
783 else {
784 int copy;
785 struct {
786 __be16 h_vlan_proto;
787 __be16 h_vlan_TCI;
788 } veth;
789 veth.h_vlan_proto = htons(ETH_P_8021Q);
790 veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb));
791
792 vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto);
793 len = min_t(int, skb->len + VLAN_HLEN, len);
794
795 copy = min_t(int, vlan_offset, len);
796 ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy);
797 len -= copy;
798 copied += copy;
799 if (ret || !len)
800 goto done;
801
802 copy = min_t(int, sizeof(veth), len);
803 ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy);
804 len -= copy;
805 copied += copy;
806 if (ret || !len)
807 goto done;
808 }
776 809
777 len = min_t(int, skb->len, len); 810 ret = skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len);
778 811 copied += len;
779 ret = skb_copy_datagram_const_iovec(skb, 0, iv, vnet_hdr_len, len);
780 812
813done:
781 rcu_read_lock_bh(); 814 rcu_read_lock_bh();
782 vlan = rcu_dereference_bh(q->vlan); 815 vlan = rcu_dereference_bh(q->vlan);
783 if (vlan) 816 if (vlan)
784 macvlan_count_rx(vlan, len, ret == 0, 0); 817 macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0);
785 rcu_read_unlock_bh(); 818 rcu_read_unlock_bh();
786 819
787 return ret ? ret : (len + vnet_hdr_len); 820 return ret ? ret : copied;
788} 821}
789 822
790static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, 823static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index f08c85acf761..5ac46f5226f3 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -40,6 +40,7 @@ MODULE_LICENSE("GPL");
40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ 40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */
41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ 41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
42#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ 42#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
43#define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */
43 44
44static int ip175c_config_init(struct phy_device *phydev) 45static int ip175c_config_init(struct phy_device *phydev)
45{ 46{
@@ -185,6 +186,15 @@ static int ip175c_config_aneg(struct phy_device *phydev)
185 return 0; 186 return 0;
186} 187}
187 188
189static int ip101a_g_ack_interrupt(struct phy_device *phydev)
190{
191 int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
192 if (err < 0)
193 return err;
194
195 return 0;
196}
197
188static struct phy_driver ip175c_driver = { 198static struct phy_driver ip175c_driver = {
189 .phy_id = 0x02430d80, 199 .phy_id = 0x02430d80,
190 .name = "ICPlus IP175C", 200 .name = "ICPlus IP175C",
@@ -204,7 +214,6 @@ static struct phy_driver ip1001_driver = {
204 .phy_id_mask = 0x0ffffff0, 214 .phy_id_mask = 0x0ffffff0,
205 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | 215 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause |
206 SUPPORTED_Asym_Pause, 216 SUPPORTED_Asym_Pause,
207 .flags = PHY_HAS_INTERRUPT,
208 .config_init = &ip1001_config_init, 217 .config_init = &ip1001_config_init,
209 .config_aneg = &genphy_config_aneg, 218 .config_aneg = &genphy_config_aneg,
210 .read_status = &genphy_read_status, 219 .read_status = &genphy_read_status,
@@ -220,6 +229,7 @@ static struct phy_driver ip101a_g_driver = {
220 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | 229 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause |
221 SUPPORTED_Asym_Pause, 230 SUPPORTED_Asym_Pause,
222 .flags = PHY_HAS_INTERRUPT, 231 .flags = PHY_HAS_INTERRUPT,
232 .ack_interrupt = ip101a_g_ack_interrupt,
223 .config_init = &ip101a_g_config_init, 233 .config_init = &ip101a_g_config_init,
224 .config_aneg = &genphy_config_aneg, 234 .config_aneg = &genphy_config_aneg,
225 .read_status = &genphy_read_status, 235 .read_status = &genphy_read_status,
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 33f8c51968b6..21d7151fb0ab 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -235,7 +235,7 @@ struct ppp_net {
235/* Prototypes. */ 235/* Prototypes. */
236static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, 236static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
237 struct file *file, unsigned int cmd, unsigned long arg); 237 struct file *file, unsigned int cmd, unsigned long arg);
238static int ppp_xmit_process(struct ppp *ppp); 238static void ppp_xmit_process(struct ppp *ppp);
239static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); 239static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb);
240static void ppp_push(struct ppp *ppp); 240static void ppp_push(struct ppp *ppp);
241static void ppp_channel_push(struct channel *pch); 241static void ppp_channel_push(struct channel *pch);
@@ -969,8 +969,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
969 put_unaligned_be16(proto, pp); 969 put_unaligned_be16(proto, pp);
970 970
971 skb_queue_tail(&ppp->file.xq, skb); 971 skb_queue_tail(&ppp->file.xq, skb);
972 if (!ppp_xmit_process(ppp)) 972 ppp_xmit_process(ppp);
973 netif_stop_queue(dev);
974 return NETDEV_TX_OK; 973 return NETDEV_TX_OK;
975 974
976 outf: 975 outf:
@@ -1048,11 +1047,10 @@ static void ppp_setup(struct net_device *dev)
1048 * Called to do any work queued up on the transmit side 1047 * Called to do any work queued up on the transmit side
1049 * that can now be done. 1048 * that can now be done.
1050 */ 1049 */
1051static int 1050static void
1052ppp_xmit_process(struct ppp *ppp) 1051ppp_xmit_process(struct ppp *ppp)
1053{ 1052{
1054 struct sk_buff *skb; 1053 struct sk_buff *skb;
1055 int ret = 0;
1056 1054
1057 ppp_xmit_lock(ppp); 1055 ppp_xmit_lock(ppp);
1058 if (!ppp->closing) { 1056 if (!ppp->closing) {
@@ -1062,13 +1060,12 @@ ppp_xmit_process(struct ppp *ppp)
1062 ppp_send_frame(ppp, skb); 1060 ppp_send_frame(ppp, skb);
1063 /* If there's no work left to do, tell the core net 1061 /* If there's no work left to do, tell the core net
1064 code that we can accept some more. */ 1062 code that we can accept some more. */
1065 if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) { 1063 if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq))
1066 netif_wake_queue(ppp->dev); 1064 netif_wake_queue(ppp->dev);
1067 ret = 1; 1065 else
1068 } 1066 netif_stop_queue(ppp->dev);
1069 } 1067 }
1070 ppp_xmit_unlock(ppp); 1068 ppp_xmit_unlock(ppp);
1071 return ret;
1072} 1069}
1073 1070
1074static inline struct sk_buff * 1071static inline struct sk_buff *
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 5ee032cafade..42b5151aa78a 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -355,7 +355,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
355 u32 packet_len; 355 u32 packet_len;
356 u32 padbytes = 0xffff0000; 356 u32 padbytes = 0xffff0000;
357 357
358 padlen = ((skb->len + 4) % 512) ? 0 : 4; 358 padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4;
359 359
360 if ((!skb_cloned(skb)) && 360 if ((!skb_cloned(skb)) &&
361 ((headroom + tailroom) >= (4 + padlen))) { 361 ((headroom + tailroom) >= (4 + padlen))) {
@@ -377,7 +377,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
377 cpu_to_le32s(&packet_len); 377 cpu_to_le32s(&packet_len);
378 skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); 378 skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len));
379 379
380 if ((skb->len % 512) == 0) { 380 if (padlen) {
381 cpu_to_le32s(&padbytes); 381 cpu_to_le32s(&padbytes);
382 memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); 382 memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
383 skb_put(skb, sizeof(padbytes)); 383 skb_put(skb, sizeof(padbytes));
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 90a30026a931..425e201f597c 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -83,6 +83,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
83 struct cdc_state *info = (void *) &dev->data; 83 struct cdc_state *info = (void *) &dev->data;
84 int status; 84 int status;
85 int rndis; 85 int rndis;
86 bool android_rndis_quirk = false;
86 struct usb_driver *driver = driver_of(intf); 87 struct usb_driver *driver = driver_of(intf);
87 struct usb_cdc_mdlm_desc *desc = NULL; 88 struct usb_cdc_mdlm_desc *desc = NULL;
88 struct usb_cdc_mdlm_detail_desc *detail = NULL; 89 struct usb_cdc_mdlm_detail_desc *detail = NULL;
@@ -195,6 +196,11 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
195 info->control, 196 info->control,
196 info->u->bSlaveInterface0, 197 info->u->bSlaveInterface0,
197 info->data); 198 info->data);
199 /* fall back to hard-wiring for RNDIS */
200 if (rndis) {
201 android_rndis_quirk = true;
202 goto next_desc;
203 }
198 goto bad_desc; 204 goto bad_desc;
199 } 205 }
200 if (info->control != intf) { 206 if (info->control != intf) {
@@ -271,11 +277,15 @@ next_desc:
271 /* Microsoft ActiveSync based and some regular RNDIS devices lack the 277 /* Microsoft ActiveSync based and some regular RNDIS devices lack the
272 * CDC descriptors, so we'll hard-wire the interfaces and not check 278 * CDC descriptors, so we'll hard-wire the interfaces and not check
273 * for descriptors. 279 * for descriptors.
280 *
281 * Some Android RNDIS devices have a CDC Union descriptor pointing
282 * to non-existing interfaces. Ignore that and attempt the same
283 * hard-wired 0 and 1 interfaces.
274 */ 284 */
275 if (rndis && !info->u) { 285 if (rndis && (!info->u || android_rndis_quirk)) {
276 info->control = usb_ifnum_to_if(dev->udev, 0); 286 info->control = usb_ifnum_to_if(dev->udev, 0);
277 info->data = usb_ifnum_to_if(dev->udev, 1); 287 info->data = usb_ifnum_to_if(dev->udev, 1);
278 if (!info->control || !info->data) { 288 if (!info->control || !info->data || info->control != intf) {
279 dev_dbg(&intf->dev, 289 dev_dbg(&intf->dev,
280 "rndis: master #0/%p slave #1/%p\n", 290 "rndis: master #0/%p slave #1/%p\n",
281 info->control, 291 info->control,
@@ -475,6 +485,7 @@ static const struct driver_info wwan_info = {
475/*-------------------------------------------------------------------------*/ 485/*-------------------------------------------------------------------------*/
476 486
477#define HUAWEI_VENDOR_ID 0x12D1 487#define HUAWEI_VENDOR_ID 0x12D1
488#define NOVATEL_VENDOR_ID 0x1410
478 489
479static const struct usb_device_id products [] = { 490static const struct usb_device_id products [] = {
480/* 491/*
@@ -592,6 +603,21 @@ static const struct usb_device_id products [] = {
592 * because of bugs/quirks in a given product (like Zaurus, above). 603 * because of bugs/quirks in a given product (like Zaurus, above).
593 */ 604 */
594{ 605{
606 /* Novatel USB551L */
607 /* This match must come *before* the generic CDC-ETHER match so that
608 * we get FLAG_WWAN set on the device, since it's descriptors are
609 * generic CDC-ETHER.
610 */
611 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
612 | USB_DEVICE_ID_MATCH_PRODUCT
613 | USB_DEVICE_ID_MATCH_INT_INFO,
614 .idVendor = NOVATEL_VENDOR_ID,
615 .idProduct = 0xB001,
616 .bInterfaceClass = USB_CLASS_COMM,
617 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
618 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
619 .driver_info = (unsigned long)&wwan_info,
620}, {
595 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, 621 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
596 USB_CDC_PROTO_NONE), 622 USB_CDC_PROTO_NONE),
597 .driver_info = (unsigned long) &cdc_info, 623 .driver_info = (unsigned long) &cdc_info,
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 552d24bf862e..d316503b35d4 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -365,6 +365,27 @@ static const struct driver_info qmi_wwan_force_int4 = {
365 .data = BIT(4), /* interface whitelist bitmap */ 365 .data = BIT(4), /* interface whitelist bitmap */
366}; 366};
367 367
368/* Sierra Wireless provide equally useless interface descriptors
369 * Devices in QMI mode can be switched between two different
370 * configurations:
371 * a) USB interface #8 is QMI/wwan
372 * b) USB interfaces #8, #19 and #20 are QMI/wwan
373 *
374 * Both configurations provide a number of other interfaces (serial++),
375 * some of which have the same endpoint configuration as we expect, so
376 * a whitelist or blacklist is necessary.
377 *
378 * FIXME: The below whitelist should include BIT(20). It does not
379 * because I cannot get it to work...
380 */
381static const struct driver_info qmi_wwan_sierra = {
382 .description = "Sierra Wireless wwan/QMI device",
383 .flags = FLAG_WWAN,
384 .bind = qmi_wwan_bind_gobi,
385 .unbind = qmi_wwan_unbind_shared,
386 .manage_power = qmi_wwan_manage_power,
387 .data = BIT(8) | BIT(19), /* interface whitelist bitmap */
388};
368 389
369#define HUAWEI_VENDOR_ID 0x12D1 390#define HUAWEI_VENDOR_ID 0x12D1
370#define QMI_GOBI_DEVICE(vend, prod) \ 391#define QMI_GOBI_DEVICE(vend, prod) \
@@ -445,6 +466,15 @@ static const struct usb_device_id products[] = {
445 .bInterfaceProtocol = 0xff, 466 .bInterfaceProtocol = 0xff,
446 .driver_info = (unsigned long)&qmi_wwan_force_int4, 467 .driver_info = (unsigned long)&qmi_wwan_force_int4,
447 }, 468 },
469 { /* Sierra Wireless MC77xx in QMI mode */
470 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
471 .idVendor = 0x1199,
472 .idProduct = 0x68a2,
473 .bInterfaceClass = 0xff,
474 .bInterfaceSubClass = 0xff,
475 .bInterfaceProtocol = 0xff,
476 .driver_info = (unsigned long)&qmi_wwan_sierra,
477 },
448 {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 478 {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
449 {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 479 {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
450 {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ 480 {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 187d01ccb973..00103a8c5e04 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -98,7 +98,7 @@ static int __must_check smsc75xx_read_reg(struct usbnet *dev, u32 index,
98 98
99 if (unlikely(ret < 0)) 99 if (unlikely(ret < 0))
100 netdev_warn(dev->net, 100 netdev_warn(dev->net,
101 "Failed to read register index 0x%08x", index); 101 "Failed to read reg index 0x%08x: %d", index, ret);
102 102
103 le32_to_cpus(buf); 103 le32_to_cpus(buf);
104 *data = *buf; 104 *data = *buf;
@@ -128,7 +128,7 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index,
128 128
129 if (unlikely(ret < 0)) 129 if (unlikely(ret < 0))
130 netdev_warn(dev->net, 130 netdev_warn(dev->net,
131 "Failed to write register index 0x%08x", index); 131 "Failed to write reg index 0x%08x: %d", index, ret);
132 132
133 kfree(buf); 133 kfree(buf);
134 134
@@ -171,7 +171,7 @@ static int smsc75xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
171 idx &= dev->mii.reg_num_mask; 171 idx &= dev->mii.reg_num_mask;
172 addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) 172 addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR)
173 | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) 173 | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR)
174 | MII_ACCESS_READ; 174 | MII_ACCESS_READ | MII_ACCESS_BUSY;
175 ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); 175 ret = smsc75xx_write_reg(dev, MII_ACCESS, addr);
176 check_warn_goto_done(ret, "Error writing MII_ACCESS"); 176 check_warn_goto_done(ret, "Error writing MII_ACCESS");
177 177
@@ -210,7 +210,7 @@ static void smsc75xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
210 idx &= dev->mii.reg_num_mask; 210 idx &= dev->mii.reg_num_mask;
211 addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) 211 addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR)
212 | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) 212 | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR)
213 | MII_ACCESS_WRITE; 213 | MII_ACCESS_WRITE | MII_ACCESS_BUSY;
214 ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); 214 ret = smsc75xx_write_reg(dev, MII_ACCESS, addr);
215 check_warn_goto_done(ret, "Error writing MII_ACCESS"); 215 check_warn_goto_done(ret, "Error writing MII_ACCESS");
216 216
@@ -508,9 +508,10 @@ static int smsc75xx_link_reset(struct usbnet *dev)
508 u16 lcladv, rmtadv; 508 u16 lcladv, rmtadv;
509 int ret; 509 int ret;
510 510
511 /* clear interrupt status */ 511 /* read and write to clear phy interrupt status */
512 ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); 512 ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
513 check_warn_return(ret, "Error reading PHY_INT_SRC"); 513 check_warn_return(ret, "Error reading PHY_INT_SRC");
514 smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC, 0xffff);
514 515
515 ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); 516 ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL);
516 check_warn_return(ret, "Error writing INT_STS"); 517 check_warn_return(ret, "Error writing INT_STS");
@@ -643,7 +644,7 @@ static int smsc75xx_set_mac_address(struct usbnet *dev)
643 644
644static int smsc75xx_phy_initialize(struct usbnet *dev) 645static int smsc75xx_phy_initialize(struct usbnet *dev)
645{ 646{
646 int bmcr, timeout = 0; 647 int bmcr, ret, timeout = 0;
647 648
648 /* Initialize MII structure */ 649 /* Initialize MII structure */
649 dev->mii.dev = dev->net; 650 dev->mii.dev = dev->net;
@@ -651,6 +652,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev)
651 dev->mii.mdio_write = smsc75xx_mdio_write; 652 dev->mii.mdio_write = smsc75xx_mdio_write;
652 dev->mii.phy_id_mask = 0x1f; 653 dev->mii.phy_id_mask = 0x1f;
653 dev->mii.reg_num_mask = 0x1f; 654 dev->mii.reg_num_mask = 0x1f;
655 dev->mii.supports_gmii = 1;
654 dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; 656 dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID;
655 657
656 /* reset phy and wait for reset to complete */ 658 /* reset phy and wait for reset to complete */
@@ -661,7 +663,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev)
661 bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); 663 bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR);
662 check_warn_return(bmcr, "Error reading MII_BMCR"); 664 check_warn_return(bmcr, "Error reading MII_BMCR");
663 timeout++; 665 timeout++;
664 } while ((bmcr & MII_BMCR) && (timeout < 100)); 666 } while ((bmcr & BMCR_RESET) && (timeout < 100));
665 667
666 if (timeout >= 100) { 668 if (timeout >= 100) {
667 netdev_warn(dev->net, "timeout on PHY Reset"); 669 netdev_warn(dev->net, "timeout on PHY Reset");
@@ -671,10 +673,13 @@ static int smsc75xx_phy_initialize(struct usbnet *dev)
671 smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, 673 smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
672 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | 674 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP |
673 ADVERTISE_PAUSE_ASYM); 675 ADVERTISE_PAUSE_ASYM);
676 smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000,
677 ADVERTISE_1000FULL);
674 678
675 /* read to clear */ 679 /* read and write to clear phy interrupt status */
676 smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); 680 ret = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC);
677 check_warn_return(bmcr, "Error reading PHY_INT_SRC"); 681 check_warn_return(ret, "Error reading PHY_INT_SRC");
682 smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_SRC, 0xffff);
678 683
679 smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, 684 smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK,
680 PHY_INT_MASK_DEFAULT); 685 PHY_INT_MASK_DEFAULT);
@@ -946,6 +951,14 @@ static int smsc75xx_reset(struct usbnet *dev)
946 ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); 951 ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf);
947 check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); 952 check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret);
948 953
954 /* allow mac to detect speed and duplex from phy */
955 ret = smsc75xx_read_reg(dev, MAC_CR, &buf);
956 check_warn_return(ret, "Failed to read MAC_CR: %d", ret);
957
958 buf |= (MAC_CR_ADD | MAC_CR_ASD);
959 ret = smsc75xx_write_reg(dev, MAC_CR, buf);
960 check_warn_return(ret, "Failed to write MAC_CR: %d", ret);
961
949 ret = smsc75xx_read_reg(dev, MAC_TX, &buf); 962 ret = smsc75xx_read_reg(dev, MAC_TX, &buf);
950 check_warn_return(ret, "Failed to read MAC_TX: %d", ret); 963 check_warn_return(ret, "Failed to read MAC_TX: %d", ret);
951 964
@@ -1051,6 +1064,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
1051 dev->net->ethtool_ops = &smsc75xx_ethtool_ops; 1064 dev->net->ethtool_ops = &smsc75xx_ethtool_ops;
1052 dev->net->flags |= IFF_MULTICAST; 1065 dev->net->flags |= IFF_MULTICAST;
1053 dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; 1066 dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD;
1067 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
1054 return 0; 1068 return 0;
1055} 1069}
1056 1070
@@ -1211,7 +1225,7 @@ static const struct driver_info smsc75xx_info = {
1211 .rx_fixup = smsc75xx_rx_fixup, 1225 .rx_fixup = smsc75xx_rx_fixup,
1212 .tx_fixup = smsc75xx_tx_fixup, 1226 .tx_fixup = smsc75xx_tx_fixup,
1213 .status = smsc75xx_status, 1227 .status = smsc75xx_status,
1214 .flags = FLAG_ETHER | FLAG_SEND_ZLP, 1228 .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR,
1215}; 1229};
1216 1230
1217static const struct usb_device_id products[] = { 1231static const struct usb_device_id products[] = {
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 5f19f84d3494..94ae66999f59 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1017,6 +1017,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1017 dev->net->ethtool_ops = &smsc95xx_ethtool_ops; 1017 dev->net->ethtool_ops = &smsc95xx_ethtool_ops;
1018 dev->net->flags |= IFF_MULTICAST; 1018 dev->net->flags |= IFF_MULTICAST;
1019 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; 1019 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM;
1020 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
1020 return 0; 1021 return 0;
1021} 1022}
1022 1023
@@ -1191,7 +1192,7 @@ static const struct driver_info smsc95xx_info = {
1191 .rx_fixup = smsc95xx_rx_fixup, 1192 .rx_fixup = smsc95xx_rx_fixup,
1192 .tx_fixup = smsc95xx_tx_fixup, 1193 .tx_fixup = smsc95xx_tx_fixup,
1193 .status = smsc95xx_status, 1194 .status = smsc95xx_status,
1194 .flags = FLAG_ETHER | FLAG_SEND_ZLP, 1195 .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR,
1195}; 1196};
1196 1197
1197static const struct usb_device_id products[] = { 1198static const struct usb_device_id products[] = {
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index b7b3f5b0d406..b38db48b1ce0 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf)
210 } else { 210 } else {
211 usb_fill_int_urb(dev->interrupt, dev->udev, pipe, 211 usb_fill_int_urb(dev->interrupt, dev->udev, pipe,
212 buf, maxp, intr_complete, dev, period); 212 buf, maxp, intr_complete, dev, period);
213 dev->interrupt->transfer_flags |= URB_FREE_BUFFER;
213 dev_dbg(&intf->dev, 214 dev_dbg(&intf->dev,
214 "status ep%din, %d bytes period %d\n", 215 "status ep%din, %d bytes period %d\n",
215 usb_pipeendpoint(pipe), maxp, period); 216 usb_pipeendpoint(pipe), maxp, period);
@@ -281,17 +282,32 @@ int usbnet_change_mtu (struct net_device *net, int new_mtu)
281} 282}
282EXPORT_SYMBOL_GPL(usbnet_change_mtu); 283EXPORT_SYMBOL_GPL(usbnet_change_mtu);
283 284
285/* The caller must hold list->lock */
286static void __usbnet_queue_skb(struct sk_buff_head *list,
287 struct sk_buff *newsk, enum skb_state state)
288{
289 struct skb_data *entry = (struct skb_data *) newsk->cb;
290
291 __skb_queue_tail(list, newsk);
292 entry->state = state;
293}
294
284/*-------------------------------------------------------------------------*/ 295/*-------------------------------------------------------------------------*/
285 296
286/* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from 297/* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from
287 * completion callbacks. 2.5 should have fixed those bugs... 298 * completion callbacks. 2.5 should have fixed those bugs...
288 */ 299 */
289 300
290static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_head *list) 301static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb,
302 struct sk_buff_head *list, enum skb_state state)
291{ 303{
292 unsigned long flags; 304 unsigned long flags;
305 enum skb_state old_state;
306 struct skb_data *entry = (struct skb_data *) skb->cb;
293 307
294 spin_lock_irqsave(&list->lock, flags); 308 spin_lock_irqsave(&list->lock, flags);
309 old_state = entry->state;
310 entry->state = state;
295 __skb_unlink(skb, list); 311 __skb_unlink(skb, list);
296 spin_unlock(&list->lock); 312 spin_unlock(&list->lock);
297 spin_lock(&dev->done.lock); 313 spin_lock(&dev->done.lock);
@@ -299,6 +315,7 @@ static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_hea
299 if (dev->done.qlen == 1) 315 if (dev->done.qlen == 1)
300 tasklet_schedule(&dev->bh); 316 tasklet_schedule(&dev->bh);
301 spin_unlock_irqrestore(&dev->done.lock, flags); 317 spin_unlock_irqrestore(&dev->done.lock, flags);
318 return old_state;
302} 319}
303 320
304/* some work can't be done in tasklets, so we use keventd 321/* some work can't be done in tasklets, so we use keventd
@@ -339,7 +356,6 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
339 entry = (struct skb_data *) skb->cb; 356 entry = (struct skb_data *) skb->cb;
340 entry->urb = urb; 357 entry->urb = urb;
341 entry->dev = dev; 358 entry->dev = dev;
342 entry->state = rx_start;
343 entry->length = 0; 359 entry->length = 0;
344 360
345 usb_fill_bulk_urb (urb, dev->udev, dev->in, 361 usb_fill_bulk_urb (urb, dev->udev, dev->in,
@@ -371,7 +387,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
371 tasklet_schedule (&dev->bh); 387 tasklet_schedule (&dev->bh);
372 break; 388 break;
373 case 0: 389 case 0:
374 __skb_queue_tail (&dev->rxq, skb); 390 __usbnet_queue_skb(&dev->rxq, skb, rx_start);
375 } 391 }
376 } else { 392 } else {
377 netif_dbg(dev, ifdown, dev->net, "rx: stopped\n"); 393 netif_dbg(dev, ifdown, dev->net, "rx: stopped\n");
@@ -422,16 +438,17 @@ static void rx_complete (struct urb *urb)
422 struct skb_data *entry = (struct skb_data *) skb->cb; 438 struct skb_data *entry = (struct skb_data *) skb->cb;
423 struct usbnet *dev = entry->dev; 439 struct usbnet *dev = entry->dev;
424 int urb_status = urb->status; 440 int urb_status = urb->status;
441 enum skb_state state;
425 442
426 skb_put (skb, urb->actual_length); 443 skb_put (skb, urb->actual_length);
427 entry->state = rx_done; 444 state = rx_done;
428 entry->urb = NULL; 445 entry->urb = NULL;
429 446
430 switch (urb_status) { 447 switch (urb_status) {
431 /* success */ 448 /* success */
432 case 0: 449 case 0:
433 if (skb->len < dev->net->hard_header_len) { 450 if (skb->len < dev->net->hard_header_len) {
434 entry->state = rx_cleanup; 451 state = rx_cleanup;
435 dev->net->stats.rx_errors++; 452 dev->net->stats.rx_errors++;
436 dev->net->stats.rx_length_errors++; 453 dev->net->stats.rx_length_errors++;
437 netif_dbg(dev, rx_err, dev->net, 454 netif_dbg(dev, rx_err, dev->net,
@@ -470,7 +487,7 @@ static void rx_complete (struct urb *urb)
470 "rx throttle %d\n", urb_status); 487 "rx throttle %d\n", urb_status);
471 } 488 }
472block: 489block:
473 entry->state = rx_cleanup; 490 state = rx_cleanup;
474 entry->urb = urb; 491 entry->urb = urb;
475 urb = NULL; 492 urb = NULL;
476 break; 493 break;
@@ -481,17 +498,18 @@ block:
481 // FALLTHROUGH 498 // FALLTHROUGH
482 499
483 default: 500 default:
484 entry->state = rx_cleanup; 501 state = rx_cleanup;
485 dev->net->stats.rx_errors++; 502 dev->net->stats.rx_errors++;
486 netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status); 503 netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status);
487 break; 504 break;
488 } 505 }
489 506
490 defer_bh(dev, skb, &dev->rxq); 507 state = defer_bh(dev, skb, &dev->rxq, state);
491 508
492 if (urb) { 509 if (urb) {
493 if (netif_running (dev->net) && 510 if (netif_running (dev->net) &&
494 !test_bit (EVENT_RX_HALT, &dev->flags)) { 511 !test_bit (EVENT_RX_HALT, &dev->flags) &&
512 state != unlink_start) {
495 rx_submit (dev, urb, GFP_ATOMIC); 513 rx_submit (dev, urb, GFP_ATOMIC);
496 usb_mark_last_busy(dev->udev); 514 usb_mark_last_busy(dev->udev);
497 return; 515 return;
@@ -578,16 +596,23 @@ EXPORT_SYMBOL_GPL(usbnet_purge_paused_rxq);
578static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) 596static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q)
579{ 597{
580 unsigned long flags; 598 unsigned long flags;
581 struct sk_buff *skb, *skbnext; 599 struct sk_buff *skb;
582 int count = 0; 600 int count = 0;
583 601
584 spin_lock_irqsave (&q->lock, flags); 602 spin_lock_irqsave (&q->lock, flags);
585 skb_queue_walk_safe(q, skb, skbnext) { 603 while (!skb_queue_empty(q)) {
586 struct skb_data *entry; 604 struct skb_data *entry;
587 struct urb *urb; 605 struct urb *urb;
588 int retval; 606 int retval;
589 607
590 entry = (struct skb_data *) skb->cb; 608 skb_queue_walk(q, skb) {
609 entry = (struct skb_data *) skb->cb;
610 if (entry->state != unlink_start)
611 goto found;
612 }
613 break;
614found:
615 entry->state = unlink_start;
591 urb = entry->urb; 616 urb = entry->urb;
592 617
593 /* 618 /*
@@ -1038,8 +1063,7 @@ static void tx_complete (struct urb *urb)
1038 } 1063 }
1039 1064
1040 usb_autopm_put_interface_async(dev->intf); 1065 usb_autopm_put_interface_async(dev->intf);
1041 entry->state = tx_done; 1066 (void) defer_bh(dev, skb, &dev->txq, tx_done);
1042 defer_bh(dev, skb, &dev->txq);
1043} 1067}
1044 1068
1045/*-------------------------------------------------------------------------*/ 1069/*-------------------------------------------------------------------------*/
@@ -1095,7 +1119,6 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1095 entry = (struct skb_data *) skb->cb; 1119 entry = (struct skb_data *) skb->cb;
1096 entry->urb = urb; 1120 entry->urb = urb;
1097 entry->dev = dev; 1121 entry->dev = dev;
1098 entry->state = tx_start;
1099 entry->length = length; 1122 entry->length = length;
1100 1123
1101 usb_fill_bulk_urb (urb, dev->udev, dev->out, 1124 usb_fill_bulk_urb (urb, dev->udev, dev->out,
@@ -1154,7 +1177,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1154 break; 1177 break;
1155 case 0: 1178 case 0:
1156 net->trans_start = jiffies; 1179 net->trans_start = jiffies;
1157 __skb_queue_tail (&dev->txq, skb); 1180 __usbnet_queue_skb(&dev->txq, skb, tx_start);
1158 if (dev->txq.qlen >= TX_QLEN (dev)) 1181 if (dev->txq.qlen >= TX_QLEN (dev))
1159 netif_stop_queue (net); 1182 netif_stop_queue (net);
1160 } 1183 }
@@ -1443,7 +1466,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1443 1466
1444 status = register_netdev (net); 1467 status = register_netdev (net);
1445 if (status) 1468 if (status)
1446 goto out3; 1469 goto out4;
1447 netif_info(dev, probe, dev->net, 1470 netif_info(dev, probe, dev->net,
1448 "register '%s' at usb-%s-%s, %s, %pM\n", 1471 "register '%s' at usb-%s-%s, %s, %pM\n",
1449 udev->dev.driver->name, 1472 udev->dev.driver->name,
@@ -1461,6 +1484,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1461 1484
1462 return 0; 1485 return 0;
1463 1486
1487out4:
1488 usb_free_urb(dev->interrupt);
1464out3: 1489out3:
1465 if (info->unbind) 1490 if (info->unbind)
1466 info->unbind (dev, udev); 1491 info->unbind (dev, udev);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4de2760c5937..cbefe671bcc6 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -492,7 +492,9 @@ static void virtnet_napi_enable(struct virtnet_info *vi)
492 * We synchronize against interrupts via NAPI_STATE_SCHED */ 492 * We synchronize against interrupts via NAPI_STATE_SCHED */
493 if (napi_schedule_prep(&vi->napi)) { 493 if (napi_schedule_prep(&vi->napi)) {
494 virtqueue_disable_cb(vi->rvq); 494 virtqueue_disable_cb(vi->rvq);
495 local_bh_disable();
495 __napi_schedule(&vi->napi); 496 __napi_schedule(&vi->napi);
497 local_bh_enable();
496 } 498 }
497} 499}
498 500
@@ -626,16 +628,15 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
626 /* This can happen with OOM and indirect buffers. */ 628 /* This can happen with OOM and indirect buffers. */
627 if (unlikely(capacity < 0)) { 629 if (unlikely(capacity < 0)) {
628 if (likely(capacity == -ENOMEM)) { 630 if (likely(capacity == -ENOMEM)) {
629 if (net_ratelimit()) { 631 if (net_ratelimit())
630 dev_warn(&dev->dev, 632 dev_warn(&dev->dev,
631 "TX queue failure: out of memory\n"); 633 "TX queue failure: out of memory\n");
632 } else { 634 } else {
633 dev->stats.tx_fifo_errors++; 635 dev->stats.tx_fifo_errors++;
634 if (net_ratelimit()) 636 if (net_ratelimit())
635 dev_warn(&dev->dev, 637 dev_warn(&dev->dev,
636 "Unexpected TX queue failure: %d\n", 638 "Unexpected TX queue failure: %d\n",
637 capacity); 639 capacity);
638 }
639 } 640 }
640 dev->stats.tx_dropped++; 641 dev->stats.tx_dropped++;
641 kfree_skb(skb); 642 kfree_skb(skb);
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index ebb9f24eefb5..1a623183cbe5 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2483,6 +2483,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2483 pr_err("Control memory remap failed\n"); 2483 pr_err("Control memory remap failed\n");
2484 pci_release_regions(pdev); 2484 pci_release_regions(pdev);
2485 pci_disable_device(pdev); 2485 pci_disable_device(pdev);
2486 iounmap(card->mem);
2486 kfree(card); 2487 kfree(card);
2487 return -ENODEV; 2488 return -ENODEV;
2488 } 2489 }
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
index 8faa129da5a0..aec33cc207fd 100644
--- a/drivers/net/wireless/ath/ath5k/ahb.c
+++ b/drivers/net/wireless/ath/ath5k/ahb.c
@@ -19,6 +19,7 @@
19#include <linux/nl80211.h> 19#include <linux/nl80211.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/etherdevice.h> 21#include <linux/etherdevice.h>
22#include <linux/export.h>
22#include <ar231x_platform.h> 23#include <ar231x_platform.h>
23#include "ath5k.h" 24#include "ath5k.h"
24#include "debug.h" 25#include "debug.h"
@@ -119,7 +120,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
119 if (res == NULL) { 120 if (res == NULL) {
120 dev_err(&pdev->dev, "no IRQ resource found\n"); 121 dev_err(&pdev->dev, "no IRQ resource found\n");
121 ret = -ENXIO; 122 ret = -ENXIO;
122 goto err_out; 123 goto err_iounmap;
123 } 124 }
124 125
125 irq = res->start; 126 irq = res->start;
@@ -128,7 +129,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
128 if (hw == NULL) { 129 if (hw == NULL) {
129 dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); 130 dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
130 ret = -ENOMEM; 131 ret = -ENOMEM;
131 goto err_out; 132 goto err_iounmap;
132 } 133 }
133 134
134 ah = hw->priv; 135 ah = hw->priv;
@@ -185,6 +186,8 @@ static int ath_ahb_probe(struct platform_device *pdev)
185 err_free_hw: 186 err_free_hw:
186 ieee80211_free_hw(hw); 187 ieee80211_free_hw(hw);
187 platform_set_drvdata(pdev, NULL); 188 platform_set_drvdata(pdev, NULL);
189 err_iounmap:
190 iounmap(mem);
188 err_out: 191 err_out:
189 return ret; 192 return ret;
190} 193}
@@ -217,6 +220,7 @@ static int ath_ahb_remove(struct platform_device *pdev)
217 } 220 }
218 221
219 ath5k_deinit_ah(ah); 222 ath5k_deinit_ah(ah);
223 iounmap(ah->iobase);
220 platform_set_drvdata(pdev, NULL); 224 platform_set_drvdata(pdev, NULL);
221 ieee80211_free_hw(hw); 225 ieee80211_free_hw(hw);
222 226
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index d7d8e9199140..aba088005b22 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -869,7 +869,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
869 ar5008_hw_set_channel_regs(ah, chan); 869 ar5008_hw_set_channel_regs(ah, chan);
870 ar5008_hw_init_chain_masks(ah); 870 ar5008_hw_init_chain_masks(ah);
871 ath9k_olc_init(ah); 871 ath9k_olc_init(ah);
872 ath9k_hw_apply_txpower(ah, chan); 872 ath9k_hw_apply_txpower(ah, chan, false);
873 873
874 /* Write analog registers */ 874 /* Write analog registers */
875 if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { 875 if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) {
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 59647a3ceb7f..3d400e8d6535 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *ah, bool val)
54 54
55 if (val) { 55 if (val) {
56 ah->paprd_table_write_done = true; 56 ah->paprd_table_write_done = true;
57 ath9k_hw_apply_txpower(ah, chan); 57 ath9k_hw_apply_txpower(ah, chan, false);
58 } 58 }
59 59
60 REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, 60 REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0,
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index bc992b237ae5..600aca9fe6b1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -373,7 +373,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah,
373 else 373 else
374 spur_subchannel_sd = 0; 374 spur_subchannel_sd = 0;
375 375
376 spur_freq_sd = (freq_offset << 9) / 11; 376 spur_freq_sd = ((freq_offset + 10) << 9) / 11;
377 377
378 } else { 378 } else {
379 if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, 379 if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL,
@@ -382,7 +382,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah,
382 else 382 else
383 spur_subchannel_sd = 1; 383 spur_subchannel_sd = 1;
384 384
385 spur_freq_sd = (freq_offset << 9) / 11; 385 spur_freq_sd = ((freq_offset - 10) << 9) / 11;
386 386
387 } 387 }
388 388
@@ -694,7 +694,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
694 ar9003_hw_override_ini(ah); 694 ar9003_hw_override_ini(ah);
695 ar9003_hw_set_channel_regs(ah, chan); 695 ar9003_hw_set_channel_regs(ah, chan);
696 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); 696 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
697 ath9k_hw_apply_txpower(ah, chan); 697 ath9k_hw_apply_txpower(ah, chan, false);
698 698
699 if (AR_SREV_9462(ah)) { 699 if (AR_SREV_9462(ah)) {
700 if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, 700 if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0,
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index f272236d8053..b34e8b2990b1 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -824,6 +824,8 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah,
824 regulatory->max_power_level = ratesArray[i]; 824 regulatory->max_power_level = ratesArray[i];
825 } 825 }
826 826
827 ath9k_hw_update_regulatory_maxpower(ah);
828
827 if (test) 829 if (test)
828 return; 830 return;
829 831
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 6c69e4e8b1cb..fa84e37bf091 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1454,7 +1454,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,
1454 return false; 1454 return false;
1455 } 1455 }
1456 ath9k_hw_set_clockrate(ah); 1456 ath9k_hw_set_clockrate(ah);
1457 ath9k_hw_apply_txpower(ah, chan); 1457 ath9k_hw_apply_txpower(ah, chan, false);
1458 ath9k_hw_rfbus_done(ah); 1458 ath9k_hw_rfbus_done(ah);
1459 1459
1460 if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) 1460 if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
@@ -2652,7 +2652,8 @@ static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan)
2652 return ah->eep_ops->get_eeprom(ah, gain_param); 2652 return ah->eep_ops->get_eeprom(ah, gain_param);
2653} 2653}
2654 2654
2655void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) 2655void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
2656 bool test)
2656{ 2657{
2657 struct ath_regulatory *reg = ath9k_hw_regulatory(ah); 2658 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
2658 struct ieee80211_channel *channel; 2659 struct ieee80211_channel *channel;
@@ -2673,7 +2674,7 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan)
2673 2674
2674 ah->eep_ops->set_txpower(ah, chan, 2675 ah->eep_ops->set_txpower(ah, chan,
2675 ath9k_regd_get_ctl(reg, chan), 2676 ath9k_regd_get_ctl(reg, chan),
2676 ant_reduction, new_pwr, false); 2677 ant_reduction, new_pwr, test);
2677} 2678}
2678 2679
2679void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) 2680void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
@@ -2686,7 +2687,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
2686 if (test) 2687 if (test)
2687 channel->max_power = MAX_RATE_POWER / 2; 2688 channel->max_power = MAX_RATE_POWER / 2;
2688 2689
2689 ath9k_hw_apply_txpower(ah, chan); 2690 ath9k_hw_apply_txpower(ah, chan, test);
2690 2691
2691 if (test) 2692 if (test)
2692 channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); 2693 channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index aa1680a0c7fd..e88f182ff45c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -985,7 +985,8 @@ void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len);
985/* PHY */ 985/* PHY */
986void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, 986void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
987 u32 *coef_mantissa, u32 *coef_exponent); 987 u32 *coef_mantissa, u32 *coef_exponent);
988void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan); 988void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
989 bool test);
989 990
990/* 991/*
991 * Code Specific to AR5008, AR9001 or AR9002, 992 * Code Specific to AR5008, AR9001 or AR9002,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 215eb2536b1e..798ea57252b4 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -118,15 +118,13 @@ void ath9k_ps_restore(struct ath_softc *sc)
118 if (--sc->ps_usecount != 0) 118 if (--sc->ps_usecount != 0)
119 goto unlock; 119 goto unlock;
120 120
121 if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) 121 if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK))
122 goto unlock;
123
124 if (sc->ps_idle)
125 mode = ATH9K_PM_FULL_SLEEP; 122 mode = ATH9K_PM_FULL_SLEEP;
126 else if (sc->ps_enabled && 123 else if (sc->ps_enabled &&
127 !(sc->ps_flags & (PS_WAIT_FOR_BEACON | 124 !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
128 PS_WAIT_FOR_CAB | 125 PS_WAIT_FOR_CAB |
129 PS_WAIT_FOR_PSPOLL_DATA))) 126 PS_WAIT_FOR_PSPOLL_DATA |
127 PS_WAIT_FOR_TX_ACK)))
130 mode = ATH9K_PM_NETWORK_SLEEP; 128 mode = ATH9K_PM_NETWORK_SLEEP;
131 else 129 else
132 goto unlock; 130 goto unlock;
@@ -1550,6 +1548,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1550 struct ath_hw *ah = sc->sc_ah; 1548 struct ath_hw *ah = sc->sc_ah;
1551 struct ath_common *common = ath9k_hw_common(ah); 1549 struct ath_common *common = ath9k_hw_common(ah);
1552 struct ieee80211_conf *conf = &hw->conf; 1550 struct ieee80211_conf *conf = &hw->conf;
1551 bool reset_channel = false;
1553 1552
1554 ath9k_ps_wakeup(sc); 1553 ath9k_ps_wakeup(sc);
1555 mutex_lock(&sc->mutex); 1554 mutex_lock(&sc->mutex);
@@ -1558,6 +1557,12 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1558 sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); 1557 sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
1559 if (sc->ps_idle) 1558 if (sc->ps_idle)
1560 ath_cancel_work(sc); 1559 ath_cancel_work(sc);
1560 else
1561 /*
1562 * The chip needs a reset to properly wake up from
1563 * full sleep
1564 */
1565 reset_channel = ah->chip_fullsleep;
1561 } 1566 }
1562 1567
1563 /* 1568 /*
@@ -1586,7 +1591,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1586 } 1591 }
1587 } 1592 }
1588 1593
1589 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 1594 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
1590 struct ieee80211_channel *curchan = hw->conf.channel; 1595 struct ieee80211_channel *curchan = hw->conf.channel;
1591 int pos = curchan->hw_value; 1596 int pos = curchan->hw_value;
1592 int old_pos = -1; 1597 int old_pos = -1;
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 834e6bc45e8b..23eaa1b26ebe 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1820,6 +1820,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1820 struct ath_frame_info *fi = get_frame_info(skb); 1820 struct ath_frame_info *fi = get_frame_info(skb);
1821 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1821 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1822 struct ath_buf *bf; 1822 struct ath_buf *bf;
1823 int fragno;
1823 u16 seqno; 1824 u16 seqno;
1824 1825
1825 bf = ath_tx_get_buffer(sc); 1826 bf = ath_tx_get_buffer(sc);
@@ -1831,9 +1832,16 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1831 ATH_TXBUF_RESET(bf); 1832 ATH_TXBUF_RESET(bf);
1832 1833
1833 if (tid) { 1834 if (tid) {
1835 fragno = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
1834 seqno = tid->seq_next; 1836 seqno = tid->seq_next;
1835 hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); 1837 hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT);
1836 INCR(tid->seq_next, IEEE80211_SEQ_MAX); 1838
1839 if (fragno)
1840 hdr->seq_ctrl |= cpu_to_le16(fragno);
1841
1842 if (!ieee80211_has_morefrags(hdr->frame_control))
1843 INCR(tid->seq_next, IEEE80211_SEQ_MAX);
1844
1837 bf->bf_state.seqno = seqno; 1845 bf->bf_state.seqno = seqno;
1838 } 1846 }
1839 1847
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index c79e6638c88d..e4d6dc2e37d1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4827,8 +4827,14 @@ static int b43_op_start(struct ieee80211_hw *hw)
4827 out_mutex_unlock: 4827 out_mutex_unlock:
4828 mutex_unlock(&wl->mutex); 4828 mutex_unlock(&wl->mutex);
4829 4829
4830 /* reload configuration */ 4830 /*
4831 b43_op_config(hw, ~0); 4831 * Configuration may have been overwritten during initialization.
4832 * Reload the configuration, but only if initialization was
4833 * successful. Reloading the configuration after a failed init
4834 * may hang the system.
4835 */
4836 if (!err)
4837 b43_op_config(hw, ~0);
4832 4838
4833 return err; 4839 return err;
4834} 4840}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 4688904908ec..758c115b556e 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
108 sdio_release_host(sdfunc); 108 sdio_release_host(sdfunc);
109 } 109 }
110 } else if (regaddr == SDIO_CCCR_ABORT) { 110 } else if (regaddr == SDIO_CCCR_ABORT) {
111 sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func),
112 GFP_KERNEL);
113 if (!sdfunc)
114 return -ENOMEM;
115 sdfunc->num = 0;
111 sdio_claim_host(sdfunc); 116 sdio_claim_host(sdfunc);
112 sdio_writeb(sdfunc, *byte, regaddr, &err_ret); 117 sdio_writeb(sdfunc, *byte, regaddr, &err_ret);
113 sdio_release_host(sdfunc); 118 sdio_release_host(sdfunc);
119 kfree(sdfunc);
114 } else if (regaddr < 0xF0) { 120 } else if (regaddr < 0xF0) {
115 brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); 121 brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr);
116 err_ret = -EPERM; 122 err_ret = -EPERM;
@@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
486 kfree(bus_if); 492 kfree(bus_if);
487 return -ENOMEM; 493 return -ENOMEM;
488 } 494 }
489 sdiodev->func[0] = func->card->sdio_func[0]; 495 sdiodev->func[0] = func;
490 sdiodev->func[1] = func; 496 sdiodev->func[1] = func;
491 sdiodev->bus_if = bus_if; 497 sdiodev->bus_if = bus_if;
492 bus_if->bus_priv.sdio = sdiodev; 498 bus_if->bus_priv.sdio = sdiodev;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 2bf5dda29291..e2b34e1563f4 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -574,6 +574,8 @@ struct brcmf_sdio {
574 574
575 struct task_struct *dpc_tsk; 575 struct task_struct *dpc_tsk;
576 struct completion dpc_wait; 576 struct completion dpc_wait;
577 struct list_head dpc_tsklst;
578 spinlock_t dpc_tl_lock;
577 579
578 struct semaphore sdsem; 580 struct semaphore sdsem;
579 581
@@ -2594,29 +2596,59 @@ clkwait:
2594 return resched; 2596 return resched;
2595} 2597}
2596 2598
2599static inline void brcmf_sdbrcm_adddpctsk(struct brcmf_sdio *bus)
2600{
2601 struct list_head *new_hd;
2602 unsigned long flags;
2603
2604 if (in_interrupt())
2605 new_hd = kzalloc(sizeof(struct list_head), GFP_ATOMIC);
2606 else
2607 new_hd = kzalloc(sizeof(struct list_head), GFP_KERNEL);
2608 if (new_hd == NULL)
2609 return;
2610
2611 spin_lock_irqsave(&bus->dpc_tl_lock, flags);
2612 list_add_tail(new_hd, &bus->dpc_tsklst);
2613 spin_unlock_irqrestore(&bus->dpc_tl_lock, flags);
2614}
2615
2597static int brcmf_sdbrcm_dpc_thread(void *data) 2616static int brcmf_sdbrcm_dpc_thread(void *data)
2598{ 2617{
2599 struct brcmf_sdio *bus = (struct brcmf_sdio *) data; 2618 struct brcmf_sdio *bus = (struct brcmf_sdio *) data;
2619 struct list_head *cur_hd, *tmp_hd;
2620 unsigned long flags;
2600 2621
2601 allow_signal(SIGTERM); 2622 allow_signal(SIGTERM);
2602 /* Run until signal received */ 2623 /* Run until signal received */
2603 while (1) { 2624 while (1) {
2604 if (kthread_should_stop()) 2625 if (kthread_should_stop())
2605 break; 2626 break;
2606 if (!wait_for_completion_interruptible(&bus->dpc_wait)) { 2627
2607 /* Call bus dpc unless it indicated down 2628 if (list_empty(&bus->dpc_tsklst))
2608 (then clean stop) */ 2629 if (wait_for_completion_interruptible(&bus->dpc_wait))
2609 if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) { 2630 break;
2610 if (brcmf_sdbrcm_dpc(bus)) 2631
2611 complete(&bus->dpc_wait); 2632 spin_lock_irqsave(&bus->dpc_tl_lock, flags);
2612 } else { 2633 list_for_each_safe(cur_hd, tmp_hd, &bus->dpc_tsklst) {
2634 spin_unlock_irqrestore(&bus->dpc_tl_lock, flags);
2635
2636 if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) {
2613 /* after stopping the bus, exit thread */ 2637 /* after stopping the bus, exit thread */
2614 brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); 2638 brcmf_sdbrcm_bus_stop(bus->sdiodev->dev);
2615 bus->dpc_tsk = NULL; 2639 bus->dpc_tsk = NULL;
2640 spin_lock_irqsave(&bus->dpc_tl_lock, flags);
2616 break; 2641 break;
2617 } 2642 }
2618 } else 2643
2619 break; 2644 if (brcmf_sdbrcm_dpc(bus))
2645 brcmf_sdbrcm_adddpctsk(bus);
2646
2647 spin_lock_irqsave(&bus->dpc_tl_lock, flags);
2648 list_del(cur_hd);
2649 kfree(cur_hd);
2650 }
2651 spin_unlock_irqrestore(&bus->dpc_tl_lock, flags);
2620 } 2652 }
2621 return 0; 2653 return 0;
2622} 2654}
@@ -2669,8 +2701,10 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt)
2669 /* Schedule DPC if needed to send queued packet(s) */ 2701 /* Schedule DPC if needed to send queued packet(s) */
2670 if (!bus->dpc_sched) { 2702 if (!bus->dpc_sched) {
2671 bus->dpc_sched = true; 2703 bus->dpc_sched = true;
2672 if (bus->dpc_tsk) 2704 if (bus->dpc_tsk) {
2705 brcmf_sdbrcm_adddpctsk(bus);
2673 complete(&bus->dpc_wait); 2706 complete(&bus->dpc_wait);
2707 }
2674 } 2708 }
2675 2709
2676 return ret; 2710 return ret;
@@ -3514,8 +3548,10 @@ void brcmf_sdbrcm_isr(void *arg)
3514 brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); 3548 brcmf_dbg(ERROR, "isr w/o interrupt configured!\n");
3515 3549
3516 bus->dpc_sched = true; 3550 bus->dpc_sched = true;
3517 if (bus->dpc_tsk) 3551 if (bus->dpc_tsk) {
3552 brcmf_sdbrcm_adddpctsk(bus);
3518 complete(&bus->dpc_wait); 3553 complete(&bus->dpc_wait);
3554 }
3519} 3555}
3520 3556
3521static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) 3557static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
@@ -3559,8 +3595,10 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
3559 bus->ipend = true; 3595 bus->ipend = true;
3560 3596
3561 bus->dpc_sched = true; 3597 bus->dpc_sched = true;
3562 if (bus->dpc_tsk) 3598 if (bus->dpc_tsk) {
3599 brcmf_sdbrcm_adddpctsk(bus);
3563 complete(&bus->dpc_wait); 3600 complete(&bus->dpc_wait);
3601 }
3564 } 3602 }
3565 } 3603 }
3566 3604
@@ -3897,6 +3935,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
3897 } 3935 }
3898 /* Initialize DPC thread */ 3936 /* Initialize DPC thread */
3899 init_completion(&bus->dpc_wait); 3937 init_completion(&bus->dpc_wait);
3938 INIT_LIST_HEAD(&bus->dpc_tsklst);
3939 spin_lock_init(&bus->dpc_tl_lock);
3900 bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, 3940 bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread,
3901 bus, "brcmf_dpc"); 3941 bus, "brcmf_dpc");
3902 if (IS_ERR(bus->dpc_tsk)) { 3942 if (IS_ERR(bus->dpc_tsk)) {
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 231ddf4a674f..b4d92792c502 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -847,8 +847,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
847 */ 847 */
848 if (!(txs->status & TX_STATUS_AMPDU) 848 if (!(txs->status & TX_STATUS_AMPDU)
849 && (txs->status & TX_STATUS_INTERMEDIATE)) { 849 && (txs->status & TX_STATUS_INTERMEDIATE)) {
850 wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n", 850 BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n");
851 __func__);
852 return false; 851 return false;
853 } 852 }
854 853
@@ -7614,6 +7613,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
7614{ 7613{
7615 int len_mpdu; 7614 int len_mpdu;
7616 struct ieee80211_rx_status rx_status; 7615 struct ieee80211_rx_status rx_status;
7616 struct ieee80211_hdr *hdr;
7617 7617
7618 memset(&rx_status, 0, sizeof(rx_status)); 7618 memset(&rx_status, 0, sizeof(rx_status));
7619 prep_mac80211_status(wlc, rxh, p, &rx_status); 7619 prep_mac80211_status(wlc, rxh, p, &rx_status);
@@ -7623,6 +7623,13 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
7623 skb_pull(p, D11_PHY_HDR_LEN); 7623 skb_pull(p, D11_PHY_HDR_LEN);
7624 __skb_trim(p, len_mpdu); 7624 __skb_trim(p, len_mpdu);
7625 7625
7626 /* unmute transmit */
7627 if (wlc->hw->suspended_fifos) {
7628 hdr = (struct ieee80211_hdr *)p->data;
7629 if (ieee80211_is_beacon(hdr->frame_control))
7630 brcms_b_mute(wlc->hw, false);
7631 }
7632
7626 memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); 7633 memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status));
7627 ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); 7634 ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p);
7628} 7635}
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 2b022571a859..1779db3aa2b0 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -2191,6 +2191,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
2191{ 2191{
2192 int rc = 0; 2192 int rc = 0;
2193 unsigned long flags; 2193 unsigned long flags;
2194 unsigned long now, end;
2194 2195
2195 spin_lock_irqsave(&priv->lock, flags); 2196 spin_lock_irqsave(&priv->lock, flags);
2196 if (priv->status & STATUS_HCMD_ACTIVE) { 2197 if (priv->status & STATUS_HCMD_ACTIVE) {
@@ -2232,10 +2233,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
2232 } 2233 }
2233 spin_unlock_irqrestore(&priv->lock, flags); 2234 spin_unlock_irqrestore(&priv->lock, flags);
2234 2235
2236 now = jiffies;
2237 end = now + HOST_COMPLETE_TIMEOUT;
2238again:
2235 rc = wait_event_interruptible_timeout(priv->wait_command_queue, 2239 rc = wait_event_interruptible_timeout(priv->wait_command_queue,
2236 !(priv-> 2240 !(priv->
2237 status & STATUS_HCMD_ACTIVE), 2241 status & STATUS_HCMD_ACTIVE),
2238 HOST_COMPLETE_TIMEOUT); 2242 end - now);
2243 if (rc < 0) {
2244 now = jiffies;
2245 if (time_before(now, end))
2246 goto again;
2247 rc = 0;
2248 }
2249
2239 if (rc == 0) { 2250 if (rc == 0) {
2240 spin_lock_irqsave(&priv->lock, flags); 2251 spin_lock_irqsave(&priv->lock, flags);
2241 if (priv->status & STATUS_HCMD_ACTIVE) { 2252 if (priv->status & STATUS_HCMD_ACTIVE) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 5b0d888f746b..8d80e233bc7a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -46,8 +46,8 @@
46#include "iwl-prph.h" 46#include "iwl-prph.h"
47 47
48/* Highest firmware API version supported */ 48/* Highest firmware API version supported */
49#define IWL1000_UCODE_API_MAX 6 49#define IWL1000_UCODE_API_MAX 5
50#define IWL100_UCODE_API_MAX 6 50#define IWL100_UCODE_API_MAX 5
51 51
52/* Oldest version we won't warn about */ 52/* Oldest version we won't warn about */
53#define IWL1000_UCODE_API_OK 5 53#define IWL1000_UCODE_API_OK 5
@@ -226,5 +226,5 @@ const struct iwl_cfg iwl100_bg_cfg = {
226 IWL_DEVICE_100, 226 IWL_DEVICE_100,
227}; 227};
228 228
229MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); 229MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK));
230MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); 230MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 5635b9e2c69e..ea108622e0bd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -51,10 +51,10 @@
51#define IWL135_UCODE_API_MAX 6 51#define IWL135_UCODE_API_MAX 6
52 52
53/* Oldest version we won't warn about */ 53/* Oldest version we won't warn about */
54#define IWL2030_UCODE_API_OK 5 54#define IWL2030_UCODE_API_OK 6
55#define IWL2000_UCODE_API_OK 5 55#define IWL2000_UCODE_API_OK 6
56#define IWL105_UCODE_API_OK 5 56#define IWL105_UCODE_API_OK 6
57#define IWL135_UCODE_API_OK 5 57#define IWL135_UCODE_API_OK 6
58 58
59/* Lowest firmware API version supported */ 59/* Lowest firmware API version supported */
60#define IWL2030_UCODE_API_MIN 5 60#define IWL2030_UCODE_API_MIN 5
@@ -328,7 +328,7 @@ const struct iwl_cfg iwl135_bgn_cfg = {
328 .ht_params = &iwl2000_ht_params, 328 .ht_params = &iwl2000_ht_params,
329}; 329};
330 330
331MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); 331MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK));
332MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); 332MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK));
333MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); 333MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK));
334MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); 334MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index a805e97b89af..de0920c74cdd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -51,6 +51,10 @@
51#define IWL5000_UCODE_API_MAX 5 51#define IWL5000_UCODE_API_MAX 5
52#define IWL5150_UCODE_API_MAX 2 52#define IWL5150_UCODE_API_MAX 2
53 53
54/* Oldest version we won't warn about */
55#define IWL5000_UCODE_API_OK 5
56#define IWL5150_UCODE_API_OK 2
57
54/* Lowest firmware API version supported */ 58/* Lowest firmware API version supported */
55#define IWL5000_UCODE_API_MIN 1 59#define IWL5000_UCODE_API_MIN 1
56#define IWL5150_UCODE_API_MIN 1 60#define IWL5150_UCODE_API_MIN 1
@@ -326,6 +330,7 @@ static const struct iwl_ht_params iwl5000_ht_params = {
326#define IWL_DEVICE_5000 \ 330#define IWL_DEVICE_5000 \
327 .fw_name_pre = IWL5000_FW_PRE, \ 331 .fw_name_pre = IWL5000_FW_PRE, \
328 .ucode_api_max = IWL5000_UCODE_API_MAX, \ 332 .ucode_api_max = IWL5000_UCODE_API_MAX, \
333 .ucode_api_ok = IWL5000_UCODE_API_OK, \
329 .ucode_api_min = IWL5000_UCODE_API_MIN, \ 334 .ucode_api_min = IWL5000_UCODE_API_MIN, \
330 .max_inst_size = IWLAGN_RTC_INST_SIZE, \ 335 .max_inst_size = IWLAGN_RTC_INST_SIZE, \
331 .max_data_size = IWLAGN_RTC_DATA_SIZE, \ 336 .max_data_size = IWLAGN_RTC_DATA_SIZE, \
@@ -371,6 +376,7 @@ const struct iwl_cfg iwl5350_agn_cfg = {
371 .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", 376 .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
372 .fw_name_pre = IWL5000_FW_PRE, 377 .fw_name_pre = IWL5000_FW_PRE,
373 .ucode_api_max = IWL5000_UCODE_API_MAX, 378 .ucode_api_max = IWL5000_UCODE_API_MAX,
379 .ucode_api_ok = IWL5000_UCODE_API_OK,
374 .ucode_api_min = IWL5000_UCODE_API_MIN, 380 .ucode_api_min = IWL5000_UCODE_API_MIN,
375 .max_inst_size = IWLAGN_RTC_INST_SIZE, 381 .max_inst_size = IWLAGN_RTC_INST_SIZE,
376 .max_data_size = IWLAGN_RTC_DATA_SIZE, 382 .max_data_size = IWLAGN_RTC_DATA_SIZE,
@@ -386,6 +392,7 @@ const struct iwl_cfg iwl5350_agn_cfg = {
386#define IWL_DEVICE_5150 \ 392#define IWL_DEVICE_5150 \
387 .fw_name_pre = IWL5150_FW_PRE, \ 393 .fw_name_pre = IWL5150_FW_PRE, \
388 .ucode_api_max = IWL5150_UCODE_API_MAX, \ 394 .ucode_api_max = IWL5150_UCODE_API_MAX, \
395 .ucode_api_ok = IWL5150_UCODE_API_OK, \
389 .ucode_api_min = IWL5150_UCODE_API_MIN, \ 396 .ucode_api_min = IWL5150_UCODE_API_MIN, \
390 .max_inst_size = IWLAGN_RTC_INST_SIZE, \ 397 .max_inst_size = IWLAGN_RTC_INST_SIZE, \
391 .max_data_size = IWLAGN_RTC_DATA_SIZE, \ 398 .max_data_size = IWLAGN_RTC_DATA_SIZE, \
@@ -409,5 +416,5 @@ const struct iwl_cfg iwl5150_abg_cfg = {
409 IWL_DEVICE_5150, 416 IWL_DEVICE_5150,
410}; 417};
411 418
412MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); 419MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK));
413MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); 420MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 64060cd738b5..f0c91505a7f7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -53,6 +53,8 @@
53/* Oldest version we won't warn about */ 53/* Oldest version we won't warn about */
54#define IWL6000_UCODE_API_OK 4 54#define IWL6000_UCODE_API_OK 4
55#define IWL6000G2_UCODE_API_OK 5 55#define IWL6000G2_UCODE_API_OK 5
56#define IWL6050_UCODE_API_OK 5
57#define IWL6000G2B_UCODE_API_OK 6
56 58
57/* Lowest firmware API version supported */ 59/* Lowest firmware API version supported */
58#define IWL6000_UCODE_API_MIN 4 60#define IWL6000_UCODE_API_MIN 4
@@ -388,7 +390,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = {
388#define IWL_DEVICE_6030 \ 390#define IWL_DEVICE_6030 \
389 .fw_name_pre = IWL6030_FW_PRE, \ 391 .fw_name_pre = IWL6030_FW_PRE, \
390 .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ 392 .ucode_api_max = IWL6000G2_UCODE_API_MAX, \
391 .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ 393 .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \
392 .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ 394 .ucode_api_min = IWL6000G2_UCODE_API_MIN, \
393 .max_inst_size = IWL60_RTC_INST_SIZE, \ 395 .max_inst_size = IWL60_RTC_INST_SIZE, \
394 .max_data_size = IWL60_RTC_DATA_SIZE, \ 396 .max_data_size = IWL60_RTC_DATA_SIZE, \
@@ -557,6 +559,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = {
557}; 559};
558 560
559MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); 561MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK));
560MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); 562MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK));
561MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); 563MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK));
562MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); 564MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index f4b84d1596e3..22474608a70b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -773,8 +773,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
773 struct sk_buff *skb; 773 struct sk_buff *skb;
774 __le16 fc = hdr->frame_control; 774 __le16 fc = hdr->frame_control;
775 struct iwl_rxon_context *ctx; 775 struct iwl_rxon_context *ctx;
776 struct page *p; 776 unsigned int hdrlen, fraglen;
777 int offset;
778 777
779 /* We only process data packets if the interface is open */ 778 /* We only process data packets if the interface is open */
780 if (unlikely(!priv->is_open)) { 779 if (unlikely(!priv->is_open)) {
@@ -788,16 +787,24 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
788 iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) 787 iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats))
789 return; 788 return;
790 789
791 skb = dev_alloc_skb(128); 790 /* Dont use dev_alloc_skb(), we'll have enough headroom once
791 * ieee80211_hdr pulled.
792 */
793 skb = alloc_skb(128, GFP_ATOMIC);
792 if (!skb) { 794 if (!skb) {
793 IWL_ERR(priv, "dev_alloc_skb failed\n"); 795 IWL_ERR(priv, "alloc_skb failed\n");
794 return; 796 return;
795 } 797 }
798 hdrlen = min_t(unsigned int, len, skb_tailroom(skb));
799 memcpy(skb_put(skb, hdrlen), hdr, hdrlen);
800 fraglen = len - hdrlen;
796 801
797 offset = (void *)hdr - rxb_addr(rxb); 802 if (fraglen) {
798 p = rxb_steal_page(rxb); 803 int offset = (void *)hdr + hdrlen - rxb_addr(rxb);
799 skb_add_rx_frag(skb, 0, p, offset, len, len);
800 804
805 skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset,
806 fraglen, rxb->truesize);
807 }
801 iwl_update_stats(priv, false, fc, len); 808 iwl_update_stats(priv, false, fc, len);
802 809
803 /* 810 /*
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index f1226dbf789d..2a9a16f901c3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -863,7 +863,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
863 863
864void iwlagn_prepare_restart(struct iwl_priv *priv) 864void iwlagn_prepare_restart(struct iwl_priv *priv)
865{ 865{
866 struct iwl_rxon_context *ctx;
867 bool bt_full_concurrent; 866 bool bt_full_concurrent;
868 u8 bt_ci_compliance; 867 u8 bt_ci_compliance;
869 u8 bt_load; 868 u8 bt_load;
@@ -872,8 +871,6 @@ void iwlagn_prepare_restart(struct iwl_priv *priv)
872 871
873 lockdep_assert_held(&priv->mutex); 872 lockdep_assert_held(&priv->mutex);
874 873
875 for_each_context(priv, ctx)
876 ctx->vif = NULL;
877 priv->is_open = 0; 874 priv->is_open = 0;
878 875
879 /* 876 /*
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
index 90208094b8eb..74bce97a8600 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
@@ -104,15 +104,29 @@
104 * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 104 * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04
105 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte 105 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte
106 * aligned (address bits 0-7 must be 0). 106 * aligned (address bits 0-7 must be 0).
107 * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers
108 * for them are in different places.
107 * 109 *
108 * Bit fields in each pointer register: 110 * Bit fields in each pointer register:
109 * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned 111 * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned
110 */ 112 */
111#define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) 113#define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0)
112#define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) 114#define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10)
113 115#define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0)
114/* Find TFD CB base pointer for given queue (range 0-15). */ 116#define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00)
115#define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) 117#define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20)
118#define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80)
119
120/* Find TFD CB base pointer for given queue */
121static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl)
122{
123 if (chnl < 16)
124 return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl;
125 if (chnl < 20)
126 return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16);
127 WARN_ON_ONCE(chnl >= 32);
128 return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20);
129}
116 130
117 131
118/** 132/**
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index b6805f8e9a01..c24a7134a6f9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -1244,6 +1244,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
1244 struct iwl_rxon_context *tmp, *ctx = NULL; 1244 struct iwl_rxon_context *tmp, *ctx = NULL;
1245 int err; 1245 int err;
1246 enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); 1246 enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif);
1247 bool reset = false;
1247 1248
1248 IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", 1249 IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n",
1249 viftype, vif->addr); 1250 viftype, vif->addr);
@@ -1265,6 +1266,13 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
1265 tmp->interface_modes | tmp->exclusive_interface_modes; 1266 tmp->interface_modes | tmp->exclusive_interface_modes;
1266 1267
1267 if (tmp->vif) { 1268 if (tmp->vif) {
1269 /* On reset we need to add the same interface again */
1270 if (tmp->vif == vif) {
1271 reset = true;
1272 ctx = tmp;
1273 break;
1274 }
1275
1268 /* check if this busy context is exclusive */ 1276 /* check if this busy context is exclusive */
1269 if (tmp->exclusive_interface_modes & 1277 if (tmp->exclusive_interface_modes &
1270 BIT(tmp->vif->type)) { 1278 BIT(tmp->vif->type)) {
@@ -1291,7 +1299,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
1291 ctx->vif = vif; 1299 ctx->vif = vif;
1292 1300
1293 err = iwl_setup_interface(priv, ctx); 1301 err = iwl_setup_interface(priv, ctx);
1294 if (!err) 1302 if (!err || reset)
1295 goto out; 1303 goto out;
1296 1304
1297 ctx->vif = NULL; 1305 ctx->vif = NULL;
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
index 75dc20bd965b..3b1069290fa9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
@@ -223,12 +223,33 @@
223#define SCD_AIT (SCD_BASE + 0x0c) 223#define SCD_AIT (SCD_BASE + 0x0c)
224#define SCD_TXFACT (SCD_BASE + 0x10) 224#define SCD_TXFACT (SCD_BASE + 0x10)
225#define SCD_ACTIVE (SCD_BASE + 0x14) 225#define SCD_ACTIVE (SCD_BASE + 0x14)
226#define SCD_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4)
227#define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4)
228#define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) 226#define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8)
229#define SCD_AGGR_SEL (SCD_BASE + 0x248) 227#define SCD_AGGR_SEL (SCD_BASE + 0x248)
230#define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) 228#define SCD_INTERRUPT_MASK (SCD_BASE + 0x108)
231#define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4) 229
230static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl)
231{
232 if (chnl < 20)
233 return SCD_BASE + 0x18 + chnl * 4;
234 WARN_ON_ONCE(chnl >= 32);
235 return SCD_BASE + 0x284 + (chnl - 20) * 4;
236}
237
238static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl)
239{
240 if (chnl < 20)
241 return SCD_BASE + 0x68 + chnl * 4;
242 WARN_ON_ONCE(chnl >= 32);
243 return SCD_BASE + 0x2B4 + (chnl - 20) * 4;
244}
245
246static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl)
247{
248 if (chnl < 20)
249 return SCD_BASE + 0x10c + chnl * 4;
250 WARN_ON_ONCE(chnl >= 32);
251 return SCD_BASE + 0x384 + (chnl - 20) * 4;
252}
232 253
233/*********************** END TX SCHEDULER *************************************/ 254/*********************** END TX SCHEDULER *************************************/
234 255
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 8b1a7988e176..aa7aea168138 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -374,8 +374,9 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
374 if (WARN_ON(!rxb)) 374 if (WARN_ON(!rxb))
375 return; 375 return;
376 376
377 rxcb.truesize = PAGE_SIZE << hw_params(trans).rx_page_order;
377 dma_unmap_page(trans->dev, rxb->page_dma, 378 dma_unmap_page(trans->dev, rxb->page_dma,
378 PAGE_SIZE << hw_params(trans).rx_page_order, 379 rxcb.truesize,
379 DMA_FROM_DEVICE); 380 DMA_FROM_DEVICE);
380 381
381 rxcb._page = rxb->page; 382 rxcb._page = rxb->page;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 0c81cbaa8088..fdf97886a5e4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -260,6 +260,7 @@ static inline void iwl_free_resp(struct iwl_host_cmd *cmd)
260 260
261struct iwl_rx_cmd_buffer { 261struct iwl_rx_cmd_buffer {
262 struct page *_page; 262 struct page *_page;
263 unsigned int truesize;
263}; 264};
264 265
265static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r) 266static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r)
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 3fa1ecebadfd..2fa879b015b6 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -103,7 +103,7 @@ static const u32 cipher_suites[] = {
103 * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 103 * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1
104 * in the firmware spec 104 * in the firmware spec
105 */ 105 */
106static u8 lbs_auth_to_authtype(enum nl80211_auth_type auth_type) 106static int lbs_auth_to_authtype(enum nl80211_auth_type auth_type)
107{ 107{
108 int ret = -ENOTSUPP; 108 int ret = -ENOTSUPP;
109 109
@@ -1411,7 +1411,12 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
1411 goto done; 1411 goto done;
1412 } 1412 }
1413 1413
1414 lbs_set_authtype(priv, sme); 1414 ret = lbs_set_authtype(priv, sme);
1415 if (ret == -ENOTSUPP) {
1416 wiphy_err(wiphy, "unsupported authtype 0x%x\n", sme->auth_type);
1417 goto done;
1418 }
1419
1415 lbs_set_radio(priv, preamble, 1); 1420 lbs_set_radio(priv, preamble, 1);
1416 1421
1417 /* Do the actual association */ 1422 /* Do the actual association */
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h
index 445ff21772e2..2f218f9a3fd3 100644
--- a/drivers/net/wireless/mwifiex/pcie.h
+++ b/drivers/net/wireless/mwifiex/pcie.h
@@ -48,15 +48,15 @@
48#define PCIE_HOST_INT_STATUS_MASK 0xC3C 48#define PCIE_HOST_INT_STATUS_MASK 0xC3C
49#define PCIE_SCRATCH_2_REG 0xC40 49#define PCIE_SCRATCH_2_REG 0xC40
50#define PCIE_SCRATCH_3_REG 0xC44 50#define PCIE_SCRATCH_3_REG 0xC44
51#define PCIE_SCRATCH_4_REG 0xCC0 51#define PCIE_SCRATCH_4_REG 0xCD0
52#define PCIE_SCRATCH_5_REG 0xCC4 52#define PCIE_SCRATCH_5_REG 0xCD4
53#define PCIE_SCRATCH_6_REG 0xCC8 53#define PCIE_SCRATCH_6_REG 0xCD8
54#define PCIE_SCRATCH_7_REG 0xCCC 54#define PCIE_SCRATCH_7_REG 0xCDC
55#define PCIE_SCRATCH_8_REG 0xCD0 55#define PCIE_SCRATCH_8_REG 0xCE0
56#define PCIE_SCRATCH_9_REG 0xCD4 56#define PCIE_SCRATCH_9_REG 0xCE4
57#define PCIE_SCRATCH_10_REG 0xCD8 57#define PCIE_SCRATCH_10_REG 0xCE8
58#define PCIE_SCRATCH_11_REG 0xCDC 58#define PCIE_SCRATCH_11_REG 0xCEC
59#define PCIE_SCRATCH_12_REG 0xCE0 59#define PCIE_SCRATCH_12_REG 0xCF0
60 60
61#define CPU_INTR_DNLD_RDY BIT(0) 61#define CPU_INTR_DNLD_RDY BIT(0)
62#define CPU_INTR_DOOR_BELL BIT(1) 62#define CPU_INTR_DOOR_BELL BIT(1)
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index fc9901e027c1..90cc5e772650 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1062,11 +1062,6 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1062 1062
1063 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); 1063 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
1064 1064
1065 /*
1066 * Register the extra components.
1067 */
1068 rt2x00rfkill_register(rt2x00dev);
1069
1070 return 0; 1065 return 0;
1071} 1066}
1072 1067
@@ -1210,6 +1205,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1210 rt2x00link_register(rt2x00dev); 1205 rt2x00link_register(rt2x00dev);
1211 rt2x00leds_register(rt2x00dev); 1206 rt2x00leds_register(rt2x00dev);
1212 rt2x00debug_register(rt2x00dev); 1207 rt2x00debug_register(rt2x00dev);
1208 rt2x00rfkill_register(rt2x00dev);
1213 1209
1214 return 0; 1210 return 0;
1215 1211
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 510023554e5f..e54488db0e10 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -838,7 +838,10 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
838 __le16 fc = hdr->frame_control; 838 __le16 fc = hdr->frame_control;
839 839
840 txrate = ieee80211_get_tx_rate(hw, info); 840 txrate = ieee80211_get_tx_rate(hw, info);
841 tcb_desc->hw_rate = txrate->hw_value; 841 if (txrate)
842 tcb_desc->hw_rate = txrate->hw_value;
843 else
844 tcb_desc->hw_rate = 0;
842 845
843 if (ieee80211_is_data(fc)) { 846 if (ieee80211_is_data(fc)) {
844 /* 847 /*
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 07dd38efe62a..67f9430ee197 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -912,8 +912,13 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
912 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); 912 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
913 ring = &rtlpci->tx_ring[BEACON_QUEUE]; 913 ring = &rtlpci->tx_ring[BEACON_QUEUE];
914 pskb = __skb_dequeue(&ring->queue); 914 pskb = __skb_dequeue(&ring->queue);
915 if (pskb) 915 if (pskb) {
916 struct rtl_tx_desc *entry = &ring->desc[ring->idx];
917 pci_unmap_single(rtlpci->pdev, rtlpriv->cfg->ops->get_desc(
918 (u8 *) entry, true, HW_DESC_TXBUFF_ADDR),
919 pskb->len, PCI_DMA_TODEVICE);
916 kfree_skb(pskb); 920 kfree_skb(pskb);
921 }
917 922
918 /*NB: the beacon data buffer must be 32-bit aligned. */ 923 /*NB: the beacon data buffer must be 32-bit aligned. */
919 pskb = ieee80211_beacon_get(hw, mac->vif); 924 pskb = ieee80211_beacon_get(hw, mac->vif);
@@ -1846,14 +1851,6 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1846 /*like read eeprom and so on */ 1851 /*like read eeprom and so on */
1847 rtlpriv->cfg->ops->read_eeprom_info(hw); 1852 rtlpriv->cfg->ops->read_eeprom_info(hw);
1848 1853
1849 if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
1850 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
1851 err = -ENODEV;
1852 goto fail3;
1853 }
1854
1855 rtlpriv->cfg->ops->init_sw_leds(hw);
1856
1857 /*aspm */ 1854 /*aspm */
1858 rtl_pci_init_aspm(hw); 1855 rtl_pci_init_aspm(hw);
1859 1856
@@ -1872,6 +1869,14 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1872 goto fail3; 1869 goto fail3;
1873 } 1870 }
1874 1871
1872 if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
1873 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
1874 err = -ENODEV;
1875 goto fail3;
1876 }
1877
1878 rtlpriv->cfg->ops->init_sw_leds(hw);
1879
1875 err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group); 1880 err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group);
1876 if (err) { 1881 if (err) {
1877 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1882 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
@@ -1936,6 +1941,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
1936 rtl_deinit_deferred_work(hw); 1941 rtl_deinit_deferred_work(hw);
1937 rtlpriv->intf_ops->adapter_stop(hw); 1942 rtlpriv->intf_ops->adapter_stop(hw);
1938 } 1943 }
1944 rtlpriv->cfg->ops->disable_interrupt(hw);
1939 1945
1940 /*deinit rfkill */ 1946 /*deinit rfkill */
1941 rtl_deinit_rfkill(hw); 1947 rtl_deinit_rfkill(hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
index 4898c502974d..480862c07f92 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
@@ -91,7 +91,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
91 u8 tid; 91 u8 tid;
92 struct rtl_priv *rtlpriv = rtl_priv(hw); 92 struct rtl_priv *rtlpriv = rtl_priv(hw);
93 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 93 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
94 static int header_print;
95 94
96 rtlpriv->dm.dm_initialgain_enable = true; 95 rtlpriv->dm.dm_initialgain_enable = true;
97 rtlpriv->dm.dm_flag = 0; 96 rtlpriv->dm.dm_flag = 0;
@@ -171,10 +170,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
171 for (tid = 0; tid < 8; tid++) 170 for (tid = 0; tid < 8; tid++)
172 skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); 171 skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]);
173 172
174 /* Only load firmware for first MAC */
175 if (header_print)
176 return 0;
177
178 /* for firmware buf */ 173 /* for firmware buf */
179 rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); 174 rtlpriv->rtlhal.pfirmware = vzalloc(0x8000);
180 if (!rtlpriv->rtlhal.pfirmware) { 175 if (!rtlpriv->rtlhal.pfirmware) {
@@ -186,7 +181,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
186 rtlpriv->max_fw_size = 0x8000; 181 rtlpriv->max_fw_size = 0x8000;
187 pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); 182 pr_info("Driver for Realtek RTL8192DE WLAN interface\n");
188 pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); 183 pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
189 header_print++;
190 184
191 /* request fw */ 185 /* request fw */
192 err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, 186 err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 2e1e352864bb..a6049d7d51b3 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -124,46 +124,38 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
124 return status; 124 return status;
125} 125}
126 126
127static u32 _usb_read_sync(struct usb_device *udev, u32 addr, u16 len) 127static u32 _usb_read_sync(struct rtl_priv *rtlpriv, u32 addr, u16 len)
128{ 128{
129 struct device *dev = rtlpriv->io.dev;
130 struct usb_device *udev = to_usb_device(dev);
129 u8 request; 131 u8 request;
130 u16 wvalue; 132 u16 wvalue;
131 u16 index; 133 u16 index;
132 u32 *data; 134 __le32 *data = &rtlpriv->usb_data[rtlpriv->usb_data_index];
133 u32 ret;
134 135
135 data = kmalloc(sizeof(u32), GFP_KERNEL);
136 if (!data)
137 return -ENOMEM;
138 request = REALTEK_USB_VENQT_CMD_REQ; 136 request = REALTEK_USB_VENQT_CMD_REQ;
139 index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ 137 index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */
140 138
141 wvalue = (u16)addr; 139 wvalue = (u16)addr;
142 _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); 140 _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len);
143 ret = le32_to_cpu(*data); 141 if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT)
144 kfree(data); 142 rtlpriv->usb_data_index = 0;
145 return ret; 143 return le32_to_cpu(*data);
146} 144}
147 145
148static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) 146static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr)
149{ 147{
150 struct device *dev = rtlpriv->io.dev; 148 return (u8)_usb_read_sync(rtlpriv, addr, 1);
151
152 return (u8)_usb_read_sync(to_usb_device(dev), addr, 1);
153} 149}
154 150
155static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) 151static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr)
156{ 152{
157 struct device *dev = rtlpriv->io.dev; 153 return (u16)_usb_read_sync(rtlpriv, addr, 2);
158
159 return (u16)_usb_read_sync(to_usb_device(dev), addr, 2);
160} 154}
161 155
162static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) 156static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr)
163{ 157{
164 struct device *dev = rtlpriv->io.dev; 158 return _usb_read_sync(rtlpriv, addr, 4);
165
166 return _usb_read_sync(to_usb_device(dev), addr, 4);
167} 159}
168 160
169static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, 161static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val,
@@ -955,6 +947,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
955 return -ENOMEM; 947 return -ENOMEM;
956 } 948 }
957 rtlpriv = hw->priv; 949 rtlpriv = hw->priv;
950 rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32),
951 GFP_KERNEL);
952 if (!rtlpriv->usb_data)
953 return -ENOMEM;
954 rtlpriv->usb_data_index = 0;
958 init_completion(&rtlpriv->firmware_loading_complete); 955 init_completion(&rtlpriv->firmware_loading_complete);
959 SET_IEEE80211_DEV(hw, &intf->dev); 956 SET_IEEE80211_DEV(hw, &intf->dev);
960 udev = interface_to_usbdev(intf); 957 udev = interface_to_usbdev(intf);
@@ -974,11 +971,6 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
974 rtlpriv->cfg->ops->read_chip_version(hw); 971 rtlpriv->cfg->ops->read_chip_version(hw);
975 /*like read eeprom and so on */ 972 /*like read eeprom and so on */
976 rtlpriv->cfg->ops->read_eeprom_info(hw); 973 rtlpriv->cfg->ops->read_eeprom_info(hw);
977 if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
978 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
979 goto error_out;
980 }
981 rtlpriv->cfg->ops->init_sw_leds(hw);
982 err = _rtl_usb_init(hw); 974 err = _rtl_usb_init(hw);
983 if (err) 975 if (err)
984 goto error_out; 976 goto error_out;
@@ -990,6 +982,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
990 "Can't allocate sw for mac80211\n"); 982 "Can't allocate sw for mac80211\n");
991 goto error_out; 983 goto error_out;
992 } 984 }
985 if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
986 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
987 goto error_out;
988 }
989 rtlpriv->cfg->ops->init_sw_leds(hw);
993 990
994 return 0; 991 return 0;
995error_out: 992error_out:
@@ -1025,6 +1022,7 @@ void rtl_usb_disconnect(struct usb_interface *intf)
1025 /* rtl_deinit_rfkill(hw); */ 1022 /* rtl_deinit_rfkill(hw); */
1026 rtl_usb_deinit(hw); 1023 rtl_usb_deinit(hw);
1027 rtl_deinit_core(hw); 1024 rtl_deinit_core(hw);
1025 kfree(rtlpriv->usb_data);
1028 rtlpriv->cfg->ops->deinit_sw_leds(hw); 1026 rtlpriv->cfg->ops->deinit_sw_leds(hw);
1029 rtlpriv->cfg->ops->deinit_sw_vars(hw); 1027 rtlpriv->cfg->ops->deinit_sw_vars(hw);
1030 _rtl_usb_io_handler_release(hw); 1028 _rtl_usb_io_handler_release(hw);
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index b591614c3b9b..28ebc69218a3 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -67,7 +67,7 @@
67#define QOS_QUEUE_NUM 4 67#define QOS_QUEUE_NUM 4
68#define RTL_MAC80211_NUM_QUEUE 5 68#define RTL_MAC80211_NUM_QUEUE 5
69#define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 69#define REALTEK_USB_VENQT_MAX_BUF_SIZE 254
70 70#define RTL_USB_MAX_RX_COUNT 100
71#define QBSS_LOAD_SIZE 5 71#define QBSS_LOAD_SIZE 5
72#define MAX_WMMELE_LENGTH 64 72#define MAX_WMMELE_LENGTH 64
73 73
@@ -1629,6 +1629,10 @@ struct rtl_priv {
1629 interface or hardware */ 1629 interface or hardware */
1630 unsigned long status; 1630 unsigned long status;
1631 1631
1632 /* data buffer pointer for USB reads */
1633 __le32 *usb_data;
1634 int usb_data_index;
1635
1632 /*This must be the last item so 1636 /*This must be the last item so
1633 that it points to the data allocated 1637 that it points to the data allocated
1634 beyond this structure like: 1638 beyond this structure like:
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
index 41302c7b1ad0..d1afb8e3b2ef 100644
--- a/drivers/net/wireless/wl1251/main.c
+++ b/drivers/net/wireless/wl1251/main.c
@@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
479 cancel_work_sync(&wl->irq_work); 479 cancel_work_sync(&wl->irq_work);
480 cancel_work_sync(&wl->tx_work); 480 cancel_work_sync(&wl->tx_work);
481 cancel_work_sync(&wl->filter_work); 481 cancel_work_sync(&wl->filter_work);
482 cancel_delayed_work_sync(&wl->elp_work);
482 483
483 mutex_lock(&wl->mutex); 484 mutex_lock(&wl->mutex);
484 485
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
index f78694295c39..1b851f650e07 100644
--- a/drivers/net/wireless/wl1251/sdio.c
+++ b/drivers/net/wireless/wl1251/sdio.c
@@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func)
315 315
316 if (wl->irq) 316 if (wl->irq)
317 free_irq(wl->irq, wl); 317 free_irq(wl->irq, wl);
318 kfree(wl_sdio);
319 wl1251_free_hw(wl); 318 wl1251_free_hw(wl);
319 kfree(wl_sdio);
320 320
321 sdio_claim_host(func); 321 sdio_claim_host(func);
322 sdio_release_irq(func); 322 sdio_release_irq(func);