aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-24 11:27:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-24 11:27:32 -0400
commiteb3d33900aa953bcdfe132a71bb03ee592ebbb47 (patch)
tree020bf904e5d5e9b3106228514f925b041492df28 /drivers/net
parent514e250f67d2b2a8ab08dc9c3650af19a411c926 (diff)
parent950e2958a5e96406e6e5ff4190a638a54769f89b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "It's been a while since my last pull request so quite a few fixes have piled up." Indeed. 1) Fix nf_{log,queue} compilation with PROC_FS disabled, from Pablo Neira Ayuso. 2) Fix data corruption on some tg3 chips with TSO enabled, from Michael Chan. 3) Fix double insertion of VLAN tags in be2net driver, from Sarveshwar Bandi. 4) Don't have TCP's MD5 support pass > PAGE_SIZE page offsets in scatter-gather entries into the crypto layer, the crypto layer can't handle that. From Eric Dumazet. 5) Fix lockdep splat in 802.1Q MRP code, also from Eric Dumazet. 6) Fix OOPS in netfilter log module when called from conntrack, from Hans Schillstrom. 7) FEC driver needs to use netif_tx_{lock,unlock}_bh() rather than the non-BH disabling variants. From Fabio Estevam. 8) TCP GSO can generate out-of-order packets, fix from Eric Dumazet. 9) vxlan driver doesn't update 'used' field of fdb entries when it should, from Sridhar Samudrala. 10) ipv6 should use kzalloc() to allocate inet6 socket cork options, otherwise we can OOPS in ip6_cork_release(). From Eric Dumazet. 11) Fix races in bonding set mode, from Nikolay Aleksandrov. 12) Fix checksum generation regression added by "r8169: fix 8168evl frame padding.", from Francois Romieu. 13) ip_gre can look at stale SKB data pointer, fix from Eric Dumazet. 14) Fix checksum handling when GSO is enabled in bnx2x driver with certain chips, from Yuval Mintz. 15) Fix double free in batman-adv, from Martin Hundebøll. 16) Fix device startup synchronization with firmware in tg3 driver, from Nithin Sujit. 17) perf networking dropmonitor doesn't work at all due to mixed up trace parameter ordering, from Ben Hutchings. 18) Fix proportional rate reduction handling in tcp_ack(), from Nandita Dukkipati. 19) IPSEC layer doesn't return an error when a valid state is detected, causing an OOPS. Fix from Timo Teräs. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (85 commits) be2net: bug fix on returning an invalid nic descriptor tcp: xps: fix reordering issues net: Revert unused variable changes. xfrm: properly handle invalid states as an error virtio_net: enable napi for all possible queues during open tcp: bug fix in proportional rate reduction. net: ethernet: sun: drop unused variable net: ethernet: korina: drop unused variable net: ethernet: apple: drop unused variable qmi_wwan: Added support for Cinterion's PLxx WWAN Interface perf: net_dropmonitor: Remove progress indicator perf: net_dropmonitor: Use bisection in symbol lookup perf: net_dropmonitor: Do not assume ordering of dictionaries perf: net_dropmonitor: Fix symbol-relative addresses perf: net_dropmonitor: Fix trace parameter order net: fec: use a more proper compatible string for MVF type device qlcnic: Fix updating netdev->features qlcnic: remove netdev->trans_start updates within the driver qlcnic: Return proper error codes from probe failure paths tg3: Update version to 3.132 ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_3ad.c21
-rw-r--r--drivers/net/bonding/bond_3ad.h2
-rw-r--r--drivers/net/bonding/bond_main.c26
-rw-r--r--drivers/net/bonding/bond_procfs.c2
-rw-r--r--drivers/net/bonding/bond_sysfs.c13
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c9
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c61
-rw-r--r--drivers/net/ethernet/cadence/macb.c18
-rw-r--r--drivers/net/ethernet/cadence/macb.h7
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c13
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c18
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c14
-rw-r--r--drivers/net/ethernet/freescale/gianfar_ptp.c1
-rw-r--r--drivers/net/ethernet/icplus/ipg.h86
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c6
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic.h6
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c49
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c65
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c1
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c3
-rw-r--r--drivers/net/ethernet/realtek/8139cp.c1
-rw-r--r--drivers/net/ethernet/realtek/r8169.c41
-rw-r--r--drivers/net/ethernet/sfc/efx.c8
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h31
-rw-r--r--drivers/net/ethernet/sfc/rx.c8
-rw-r--r--drivers/net/usb/qmi_wwan.c1
-rw-r--r--drivers/net/usb/rtl8150.c100
-rw-r--r--drivers/net/virtio_net.c9
-rw-r--r--drivers/net/vxlan.c17
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9485_initvals.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h5
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c74
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c7
-rw-r--r--drivers/net/wireless/iwlegacy/common.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api.h27
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c12
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c17
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/scan.c6
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c13
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.h2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c48
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/trx.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c1
52 files changed, 569 insertions, 342 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index fc58d118d844..390061d09693 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2360,14 +2360,15 @@ int bond_3ad_set_carrier(struct bonding *bond)
2360} 2360}
2361 2361
2362/** 2362/**
2363 * bond_3ad_get_active_agg_info - get information of the active aggregator 2363 * __bond_3ad_get_active_agg_info - get information of the active aggregator
2364 * @bond: bonding struct to work on 2364 * @bond: bonding struct to work on
2365 * @ad_info: ad_info struct to fill with the bond's info 2365 * @ad_info: ad_info struct to fill with the bond's info
2366 * 2366 *
2367 * Returns: 0 on success 2367 * Returns: 0 on success
2368 * < 0 on error 2368 * < 0 on error
2369 */ 2369 */
2370int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) 2370int __bond_3ad_get_active_agg_info(struct bonding *bond,
2371 struct ad_info *ad_info)
2371{ 2372{
2372 struct aggregator *aggregator = NULL; 2373 struct aggregator *aggregator = NULL;
2373 struct port *port; 2374 struct port *port;
@@ -2391,6 +2392,18 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
2391 return -1; 2392 return -1;
2392} 2393}
2393 2394
2395/* Wrapper used to hold bond->lock so no slave manipulation can occur */
2396int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
2397{
2398 int ret;
2399
2400 read_lock(&bond->lock);
2401 ret = __bond_3ad_get_active_agg_info(bond, ad_info);
2402 read_unlock(&bond->lock);
2403
2404 return ret;
2405}
2406
2394int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) 2407int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2395{ 2408{
2396 struct slave *slave, *start_at; 2409 struct slave *slave, *start_at;
@@ -2402,8 +2415,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2402 struct ad_info ad_info; 2415 struct ad_info ad_info;
2403 int res = 1; 2416 int res = 1;
2404 2417
2405 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { 2418 if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
2406 pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", 2419 pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n",
2407 dev->name); 2420 dev->name);
2408 goto out; 2421 goto out;
2409 } 2422 }
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
index 0cfaa4afdece..5d91ad0cc041 100644
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -273,6 +273,8 @@ void bond_3ad_adapter_speed_changed(struct slave *slave);
273void bond_3ad_adapter_duplex_changed(struct slave *slave); 273void 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_get_active_agg_info(struct bonding *bond,
277 struct ad_info *ad_info);
276int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); 278int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
277int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, 279int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
278 struct slave *slave); 280 struct slave *slave);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d0aade04e49a..29b846cbfb48 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1362,6 +1362,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
1362 slave->dev->features, 1362 slave->dev->features,
1363 mask); 1363 mask);
1364 } 1364 }
1365 features = netdev_add_tso_features(features, mask);
1365 1366
1366out: 1367out:
1367 read_unlock(&bond->lock); 1368 read_unlock(&bond->lock);
@@ -2555,8 +2556,8 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_
2555{ 2556{
2556 struct sk_buff *skb; 2557 struct sk_buff *skb;
2557 2558
2558 pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, 2559 pr_debug("arp %d on slave %s: dst %pI4 src %pI4 vid %d\n", arp_op,
2559 slave_dev->name, dest_ip, src_ip, vlan_id); 2560 slave_dev->name, &dest_ip, &src_ip, vlan_id);
2560 2561
2561 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, 2562 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip,
2562 NULL, slave_dev->dev_addr, NULL); 2563 NULL, slave_dev->dev_addr, NULL);
@@ -2588,7 +2589,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2588 __be32 addr; 2589 __be32 addr;
2589 if (!targets[i]) 2590 if (!targets[i])
2590 break; 2591 break;
2591 pr_debug("basa: target %x\n", targets[i]); 2592 pr_debug("basa: target %pI4\n", &targets[i]);
2592 if (!bond_vlan_used(bond)) { 2593 if (!bond_vlan_used(bond)) {
2593 pr_debug("basa: empty vlan: arp_send\n"); 2594 pr_debug("basa: empty vlan: arp_send\n");
2594 addr = bond_confirm_addr(bond->dev, targets[i], 0); 2595 addr = bond_confirm_addr(bond->dev, targets[i], 0);
@@ -4470,7 +4471,7 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
4470 4471
4471static int bond_check_params(struct bond_params *params) 4472static int bond_check_params(struct bond_params *params)
4472{ 4473{
4473 int arp_validate_value, fail_over_mac_value, primary_reselect_value; 4474 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
4474 4475
4475 /* 4476 /*
4476 * Convert string parameters. 4477 * Convert string parameters.
@@ -4650,19 +4651,18 @@ static int bond_check_params(struct bond_params *params)
4650 arp_interval = BOND_LINK_ARP_INTERV; 4651 arp_interval = BOND_LINK_ARP_INTERV;
4651 } 4652 }
4652 4653
4653 for (arp_ip_count = 0; 4654 for (arp_ip_count = 0, i = 0;
4654 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[arp_ip_count]; 4655 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
4655 arp_ip_count++) {
4656 /* not complete check, but should be good enough to 4656 /* not complete check, but should be good enough to
4657 catch mistakes */ 4657 catch mistakes */
4658 __be32 ip = in_aton(arp_ip_target[arp_ip_count]); 4658 __be32 ip = in_aton(arp_ip_target[i]);
4659 if (!isdigit(arp_ip_target[arp_ip_count][0]) || 4659 if (!isdigit(arp_ip_target[i][0]) || ip == 0 ||
4660 ip == 0 || ip == htonl(INADDR_BROADCAST)) { 4660 ip == htonl(INADDR_BROADCAST)) {
4661 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", 4661 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
4662 arp_ip_target[arp_ip_count]); 4662 arp_ip_target[i]);
4663 arp_interval = 0; 4663 arp_interval = 0;
4664 } else { 4664 } else {
4665 arp_target[arp_ip_count] = ip; 4665 arp_target[arp_ip_count++] = ip;
4666 } 4666 }
4667 } 4667 }
4668 4668
@@ -4696,8 +4696,6 @@ static int bond_check_params(struct bond_params *params)
4696 if (miimon) { 4696 if (miimon) {
4697 pr_info("MII link monitoring set to %d ms\n", miimon); 4697 pr_info("MII link monitoring set to %d ms\n", miimon);
4698 } else if (arp_interval) { 4698 } else if (arp_interval) {
4699 int i;
4700
4701 pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", 4699 pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):",
4702 arp_interval, 4700 arp_interval,
4703 arp_validate_tbl[arp_validate_value].modename, 4701 arp_validate_tbl[arp_validate_value].modename,
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 94d06f1307b8..4060d41f0ee7 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -130,7 +130,7 @@ static void bond_info_show_master(struct seq_file *seq)
130 seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", 130 seq_printf(seq, "Aggregator selection policy (ad_select): %s\n",
131 ad_select_tbl[bond->params.ad_select].modename); 131 ad_select_tbl[bond->params.ad_select].modename);
132 132
133 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { 133 if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
134 seq_printf(seq, "bond %s has no active aggregator\n", 134 seq_printf(seq, "bond %s has no active aggregator\n",
135 bond->dev->name); 135 bond->dev->name);
136 } else { 136 } else {
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ea7a388f4843..d7434e0a610e 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -316,6 +316,9 @@ static ssize_t bonding_store_mode(struct device *d,
316 int new_value, ret = count; 316 int new_value, ret = count;
317 struct bonding *bond = to_bond(d); 317 struct bonding *bond = to_bond(d);
318 318
319 if (!rtnl_trylock())
320 return restart_syscall();
321
319 if (bond->dev->flags & IFF_UP) { 322 if (bond->dev->flags & IFF_UP) {
320 pr_err("unable to update mode of %s because interface is up.\n", 323 pr_err("unable to update mode of %s because interface is up.\n",
321 bond->dev->name); 324 bond->dev->name);
@@ -352,6 +355,7 @@ static ssize_t bonding_store_mode(struct device *d,
352 bond->dev->name, bond_mode_tbl[new_value].modename, 355 bond->dev->name, bond_mode_tbl[new_value].modename,
353 new_value); 356 new_value);
354out: 357out:
358 rtnl_unlock();
355 return ret; 359 return ret;
356} 360}
357static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, 361static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR,
@@ -1315,7 +1319,6 @@ static ssize_t bonding_show_mii_status(struct device *d,
1315} 1319}
1316static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); 1320static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL);
1317 1321
1318
1319/* 1322/*
1320 * Show current 802.3ad aggregator ID. 1323 * Show current 802.3ad aggregator ID.
1321 */ 1324 */
@@ -1329,7 +1332,7 @@ static ssize_t bonding_show_ad_aggregator(struct device *d,
1329 if (bond->params.mode == BOND_MODE_8023AD) { 1332 if (bond->params.mode == BOND_MODE_8023AD) {
1330 struct ad_info ad_info; 1333 struct ad_info ad_info;
1331 count = sprintf(buf, "%d\n", 1334 count = sprintf(buf, "%d\n",
1332 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1335 bond_3ad_get_active_agg_info(bond, &ad_info)
1333 ? 0 : ad_info.aggregator_id); 1336 ? 0 : ad_info.aggregator_id);
1334 } 1337 }
1335 1338
@@ -1351,7 +1354,7 @@ static ssize_t bonding_show_ad_num_ports(struct device *d,
1351 if (bond->params.mode == BOND_MODE_8023AD) { 1354 if (bond->params.mode == BOND_MODE_8023AD) {
1352 struct ad_info ad_info; 1355 struct ad_info ad_info;
1353 count = sprintf(buf, "%d\n", 1356 count = sprintf(buf, "%d\n",
1354 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1357 bond_3ad_get_active_agg_info(bond, &ad_info)
1355 ? 0 : ad_info.ports); 1358 ? 0 : ad_info.ports);
1356 } 1359 }
1357 1360
@@ -1373,7 +1376,7 @@ static ssize_t bonding_show_ad_actor_key(struct device *d,
1373 if (bond->params.mode == BOND_MODE_8023AD) { 1376 if (bond->params.mode == BOND_MODE_8023AD) {
1374 struct ad_info ad_info; 1377 struct ad_info ad_info;
1375 count = sprintf(buf, "%d\n", 1378 count = sprintf(buf, "%d\n",
1376 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1379 bond_3ad_get_active_agg_info(bond, &ad_info)
1377 ? 0 : ad_info.actor_key); 1380 ? 0 : ad_info.actor_key);
1378 } 1381 }
1379 1382
@@ -1395,7 +1398,7 @@ static ssize_t bonding_show_ad_partner_key(struct device *d,
1395 if (bond->params.mode == BOND_MODE_8023AD) { 1398 if (bond->params.mode == BOND_MODE_8023AD) {
1396 struct ad_info ad_info; 1399 struct ad_info ad_info;
1397 count = sprintf(buf, "%d\n", 1400 count = sprintf(buf, "%d\n",
1398 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1401 bond_3ad_get_active_agg_info(bond, &ad_info)
1399 ? 0 : ad_info.partner_key); 1402 ? 0 : ad_info.partner_key);
1400 } 1403 }
1401 1404
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index b8fbe266ab68..be59ec4b2c30 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3313,6 +3313,7 @@ static void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, u32 *parsing_data,
3313 */ 3313 */
3314static void bnx2x_set_pbd_gso(struct sk_buff *skb, 3314static void bnx2x_set_pbd_gso(struct sk_buff *skb,
3315 struct eth_tx_parse_bd_e1x *pbd, 3315 struct eth_tx_parse_bd_e1x *pbd,
3316 struct eth_tx_start_bd *tx_start_bd,
3316 u32 xmit_type) 3317 u32 xmit_type)
3317{ 3318{
3318 pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 3319 pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
@@ -3326,11 +3327,14 @@ static void bnx2x_set_pbd_gso(struct sk_buff *skb,
3326 ip_hdr(skb)->daddr, 3327 ip_hdr(skb)->daddr,
3327 0, IPPROTO_TCP, 0)); 3328 0, IPPROTO_TCP, 0));
3328 3329
3329 } else 3330 /* GSO on 57710/57711 needs FW to calculate IP checksum */
3331 tx_start_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_IP_CSUM;
3332 } else {
3330 pbd->tcp_pseudo_csum = 3333 pbd->tcp_pseudo_csum =
3331 bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, 3334 bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
3332 &ipv6_hdr(skb)->daddr, 3335 &ipv6_hdr(skb)->daddr,
3333 0, IPPROTO_TCP, 0)); 3336 0, IPPROTO_TCP, 0));
3337 }
3334 3338
3335 pbd->global_data |= 3339 pbd->global_data |=
3336 cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN); 3340 cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN);
@@ -3814,7 +3818,8 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
3814 bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, 3818 bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data,
3815 xmit_type); 3819 xmit_type);
3816 else 3820 else
3817 bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); 3821 bnx2x_set_pbd_gso(skb, pbd_e1x, tx_start_bd,
3822 xmit_type);
3818 } 3823 }
3819 3824
3820 /* Set the PBD's parsing_data field if not zero 3825 /* Set the PBD's parsing_data field if not zero
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 728d42ab2a76..1f2dd928888a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
94 94
95#define DRV_MODULE_NAME "tg3" 95#define DRV_MODULE_NAME "tg3"
96#define TG3_MAJ_NUM 3 96#define TG3_MAJ_NUM 3
97#define TG3_MIN_NUM 131 97#define TG3_MIN_NUM 132
98#define DRV_MODULE_VERSION \ 98#define DRV_MODULE_VERSION \
99 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) 99 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
100#define DRV_MODULE_RELDATE "April 09, 2013" 100#define DRV_MODULE_RELDATE "May 21, 2013"
101 101
102#define RESET_KIND_SHUTDOWN 0 102#define RESET_KIND_SHUTDOWN 0
103#define RESET_KIND_INIT 1 103#define RESET_KIND_INIT 1
@@ -2957,6 +2957,31 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed)
2957 return 0; 2957 return 0;
2958} 2958}
2959 2959
2960static bool tg3_phy_power_bug(struct tg3 *tp)
2961{
2962 switch (tg3_asic_rev(tp)) {
2963 case ASIC_REV_5700:
2964 case ASIC_REV_5704:
2965 return true;
2966 case ASIC_REV_5780:
2967 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
2968 return true;
2969 return false;
2970 case ASIC_REV_5717:
2971 if (!tp->pci_fn)
2972 return true;
2973 return false;
2974 case ASIC_REV_5719:
2975 case ASIC_REV_5720:
2976 if ((tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
2977 !tp->pci_fn)
2978 return true;
2979 return false;
2980 }
2981
2982 return false;
2983}
2984
2960static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) 2985static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
2961{ 2986{
2962 u32 val; 2987 u32 val;
@@ -3016,12 +3041,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
3016 /* The PHY should not be powered down on some chips because 3041 /* The PHY should not be powered down on some chips because
3017 * of bugs. 3042 * of bugs.
3018 */ 3043 */
3019 if (tg3_asic_rev(tp) == ASIC_REV_5700 || 3044 if (tg3_phy_power_bug(tp))
3020 tg3_asic_rev(tp) == ASIC_REV_5704 ||
3021 (tg3_asic_rev(tp) == ASIC_REV_5780 &&
3022 (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) ||
3023 (tg3_asic_rev(tp) == ASIC_REV_5717 &&
3024 !tp->pci_fn))
3025 return; 3045 return;
3026 3046
3027 if (tg3_chip_rev(tp) == CHIPREV_5784_AX || 3047 if (tg3_chip_rev(tp) == CHIPREV_5784_AX ||
@@ -7428,6 +7448,20 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
7428 return (base > 0xffffdcc0) && (base + len + 8 < base); 7448 return (base > 0xffffdcc0) && (base + len + 8 < base);
7429} 7449}
7430 7450
7451/* Test for TSO DMA buffers that cross into regions which are within MSS bytes
7452 * of any 4GB boundaries: 4G, 8G, etc
7453 */
7454static inline int tg3_4g_tso_overflow_test(struct tg3 *tp, dma_addr_t mapping,
7455 u32 len, u32 mss)
7456{
7457 if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) {
7458 u32 base = (u32) mapping & 0xffffffff;
7459
7460 return ((base + len + (mss & 0x3fff)) < base);
7461 }
7462 return 0;
7463}
7464
7431/* Test for DMA addresses > 40-bit */ 7465/* Test for DMA addresses > 40-bit */
7432static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, 7466static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping,
7433 int len) 7467 int len)
@@ -7464,6 +7498,9 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
7464 if (tg3_4g_overflow_test(map, len)) 7498 if (tg3_4g_overflow_test(map, len))
7465 hwbug = true; 7499 hwbug = true;
7466 7500
7501 if (tg3_4g_tso_overflow_test(tp, map, len, mss))
7502 hwbug = true;
7503
7467 if (tg3_40bit_overflow_test(tp, map, len)) 7504 if (tg3_40bit_overflow_test(tp, map, len))
7468 hwbug = true; 7505 hwbug = true;
7469 7506
@@ -8874,6 +8911,10 @@ static int tg3_chip_reset(struct tg3 *tp)
8874 tg3_halt_cpu(tp, RX_CPU_BASE); 8911 tg3_halt_cpu(tp, RX_CPU_BASE);
8875 } 8912 }
8876 8913
8914 err = tg3_poll_fw(tp);
8915 if (err)
8916 return err;
8917
8877 tw32(GRC_MODE, tp->grc_mode); 8918 tw32(GRC_MODE, tp->grc_mode);
8878 8919
8879 if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { 8920 if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) {
@@ -8904,10 +8945,6 @@ static int tg3_chip_reset(struct tg3 *tp)
8904 8945
8905 tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); 8946 tg3_ape_unlock(tp, TG3_APE_LOCK_GRC);
8906 8947
8907 err = tg3_poll_fw(tp);
8908 if (err)
8909 return err;
8910
8911 tg3_mdio_start(tp); 8948 tg3_mdio_start(tp);
8912 8949
8913 if (tg3_flag(tp, PCI_EXPRESS) && 8950 if (tg3_flag(tp, PCI_EXPRESS) &&
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 6be513deb17f..c89aa41dd448 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -485,7 +485,8 @@ static void macb_tx_interrupt(struct macb *bp)
485 status = macb_readl(bp, TSR); 485 status = macb_readl(bp, TSR);
486 macb_writel(bp, TSR, status); 486 macb_writel(bp, TSR, status);
487 487
488 macb_writel(bp, ISR, MACB_BIT(TCOMP)); 488 if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
489 macb_writel(bp, ISR, MACB_BIT(TCOMP));
489 490
490 netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n", 491 netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n",
491 (unsigned long)status); 492 (unsigned long)status);
@@ -738,7 +739,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
738 * now. 739 * now.
739 */ 740 */
740 macb_writel(bp, IDR, MACB_RX_INT_FLAGS); 741 macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
741 macb_writel(bp, ISR, MACB_BIT(RCOMP)); 742 if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
743 macb_writel(bp, ISR, MACB_BIT(RCOMP));
742 744
743 if (napi_schedule_prep(&bp->napi)) { 745 if (napi_schedule_prep(&bp->napi)) {
744 netdev_vdbg(bp->dev, "scheduling RX softirq\n"); 746 netdev_vdbg(bp->dev, "scheduling RX softirq\n");
@@ -1062,6 +1064,17 @@ static void macb_configure_dma(struct macb *bp)
1062 } 1064 }
1063} 1065}
1064 1066
1067/*
1068 * Configure peripheral capacities according to integration options used
1069 */
1070static void macb_configure_caps(struct macb *bp)
1071{
1072 if (macb_is_gem(bp)) {
1073 if (GEM_BF(IRQCOR, gem_readl(bp, DCFG1)) == 0)
1074 bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE;
1075 }
1076}
1077
1065static void macb_init_hw(struct macb *bp) 1078static void macb_init_hw(struct macb *bp)
1066{ 1079{
1067 u32 config; 1080 u32 config;
@@ -1084,6 +1097,7 @@ static void macb_init_hw(struct macb *bp)
1084 bp->duplex = DUPLEX_HALF; 1097 bp->duplex = DUPLEX_HALF;
1085 1098
1086 macb_configure_dma(bp); 1099 macb_configure_dma(bp);
1100 macb_configure_caps(bp);
1087 1101
1088 /* Initialize TX and RX buffers */ 1102 /* Initialize TX and RX buffers */
1089 macb_writel(bp, RBQP, bp->rx_ring_dma); 1103 macb_writel(bp, RBQP, bp->rx_ring_dma);
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 993d70380688..548c0ecae869 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -300,6 +300,8 @@
300#define MACB_REV_SIZE 16 300#define MACB_REV_SIZE 16
301 301
302/* Bitfields in DCFG1. */ 302/* Bitfields in DCFG1. */
303#define GEM_IRQCOR_OFFSET 23
304#define GEM_IRQCOR_SIZE 1
303#define GEM_DBWDEF_OFFSET 25 305#define GEM_DBWDEF_OFFSET 25
304#define GEM_DBWDEF_SIZE 3 306#define GEM_DBWDEF_SIZE 3
305 307
@@ -323,6 +325,9 @@
323#define MACB_MAN_READ 2 325#define MACB_MAN_READ 2
324#define MACB_MAN_CODE 2 326#define MACB_MAN_CODE 2
325 327
328/* Capability mask bits */
329#define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x1
330
326/* Bit manipulation macros */ 331/* Bit manipulation macros */
327#define MACB_BIT(name) \ 332#define MACB_BIT(name) \
328 (1 << MACB_##name##_OFFSET) 333 (1 << MACB_##name##_OFFSET)
@@ -574,6 +579,8 @@ struct macb {
574 unsigned int speed; 579 unsigned int speed;
575 unsigned int duplex; 580 unsigned int duplex;
576 581
582 u32 caps;
583
577 phy_interface_t phy_interface; 584 phy_interface_t phy_interface;
578 585
579 /* AT91RM9200 transmit */ 586 /* AT91RM9200 transmit */
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index fd7b547698ab..a236ecd27cf3 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2976,22 +2976,17 @@ static struct be_nic_resource_desc *be_get_nic_desc(u8 *buf, u32 desc_count,
2976 for (i = 0; i < desc_count; i++) { 2976 for (i = 0; i < desc_count; i++) {
2977 desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE; 2977 desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE;
2978 if (((void *)desc + desc->desc_len) > 2978 if (((void *)desc + desc->desc_len) >
2979 (void *)(buf + max_buf_size)) { 2979 (void *)(buf + max_buf_size))
2980 desc = NULL; 2980 return NULL;
2981 break;
2982 }
2983 2981
2984 if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || 2982 if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 ||
2985 desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1) 2983 desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1)
2986 break; 2984 return desc;
2987 2985
2988 desc = (void *)desc + desc->desc_len; 2986 desc = (void *)desc + desc->desc_len;
2989 } 2987 }
2990 2988
2991 if (!desc || i == MAX_RESOURCE_DESC) 2989 return NULL;
2992 return NULL;
2993
2994 return desc;
2995} 2990}
2996 2991
2997/* Uses Mbox */ 2992/* Uses Mbox */
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index a444110b060f..ca2967b0f18b 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -780,26 +780,18 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
780 if (unlikely(!skb)) 780 if (unlikely(!skb))
781 return skb; 781 return skb;
782 782
783 if (vlan_tx_tag_present(skb)) { 783 if (vlan_tx_tag_present(skb))
784 vlan_tag = be_get_tx_vlan_tag(adapter, skb); 784 vlan_tag = be_get_tx_vlan_tag(adapter, skb);
785 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); 785 else if (qnq_async_evt_rcvd(adapter) && adapter->pvid)
786 if (skb) 786 vlan_tag = adapter->pvid;
787 skb->vlan_tci = 0;
788 }
789
790 if (qnq_async_evt_rcvd(adapter) && adapter->pvid) {
791 if (!vlan_tag)
792 vlan_tag = adapter->pvid;
793 if (skip_hw_vlan)
794 *skip_hw_vlan = true;
795 }
796 787
797 if (vlan_tag) { 788 if (vlan_tag) {
798 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); 789 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
799 if (unlikely(!skb)) 790 if (unlikely(!skb))
800 return skb; 791 return skb;
801
802 skb->vlan_tci = 0; 792 skb->vlan_tci = 0;
793 if (skip_hw_vlan)
794 *skip_hw_vlan = true;
803 } 795 }
804 796
805 /* Insert the outer VLAN, if any */ 797 /* Insert the outer VLAN, if any */
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ca9825ca88c9..85a06037b242 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -109,7 +109,7 @@ static struct platform_device_id fec_devtype[] = {
109 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | 109 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
110 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM, 110 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM,
111 }, { 111 }, {
112 .name = "mvf-fec", 112 .name = "mvf600-fec",
113 .driver_data = FEC_QUIRK_ENET_MAC, 113 .driver_data = FEC_QUIRK_ENET_MAC,
114 }, { 114 }, {
115 /* sentinel */ 115 /* sentinel */
@@ -122,7 +122,7 @@ enum imx_fec_type {
122 IMX27_FEC, /* runs on i.mx27/35/51 */ 122 IMX27_FEC, /* runs on i.mx27/35/51 */
123 IMX28_FEC, 123 IMX28_FEC,
124 IMX6Q_FEC, 124 IMX6Q_FEC,
125 MVF_FEC, 125 MVF600_FEC,
126}; 126};
127 127
128static const struct of_device_id fec_dt_ids[] = { 128static const struct of_device_id fec_dt_ids[] = {
@@ -130,7 +130,7 @@ static const struct of_device_id fec_dt_ids[] = {
130 { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], }, 130 { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], },
131 { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, 131 { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], },
132 { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], }, 132 { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], },
133 { .compatible = "fsl,mvf-fec", .data = &fec_devtype[MVF_FEC], }, 133 { .compatible = "fsl,mvf600-fec", .data = &fec_devtype[MVF600_FEC], },
134 { /* sentinel */ } 134 { /* sentinel */ }
135}; 135};
136MODULE_DEVICE_TABLE(of, fec_dt_ids); 136MODULE_DEVICE_TABLE(of, fec_dt_ids);
@@ -451,7 +451,7 @@ fec_restart(struct net_device *ndev, int duplex)
451 netif_device_detach(ndev); 451 netif_device_detach(ndev);
452 napi_disable(&fep->napi); 452 napi_disable(&fep->napi);
453 netif_stop_queue(ndev); 453 netif_stop_queue(ndev);
454 netif_tx_lock(ndev); 454 netif_tx_lock_bh(ndev);
455 } 455 }
456 456
457 /* Whack a reset. We should wait for this. */ 457 /* Whack a reset. We should wait for this. */
@@ -616,10 +616,10 @@ fec_restart(struct net_device *ndev, int duplex)
616 writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); 616 writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
617 617
618 if (netif_running(ndev)) { 618 if (netif_running(ndev)) {
619 netif_device_attach(ndev); 619 netif_tx_unlock_bh(ndev);
620 napi_enable(&fep->napi);
621 netif_wake_queue(ndev); 620 netif_wake_queue(ndev);
622 netif_tx_unlock(ndev); 621 napi_enable(&fep->napi);
622 netif_device_attach(ndev);
623 } 623 }
624} 624}
625 625
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index 576e4b858fce..083ea2b4d20a 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -524,6 +524,7 @@ static int gianfar_ptp_probe(struct platform_device *dev)
524 return 0; 524 return 0;
525 525
526no_clock: 526no_clock:
527 iounmap(etsects->regs);
527no_ioremap: 528no_ioremap:
528 release_resource(etsects->rsrc); 529 release_resource(etsects->rsrc);
529no_resource: 530no_resource:
diff --git a/drivers/net/ethernet/icplus/ipg.h b/drivers/net/ethernet/icplus/ipg.h
index 6ce027355fcf..abb300a31912 100644
--- a/drivers/net/ethernet/icplus/ipg.h
+++ b/drivers/net/ethernet/icplus/ipg.h
@@ -195,57 +195,57 @@ enum ipg_regs {
195/* TFD data structure masks. */ 195/* TFD data structure masks. */
196 196
197/* TFDList, TFC */ 197/* TFDList, TFC */
198#define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFF 198#define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFFULL
199#define IPG_TFC_FRAMEID 0x000000000000FFFF 199#define IPG_TFC_FRAMEID 0x000000000000FFFFULL
200#define IPG_TFC_WORDALIGN 0x0000000000030000 200#define IPG_TFC_WORDALIGN 0x0000000000030000ULL
201#define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000 201#define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000ULL
202#define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000 202#define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000ULL
203#define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000 203#define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000ULL
204#define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000 204#define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000ULL
205#define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000 205#define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000ULL
206#define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000 206#define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000ULL
207#define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000 207#define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000ULL
208#define IPG_TFC_TXINDICATE 0x0000000000400000 208#define IPG_TFC_TXINDICATE 0x0000000000400000ULL
209#define IPG_TFC_TXDMAINDICATE 0x0000000000800000 209#define IPG_TFC_TXDMAINDICATE 0x0000000000800000ULL
210#define IPG_TFC_FRAGCOUNT 0x000000000F000000 210#define IPG_TFC_FRAGCOUNT 0x000000000F000000ULL
211#define IPG_TFC_VLANTAGINSERT 0x0000000010000000 211#define IPG_TFC_VLANTAGINSERT 0x0000000010000000ULL
212#define IPG_TFC_TFDDONE 0x0000000080000000 212#define IPG_TFC_TFDDONE 0x0000000080000000ULL
213#define IPG_TFC_VID 0x00000FFF00000000 213#define IPG_TFC_VID 0x00000FFF00000000ULL
214#define IPG_TFC_CFI 0x0000100000000000 214#define IPG_TFC_CFI 0x0000100000000000ULL
215#define IPG_TFC_USERPRIORITY 0x0000E00000000000 215#define IPG_TFC_USERPRIORITY 0x0000E00000000000ULL
216 216
217/* TFDList, FragInfo */ 217/* TFDList, FragInfo */
218#define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFF 218#define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL
219#define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFF 219#define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFFULL
220#define IPG_TFI_FRAGLEN 0xFFFF000000000000LL 220#define IPG_TFI_FRAGLEN 0xFFFF000000000000ULL
221 221
222/* RFD data structure masks. */ 222/* RFD data structure masks. */
223 223
224/* RFDList, RFS */ 224/* RFDList, RFS */
225#define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFF 225#define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFFULL
226#define IPG_RFS_RXFRAMELEN 0x000000000000FFFF 226#define IPG_RFS_RXFRAMELEN 0x000000000000FFFFULL
227#define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000 227#define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000ULL
228#define IPG_RFS_RXRUNTFRAME 0x0000000000020000 228#define IPG_RFS_RXRUNTFRAME 0x0000000000020000ULL
229#define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000 229#define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000ULL
230#define IPG_RFS_RXFCSERROR 0x0000000000080000 230#define IPG_RFS_RXFCSERROR 0x0000000000080000ULL
231#define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000 231#define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000ULL
232#define IPG_RFS_RXLENGTHERROR 0x0000000000200000 232#define IPG_RFS_RXLENGTHERROR 0x0000000000200000ULL
233#define IPG_RFS_VLANDETECTED 0x0000000000400000 233#define IPG_RFS_VLANDETECTED 0x0000000000400000ULL
234#define IPG_RFS_TCPDETECTED 0x0000000000800000 234#define IPG_RFS_TCPDETECTED 0x0000000000800000ULL
235#define IPG_RFS_TCPERROR 0x0000000001000000 235#define IPG_RFS_TCPERROR 0x0000000001000000ULL
236#define IPG_RFS_UDPDETECTED 0x0000000002000000 236#define IPG_RFS_UDPDETECTED 0x0000000002000000ULL
237#define IPG_RFS_UDPERROR 0x0000000004000000 237#define IPG_RFS_UDPERROR 0x0000000004000000ULL
238#define IPG_RFS_IPDETECTED 0x0000000008000000 238#define IPG_RFS_IPDETECTED 0x0000000008000000ULL
239#define IPG_RFS_IPERROR 0x0000000010000000 239#define IPG_RFS_IPERROR 0x0000000010000000ULL
240#define IPG_RFS_FRAMESTART 0x0000000020000000 240#define IPG_RFS_FRAMESTART 0x0000000020000000ULL
241#define IPG_RFS_FRAMEEND 0x0000000040000000 241#define IPG_RFS_FRAMEEND 0x0000000040000000ULL
242#define IPG_RFS_RFDDONE 0x0000000080000000 242#define IPG_RFS_RFDDONE 0x0000000080000000ULL
243#define IPG_RFS_TCI 0x0000FFFF00000000 243#define IPG_RFS_TCI 0x0000FFFF00000000ULL
244 244
245/* RFDList, FragInfo */ 245/* RFDList, FragInfo */
246#define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFF 246#define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL
247#define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFF 247#define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFFULL
248#define IPG_RFI_FRAGLEN 0xFFFF000000000000LL 248#define IPG_RFI_FRAGLEN 0xFFFF000000000000ULL
249 249
250/* I/O Register masks. */ 250/* I/O Register masks. */
251 251
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index d0afeea181fb..2ad1494efbb3 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -867,7 +867,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
867 struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index); 867 struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index);
868 int reclaimed; 868 int reclaimed;
869 869
870 __netif_tx_lock(nq, smp_processor_id()); 870 __netif_tx_lock_bh(nq);
871 871
872 reclaimed = 0; 872 reclaimed = 0;
873 while (reclaimed < budget && txq->tx_desc_count > 0) { 873 while (reclaimed < budget && txq->tx_desc_count > 0) {
@@ -913,7 +913,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
913 dev_kfree_skb(skb); 913 dev_kfree_skb(skb);
914 } 914 }
915 915
916 __netif_tx_unlock(nq); 916 __netif_tx_unlock_bh(nq);
917 917
918 if (reclaimed < budget) 918 if (reclaimed < budget)
919 mp->work_tx &= ~(1 << txq->index); 919 mp->work_tx &= ~(1 << txq->index);
@@ -2745,7 +2745,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2745 2745
2746 INIT_WORK(&mp->tx_timeout_task, tx_timeout_task); 2746 INIT_WORK(&mp->tx_timeout_task, tx_timeout_task);
2747 2747
2748 netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, 128); 2748 netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, NAPI_POLL_WEIGHT);
2749 2749
2750 init_timer(&mp->rx_oom); 2750 init_timer(&mp->rx_oom);
2751 mp->rx_oom.data = (unsigned long)mp; 2751 mp->rx_oom.data = (unsigned long)mp;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 019c5f78732e..c1b693cb3df3 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -907,8 +907,11 @@ struct qlcnic_ipaddr {
907#define QLCNIC_FW_HANG 0x4000 907#define QLCNIC_FW_HANG 0x4000
908#define QLCNIC_FW_LRO_MSS_CAP 0x8000 908#define QLCNIC_FW_LRO_MSS_CAP 0x8000
909#define QLCNIC_TX_INTR_SHARED 0x10000 909#define QLCNIC_TX_INTR_SHARED 0x10000
910#define QLCNIC_APP_CHANGED_FLAGS 0x20000
910#define QLCNIC_IS_MSI_FAMILY(adapter) \ 911#define QLCNIC_IS_MSI_FAMILY(adapter) \
911 ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) 912 ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
913#define QLCNIC_IS_TSO_CAPABLE(adapter) \
914 ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
912 915
913#define QLCNIC_DEF_NUM_STS_DESC_RINGS 4 916#define QLCNIC_DEF_NUM_STS_DESC_RINGS 4
914#define QLCNIC_MSIX_TBL_SPACE 8192 917#define QLCNIC_MSIX_TBL_SPACE 8192
@@ -1034,6 +1037,7 @@ struct qlcnic_adapter {
1034 spinlock_t rx_mac_learn_lock; 1037 spinlock_t rx_mac_learn_lock;
1035 u32 file_prd_off; /*File fw product offset*/ 1038 u32 file_prd_off; /*File fw product offset*/
1036 u32 fw_version; 1039 u32 fw_version;
1040 u32 offload_flags;
1037 const struct firmware *fw; 1041 const struct firmware *fw;
1038}; 1042};
1039 1043
@@ -1542,6 +1546,8 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int, u16);
1542int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter); 1546int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter);
1543int qlcnic_read_mac_addr(struct qlcnic_adapter *); 1547int qlcnic_read_mac_addr(struct qlcnic_adapter *);
1544int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int); 1548int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int);
1549void qlcnic_set_netdev_features(struct qlcnic_adapter *,
1550 struct qlcnic_esw_func_cfg *);
1545void qlcnic_sriov_vf_schedule_multi(struct net_device *); 1551void qlcnic_sriov_vf_schedule_multi(struct net_device *);
1546void qlcnic_vf_add_mc_list(struct net_device *, u16); 1552void qlcnic_vf_add_mc_list(struct net_device *, u16);
1547 1553
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index c67d1eb35e8f..5e7fb1dfb97b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -382,8 +382,6 @@ static int qlcnic_83xx_idc_tx_soft_reset(struct qlcnic_adapter *adapter)
382 clear_bit(__QLCNIC_RESETTING, &adapter->state); 382 clear_bit(__QLCNIC_RESETTING, &adapter->state);
383 dev_err(&adapter->pdev->dev, "%s:\n", __func__); 383 dev_err(&adapter->pdev->dev, "%s:\n", __func__);
384 384
385 adapter->netdev->trans_start = jiffies;
386
387 return 0; 385 return 0;
388} 386}
389 387
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 6a6512ba9f38..106a12f2a02f 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -973,16 +973,57 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu)
973 return rc; 973 return rc;
974} 974}
975 975
976static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter,
977 netdev_features_t features)
978{
979 u32 offload_flags = adapter->offload_flags;
980
981 if (offload_flags & BIT_0) {
982 features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM |
983 NETIF_F_IPV6_CSUM;
984 adapter->rx_csum = 1;
985 if (QLCNIC_IS_TSO_CAPABLE(adapter)) {
986 if (!(offload_flags & BIT_1))
987 features &= ~NETIF_F_TSO;
988 else
989 features |= NETIF_F_TSO;
990
991 if (!(offload_flags & BIT_2))
992 features &= ~NETIF_F_TSO6;
993 else
994 features |= NETIF_F_TSO6;
995 }
996 } else {
997 features &= ~(NETIF_F_RXCSUM |
998 NETIF_F_IP_CSUM |
999 NETIF_F_IPV6_CSUM);
1000
1001 if (QLCNIC_IS_TSO_CAPABLE(adapter))
1002 features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
1003 adapter->rx_csum = 0;
1004 }
1005
1006 return features;
1007}
976 1008
977netdev_features_t qlcnic_fix_features(struct net_device *netdev, 1009netdev_features_t qlcnic_fix_features(struct net_device *netdev,
978 netdev_features_t features) 1010 netdev_features_t features)
979{ 1011{
980 struct qlcnic_adapter *adapter = netdev_priv(netdev); 1012 struct qlcnic_adapter *adapter = netdev_priv(netdev);
1013 netdev_features_t changed;
981 1014
982 if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) && 1015 if (qlcnic_82xx_check(adapter) &&
983 qlcnic_82xx_check(adapter)) { 1016 (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
984 netdev_features_t changed = features ^ netdev->features; 1017 if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) {
985 features ^= changed & (NETIF_F_ALL_CSUM | NETIF_F_RXCSUM); 1018 features = qlcnic_process_flags(adapter, features);
1019 } else {
1020 changed = features ^ netdev->features;
1021 features ^= changed & (NETIF_F_RXCSUM |
1022 NETIF_F_IP_CSUM |
1023 NETIF_F_IPV6_CSUM |
1024 NETIF_F_TSO |
1025 NETIF_F_TSO6);
1026 }
986 } 1027 }
987 1028
988 if (!(features & NETIF_F_RXCSUM)) 1029 if (!(features & NETIF_F_RXCSUM))
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 8fb836d4129f..aeb26a850679 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -84,14 +84,9 @@ static int qlcnic_start_firmware(struct qlcnic_adapter *);
84static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); 84static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter);
85static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); 85static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *);
86static int qlcnicvf_start_firmware(struct qlcnic_adapter *); 86static int qlcnicvf_start_firmware(struct qlcnic_adapter *);
87static void qlcnic_set_netdev_features(struct qlcnic_adapter *,
88 struct qlcnic_esw_func_cfg *);
89static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16); 87static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16);
90static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16); 88static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16);
91 89
92#define QLCNIC_IS_TSO_CAPABLE(adapter) \
93 ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
94
95static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) 90static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter)
96{ 91{
97 struct qlcnic_hardware_context *ahw = adapter->ahw; 92 struct qlcnic_hardware_context *ahw = adapter->ahw;
@@ -1074,8 +1069,6 @@ void qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter,
1074 1069
1075 if (!esw_cfg->promisc_mode) 1070 if (!esw_cfg->promisc_mode)
1076 adapter->flags |= QLCNIC_PROMISC_DISABLED; 1071 adapter->flags |= QLCNIC_PROMISC_DISABLED;
1077
1078 qlcnic_set_netdev_features(adapter, esw_cfg);
1079} 1072}
1080 1073
1081int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) 1074int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter)
@@ -1090,51 +1083,23 @@ int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter)
1090 return -EIO; 1083 return -EIO;
1091 qlcnic_set_vlan_config(adapter, &esw_cfg); 1084 qlcnic_set_vlan_config(adapter, &esw_cfg);
1092 qlcnic_set_eswitch_port_features(adapter, &esw_cfg); 1085 qlcnic_set_eswitch_port_features(adapter, &esw_cfg);
1086 qlcnic_set_netdev_features(adapter, &esw_cfg);
1093 1087
1094 return 0; 1088 return 0;
1095} 1089}
1096 1090
1097static void 1091void qlcnic_set_netdev_features(struct qlcnic_adapter *adapter,
1098qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, 1092 struct qlcnic_esw_func_cfg *esw_cfg)
1099 struct qlcnic_esw_func_cfg *esw_cfg)
1100{ 1093{
1101 struct net_device *netdev = adapter->netdev; 1094 struct net_device *netdev = adapter->netdev;
1102 unsigned long features, vlan_features;
1103 1095
1104 if (qlcnic_83xx_check(adapter)) 1096 if (qlcnic_83xx_check(adapter))
1105 return; 1097 return;
1106 1098
1107 features = (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | 1099 adapter->offload_flags = esw_cfg->offload_flags;
1108 NETIF_F_IPV6_CSUM | NETIF_F_GRO); 1100 adapter->flags |= QLCNIC_APP_CHANGED_FLAGS;
1109 vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | 1101 netdev_update_features(netdev);
1110 NETIF_F_IPV6_CSUM); 1102 adapter->flags &= ~QLCNIC_APP_CHANGED_FLAGS;
1111
1112 if (QLCNIC_IS_TSO_CAPABLE(adapter)) {
1113 features |= (NETIF_F_TSO | NETIF_F_TSO6);
1114 vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6);
1115 }
1116
1117 if (netdev->features & NETIF_F_LRO)
1118 features |= NETIF_F_LRO;
1119
1120 if (esw_cfg->offload_flags & BIT_0) {
1121 netdev->features |= features;
1122 adapter->rx_csum = 1;
1123 if (!(esw_cfg->offload_flags & BIT_1)) {
1124 netdev->features &= ~NETIF_F_TSO;
1125 features &= ~NETIF_F_TSO;
1126 }
1127 if (!(esw_cfg->offload_flags & BIT_2)) {
1128 netdev->features &= ~NETIF_F_TSO6;
1129 features &= ~NETIF_F_TSO6;
1130 }
1131 } else {
1132 netdev->features &= ~features;
1133 features &= ~features;
1134 adapter->rx_csum = 0;
1135 }
1136
1137 netdev->vlan_features = (features & vlan_features);
1138} 1103}
1139 1104
1140static int 1105static int
@@ -2016,8 +1981,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2016 pci_enable_pcie_error_reporting(pdev); 1981 pci_enable_pcie_error_reporting(pdev);
2017 1982
2018 ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL); 1983 ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL);
2019 if (!ahw) 1984 if (!ahw) {
1985 err = -ENOMEM;
2020 goto err_out_free_res; 1986 goto err_out_free_res;
1987 }
2021 1988
2022 switch (ent->device) { 1989 switch (ent->device) {
2023 case PCI_DEVICE_ID_QLOGIC_QLE824X: 1990 case PCI_DEVICE_ID_QLOGIC_QLE824X:
@@ -2053,6 +2020,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2053 2020
2054 adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic"); 2021 adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic");
2055 if (adapter->qlcnic_wq == NULL) { 2022 if (adapter->qlcnic_wq == NULL) {
2023 err = -ENOMEM;
2056 dev_err(&pdev->dev, "Failed to create workqueue\n"); 2024 dev_err(&pdev->dev, "Failed to create workqueue\n");
2057 goto err_out_free_netdev; 2025 goto err_out_free_netdev;
2058 } 2026 }
@@ -2133,6 +2101,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2133 goto err_out_disable_msi; 2101 goto err_out_disable_msi;
2134 } 2102 }
2135 2103
2104 err = qlcnic_get_act_pci_func(adapter);
2105 if (err)
2106 goto err_out_disable_mbx_intr;
2107
2136 err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac); 2108 err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac);
2137 if (err) 2109 if (err)
2138 goto err_out_disable_mbx_intr; 2110 goto err_out_disable_mbx_intr;
@@ -2162,9 +2134,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2162 break; 2134 break;
2163 } 2135 }
2164 2136
2165 if (qlcnic_get_act_pci_func(adapter))
2166 goto err_out_disable_mbx_intr;
2167
2168 if (adapter->drv_mac_learn) 2137 if (adapter->drv_mac_learn)
2169 qlcnic_alloc_lb_filters_mem(adapter); 2138 qlcnic_alloc_lb_filters_mem(adapter);
2170 2139
@@ -3149,10 +3118,8 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
3149 if (adapter->need_fw_reset) 3118 if (adapter->need_fw_reset)
3150 goto detach; 3119 goto detach;
3151 3120
3152 if (adapter->ahw->reset_context && qlcnic_auto_fw_reset) { 3121 if (adapter->ahw->reset_context && qlcnic_auto_fw_reset)
3153 qlcnic_reset_hw_context(adapter); 3122 qlcnic_reset_hw_context(adapter);
3154 adapter->netdev->trans_start = jiffies;
3155 }
3156 3123
3157 return 0; 3124 return 0;
3158 } 3125 }
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index 3869c3864deb..196b2d100407 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -1734,7 +1734,6 @@ static int qlcnic_sriov_vf_handle_context_reset(struct qlcnic_adapter *adapter)
1734 1734
1735 if (!qlcnic_sriov_vf_reinit_driver(adapter)) { 1735 if (!qlcnic_sriov_vf_reinit_driver(adapter)) {
1736 qlcnic_sriov_vf_attach(adapter); 1736 qlcnic_sriov_vf_attach(adapter);
1737 adapter->netdev->trans_start = jiffies;
1738 adapter->tx_timeo_cnt = 0; 1737 adapter->tx_timeo_cnt = 0;
1739 adapter->reset_ctx_cnt = 0; 1738 adapter->reset_ctx_cnt = 0;
1740 adapter->fw_fail_cnt = 0; 1739 adapter->fw_fail_cnt = 0;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index 4e22e794a186..e7a2fe21b649 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -544,6 +544,9 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
544 switch (esw_cfg[i].op_mode) { 544 switch (esw_cfg[i].op_mode) {
545 case QLCNIC_PORT_DEFAULTS: 545 case QLCNIC_PORT_DEFAULTS:
546 qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]); 546 qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]);
547 rtnl_lock();
548 qlcnic_set_netdev_features(adapter, &esw_cfg[i]);
549 rtnl_unlock();
547 break; 550 break;
548 case QLCNIC_ADD_VLAN: 551 case QLCNIC_ADD_VLAN:
549 qlcnic_set_vlan_config(adapter, &esw_cfg[i]); 552 qlcnic_set_vlan_config(adapter, &esw_cfg[i]);
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index 7d1fb9ad1296..03523459c406 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -1136,6 +1136,7 @@ static void cp_clean_rings (struct cp_private *cp)
1136 cp->dev->stats.tx_dropped++; 1136 cp->dev->stats.tx_dropped++;
1137 } 1137 }
1138 } 1138 }
1139 netdev_reset_queue(cp->dev);
1139 1140
1140 memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); 1141 memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE);
1141 memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); 1142 memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE);
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 79c520b64fdd..393f961a013c 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5856,7 +5856,20 @@ err_out:
5856 return -EIO; 5856 return -EIO;
5857} 5857}
5858 5858
5859static inline void rtl8169_tso_csum(struct rtl8169_private *tp, 5859static bool rtl_skb_pad(struct sk_buff *skb)
5860{
5861 if (skb_padto(skb, ETH_ZLEN))
5862 return false;
5863 skb_put(skb, ETH_ZLEN - skb->len);
5864 return true;
5865}
5866
5867static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb)
5868{
5869 return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34;
5870}
5871
5872static inline bool rtl8169_tso_csum(struct rtl8169_private *tp,
5860 struct sk_buff *skb, u32 *opts) 5873 struct sk_buff *skb, u32 *opts)
5861{ 5874{
5862 const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version; 5875 const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version;
@@ -5869,13 +5882,20 @@ static inline void rtl8169_tso_csum(struct rtl8169_private *tp,
5869 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 5882 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
5870 const struct iphdr *ip = ip_hdr(skb); 5883 const struct iphdr *ip = ip_hdr(skb);
5871 5884
5885 if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
5886 return skb_checksum_help(skb) == 0 && rtl_skb_pad(skb);
5887
5872 if (ip->protocol == IPPROTO_TCP) 5888 if (ip->protocol == IPPROTO_TCP)
5873 opts[offset] |= info->checksum.tcp; 5889 opts[offset] |= info->checksum.tcp;
5874 else if (ip->protocol == IPPROTO_UDP) 5890 else if (ip->protocol == IPPROTO_UDP)
5875 opts[offset] |= info->checksum.udp; 5891 opts[offset] |= info->checksum.udp;
5876 else 5892 else
5877 WARN_ON_ONCE(1); 5893 WARN_ON_ONCE(1);
5894 } else {
5895 if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
5896 return rtl_skb_pad(skb);
5878 } 5897 }
5898 return true;
5879} 5899}
5880 5900
5881static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, 5901static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
@@ -5896,17 +5916,15 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5896 goto err_stop_0; 5916 goto err_stop_0;
5897 } 5917 }
5898 5918
5899 /* 8168evl does not automatically pad to minimum length. */
5900 if (unlikely(tp->mac_version == RTL_GIGA_MAC_VER_34 &&
5901 skb->len < ETH_ZLEN)) {
5902 if (skb_padto(skb, ETH_ZLEN))
5903 goto err_update_stats;
5904 skb_put(skb, ETH_ZLEN - skb->len);
5905 }
5906
5907 if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) 5919 if (unlikely(le32_to_cpu(txd->opts1) & DescOwn))
5908 goto err_stop_0; 5920 goto err_stop_0;
5909 5921
5922 opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb));
5923 opts[0] = DescOwn;
5924
5925 if (!rtl8169_tso_csum(tp, skb, opts))
5926 goto err_update_stats;
5927
5910 len = skb_headlen(skb); 5928 len = skb_headlen(skb);
5911 mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE); 5929 mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE);
5912 if (unlikely(dma_mapping_error(d, mapping))) { 5930 if (unlikely(dma_mapping_error(d, mapping))) {
@@ -5918,11 +5936,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5918 tp->tx_skb[entry].len = len; 5936 tp->tx_skb[entry].len = len;
5919 txd->addr = cpu_to_le64(mapping); 5937 txd->addr = cpu_to_le64(mapping);
5920 5938
5921 opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb));
5922 opts[0] = DescOwn;
5923
5924 rtl8169_tso_csum(tp, skb, opts);
5925
5926 frags = rtl8169_xmit_frags(tp, skb, opts); 5939 frags = rtl8169_xmit_frags(tp, skb, opts);
5927 if (frags < 0) 5940 if (frags < 0)
5928 goto err_dma_1; 5941 goto err_dma_1;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 01b99206139a..39e4cb39de29 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -638,14 +638,16 @@ static void efx_start_datapath(struct efx_nic *efx)
638 EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + 638 EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
639 efx->type->rx_buffer_padding); 639 efx->type->rx_buffer_padding);
640 rx_buf_len = (sizeof(struct efx_rx_page_state) + 640 rx_buf_len = (sizeof(struct efx_rx_page_state) +
641 EFX_PAGE_IP_ALIGN + efx->rx_dma_len); 641 NET_IP_ALIGN + efx->rx_dma_len);
642 if (rx_buf_len <= PAGE_SIZE) { 642 if (rx_buf_len <= PAGE_SIZE) {
643 efx->rx_scatter = false; 643 efx->rx_scatter = false;
644 efx->rx_buffer_order = 0; 644 efx->rx_buffer_order = 0;
645 } else if (efx->type->can_rx_scatter) { 645 } else if (efx->type->can_rx_scatter) {
646 BUILD_BUG_ON(EFX_RX_USR_BUF_SIZE % L1_CACHE_BYTES);
646 BUILD_BUG_ON(sizeof(struct efx_rx_page_state) + 647 BUILD_BUG_ON(sizeof(struct efx_rx_page_state) +
647 EFX_PAGE_IP_ALIGN + EFX_RX_USR_BUF_SIZE > 648 2 * ALIGN(NET_IP_ALIGN + EFX_RX_USR_BUF_SIZE,
648 PAGE_SIZE / 2); 649 EFX_RX_BUF_ALIGNMENT) >
650 PAGE_SIZE);
649 efx->rx_scatter = true; 651 efx->rx_scatter = true;
650 efx->rx_dma_len = EFX_RX_USR_BUF_SIZE; 652 efx->rx_dma_len = EFX_RX_USR_BUF_SIZE;
651 efx->rx_buffer_order = 0; 653 efx->rx_buffer_order = 0;
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 9bd433a095c5..39d6bd77f015 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -72,8 +72,20 @@
72/* Maximum possible MTU the driver supports */ 72/* Maximum possible MTU the driver supports */
73#define EFX_MAX_MTU (9 * 1024) 73#define EFX_MAX_MTU (9 * 1024)
74 74
75/* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page. */ 75/* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page,
76#define EFX_RX_USR_BUF_SIZE 1824 76 * and should be a multiple of the cache line size.
77 */
78#define EFX_RX_USR_BUF_SIZE (2048 - 256)
79
80/* If possible, we should ensure cache line alignment at start and end
81 * of every buffer. Otherwise, we just need to ensure 4-byte
82 * alignment of the network header.
83 */
84#if NET_IP_ALIGN == 0
85#define EFX_RX_BUF_ALIGNMENT L1_CACHE_BYTES
86#else
87#define EFX_RX_BUF_ALIGNMENT 4
88#endif
77 89
78/* Forward declare Precision Time Protocol (PTP) support structure. */ 90/* Forward declare Precision Time Protocol (PTP) support structure. */
79struct efx_ptp_data; 91struct efx_ptp_data;
@@ -468,24 +480,11 @@ enum nic_state {
468}; 480};
469 481
470/* 482/*
471 * Alignment of page-allocated RX buffers
472 *
473 * Controls the number of bytes inserted at the start of an RX buffer.
474 * This is the equivalent of NET_IP_ALIGN [which controls the alignment
475 * of the skb->head for hardware DMA].
476 */
477#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
478#define EFX_PAGE_IP_ALIGN 0
479#else
480#define EFX_PAGE_IP_ALIGN NET_IP_ALIGN
481#endif
482
483/*
484 * Alignment of the skb->head which wraps a page-allocated RX buffer 483 * Alignment of the skb->head which wraps a page-allocated RX buffer
485 * 484 *
486 * The skb allocated to wrap an rx_buffer can have this alignment. Since 485 * The skb allocated to wrap an rx_buffer can have this alignment. Since
487 * the data is memcpy'd from the rx_buf, it does not need to be equal to 486 * the data is memcpy'd from the rx_buf, it does not need to be equal to
488 * EFX_PAGE_IP_ALIGN. 487 * NET_IP_ALIGN.
489 */ 488 */
490#define EFX_PAGE_SKB_ALIGN 2 489#define EFX_PAGE_SKB_ALIGN 2
491 490
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index e73e30bac10e..a7dfe36cabf4 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -93,8 +93,8 @@ static inline void efx_sync_rx_buffer(struct efx_nic *efx,
93 93
94void efx_rx_config_page_split(struct efx_nic *efx) 94void efx_rx_config_page_split(struct efx_nic *efx)
95{ 95{
96 efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + EFX_PAGE_IP_ALIGN, 96 efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + NET_IP_ALIGN,
97 L1_CACHE_BYTES); 97 EFX_RX_BUF_ALIGNMENT);
98 efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : 98 efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 :
99 ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / 99 ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) /
100 efx->rx_page_buf_step); 100 efx->rx_page_buf_step);
@@ -188,9 +188,9 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue)
188 do { 188 do {
189 index = rx_queue->added_count & rx_queue->ptr_mask; 189 index = rx_queue->added_count & rx_queue->ptr_mask;
190 rx_buf = efx_rx_buffer(rx_queue, index); 190 rx_buf = efx_rx_buffer(rx_queue, index);
191 rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; 191 rx_buf->dma_addr = dma_addr + NET_IP_ALIGN;
192 rx_buf->page = page; 192 rx_buf->page = page;
193 rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; 193 rx_buf->page_offset = page_offset + NET_IP_ALIGN;
194 rx_buf->len = efx->rx_dma_len; 194 rx_buf->len = efx->rx_dma_len;
195 rx_buf->flags = 0; 195 rx_buf->flags = 0;
196 ++rx_queue->added_count; 196 ++rx_queue->added_count;
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index cf887c2384e9..86adfa0a912e 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -582,6 +582,7 @@ static const struct usb_device_id products[] = {
582 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ 582 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
583 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ 583 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
584 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ 584 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
585 {QMI_FIXED_INTF(0x1e2d, 0x12d1, 4)}, /* Cinterion PLxx */
585 586
586 /* 4. Gobi 1000 devices */ 587 /* 4. Gobi 1000 devices */
587 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 588 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index a491d3a95393..6cbdac67f3a0 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -130,19 +130,23 @@ struct rtl8150 {
130 struct usb_device *udev; 130 struct usb_device *udev;
131 struct tasklet_struct tl; 131 struct tasklet_struct tl;
132 struct net_device *netdev; 132 struct net_device *netdev;
133 struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb; 133 struct urb *rx_urb, *tx_urb, *intr_urb;
134 struct sk_buff *tx_skb, *rx_skb; 134 struct sk_buff *tx_skb, *rx_skb;
135 struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE]; 135 struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
136 spinlock_t rx_pool_lock; 136 spinlock_t rx_pool_lock;
137 struct usb_ctrlrequest dr; 137 struct usb_ctrlrequest dr;
138 int intr_interval; 138 int intr_interval;
139 __le16 rx_creg;
140 u8 *intr_buff; 139 u8 *intr_buff;
141 u8 phy; 140 u8 phy;
142}; 141};
143 142
144typedef struct rtl8150 rtl8150_t; 143typedef struct rtl8150 rtl8150_t;
145 144
145struct async_req {
146 struct usb_ctrlrequest dr;
147 u16 rx_creg;
148};
149
146static const char driver_name [] = "rtl8150"; 150static const char driver_name [] = "rtl8150";
147 151
148/* 152/*
@@ -164,51 +168,47 @@ static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
164 indx, 0, data, size, 500); 168 indx, 0, data, size, 500);
165} 169}
166 170
167static void ctrl_callback(struct urb *urb) 171static void async_set_reg_cb(struct urb *urb)
168{ 172{
169 rtl8150_t *dev; 173 struct async_req *req = (struct async_req *)urb->context;
170 int status = urb->status; 174 int status = urb->status;
171 175
172 switch (status) { 176 if (status < 0)
173 case 0: 177 dev_dbg(&urb->dev->dev, "%s failed with %d", __func__, status);
174 break; 178 kfree(req);
175 case -EINPROGRESS: 179 usb_free_urb(urb);
176 break;
177 case -ENOENT:
178 break;
179 default:
180 if (printk_ratelimit())
181 dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status);
182 }
183 dev = urb->context;
184 clear_bit(RX_REG_SET, &dev->flags);
185} 180}
186 181
187static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size) 182static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg)
188{ 183{
189 int ret; 184 int res = -ENOMEM;
190 185 struct urb *async_urb;
191 if (test_bit(RX_REG_SET, &dev->flags)) 186 struct async_req *req;
192 return -EAGAIN;
193 187
194 dev->dr.bRequestType = RTL8150_REQT_WRITE; 188 req = kmalloc(sizeof(struct async_req), GFP_ATOMIC);
195 dev->dr.bRequest = RTL8150_REQ_SET_REGS; 189 if (req == NULL)
196 dev->dr.wValue = cpu_to_le16(indx); 190 return res;
197 dev->dr.wIndex = 0; 191 async_urb = usb_alloc_urb(0, GFP_ATOMIC);
198 dev->dr.wLength = cpu_to_le16(size); 192 if (async_urb == NULL) {
199 dev->ctrl_urb->transfer_buffer_length = size; 193 kfree(req);
200 usb_fill_control_urb(dev->ctrl_urb, dev->udev, 194 return res;
201 usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, 195 }
202 &dev->rx_creg, size, ctrl_callback, dev); 196 req->rx_creg = cpu_to_le16(reg);
203 if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) { 197 req->dr.bRequestType = RTL8150_REQT_WRITE;
204 if (ret == -ENODEV) 198 req->dr.bRequest = RTL8150_REQ_SET_REGS;
199 req->dr.wIndex = 0;
200 req->dr.wValue = cpu_to_le16(indx);
201 req->dr.wLength = cpu_to_le16(size);
202 usb_fill_control_urb(async_urb, dev->udev,
203 usb_sndctrlpipe(dev->udev, 0), (void *)&req->dr,
204 &req->rx_creg, size, async_set_reg_cb, req);
205 res = usb_submit_urb(async_urb, GFP_ATOMIC);
206 if (res) {
207 if (res == -ENODEV)
205 netif_device_detach(dev->netdev); 208 netif_device_detach(dev->netdev);
206 dev_err(&dev->udev->dev, 209 dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res);
207 "control request submission failed: %d\n", ret); 210 }
208 } else 211 return res;
209 set_bit(RX_REG_SET, &dev->flags);
210
211 return ret;
212} 212}
213 213
214static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) 214static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
@@ -330,13 +330,6 @@ static int alloc_all_urbs(rtl8150_t * dev)
330 usb_free_urb(dev->tx_urb); 330 usb_free_urb(dev->tx_urb);
331 return 0; 331 return 0;
332 } 332 }
333 dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
334 if (!dev->ctrl_urb) {
335 usb_free_urb(dev->rx_urb);
336 usb_free_urb(dev->tx_urb);
337 usb_free_urb(dev->intr_urb);
338 return 0;
339 }
340 333
341 return 1; 334 return 1;
342} 335}
@@ -346,7 +339,6 @@ static void free_all_urbs(rtl8150_t * dev)
346 usb_free_urb(dev->rx_urb); 339 usb_free_urb(dev->rx_urb);
347 usb_free_urb(dev->tx_urb); 340 usb_free_urb(dev->tx_urb);
348 usb_free_urb(dev->intr_urb); 341 usb_free_urb(dev->intr_urb);
349 usb_free_urb(dev->ctrl_urb);
350} 342}
351 343
352static void unlink_all_urbs(rtl8150_t * dev) 344static void unlink_all_urbs(rtl8150_t * dev)
@@ -354,7 +346,6 @@ static void unlink_all_urbs(rtl8150_t * dev)
354 usb_kill_urb(dev->rx_urb); 346 usb_kill_urb(dev->rx_urb);
355 usb_kill_urb(dev->tx_urb); 347 usb_kill_urb(dev->tx_urb);
356 usb_kill_urb(dev->intr_urb); 348 usb_kill_urb(dev->intr_urb);
357 usb_kill_urb(dev->ctrl_urb);
358} 349}
359 350
360static inline struct sk_buff *pull_skb(rtl8150_t *dev) 351static inline struct sk_buff *pull_skb(rtl8150_t *dev)
@@ -629,7 +620,6 @@ static int enable_net_traffic(rtl8150_t * dev)
629 } 620 }
630 /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */ 621 /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */
631 rcr = 0x9e; 622 rcr = 0x9e;
632 dev->rx_creg = cpu_to_le16(rcr);
633 tcr = 0xd8; 623 tcr = 0xd8;
634 cr = 0x0c; 624 cr = 0x0c;
635 if (!(rcr & 0x80)) 625 if (!(rcr & 0x80))
@@ -662,20 +652,22 @@ static void rtl8150_tx_timeout(struct net_device *netdev)
662static void rtl8150_set_multicast(struct net_device *netdev) 652static void rtl8150_set_multicast(struct net_device *netdev)
663{ 653{
664 rtl8150_t *dev = netdev_priv(netdev); 654 rtl8150_t *dev = netdev_priv(netdev);
655 u16 rx_creg = 0x9e;
656
665 netif_stop_queue(netdev); 657 netif_stop_queue(netdev);
666 if (netdev->flags & IFF_PROMISC) { 658 if (netdev->flags & IFF_PROMISC) {
667 dev->rx_creg |= cpu_to_le16(0x0001); 659 rx_creg |= 0x0001;
668 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); 660 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name);
669 } else if (!netdev_mc_empty(netdev) || 661 } else if (!netdev_mc_empty(netdev) ||
670 (netdev->flags & IFF_ALLMULTI)) { 662 (netdev->flags & IFF_ALLMULTI)) {
671 dev->rx_creg &= cpu_to_le16(0xfffe); 663 rx_creg &= 0xfffe;
672 dev->rx_creg |= cpu_to_le16(0x0002); 664 rx_creg |= 0x0002;
673 dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name); 665 dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name);
674 } else { 666 } else {
675 /* ~RX_MULTICAST, ~RX_PROMISCUOUS */ 667 /* ~RX_MULTICAST, ~RX_PROMISCUOUS */
676 dev->rx_creg &= cpu_to_le16(0x00fc); 668 rx_creg &= 0x00fc;
677 } 669 }
678 async_set_registers(dev, RCR, 2); 670 async_set_registers(dev, RCR, sizeof(rx_creg), rx_creg);
679 netif_wake_queue(netdev); 671 netif_wake_queue(netdev);
680} 672}
681 673
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 655bb25eed2b..c9e00387d999 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -636,10 +636,11 @@ static int virtnet_open(struct net_device *dev)
636 struct virtnet_info *vi = netdev_priv(dev); 636 struct virtnet_info *vi = netdev_priv(dev);
637 int i; 637 int i;
638 638
639 for (i = 0; i < vi->curr_queue_pairs; i++) { 639 for (i = 0; i < vi->max_queue_pairs; i++) {
640 /* Make sure we have some buffers: if oom use wq. */ 640 if (i < vi->curr_queue_pairs)
641 if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) 641 /* Make sure we have some buffers: if oom use wq. */
642 schedule_delayed_work(&vi->refill, 0); 642 if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
643 schedule_delayed_work(&vi->refill, 0);
643 virtnet_napi_enable(&vi->rq[i]); 644 virtnet_napi_enable(&vi->rq[i]);
644 } 645 }
645 646
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ba81f3c39a83..3b1d2ee7156b 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -301,7 +301,7 @@ static inline struct hlist_head *vxlan_fdb_head(struct vxlan_dev *vxlan,
301} 301}
302 302
303/* Look up Ethernet address in forwarding table */ 303/* Look up Ethernet address in forwarding table */
304static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, 304static struct vxlan_fdb *__vxlan_find_mac(struct vxlan_dev *vxlan,
305 const u8 *mac) 305 const u8 *mac)
306 306
307{ 307{
@@ -316,6 +316,18 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
316 return NULL; 316 return NULL;
317} 317}
318 318
319static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
320 const u8 *mac)
321{
322 struct vxlan_fdb *f;
323
324 f = __vxlan_find_mac(vxlan, mac);
325 if (f)
326 f->used = jiffies;
327
328 return f;
329}
330
319/* Add/update destinations for multicast */ 331/* Add/update destinations for multicast */
320static int vxlan_fdb_append(struct vxlan_fdb *f, 332static int vxlan_fdb_append(struct vxlan_fdb *f,
321 __be32 ip, __be16 port, __u32 vni, __u32 ifindex) 333 __be32 ip, __be16 port, __u32 vni, __u32 ifindex)
@@ -353,7 +365,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
353 struct vxlan_fdb *f; 365 struct vxlan_fdb *f;
354 int notify = 0; 366 int notify = 0;
355 367
356 f = vxlan_find_mac(vxlan, mac); 368 f = __vxlan_find_mac(vxlan, mac);
357 if (f) { 369 if (f) {
358 if (flags & NLM_F_EXCL) { 370 if (flags & NLM_F_EXCL) {
359 netdev_dbg(vxlan->dev, 371 netdev_dbg(vxlan->dev,
@@ -563,7 +575,6 @@ static void vxlan_snoop(struct net_device *dev,
563 575
564 f = vxlan_find_mac(vxlan, src_mac); 576 f = vxlan_find_mac(vxlan, src_mac);
565 if (likely(f)) { 577 if (likely(f)) {
566 f->used = jiffies;
567 if (likely(f->remote.remote_ip == src_ip)) 578 if (likely(f->remote.remote_ip == src_ip))
568 return; 579 return;
569 580
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 639ba7d18ea4..6988e1d081f2 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -965,7 +965,7 @@ static void ar9003_hw_do_manual_peak_cal(struct ath_hw *ah,
965{ 965{
966 int i; 966 int i;
967 967
968 if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah)) 968 if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah) && !AR_SREV_9485(ah))
969 return; 969 return;
970 970
971 for (i = 0; i < AR9300_MAX_CHAINS; i++) { 971 for (i = 0; i < AR9300_MAX_CHAINS; i++) {
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
index 712f415b8c08..88ff1d7b53ab 100644
--- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
@@ -1020,7 +1020,7 @@ static const u32 ar9485_1_1_baseband_postamble[][5] = {
1020 {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, 1020 {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0},
1021 {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1021 {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1022 {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1022 {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1023 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, 1023 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00058d18, 0x00058d18},
1024 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, 1024 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982},
1025 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, 1025 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a},
1026 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1026 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 8a1888d02070..366002f266f8 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -254,6 +254,7 @@ struct ath_atx_tid {
254 int sched; 254 int sched;
255 int paused; 255 int paused;
256 u8 state; 256 u8 state;
257 bool stop_cb;
257}; 258};
258 259
259struct ath_node { 260struct ath_node {
@@ -351,7 +352,8 @@ void ath_tx_tasklet(struct ath_softc *sc);
351void ath_tx_edma_tasklet(struct ath_softc *sc); 352void ath_tx_edma_tasklet(struct ath_softc *sc);
352int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 353int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
353 u16 tid, u16 *ssn); 354 u16 tid, u16 *ssn);
354void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 355bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
356 bool flush);
355void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 357void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
356 358
357void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an); 359void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index e6307b86363a..b37eb8d38811 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -2008,6 +2008,14 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,
2008 WARN_ON(i != ATH9K_SSTATS_LEN); 2008 WARN_ON(i != ATH9K_SSTATS_LEN);
2009} 2009}
2010 2010
2011void ath9k_deinit_debug(struct ath_softc *sc)
2012{
2013 if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
2014 relay_close(sc->rfs_chan_spec_scan);
2015 sc->rfs_chan_spec_scan = NULL;
2016 }
2017}
2018
2011int ath9k_init_debug(struct ath_hw *ah) 2019int ath9k_init_debug(struct ath_hw *ah)
2012{ 2020{
2013 struct ath_common *common = ath9k_hw_common(ah); 2021 struct ath_common *common = ath9k_hw_common(ah);
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 794a7ec83a24..9d49aab8b989 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -304,6 +304,7 @@ struct ath9k_debug {
304}; 304};
305 305
306int ath9k_init_debug(struct ath_hw *ah); 306int ath9k_init_debug(struct ath_hw *ah);
307void ath9k_deinit_debug(struct ath_softc *sc);
307 308
308void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); 309void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
309void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, 310void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
@@ -339,6 +340,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah)
339 return 0; 340 return 0;
340} 341}
341 342
343static inline void ath9k_deinit_debug(struct ath_softc *sc)
344{
345}
346
342static inline void ath_debug_stat_interrupt(struct ath_softc *sc, 347static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
343 enum ath9k_int status) 348 enum ath9k_int status)
344{ 349{
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 0237b2868961..aba415103f94 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -906,7 +906,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc,
906 if (!ath_is_world_regd(reg)) { 906 if (!ath_is_world_regd(reg)) {
907 error = regulatory_hint(hw->wiphy, reg->alpha2); 907 error = regulatory_hint(hw->wiphy, reg->alpha2);
908 if (error) 908 if (error)
909 goto unregister; 909 goto debug_cleanup;
910 } 910 }
911 911
912 ath_init_leds(sc); 912 ath_init_leds(sc);
@@ -914,6 +914,8 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc,
914 914
915 return 0; 915 return 0;
916 916
917debug_cleanup:
918 ath9k_deinit_debug(sc);
917unregister: 919unregister:
918 ieee80211_unregister_hw(hw); 920 ieee80211_unregister_hw(hw);
919rx_cleanup: 921rx_cleanup:
@@ -942,11 +944,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
942 sc->dfs_detector->exit(sc->dfs_detector); 944 sc->dfs_detector->exit(sc->dfs_detector);
943 945
944 ath9k_eeprom_release(sc); 946 ath9k_eeprom_release(sc);
945
946 if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
947 relay_close(sc->rfs_chan_spec_scan);
948 sc->rfs_chan_spec_scan = NULL;
949 }
950} 947}
951 948
952void ath9k_deinit_device(struct ath_softc *sc) 949void ath9k_deinit_device(struct ath_softc *sc)
@@ -960,6 +957,7 @@ void ath9k_deinit_device(struct ath_softc *sc)
960 957
961 ath9k_ps_restore(sc); 958 ath9k_ps_restore(sc);
962 959
960 ath9k_deinit_debug(sc);
963 ieee80211_unregister_hw(hw); 961 ieee80211_unregister_hw(hw);
964 ath_rx_cleanup(sc); 962 ath_rx_cleanup(sc);
965 ath9k_deinit_softc(sc); 963 ath9k_deinit_softc(sc);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a18414b5948b..2382d1262e7f 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1687,6 +1687,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1687 u16 tid, u16 *ssn, u8 buf_size) 1687 u16 tid, u16 *ssn, u8 buf_size)
1688{ 1688{
1689 struct ath_softc *sc = hw->priv; 1689 struct ath_softc *sc = hw->priv;
1690 bool flush = false;
1690 int ret = 0; 1691 int ret = 0;
1691 1692
1692 local_bh_disable(); 1693 local_bh_disable();
@@ -1703,12 +1704,13 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1703 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1704 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1704 ath9k_ps_restore(sc); 1705 ath9k_ps_restore(sc);
1705 break; 1706 break;
1706 case IEEE80211_AMPDU_TX_STOP_CONT:
1707 case IEEE80211_AMPDU_TX_STOP_FLUSH: 1707 case IEEE80211_AMPDU_TX_STOP_FLUSH:
1708 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: 1708 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
1709 flush = true;
1710 case IEEE80211_AMPDU_TX_STOP_CONT:
1709 ath9k_ps_wakeup(sc); 1711 ath9k_ps_wakeup(sc);
1710 ath_tx_aggr_stop(sc, sta, tid); 1712 if (ath_tx_aggr_stop(sc, sta, tid, flush))
1711 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1713 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1712 ath9k_ps_restore(sc); 1714 ath9k_ps_restore(sc);
1713 break; 1715 break;
1714 case IEEE80211_AMPDU_TX_OPERATIONAL: 1716 case IEEE80211_AMPDU_TX_OPERATIONAL:
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index eab0fcb7ded6..14bb3354ea64 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -164,7 +164,20 @@ static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
164 ARRAY_SIZE(bf->rates)); 164 ARRAY_SIZE(bf->rates));
165} 165}
166 166
167static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 167static void ath_tx_clear_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
168{
169 tid->state &= ~AGGR_ADDBA_COMPLETE;
170 tid->state &= ~AGGR_CLEANUP;
171 if (!tid->stop_cb)
172 return;
173
174 ieee80211_start_tx_ba_cb_irqsafe(tid->an->vif, tid->an->sta->addr,
175 tid->tidno);
176 tid->stop_cb = false;
177}
178
179static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid,
180 bool flush_packets)
168{ 181{
169 struct ath_txq *txq = tid->ac->txq; 182 struct ath_txq *txq = tid->ac->txq;
170 struct sk_buff *skb; 183 struct sk_buff *skb;
@@ -181,16 +194,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
181 while ((skb = __skb_dequeue(&tid->buf_q))) { 194 while ((skb = __skb_dequeue(&tid->buf_q))) {
182 fi = get_frame_info(skb); 195 fi = get_frame_info(skb);
183 bf = fi->bf; 196 bf = fi->bf;
197 if (!bf && !flush_packets)
198 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
184 199
185 if (!bf) { 200 if (!bf) {
186 bf = ath_tx_setup_buffer(sc, txq, tid, skb); 201 ieee80211_free_txskb(sc->hw, skb);
187 if (!bf) { 202 continue;
188 ieee80211_free_txskb(sc->hw, skb);
189 continue;
190 }
191 } 203 }
192 204
193 if (fi->retries) { 205 if (fi->retries || flush_packets) {
194 list_add_tail(&bf->list, &bf_head); 206 list_add_tail(&bf->list, &bf_head);
195 ath_tx_update_baw(sc, tid, bf->bf_state.seqno); 207 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
196 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 208 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -201,12 +213,10 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
201 } 213 }
202 } 214 }
203 215
204 if (tid->baw_head == tid->baw_tail) { 216 if (tid->baw_head == tid->baw_tail)
205 tid->state &= ~AGGR_ADDBA_COMPLETE; 217 ath_tx_clear_tid(sc, tid);
206 tid->state &= ~AGGR_CLEANUP;
207 }
208 218
209 if (sendbar) { 219 if (sendbar && !flush_packets) {
210 ath_txq_unlock(sc, txq); 220 ath_txq_unlock(sc, txq);
211 ath_send_bar(tid, tid->seq_start); 221 ath_send_bar(tid, tid->seq_start);
212 ath_txq_lock(sc, txq); 222 ath_txq_lock(sc, txq);
@@ -277,9 +287,7 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
277 287
278 list_add_tail(&bf->list, &bf_head); 288 list_add_tail(&bf->list, &bf_head);
279 289
280 if (fi->retries) 290 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
281 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
282
283 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 291 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
284 } 292 }
285 293
@@ -602,7 +610,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
602 } 610 }
603 611
604 if (tid->state & AGGR_CLEANUP) 612 if (tid->state & AGGR_CLEANUP)
605 ath_tx_flush_tid(sc, tid); 613 ath_tx_flush_tid(sc, tid, false);
606 614
607 rcu_read_unlock(); 615 rcu_read_unlock();
608 616
@@ -620,6 +628,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
620 struct ath_tx_status *ts, struct ath_buf *bf, 628 struct ath_tx_status *ts, struct ath_buf *bf,
621 struct list_head *bf_head) 629 struct list_head *bf_head)
622{ 630{
631 struct ieee80211_tx_info *info;
623 bool txok, flush; 632 bool txok, flush;
624 633
625 txok = !(ts->ts_status & ATH9K_TXERR_MASK); 634 txok = !(ts->ts_status & ATH9K_TXERR_MASK);
@@ -631,8 +640,12 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
631 txq->axq_ampdu_depth--; 640 txq->axq_ampdu_depth--;
632 641
633 if (!bf_isampdu(bf)) { 642 if (!bf_isampdu(bf)) {
634 if (!flush) 643 if (!flush) {
644 info = IEEE80211_SKB_CB(bf->bf_mpdu);
645 memcpy(info->control.rates, bf->rates,
646 sizeof(info->control.rates));
635 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); 647 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
648 }
636 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); 649 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
637 } else 650 } else
638 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); 651 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok);
@@ -676,7 +689,7 @@ static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,
676 689
677 skb = bf->bf_mpdu; 690 skb = bf->bf_mpdu;
678 tx_info = IEEE80211_SKB_CB(skb); 691 tx_info = IEEE80211_SKB_CB(skb);
679 rates = tx_info->control.rates; 692 rates = bf->rates;
680 693
681 /* 694 /*
682 * Find the lowest frame length among the rate series that will have a 695 * Find the lowest frame length among the rate series that will have a
@@ -1256,18 +1269,23 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
1256 return 0; 1269 return 0;
1257} 1270}
1258 1271
1259void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) 1272bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
1273 bool flush)
1260{ 1274{
1261 struct ath_node *an = (struct ath_node *)sta->drv_priv; 1275 struct ath_node *an = (struct ath_node *)sta->drv_priv;
1262 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); 1276 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
1263 struct ath_txq *txq = txtid->ac->txq; 1277 struct ath_txq *txq = txtid->ac->txq;
1278 bool ret = !flush;
1279
1280 if (flush)
1281 txtid->stop_cb = false;
1264 1282
1265 if (txtid->state & AGGR_CLEANUP) 1283 if (txtid->state & AGGR_CLEANUP)
1266 return; 1284 return false;
1267 1285
1268 if (!(txtid->state & AGGR_ADDBA_COMPLETE)) { 1286 if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
1269 txtid->state &= ~AGGR_ADDBA_PROGRESS; 1287 txtid->state &= ~AGGR_ADDBA_PROGRESS;
1270 return; 1288 return ret;
1271 } 1289 }
1272 1290
1273 ath_txq_lock(sc, txq); 1291 ath_txq_lock(sc, txq);
@@ -1279,13 +1297,17 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
1279 * TID can only be reused after all in-progress subframes have been 1297 * TID can only be reused after all in-progress subframes have been
1280 * completed. 1298 * completed.
1281 */ 1299 */
1282 if (txtid->baw_head != txtid->baw_tail) 1300 if (txtid->baw_head != txtid->baw_tail) {
1283 txtid->state |= AGGR_CLEANUP; 1301 txtid->state |= AGGR_CLEANUP;
1284 else 1302 ret = false;
1303 txtid->stop_cb = !flush;
1304 } else {
1285 txtid->state &= ~AGGR_ADDBA_COMPLETE; 1305 txtid->state &= ~AGGR_ADDBA_COMPLETE;
1306 }
1286 1307
1287 ath_tx_flush_tid(sc, txtid); 1308 ath_tx_flush_tid(sc, txtid, flush);
1288 ath_txq_unlock_complete(sc, txq); 1309 ath_txq_unlock_complete(sc, txq);
1310 return ret;
1289} 1311}
1290 1312
1291void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, 1313void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
@@ -2415,6 +2437,7 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
2415 tid->ac = &an->ac[acno]; 2437 tid->ac = &an->ac[acno];
2416 tid->state &= ~AGGR_ADDBA_COMPLETE; 2438 tid->state &= ~AGGR_ADDBA_COMPLETE;
2417 tid->state &= ~AGGR_ADDBA_PROGRESS; 2439 tid->state &= ~AGGR_ADDBA_PROGRESS;
2440 tid->stop_cb = false;
2418 } 2441 }
2419 2442
2420 for (acno = 0, ac = &an->ac[acno]; 2443 for (acno = 0, ac = &an->ac[acno];
@@ -2451,8 +2474,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2451 } 2474 }
2452 2475
2453 ath_tid_drain(sc, txq, tid); 2476 ath_tid_drain(sc, txq, tid);
2454 tid->state &= ~AGGR_ADDBA_COMPLETE; 2477 ath_tx_clear_tid(sc, tid);
2455 tid->state &= ~AGGR_CLEANUP;
2456 2478
2457 ath_txq_unlock(sc, txq); 2479 ath_txq_unlock(sc, txq);
2458 } 2480 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 6d758f285352..761f501959a9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -4140,6 +4140,10 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = {
4140 .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | 4140 .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
4141 BIT(NL80211_IFTYPE_P2P_GO) 4141 BIT(NL80211_IFTYPE_P2P_GO)
4142 }, 4142 },
4143 {
4144 .max = 1,
4145 .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
4146 }
4143}; 4147};
4144static const struct ieee80211_iface_combination brcmf_iface_combos[] = { 4148static const struct ieee80211_iface_combination brcmf_iface_combos[] = {
4145 { 4149 {
@@ -4197,7 +4201,8 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)
4197 BIT(NL80211_IFTYPE_ADHOC) | 4201 BIT(NL80211_IFTYPE_ADHOC) |
4198 BIT(NL80211_IFTYPE_AP) | 4202 BIT(NL80211_IFTYPE_AP) |
4199 BIT(NL80211_IFTYPE_P2P_CLIENT) | 4203 BIT(NL80211_IFTYPE_P2P_CLIENT) |
4200 BIT(NL80211_IFTYPE_P2P_GO); 4204 BIT(NL80211_IFTYPE_P2P_GO) |
4205 BIT(NL80211_IFTYPE_P2P_DEVICE);
4201 wiphy->iface_combinations = brcmf_iface_combos; 4206 wiphy->iface_combinations = brcmf_iface_combos;
4202 wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); 4207 wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
4203 wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; 4208 wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 592d0aa634a8..e9a3cbc409ae 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -1423,7 +1423,7 @@ il_setup_rx_scan_handlers(struct il_priv *il)
1423} 1423}
1424EXPORT_SYMBOL(il_setup_rx_scan_handlers); 1424EXPORT_SYMBOL(il_setup_rx_scan_handlers);
1425 1425
1426inline u16 1426u16
1427il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, 1427il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band,
1428 u8 n_probes) 1428 u8 n_probes)
1429{ 1429{
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
index 191dcae8ba47..c6384555aab4 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
@@ -173,6 +173,8 @@ enum {
173 REPLY_DEBUG_CMD = 0xf0, 173 REPLY_DEBUG_CMD = 0xf0,
174 DEBUG_LOG_MSG = 0xf7, 174 DEBUG_LOG_MSG = 0xf7,
175 175
176 MCAST_FILTER_CMD = 0xd0,
177
176 /* D3 commands/notifications */ 178 /* D3 commands/notifications */
177 D3_CONFIG_CMD = 0xd3, 179 D3_CONFIG_CMD = 0xd3,
178 PROT_OFFLOAD_CONFIG_CMD = 0xd4, 180 PROT_OFFLOAD_CONFIG_CMD = 0xd4,
@@ -948,4 +950,29 @@ struct iwl_set_calib_default_cmd {
948 u8 data[0]; 950 u8 data[0];
949} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */ 951} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
950 952
953#define MAX_PORT_ID_NUM 2
954
955/**
956 * struct iwl_mcast_filter_cmd - configure multicast filter.
957 * @filter_own: Set 1 to filter out multicast packets sent by station itself
958 * @port_id: Multicast MAC addresses array specifier. This is a strange way
959 * to identify network interface adopted in host-device IF.
960 * It is used by FW as index in array of addresses. This array has
961 * MAX_PORT_ID_NUM members.
962 * @count: Number of MAC addresses in the array
963 * @pass_all: Set 1 to pass all multicast packets.
964 * @bssid: current association BSSID.
965 * @addr_list: Place holder for array of MAC addresses.
966 * IMPORTANT: add padding if necessary to ensure DWORD alignment.
967 */
968struct iwl_mcast_filter_cmd {
969 u8 filter_own;
970 u8 port_id;
971 u8 count;
972 u8 pass_all;
973 u8 bssid[6];
974 u8 reserved[2];
975 u8 addr_list[0];
976} __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
977
951#endif /* __fw_api_h__ */ 978#endif /* __fw_api_h__ */
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index e6eca4d66f6c..b2cc3d98e0f7 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -586,10 +586,12 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
586 */ 586 */
587static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, 587static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm,
588 struct ieee80211_vif *vif, 588 struct ieee80211_vif *vif,
589 struct iwl_mac_data_sta *ctxt_sta) 589 struct iwl_mac_data_sta *ctxt_sta,
590 bool force_assoc_off)
590{ 591{
591 /* We need the dtim_period to set the MAC as associated */ 592 /* We need the dtim_period to set the MAC as associated */
592 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) { 593 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period &&
594 !force_assoc_off) {
593 u32 dtim_offs; 595 u32 dtim_offs;
594 596
595 /* 597 /*
@@ -659,7 +661,8 @@ static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm,
659 cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); 661 cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON);
660 662
661 /* Fill the data specific for station mode */ 663 /* Fill the data specific for station mode */
662 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta); 664 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta,
665 action == FW_CTXT_ACTION_ADD);
663 666
664 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 667 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
665} 668}
@@ -677,7 +680,8 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm,
677 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); 680 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
678 681
679 /* Fill the data specific for station mode */ 682 /* Fill the data specific for station mode */
680 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta); 683 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta,
684 action == FW_CTXT_ACTION_ADD);
681 685
682 cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & 686 cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow &
683 IEEE80211_P2P_OPPPS_CTWINDOW_MASK); 687 IEEE80211_P2P_OPPPS_CTWINDOW_MASK);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index dd158ec571fb..a5eb8c82f16a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -701,6 +701,20 @@ static void iwl_mvm_configure_filter(struct ieee80211_hw *hw,
701 *total_flags = 0; 701 *total_flags = 0;
702} 702}
703 703
704static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm,
705 struct ieee80211_vif *vif)
706{
707 struct iwl_mcast_filter_cmd mcast_filter_cmd = {
708 .pass_all = 1,
709 };
710
711 memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN);
712
713 return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC,
714 sizeof(mcast_filter_cmd),
715 &mcast_filter_cmd);
716}
717
704static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, 718static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
705 struct ieee80211_vif *vif, 719 struct ieee80211_vif *vif,
706 struct ieee80211_bss_conf *bss_conf, 720 struct ieee80211_bss_conf *bss_conf,
@@ -722,6 +736,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
722 return; 736 return;
723 } 737 }
724 iwl_mvm_bt_coex_vif_assoc(mvm, vif); 738 iwl_mvm_bt_coex_vif_assoc(mvm, vif);
739 iwl_mvm_configure_mcast_filter(mvm, vif);
725 } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { 740 } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
726 /* remove AP station now that the MAC is unassoc */ 741 /* remove AP station now that the MAC is unassoc */
727 ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); 742 ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id);
@@ -931,7 +946,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
931 946
932 switch (cmd) { 947 switch (cmd) {
933 case STA_NOTIFY_SLEEP: 948 case STA_NOTIFY_SLEEP:
934 if (atomic_read(&mvmsta->pending_frames) > 0) 949 if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0)
935 ieee80211_sta_block_awake(hw, sta, true); 950 ieee80211_sta_block_awake(hw, sta, true);
936 /* 951 /*
937 * The fw updates the STA to be asleep. Tx packets on the Tx 952 * The fw updates the STA to be asleep. Tx packets on the Tx
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 8269bc562951..9f46b23801bc 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -292,6 +292,7 @@ struct iwl_mvm {
292 struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; 292 struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT];
293 struct work_struct sta_drained_wk; 293 struct work_struct sta_drained_wk;
294 unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; 294 unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)];
295 atomic_t pending_frames[IWL_MVM_STATION_COUNT];
295 296
296 /* configured by mac80211 */ 297 /* configured by mac80211 */
297 u32 rts_threshold; 298 u32 rts_threshold;
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index fe031d304d1e..b29c31a41594 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -292,6 +292,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = {
292 CMD(BT_COEX_PROT_ENV), 292 CMD(BT_COEX_PROT_ENV),
293 CMD(BT_PROFILE_NOTIFICATION), 293 CMD(BT_PROFILE_NOTIFICATION),
294 CMD(BT_CONFIG), 294 CMD(BT_CONFIG),
295 CMD(MCAST_FILTER_CMD),
295}; 296};
296#undef CMD 297#undef CMD
297 298
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 2157b0f8ced5..2476e43799d5 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -298,6 +298,12 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
298 else 298 else
299 cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); 299 cmd->type = cpu_to_le32(SCAN_TYPE_FORCED);
300 300
301 /*
302 * TODO: This is a WA due to a bug in the FW AUX framework that does not
303 * properly handle time events that fail to be scheduled
304 */
305 cmd->type = cpu_to_le32(SCAN_TYPE_FORCED);
306
301 cmd->repeats = cpu_to_le32(1); 307 cmd->repeats = cpu_to_le32(1);
302 308
303 /* 309 /*
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index 0fd96e4da461..5c664ed54400 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -219,7 +219,7 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
219 mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF; 219 mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
220 220
221 /* HW restart, don't assume the memory has been zeroed */ 221 /* HW restart, don't assume the memory has been zeroed */
222 atomic_set(&mvm_sta->pending_frames, 0); 222 atomic_set(&mvm->pending_frames[sta_id], 0);
223 mvm_sta->tid_disable_agg = 0; 223 mvm_sta->tid_disable_agg = 0;
224 mvm_sta->tfd_queue_msk = 0; 224 mvm_sta->tfd_queue_msk = 0;
225 for (i = 0; i < IEEE80211_NUM_ACS; i++) 225 for (i = 0; i < IEEE80211_NUM_ACS; i++)
@@ -407,14 +407,21 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
407 } 407 }
408 408
409 /* 409 /*
410 * Make sure that the tx response code sees the station as -EBUSY and
411 * calls the drain worker.
412 */
413 spin_lock_bh(&mvm_sta->lock);
414 /*
410 * There are frames pending on the AC queues for this station. 415 * There are frames pending on the AC queues for this station.
411 * We need to wait until all the frames are drained... 416 * We need to wait until all the frames are drained...
412 */ 417 */
413 if (atomic_read(&mvm_sta->pending_frames)) { 418 if (atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) {
414 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true);
415 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], 419 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id],
416 ERR_PTR(-EBUSY)); 420 ERR_PTR(-EBUSY));
421 spin_unlock_bh(&mvm_sta->lock);
422 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true);
417 } else { 423 } else {
424 spin_unlock_bh(&mvm_sta->lock);
418 ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); 425 ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id);
419 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); 426 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL);
420 } 427 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h b/drivers/net/wireless/iwlwifi/mvm/sta.h
index 12abd2d71835..a4ddce77aaae 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.h
@@ -274,7 +274,6 @@ struct iwl_mvm_tid_data {
274 * @bt_reduced_txpower: is reduced tx power enabled for this station 274 * @bt_reduced_txpower: is reduced tx power enabled for this station
275 * @lock: lock to protect the whole struct. Since %tid_data is access from Tx 275 * @lock: lock to protect the whole struct. Since %tid_data is access from Tx
276 * and from Tx response flow, it needs a spinlock. 276 * and from Tx response flow, it needs a spinlock.
277 * @pending_frames: number of frames for this STA on the shared Tx queues.
278 * @tid_data: per tid data. Look at %iwl_mvm_tid_data. 277 * @tid_data: per tid data. Look at %iwl_mvm_tid_data.
279 * 278 *
280 * When mac80211 creates a station it reserves some space (hw->sta_data_size) 279 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
@@ -290,7 +289,6 @@ struct iwl_mvm_sta {
290 u8 max_agg_bufsize; 289 u8 max_agg_bufsize;
291 bool bt_reduced_txpower; 290 bool bt_reduced_txpower;
292 spinlock_t lock; 291 spinlock_t lock;
293 atomic_t pending_frames;
294 struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT]; 292 struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT];
295 struct iwl_lq_sta lq_sta; 293 struct iwl_lq_sta lq_sta;
296 struct ieee80211_vif *vif; 294 struct ieee80211_vif *vif;
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 479074303bd7..f212f16502ff 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -416,9 +416,8 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
416 416
417 spin_unlock(&mvmsta->lock); 417 spin_unlock(&mvmsta->lock);
418 418
419 if (mvmsta->vif->type == NL80211_IFTYPE_AP && 419 if (txq_id < IWL_MVM_FIRST_AGG_QUEUE)
420 txq_id < IWL_MVM_FIRST_AGG_QUEUE) 420 atomic_inc(&mvm->pending_frames[mvmsta->sta_id]);
421 atomic_inc(&mvmsta->pending_frames);
422 421
423 return 0; 422 return 0;
424 423
@@ -680,16 +679,41 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
680 /* 679 /*
681 * If the txq is not an AMPDU queue, there is no chance we freed 680 * If the txq is not an AMPDU queue, there is no chance we freed
682 * several skbs. Check that out... 681 * several skbs. Check that out...
683 * If there are no pending frames for this STA, notify mac80211 that
684 * this station can go to sleep in its STA table.
685 */ 682 */
686 if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && mvmsta && 683 if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && !WARN_ON(skb_freed > 1) &&
687 !WARN_ON(skb_freed > 1) && 684 atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) {
688 mvmsta->vif->type == NL80211_IFTYPE_AP && 685 if (mvmsta) {
689 atomic_sub_and_test(skb_freed, &mvmsta->pending_frames)) { 686 /*
690 ieee80211_sta_block_awake(mvm->hw, sta, false); 687 * If there are no pending frames for this STA, notify
691 set_bit(sta_id, mvm->sta_drained); 688 * mac80211 that this station can go to sleep in its
692 schedule_work(&mvm->sta_drained_wk); 689 * STA table.
690 */
691 if (mvmsta->vif->type == NL80211_IFTYPE_AP)
692 ieee80211_sta_block_awake(mvm->hw, sta, false);
693 /*
694 * We might very well have taken mvmsta pointer while
695 * the station was being removed. The remove flow might
696 * have seen a pending_frame (because we didn't take
697 * the lock) even if now the queues are drained. So make
698 * really sure now that this the station is not being
699 * removed. If it is, run the drain worker to remove it.
700 */
701 spin_lock_bh(&mvmsta->lock);
702 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
703 if (IS_ERR_OR_NULL(sta)) {
704 /*
705 * Station disappeared in the meantime:
706 * so we are draining.
707 */
708 set_bit(sta_id, mvm->sta_drained);
709 schedule_work(&mvm->sta_drained_wk);
710 }
711 spin_unlock_bh(&mvmsta->lock);
712 } else if (!mvmsta) {
713 /* Tx response without STA, so we are draining */
714 set_bit(sta_id, mvm->sta_drained);
715 schedule_work(&mvm->sta_drained_wk);
716 }
693 } 717 }
694 718
695 rcu_read_unlock(); 719 rcu_read_unlock();
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index b878a32e7a98..cb34c7895f2a 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1723,11 +1723,11 @@ static void mac80211_hwsim_free(void)
1723 class_destroy(hwsim_class); 1723 class_destroy(hwsim_class);
1724} 1724}
1725 1725
1726 1726static struct platform_driver mac80211_hwsim_driver = {
1727static struct device_driver mac80211_hwsim_driver = { 1727 .driver = {
1728 .name = "mac80211_hwsim", 1728 .name = "mac80211_hwsim",
1729 .bus = &platform_bus_type, 1729 .owner = THIS_MODULE,
1730 .owner = THIS_MODULE, 1730 },
1731}; 1731};
1732 1732
1733static const struct net_device_ops hwsim_netdev_ops = { 1733static const struct net_device_ops hwsim_netdev_ops = {
@@ -2219,7 +2219,7 @@ static int __init init_mac80211_hwsim(void)
2219 spin_lock_init(&hwsim_radio_lock); 2219 spin_lock_init(&hwsim_radio_lock);
2220 INIT_LIST_HEAD(&hwsim_radios); 2220 INIT_LIST_HEAD(&hwsim_radios);
2221 2221
2222 err = driver_register(&mac80211_hwsim_driver); 2222 err = platform_driver_register(&mac80211_hwsim_driver);
2223 if (err) 2223 if (err)
2224 return err; 2224 return err;
2225 2225
@@ -2254,7 +2254,7 @@ static int __init init_mac80211_hwsim(void)
2254 err = -ENOMEM; 2254 err = -ENOMEM;
2255 goto failed_drvdata; 2255 goto failed_drvdata;
2256 } 2256 }
2257 data->dev->driver = &mac80211_hwsim_driver; 2257 data->dev->driver = &mac80211_hwsim_driver.driver;
2258 err = device_bind_driver(data->dev); 2258 err = device_bind_driver(data->dev);
2259 if (err != 0) { 2259 if (err != 0) {
2260 printk(KERN_DEBUG 2260 printk(KERN_DEBUG
@@ -2564,7 +2564,7 @@ failed_drvdata:
2564failed: 2564failed:
2565 mac80211_hwsim_free(); 2565 mac80211_hwsim_free();
2566failed_unregister_driver: 2566failed_unregister_driver:
2567 driver_unregister(&mac80211_hwsim_driver); 2567 platform_driver_unregister(&mac80211_hwsim_driver);
2568 return err; 2568 return err;
2569} 2569}
2570module_init(init_mac80211_hwsim); 2570module_init(init_mac80211_hwsim);
@@ -2577,6 +2577,6 @@ static void __exit exit_mac80211_hwsim(void)
2577 2577
2578 mac80211_hwsim_free(); 2578 mac80211_hwsim_free();
2579 unregister_netdev(hwsim_mon); 2579 unregister_netdev(hwsim_mon);
2580 driver_unregister(&mac80211_hwsim_driver); 2580 platform_driver_unregister(&mac80211_hwsim_driver);
2581} 2581}
2582module_exit(exit_mac80211_hwsim); 2582module_exit(exit_mac80211_hwsim);
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
index d3a02e73f53a..21ca33a7c770 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
@@ -550,7 +550,7 @@ do { \
550 rxmcs == DESC92C_RATE11M) 550 rxmcs == DESC92C_RATE11M)
551 551
552struct phy_rx_agc_info_t { 552struct phy_rx_agc_info_t {
553 #if __LITTLE_ENDIAN 553 #ifdef __LITTLE_ENDIAN
554 u8 gain:7, trsw:1; 554 u8 gain:7, trsw:1;
555 #else 555 #else
556 u8 trsw:1, gain:7; 556 u8 trsw:1, gain:7;
@@ -574,7 +574,7 @@ struct phy_status_rpt {
574 u8 stream_target_csi[2]; 574 u8 stream_target_csi[2];
575 u8 sig_evm; 575 u8 sig_evm;
576 u8 rsvd_3; 576 u8 rsvd_3;
577#if __LITTLE_ENDIAN 577#ifdef __LITTLE_ENDIAN
578 u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ 578 u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/
579 u8 sgi_en:1; 579 u8 sgi_en:1;
580 u8 rxsc:2; 580 u8 rxsc:2;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23d640a4debd..938b1e670b93 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -349,6 +349,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
349 {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ 349 {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/
350 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ 350 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/
351 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ 351 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/
352 {RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/
352 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ 353 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
353 {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ 354 {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/
354 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ 355 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/