aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-12-08 16:15:38 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-08 16:47:38 -0500
commitfe6c791570efe717946ea7b7dd50aec96b70d551 (patch)
tree1becb5e8aea7a9c9a7d78f987bd73b0a5d8ee434
parentf8bf5681cf15f77692c8ad8cb95d059ff7c622c9 (diff)
parentf19872575ff7819a3723154657a497d9bca66b33 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/ath/ath9k/ar9003_eeprom.c net/llc/af_llc.c
-rw-r--r--Documentation/networking/ip-sysctl.txt1
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/bluetooth/ath3k.c4
-rw-r--r--drivers/bluetooth/btusb.c12
-rw-r--r--drivers/isdn/icn/icn.c7
-rw-r--r--drivers/net/Kconfig6
-rw-r--r--drivers/net/atl1c/atl1c_hw.c2
-rw-r--r--drivers/net/au1000_eth.c10
-rw-r--r--drivers/net/b44.c11
-rw-r--r--drivers/net/benet/be_cmds.c2
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/caif/caif_shm_u5500.c2
-rw-r--r--drivers/net/caif/caif_shmcore.c2
-rw-r--r--drivers/net/cxgb4/t4_hw.c2
-rw-r--r--drivers/net/cxgb4vf/cxgb4vf_main.c73
-rw-r--r--drivers/net/cxgb4vf/t4vf_hw.c94
-rw-r--r--drivers/net/e1000/e1000_main.c12
-rw-r--r--drivers/net/ehea/ehea_ethtool.c9
-rw-r--r--drivers/net/ehea/ehea_main.c25
-rw-r--r--drivers/net/ifb.c2
-rw-r--r--drivers/net/irda/sh_sir.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c3
-rw-r--r--drivers/net/pch_gbe/pch_gbe_main.c6
-rw-r--r--drivers/net/pch_gbe/pch_gbe_param.c8
-rw-r--r--drivers/net/phy/marvell.c164
-rw-r--r--drivers/net/ppp_generic.c43
-rw-r--r--drivers/net/qlge/qlge_main.c6
-rw-r--r--drivers/net/sfc/efx.c43
-rw-r--r--drivers/net/sfc/net_driver.h2
-rw-r--r--drivers/net/sfc/nic.c6
-rw-r--r--drivers/net/stmmac/stmmac_main.c4
-rw-r--r--drivers/net/tulip/dmfe.c6
-rw-r--r--drivers/net/ucc_geth.h3
-rw-r--r--drivers/net/usb/hso.c10
-rw-r--r--drivers/net/wan/x25_asy.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c315
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.h9
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h27
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_def.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c16
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h6
-rw-r--r--drivers/net/wireless/ath/carl9170/fw.c3
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c3
-rw-r--r--drivers/net/wireless/ath/carl9170/tx.c2
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c1
-rw-r--r--drivers/net/wireless/libertas/if_spi.c1
-rw-r--r--drivers/net/wireless/libertas/main.c2
-rw-r--r--drivers/net/wireless/orinoco/main.c12
-rw-r--r--drivers/net/wireless/orinoco/scan.c8
-rw-r--r--drivers/net/wireless/orinoco/scan.h1
-rw-r--r--drivers/vhost/net.c5
-rw-r--r--include/linux/marvell_phy.h1
-rw-r--r--include/linux/snmp.h1
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/sock.h4
-rw-r--r--net/bluetooth/sco.c6
-rw-r--r--net/ceph/Makefile22
-rw-r--r--net/ceph/buffer.c2
-rw-r--r--net/core/filter.c19
-rw-r--r--net/core/request_sock.c4
-rw-r--r--net/dccp/input.c3
-rw-r--r--net/decnet/af_decnet.c2
-rw-r--r--net/econet/af_econet.c93
-rw-r--r--net/ipv4/fib_trie.c2
-rw-r--r--net/ipv4/inet_hashtables.c3
-rw-r--r--net/ipv4/proc.c1
-rw-r--r--net/ipv4/sysctl_net_ipv4.c6
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_ipv4.c4
-rw-r--r--net/ipv4/tcp_minisocks.c2
-rw-r--r--net/ipv4/tcp_output.c42
-rw-r--r--net/ipv6/ip6_tunnel.c7
-rw-r--r--net/ipv6/sit.c3
-rw-r--r--net/l2tp/l2tp_ip.c6
-rw-r--r--net/mac80211/rx.c6
-rw-r--r--net/mac80211/tx.c7
-rw-r--r--net/unix/af_unix.c37
-rw-r--r--net/unix/garbage.c9
-rw-r--r--net/x25/x25_link.c1
-rw-r--r--net/xfrm/xfrm_hash.c2
84 files changed, 824 insertions, 516 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index ae5522703d16..2193a5d124c5 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -144,6 +144,7 @@ tcp_adv_win_scale - INTEGER
144 Count buffering overhead as bytes/2^tcp_adv_win_scale 144 Count buffering overhead as bytes/2^tcp_adv_win_scale
145 (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale), 145 (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale),
146 if it is <= 0. 146 if it is <= 0.
147 Possible values are [-31, 31], inclusive.
147 Default: 2 148 Default: 2
148 149
149tcp_allowed_congestion_control - STRING 150tcp_allowed_congestion_control - STRING
diff --git a/MAINTAINERS b/MAINTAINERS
index 8b6ca96435ee..9206cb462913 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1359,7 +1359,7 @@ F: include/net/bluetooth/
1359 1359
1360BONDING DRIVER 1360BONDING DRIVER
1361M: Jay Vosburgh <fubar@us.ibm.com> 1361M: Jay Vosburgh <fubar@us.ibm.com>
1362L: bonding-devel@lists.sourceforge.net 1362L: netdev@vger.kernel.org
1363W: http://sourceforge.net/projects/bonding/ 1363W: http://sourceforge.net/projects/bonding/
1364S: Supported 1364S: Supported
1365F: drivers/net/bonding/ 1365F: drivers/net/bonding/
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 128cae4e8629..949ed09c6361 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -35,6 +35,10 @@
35static struct usb_device_id ath3k_table[] = { 35static struct usb_device_id ath3k_table[] = {
36 /* Atheros AR3011 */ 36 /* Atheros AR3011 */
37 { USB_DEVICE(0x0CF3, 0x3000) }, 37 { USB_DEVICE(0x0CF3, 0x3000) },
38
39 /* Atheros AR3011 with sflash firmware*/
40 { USB_DEVICE(0x0CF3, 0x3002) },
41
38 { } /* Terminating entry */ 42 { } /* Terminating entry */
39}; 43};
40 44
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ab3894f742c3..1da773f899a2 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -99,6 +99,9 @@ static struct usb_device_id blacklist_table[] = {
99 /* Broadcom BCM2033 without firmware */ 99 /* Broadcom BCM2033 without firmware */
100 { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, 100 { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE },
101 101
102 /* Atheros 3011 with sflash firmware */
103 { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
104
102 /* Broadcom BCM2035 */ 105 /* Broadcom BCM2035 */
103 { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, 106 { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },
104 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, 107 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU },
@@ -239,7 +242,8 @@ static void btusb_intr_complete(struct urb *urb)
239 242
240 err = usb_submit_urb(urb, GFP_ATOMIC); 243 err = usb_submit_urb(urb, GFP_ATOMIC);
241 if (err < 0) { 244 if (err < 0) {
242 BT_ERR("%s urb %p failed to resubmit (%d)", 245 if (err != -EPERM)
246 BT_ERR("%s urb %p failed to resubmit (%d)",
243 hdev->name, urb, -err); 247 hdev->name, urb, -err);
244 usb_unanchor_urb(urb); 248 usb_unanchor_urb(urb);
245 } 249 }
@@ -323,7 +327,8 @@ static void btusb_bulk_complete(struct urb *urb)
323 327
324 err = usb_submit_urb(urb, GFP_ATOMIC); 328 err = usb_submit_urb(urb, GFP_ATOMIC);
325 if (err < 0) { 329 if (err < 0) {
326 BT_ERR("%s urb %p failed to resubmit (%d)", 330 if (err != -EPERM)
331 BT_ERR("%s urb %p failed to resubmit (%d)",
327 hdev->name, urb, -err); 332 hdev->name, urb, -err);
328 usb_unanchor_urb(urb); 333 usb_unanchor_urb(urb);
329 } 334 }
@@ -412,7 +417,8 @@ static void btusb_isoc_complete(struct urb *urb)
412 417
413 err = usb_submit_urb(urb, GFP_ATOMIC); 418 err = usb_submit_urb(urb, GFP_ATOMIC);
414 if (err < 0) { 419 if (err < 0) {
415 BT_ERR("%s urb %p failed to resubmit (%d)", 420 if (err != -EPERM)
421 BT_ERR("%s urb %p failed to resubmit (%d)",
416 hdev->name, urb, -err); 422 hdev->name, urb, -err);
417 usb_unanchor_urb(urb); 423 usb_unanchor_urb(urb);
418 } 424 }
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 2e847a90bad0..f2b5bab5e6a1 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -1627,7 +1627,7 @@ __setup("icn=", icn_setup);
1627static int __init icn_init(void) 1627static int __init icn_init(void)
1628{ 1628{
1629 char *p; 1629 char *p;
1630 char rev[10]; 1630 char rev[20];
1631 1631
1632 memset(&dev, 0, sizeof(icn_dev)); 1632 memset(&dev, 0, sizeof(icn_dev));
1633 dev.memaddr = (membase & 0x0ffc000); 1633 dev.memaddr = (membase & 0x0ffc000);
@@ -1637,9 +1637,10 @@ static int __init icn_init(void)
1637 spin_lock_init(&dev.devlock); 1637 spin_lock_init(&dev.devlock);
1638 1638
1639 if ((p = strchr(revision, ':'))) { 1639 if ((p = strchr(revision, ':'))) {
1640 strcpy(rev, p + 1); 1640 strncpy(rev, p + 1, 20);
1641 p = strchr(rev, '$'); 1641 p = strchr(rev, '$');
1642 *p = 0; 1642 if (p)
1643 *p = 0;
1643 } else 1644 } else
1644 strcpy(rev, " ??? "); 1645 strcpy(rev, " ??? ");
1645 printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev, 1646 printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev,
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index a11dc735752c..a20693fcb321 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2543,10 +2543,10 @@ config PCH_GBE
2543 depends on PCI 2543 depends on PCI
2544 select MII 2544 select MII
2545 ---help--- 2545 ---help---
2546 This is a gigabit ethernet driver for Topcliff PCH. 2546 This is a gigabit ethernet driver for EG20T PCH.
2547 Topcliff PCH is the platform controller hub that is used in Intel's 2547 EG20T PCH is the platform controller hub that is used in Intel's
2548 general embedded platform. 2548 general embedded platform.
2549 Topcliff PCH has Gigabit Ethernet interface. 2549 EG20T PCH has Gigabit Ethernet interface.
2550 Using this interface, it is able to access system devices connected 2550 Using this interface, it is able to access system devices connected
2551 to Gigabit Ethernet. 2551 to Gigabit Ethernet.
2552 This driver enables Gigabit Ethernet function. 2552 This driver enables Gigabit Ethernet function.
diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c
index 919080b2c3a5..1bf672009948 100644
--- a/drivers/net/atl1c/atl1c_hw.c
+++ b/drivers/net/atl1c/atl1c_hw.c
@@ -82,7 +82,7 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
82 addr[0] = addr[1] = 0; 82 addr[0] = addr[1] = 0;
83 AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data); 83 AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data);
84 if (atl1c_check_eeprom_exist(hw)) { 84 if (atl1c_check_eeprom_exist(hw)) {
85 if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b) { 85 if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c) {
86 /* Enable OTP CLK */ 86 /* Enable OTP CLK */
87 if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) { 87 if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) {
88 otp_ctrl_data |= OTP_CTRL_CLK_EN; 88 otp_ctrl_data |= OTP_CTRL_CLK_EN;
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 43489f89c142..53eff9ba6e95 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -155,10 +155,10 @@ static void au1000_enable_mac(struct net_device *dev, int force_reset)
155 spin_lock_irqsave(&aup->lock, flags); 155 spin_lock_irqsave(&aup->lock, flags);
156 156
157 if (force_reset || (!aup->mac_enabled)) { 157 if (force_reset || (!aup->mac_enabled)) {
158 writel(MAC_EN_CLOCK_ENABLE, &aup->enable); 158 writel(MAC_EN_CLOCK_ENABLE, aup->enable);
159 au_sync_delay(2); 159 au_sync_delay(2);
160 writel((MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2 160 writel((MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2
161 | MAC_EN_CLOCK_ENABLE), &aup->enable); 161 | MAC_EN_CLOCK_ENABLE), aup->enable);
162 au_sync_delay(2); 162 au_sync_delay(2);
163 163
164 aup->mac_enabled = 1; 164 aup->mac_enabled = 1;
@@ -503,9 +503,9 @@ static void au1000_reset_mac_unlocked(struct net_device *dev)
503 503
504 au1000_hard_stop(dev); 504 au1000_hard_stop(dev);
505 505
506 writel(MAC_EN_CLOCK_ENABLE, &aup->enable); 506 writel(MAC_EN_CLOCK_ENABLE, aup->enable);
507 au_sync_delay(2); 507 au_sync_delay(2);
508 writel(0, &aup->enable); 508 writel(0, aup->enable);
509 au_sync_delay(2); 509 au_sync_delay(2);
510 510
511 aup->tx_full = 0; 511 aup->tx_full = 0;
@@ -1119,7 +1119,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1119 /* set a random MAC now in case platform_data doesn't provide one */ 1119 /* set a random MAC now in case platform_data doesn't provide one */
1120 random_ether_addr(dev->dev_addr); 1120 random_ether_addr(dev->dev_addr);
1121 1121
1122 writel(0, &aup->enable); 1122 writel(0, aup->enable);
1123 aup->mac_enabled = 0; 1123 aup->mac_enabled = 0;
1124 1124
1125 pd = pdev->dev.platform_data; 1125 pd = pdev->dev.platform_data;
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index c6e86315b3f8..2e2b76258ab4 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -381,11 +381,11 @@ static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
381 __b44_set_flow_ctrl(bp, pause_enab); 381 __b44_set_flow_ctrl(bp, pause_enab);
382} 382}
383 383
384#ifdef SSB_DRIVER_MIPS 384#ifdef CONFIG_BCM47XX
385extern char *nvram_get(char *name); 385#include <asm/mach-bcm47xx/nvram.h>
386static void b44_wap54g10_workaround(struct b44 *bp) 386static void b44_wap54g10_workaround(struct b44 *bp)
387{ 387{
388 const char *str; 388 char buf[20];
389 u32 val; 389 u32 val;
390 int err; 390 int err;
391 391
@@ -394,10 +394,9 @@ static void b44_wap54g10_workaround(struct b44 *bp)
394 * see https://dev.openwrt.org/ticket/146 394 * see https://dev.openwrt.org/ticket/146
395 * check and reset bit "isolate" 395 * check and reset bit "isolate"
396 */ 396 */
397 str = nvram_get("boardnum"); 397 if (nvram_getenv("boardnum", buf, sizeof(buf)) < 0)
398 if (!str)
399 return; 398 return;
400 if (simple_strtoul(str, NULL, 0) == 2) { 399 if (simple_strtoul(buf, NULL, 0) == 2) {
401 err = __b44_readphy(bp, 0, MII_BMCR, &val); 400 err = __b44_readphy(bp, 0, MII_BMCR, &val);
402 if (err) 401 if (err)
403 goto error; 402 goto error;
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 31c5ddc08fc8..171a08caf2be 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1274,7 +1274,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
1274 1274
1275 i = 0; 1275 i = 0;
1276 netdev_for_each_mc_addr(ha, netdev) 1276 netdev_for_each_mc_addr(ha, netdev)
1277 memcpy(req->mac[i].byte, ha->addr, ETH_ALEN); 1277 memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN);
1278 } else { 1278 } else {
1279 req->promiscuous = 1; 1279 req->promiscuous = 1;
1280 } 1280 }
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 0273ad0b57bb..bb33b3b347fa 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1570,7 +1570,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1570 1570
1571 /* If this is the first slave, then we need to set the master's hardware 1571 /* If this is the first slave, then we need to set the master's hardware
1572 * address to be the same as the slave's. */ 1572 * address to be the same as the slave's. */
1573 if (bond->slave_cnt == 0) 1573 if (is_zero_ether_addr(bond->dev->dev_addr))
1574 memcpy(bond->dev->dev_addr, slave_dev->dev_addr, 1574 memcpy(bond->dev->dev_addr, slave_dev->dev_addr,
1575 slave_dev->addr_len); 1575 slave_dev->addr_len);
1576 1576
diff --git a/drivers/net/caif/caif_shm_u5500.c b/drivers/net/caif/caif_shm_u5500.c
index 1cd90da86f13..32b1c6fb2de1 100644
--- a/drivers/net/caif/caif_shm_u5500.c
+++ b/drivers/net/caif/caif_shm_u5500.c
@@ -5,7 +5,7 @@
5 * License terms: GNU General Public License (GPL) version 2 5 * License terms: GNU General Public License (GPL) version 2
6 */ 6 */
7 7
8#define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt 8#define pr_fmt(fmt) KBUILD_MODNAME ":" fmt
9 9
10#include <linux/version.h> 10#include <linux/version.h>
11#include <linux/init.h> 11#include <linux/init.h>
diff --git a/drivers/net/caif/caif_shmcore.c b/drivers/net/caif/caif_shmcore.c
index 19f9c0656667..80511167f35b 100644
--- a/drivers/net/caif/caif_shmcore.c
+++ b/drivers/net/caif/caif_shmcore.c
@@ -6,7 +6,7 @@
6 * License terms: GNU General Public License (GPL) version 2 6 * License terms: GNU General Public License (GPL) version 2
7 */ 7 */
8 8
9#define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt 9#define pr_fmt(fmt) KBUILD_MODNAME ":" fmt
10 10
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c
index bb813d94aea8..e97521c801ea 100644
--- a/drivers/net/cxgb4/t4_hw.c
+++ b/drivers/net/cxgb4/t4_hw.c
@@ -2408,7 +2408,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox,
2408 if (index < NEXACT_MAC) 2408 if (index < NEXACT_MAC)
2409 ret++; 2409 ret++;
2410 else if (hash) 2410 else if (hash)
2411 *hash |= (1 << hash_mac_addr(addr[i])); 2411 *hash |= (1ULL << hash_mac_addr(addr[i]));
2412 } 2412 }
2413 return ret; 2413 return ret;
2414} 2414}
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 9246d2fa6cf9..f54af48edb93 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -814,40 +814,48 @@ static struct net_device_stats *cxgb4vf_get_stats(struct net_device *dev)
814} 814}
815 815
816/* 816/*
817 * Collect up to maxaddrs worth of a netdevice's unicast addresses into an 817 * Collect up to maxaddrs worth of a netdevice's unicast addresses, starting
818 * array of addrss pointers and return the number collected. 818 * at a specified offset within the list, into an array of addrss pointers and
819 * return the number collected.
819 */ 820 */
820static inline int collect_netdev_uc_list_addrs(const struct net_device *dev, 821static inline unsigned int collect_netdev_uc_list_addrs(const struct net_device *dev,
821 const u8 **addr, 822 const u8 **addr,
822 unsigned int maxaddrs) 823 unsigned int offset,
824 unsigned int maxaddrs)
823{ 825{
826 unsigned int index = 0;
824 unsigned int naddr = 0; 827 unsigned int naddr = 0;
825 const struct netdev_hw_addr *ha; 828 const struct netdev_hw_addr *ha;
826 829
827 for_each_dev_addr(dev, ha) { 830 for_each_dev_addr(dev, ha)
828 addr[naddr++] = ha->addr; 831 if (index++ >= offset) {
829 if (naddr >= maxaddrs) 832 addr[naddr++] = ha->addr;
830 break; 833 if (naddr >= maxaddrs)
831 } 834 break;
835 }
832 return naddr; 836 return naddr;
833} 837}
834 838
835/* 839/*
836 * Collect up to maxaddrs worth of a netdevice's multicast addresses into an 840 * Collect up to maxaddrs worth of a netdevice's multicast addresses, starting
837 * array of addrss pointers and return the number collected. 841 * at a specified offset within the list, into an array of addrss pointers and
842 * return the number collected.
838 */ 843 */
839static inline int collect_netdev_mc_list_addrs(const struct net_device *dev, 844static inline unsigned int collect_netdev_mc_list_addrs(const struct net_device *dev,
840 const u8 **addr, 845 const u8 **addr,
841 unsigned int maxaddrs) 846 unsigned int offset,
847 unsigned int maxaddrs)
842{ 848{
849 unsigned int index = 0;
843 unsigned int naddr = 0; 850 unsigned int naddr = 0;
844 const struct netdev_hw_addr *ha; 851 const struct netdev_hw_addr *ha;
845 852
846 netdev_for_each_mc_addr(ha, dev) { 853 netdev_for_each_mc_addr(ha, dev)
847 addr[naddr++] = ha->addr; 854 if (index++ >= offset) {
848 if (naddr >= maxaddrs) 855 addr[naddr++] = ha->addr;
849 break; 856 if (naddr >= maxaddrs)
850 } 857 break;
858 }
851 return naddr; 859 return naddr;
852} 860}
853 861
@@ -860,16 +868,20 @@ static int set_addr_filters(const struct net_device *dev, bool sleep)
860 u64 mhash = 0; 868 u64 mhash = 0;
861 u64 uhash = 0; 869 u64 uhash = 0;
862 bool free = true; 870 bool free = true;
863 u16 filt_idx[7]; 871 unsigned int offset, naddr;
864 const u8 *addr[7]; 872 const u8 *addr[7];
865 int ret, naddr = 0; 873 int ret;
866 const struct port_info *pi = netdev_priv(dev); 874 const struct port_info *pi = netdev_priv(dev);
867 875
868 /* first do the secondary unicast addresses */ 876 /* first do the secondary unicast addresses */
869 naddr = collect_netdev_uc_list_addrs(dev, addr, ARRAY_SIZE(addr)); 877 for (offset = 0; ; offset += naddr) {
870 if (naddr > 0) { 878 naddr = collect_netdev_uc_list_addrs(dev, addr, offset,
879 ARRAY_SIZE(addr));
880 if (naddr == 0)
881 break;
882
871 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, 883 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free,
872 naddr, addr, filt_idx, &uhash, sleep); 884 naddr, addr, NULL, &uhash, sleep);
873 if (ret < 0) 885 if (ret < 0)
874 return ret; 886 return ret;
875 887
@@ -877,12 +889,17 @@ static int set_addr_filters(const struct net_device *dev, bool sleep)
877 } 889 }
878 890
879 /* next set up the multicast addresses */ 891 /* next set up the multicast addresses */
880 naddr = collect_netdev_mc_list_addrs(dev, addr, ARRAY_SIZE(addr)); 892 for (offset = 0; ; offset += naddr) {
881 if (naddr > 0) { 893 naddr = collect_netdev_mc_list_addrs(dev, addr, offset,
894 ARRAY_SIZE(addr));
895 if (naddr == 0)
896 break;
897
882 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, 898 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free,
883 naddr, addr, filt_idx, &mhash, sleep); 899 naddr, addr, NULL, &mhash, sleep);
884 if (ret < 0) 900 if (ret < 0)
885 return ret; 901 return ret;
902 free = false;
886 } 903 }
887 904
888 return t4vf_set_addr_hash(pi->adapter, pi->viid, uhash != 0, 905 return t4vf_set_addr_hash(pi->adapter, pi->viid, uhash != 0,
diff --git a/drivers/net/cxgb4vf/t4vf_hw.c b/drivers/net/cxgb4vf/t4vf_hw.c
index f7d7f976064b..35fc803a6a04 100644
--- a/drivers/net/cxgb4vf/t4vf_hw.c
+++ b/drivers/net/cxgb4vf/t4vf_hw.c
@@ -1014,48 +1014,72 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free,
1014 unsigned int naddr, const u8 **addr, u16 *idx, 1014 unsigned int naddr, const u8 **addr, u16 *idx,
1015 u64 *hash, bool sleep_ok) 1015 u64 *hash, bool sleep_ok)
1016{ 1016{
1017 int i, ret; 1017 int offset, ret = 0;
1018 unsigned nfilters = 0;
1019 unsigned int rem = naddr;
1018 struct fw_vi_mac_cmd cmd, rpl; 1020 struct fw_vi_mac_cmd cmd, rpl;
1019 struct fw_vi_mac_exact *p;
1020 size_t len16;
1021 1021
1022 if (naddr > ARRAY_SIZE(cmd.u.exact)) 1022 if (naddr > FW_CLS_TCAM_NUM_ENTRIES)
1023 return -EINVAL; 1023 return -EINVAL;
1024 len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd,
1025 u.exact[naddr]), 16);
1026 1024
1027 memset(&cmd, 0, sizeof(cmd)); 1025 for (offset = 0; offset < naddr; /**/) {
1028 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP(FW_VI_MAC_CMD) | 1026 unsigned int fw_naddr = (rem < ARRAY_SIZE(cmd.u.exact)
1029 FW_CMD_REQUEST | 1027 ? rem
1030 FW_CMD_WRITE | 1028 : ARRAY_SIZE(cmd.u.exact));
1031 (free ? FW_CMD_EXEC : 0) | 1029 size_t len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd,
1032 FW_VI_MAC_CMD_VIID(viid)); 1030 u.exact[fw_naddr]), 16);
1033 cmd.freemacs_to_len16 = cpu_to_be32(FW_VI_MAC_CMD_FREEMACS(free) | 1031 struct fw_vi_mac_exact *p;
1034 FW_CMD_LEN16(len16)); 1032 int i;
1035 1033
1036 for (i = 0, p = cmd.u.exact; i < naddr; i++, p++) { 1034 memset(&cmd, 0, sizeof(cmd));
1037 p->valid_to_idx = 1035 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP(FW_VI_MAC_CMD) |
1038 cpu_to_be16(FW_VI_MAC_CMD_VALID | 1036 FW_CMD_REQUEST |
1039 FW_VI_MAC_CMD_IDX(FW_VI_MAC_ADD_MAC)); 1037 FW_CMD_WRITE |
1040 memcpy(p->macaddr, addr[i], sizeof(p->macaddr)); 1038 (free ? FW_CMD_EXEC : 0) |
1041 } 1039 FW_VI_MAC_CMD_VIID(viid));
1040 cmd.freemacs_to_len16 =
1041 cpu_to_be32(FW_VI_MAC_CMD_FREEMACS(free) |
1042 FW_CMD_LEN16(len16));
1043
1044 for (i = 0, p = cmd.u.exact; i < fw_naddr; i++, p++) {
1045 p->valid_to_idx = cpu_to_be16(
1046 FW_VI_MAC_CMD_VALID |
1047 FW_VI_MAC_CMD_IDX(FW_VI_MAC_ADD_MAC));
1048 memcpy(p->macaddr, addr[offset+i], sizeof(p->macaddr));
1049 }
1050
1051
1052 ret = t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), &rpl,
1053 sleep_ok);
1054 if (ret && ret != -ENOMEM)
1055 break;
1042 1056
1043 ret = t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), &rpl, sleep_ok); 1057 for (i = 0, p = rpl.u.exact; i < fw_naddr; i++, p++) {
1044 if (ret) 1058 u16 index = FW_VI_MAC_CMD_IDX_GET(
1045 return ret; 1059 be16_to_cpu(p->valid_to_idx));
1046 1060
1047 for (i = 0, p = rpl.u.exact; i < naddr; i++, p++) { 1061 if (idx)
1048 u16 index = FW_VI_MAC_CMD_IDX_GET(be16_to_cpu(p->valid_to_idx)); 1062 idx[offset+i] =
1049 1063 (index >= FW_CLS_TCAM_NUM_ENTRIES
1050 if (idx) 1064 ? 0xffff
1051 idx[i] = (index >= FW_CLS_TCAM_NUM_ENTRIES 1065 : index);
1052 ? 0xffff 1066 if (index < FW_CLS_TCAM_NUM_ENTRIES)
1053 : index); 1067 nfilters++;
1054 if (index < FW_CLS_TCAM_NUM_ENTRIES) 1068 else if (hash)
1055 ret++; 1069 *hash |= (1ULL << hash_mac_addr(addr[offset+i]));
1056 else if (hash) 1070 }
1057 *hash |= (1 << hash_mac_addr(addr[i])); 1071
1072 free = false;
1073 offset += fw_naddr;
1074 rem -= fw_naddr;
1058 } 1075 }
1076
1077 /*
1078 * If there were no errors or we merely ran out of room in our MAC
1079 * address arena, return the number of filters actually written.
1080 */
1081 if (ret == 0 || ret == -ENOMEM)
1082 ret = nfilters;
1059 return ret; 1083 return ret;
1060} 1084}
1061 1085
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index dcb7f82c2701..06c7d1c67517 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -31,7 +31,7 @@
31 31
32char e1000_driver_name[] = "e1000"; 32char e1000_driver_name[] = "e1000";
33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
34#define DRV_VERSION "7.3.21-k6-NAPI" 34#define DRV_VERSION "7.3.21-k8-NAPI"
35const char e1000_driver_version[] = DRV_VERSION; 35const char e1000_driver_version[] = DRV_VERSION;
36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
37 37
@@ -485,9 +485,6 @@ void e1000_down(struct e1000_adapter *adapter)
485 struct net_device *netdev = adapter->netdev; 485 struct net_device *netdev = adapter->netdev;
486 u32 rctl, tctl; 486 u32 rctl, tctl;
487 487
488 /* signal that we're down so the interrupt handler does not
489 * reschedule our watchdog timer */
490 set_bit(__E1000_DOWN, &adapter->flags);
491 488
492 /* disable receives in the hardware */ 489 /* disable receives in the hardware */
493 rctl = er32(RCTL); 490 rctl = er32(RCTL);
@@ -508,6 +505,13 @@ void e1000_down(struct e1000_adapter *adapter)
508 505
509 e1000_irq_disable(adapter); 506 e1000_irq_disable(adapter);
510 507
508 /*
509 * Setting DOWN must be after irq_disable to prevent
510 * a screaming interrupt. Setting DOWN also prevents
511 * timers and tasks from rescheduling.
512 */
513 set_bit(__E1000_DOWN, &adapter->flags);
514
511 del_timer_sync(&adapter->tx_fifo_stall_timer); 515 del_timer_sync(&adapter->tx_fifo_stall_timer);
512 del_timer_sync(&adapter->watchdog_timer); 516 del_timer_sync(&adapter->watchdog_timer);
513 del_timer_sync(&adapter->phy_info_timer); 517 del_timer_sync(&adapter->phy_info_timer);
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 75b099ce49c9..1f37ee6b2a26 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -261,6 +261,13 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
261 261
262} 262}
263 263
264static int ehea_set_flags(struct net_device *dev, u32 data)
265{
266 return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO
267 | ETH_FLAG_TXVLAN
268 | ETH_FLAG_RXVLAN);
269}
270
264const struct ethtool_ops ehea_ethtool_ops = { 271const struct ethtool_ops ehea_ethtool_ops = {
265 .get_settings = ehea_get_settings, 272 .get_settings = ehea_get_settings,
266 .get_drvinfo = ehea_get_drvinfo, 273 .get_drvinfo = ehea_get_drvinfo,
@@ -273,6 +280,8 @@ const struct ethtool_ops ehea_ethtool_ops = {
273 .get_ethtool_stats = ehea_get_ethtool_stats, 280 .get_ethtool_stats = ehea_get_ethtool_stats,
274 .get_rx_csum = ehea_get_rx_csum, 281 .get_rx_csum = ehea_get_rx_csum,
275 .set_settings = ehea_set_settings, 282 .set_settings = ehea_set_settings,
283 .get_flags = ethtool_op_get_flags,
284 .set_flags = ehea_set_flags,
276 .nway_reset = ehea_nway_reset, /* Restart autonegotiation */ 285 .nway_reset = ehea_nway_reset, /* Restart autonegotiation */
277}; 286};
278 287
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index a84c389d3db7..69f61523fcc8 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -400,6 +400,7 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
400 skb_arr_rq1[index] = netdev_alloc_skb(dev, 400 skb_arr_rq1[index] = netdev_alloc_skb(dev,
401 EHEA_L_PKT_SIZE); 401 EHEA_L_PKT_SIZE);
402 if (!skb_arr_rq1[index]) { 402 if (!skb_arr_rq1[index]) {
403 ehea_info("Unable to allocate enough skb in the array\n");
403 pr->rq1_skba.os_skbs = fill_wqes - i; 404 pr->rq1_skba.os_skbs = fill_wqes - i;
404 break; 405 break;
405 } 406 }
@@ -422,13 +423,20 @@ static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a)
422 struct net_device *dev = pr->port->netdev; 423 struct net_device *dev = pr->port->netdev;
423 int i; 424 int i;
424 425
425 for (i = 0; i < pr->rq1_skba.len; i++) { 426 if (nr_rq1a > pr->rq1_skba.len) {
427 ehea_error("NR_RQ1A bigger than skb array len\n");
428 return;
429 }
430
431 for (i = 0; i < nr_rq1a; i++) {
426 skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); 432 skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE);
427 if (!skb_arr_rq1[i]) 433 if (!skb_arr_rq1[i]) {
434 ehea_info("No enough memory to allocate skb array\n");
428 break; 435 break;
436 }
429 } 437 }
430 /* Ring doorbell */ 438 /* Ring doorbell */
431 ehea_update_rq1a(pr->qp, nr_rq1a); 439 ehea_update_rq1a(pr->qp, i);
432} 440}
433 441
434static int ehea_refill_rq_def(struct ehea_port_res *pr, 442static int ehea_refill_rq_def(struct ehea_port_res *pr,
@@ -675,7 +683,7 @@ static void ehea_proc_skb(struct ehea_port_res *pr, struct ehea_cqe *cqe,
675 int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && 683 int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) &&
676 pr->port->vgrp); 684 pr->port->vgrp);
677 685
678 if (use_lro) { 686 if (skb->dev->features & NETIF_F_LRO) {
679 if (vlan_extracted) 687 if (vlan_extracted)
680 lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, 688 lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb,
681 pr->port->vgrp, 689 pr->port->vgrp,
@@ -735,8 +743,10 @@ static int ehea_proc_rwqes(struct net_device *dev,
735 743
736 skb = netdev_alloc_skb(dev, 744 skb = netdev_alloc_skb(dev,
737 EHEA_L_PKT_SIZE); 745 EHEA_L_PKT_SIZE);
738 if (!skb) 746 if (!skb) {
747 ehea_info("Not enough memory to allocate skb\n");
739 break; 748 break;
749 }
740 } 750 }
741 skb_copy_to_linear_data(skb, ((char *)cqe) + 64, 751 skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
742 cqe->num_bytes_transfered - 4); 752 cqe->num_bytes_transfered - 4);
@@ -777,7 +787,7 @@ static int ehea_proc_rwqes(struct net_device *dev,
777 } 787 }
778 cqe = ehea_poll_rq1(qp, &wqe_index); 788 cqe = ehea_poll_rq1(qp, &wqe_index);
779 } 789 }
780 if (use_lro) 790 if (dev->features & NETIF_F_LRO)
781 lro_flush_all(&pr->lro_mgr); 791 lro_flush_all(&pr->lro_mgr);
782 792
783 pr->rx_packets += processed; 793 pr->rx_packets += processed;
@@ -3266,6 +3276,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3266 | NETIF_F_LLTX; 3276 | NETIF_F_LLTX;
3267 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; 3277 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
3268 3278
3279 if (use_lro)
3280 dev->features |= NETIF_F_LRO;
3281
3269 INIT_WORK(&port->reset_task, ehea_reset_port); 3282 INIT_WORK(&port->reset_task, ehea_reset_port);
3270 3283
3271 ret = register_netdev(dev); 3284 ret = register_netdev(dev);
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index ab9f675c5b8b..fe337bd121aa 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -104,6 +104,8 @@ static void ri_tasklet(unsigned long dev)
104 rcu_read_unlock(); 104 rcu_read_unlock();
105 dev_kfree_skb(skb); 105 dev_kfree_skb(skb);
106 stats->tx_dropped++; 106 stats->tx_dropped++;
107 if (skb_queue_len(&dp->tq) != 0)
108 goto resched;
107 break; 109 break;
108 } 110 }
109 rcu_read_unlock(); 111 rcu_read_unlock();
diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c
index 00b38bccd6d0..52a7c86af663 100644
--- a/drivers/net/irda/sh_sir.c
+++ b/drivers/net/irda/sh_sir.c
@@ -258,7 +258,7 @@ static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate)
258 258
259 /* Baud Rate Error Correction x 10000 */ 259 /* Baud Rate Error Correction x 10000 */
260 u32 rate_err_array[] = { 260 u32 rate_err_array[] = {
261 0000, 0625, 1250, 1875, 261 0, 625, 1250, 1875,
262 2500, 3125, 3750, 4375, 262 2500, 3125, 3750, 4375,
263 5000, 5625, 6250, 6875, 263 5000, 5625, 6250, 6875,
264 7500, 8125, 8750, 9375, 264 7500, 8125, 8750, 9375,
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a12e86fccb06..fdb35d040d23 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -4987,6 +4987,9 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter)
4987 adapter->rx_ring[i] = NULL; 4987 adapter->rx_ring[i] = NULL;
4988 } 4988 }
4989 4989
4990 adapter->num_tx_queues = 0;
4991 adapter->num_rx_queues = 0;
4992
4990 ixgbe_free_q_vectors(adapter); 4993 ixgbe_free_q_vectors(adapter);
4991 ixgbe_reset_interrupt_capability(adapter); 4994 ixgbe_reset_interrupt_capability(adapter);
4992} 4995}
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index 58e79033a8ee..d7355306a738 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 1999 - 2010 Intel Corporation. 2 * Copyright (C) 1999 - 2010 Intel Corporation.
3 * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. 3 * Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD.
4 * 4 *
5 * This code was derived from the Intel e1000e Linux driver. 5 * This code was derived from the Intel e1000e Linux driver.
6 * 6 *
@@ -2462,8 +2462,8 @@ static void __exit pch_gbe_exit_module(void)
2462module_init(pch_gbe_init_module); 2462module_init(pch_gbe_init_module);
2463module_exit(pch_gbe_exit_module); 2463module_exit(pch_gbe_exit_module);
2464 2464
2465MODULE_DESCRIPTION("OKI semiconductor PCH Gigabit ethernet Driver"); 2465MODULE_DESCRIPTION("EG20T PCH Gigabit ethernet Driver");
2466MODULE_AUTHOR("OKI semiconductor, <masa-korg@dsn.okisemi.com>"); 2466MODULE_AUTHOR("OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>");
2467MODULE_LICENSE("GPL"); 2467MODULE_LICENSE("GPL");
2468MODULE_VERSION(DRV_VERSION); 2468MODULE_VERSION(DRV_VERSION);
2469MODULE_DEVICE_TABLE(pci, pch_gbe_pcidev_id); 2469MODULE_DEVICE_TABLE(pci, pch_gbe_pcidev_id);
diff --git a/drivers/net/pch_gbe/pch_gbe_param.c b/drivers/net/pch_gbe/pch_gbe_param.c
index 2510146fc560..ef0996a0eaaa 100644
--- a/drivers/net/pch_gbe/pch_gbe_param.c
+++ b/drivers/net/pch_gbe/pch_gbe_param.c
@@ -434,8 +434,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
434 .err = "using default of " 434 .err = "using default of "
435 __MODULE_STRING(PCH_GBE_DEFAULT_TXD), 435 __MODULE_STRING(PCH_GBE_DEFAULT_TXD),
436 .def = PCH_GBE_DEFAULT_TXD, 436 .def = PCH_GBE_DEFAULT_TXD,
437 .arg = { .r = { .min = PCH_GBE_MIN_TXD } }, 437 .arg = { .r = { .min = PCH_GBE_MIN_TXD,
438 .arg = { .r = { .max = PCH_GBE_MAX_TXD } } 438 .max = PCH_GBE_MAX_TXD } }
439 }; 439 };
440 struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; 440 struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
441 tx_ring->count = TxDescriptors; 441 tx_ring->count = TxDescriptors;
@@ -450,8 +450,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
450 .err = "using default of " 450 .err = "using default of "
451 __MODULE_STRING(PCH_GBE_DEFAULT_RXD), 451 __MODULE_STRING(PCH_GBE_DEFAULT_RXD),
452 .def = PCH_GBE_DEFAULT_RXD, 452 .def = PCH_GBE_DEFAULT_RXD,
453 .arg = { .r = { .min = PCH_GBE_MIN_RXD } }, 453 .arg = { .r = { .min = PCH_GBE_MIN_RXD,
454 .arg = { .r = { .max = PCH_GBE_MAX_RXD } } 454 .max = PCH_GBE_MAX_RXD } }
455 }; 455 };
456 struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; 456 struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring;
457 rx_ring->count = RxDescriptors; 457 rx_ring->count = RxDescriptors;
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index f0bd1a1aba3a..e8b9c53c304b 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -30,11 +30,14 @@
30#include <linux/ethtool.h> 30#include <linux/ethtool.h>
31#include <linux/phy.h> 31#include <linux/phy.h>
32#include <linux/marvell_phy.h> 32#include <linux/marvell_phy.h>
33#include <linux/of.h>
33 34
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/irq.h> 36#include <asm/irq.h>
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
37 38
39#define MII_MARVELL_PHY_PAGE 22
40
38#define MII_M1011_IEVENT 0x13 41#define MII_M1011_IEVENT 0x13
39#define MII_M1011_IEVENT_CLEAR 0x0000 42#define MII_M1011_IEVENT_CLEAR 0x0000
40 43
@@ -80,7 +83,6 @@
80#define MII_88E1121_PHY_LED_CTRL 16 83#define MII_88E1121_PHY_LED_CTRL 16
81#define MII_88E1121_PHY_LED_PAGE 3 84#define MII_88E1121_PHY_LED_PAGE 3
82#define MII_88E1121_PHY_LED_DEF 0x0030 85#define MII_88E1121_PHY_LED_DEF 0x0030
83#define MII_88E1121_PHY_PAGE 22
84 86
85#define MII_M1011_PHY_STATUS 0x11 87#define MII_M1011_PHY_STATUS 0x11
86#define MII_M1011_PHY_STATUS_1000 0x8000 88#define MII_M1011_PHY_STATUS_1000 0x8000
@@ -186,13 +188,94 @@ static int marvell_config_aneg(struct phy_device *phydev)
186 return 0; 188 return 0;
187} 189}
188 190
191#ifdef CONFIG_OF_MDIO
192/*
193 * Set and/or override some configuration registers based on the
194 * marvell,reg-init property stored in the of_node for the phydev.
195 *
196 * marvell,reg-init = <reg-page reg mask value>,...;
197 *
198 * There may be one or more sets of <reg-page reg mask value>:
199 *
200 * reg-page: which register bank to use.
201 * reg: the register.
202 * mask: if non-zero, ANDed with existing register value.
203 * value: ORed with the masked value and written to the regiser.
204 *
205 */
206static int marvell_of_reg_init(struct phy_device *phydev)
207{
208 const __be32 *paddr;
209 int len, i, saved_page, current_page, page_changed, ret;
210
211 if (!phydev->dev.of_node)
212 return 0;
213
214 paddr = of_get_property(phydev->dev.of_node, "marvell,reg-init", &len);
215 if (!paddr || len < (4 * sizeof(*paddr)))
216 return 0;
217
218 saved_page = phy_read(phydev, MII_MARVELL_PHY_PAGE);
219 if (saved_page < 0)
220 return saved_page;
221 page_changed = 0;
222 current_page = saved_page;
223
224 ret = 0;
225 len /= sizeof(*paddr);
226 for (i = 0; i < len - 3; i += 4) {
227 u16 reg_page = be32_to_cpup(paddr + i);
228 u16 reg = be32_to_cpup(paddr + i + 1);
229 u16 mask = be32_to_cpup(paddr + i + 2);
230 u16 val_bits = be32_to_cpup(paddr + i + 3);
231 int val;
232
233 if (reg_page != current_page) {
234 current_page = reg_page;
235 page_changed = 1;
236 ret = phy_write(phydev, MII_MARVELL_PHY_PAGE, reg_page);
237 if (ret < 0)
238 goto err;
239 }
240
241 val = 0;
242 if (mask) {
243 val = phy_read(phydev, reg);
244 if (val < 0) {
245 ret = val;
246 goto err;
247 }
248 val &= mask;
249 }
250 val |= val_bits;
251
252 ret = phy_write(phydev, reg, val);
253 if (ret < 0)
254 goto err;
255
256 }
257err:
258 if (page_changed) {
259 i = phy_write(phydev, MII_MARVELL_PHY_PAGE, saved_page);
260 if (ret == 0)
261 ret = i;
262 }
263 return ret;
264}
265#else
266static int marvell_of_reg_init(struct phy_device *phydev)
267{
268 return 0;
269}
270#endif /* CONFIG_OF_MDIO */
271
189static int m88e1121_config_aneg(struct phy_device *phydev) 272static int m88e1121_config_aneg(struct phy_device *phydev)
190{ 273{
191 int err, oldpage, mscr; 274 int err, oldpage, mscr;
192 275
193 oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); 276 oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);
194 277
195 err = phy_write(phydev, MII_88E1121_PHY_PAGE, 278 err = phy_write(phydev, MII_MARVELL_PHY_PAGE,
196 MII_88E1121_PHY_MSCR_PAGE); 279 MII_88E1121_PHY_MSCR_PAGE);
197 if (err < 0) 280 if (err < 0)
198 return err; 281 return err;
@@ -218,7 +301,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev)
218 return err; 301 return err;
219 } 302 }
220 303
221 phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); 304 phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);
222 305
223 err = phy_write(phydev, MII_BMCR, BMCR_RESET); 306 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
224 if (err < 0) 307 if (err < 0)
@@ -229,11 +312,11 @@ static int m88e1121_config_aneg(struct phy_device *phydev)
229 if (err < 0) 312 if (err < 0)
230 return err; 313 return err;
231 314
232 oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); 315 oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);
233 316
234 phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); 317 phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
235 phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF); 318 phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);
236 phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); 319 phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);
237 320
238 err = genphy_config_aneg(phydev); 321 err = genphy_config_aneg(phydev);
239 322
@@ -244,9 +327,9 @@ static int m88e1318_config_aneg(struct phy_device *phydev)
244{ 327{
245 int err, oldpage, mscr; 328 int err, oldpage, mscr;
246 329
247 oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); 330 oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);
248 331
249 err = phy_write(phydev, MII_88E1121_PHY_PAGE, 332 err = phy_write(phydev, MII_MARVELL_PHY_PAGE,
250 MII_88E1121_PHY_MSCR_PAGE); 333 MII_88E1121_PHY_MSCR_PAGE);
251 if (err < 0) 334 if (err < 0)
252 return err; 335 return err;
@@ -258,7 +341,7 @@ static int m88e1318_config_aneg(struct phy_device *phydev)
258 if (err < 0) 341 if (err < 0)
259 return err; 342 return err;
260 343
261 err = phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); 344 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);
262 if (err < 0) 345 if (err < 0)
263 return err; 346 return err;
264 347
@@ -368,6 +451,9 @@ static int m88e1111_config_init(struct phy_device *phydev)
368 return err; 451 return err;
369 } 452 }
370 453
454 err = marvell_of_reg_init(phydev);
455 if (err < 0)
456 return err;
371 457
372 err = phy_write(phydev, MII_BMCR, BMCR_RESET); 458 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
373 if (err < 0) 459 if (err < 0)
@@ -398,7 +484,7 @@ static int m88e1118_config_init(struct phy_device *phydev)
398 int err; 484 int err;
399 485
400 /* Change address */ 486 /* Change address */
401 err = phy_write(phydev, 0x16, 0x0002); 487 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0002);
402 if (err < 0) 488 if (err < 0)
403 return err; 489 return err;
404 490
@@ -408,7 +494,7 @@ static int m88e1118_config_init(struct phy_device *phydev)
408 return err; 494 return err;
409 495
410 /* Change address */ 496 /* Change address */
411 err = phy_write(phydev, 0x16, 0x0003); 497 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0003);
412 if (err < 0) 498 if (err < 0)
413 return err; 499 return err;
414 500
@@ -420,8 +506,42 @@ static int m88e1118_config_init(struct phy_device *phydev)
420 if (err < 0) 506 if (err < 0)
421 return err; 507 return err;
422 508
509 err = marvell_of_reg_init(phydev);
510 if (err < 0)
511 return err;
512
423 /* Reset address */ 513 /* Reset address */
424 err = phy_write(phydev, 0x16, 0x0); 514 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0);
515 if (err < 0)
516 return err;
517
518 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
519 if (err < 0)
520 return err;
521
522 return 0;
523}
524
525static int m88e1149_config_init(struct phy_device *phydev)
526{
527 int err;
528
529 /* Change address */
530 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0002);
531 if (err < 0)
532 return err;
533
534 /* Enable 1000 Mbit */
535 err = phy_write(phydev, 0x15, 0x1048);
536 if (err < 0)
537 return err;
538
539 err = marvell_of_reg_init(phydev);
540 if (err < 0)
541 return err;
542
543 /* Reset address */
544 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0);
425 if (err < 0) 545 if (err < 0)
426 return err; 546 return err;
427 547
@@ -491,6 +611,10 @@ static int m88e1145_config_init(struct phy_device *phydev)
491 } 611 }
492 } 612 }
493 613
614 err = marvell_of_reg_init(phydev);
615 if (err < 0)
616 return err;
617
494 return 0; 618 return 0;
495} 619}
496 620
@@ -685,6 +809,19 @@ static struct phy_driver marvell_drivers[] = {
685 .driver = { .owner = THIS_MODULE }, 809 .driver = { .owner = THIS_MODULE },
686 }, 810 },
687 { 811 {
812 .phy_id = MARVELL_PHY_ID_88E1149R,
813 .phy_id_mask = MARVELL_PHY_ID_MASK,
814 .name = "Marvell 88E1149R",
815 .features = PHY_GBIT_FEATURES,
816 .flags = PHY_HAS_INTERRUPT,
817 .config_init = &m88e1149_config_init,
818 .config_aneg = &m88e1118_config_aneg,
819 .read_status = &genphy_read_status,
820 .ack_interrupt = &marvell_ack_interrupt,
821 .config_intr = &marvell_config_intr,
822 .driver = { .owner = THIS_MODULE },
823 },
824 {
688 .phy_id = MARVELL_PHY_ID_88E1240, 825 .phy_id = MARVELL_PHY_ID_88E1240,
689 .phy_id_mask = MARVELL_PHY_ID_MASK, 826 .phy_id_mask = MARVELL_PHY_ID_MASK,
690 .name = "Marvell 88E1240", 827 .name = "Marvell 88E1240",
@@ -735,6 +872,7 @@ static struct mdio_device_id __maybe_unused marvell_tbl[] = {
735 { 0x01410e10, 0xfffffff0 }, 872 { 0x01410e10, 0xfffffff0 },
736 { 0x01410cb0, 0xfffffff0 }, 873 { 0x01410cb0, 0xfffffff0 },
737 { 0x01410cd0, 0xfffffff0 }, 874 { 0x01410cd0, 0xfffffff0 },
875 { 0x01410e50, 0xfffffff0 },
738 { 0x01410e30, 0xfffffff0 }, 876 { 0x01410e30, 0xfffffff0 },
739 { 0x01410e90, 0xfffffff0 }, 877 { 0x01410e90, 0xfffffff0 },
740 { } 878 { }
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 0c91598ae280..b708f68471a6 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2580,16 +2580,16 @@ ppp_create_interface(struct net *net, int unit, int *retp)
2580 */ 2580 */
2581 dev_net_set(dev, net); 2581 dev_net_set(dev, net);
2582 2582
2583 ret = -EEXIST;
2584 mutex_lock(&pn->all_ppp_mutex); 2583 mutex_lock(&pn->all_ppp_mutex);
2585 2584
2586 if (unit < 0) { 2585 if (unit < 0) {
2587 unit = unit_get(&pn->units_idr, ppp); 2586 unit = unit_get(&pn->units_idr, ppp);
2588 if (unit < 0) { 2587 if (unit < 0) {
2589 *retp = unit; 2588 ret = unit;
2590 goto out2; 2589 goto out2;
2591 } 2590 }
2592 } else { 2591 } else {
2592 ret = -EEXIST;
2593 if (unit_find(&pn->units_idr, unit)) 2593 if (unit_find(&pn->units_idr, unit))
2594 goto out2; /* unit already exists */ 2594 goto out2; /* unit already exists */
2595 /* 2595 /*
@@ -2664,10 +2664,10 @@ static void ppp_shutdown_interface(struct ppp *ppp)
2664 ppp->closing = 1; 2664 ppp->closing = 1;
2665 ppp_unlock(ppp); 2665 ppp_unlock(ppp);
2666 unregister_netdev(ppp->dev); 2666 unregister_netdev(ppp->dev);
2667 unit_put(&pn->units_idr, ppp->file.index);
2667 } else 2668 } else
2668 ppp_unlock(ppp); 2669 ppp_unlock(ppp);
2669 2670
2670 unit_put(&pn->units_idr, ppp->file.index);
2671 ppp->file.dead = 1; 2671 ppp->file.dead = 1;
2672 ppp->owner = NULL; 2672 ppp->owner = NULL;
2673 wake_up_interruptible(&ppp->file.rwait); 2673 wake_up_interruptible(&ppp->file.rwait);
@@ -2855,8 +2855,7 @@ static void __exit ppp_cleanup(void)
2855 * by holding all_ppp_mutex 2855 * by holding all_ppp_mutex
2856 */ 2856 */
2857 2857
2858/* associate pointer with specified number */ 2858static int __unit_alloc(struct idr *p, void *ptr, int n)
2859static int unit_set(struct idr *p, void *ptr, int n)
2860{ 2859{
2861 int unit, err; 2860 int unit, err;
2862 2861
@@ -2867,10 +2866,24 @@ again:
2867 } 2866 }
2868 2867
2869 err = idr_get_new_above(p, ptr, n, &unit); 2868 err = idr_get_new_above(p, ptr, n, &unit);
2870 if (err == -EAGAIN) 2869 if (err < 0) {
2871 goto again; 2870 if (err == -EAGAIN)
2871 goto again;
2872 return err;
2873 }
2874
2875 return unit;
2876}
2877
2878/* associate pointer with specified number */
2879static int unit_set(struct idr *p, void *ptr, int n)
2880{
2881 int unit;
2872 2882
2873 if (unit != n) { 2883 unit = __unit_alloc(p, ptr, n);
2884 if (unit < 0)
2885 return unit;
2886 else if (unit != n) {
2874 idr_remove(p, unit); 2887 idr_remove(p, unit);
2875 return -EINVAL; 2888 return -EINVAL;
2876 } 2889 }
@@ -2881,19 +2894,7 @@ again:
2881/* get new free unit number and associate pointer with it */ 2894/* get new free unit number and associate pointer with it */
2882static int unit_get(struct idr *p, void *ptr) 2895static int unit_get(struct idr *p, void *ptr)
2883{ 2896{
2884 int unit, err; 2897 return __unit_alloc(p, ptr, 0);
2885
2886again:
2887 if (!idr_pre_get(p, GFP_KERNEL)) {
2888 printk(KERN_ERR "PPP: No free memory for idr\n");
2889 return -ENOMEM;
2890 }
2891
2892 err = idr_get_new_above(p, ptr, 0, &unit);
2893 if (err == -EAGAIN)
2894 goto again;
2895
2896 return unit;
2897} 2898}
2898 2899
2899/* put unit number back to a pool */ 2900/* put unit number back to a pool */
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index d9a76260880b..e4dbbbfec723 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -62,15 +62,15 @@ static const u32 default_msg =
62/* NETIF_MSG_PKTDATA | */ 62/* NETIF_MSG_PKTDATA | */
63 NETIF_MSG_HW | NETIF_MSG_WOL | 0; 63 NETIF_MSG_HW | NETIF_MSG_WOL | 0;
64 64
65static int debug = 0x00007fff; /* defaults above */ 65static int debug = -1; /* defaults above */
66module_param(debug, int, 0); 66module_param(debug, int, 0664);
67MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); 67MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
68 68
69#define MSIX_IRQ 0 69#define MSIX_IRQ 0
70#define MSI_IRQ 1 70#define MSI_IRQ 1
71#define LEG_IRQ 2 71#define LEG_IRQ 2
72static int qlge_irq_type = MSIX_IRQ; 72static int qlge_irq_type = MSIX_IRQ;
73module_param(qlge_irq_type, int, MSIX_IRQ); 73module_param(qlge_irq_type, int, 0664);
74MODULE_PARM_DESC(qlge_irq_type, "0 = MSI-X, 1 = MSI, 2 = Legacy."); 74MODULE_PARM_DESC(qlge_irq_type, "0 = MSI-X, 1 = MSI, 2 = Legacy.");
75 75
76static int qlge_mpi_coredump; 76static int qlge_mpi_coredump;
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index f3e4043d70ee..2166c1d0a533 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -196,7 +196,9 @@ MODULE_PARM_DESC(debug, "Bitmapped debugging message enable value");
196 196
197static void efx_remove_channels(struct efx_nic *efx); 197static void efx_remove_channels(struct efx_nic *efx);
198static void efx_remove_port(struct efx_nic *efx); 198static void efx_remove_port(struct efx_nic *efx);
199static void efx_init_napi(struct efx_nic *efx);
199static void efx_fini_napi(struct efx_nic *efx); 200static void efx_fini_napi(struct efx_nic *efx);
201static void efx_fini_napi_channel(struct efx_channel *channel);
200static void efx_fini_struct(struct efx_nic *efx); 202static void efx_fini_struct(struct efx_nic *efx);
201static void efx_start_all(struct efx_nic *efx); 203static void efx_start_all(struct efx_nic *efx);
202static void efx_stop_all(struct efx_nic *efx); 204static void efx_stop_all(struct efx_nic *efx);
@@ -334,8 +336,10 @@ void efx_process_channel_now(struct efx_channel *channel)
334 336
335 /* Disable interrupts and wait for ISRs to complete */ 337 /* Disable interrupts and wait for ISRs to complete */
336 efx_nic_disable_interrupts(efx); 338 efx_nic_disable_interrupts(efx);
337 if (efx->legacy_irq) 339 if (efx->legacy_irq) {
338 synchronize_irq(efx->legacy_irq); 340 synchronize_irq(efx->legacy_irq);
341 efx->legacy_irq_enabled = false;
342 }
339 if (channel->irq) 343 if (channel->irq)
340 synchronize_irq(channel->irq); 344 synchronize_irq(channel->irq);
341 345
@@ -350,6 +354,8 @@ void efx_process_channel_now(struct efx_channel *channel)
350 efx_channel_processed(channel); 354 efx_channel_processed(channel);
351 355
352 napi_enable(&channel->napi_str); 356 napi_enable(&channel->napi_str);
357 if (efx->legacy_irq)
358 efx->legacy_irq_enabled = true;
353 efx_nic_enable_interrupts(efx); 359 efx_nic_enable_interrupts(efx);
354} 360}
355 361
@@ -425,6 +431,7 @@ efx_alloc_channel(struct efx_nic *efx, int i, struct efx_channel *old_channel)
425 431
426 *channel = *old_channel; 432 *channel = *old_channel;
427 433
434 channel->napi_dev = NULL;
428 memset(&channel->eventq, 0, sizeof(channel->eventq)); 435 memset(&channel->eventq, 0, sizeof(channel->eventq));
429 436
430 rx_queue = &channel->rx_queue; 437 rx_queue = &channel->rx_queue;
@@ -735,9 +742,13 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
735 if (rc) 742 if (rc)
736 goto rollback; 743 goto rollback;
737 744
745 efx_init_napi(efx);
746
738 /* Destroy old channels */ 747 /* Destroy old channels */
739 for (i = 0; i < efx->n_channels; i++) 748 for (i = 0; i < efx->n_channels; i++) {
749 efx_fini_napi_channel(other_channel[i]);
740 efx_remove_channel(other_channel[i]); 750 efx_remove_channel(other_channel[i]);
751 }
741out: 752out:
742 /* Free unused channel structures */ 753 /* Free unused channel structures */
743 for (i = 0; i < efx->n_channels; i++) 754 for (i = 0; i < efx->n_channels; i++)
@@ -1401,6 +1412,8 @@ static void efx_start_all(struct efx_nic *efx)
1401 efx_start_channel(channel); 1412 efx_start_channel(channel);
1402 } 1413 }
1403 1414
1415 if (efx->legacy_irq)
1416 efx->legacy_irq_enabled = true;
1404 efx_nic_enable_interrupts(efx); 1417 efx_nic_enable_interrupts(efx);
1405 1418
1406 /* Switch to event based MCDI completions after enabling interrupts. 1419 /* Switch to event based MCDI completions after enabling interrupts.
@@ -1461,8 +1474,10 @@ static void efx_stop_all(struct efx_nic *efx)
1461 1474
1462 /* Disable interrupts and wait for ISR to complete */ 1475 /* Disable interrupts and wait for ISR to complete */
1463 efx_nic_disable_interrupts(efx); 1476 efx_nic_disable_interrupts(efx);
1464 if (efx->legacy_irq) 1477 if (efx->legacy_irq) {
1465 synchronize_irq(efx->legacy_irq); 1478 synchronize_irq(efx->legacy_irq);
1479 efx->legacy_irq_enabled = false;
1480 }
1466 efx_for_each_channel(channel, efx) { 1481 efx_for_each_channel(channel, efx) {
1467 if (channel->irq) 1482 if (channel->irq)
1468 synchronize_irq(channel->irq); 1483 synchronize_irq(channel->irq);
@@ -1594,7 +1609,7 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
1594 * 1609 *
1595 **************************************************************************/ 1610 **************************************************************************/
1596 1611
1597static int efx_init_napi(struct efx_nic *efx) 1612static void efx_init_napi(struct efx_nic *efx)
1598{ 1613{
1599 struct efx_channel *channel; 1614 struct efx_channel *channel;
1600 1615
@@ -1603,18 +1618,21 @@ static int efx_init_napi(struct efx_nic *efx)
1603 netif_napi_add(channel->napi_dev, &channel->napi_str, 1618 netif_napi_add(channel->napi_dev, &channel->napi_str,
1604 efx_poll, napi_weight); 1619 efx_poll, napi_weight);
1605 } 1620 }
1606 return 0; 1621}
1622
1623static void efx_fini_napi_channel(struct efx_channel *channel)
1624{
1625 if (channel->napi_dev)
1626 netif_napi_del(&channel->napi_str);
1627 channel->napi_dev = NULL;
1607} 1628}
1608 1629
1609static void efx_fini_napi(struct efx_nic *efx) 1630static void efx_fini_napi(struct efx_nic *efx)
1610{ 1631{
1611 struct efx_channel *channel; 1632 struct efx_channel *channel;
1612 1633
1613 efx_for_each_channel(channel, efx) { 1634 efx_for_each_channel(channel, efx)
1614 if (channel->napi_dev) 1635 efx_fini_napi_channel(channel);
1615 netif_napi_del(&channel->napi_str);
1616 channel->napi_dev = NULL;
1617 }
1618} 1636}
1619 1637
1620/************************************************************************** 1638/**************************************************************************
@@ -2331,9 +2349,7 @@ static int efx_pci_probe_main(struct efx_nic *efx)
2331 if (rc) 2349 if (rc)
2332 goto fail1; 2350 goto fail1;
2333 2351
2334 rc = efx_init_napi(efx); 2352 efx_init_napi(efx);
2335 if (rc)
2336 goto fail2;
2337 2353
2338 rc = efx->type->init(efx); 2354 rc = efx->type->init(efx);
2339 if (rc) { 2355 if (rc) {
@@ -2364,7 +2380,6 @@ static int efx_pci_probe_main(struct efx_nic *efx)
2364 efx->type->fini(efx); 2380 efx->type->fini(efx);
2365 fail3: 2381 fail3:
2366 efx_fini_napi(efx); 2382 efx_fini_napi(efx);
2367 fail2:
2368 efx_remove_all(efx); 2383 efx_remove_all(efx);
2369 fail1: 2384 fail1:
2370 return rc; 2385 return rc;
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 0d19fbfc5c2c..4c12332434b7 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -621,6 +621,7 @@ struct efx_filter_state;
621 * @pci_dev: The PCI device 621 * @pci_dev: The PCI device
622 * @type: Controller type attributes 622 * @type: Controller type attributes
623 * @legacy_irq: IRQ number 623 * @legacy_irq: IRQ number
624 * @legacy_irq_enabled: Are IRQs enabled on NIC (INT_EN_KER register)?
624 * @workqueue: Workqueue for port reconfigures and the HW monitor. 625 * @workqueue: Workqueue for port reconfigures and the HW monitor.
625 * Work items do not hold and must not acquire RTNL. 626 * Work items do not hold and must not acquire RTNL.
626 * @workqueue_name: Name of workqueue 627 * @workqueue_name: Name of workqueue
@@ -702,6 +703,7 @@ struct efx_nic {
702 struct pci_dev *pci_dev; 703 struct pci_dev *pci_dev;
703 const struct efx_nic_type *type; 704 const struct efx_nic_type *type;
704 int legacy_irq; 705 int legacy_irq;
706 bool legacy_irq_enabled;
705 struct workqueue_struct *workqueue; 707 struct workqueue_struct *workqueue;
706 char workqueue_name[16]; 708 char workqueue_name[16];
707 struct work_struct reset_work; 709 struct work_struct reset_work;
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c
index 9743cff15130..399b12abe2fd 100644
--- a/drivers/net/sfc/nic.c
+++ b/drivers/net/sfc/nic.c
@@ -1380,6 +1380,12 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id)
1380 u32 queues; 1380 u32 queues;
1381 int syserr; 1381 int syserr;
1382 1382
1383 /* Could this be ours? If interrupts are disabled then the
1384 * channel state may not be valid.
1385 */
1386 if (!efx->legacy_irq_enabled)
1387 return result;
1388
1383 /* Read the ISR which also ACKs the interrupts */ 1389 /* Read the ISR which also ACKs the interrupts */
1384 efx_readd(efx, &reg, FR_BZ_INT_ISR0); 1390 efx_readd(efx, &reg, FR_BZ_INT_ISR0);
1385 queues = EFX_EXTRACT_DWORD(reg, 0, 31); 1391 queues = EFX_EXTRACT_DWORD(reg, 0, 31);
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index bfc2d1251502..c0dc78571c62 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1517,6 +1517,8 @@ static int stmmac_probe(struct net_device *dev)
1517 pr_warning("\tno valid MAC address;" 1517 pr_warning("\tno valid MAC address;"
1518 "please, use ifconfig or nwhwconfig!\n"); 1518 "please, use ifconfig or nwhwconfig!\n");
1519 1519
1520 spin_lock_init(&priv->lock);
1521
1520 ret = register_netdev(dev); 1522 ret = register_netdev(dev);
1521 if (ret) { 1523 if (ret) {
1522 pr_err("%s: ERROR %i registering the device\n", 1524 pr_err("%s: ERROR %i registering the device\n",
@@ -1528,8 +1530,6 @@ static int stmmac_probe(struct net_device *dev)
1528 dev->name, (dev->features & NETIF_F_SG) ? "on" : "off", 1530 dev->name, (dev->features & NETIF_F_SG) ? "on" : "off",
1529 (dev->features & NETIF_F_IP_CSUM) ? "on" : "off"); 1531 (dev->features & NETIF_F_IP_CSUM) ? "on" : "off");
1530 1532
1531 spin_lock_init(&priv->lock);
1532
1533 return ret; 1533 return ret;
1534} 1534}
1535 1535
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index a9f7d5d1a269..7064e035757a 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -688,9 +688,6 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb,
688 688
689 DMFE_DBUG(0, "dmfe_start_xmit", 0); 689 DMFE_DBUG(0, "dmfe_start_xmit", 0);
690 690
691 /* Resource flag check */
692 netif_stop_queue(dev);
693
694 /* Too large packet check */ 691 /* Too large packet check */
695 if (skb->len > MAX_PACKET_SIZE) { 692 if (skb->len > MAX_PACKET_SIZE) {
696 pr_err("big packet = %d\n", (u16)skb->len); 693 pr_err("big packet = %d\n", (u16)skb->len);
@@ -698,6 +695,9 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb,
698 return NETDEV_TX_OK; 695 return NETDEV_TX_OK;
699 } 696 }
700 697
698 /* Resource flag check */
699 netif_stop_queue(dev);
700
701 spin_lock_irqsave(&db->lock, flags); 701 spin_lock_irqsave(&db->lock, flags);
702 702
703 /* No Tx resource check, it never happen nromally */ 703 /* No Tx resource check, it never happen nromally */
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index 05a95586f3c5..055b87ab4f07 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -899,7 +899,8 @@ struct ucc_geth_hardware_statistics {
899#define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size 899#define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size
900 */ 900 */
901#define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ 901#define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */
902#define UCC_GETH_UTFTT_INIT 512 902#define UCC_GETH_UTFTT_INIT 256 /* 1/2 utfs
903 due to errata */
903/* Gigabit Ethernet (1000 Mbps) */ 904/* Gigabit Ethernet (1000 Mbps) */
904#define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual 905#define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual
905 FIFO size */ 906 FIFO size */
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index be8cc2a8e213..93c6b5f62ac4 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2993,12 +2993,14 @@ static int hso_probe(struct usb_interface *interface,
2993 2993
2994 case HSO_INTF_BULK: 2994 case HSO_INTF_BULK:
2995 /* It's a regular bulk interface */ 2995 /* It's a regular bulk interface */
2996 if (((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) && 2996 if ((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) {
2997 !disable_net) 2997 if (!disable_net)
2998 hso_dev = hso_create_net_device(interface, port_spec); 2998 hso_dev =
2999 else 2999 hso_create_net_device(interface, port_spec);
3000 } else {
3000 hso_dev = 3001 hso_dev =
3001 hso_create_bulk_serial_device(interface, port_spec); 3002 hso_create_bulk_serial_device(interface, port_spec);
3003 }
3002 if (!hso_dev) 3004 if (!hso_dev)
3003 goto exit; 3005 goto exit;
3004 break; 3006 break;
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index d81ad8397885..cf05504d9511 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -498,7 +498,6 @@ norbuff:
498static int x25_asy_close(struct net_device *dev) 498static int x25_asy_close(struct net_device *dev)
499{ 499{
500 struct x25_asy *sl = netdev_priv(dev); 500 struct x25_asy *sl = netdev_priv(dev);
501 int err;
502 501
503 spin_lock(&sl->lock); 502 spin_lock(&sl->lock);
504 if (sl->tty) 503 if (sl->tty)
@@ -507,10 +506,6 @@ static int x25_asy_close(struct net_device *dev)
507 netif_stop_queue(dev); 506 netif_stop_queue(dev);
508 sl->rcount = 0; 507 sl->rcount = 0;
509 sl->xleft = 0; 508 sl->xleft = 0;
510 err = lapb_unregister(dev);
511 if (err != LAPB_OK)
512 printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n",
513 err);
514 spin_unlock(&sl->lock); 509 spin_unlock(&sl->lock);
515 return 0; 510 return 0;
516} 511}
@@ -595,6 +590,7 @@ static int x25_asy_open_tty(struct tty_struct *tty)
595static void x25_asy_close_tty(struct tty_struct *tty) 590static void x25_asy_close_tty(struct tty_struct *tty)
596{ 591{
597 struct x25_asy *sl = tty->disc_data; 592 struct x25_asy *sl = tty->disc_data;
593 int err;
598 594
599 /* First make sure we're connected. */ 595 /* First make sure we're connected. */
600 if (!sl || sl->magic != X25_ASY_MAGIC) 596 if (!sl || sl->magic != X25_ASY_MAGIC)
@@ -605,6 +601,11 @@ static void x25_asy_close_tty(struct tty_struct *tty)
605 dev_close(sl->dev); 601 dev_close(sl->dev);
606 rtnl_unlock(); 602 rtnl_unlock();
607 603
604 err = lapb_unregister(sl->dev);
605 if (err != LAPB_OK)
606 printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n",
607 err);
608
608 tty->disc_data = NULL; 609 tty->disc_data = NULL;
609 sl->tty = NULL; 610 sl->tty = NULL;
610 x25_asy_free(sl); 611 x25_asy_free(sl);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 3161a5901a7a..f2eec388693b 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -59,6 +59,9 @@
59 59
60static int ar9003_hw_power_interpolate(int32_t x, 60static int ar9003_hw_power_interpolate(int32_t x,
61 int32_t *px, int32_t *py, u_int16_t np); 61 int32_t *px, int32_t *py, u_int16_t np);
62
63#define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
64
62static const struct ar9300_eeprom ar9300_default = { 65static const struct ar9300_eeprom ar9300_default = {
63 .eepromVersion = 2, 66 .eepromVersion = 2,
64 .templateVersion = 2, 67 .templateVersion = 2,
@@ -296,21 +299,21 @@ static const struct ar9300_eeprom ar9300_default = {
296 } 299 }
297 }, 300 },
298 .ctlPowerData_2G = { 301 .ctlPowerData_2G = {
299 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 302 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
300 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 303 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
301 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 304 { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
302 305
303 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 306 { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
304 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 307 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
305 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 308 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
306 309
307 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 310 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
308 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 311 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
309 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 312 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
310 313
311 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 314 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
312 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 315 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
313 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 316 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
314 }, 317 },
315 .modalHeader5G = { 318 .modalHeader5G = {
316 /* 4 idle,t1,t2,b (4 bits per setting) */ 319 /* 4 idle,t1,t2,b (4 bits per setting) */
@@ -582,56 +585,56 @@ static const struct ar9300_eeprom ar9300_default = {
582 .ctlPowerData_5G = { 585 .ctlPowerData_5G = {
583 { 586 {
584 { 587 {
585 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 588 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
586 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 589 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
587 } 590 }
588 }, 591 },
589 { 592 {
590 { 593 {
591 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 594 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
592 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 595 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
593 } 596 }
594 }, 597 },
595 { 598 {
596 { 599 {
597 {60, 0}, {60, 1}, {60, 0}, {60, 1}, 600 CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
598 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 601 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
599 } 602 }
600 }, 603 },
601 { 604 {
602 { 605 {
603 {60, 0}, {60, 1}, {60, 1}, {60, 0}, 606 CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
604 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 607 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
605 } 608 }
606 }, 609 },
607 { 610 {
608 { 611 {
609 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 612 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
610 {60, 0}, {60, 0}, {60, 0}, {60, 0}, 613 CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
611 } 614 }
612 }, 615 },
613 { 616 {
614 { 617 {
615 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 618 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
616 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 619 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
617 } 620 }
618 }, 621 },
619 { 622 {
620 { 623 {
621 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 624 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
622 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 625 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
623 } 626 }
624 }, 627 },
625 { 628 {
626 { 629 {
627 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 630 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
628 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 631 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
629 } 632 }
630 }, 633 },
631 { 634 {
632 { 635 {
633 {60, 1}, {60, 0}, {60, 1}, {60, 1}, 636 CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
634 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 637 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
635 } 638 }
636 }, 639 },
637 } 640 }
@@ -873,21 +876,21 @@ static const struct ar9300_eeprom ar9300_x113 = {
873 } 876 }
874 }, 877 },
875 .ctlPowerData_2G = { 878 .ctlPowerData_2G = {
876 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 879 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
877 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 880 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
878 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 881 { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
879 882
880 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 883 { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
881 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 884 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
882 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 885 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
883 886
884 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 887 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
885 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 888 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
886 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 889 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
887 890
888 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 891 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
889 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 892 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
890 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 893 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
891 }, 894 },
892 .modalHeader5G = { 895 .modalHeader5G = {
893 /* 4 idle,t1,t2,b (4 bits per setting) */ 896 /* 4 idle,t1,t2,b (4 bits per setting) */
@@ -1159,56 +1162,56 @@ static const struct ar9300_eeprom ar9300_x113 = {
1159 .ctlPowerData_5G = { 1162 .ctlPowerData_5G = {
1160 { 1163 {
1161 { 1164 {
1162 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1165 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1163 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1166 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1164 } 1167 }
1165 }, 1168 },
1166 { 1169 {
1167 { 1170 {
1168 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1171 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1169 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1172 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1170 } 1173 }
1171 }, 1174 },
1172 { 1175 {
1173 { 1176 {
1174 {60, 0}, {60, 1}, {60, 0}, {60, 1}, 1177 CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1175 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1178 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1176 } 1179 }
1177 }, 1180 },
1178 { 1181 {
1179 { 1182 {
1180 {60, 0}, {60, 1}, {60, 1}, {60, 0}, 1183 CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1181 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1184 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
1182 } 1185 }
1183 }, 1186 },
1184 { 1187 {
1185 { 1188 {
1186 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1189 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1187 {60, 0}, {60, 0}, {60, 0}, {60, 0}, 1190 CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
1188 } 1191 }
1189 }, 1192 },
1190 { 1193 {
1191 { 1194 {
1192 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1195 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1193 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1196 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
1194 } 1197 }
1195 }, 1198 },
1196 { 1199 {
1197 { 1200 {
1198 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1201 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1199 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1202 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1200 } 1203 }
1201 }, 1204 },
1202 { 1205 {
1203 { 1206 {
1204 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1207 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1205 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1208 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1206 } 1209 }
1207 }, 1210 },
1208 { 1211 {
1209 { 1212 {
1210 {60, 1}, {60, 0}, {60, 1}, {60, 1}, 1213 CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
1211 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1214 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1212 } 1215 }
1213 }, 1216 },
1214 } 1217 }
@@ -1451,21 +1454,21 @@ static const struct ar9300_eeprom ar9300_h112 = {
1451 } 1454 }
1452 }, 1455 },
1453 .ctlPowerData_2G = { 1456 .ctlPowerData_2G = {
1454 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1457 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1455 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1458 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1456 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 1459 { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
1457 1460
1458 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 1461 { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
1459 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1462 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1460 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1463 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1461 1464
1462 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 1465 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
1463 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1466 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1464 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1467 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1465 1468
1466 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1469 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1467 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 1470 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
1468 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 1471 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
1469 }, 1472 },
1470 .modalHeader5G = { 1473 .modalHeader5G = {
1471 /* 4 idle,t1,t2,b (4 bits per setting) */ 1474 /* 4 idle,t1,t2,b (4 bits per setting) */
@@ -1737,56 +1740,56 @@ static const struct ar9300_eeprom ar9300_h112 = {
1737 .ctlPowerData_5G = { 1740 .ctlPowerData_5G = {
1738 { 1741 {
1739 { 1742 {
1740 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1743 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1741 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1744 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1742 } 1745 }
1743 }, 1746 },
1744 { 1747 {
1745 { 1748 {
1746 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1749 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1747 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1750 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1748 } 1751 }
1749 }, 1752 },
1750 { 1753 {
1751 { 1754 {
1752 {60, 0}, {60, 1}, {60, 0}, {60, 1}, 1755 CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1753 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1756 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1754 } 1757 }
1755 }, 1758 },
1756 { 1759 {
1757 { 1760 {
1758 {60, 0}, {60, 1}, {60, 1}, {60, 0}, 1761 CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1759 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1762 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
1760 } 1763 }
1761 }, 1764 },
1762 { 1765 {
1763 { 1766 {
1764 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1767 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1765 {60, 0}, {60, 0}, {60, 0}, {60, 0}, 1768 CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
1766 } 1769 }
1767 }, 1770 },
1768 { 1771 {
1769 { 1772 {
1770 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1773 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1771 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1774 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
1772 } 1775 }
1773 }, 1776 },
1774 { 1777 {
1775 { 1778 {
1776 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1779 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1777 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1780 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1778 } 1781 }
1779 }, 1782 },
1780 { 1783 {
1781 { 1784 {
1782 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1785 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1783 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1786 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1784 } 1787 }
1785 }, 1788 },
1786 { 1789 {
1787 { 1790 {
1788 {60, 1}, {60, 0}, {60, 1}, {60, 1}, 1791 CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
1789 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1792 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1790 } 1793 }
1791 }, 1794 },
1792 } 1795 }
@@ -2029,21 +2032,21 @@ static const struct ar9300_eeprom ar9300_x112 = {
2029 } 2032 }
2030 }, 2033 },
2031 .ctlPowerData_2G = { 2034 .ctlPowerData_2G = {
2032 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2035 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2033 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2036 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2034 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 2037 { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
2035 2038
2036 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 2039 { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
2037 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2040 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2038 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2041 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2039 2042
2040 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 2043 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
2041 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2044 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2042 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2045 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2043 2046
2044 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2047 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2045 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2048 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
2046 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2049 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
2047 }, 2050 },
2048 .modalHeader5G = { 2051 .modalHeader5G = {
2049 /* 4 idle,t1,t2,b (4 bits per setting) */ 2052 /* 4 idle,t1,t2,b (4 bits per setting) */
@@ -2315,56 +2318,56 @@ static const struct ar9300_eeprom ar9300_x112 = {
2315 .ctlPowerData_5G = { 2318 .ctlPowerData_5G = {
2316 { 2319 {
2317 { 2320 {
2318 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2321 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2319 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2322 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2320 } 2323 }
2321 }, 2324 },
2322 { 2325 {
2323 { 2326 {
2324 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2327 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2325 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2328 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2326 } 2329 }
2327 }, 2330 },
2328 { 2331 {
2329 { 2332 {
2330 {60, 0}, {60, 1}, {60, 0}, {60, 1}, 2333 CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2331 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2334 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2332 } 2335 }
2333 }, 2336 },
2334 { 2337 {
2335 { 2338 {
2336 {60, 0}, {60, 1}, {60, 1}, {60, 0}, 2339 CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2337 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2340 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
2338 } 2341 }
2339 }, 2342 },
2340 { 2343 {
2341 { 2344 {
2342 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2345 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2343 {60, 0}, {60, 0}, {60, 0}, {60, 0}, 2346 CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
2344 } 2347 }
2345 }, 2348 },
2346 { 2349 {
2347 { 2350 {
2348 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2351 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2349 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2352 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
2350 } 2353 }
2351 }, 2354 },
2352 { 2355 {
2353 { 2356 {
2354 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2357 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2355 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2358 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2356 } 2359 }
2357 }, 2360 },
2358 { 2361 {
2359 { 2362 {
2360 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2363 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2361 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2364 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2362 } 2365 }
2363 }, 2366 },
2364 { 2367 {
2365 { 2368 {
2366 {60, 1}, {60, 0}, {60, 1}, {60, 1}, 2369 CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
2367 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2370 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2368 } 2371 }
2369 }, 2372 },
2370 } 2373 }
@@ -2606,21 +2609,21 @@ static const struct ar9300_eeprom ar9300_h116 = {
2606 } 2609 }
2607 }, 2610 },
2608 .ctlPowerData_2G = { 2611 .ctlPowerData_2G = {
2609 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2612 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2610 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2613 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2611 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 2614 { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
2612 2615
2613 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 2616 { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
2614 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2617 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2615 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2618 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2616 2619
2617 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 2620 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
2618 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2621 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2619 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2622 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2620 2623
2621 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2624 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2622 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2625 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
2623 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2626 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
2624 }, 2627 },
2625 .modalHeader5G = { 2628 .modalHeader5G = {
2626 /* 4 idle,t1,t2,b (4 bits per setting) */ 2629 /* 4 idle,t1,t2,b (4 bits per setting) */
@@ -2892,56 +2895,56 @@ static const struct ar9300_eeprom ar9300_h116 = {
2892 .ctlPowerData_5G = { 2895 .ctlPowerData_5G = {
2893 { 2896 {
2894 { 2897 {
2895 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2898 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2896 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2899 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2897 } 2900 }
2898 }, 2901 },
2899 { 2902 {
2900 { 2903 {
2901 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2904 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2902 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2905 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2903 } 2906 }
2904 }, 2907 },
2905 { 2908 {
2906 { 2909 {
2907 {60, 0}, {60, 1}, {60, 0}, {60, 1}, 2910 CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2908 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2911 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2909 } 2912 }
2910 }, 2913 },
2911 { 2914 {
2912 { 2915 {
2913 {60, 0}, {60, 1}, {60, 1}, {60, 0}, 2916 CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2914 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2917 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
2915 } 2918 }
2916 }, 2919 },
2917 { 2920 {
2918 { 2921 {
2919 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2922 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2920 {60, 0}, {60, 0}, {60, 0}, {60, 0}, 2923 CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
2921 } 2924 }
2922 }, 2925 },
2923 { 2926 {
2924 { 2927 {
2925 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2928 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2926 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2929 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
2927 } 2930 }
2928 }, 2931 },
2929 { 2932 {
2930 { 2933 {
2931 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2934 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2932 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2935 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2933 } 2936 }
2934 }, 2937 },
2935 { 2938 {
2936 { 2939 {
2937 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2940 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2938 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2941 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2939 } 2942 }
2940 }, 2943 },
2941 { 2944 {
2942 { 2945 {
2943 {60, 1}, {60, 0}, {60, 1}, {60, 1}, 2946 CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
2944 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2947 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2945 } 2948 }
2946 }, 2949 },
2947 } 2950 }
@@ -4363,9 +4366,9 @@ static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep,
4363 struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; 4366 struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
4364 4367
4365 if (is2GHz) 4368 if (is2GHz)
4366 return ctl_2g[idx].ctlEdges[edge].tPower; 4369 return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]);
4367 else 4370 else
4368 return ctl_5g[idx].ctlEdges[edge].tPower; 4371 return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]);
4369} 4372}
4370 4373
4371static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, 4374static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
@@ -4383,12 +4386,12 @@ static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
4383 4386
4384 if (is2GHz) { 4387 if (is2GHz) {
4385 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && 4388 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq &&
4386 ctl_2g[idx].ctlEdges[edge - 1].flag) 4389 CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1]))
4387 return ctl_2g[idx].ctlEdges[edge - 1].tPower; 4390 return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]);
4388 } else { 4391 } else {
4389 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && 4392 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq &&
4390 ctl_5g[idx].ctlEdges[edge - 1].flag) 4393 CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1]))
4391 return ctl_5g[idx].ctlEdges[edge - 1].tPower; 4394 return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]);
4392 } 4395 }
4393 4396
4394 return AR9300_MAX_RATE_POWER; 4397 return AR9300_MAX_RATE_POWER;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
index 57f64dbbcd89..9c1463307f0c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
@@ -270,17 +270,12 @@ struct cal_tgt_pow_ht {
270 u8 tPow2x[14]; 270 u8 tPow2x[14];
271} __packed; 271} __packed;
272 272
273struct cal_ctl_edge_pwr {
274 u8 tPower:6,
275 flag:2;
276} __packed;
277
278struct cal_ctl_data_2g { 273struct cal_ctl_data_2g {
279 struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_2G]; 274 u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G];
280} __packed; 275} __packed;
281 276
282struct cal_ctl_data_5g { 277struct cal_ctl_data_5g {
283 struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_5G]; 278 u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G];
284} __packed; 279} __packed;
285 280
286struct ar9300_BaseExtension_1 { 281struct ar9300_BaseExtension_1 {
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 6f90acc5cca7..0b4b4704b1f0 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -21,6 +21,7 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/leds.h> 22#include <linux/leds.h>
23#include <linux/completion.h> 23#include <linux/completion.h>
24#include <linux/pm_qos_params.h>
24 25
25#include "debug.h" 26#include "debug.h"
26#include "common.h" 27#include "common.h"
@@ -628,6 +629,8 @@ struct ath_softc {
628 struct ath_descdma txsdma; 629 struct ath_descdma txsdma;
629 630
630 struct ath_ant_comb ant_comb; 631 struct ath_ant_comb ant_comb;
632
633 struct pm_qos_request_list pm_qos_req;
631}; 634};
632 635
633struct ath_wiphy { 636struct ath_wiphy {
@@ -657,7 +660,6 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz)
657} 660}
658 661
659extern struct ieee80211_ops ath9k_ops; 662extern struct ieee80211_ops ath9k_ops;
660extern struct pm_qos_request_list ath9k_pm_qos_req;
661extern int modparam_nohwcrypt; 663extern int modparam_nohwcrypt;
662extern int led_blink; 664extern int led_blink;
663 665
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 1266333f586d..2bbf94d0191e 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower,
240 for (i = 0; (i < num_band_edges) && 240 for (i = 0; (i < num_band_edges) &&
241 (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { 241 (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
242 if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { 242 if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) {
243 twiceMaxEdgePower = pRdEdgesPower[i].tPower; 243 twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl);
244 break; 244 break;
245 } else if ((i > 0) && 245 } else if ((i > 0) &&
246 (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, 246 (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel,
247 is2GHz))) { 247 is2GHz))) {
248 if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, 248 if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel,
249 is2GHz) < freq && 249 is2GHz) < freq &&
250 pRdEdgesPower[i - 1].flag) { 250 CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) {
251 twiceMaxEdgePower = 251 twiceMaxEdgePower =
252 pRdEdgesPower[i - 1].tPower; 252 CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl);
253 } 253 }
254 break; 254 break;
255 } 255 }
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 3c99830dab0c..8a644fced5c9 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -233,6 +233,18 @@
233 233
234#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) 234#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1)
235 235
236#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
237#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
238
239#define LNA_CTL_BUF_MODE BIT(0)
240#define LNA_CTL_ISEL_LO BIT(1)
241#define LNA_CTL_ISEL_HI BIT(2)
242#define LNA_CTL_BUF_IN BIT(3)
243#define LNA_CTL_FEM_BAND BIT(4)
244#define LNA_CTL_LOCAL_BIAS BIT(5)
245#define LNA_CTL_FORCE_XPA BIT(6)
246#define LNA_CTL_USE_ANT1 BIT(7)
247
236enum eeprom_param { 248enum eeprom_param {
237 EEP_NFTHRESH_5, 249 EEP_NFTHRESH_5,
238 EEP_NFTHRESH_2, 250 EEP_NFTHRESH_2,
@@ -378,10 +390,7 @@ struct modal_eep_header {
378 u8 xatten2Margin[AR5416_MAX_CHAINS]; 390 u8 xatten2Margin[AR5416_MAX_CHAINS];
379 u8 ob_ch1; 391 u8 ob_ch1;
380 u8 db_ch1; 392 u8 db_ch1;
381 u8 useAnt1:1, 393 u8 lna_ctl;
382 force_xpaon:1,
383 local_bias:1,
384 femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
385 u8 miscBits; 394 u8 miscBits;
386 u16 xpaBiasLvlFreq[3]; 395 u16 xpaBiasLvlFreq[3];
387 u8 futureModal[6]; 396 u8 futureModal[6];
@@ -535,18 +544,10 @@ struct cal_target_power_ht {
535 u8 tPow2x[8]; 544 u8 tPow2x[8];
536} __packed; 545} __packed;
537 546
538
539#ifdef __BIG_ENDIAN_BITFIELD
540struct cal_ctl_edges {
541 u8 bChannel;
542 u8 flag:2, tPower:6;
543} __packed;
544#else
545struct cal_ctl_edges { 547struct cal_ctl_edges {
546 u8 bChannel; 548 u8 bChannel;
547 u8 tPower:6, flag:2; 549 u8 ctl;
548} __packed; 550} __packed;
549#endif
550 551
551struct cal_data_op_loop_ar9287 { 552struct cal_data_op_loop_ar9287 {
552 u8 pwrPdg[2][5]; 553 u8 pwrPdg[2][5];
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index e94216e1e107..45f70b2404a1 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
451 ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2, 451 ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
452 AR_AN_TOP2_LOCALBIAS, 452 AR_AN_TOP2_LOCALBIAS,
453 AR_AN_TOP2_LOCALBIAS_S, 453 AR_AN_TOP2_LOCALBIAS_S,
454 pModal->local_bias); 454 !!(pModal->lna_ctl &
455 LNA_CTL_LOCAL_BIAS));
455 REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG, 456 REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
456 pModal->force_xpaon); 457 !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA));
457 } 458 }
458 459
459 REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, 460 REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
@@ -1435,9 +1436,9 @@ static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah,
1435 1436
1436 num_ant_config = 1; 1437 num_ant_config = 1;
1437 1438
1438 if (pBase->version >= 0x0E0D) 1439 if (pBase->version >= 0x0E0D &&
1439 if (pModal->useAnt1) 1440 (pModal->lna_ctl & LNA_CTL_USE_ANT1))
1440 num_ant_config += 1; 1441 num_ant_config += 1;
1441 1442
1442 return num_ant_config; 1443 return num_ant_config;
1443} 1444}
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index ce9e59f4cd3d..380d0c651137 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2046,7 +2046,8 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
2046 val = REG_READ(ah, AR7010_GPIO_IN); 2046 val = REG_READ(ah, AR7010_GPIO_IN);
2047 return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; 2047 return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0;
2048 } else if (AR_SREV_9300_20_OR_LATER(ah)) 2048 } else if (AR_SREV_9300_20_OR_LATER(ah))
2049 return MS_REG_READ(AR9300, gpio) != 0; 2049 return (MS(REG_READ(ah, AR_GPIO_IN), AR9300_GPIO_IN_VAL) &
2050 AR_GPIO_BIT(gpio)) != 0;
2050 else if (AR_SREV_9271(ah)) 2051 else if (AR_SREV_9271(ah))
2051 return MS_REG_READ(AR9271, gpio) != 0; 2052 return MS_REG_READ(AR9271, gpio) != 0;
2052 else if (AR_SREV_9287_11_OR_LATER(ah)) 2053 else if (AR_SREV_9287_11_OR_LATER(ah))
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 7eef1faee668..84e19e504dd0 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pm_qos_params.h>
19 18
20#include "ath9k.h" 19#include "ath9k.h"
21 20
@@ -180,8 +179,6 @@ static const struct ath_ops ath9k_common_ops = {
180 .write = ath9k_iowrite32, 179 .write = ath9k_iowrite32,
181}; 180};
182 181
183struct pm_qos_request_list ath9k_pm_qos_req;
184
185/**************************/ 182/**************************/
186/* Initialization */ 183/* Initialization */
187/**************************/ 184/**************************/
@@ -657,6 +654,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
657 hw->flags |= IEEE80211_HW_MFP_CAPABLE; 654 hw->flags |= IEEE80211_HW_MFP_CAPABLE;
658 655
659 hw->wiphy->interface_modes = 656 hw->wiphy->interface_modes =
657 BIT(NL80211_IFTYPE_P2P_GO) |
658 BIT(NL80211_IFTYPE_P2P_CLIENT) |
660 BIT(NL80211_IFTYPE_AP) | 659 BIT(NL80211_IFTYPE_AP) |
661 BIT(NL80211_IFTYPE_WDS) | 660 BIT(NL80211_IFTYPE_WDS) |
662 BIT(NL80211_IFTYPE_STATION) | 661 BIT(NL80211_IFTYPE_STATION) |
@@ -756,7 +755,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
756 ath_init_leds(sc); 755 ath_init_leds(sc);
757 ath_start_rfkill_poll(sc); 756 ath_start_rfkill_poll(sc);
758 757
759 pm_qos_add_request(&ath9k_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 758 pm_qos_add_request(&sc->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
760 PM_QOS_DEFAULT_VALUE); 759 PM_QOS_DEFAULT_VALUE);
761 760
762 return 0; 761 return 0;
@@ -827,7 +826,7 @@ void ath9k_deinit_device(struct ath_softc *sc)
827 } 826 }
828 827
829 ieee80211_unregister_hw(hw); 828 ieee80211_unregister_hw(hw);
830 pm_qos_remove_request(&ath9k_pm_qos_req); 829 pm_qos_remove_request(&sc->pm_qos_req);
831 ath_rx_cleanup(sc); 830 ath_rx_cleanup(sc);
832 ath_tx_cleanup(sc); 831 ath_tx_cleanup(sc);
833 ath9k_deinit_softc(sc); 832 ath9k_deinit_softc(sc);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 50bdb5db23b4..7acd6b0ca011 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <linux/nl80211.h> 17#include <linux/nl80211.h>
18#include <linux/pm_qos_params.h>
19#include "ath9k.h" 18#include "ath9k.h"
20#include "btcoex.h" 19#include "btcoex.h"
21 20
@@ -1184,7 +1183,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1184 ath9k_btcoex_timer_resume(sc); 1183 ath9k_btcoex_timer_resume(sc);
1185 } 1184 }
1186 1185
1187 pm_qos_update_request(&ath9k_pm_qos_req, 55); 1186 pm_qos_update_request(&sc->pm_qos_req, 55);
1188 1187
1189mutex_unlock: 1188mutex_unlock:
1190 mutex_unlock(&sc->mutex); 1189 mutex_unlock(&sc->mutex);
@@ -1339,7 +1338,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1339 1338
1340 sc->sc_flags |= SC_OP_INVALID; 1339 sc->sc_flags |= SC_OP_INVALID;
1341 1340
1342 pm_qos_update_request(&ath9k_pm_qos_req, PM_QOS_DEFAULT_VALUE); 1341 pm_qos_update_request(&sc->pm_qos_req, PM_QOS_DEFAULT_VALUE);
1343 1342
1344 mutex_unlock(&sc->mutex); 1343 mutex_unlock(&sc->mutex);
1345 1344
@@ -1436,6 +1435,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1436 struct ath_softc *sc = aphy->sc; 1435 struct ath_softc *sc = aphy->sc;
1437 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1436 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1438 struct ath_vif *avp = (void *)vif->drv_priv; 1437 struct ath_vif *avp = (void *)vif->drv_priv;
1438 bool bs_valid = false;
1439 int i; 1439 int i;
1440 1440
1441 ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); 1441 ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n");
@@ -1464,7 +1464,15 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1464 "slot\n", __func__); 1464 "slot\n", __func__);
1465 sc->beacon.bslot[i] = NULL; 1465 sc->beacon.bslot[i] = NULL;
1466 sc->beacon.bslot_aphy[i] = NULL; 1466 sc->beacon.bslot_aphy[i] = NULL;
1467 } 1467 } else if (sc->beacon.bslot[i])
1468 bs_valid = true;
1469 }
1470 if (!bs_valid && (sc->sc_ah->imask & ATH9K_INT_SWBA)) {
1471 /* Disable SWBA interrupt */
1472 sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
1473 ath9k_ps_wakeup(sc);
1474 ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
1475 ath9k_ps_restore(sc);
1468 } 1476 }
1469 1477
1470 sc->nvifs--; 1478 sc->nvifs--;
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index a597cc8d8644..c2472edab5e0 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -976,11 +976,13 @@ enum {
976#define AR9287_GPIO_IN_VAL_S 11 976#define AR9287_GPIO_IN_VAL_S 11
977#define AR9271_GPIO_IN_VAL 0xFFFF0000 977#define AR9271_GPIO_IN_VAL 0xFFFF0000
978#define AR9271_GPIO_IN_VAL_S 16 978#define AR9271_GPIO_IN_VAL_S 16
979#define AR9300_GPIO_IN_VAL 0x0001FFFF
980#define AR9300_GPIO_IN_VAL_S 0
981#define AR7010_GPIO_IN_VAL 0x0000FFFF 979#define AR7010_GPIO_IN_VAL 0x0000FFFF
982#define AR7010_GPIO_IN_VAL_S 0 980#define AR7010_GPIO_IN_VAL_S 0
983 981
982#define AR_GPIO_IN 0x404c
983#define AR9300_GPIO_IN_VAL 0x0001FFFF
984#define AR9300_GPIO_IN_VAL_S 0
985
984#define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) 986#define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c)
985#define AR_GPIO_OE_OUT_DRV 0x3 987#define AR_GPIO_OE_OUT_DRV 0x3
986#define AR_GPIO_OE_OUT_DRV_NO 0x0 988#define AR_GPIO_OE_OUT_DRV_NO 0x0
diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c
index ae6c006bbc56..546b4e4ec5ea 100644
--- a/drivers/net/wireless/ath/carl9170/fw.c
+++ b/drivers/net/wireless/ath/carl9170/fw.c
@@ -291,7 +291,8 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len)
291 291
292 if (SUPP(CARL9170FW_WLANTX_CAB)) { 292 if (SUPP(CARL9170FW_WLANTX_CAB)) {
293 ar->hw->wiphy->interface_modes |= 293 ar->hw->wiphy->interface_modes |=
294 BIT(NL80211_IFTYPE_AP); 294 BIT(NL80211_IFTYPE_AP) |
295 BIT(NL80211_IFTYPE_P2P_GO);
295 } 296 }
296 } 297 }
297 298
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 511dbe3caf58..870df8c42622 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1648,7 +1648,8 @@ void *carl9170_alloc(size_t priv_size)
1648 * supports these modes. The code which will add the 1648 * supports these modes. The code which will add the
1649 * additional interface_modes is in fw.c. 1649 * additional interface_modes is in fw.c.
1650 */ 1650 */
1651 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 1651 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
1652 BIT(NL80211_IFTYPE_P2P_CLIENT);
1652 1653
1653 hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS | 1654 hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS |
1654 IEEE80211_HW_REPORTS_TX_ACK_STATUS | 1655 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index aee5c9d89a14..6cc58e052d10 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -867,7 +867,7 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
867 867
868 mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION | 868 mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION |
869 AR9170_TX_MAC_BACKOFF); 869 AR9170_TX_MAC_BACKOFF);
870 mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) && 870 mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) &
871 AR9170_TX_MAC_QOS); 871 AR9170_TX_MAC_QOS);
872 872
873 no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK); 873 no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK);
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index e5685dc317a8..b4de0ca10feb 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -1170,7 +1170,6 @@ static void if_sdio_remove(struct sdio_func *func)
1170 lbs_deb_sdio("call remove card\n"); 1170 lbs_deb_sdio("call remove card\n");
1171 lbs_stop_card(card->priv); 1171 lbs_stop_card(card->priv);
1172 lbs_remove_card(card->priv); 1172 lbs_remove_card(card->priv);
1173 card->priv->surpriseremoved = 1;
1174 1173
1175 flush_workqueue(card->workqueue); 1174 flush_workqueue(card->workqueue);
1176 destroy_workqueue(card->workqueue); 1175 destroy_workqueue(card->workqueue);
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 79bcb4e5d2ca..ecd4d04b2c3c 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1055,7 +1055,6 @@ static int __devexit libertas_spi_remove(struct spi_device *spi)
1055 lbs_stop_card(priv); 1055 lbs_stop_card(priv);
1056 lbs_remove_card(priv); /* will call free_netdev */ 1056 lbs_remove_card(priv); /* will call free_netdev */
1057 1057
1058 priv->surpriseremoved = 1;
1059 free_irq(spi->irq, card); 1058 free_irq(spi->irq, card);
1060 if_spi_terminate_spi_thread(card); 1059 if_spi_terminate_spi_thread(card);
1061 if (card->pdata->teardown) 1060 if (card->pdata->teardown)
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 143473c59393..6836a6dd9853 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -916,8 +916,6 @@ void lbs_remove_card(struct lbs_private *priv)
916 916
917 lbs_free_adapter(priv); 917 lbs_free_adapter(priv);
918 lbs_cfg_free(priv); 918 lbs_cfg_free(priv);
919
920 priv->dev = NULL;
921 free_netdev(dev); 919 free_netdev(dev);
922 920
923 lbs_deb_leave(LBS_DEB_MAIN); 921 lbs_deb_leave(LBS_DEB_MAIN);
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index e8e2d0f4763d..fa0cf744958f 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -1392,10 +1392,9 @@ static void orinoco_process_scan_results(struct work_struct *work)
1392 orinoco_add_hostscan_results(priv, buf, len); 1392 orinoco_add_hostscan_results(priv, buf, len);
1393 1393
1394 kfree(buf); 1394 kfree(buf);
1395 } else if (priv->scan_request) { 1395 } else {
1396 /* Either abort or complete the scan */ 1396 /* Either abort or complete the scan */
1397 cfg80211_scan_done(priv->scan_request, (len < 0)); 1397 orinoco_scan_done(priv, (len < 0));
1398 priv->scan_request = NULL;
1399 } 1398 }
1400 1399
1401 spin_lock_irqsave(&priv->scan_lock, flags); 1400 spin_lock_irqsave(&priv->scan_lock, flags);
@@ -1684,6 +1683,8 @@ static int __orinoco_down(struct orinoco_private *priv)
1684 hermes_write_regn(hw, EVACK, 0xffff); 1683 hermes_write_regn(hw, EVACK, 0xffff);
1685 } 1684 }
1686 1685
1686 orinoco_scan_done(priv, true);
1687
1687 /* firmware will have to reassociate */ 1688 /* firmware will have to reassociate */
1688 netif_carrier_off(dev); 1689 netif_carrier_off(dev);
1689 priv->last_linkstatus = 0xffff; 1690 priv->last_linkstatus = 0xffff;
@@ -1762,10 +1763,7 @@ void orinoco_reset(struct work_struct *work)
1762 orinoco_unlock(priv, &flags); 1763 orinoco_unlock(priv, &flags);
1763 1764
1764 /* Scanning support: Notify scan cancellation */ 1765 /* Scanning support: Notify scan cancellation */
1765 if (priv->scan_request) { 1766 orinoco_scan_done(priv, true);
1766 cfg80211_scan_done(priv->scan_request, 1);
1767 priv->scan_request = NULL;
1768 }
1769 1767
1770 if (priv->hard_reset) { 1768 if (priv->hard_reset) {
1771 err = (*priv->hard_reset)(priv); 1769 err = (*priv->hard_reset)(priv);
diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c
index 4300d9db7d8c..86cb54c842e7 100644
--- a/drivers/net/wireless/orinoco/scan.c
+++ b/drivers/net/wireless/orinoco/scan.c
@@ -229,3 +229,11 @@ void orinoco_add_hostscan_results(struct orinoco_private *priv,
229 priv->scan_request = NULL; 229 priv->scan_request = NULL;
230 } 230 }
231} 231}
232
233void orinoco_scan_done(struct orinoco_private *priv, bool abort)
234{
235 if (priv->scan_request) {
236 cfg80211_scan_done(priv->scan_request, abort);
237 priv->scan_request = NULL;
238 }
239}
diff --git a/drivers/net/wireless/orinoco/scan.h b/drivers/net/wireless/orinoco/scan.h
index 2dc4e046dbdb..27281fb0a6dc 100644
--- a/drivers/net/wireless/orinoco/scan.h
+++ b/drivers/net/wireless/orinoco/scan.h
@@ -16,5 +16,6 @@ void orinoco_add_extscan_result(struct orinoco_private *priv,
16void orinoco_add_hostscan_results(struct orinoco_private *dev, 16void orinoco_add_hostscan_results(struct orinoco_private *dev,
17 unsigned char *buf, 17 unsigned char *buf,
18 size_t len); 18 size_t len);
19void orinoco_scan_done(struct orinoco_private *priv, bool abort);
19 20
20#endif /* _ORINOCO_SCAN_H_ */ 21#endif /* _ORINOCO_SCAN_H_ */
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 4b4da5b86ff9..f442668a1e52 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -129,8 +129,9 @@ static void handle_tx(struct vhost_net *net)
129 size_t hdr_size; 129 size_t hdr_size;
130 struct socket *sock; 130 struct socket *sock;
131 131
132 sock = rcu_dereference_check(vq->private_data, 132 /* TODO: check that we are running from vhost_worker?
133 lockdep_is_held(&vq->mutex)); 133 * Not sure it's worth it, it's straight-forward enough. */
134 sock = rcu_dereference_check(vq->private_data, 1);
134 if (!sock) 135 if (!sock)
135 return; 136 return;
136 137
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index 1ff81b51b656..dd3c34ebca9a 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -11,6 +11,7 @@
11#define MARVELL_PHY_ID_88E1118 0x01410e10 11#define MARVELL_PHY_ID_88E1118 0x01410e10
12#define MARVELL_PHY_ID_88E1121R 0x01410cb0 12#define MARVELL_PHY_ID_88E1121R 0x01410cb0
13#define MARVELL_PHY_ID_88E1145 0x01410cd0 13#define MARVELL_PHY_ID_88E1145 0x01410cd0
14#define MARVELL_PHY_ID_88E1149R 0x01410e50
14#define MARVELL_PHY_ID_88E1240 0x01410e30 15#define MARVELL_PHY_ID_88E1240 0x01410e30
15#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
16 17
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index ebb0c80ffd6e..12b2b18e50c1 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -230,6 +230,7 @@ enum
230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ 230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
231 LINUX_MIB_TCPDEFERACCEPTDROP, 231 LINUX_MIB_TCPDEFERACCEPTDROP,
232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ 232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
233 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */
233 __LINUX_MIB_MAX 234 __LINUX_MIB_MAX
234}; 235};
235 236
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 90c9e2872f27..18e5c3f67580 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -10,6 +10,7 @@ extern void unix_inflight(struct file *fp);
10extern void unix_notinflight(struct file *fp); 10extern void unix_notinflight(struct file *fp);
11extern void unix_gc(void); 11extern void unix_gc(void);
12extern void wait_for_unix_gc(void); 12extern void wait_for_unix_gc(void);
13extern struct sock *unix_get_socket(struct file *filp);
13 14
14#define UNIX_HASH_SIZE 256 15#define UNIX_HASH_SIZE 256
15 16
@@ -56,6 +57,7 @@ struct unix_sock {
56 spinlock_t lock; 57 spinlock_t lock;
57 unsigned int gc_candidate : 1; 58 unsigned int gc_candidate : 1;
58 unsigned int gc_maybe_cycle : 1; 59 unsigned int gc_maybe_cycle : 1;
60 unsigned char recursion_level;
59 struct socket_wq peer_wq; 61 struct socket_wq peer_wq;
60}; 62};
61#define unix_sk(__sk) ((struct unix_sock *)__sk) 63#define unix_sk(__sk) ((struct unix_sock *)__sk)
diff --git a/include/net/sock.h b/include/net/sock.h
index 717cfbf649df..3482004e5c29 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1159,6 +1159,8 @@ extern void sk_common_release(struct sock *sk);
1159/* Initialise core socket variables */ 1159/* Initialise core socket variables */
1160extern void sock_init_data(struct socket *sock, struct sock *sk); 1160extern void sock_init_data(struct socket *sock, struct sock *sk);
1161 1161
1162extern void sk_filter_release_rcu(struct rcu_head *rcu);
1163
1162/** 1164/**
1163 * sk_filter_release - release a socket filter 1165 * sk_filter_release - release a socket filter
1164 * @fp: filter to remove 1166 * @fp: filter to remove
@@ -1169,7 +1171,7 @@ extern void sock_init_data(struct socket *sock, struct sock *sk);
1169static inline void sk_filter_release(struct sk_filter *fp) 1171static inline void sk_filter_release(struct sk_filter *fp)
1170{ 1172{
1171 if (atomic_dec_and_test(&fp->refcnt)) 1173 if (atomic_dec_and_test(&fp->refcnt))
1172 kfree(fp); 1174 call_rcu_bh(&fp->rcu, sk_filter_release_rcu);
1173} 1175}
1174 1176
1175static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) 1177static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index d0927d1fdada..66b9e5c0523a 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -882,7 +882,7 @@ static int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type)
882 int lm = 0; 882 int lm = 0;
883 883
884 if (type != SCO_LINK && type != ESCO_LINK) 884 if (type != SCO_LINK && type != ESCO_LINK)
885 return 0; 885 return -EINVAL;
886 886
887 BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); 887 BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr));
888 888
@@ -908,7 +908,7 @@ static int sco_connect_cfm(struct hci_conn *hcon, __u8 status)
908 BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); 908 BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
909 909
910 if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) 910 if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
911 return 0; 911 return -EINVAL;
912 912
913 if (!status) { 913 if (!status) {
914 struct sco_conn *conn; 914 struct sco_conn *conn;
@@ -927,7 +927,7 @@ static int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason)
927 BT_DBG("hcon %p reason %d", hcon, reason); 927 BT_DBG("hcon %p reason %d", hcon, reason);
928 928
929 if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) 929 if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
930 return 0; 930 return -EINVAL;
931 931
932 sco_conn_del(hcon, bt_err(reason)); 932 sco_conn_del(hcon, bt_err(reason));
933 933
diff --git a/net/ceph/Makefile b/net/ceph/Makefile
index 153bdec40835..e87ef435e11b 100644
--- a/net/ceph/Makefile
+++ b/net/ceph/Makefile
@@ -1,9 +1,6 @@
1# 1#
2# Makefile for CEPH filesystem. 2# Makefile for CEPH filesystem.
3# 3#
4
5ifneq ($(KERNELRELEASE),)
6
7obj-$(CONFIG_CEPH_LIB) += libceph.o 4obj-$(CONFIG_CEPH_LIB) += libceph.o
8 5
9libceph-y := ceph_common.o messenger.o msgpool.o buffer.o pagelist.o \ 6libceph-y := ceph_common.o messenger.o msgpool.o buffer.o pagelist.o \
@@ -16,22 +13,3 @@ libceph-y := ceph_common.o messenger.o msgpool.o buffer.o pagelist.o \
16 ceph_fs.o ceph_strings.o ceph_hash.o \ 13 ceph_fs.o ceph_strings.o ceph_hash.o \
17 pagevec.o 14 pagevec.o
18 15
19else
20#Otherwise we were called directly from the command
21# line; invoke the kernel build system.
22
23KERNELDIR ?= /lib/modules/$(shell uname -r)/build
24PWD := $(shell pwd)
25
26default: all
27
28all:
29 $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_CEPH_LIB=m modules
30
31modules_install:
32 $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_CEPH_LIB=m modules_install
33
34clean:
35 $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
36
37endif
diff --git a/net/ceph/buffer.c b/net/ceph/buffer.c
index 53d8abfa25d5..bf3e6a13c215 100644
--- a/net/ceph/buffer.c
+++ b/net/ceph/buffer.c
@@ -19,7 +19,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)
19 if (b->vec.iov_base) { 19 if (b->vec.iov_base) {
20 b->is_vmalloc = false; 20 b->is_vmalloc = false;
21 } else { 21 } else {
22 b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL); 22 b->vec.iov_base = __vmalloc(len, gfp | __GFP_HIGHMEM, PAGE_KERNEL);
23 if (!b->vec.iov_base) { 23 if (!b->vec.iov_base) {
24 kfree(b); 24 kfree(b);
25 return NULL; 25 return NULL;
diff --git a/net/core/filter.c b/net/core/filter.c
index 25500f16a18a..e193e29d4671 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -615,23 +615,16 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
615EXPORT_SYMBOL(sk_chk_filter); 615EXPORT_SYMBOL(sk_chk_filter);
616 616
617/** 617/**
618 * sk_filter_rcu_release - Release a socket filter by rcu_head 618 * sk_filter_release_rcu - Release a socket filter by rcu_head
619 * @rcu: rcu_head that contains the sk_filter to free 619 * @rcu: rcu_head that contains the sk_filter to free
620 */ 620 */
621static void sk_filter_rcu_release(struct rcu_head *rcu) 621void sk_filter_release_rcu(struct rcu_head *rcu)
622{ 622{
623 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); 623 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
624 624
625 sk_filter_release(fp); 625 kfree(fp);
626}
627
628static void sk_filter_delayed_uncharge(struct sock *sk, struct sk_filter *fp)
629{
630 unsigned int size = sk_filter_len(fp);
631
632 atomic_sub(size, &sk->sk_omem_alloc);
633 call_rcu_bh(&fp->rcu, sk_filter_rcu_release);
634} 626}
627EXPORT_SYMBOL(sk_filter_release_rcu);
635 628
636/** 629/**
637 * sk_attach_filter - attach a socket filter 630 * sk_attach_filter - attach a socket filter
@@ -675,7 +668,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
675 rcu_assign_pointer(sk->sk_filter, fp); 668 rcu_assign_pointer(sk->sk_filter, fp);
676 669
677 if (old_fp) 670 if (old_fp)
678 sk_filter_delayed_uncharge(sk, old_fp); 671 sk_filter_uncharge(sk, old_fp);
679 return 0; 672 return 0;
680} 673}
681EXPORT_SYMBOL_GPL(sk_attach_filter); 674EXPORT_SYMBOL_GPL(sk_attach_filter);
@@ -689,7 +682,7 @@ int sk_detach_filter(struct sock *sk)
689 sock_owned_by_user(sk)); 682 sock_owned_by_user(sk));
690 if (filter) { 683 if (filter) {
691 rcu_assign_pointer(sk->sk_filter, NULL); 684 rcu_assign_pointer(sk->sk_filter, NULL);
692 sk_filter_delayed_uncharge(sk, filter); 685 sk_filter_uncharge(sk, filter);
693 ret = 0; 686 ret = 0;
694 } 687 }
695 return ret; 688 return ret;
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 41d99435f62d..182236b2510a 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -46,9 +46,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
46 nr_table_entries = roundup_pow_of_two(nr_table_entries + 1); 46 nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
47 lopt_size += nr_table_entries * sizeof(struct request_sock *); 47 lopt_size += nr_table_entries * sizeof(struct request_sock *);
48 if (lopt_size > PAGE_SIZE) 48 if (lopt_size > PAGE_SIZE)
49 lopt = __vmalloc(lopt_size, 49 lopt = vzalloc(lopt_size);
50 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
51 PAGE_KERNEL);
52 else 50 else
53 lopt = kzalloc(lopt_size, GFP_KERNEL); 51 lopt = kzalloc(lopt_size, GFP_KERNEL);
54 if (lopt == NULL) 52 if (lopt == NULL)
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 7d230d14ce22..15af247ea007 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -241,7 +241,8 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
241 dccp_update_gsr(sk, seqno); 241 dccp_update_gsr(sk, seqno);
242 242
243 if (dh->dccph_type != DCCP_PKT_SYNC && 243 if (dh->dccph_type != DCCP_PKT_SYNC &&
244 (ackno != DCCP_PKT_WITHOUT_ACK_SEQ)) 244 ackno != DCCP_PKT_WITHOUT_ACK_SEQ &&
245 after48(ackno, dp->dccps_gar))
245 dp->dccps_gar = ackno; 246 dp->dccps_gar = ackno;
246 } else { 247 } else {
247 unsigned long now = jiffies; 248 unsigned long now = jiffies;
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 9ecef9968c39..0065e7e14af4 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1556,6 +1556,8 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
1556 if (r_len > sizeof(struct linkinfo_dn)) 1556 if (r_len > sizeof(struct linkinfo_dn))
1557 r_len = sizeof(struct linkinfo_dn); 1557 r_len = sizeof(struct linkinfo_dn);
1558 1558
1559 memset(&link, 0, sizeof(link));
1560
1559 switch(sock->state) { 1561 switch(sock->state) {
1560 case SS_CONNECTING: 1562 case SS_CONNECTING:
1561 link.idn_linkstate = LL_CONNECTING; 1563 link.idn_linkstate = LL_CONNECTING;
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index f8c1ae4b41f0..f180371fa415 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -31,6 +31,7 @@
31#include <linux/skbuff.h> 31#include <linux/skbuff.h>
32#include <linux/udp.h> 32#include <linux/udp.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/vmalloc.h>
34#include <net/sock.h> 35#include <net/sock.h>
35#include <net/inet_common.h> 36#include <net/inet_common.h>
36#include <linux/stat.h> 37#include <linux/stat.h>
@@ -276,12 +277,12 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
276#endif 277#endif
277#ifdef CONFIG_ECONET_AUNUDP 278#ifdef CONFIG_ECONET_AUNUDP
278 struct msghdr udpmsg; 279 struct msghdr udpmsg;
279 struct iovec iov[msg->msg_iovlen+1]; 280 struct iovec iov[2];
280 struct aunhdr ah; 281 struct aunhdr ah;
281 struct sockaddr_in udpdest; 282 struct sockaddr_in udpdest;
282 __kernel_size_t size; 283 __kernel_size_t size;
283 int i;
284 mm_segment_t oldfs; 284 mm_segment_t oldfs;
285 char *userbuf;
285#endif 286#endif
286 287
287 /* 288 /*
@@ -297,23 +298,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
297 298
298 mutex_lock(&econet_mutex); 299 mutex_lock(&econet_mutex);
299 300
300 if (saddr == NULL) { 301 if (saddr == NULL || msg->msg_namelen < sizeof(struct sockaddr_ec)) {
301 struct econet_sock *eo = ec_sk(sk); 302 mutex_unlock(&econet_mutex);
302 303 return -EINVAL;
303 addr.station = eo->station; 304 }
304 addr.net = eo->net; 305 addr.station = saddr->addr.station;
305 port = eo->port; 306 addr.net = saddr->addr.net;
306 cb = eo->cb; 307 port = saddr->port;
307 } else { 308 cb = saddr->cb;
308 if (msg->msg_namelen < sizeof(struct sockaddr_ec)) {
309 mutex_unlock(&econet_mutex);
310 return -EINVAL;
311 }
312 addr.station = saddr->addr.station;
313 addr.net = saddr->addr.net;
314 port = saddr->port;
315 cb = saddr->cb;
316 }
317 309
318 /* Look for a device with the right network number. */ 310 /* Look for a device with the right network number. */
319 dev = net2dev_map[addr.net]; 311 dev = net2dev_map[addr.net];
@@ -328,17 +320,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
328 } 320 }
329 } 321 }
330 322
331 if (len + 15 > dev->mtu) {
332 mutex_unlock(&econet_mutex);
333 return -EMSGSIZE;
334 }
335
336 if (dev->type == ARPHRD_ECONET) { 323 if (dev->type == ARPHRD_ECONET) {
337 /* Real hardware Econet. We're not worthy etc. */ 324 /* Real hardware Econet. We're not worthy etc. */
338#ifdef CONFIG_ECONET_NATIVE 325#ifdef CONFIG_ECONET_NATIVE
339 unsigned short proto = 0; 326 unsigned short proto = 0;
340 int res; 327 int res;
341 328
329 if (len + 15 > dev->mtu) {
330 mutex_unlock(&econet_mutex);
331 return -EMSGSIZE;
332 }
333
342 dev_hold(dev); 334 dev_hold(dev);
343 335
344 skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev), 336 skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev),
@@ -351,7 +343,6 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
351 343
352 eb = (struct ec_cb *)&skb->cb; 344 eb = (struct ec_cb *)&skb->cb;
353 345
354 /* BUG: saddr may be NULL */
355 eb->cookie = saddr->cookie; 346 eb->cookie = saddr->cookie;
356 eb->sec = *saddr; 347 eb->sec = *saddr;
357 eb->sent = ec_tx_done; 348 eb->sent = ec_tx_done;
@@ -415,6 +406,11 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
415 return -ENETDOWN; /* No socket - can't send */ 406 return -ENETDOWN; /* No socket - can't send */
416 } 407 }
417 408
409 if (len > 32768) {
410 err = -E2BIG;
411 goto error;
412 }
413
418 /* Make up a UDP datagram and hand it off to some higher intellect. */ 414 /* Make up a UDP datagram and hand it off to some higher intellect. */
419 415
420 memset(&udpdest, 0, sizeof(udpdest)); 416 memset(&udpdest, 0, sizeof(udpdest));
@@ -446,36 +442,26 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
446 442
447 /* tack our header on the front of the iovec */ 443 /* tack our header on the front of the iovec */
448 size = sizeof(struct aunhdr); 444 size = sizeof(struct aunhdr);
449 /*
450 * XXX: that is b0rken. We can't mix userland and kernel pointers
451 * in iovec, since on a lot of platforms copy_from_user() will
452 * *not* work with the kernel and userland ones at the same time,
453 * regardless of what we do with set_fs(). And we are talking about
454 * econet-over-ethernet here, so "it's only ARM anyway" doesn't
455 * apply. Any suggestions on fixing that code? -- AV
456 */
457 iov[0].iov_base = (void *)&ah; 445 iov[0].iov_base = (void *)&ah;
458 iov[0].iov_len = size; 446 iov[0].iov_len = size;
459 for (i = 0; i < msg->msg_iovlen; i++) { 447
460 void __user *base = msg->msg_iov[i].iov_base; 448 userbuf = vmalloc(len);
461 size_t iov_len = msg->msg_iov[i].iov_len; 449 if (userbuf == NULL) {
462 /* Check it now since we switch to KERNEL_DS later. */ 450 err = -ENOMEM;
463 if (!access_ok(VERIFY_READ, base, iov_len)) { 451 goto error;
464 mutex_unlock(&econet_mutex);
465 return -EFAULT;
466 }
467 iov[i+1].iov_base = base;
468 iov[i+1].iov_len = iov_len;
469 size += iov_len;
470 } 452 }
471 453
454 iov[1].iov_base = userbuf;
455 iov[1].iov_len = len;
456 err = memcpy_fromiovec(userbuf, msg->msg_iov, len);
457 if (err)
458 goto error_free_buf;
459
472 /* Get a skbuff (no data, just holds our cb information) */ 460 /* Get a skbuff (no data, just holds our cb information) */
473 if ((skb = sock_alloc_send_skb(sk, 0, 461 if ((skb = sock_alloc_send_skb(sk, 0,
474 msg->msg_flags & MSG_DONTWAIT, 462 msg->msg_flags & MSG_DONTWAIT,
475 &err)) == NULL) { 463 &err)) == NULL)
476 mutex_unlock(&econet_mutex); 464 goto error_free_buf;
477 return err;
478 }
479 465
480 eb = (struct ec_cb *)&skb->cb; 466 eb = (struct ec_cb *)&skb->cb;
481 467
@@ -491,7 +477,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
491 udpmsg.msg_name = (void *)&udpdest; 477 udpmsg.msg_name = (void *)&udpdest;
492 udpmsg.msg_namelen = sizeof(udpdest); 478 udpmsg.msg_namelen = sizeof(udpdest);
493 udpmsg.msg_iov = &iov[0]; 479 udpmsg.msg_iov = &iov[0];
494 udpmsg.msg_iovlen = msg->msg_iovlen + 1; 480 udpmsg.msg_iovlen = 2;
495 udpmsg.msg_control = NULL; 481 udpmsg.msg_control = NULL;
496 udpmsg.msg_controllen = 0; 482 udpmsg.msg_controllen = 0;
497 udpmsg.msg_flags=0; 483 udpmsg.msg_flags=0;
@@ -499,9 +485,13 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
499 oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */ 485 oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */
500 err = sock_sendmsg(udpsock, &udpmsg, size); 486 err = sock_sendmsg(udpsock, &udpmsg, size);
501 set_fs(oldfs); 487 set_fs(oldfs);
488
489error_free_buf:
490 vfree(userbuf);
502#else 491#else
503 err = -EPROTOTYPE; 492 err = -EPROTOTYPE;
504#endif 493#endif
494 error:
505 mutex_unlock(&econet_mutex); 495 mutex_unlock(&econet_mutex);
506 496
507 return err; 497 return err;
@@ -671,6 +661,11 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg)
671 err = 0; 661 err = 0;
672 switch (cmd) { 662 switch (cmd) {
673 case SIOCSIFADDR: 663 case SIOCSIFADDR:
664 if (!capable(CAP_NET_ADMIN)) {
665 err = -EPERM;
666 break;
667 }
668
674 edev = dev->ec_ptr; 669 edev = dev->ec_ptr;
675 if (edev == NULL) { 670 if (edev == NULL) {
676 /* Magic up a new one. */ 671 /* Magic up a new one. */
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 200eb538fbb3..0f280348e0fd 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -365,7 +365,7 @@ static struct tnode *tnode_alloc(size_t size)
365 if (size <= PAGE_SIZE) 365 if (size <= PAGE_SIZE)
366 return kzalloc(size, GFP_KERNEL); 366 return kzalloc(size, GFP_KERNEL);
367 else 367 else
368 return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); 368 return vzalloc(size);
369} 369}
370 370
371static void __tnode_vfree(struct work_struct *arg) 371static void __tnode_vfree(struct work_struct *arg)
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 1b344f30b463..3c0369a3a663 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -133,8 +133,7 @@ int __inet_inherit_port(struct sock *sk, struct sock *child)
133 } 133 }
134 } 134 }
135 } 135 }
136 sk_add_bind_node(child, &tb->owners); 136 inet_bind_hash(child, tb, port);
137 inet_csk(child)->icsk_bind_hash = tb;
138 spin_unlock(&head->lock); 137 spin_unlock(&head->lock);
139 138
140 return 0; 139 return 0;
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 1b48eb1ed453..b14ec7d03b6e 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -253,6 +253,7 @@ static const struct snmp_mib snmp4_net_list[] = {
253 SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP), 253 SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP),
254 SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), 254 SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP),
255 SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER), 255 SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER),
256 SNMP_MIB_ITEM("TCPTimeWaitOverflow", LINUX_MIB_TCPTIMEWAITOVERFLOW),
256 SNMP_MIB_SENTINEL 257 SNMP_MIB_SENTINEL
257}; 258};
258 259
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index e91911d7aae2..1b4ec21497a4 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -26,6 +26,8 @@ static int zero;
26static int tcp_retr1_max = 255; 26static int tcp_retr1_max = 255;
27static int ip_local_port_range_min[] = { 1, 1 }; 27static int ip_local_port_range_min[] = { 1, 1 };
28static int ip_local_port_range_max[] = { 65535, 65535 }; 28static int ip_local_port_range_max[] = { 65535, 65535 };
29static int tcp_adv_win_scale_min = -31;
30static int tcp_adv_win_scale_max = 31;
29 31
30/* Update system visible IP port range */ 32/* Update system visible IP port range */
31static void set_local_port_range(int range[2]) 33static void set_local_port_range(int range[2])
@@ -426,7 +428,9 @@ static struct ctl_table ipv4_table[] = {
426 .data = &sysctl_tcp_adv_win_scale, 428 .data = &sysctl_tcp_adv_win_scale,
427 .maxlen = sizeof(int), 429 .maxlen = sizeof(int),
428 .mode = 0644, 430 .mode = 0644,
429 .proc_handler = proc_dointvec 431 .proc_handler = proc_dointvec_minmax,
432 .extra1 = &tcp_adv_win_scale_min,
433 .extra2 = &tcp_adv_win_scale_max,
430 }, 434 },
431 { 435 {
432 .procname = "tcp_tw_reuse", 436 .procname = "tcp_tw_reuse",
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2bb46d55f40c..6c11eece262c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2244,7 +2244,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2244 /* Values greater than interface MTU won't take effect. However 2244 /* Values greater than interface MTU won't take effect. However
2245 * at the point when this call is done we typically don't yet 2245 * at the point when this call is done we typically don't yet
2246 * know which interface is going to be used */ 2246 * know which interface is going to be used */
2247 if (val < 64 || val > MAX_TCP_WINDOW) { 2247 if (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW) {
2248 err = -EINVAL; 2248 err = -EINVAL;
2249 break; 2249 break;
2250 } 2250 }
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index dd555051ec8b..4fc3387aa994 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2013,7 +2013,9 @@ get_req:
2013 } 2013 }
2014get_sk: 2014get_sk:
2015 sk_nulls_for_each_from(sk, node) { 2015 sk_nulls_for_each_from(sk, node) {
2016 if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) { 2016 if (!net_eq(sock_net(sk), net))
2017 continue;
2018 if (sk->sk_family == st->family) {
2017 cur = sk; 2019 cur = sk;
2018 goto out; 2020 goto out;
2019 } 2021 }
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 3527b51d6159..80b1f80759ab 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -392,7 +392,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
392 * socket up. We've got bigger problems than 392 * socket up. We've got bigger problems than
393 * non-graceful socket closings. 393 * non-graceful socket closings.
394 */ 394 */
395 LIMIT_NETDEBUG(KERN_INFO "TCP: time wait bucket table overflow\n"); 395 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPTIMEWAITOVERFLOW);
396 } 396 }
397 397
398 tcp_update_metrics(sk); 398 tcp_update_metrics(sk);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 749b6498588e..97041f24cd27 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -231,11 +231,10 @@ void tcp_select_initial_window(int __space, __u32 mss,
231 /* when initializing use the value from init_rcv_wnd 231 /* when initializing use the value from init_rcv_wnd
232 * rather than the default from above 232 * rather than the default from above
233 */ 233 */
234 if (init_rcv_wnd && 234 if (init_rcv_wnd)
235 (*rcv_wnd > init_rcv_wnd * mss)) 235 *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
236 *rcv_wnd = init_rcv_wnd * mss; 236 else
237 else if (*rcv_wnd > init_cwnd * mss) 237 *rcv_wnd = min(*rcv_wnd, init_cwnd * mss);
238 *rcv_wnd = init_cwnd * mss;
239 } 238 }
240 239
241 /* Set the clamp no higher than max representable value */ 240 /* Set the clamp no higher than max representable value */
@@ -386,27 +385,30 @@ struct tcp_out_options {
386 */ 385 */
387static u8 tcp_cookie_size_check(u8 desired) 386static u8 tcp_cookie_size_check(u8 desired)
388{ 387{
389 if (desired > 0) { 388 int cookie_size;
389
390 if (desired > 0)
390 /* previously specified */ 391 /* previously specified */
391 return desired; 392 return desired;
392 } 393
393 if (sysctl_tcp_cookie_size <= 0) { 394 cookie_size = ACCESS_ONCE(sysctl_tcp_cookie_size);
395 if (cookie_size <= 0)
394 /* no default specified */ 396 /* no default specified */
395 return 0; 397 return 0;
396 } 398
397 if (sysctl_tcp_cookie_size <= TCP_COOKIE_MIN) { 399 if (cookie_size <= TCP_COOKIE_MIN)
398 /* value too small, specify minimum */ 400 /* value too small, specify minimum */
399 return TCP_COOKIE_MIN; 401 return TCP_COOKIE_MIN;
400 } 402
401 if (sysctl_tcp_cookie_size >= TCP_COOKIE_MAX) { 403 if (cookie_size >= TCP_COOKIE_MAX)
402 /* value too large, specify maximum */ 404 /* value too large, specify maximum */
403 return TCP_COOKIE_MAX; 405 return TCP_COOKIE_MAX;
404 } 406
405 if (0x1 & sysctl_tcp_cookie_size) { 407 if (cookie_size & 1)
406 /* 8-bit multiple, illegal, fix it */ 408 /* 8-bit multiple, illegal, fix it */
407 return (u8)(sysctl_tcp_cookie_size + 0x1); 409 cookie_size++;
408 } 410
409 return (u8)sysctl_tcp_cookie_size; 411 return (u8)cookie_size;
410} 412}
411 413
412/* Write previously computed TCP options to the packet. 414/* Write previously computed TCP options to the packet.
@@ -1516,6 +1518,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
1516 struct tcp_sock *tp = tcp_sk(sk); 1518 struct tcp_sock *tp = tcp_sk(sk);
1517 const struct inet_connection_sock *icsk = inet_csk(sk); 1519 const struct inet_connection_sock *icsk = inet_csk(sk);
1518 u32 send_win, cong_win, limit, in_flight; 1520 u32 send_win, cong_win, limit, in_flight;
1521 int win_divisor;
1519 1522
1520 if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN) 1523 if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN)
1521 goto send_now; 1524 goto send_now;
@@ -1547,13 +1550,14 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
1547 if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len)) 1550 if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len))
1548 goto send_now; 1551 goto send_now;
1549 1552
1550 if (sysctl_tcp_tso_win_divisor) { 1553 win_divisor = ACCESS_ONCE(sysctl_tcp_tso_win_divisor);
1554 if (win_divisor) {
1551 u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); 1555 u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache);
1552 1556
1553 /* If at least some fraction of a window is available, 1557 /* If at least some fraction of a window is available,
1554 * just use it. 1558 * just use it.
1555 */ 1559 */
1556 chunk /= sysctl_tcp_tso_win_divisor; 1560 chunk /= win_divisor;
1557 if (limit >= chunk) 1561 if (limit >= chunk)
1558 goto send_now; 1562 goto send_now;
1559 } else { 1563 } else {
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index b1155554bb18..4f4483e697bd 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1173,6 +1173,8 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
1173 sizeof (struct ipv6hdr); 1173 sizeof (struct ipv6hdr);
1174 1174
1175 dev->mtu = rt->rt6i_dev->mtu - sizeof (struct ipv6hdr); 1175 dev->mtu = rt->rt6i_dev->mtu - sizeof (struct ipv6hdr);
1176 if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
1177 dev->mtu-=8;
1176 1178
1177 if (dev->mtu < IPV6_MIN_MTU) 1179 if (dev->mtu < IPV6_MIN_MTU)
1178 dev->mtu = IPV6_MIN_MTU; 1180 dev->mtu = IPV6_MIN_MTU;
@@ -1361,12 +1363,17 @@ static const struct net_device_ops ip6_tnl_netdev_ops = {
1361 1363
1362static void ip6_tnl_dev_setup(struct net_device *dev) 1364static void ip6_tnl_dev_setup(struct net_device *dev)
1363{ 1365{
1366 struct ip6_tnl *t;
1367
1364 dev->netdev_ops = &ip6_tnl_netdev_ops; 1368 dev->netdev_ops = &ip6_tnl_netdev_ops;
1365 dev->destructor = ip6_dev_free; 1369 dev->destructor = ip6_dev_free;
1366 1370
1367 dev->type = ARPHRD_TUNNEL6; 1371 dev->type = ARPHRD_TUNNEL6;
1368 dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr); 1372 dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr);
1369 dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr); 1373 dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr);
1374 t = netdev_priv(dev);
1375 if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
1376 dev->mtu-=8;
1370 dev->flags |= IFF_NOARP; 1377 dev->flags |= IFF_NOARP;
1371 dev->addr_len = sizeof(struct in6_addr); 1378 dev->addr_len = sizeof(struct in6_addr);
1372 dev->features |= NETIF_F_NETNS_LOCAL; 1379 dev->features |= NETIF_F_NETNS_LOCAL;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 6e48a80d0f25..8ce38f10a547 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -606,8 +606,9 @@ static int ipip6_rcv(struct sk_buff *skb)
606 return 0; 606 return 0;
607 } 607 }
608 608
609 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); 609 /* no tunnel matched, let upstream know, ipsec may handle it */
610 rcu_read_unlock(); 610 rcu_read_unlock();
611 return 1;
611out: 612out:
612 kfree_skb(skb); 613 kfree_skb(skb);
613 return 0; 614 return 0;
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 04635e88e8ed..110efb704c9b 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -672,4 +672,8 @@ MODULE_LICENSE("GPL");
672MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); 672MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
673MODULE_DESCRIPTION("L2TP over IP"); 673MODULE_DESCRIPTION("L2TP over IP");
674MODULE_VERSION("1.0"); 674MODULE_VERSION("1.0");
675MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, SOCK_DGRAM, IPPROTO_L2TP); 675
676/* Use the value of SOCK_DGRAM (2) directory, because __stringify does't like
677 * enums
678 */
679MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d2fcd22ab06d..55337709de41 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2245,6 +2245,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
2245 break; 2245 break;
2246 case cpu_to_le16(IEEE80211_STYPE_DEAUTH): 2246 case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
2247 case cpu_to_le16(IEEE80211_STYPE_DISASSOC): 2247 case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
2248 if (is_multicast_ether_addr(mgmt->da) &&
2249 !is_broadcast_ether_addr(mgmt->da))
2250 return RX_DROP_MONITOR;
2251
2248 /* process only for station */ 2252 /* process only for station */
2249 if (sdata->vif.type != NL80211_IFTYPE_STATION) 2253 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2250 return RX_DROP_MONITOR; 2254 return RX_DROP_MONITOR;
@@ -2739,6 +2743,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
2739 2743
2740 if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) 2744 if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
2741 return; 2745 return;
2746 goto out;
2742 } 2747 }
2743 } 2748 }
2744 2749
@@ -2778,6 +2783,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
2778 return; 2783 return;
2779 } 2784 }
2780 2785
2786 out:
2781 dev_kfree_skb(skb); 2787 dev_kfree_skb(skb);
2782} 2788}
2783 2789
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e69483647f33..2ba742656825 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1595,7 +1595,12 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1595 list) { 1595 list) {
1596 if (!ieee80211_sdata_running(tmp_sdata)) 1596 if (!ieee80211_sdata_running(tmp_sdata))
1597 continue; 1597 continue;
1598 if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) 1598 if (tmp_sdata->vif.type ==
1599 NL80211_IFTYPE_MONITOR ||
1600 tmp_sdata->vif.type ==
1601 NL80211_IFTYPE_AP_VLAN ||
1602 tmp_sdata->vif.type ==
1603 NL80211_IFTYPE_WDS)
1599 continue; 1604 continue;
1600 if (compare_ether_addr(tmp_sdata->vif.addr, 1605 if (compare_ether_addr(tmp_sdata->vif.addr,
1601 hdr->addr2) == 0) { 1606 hdr->addr2) == 0) {
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 7ff31c60186a..417d7a6c36cf 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1344,9 +1344,25 @@ static void unix_destruct_scm(struct sk_buff *skb)
1344 sock_wfree(skb); 1344 sock_wfree(skb);
1345} 1345}
1346 1346
1347#define MAX_RECURSION_LEVEL 4
1348
1347static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) 1349static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1348{ 1350{
1349 int i; 1351 int i;
1352 unsigned char max_level = 0;
1353 int unix_sock_count = 0;
1354
1355 for (i = scm->fp->count - 1; i >= 0; i--) {
1356 struct sock *sk = unix_get_socket(scm->fp->fp[i]);
1357
1358 if (sk) {
1359 unix_sock_count++;
1360 max_level = max(max_level,
1361 unix_sk(sk)->recursion_level);
1362 }
1363 }
1364 if (unlikely(max_level > MAX_RECURSION_LEVEL))
1365 return -ETOOMANYREFS;
1350 1366
1351 /* 1367 /*
1352 * Need to duplicate file references for the sake of garbage 1368 * Need to duplicate file references for the sake of garbage
@@ -1357,9 +1373,11 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1357 if (!UNIXCB(skb).fp) 1373 if (!UNIXCB(skb).fp)
1358 return -ENOMEM; 1374 return -ENOMEM;
1359 1375
1360 for (i = scm->fp->count-1; i >= 0; i--) 1376 if (unix_sock_count) {
1361 unix_inflight(scm->fp->fp[i]); 1377 for (i = scm->fp->count - 1; i >= 0; i--)
1362 return 0; 1378 unix_inflight(scm->fp->fp[i]);
1379 }
1380 return max_level;
1363} 1381}
1364 1382
1365static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) 1383static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds)
@@ -1394,6 +1412,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1394 struct sk_buff *skb; 1412 struct sk_buff *skb;
1395 long timeo; 1413 long timeo;
1396 struct scm_cookie tmp_scm; 1414 struct scm_cookie tmp_scm;
1415 int max_level;
1397 1416
1398 if (NULL == siocb->scm) 1417 if (NULL == siocb->scm)
1399 siocb->scm = &tmp_scm; 1418 siocb->scm = &tmp_scm;
@@ -1432,8 +1451,9 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1432 goto out; 1451 goto out;
1433 1452
1434 err = unix_scm_to_skb(siocb->scm, skb, true); 1453 err = unix_scm_to_skb(siocb->scm, skb, true);
1435 if (err) 1454 if (err < 0)
1436 goto out_free; 1455 goto out_free;
1456 max_level = err + 1;
1437 unix_get_secdata(siocb->scm, skb); 1457 unix_get_secdata(siocb->scm, skb);
1438 1458
1439 skb_reset_transport_header(skb); 1459 skb_reset_transport_header(skb);
@@ -1515,6 +1535,8 @@ restart:
1515 if (sock_flag(other, SOCK_RCVTSTAMP)) 1535 if (sock_flag(other, SOCK_RCVTSTAMP))
1516 __net_timestamp(skb); 1536 __net_timestamp(skb);
1517 skb_queue_tail(&other->sk_receive_queue, skb); 1537 skb_queue_tail(&other->sk_receive_queue, skb);
1538 if (max_level > unix_sk(other)->recursion_level)
1539 unix_sk(other)->recursion_level = max_level;
1518 unix_state_unlock(other); 1540 unix_state_unlock(other);
1519 other->sk_data_ready(other, len); 1541 other->sk_data_ready(other, len);
1520 sock_put(other); 1542 sock_put(other);
@@ -1545,6 +1567,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
1545 int sent = 0; 1567 int sent = 0;
1546 struct scm_cookie tmp_scm; 1568 struct scm_cookie tmp_scm;
1547 bool fds_sent = false; 1569 bool fds_sent = false;
1570 int max_level;
1548 1571
1549 if (NULL == siocb->scm) 1572 if (NULL == siocb->scm)
1550 siocb->scm = &tmp_scm; 1573 siocb->scm = &tmp_scm;
@@ -1608,10 +1631,11 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
1608 1631
1609 /* Only send the fds in the first buffer */ 1632 /* Only send the fds in the first buffer */
1610 err = unix_scm_to_skb(siocb->scm, skb, !fds_sent); 1633 err = unix_scm_to_skb(siocb->scm, skb, !fds_sent);
1611 if (err) { 1634 if (err < 0) {
1612 kfree_skb(skb); 1635 kfree_skb(skb);
1613 goto out_err; 1636 goto out_err;
1614 } 1637 }
1638 max_level = err + 1;
1615 fds_sent = true; 1639 fds_sent = true;
1616 1640
1617 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); 1641 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
@@ -1627,6 +1651,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
1627 goto pipe_err_free; 1651 goto pipe_err_free;
1628 1652
1629 skb_queue_tail(&other->sk_receive_queue, skb); 1653 skb_queue_tail(&other->sk_receive_queue, skb);
1654 if (max_level > unix_sk(other)->recursion_level)
1655 unix_sk(other)->recursion_level = max_level;
1630 unix_state_unlock(other); 1656 unix_state_unlock(other);
1631 other->sk_data_ready(other, size); 1657 other->sk_data_ready(other, size);
1632 sent += size; 1658 sent += size;
@@ -1847,6 +1873,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1847 unix_state_lock(sk); 1873 unix_state_lock(sk);
1848 skb = skb_dequeue(&sk->sk_receive_queue); 1874 skb = skb_dequeue(&sk->sk_receive_queue);
1849 if (skb == NULL) { 1875 if (skb == NULL) {
1876 unix_sk(sk)->recursion_level = 0;
1850 if (copied >= target) 1877 if (copied >= target)
1851 goto unlock; 1878 goto unlock;
1852 1879
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index c8df6fda0b1f..f89f83bf828e 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -96,7 +96,7 @@ static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait);
96unsigned int unix_tot_inflight; 96unsigned int unix_tot_inflight;
97 97
98 98
99static struct sock *unix_get_socket(struct file *filp) 99struct sock *unix_get_socket(struct file *filp)
100{ 100{
101 struct sock *u_sock = NULL; 101 struct sock *u_sock = NULL;
102 struct inode *inode = filp->f_path.dentry->d_inode; 102 struct inode *inode = filp->f_path.dentry->d_inode;
@@ -259,9 +259,16 @@ static void inc_inflight_move_tail(struct unix_sock *u)
259} 259}
260 260
261static bool gc_in_progress = false; 261static bool gc_in_progress = false;
262#define UNIX_INFLIGHT_TRIGGER_GC 16000
262 263
263void wait_for_unix_gc(void) 264void wait_for_unix_gc(void)
264{ 265{
266 /*
267 * If number of inflight sockets is insane,
268 * force a garbage collect right now.
269 */
270 if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress)
271 unix_gc();
265 wait_event(unix_gc_wait, gc_in_progress == false); 272 wait_event(unix_gc_wait, gc_in_progress == false);
266} 273}
267 274
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c
index 4c81f6abb65b..4cbc942f762a 100644
--- a/net/x25/x25_link.c
+++ b/net/x25/x25_link.c
@@ -398,6 +398,7 @@ void __exit x25_link_free(void)
398 list_for_each_safe(entry, tmp, &x25_neigh_list) { 398 list_for_each_safe(entry, tmp, &x25_neigh_list) {
399 nb = list_entry(entry, struct x25_neigh, node); 399 nb = list_entry(entry, struct x25_neigh, node);
400 __x25_remove_neigh(nb); 400 __x25_remove_neigh(nb);
401 dev_put(nb->dev);
401 } 402 }
402 write_unlock_bh(&x25_neigh_list_lock); 403 write_unlock_bh(&x25_neigh_list_lock);
403} 404}
diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c
index a2023ec52329..1e98bc0fe0a5 100644
--- a/net/xfrm/xfrm_hash.c
+++ b/net/xfrm/xfrm_hash.c
@@ -19,7 +19,7 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz)
19 if (sz <= PAGE_SIZE) 19 if (sz <= PAGE_SIZE)
20 n = kzalloc(sz, GFP_KERNEL); 20 n = kzalloc(sz, GFP_KERNEL);
21 else if (hashdist) 21 else if (hashdist)
22 n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); 22 n = vzalloc(sz);
23 else 23 else
24 n = (struct hlist_head *) 24 n = (struct hlist_head *)
25 __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 25 __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,