aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-18 19:41:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-18 19:41:13 -0500
commit00c845dbfe2e966a2efd3818e40f46e286ca1ae6 (patch)
tree67d0f5d066b963e596126155a4da513d7b0550da
parent28ee5809ff7365d935d217c387ba959b8aa7182f (diff)
parent86c8fc4bbe14b8950e62d379bb57722427ad3d67 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix NBMA tunnel mac header handling in GRE, from Timo Teräs. 2) Fix a NAPI race in the fec driver, from Nimrod Andy. 3) The new IFF_VNET_LE bit is outside the size of the flags member it is stored in (which is 16-bits), store the state locally in the drivers. From Michael S Tsirkin. 4) We are kicking the tires with the new wireless maintainership situation. Bluetooth fixes via Johan Hedberg, and mac80211 fixes from Johannes Berg. 5) Fix locking and leaks in geneve driver, from Jesse Gross. 6) Make netlink TX mmap code always copy, so we don't have to be potentially exposed to the user changing the underlying contents from underneath us. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (63 commits) be2net: Fix incorrect setting of tunnel offload flag in netdev features bnx2x: fix typos in "configure" xen-netback: support frontends without feature-rx-notify again MAINTAINERS: changes for wireless cxgb4: Fix decoding QSA module for ethtool get settings geneve: Fix races between socket add and release. geneve: Remove socket and offload handlers at destruction. netlink: Don't reorder loads/stores before marking mmap netlink frame as available netlink: Always copy on mmap TX. Bluetooth: Fix bug with filter in service discovery optimization mac80211: free management frame keys when removing station net: Disallow providing non zero VLAN ID for NIC drivers FDB add flow net/mlx4: Cache line CQE/EQE stride fixes net: fec: Fix NAPI race xen-netfront: use napi_complete() correctly to prevent Rx stalling ip_tunnel: Add missing validation of encap type to ip_tunnel_encap_setup() ip_tunnel: Add sanity checks to ip_tunnel_encap_add_ops() net: Allow FIXED_PHY to be modular. if_tun: drop broken IFF_VNET_LE macvtap: drop broken IFF_VNET_LE ...
-rw-r--r--Documentation/networking/fib_trie.txt4
-rw-r--r--MAINTAINERS19
-rw-r--r--drivers/bluetooth/ath3k.c2
-rw-r--r--drivers/bluetooth/btusb.c1
-rw-r--r--drivers/net/dsa/Kconfig2
-rw-r--r--drivers/net/ethernet/broadcom/Kconfig4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h4
-rw-r--r--drivers/net/ethernet/cadence/macb.c25
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h2
-rw-r--r--drivers/net/ethernet/cirrus/cs89x0.c27
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c2
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c19
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c11
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c30
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c62
-rw-r--r--drivers/net/ethernet/smsc/Kconfig2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c10
-rw-r--r--drivers/net/macvtap.c30
-rw-r--r--drivers/net/phy/Kconfig4
-rw-r--r--drivers/net/phy/Makefile2
-rw-r--r--drivers/net/phy/fixed_phy.c (renamed from drivers/net/phy/fixed.c)0
-rw-r--r--drivers/net/tun.c26
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c15
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8821ae/dm.c11
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c6
-rw-r--r--drivers/net/xen-netback/common.h4
-rw-r--r--drivers/net/xen-netback/interface.c4
-rw-r--r--drivers/net/xen-netback/netback.c27
-rw-r--r--drivers/net/xen-netback/xenbus.c12
-rw-r--r--drivers/net/xen-netfront.c11
-rw-r--r--include/linux/phy_fixed.h2
-rw-r--r--include/uapi/linux/if_tun.h3
-rw-r--r--net/bluetooth/hci_conn.c2
-rw-r--r--net/bluetooth/hci_core.c60
-rw-r--r--net/bluetooth/hci_event.c20
-rw-r--r--net/bluetooth/l2cap_core.c5
-rw-r--r--net/bluetooth/mgmt.c99
-rw-r--r--net/bluetooth/smp.c5
-rw-r--r--net/core/rtnetlink.c5
-rw-r--r--net/ipv4/geneve.c30
-rw-r--r--net/ipv4/ip_gre.c9
-rw-r--r--net/ipv4/ip_tunnel.c9
-rw-r--r--net/mac80211/chan.c4
-rw-r--r--net/mac80211/key.c2
-rw-r--r--net/mac80211/mlme.c1
-rw-r--r--net/mac80211/rx.c11
-rw-r--r--net/netlink/af_netlink.c54
-rw-r--r--net/rds/message.c3
-rw-r--r--net/wireless/chan.c9
-rw-r--r--net/wireless/nl80211.c2
-rw-r--r--net/wireless/reg.c20
58 files changed, 454 insertions, 297 deletions
diff --git a/Documentation/networking/fib_trie.txt b/Documentation/networking/fib_trie.txt
index 0723db7f8495..fe719388518b 100644
--- a/Documentation/networking/fib_trie.txt
+++ b/Documentation/networking/fib_trie.txt
@@ -73,8 +73,8 @@ trie_leaf_remove()
73 73
74trie_rebalance() 74trie_rebalance()
75 The key function for the dynamic trie after any change in the trie 75 The key function for the dynamic trie after any change in the trie
76 it is run to optimize and reorganize. Tt will walk the trie upwards 76 it is run to optimize and reorganize. It will walk the trie upwards
77 towards the root from a given tnode, doing a resize() at each step 77 towards the root from a given tnode, doing a resize() at each step
78 to implement level compression. 78 to implement level compression.
79 79
80resize() 80resize()
diff --git a/MAINTAINERS b/MAINTAINERS
index 7605833aabc6..bae54c7fdacf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6610,19 +6610,8 @@ L: netdev@vger.kernel.org
6610S: Maintained 6610S: Maintained
6611 6611
6612NETWORKING [WIRELESS] 6612NETWORKING [WIRELESS]
6613M: "John W. Linville" <linville@tuxdriver.com>
6614L: linux-wireless@vger.kernel.org 6613L: linux-wireless@vger.kernel.org
6615Q: http://patchwork.kernel.org/project/linux-wireless/list/ 6614Q: http://patchwork.kernel.org/project/linux-wireless/list/
6616T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git
6617S: Maintained
6618F: net/mac80211/
6619F: net/rfkill/
6620F: net/wireless/
6621F: include/net/ieee80211*
6622F: include/linux/wireless.h
6623F: include/uapi/linux/wireless.h
6624F: include/net/iw_handler.h
6625F: drivers/net/wireless/
6626 6615
6627NETWORKING DRIVERS 6616NETWORKING DRIVERS
6628L: netdev@vger.kernel.org 6617L: netdev@vger.kernel.org
@@ -6643,6 +6632,14 @@ F: include/linux/inetdevice.h
6643F: include/uapi/linux/if_* 6632F: include/uapi/linux/if_*
6644F: include/uapi/linux/netdevice.h 6633F: include/uapi/linux/netdevice.h
6645 6634
6635NETWORKING DRIVERS (WIRELESS)
6636M: Kalle Valo <kvalo@codeaurora.org>
6637L: linux-wireless@vger.kernel.org
6638Q: http://patchwork.kernel.org/project/linux-wireless/list/
6639T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git/
6640S: Maintained
6641F: drivers/net/wireless/
6642
6646NETXEN (1/10) GbE SUPPORT 6643NETXEN (1/10) GbE SUPPORT
6647M: Manish Chopra <manish.chopra@qlogic.com> 6644M: Manish Chopra <manish.chopra@qlogic.com>
6648M: Sony Chacko <sony.chacko@qlogic.com> 6645M: Sony Chacko <sony.chacko@qlogic.com>
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index fce758896280..1ee27ac18de0 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -87,6 +87,7 @@ static const struct usb_device_id ath3k_table[] = {
87 { USB_DEVICE(0x04CA, 0x3007) }, 87 { USB_DEVICE(0x04CA, 0x3007) },
88 { USB_DEVICE(0x04CA, 0x3008) }, 88 { USB_DEVICE(0x04CA, 0x3008) },
89 { USB_DEVICE(0x04CA, 0x300b) }, 89 { USB_DEVICE(0x04CA, 0x300b) },
90 { USB_DEVICE(0x04CA, 0x3010) },
90 { USB_DEVICE(0x0930, 0x0219) }, 91 { USB_DEVICE(0x0930, 0x0219) },
91 { USB_DEVICE(0x0930, 0x0220) }, 92 { USB_DEVICE(0x0930, 0x0220) },
92 { USB_DEVICE(0x0930, 0x0227) }, 93 { USB_DEVICE(0x0930, 0x0227) },
@@ -140,6 +141,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
140 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, 141 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
141 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, 142 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
142 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, 143 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
144 { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
143 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, 145 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
144 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, 146 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
145 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, 147 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 31dd24ac9926..19cf2cf22e87 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -167,6 +167,7 @@ static const struct usb_device_id blacklist_table[] = {
167 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, 167 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
168 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, 168 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
169 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, 169 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
170 { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
170 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, 171 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
171 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, 172 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
172 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, 173 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index 7cf8f4ac281f..48e62a34f7f2 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -59,7 +59,7 @@ config NET_DSA_BCM_SF2
59 depends on HAS_IOMEM 59 depends on HAS_IOMEM
60 select NET_DSA 60 select NET_DSA
61 select NET_DSA_TAG_BRCM 61 select NET_DSA_TAG_BRCM
62 select FIXED_PHY if NET_DSA_BCM_SF2=y 62 select FIXED_PHY
63 select BCM7XXX_PHY 63 select BCM7XXX_PHY
64 select MDIO_BCM_UNIMAC 64 select MDIO_BCM_UNIMAC
65 ---help--- 65 ---help---
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index 888247ad9068..41a3c9804427 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -64,7 +64,7 @@ config BCMGENET
64 tristate "Broadcom GENET internal MAC support" 64 tristate "Broadcom GENET internal MAC support"
65 select MII 65 select MII
66 select PHYLIB 66 select PHYLIB
67 select FIXED_PHY if BCMGENET=y 67 select FIXED_PHY
68 select BCM7XXX_PHY 68 select BCM7XXX_PHY
69 help 69 help
70 This driver supports the built-in Ethernet MACs found in the 70 This driver supports the built-in Ethernet MACs found in the
@@ -155,7 +155,7 @@ config SYSTEMPORT
155 depends on OF 155 depends on OF
156 select MII 156 select MII
157 select PHYLIB 157 select PHYLIB
158 select FIXED_PHY if SYSTEMPORT=y 158 select FIXED_PHY
159 help 159 help
160 This driver supports the built-in Ethernet MACs found in the 160 This driver supports the built-in Ethernet MACs found in the
161 Broadcom BCM7xxx Set Top Box family chipset using an internal 161 Broadcom BCM7xxx Set Top Box family chipset using an internal
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 691f0bf09ee1..9f5e38769a29 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13256,7 +13256,7 @@ static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
13256 return -EFAULT; 13256 return -EFAULT;
13257 } 13257 }
13258 13258
13259 DP(BNX2X_MSG_PTP, "Configrued val = %d, period = %d\n", best_val, 13259 DP(BNX2X_MSG_PTP, "Configured val = %d, period = %d\n", best_val,
13260 best_period); 13260 best_period);
13261 13261
13262 return 0; 13262 return 0;
@@ -14784,7 +14784,7 @@ static int bnx2x_hwtstamp_ioctl(struct bnx2x *bp, struct ifreq *ifr)
14784 -EFAULT : 0; 14784 -EFAULT : 0;
14785} 14785}
14786 14786
14787/* Configrues HW for PTP */ 14787/* Configures HW for PTP */
14788static int bnx2x_configure_ptp(struct bnx2x *bp) 14788static int bnx2x_configure_ptp(struct bnx2x *bp)
14789{ 14789{
14790 int rc, port = BP_PORT(bp); 14790 int rc, port = BP_PORT(bp);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
index b0779d773343..6fe547c93e74 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
@@ -7549,7 +7549,7 @@ Theotherbitsarereservedandshouldbezero*/
7549#define IGU_REG_SISR_MDPC_WOMASK_UPPER 0x05a6 7549#define IGU_REG_SISR_MDPC_WOMASK_UPPER 0x05a6
7550 7550
7551#define IGU_REG_RESERVED_UPPER 0x05ff 7551#define IGU_REG_RESERVED_UPPER 0x05ff
7552/* Fields of IGU PF CONFIGRATION REGISTER */ 7552/* Fields of IGU PF CONFIGURATION REGISTER */
7553#define IGU_PF_CONF_FUNC_EN (0x1<<0) /* function enable */ 7553#define IGU_PF_CONF_FUNC_EN (0x1<<0) /* function enable */
7554#define IGU_PF_CONF_MSI_MSIX_EN (0x1<<1) /* MSI/MSIX enable */ 7554#define IGU_PF_CONF_MSI_MSIX_EN (0x1<<1) /* MSI/MSIX enable */
7555#define IGU_PF_CONF_INT_LINE_EN (0x1<<2) /* INT enable */ 7555#define IGU_PF_CONF_INT_LINE_EN (0x1<<2) /* INT enable */
@@ -7557,7 +7557,7 @@ Theotherbitsarereservedandshouldbezero*/
7557#define IGU_PF_CONF_SINGLE_ISR_EN (0x1<<4) /* single ISR mode enable */ 7557#define IGU_PF_CONF_SINGLE_ISR_EN (0x1<<4) /* single ISR mode enable */
7558#define IGU_PF_CONF_SIMD_MODE (0x1<<5) /* simd all ones mode */ 7558#define IGU_PF_CONF_SIMD_MODE (0x1<<5) /* simd all ones mode */
7559 7559
7560/* Fields of IGU VF CONFIGRATION REGISTER */ 7560/* Fields of IGU VF CONFIGURATION REGISTER */
7561#define IGU_VF_CONF_FUNC_EN (0x1<<0) /* function enable */ 7561#define IGU_VF_CONF_FUNC_EN (0x1<<0) /* function enable */
7562#define IGU_VF_CONF_MSI_MSIX_EN (0x1<<1) /* MSI/MSIX enable */ 7562#define IGU_VF_CONF_MSI_MSIX_EN (0x1<<1) /* MSI/MSIX enable */
7563#define IGU_VF_CONF_PARENT_MASK (0x3<<2) /* Parent PF */ 7563#define IGU_VF_CONF_PARENT_MASK (0x3<<2) /* Parent PF */
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 06dea3dd463c..3767271c7667 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -2160,7 +2160,7 @@ static int __init macb_probe(struct platform_device *pdev)
2160 int err = -ENXIO; 2160 int err = -ENXIO;
2161 const char *mac; 2161 const char *mac;
2162 void __iomem *mem; 2162 void __iomem *mem;
2163 unsigned int hw_q, queue_mask, q, num_queues, q_irq = 0; 2163 unsigned int hw_q, queue_mask, q, num_queues;
2164 struct clk *pclk, *hclk, *tx_clk; 2164 struct clk *pclk, *hclk, *tx_clk;
2165 2165
2166 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2166 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2235,11 +2235,11 @@ static int __init macb_probe(struct platform_device *pdev)
2235 * register mapping but we don't want to test the queue index then 2235 * register mapping but we don't want to test the queue index then
2236 * compute the corresponding register offset at run time. 2236 * compute the corresponding register offset at run time.
2237 */ 2237 */
2238 for (hw_q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) { 2238 for (hw_q = 0, q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) {
2239 if (!(queue_mask & (1 << hw_q))) 2239 if (!(queue_mask & (1 << hw_q)))
2240 continue; 2240 continue;
2241 2241
2242 queue = &bp->queues[q_irq]; 2242 queue = &bp->queues[q];
2243 queue->bp = bp; 2243 queue->bp = bp;
2244 if (hw_q) { 2244 if (hw_q) {
2245 queue->ISR = GEM_ISR(hw_q - 1); 2245 queue->ISR = GEM_ISR(hw_q - 1);
@@ -2261,18 +2261,18 @@ static int __init macb_probe(struct platform_device *pdev)
2261 * must remove the optional gaps that could exist in the 2261 * must remove the optional gaps that could exist in the
2262 * hardware queue mask. 2262 * hardware queue mask.
2263 */ 2263 */
2264 queue->irq = platform_get_irq(pdev, q_irq); 2264 queue->irq = platform_get_irq(pdev, q);
2265 err = devm_request_irq(&pdev->dev, queue->irq, macb_interrupt, 2265 err = devm_request_irq(&pdev->dev, queue->irq, macb_interrupt,
2266 0, dev->name, queue); 2266 0, dev->name, queue);
2267 if (err) { 2267 if (err) {
2268 dev_err(&pdev->dev, 2268 dev_err(&pdev->dev,
2269 "Unable to request IRQ %d (error %d)\n", 2269 "Unable to request IRQ %d (error %d)\n",
2270 queue->irq, err); 2270 queue->irq, err);
2271 goto err_out_free_irq; 2271 goto err_out_free_netdev;
2272 } 2272 }
2273 2273
2274 INIT_WORK(&queue->tx_error_task, macb_tx_error_task); 2274 INIT_WORK(&queue->tx_error_task, macb_tx_error_task);
2275 q_irq++; 2275 q++;
2276 } 2276 }
2277 dev->irq = bp->queues[0].irq; 2277 dev->irq = bp->queues[0].irq;
2278 2278
@@ -2350,7 +2350,7 @@ static int __init macb_probe(struct platform_device *pdev)
2350 err = register_netdev(dev); 2350 err = register_netdev(dev);
2351 if (err) { 2351 if (err) {
2352 dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); 2352 dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
2353 goto err_out_free_irq; 2353 goto err_out_free_netdev;
2354 } 2354 }
2355 2355
2356 err = macb_mii_init(bp); 2356 err = macb_mii_init(bp);
@@ -2373,9 +2373,7 @@ static int __init macb_probe(struct platform_device *pdev)
2373 2373
2374err_out_unregister_netdev: 2374err_out_unregister_netdev:
2375 unregister_netdev(dev); 2375 unregister_netdev(dev);
2376err_out_free_irq: 2376err_out_free_netdev:
2377 for (q = 0, queue = bp->queues; q < q_irq; ++q, ++queue)
2378 devm_free_irq(&pdev->dev, queue->irq, queue);
2379 free_netdev(dev); 2377 free_netdev(dev);
2380err_out_disable_clocks: 2378err_out_disable_clocks:
2381 if (!IS_ERR(tx_clk)) 2379 if (!IS_ERR(tx_clk))
@@ -2392,8 +2390,6 @@ static int __exit macb_remove(struct platform_device *pdev)
2392{ 2390{
2393 struct net_device *dev; 2391 struct net_device *dev;
2394 struct macb *bp; 2392 struct macb *bp;
2395 struct macb_queue *queue;
2396 unsigned int q;
2397 2393
2398 dev = platform_get_drvdata(pdev); 2394 dev = platform_get_drvdata(pdev);
2399 2395
@@ -2405,14 +2401,11 @@ static int __exit macb_remove(struct platform_device *pdev)
2405 kfree(bp->mii_bus->irq); 2401 kfree(bp->mii_bus->irq);
2406 mdiobus_free(bp->mii_bus); 2402 mdiobus_free(bp->mii_bus);
2407 unregister_netdev(dev); 2403 unregister_netdev(dev);
2408 queue = bp->queues;
2409 for (q = 0; q < bp->num_queues; ++q, ++queue)
2410 devm_free_irq(&pdev->dev, queue->irq, queue);
2411 free_netdev(dev);
2412 if (!IS_ERR(bp->tx_clk)) 2404 if (!IS_ERR(bp->tx_clk))
2413 clk_disable_unprepare(bp->tx_clk); 2405 clk_disable_unprepare(bp->tx_clk);
2414 clk_disable_unprepare(bp->hclk); 2406 clk_disable_unprepare(bp->hclk);
2415 clk_disable_unprepare(bp->pclk); 2407 clk_disable_unprepare(bp->pclk);
2408 free_netdev(dev);
2416 } 2409 }
2417 2410
2418 return 0; 2411 return 0;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 28d04153f999..c132d9030729 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -2376,7 +2376,7 @@ const char *t4_get_port_type_description(enum fw_port_type port_type)
2376 "KR/KX", 2376 "KR/KX",
2377 "KR/KX/KX4", 2377 "KR/KX/KX4",
2378 "R QSFP_10G", 2378 "R QSFP_10G",
2379 "", 2379 "R QSA",
2380 "R QSFP", 2380 "R QSFP",
2381 "R BP40_BA", 2381 "R BP40_BA",
2382 }; 2382 };
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
index 291b6f219708..7c0aec85137a 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
@@ -2470,8 +2470,8 @@ enum fw_port_type {
2470 FW_PORT_TYPE_BP_AP, 2470 FW_PORT_TYPE_BP_AP,
2471 FW_PORT_TYPE_BP4_AP, 2471 FW_PORT_TYPE_BP4_AP,
2472 FW_PORT_TYPE_QSFP_10G, 2472 FW_PORT_TYPE_QSFP_10G,
2473 FW_PORT_TYPE_QSFP,
2474 FW_PORT_TYPE_QSA, 2473 FW_PORT_TYPE_QSA,
2474 FW_PORT_TYPE_QSFP,
2475 FW_PORT_TYPE_BP40_BA, 2475 FW_PORT_TYPE_BP40_BA,
2476 2476
2477 FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_M 2477 FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_M
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
index b2427928eb11..d1c025fd9726 100644
--- a/drivers/net/ethernet/cirrus/cs89x0.c
+++ b/drivers/net/ethernet/cirrus/cs89x0.c
@@ -60,6 +60,7 @@
60#include <linux/interrupt.h> 60#include <linux/interrupt.h>
61#include <linux/ioport.h> 61#include <linux/ioport.h>
62#include <linux/in.h> 62#include <linux/in.h>
63#include <linux/jiffies.h>
63#include <linux/skbuff.h> 64#include <linux/skbuff.h>
64#include <linux/spinlock.h> 65#include <linux/spinlock.h>
65#include <linux/string.h> 66#include <linux/string.h>
@@ -238,13 +239,13 @@ writereg(struct net_device *dev, u16 regno, u16 value)
238static int __init 239static int __init
239wait_eeprom_ready(struct net_device *dev) 240wait_eeprom_ready(struct net_device *dev)
240{ 241{
241 int timeout = jiffies; 242 unsigned long timeout = jiffies;
242 /* check to see if the EEPROM is ready, 243 /* check to see if the EEPROM is ready,
243 * a timeout is used just in case EEPROM is ready when 244 * a timeout is used just in case EEPROM is ready when
244 * SI_BUSY in the PP_SelfST is clear 245 * SI_BUSY in the PP_SelfST is clear
245 */ 246 */
246 while (readreg(dev, PP_SelfST) & SI_BUSY) 247 while (readreg(dev, PP_SelfST) & SI_BUSY)
247 if (jiffies - timeout >= 40) 248 if (time_after_eq(jiffies, timeout + 40))
248 return -1; 249 return -1;
249 return 0; 250 return 0;
250} 251}
@@ -485,7 +486,7 @@ control_dc_dc(struct net_device *dev, int on_not_off)
485{ 486{
486 struct net_local *lp = netdev_priv(dev); 487 struct net_local *lp = netdev_priv(dev);
487 unsigned int selfcontrol; 488 unsigned int selfcontrol;
488 int timenow = jiffies; 489 unsigned long timenow = jiffies;
489 /* control the DC to DC convertor in the SelfControl register. 490 /* control the DC to DC convertor in the SelfControl register.
490 * Note: This is hooked up to a general purpose pin, might not 491 * Note: This is hooked up to a general purpose pin, might not
491 * always be a DC to DC convertor. 492 * always be a DC to DC convertor.
@@ -499,7 +500,7 @@ control_dc_dc(struct net_device *dev, int on_not_off)
499 writereg(dev, PP_SelfCTL, selfcontrol); 500 writereg(dev, PP_SelfCTL, selfcontrol);
500 501
501 /* Wait for the DC/DC converter to power up - 500ms */ 502 /* Wait for the DC/DC converter to power up - 500ms */
502 while (jiffies - timenow < HZ) 503 while (time_before(jiffies, timenow + HZ))
503 ; 504 ;
504} 505}
505 506
@@ -514,7 +515,7 @@ send_test_pkt(struct net_device *dev)
514 0, 0, /* DSAP=0 & SSAP=0 fields */ 515 0, 0, /* DSAP=0 & SSAP=0 fields */
515 0xf3, 0 /* Control (Test Req + P bit set) */ 516 0xf3, 0 /* Control (Test Req + P bit set) */
516 }; 517 };
517 long timenow = jiffies; 518 unsigned long timenow = jiffies;
518 519
519 writereg(dev, PP_LineCTL, readreg(dev, PP_LineCTL) | SERIAL_TX_ON); 520 writereg(dev, PP_LineCTL, readreg(dev, PP_LineCTL) | SERIAL_TX_ON);
520 521
@@ -525,10 +526,10 @@ send_test_pkt(struct net_device *dev)
525 iowrite16(ETH_ZLEN, lp->virt_addr + TX_LEN_PORT); 526 iowrite16(ETH_ZLEN, lp->virt_addr + TX_LEN_PORT);
526 527
527 /* Test to see if the chip has allocated memory for the packet */ 528 /* Test to see if the chip has allocated memory for the packet */
528 while (jiffies - timenow < 5) 529 while (time_before(jiffies, timenow + 5))
529 if (readreg(dev, PP_BusST) & READY_FOR_TX_NOW) 530 if (readreg(dev, PP_BusST) & READY_FOR_TX_NOW)
530 break; 531 break;
531 if (jiffies - timenow >= 5) 532 if (time_after_eq(jiffies, timenow + 5))
532 return 0; /* this shouldn't happen */ 533 return 0; /* this shouldn't happen */
533 534
534 /* Write the contents of the packet */ 535 /* Write the contents of the packet */
@@ -536,7 +537,7 @@ send_test_pkt(struct net_device *dev)
536 537
537 cs89_dbg(1, debug, "Sending test packet "); 538 cs89_dbg(1, debug, "Sending test packet ");
538 /* wait a couple of jiffies for packet to be received */ 539 /* wait a couple of jiffies for packet to be received */
539 for (timenow = jiffies; jiffies - timenow < 3;) 540 for (timenow = jiffies; time_before(jiffies, timenow + 3);)
540 ; 541 ;
541 if ((readreg(dev, PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK) { 542 if ((readreg(dev, PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK) {
542 cs89_dbg(1, cont, "succeeded\n"); 543 cs89_dbg(1, cont, "succeeded\n");
@@ -556,7 +557,7 @@ static int
556detect_tp(struct net_device *dev) 557detect_tp(struct net_device *dev)
557{ 558{
558 struct net_local *lp = netdev_priv(dev); 559 struct net_local *lp = netdev_priv(dev);
559 int timenow = jiffies; 560 unsigned long timenow = jiffies;
560 int fdx; 561 int fdx;
561 562
562 cs89_dbg(1, debug, "%s: Attempting TP\n", dev->name); 563 cs89_dbg(1, debug, "%s: Attempting TP\n", dev->name);
@@ -574,7 +575,7 @@ detect_tp(struct net_device *dev)
574 /* Delay for the hardware to work out if the TP cable is present 575 /* Delay for the hardware to work out if the TP cable is present
575 * - 150ms 576 * - 150ms
576 */ 577 */
577 for (timenow = jiffies; jiffies - timenow < 15;) 578 for (timenow = jiffies; time_before(jiffies, timenow + 15);)
578 ; 579 ;
579 if ((readreg(dev, PP_LineST) & LINK_OK) == 0) 580 if ((readreg(dev, PP_LineST) & LINK_OK) == 0)
580 return DETECTED_NONE; 581 return DETECTED_NONE;
@@ -618,7 +619,7 @@ detect_tp(struct net_device *dev)
618 if ((lp->auto_neg_cnf & AUTO_NEG_BITS) == AUTO_NEG_ENABLE) { 619 if ((lp->auto_neg_cnf & AUTO_NEG_BITS) == AUTO_NEG_ENABLE) {
619 pr_info("%s: negotiating duplex...\n", dev->name); 620 pr_info("%s: negotiating duplex...\n", dev->name);
620 while (readreg(dev, PP_AutoNegST) & AUTO_NEG_BUSY) { 621 while (readreg(dev, PP_AutoNegST) & AUTO_NEG_BUSY) {
621 if (jiffies - timenow > 4000) { 622 if (time_after(jiffies, timenow + 4000)) {
622 pr_err("**** Full / half duplex auto-negotiation timed out ****\n"); 623 pr_err("**** Full / half duplex auto-negotiation timed out ****\n");
623 break; 624 break;
624 } 625 }
@@ -1271,7 +1272,7 @@ static void __init reset_chip(struct net_device *dev)
1271{ 1272{
1272#if !defined(CONFIG_MACH_MX31ADS) 1273#if !defined(CONFIG_MACH_MX31ADS)
1273 struct net_local *lp = netdev_priv(dev); 1274 struct net_local *lp = netdev_priv(dev);
1274 int reset_start_time; 1275 unsigned long reset_start_time;
1275 1276
1276 writereg(dev, PP_SelfCTL, readreg(dev, PP_SelfCTL) | POWER_ON_RESET); 1277 writereg(dev, PP_SelfCTL, readreg(dev, PP_SelfCTL) | POWER_ON_RESET);
1277 1278
@@ -1294,7 +1295,7 @@ static void __init reset_chip(struct net_device *dev)
1294 /* Wait until the chip is reset */ 1295 /* Wait until the chip is reset */
1295 reset_start_time = jiffies; 1296 reset_start_time = jiffies;
1296 while ((readreg(dev, PP_SelfST) & INIT_DONE) == 0 && 1297 while ((readreg(dev, PP_SelfST) & INIT_DONE) == 0 &&
1297 jiffies - reset_start_time < 2) 1298 time_before(jiffies, reset_start_time + 2))
1298 ; 1299 ;
1299#endif /* !CONFIG_MACH_MX31ADS */ 1300#endif /* !CONFIG_MACH_MX31ADS */
1300} 1301}
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 2aacd4731051..196073110e32 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3138,6 +3138,7 @@ static void be_disable_vxlan_offloads(struct be_adapter *adapter)
3138 3138
3139 netdev->hw_enc_features = 0; 3139 netdev->hw_enc_features = 0;
3140 netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL); 3140 netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL);
3141 netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL);
3141} 3142}
3142#endif 3143#endif
3143 3144
@@ -4429,6 +4430,7 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family,
4429 NETIF_F_TSO | NETIF_F_TSO6 | 4430 NETIF_F_TSO | NETIF_F_TSO6 |
4430 NETIF_F_GSO_UDP_TUNNEL; 4431 NETIF_F_GSO_UDP_TUNNEL;
4431 netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; 4432 netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
4433 netdev->features |= NETIF_F_GSO_UDP_TUNNEL;
4432 4434
4433 dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n", 4435 dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n",
4434 be16_to_cpu(port)); 4436 be16_to_cpu(port));
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ebf76c496e7a..5ebdf8dc8a31 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1558,20 +1558,21 @@ fec_enet_interrupt(int irq, void *dev_id)
1558{ 1558{
1559 struct net_device *ndev = dev_id; 1559 struct net_device *ndev = dev_id;
1560 struct fec_enet_private *fep = netdev_priv(ndev); 1560 struct fec_enet_private *fep = netdev_priv(ndev);
1561 const unsigned napi_mask = FEC_ENET_RXF | FEC_ENET_TXF;
1562 uint int_events; 1561 uint int_events;
1563 irqreturn_t ret = IRQ_NONE; 1562 irqreturn_t ret = IRQ_NONE;
1564 1563
1565 int_events = readl(fep->hwp + FEC_IEVENT); 1564 int_events = readl(fep->hwp + FEC_IEVENT);
1566 writel(int_events & ~napi_mask, fep->hwp + FEC_IEVENT); 1565 writel(int_events, fep->hwp + FEC_IEVENT);
1567 fec_enet_collect_events(fep, int_events); 1566 fec_enet_collect_events(fep, int_events);
1568 1567
1569 if (int_events & napi_mask) { 1568 if (fep->work_tx || fep->work_rx) {
1570 ret = IRQ_HANDLED; 1569 ret = IRQ_HANDLED;
1571 1570
1572 /* Disable the NAPI interrupts */ 1571 if (napi_schedule_prep(&fep->napi)) {
1573 writel(FEC_ENET_MII, fep->hwp + FEC_IMASK); 1572 /* Disable the NAPI interrupts */
1574 napi_schedule(&fep->napi); 1573 writel(FEC_ENET_MII, fep->hwp + FEC_IMASK);
1574 __napi_schedule(&fep->napi);
1575 }
1575 } 1576 }
1576 1577
1577 if (int_events & FEC_ENET_MII) { 1578 if (int_events & FEC_ENET_MII) {
@@ -1591,12 +1592,6 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
1591 struct fec_enet_private *fep = netdev_priv(ndev); 1592 struct fec_enet_private *fep = netdev_priv(ndev);
1592 int pkts; 1593 int pkts;
1593 1594
1594 /*
1595 * Clear any pending transmit or receive interrupts before
1596 * processing the rings to avoid racing with the hardware.
1597 */
1598 writel(FEC_ENET_RXF | FEC_ENET_TXF, fep->hwp + FEC_IEVENT);
1599
1600 pkts = fec_enet_rx(ndev, budget); 1595 pkts = fec_enet_rx(ndev, budget);
1601 1596
1602 fec_enet_tx(ndev); 1597 fec_enet_tx(ndev);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 0a7ea4c5f9d3..a5f2660d552d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7549,6 +7549,11 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
7549 if (!(pf->flags & I40E_FLAG_SRIOV_ENABLED)) 7549 if (!(pf->flags & I40E_FLAG_SRIOV_ENABLED))
7550 return -EOPNOTSUPP; 7550 return -EOPNOTSUPP;
7551 7551
7552 if (vid) {
7553 pr_info("%s: vlans aren't supported yet for dev_uc|mc_add()\n", dev->name);
7554 return -EINVAL;
7555 }
7556
7552 /* Hardware does not support aging addresses so if a 7557 /* Hardware does not support aging addresses so if a
7553 * ndm_state is given only allow permanent addresses 7558 * ndm_state is given only allow permanent addresses
7554 */ 7559 */
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 6ff214de1111..190cbd931f6b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1569,8 +1569,15 @@ int mlx4_en_start_port(struct net_device *dev)
1569 mlx4_en_free_affinity_hint(priv, i); 1569 mlx4_en_free_affinity_hint(priv, i);
1570 goto cq_err; 1570 goto cq_err;
1571 } 1571 }
1572 for (j = 0; j < cq->size; j++) 1572
1573 cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK; 1573 for (j = 0; j < cq->size; j++) {
1574 struct mlx4_cqe *cqe = NULL;
1575
1576 cqe = mlx4_en_get_cqe(cq->buf, j, priv->cqe_size) +
1577 priv->cqe_factor;
1578 cqe->owner_sr_opcode = MLX4_CQE_OWNER_MASK;
1579 }
1580
1574 err = mlx4_en_set_cq_moder(priv, cq); 1581 err = mlx4_en_set_cq_moder(priv, cq);
1575 if (err) { 1582 if (err) {
1576 en_err(priv, "Failed setting cq moderation parameters\n"); 1583 en_err(priv, "Failed setting cq moderation parameters\n");
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index ef3b95bac2ad..982861d1df44 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -787,11 +787,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
787 if ((1 << (field & 0x3f)) > (PAGE_SIZE / dev_cap->bf_reg_size)) 787 if ((1 << (field & 0x3f)) > (PAGE_SIZE / dev_cap->bf_reg_size))
788 field = 3; 788 field = 3;
789 dev_cap->bf_regs_per_page = 1 << (field & 0x3f); 789 dev_cap->bf_regs_per_page = 1 << (field & 0x3f);
790 mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n",
791 dev_cap->bf_reg_size, dev_cap->bf_regs_per_page);
792 } else { 790 } else {
793 dev_cap->bf_reg_size = 0; 791 dev_cap->bf_reg_size = 0;
794 mlx4_dbg(dev, "BlueFlame not available\n");
795 } 792 }
796 793
797 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_SG_SQ_OFFSET); 794 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_SG_SQ_OFFSET);
@@ -902,9 +899,6 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
902 goto out; 899 goto out;
903 } 900 }
904 901
905 mlx4_dbg(dev, "Base MM extensions: flags %08x, rsvd L_Key %08x\n",
906 dev_cap->bmme_flags, dev_cap->reserved_lkey);
907
908 /* 902 /*
909 * Each UAR has 4 EQ doorbells; so if a UAR is reserved, then 903 * Each UAR has 4 EQ doorbells; so if a UAR is reserved, then
910 * we can't use any EQs whose doorbell falls on that page, 904 * we can't use any EQs whose doorbell falls on that page,
@@ -916,6 +910,21 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
916 else 910 else
917 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_SYS_EQS; 911 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_SYS_EQS;
918 912
913out:
914 mlx4_free_cmd_mailbox(dev, mailbox);
915 return err;
916}
917
918void mlx4_dev_cap_dump(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
919{
920 if (dev_cap->bf_reg_size > 0)
921 mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n",
922 dev_cap->bf_reg_size, dev_cap->bf_regs_per_page);
923 else
924 mlx4_dbg(dev, "BlueFlame not available\n");
925
926 mlx4_dbg(dev, "Base MM extensions: flags %08x, rsvd L_Key %08x\n",
927 dev_cap->bmme_flags, dev_cap->reserved_lkey);
919 mlx4_dbg(dev, "Max ICM size %lld MB\n", 928 mlx4_dbg(dev, "Max ICM size %lld MB\n",
920 (unsigned long long) dev_cap->max_icm_sz >> 20); 929 (unsigned long long) dev_cap->max_icm_sz >> 20);
921 mlx4_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n", 930 mlx4_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n",
@@ -949,13 +958,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
949 dev_cap->dmfs_high_rate_qpn_base); 958 dev_cap->dmfs_high_rate_qpn_base);
950 mlx4_dbg(dev, "DMFS high rate steer QPn range: %d\n", 959 mlx4_dbg(dev, "DMFS high rate steer QPn range: %d\n",
951 dev_cap->dmfs_high_rate_qpn_range); 960 dev_cap->dmfs_high_rate_qpn_range);
952
953 dump_dev_cap_flags(dev, dev_cap->flags); 961 dump_dev_cap_flags(dev, dev_cap->flags);
954 dump_dev_cap_flags2(dev, dev_cap->flags2); 962 dump_dev_cap_flags2(dev, dev_cap->flags2);
955
956out:
957 mlx4_free_cmd_mailbox(dev, mailbox);
958 return err;
959} 963}
960 964
961int mlx4_QUERY_PORT(struct mlx4_dev *dev, int port, struct mlx4_port_cap *port_cap) 965int mlx4_QUERY_PORT(struct mlx4_dev *dev, int port, struct mlx4_port_cap *port_cap)
@@ -1848,8 +1852,8 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev,
1848 /* CX3 is capable of extending CQEs\EQEs to strides larger than 64B */ 1852 /* CX3 is capable of extending CQEs\EQEs to strides larger than 64B */
1849 MLX4_GET(byte_field, outbox, INIT_HCA_EQE_CQE_STRIDE_OFFSET); 1853 MLX4_GET(byte_field, outbox, INIT_HCA_EQE_CQE_STRIDE_OFFSET);
1850 if (byte_field) { 1854 if (byte_field) {
1851 param->dev_cap_enabled |= MLX4_DEV_CAP_64B_EQE_ENABLED; 1855 param->dev_cap_enabled |= MLX4_DEV_CAP_EQE_STRIDE_ENABLED;
1852 param->dev_cap_enabled |= MLX4_DEV_CAP_64B_CQE_ENABLED; 1856 param->dev_cap_enabled |= MLX4_DEV_CAP_CQE_STRIDE_ENABLED;
1853 param->cqe_size = 1 << ((byte_field & 1857 param->cqe_size = 1 << ((byte_field &
1854 MLX4_CQE_SIZE_MASK_STRIDE) + 5); 1858 MLX4_CQE_SIZE_MASK_STRIDE) + 5);
1855 param->eqe_size = 1 << (((byte_field & 1859 param->eqe_size = 1 << (((byte_field &
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h
index 794e2826609a..62562b60fa87 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.h
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.h
@@ -224,6 +224,7 @@ struct mlx4_set_ib_param {
224 u32 cap_mask; 224 u32 cap_mask;
225}; 225};
226 226
227void mlx4_dev_cap_dump(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap);
227int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap); 228int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap);
228int mlx4_QUERY_PORT(struct mlx4_dev *dev, int port, struct mlx4_port_cap *port_cap); 229int mlx4_QUERY_PORT(struct mlx4_dev *dev, int port, struct mlx4_port_cap *port_cap);
229int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, u8 gen_or_port, 230int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, u8 gen_or_port,
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index e25436b24ce7..b935bf3d0bb3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -305,6 +305,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
305 mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n"); 305 mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n");
306 return err; 306 return err;
307 } 307 }
308 mlx4_dev_cap_dump(dev, dev_cap);
308 309
309 if (dev_cap->min_page_sz > PAGE_SIZE) { 310 if (dev_cap->min_page_sz > PAGE_SIZE) {
310 mlx4_err(dev, "HCA minimum page size of %d bigger than kernel PAGE_SIZE of %ld, aborting\n", 311 mlx4_err(dev, "HCA minimum page size of %d bigger than kernel PAGE_SIZE of %ld, aborting\n",
@@ -2488,41 +2489,42 @@ static u64 mlx4_enable_sriov(struct mlx4_dev *dev, struct pci_dev *pdev,
2488 u8 total_vfs, int existing_vfs) 2489 u8 total_vfs, int existing_vfs)
2489{ 2490{
2490 u64 dev_flags = dev->flags; 2491 u64 dev_flags = dev->flags;
2492 int err = 0;
2491 2493
2492 dev->dev_vfs = kzalloc( 2494 atomic_inc(&pf_loading);
2493 total_vfs * sizeof(*dev->dev_vfs), 2495 if (dev->flags & MLX4_FLAG_SRIOV) {
2494 GFP_KERNEL); 2496 if (existing_vfs != total_vfs) {
2497 mlx4_err(dev, "SR-IOV was already enabled, but with num_vfs (%d) different than requested (%d)\n",
2498 existing_vfs, total_vfs);
2499 total_vfs = existing_vfs;
2500 }
2501 }
2502
2503 dev->dev_vfs = kzalloc(total_vfs * sizeof(*dev->dev_vfs), GFP_KERNEL);
2495 if (NULL == dev->dev_vfs) { 2504 if (NULL == dev->dev_vfs) {
2496 mlx4_err(dev, "Failed to allocate memory for VFs\n"); 2505 mlx4_err(dev, "Failed to allocate memory for VFs\n");
2497 goto disable_sriov; 2506 goto disable_sriov;
2498 } else if (!(dev->flags & MLX4_FLAG_SRIOV)) { 2507 }
2499 int err = 0; 2508
2500 2509 if (!(dev->flags & MLX4_FLAG_SRIOV)) {
2501 atomic_inc(&pf_loading); 2510 mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", total_vfs);
2502 if (existing_vfs) { 2511 err = pci_enable_sriov(pdev, total_vfs);
2503 if (existing_vfs != total_vfs) 2512 }
2504 mlx4_err(dev, "SR-IOV was already enabled, but with num_vfs (%d) different than requested (%d)\n", 2513 if (err) {
2505 existing_vfs, total_vfs); 2514 mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d)\n",
2506 } else { 2515 err);
2507 mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", total_vfs); 2516 goto disable_sriov;
2508 err = pci_enable_sriov(pdev, total_vfs); 2517 } else {
2509 } 2518 mlx4_warn(dev, "Running in master mode\n");
2510 if (err) { 2519 dev_flags |= MLX4_FLAG_SRIOV |
2511 mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d)\n", 2520 MLX4_FLAG_MASTER;
2512 err); 2521 dev_flags &= ~MLX4_FLAG_SLAVE;
2513 atomic_dec(&pf_loading); 2522 dev->num_vfs = total_vfs;
2514 goto disable_sriov;
2515 } else {
2516 mlx4_warn(dev, "Running in master mode\n");
2517 dev_flags |= MLX4_FLAG_SRIOV |
2518 MLX4_FLAG_MASTER;
2519 dev_flags &= ~MLX4_FLAG_SLAVE;
2520 dev->num_vfs = total_vfs;
2521 }
2522 } 2523 }
2523 return dev_flags; 2524 return dev_flags;
2524 2525
2525disable_sriov: 2526disable_sriov:
2527 atomic_dec(&pf_loading);
2526 dev->num_vfs = 0; 2528 dev->num_vfs = 0;
2527 kfree(dev->dev_vfs); 2529 kfree(dev->dev_vfs);
2528 return dev_flags & ~MLX4_FLAG_MASTER; 2530 return dev_flags & ~MLX4_FLAG_MASTER;
@@ -2606,8 +2608,10 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
2606 } 2608 }
2607 2609
2608 if (total_vfs) { 2610 if (total_vfs) {
2609 existing_vfs = pci_num_vf(pdev);
2610 dev->flags = MLX4_FLAG_MASTER; 2611 dev->flags = MLX4_FLAG_MASTER;
2612 existing_vfs = pci_num_vf(pdev);
2613 if (existing_vfs)
2614 dev->flags |= MLX4_FLAG_SRIOV;
2611 dev->num_vfs = total_vfs; 2615 dev->num_vfs = total_vfs;
2612 } 2616 }
2613 } 2617 }
@@ -2643,6 +2647,7 @@ slave_start:
2643 } 2647 }
2644 2648
2645 if (mlx4_is_master(dev)) { 2649 if (mlx4_is_master(dev)) {
2650 /* when we hit the goto slave_start below, dev_cap already initialized */
2646 if (!dev_cap) { 2651 if (!dev_cap) {
2647 dev_cap = kzalloc(sizeof(*dev_cap), GFP_KERNEL); 2652 dev_cap = kzalloc(sizeof(*dev_cap), GFP_KERNEL);
2648 2653
@@ -2849,6 +2854,7 @@ slave_start:
2849 if (mlx4_is_master(dev) && dev->num_vfs) 2854 if (mlx4_is_master(dev) && dev->num_vfs)
2850 atomic_dec(&pf_loading); 2855 atomic_dec(&pf_loading);
2851 2856
2857 kfree(dev_cap);
2852 return 0; 2858 return 0;
2853 2859
2854err_port: 2860err_port:
diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig
index 627926800ff3..9468e64e6007 100644
--- a/drivers/net/ethernet/smsc/Kconfig
+++ b/drivers/net/ethernet/smsc/Kconfig
@@ -39,7 +39,7 @@ config SMC91X
39 select CRC32 39 select CRC32
40 select MII 40 select MII
41 depends on (ARM || M32R || SUPERH || MIPS || BLACKFIN || \ 41 depends on (ARM || M32R || SUPERH || MIPS || BLACKFIN || \
42 MN10300 || COLDFIRE || ARM64 || XTENSA || NIOS2) 42 MN10300 || COLDFIRE || ARM64 || XTENSA || NIOS2) && (!OF || GPIOLIB)
43 ---help--- 43 ---help---
44 This is a driver for SMC's 91x series of Ethernet chipsets, 44 This is a driver for SMC's 91x series of Ethernet chipsets,
45 including the SMC91C94 and the SMC91C111. Say Y if you want it 45 including the SMC91C94 and the SMC91C111. Say Y if you want it
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index 0e137751e76e..056b358b4a72 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -309,16 +309,16 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
309 309
310 if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) { 310 if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) {
311 const char *rs; 311 const char *rs;
312 dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
313 312
314 err = of_property_read_string(np, "st,tx-retime-src", &rs); 313 err = of_property_read_string(np, "st,tx-retime-src", &rs);
315 if (err < 0) 314 if (err < 0) {
316 dev_warn(dev, "Use internal clock source\n"); 315 dev_warn(dev, "Use internal clock source\n");
317 316 dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
318 if (!strcasecmp(rs, "clk_125")) 317 } else if (!strcasecmp(rs, "clk_125")) {
319 dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125; 318 dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125;
320 else if (!strcasecmp(rs, "txclk")) 319 } else if (!strcasecmp(rs, "txclk")) {
321 dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK; 320 dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK;
321 }
322 322
323 dwmac->speed = SPEED_1000; 323 dwmac->speed = SPEED_1000;
324 } 324 }
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 60f7ee5fafbe..7df221788cd4 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -46,16 +46,18 @@ struct macvtap_queue {
46 struct list_head next; 46 struct list_head next;
47}; 47};
48 48
49#define MACVTAP_FEATURES (IFF_VNET_HDR | IFF_VNET_LE | IFF_MULTI_QUEUE) 49#define MACVTAP_FEATURES (IFF_VNET_HDR | IFF_MULTI_QUEUE)
50
51#define MACVTAP_VNET_LE 0x80000000
50 52
51static inline u16 macvtap16_to_cpu(struct macvtap_queue *q, __virtio16 val) 53static inline u16 macvtap16_to_cpu(struct macvtap_queue *q, __virtio16 val)
52{ 54{
53 return __virtio16_to_cpu(q->flags & IFF_VNET_LE, val); 55 return __virtio16_to_cpu(q->flags & MACVTAP_VNET_LE, val);
54} 56}
55 57
56static inline __virtio16 cpu_to_macvtap16(struct macvtap_queue *q, u16 val) 58static inline __virtio16 cpu_to_macvtap16(struct macvtap_queue *q, u16 val)
57{ 59{
58 return __cpu_to_virtio16(q->flags & IFF_VNET_LE, val); 60 return __cpu_to_virtio16(q->flags & MACVTAP_VNET_LE, val);
59} 61}
60 62
61static struct proto macvtap_proto = { 63static struct proto macvtap_proto = {
@@ -999,7 +1001,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
999 void __user *argp = (void __user *)arg; 1001 void __user *argp = (void __user *)arg;
1000 struct ifreq __user *ifr = argp; 1002 struct ifreq __user *ifr = argp;
1001 unsigned int __user *up = argp; 1003 unsigned int __user *up = argp;
1002 unsigned int u; 1004 unsigned short u;
1003 int __user *sp = argp; 1005 int __user *sp = argp;
1004 int s; 1006 int s;
1005 int ret; 1007 int ret;
@@ -1014,7 +1016,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
1014 if ((u & ~MACVTAP_FEATURES) != (IFF_NO_PI | IFF_TAP)) 1016 if ((u & ~MACVTAP_FEATURES) != (IFF_NO_PI | IFF_TAP))
1015 ret = -EINVAL; 1017 ret = -EINVAL;
1016 else 1018 else
1017 q->flags = u; 1019 q->flags = (q->flags & ~MACVTAP_FEATURES) | u;
1018 1020
1019 return ret; 1021 return ret;
1020 1022
@@ -1027,8 +1029,9 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
1027 } 1029 }
1028 1030
1029 ret = 0; 1031 ret = 0;
1032 u = q->flags;
1030 if (copy_to_user(&ifr->ifr_name, vlan->dev->name, IFNAMSIZ) || 1033 if (copy_to_user(&ifr->ifr_name, vlan->dev->name, IFNAMSIZ) ||
1031 put_user(q->flags, &ifr->ifr_flags)) 1034 put_user(u, &ifr->ifr_flags))
1032 ret = -EFAULT; 1035 ret = -EFAULT;
1033 macvtap_put_vlan(vlan); 1036 macvtap_put_vlan(vlan);
1034 rtnl_unlock(); 1037 rtnl_unlock();
@@ -1069,6 +1072,21 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
1069 q->vnet_hdr_sz = s; 1072 q->vnet_hdr_sz = s;
1070 return 0; 1073 return 0;
1071 1074
1075 case TUNGETVNETLE:
1076 s = !!(q->flags & MACVTAP_VNET_LE);
1077 if (put_user(s, sp))
1078 return -EFAULT;
1079 return 0;
1080
1081 case TUNSETVNETLE:
1082 if (get_user(s, sp))
1083 return -EFAULT;
1084 if (s)
1085 q->flags |= MACVTAP_VNET_LE;
1086 else
1087 q->flags &= ~MACVTAP_VNET_LE;
1088 return 0;
1089
1072 case TUNSETOFFLOAD: 1090 case TUNSETOFFLOAD:
1073 /* let the user check for future flags */ 1091 /* let the user check for future flags */
1074 if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | 1092 if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index b4b0f804e84c..a3c251b79f38 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -119,8 +119,8 @@ config MICREL_PHY
119 Supports the KSZ9021, VSC8201, KS8001 PHYs. 119 Supports the KSZ9021, VSC8201, KS8001 PHYs.
120 120
121config FIXED_PHY 121config FIXED_PHY
122 bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" 122 tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
123 depends on PHYLIB=y 123 depends on PHYLIB
124 ---help--- 124 ---help---
125 Adds the platform "fixed" MDIO Bus to cover the boards that use 125 Adds the platform "fixed" MDIO Bus to cover the boards that use
126 PHYs that are not connected to the real MDIO bus. 126 PHYs that are not connected to the real MDIO bus.
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index eb3b18b5978b..501ea7699a2d 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -17,7 +17,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o
17obj-$(CONFIG_ICPLUS_PHY) += icplus.o 17obj-$(CONFIG_ICPLUS_PHY) += icplus.o
18obj-$(CONFIG_REALTEK_PHY) += realtek.o 18obj-$(CONFIG_REALTEK_PHY) += realtek.o
19obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o 19obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
20obj-$(CONFIG_FIXED_PHY) += fixed.o 20obj-$(CONFIG_FIXED_PHY) += fixed_phy.o
21obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o 21obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
22obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o 22obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o
23obj-$(CONFIG_NATIONAL_PHY) += national.o 23obj-$(CONFIG_NATIONAL_PHY) += national.o
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed_phy.c
index 3ad0e6e16c39..3ad0e6e16c39 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed_phy.c
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a5cbf67517f0..8c8dc16839a7 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -110,9 +110,11 @@ do { \
110 * overload it to mean fasync when stored there. 110 * overload it to mean fasync when stored there.
111 */ 111 */
112#define TUN_FASYNC IFF_ATTACH_QUEUE 112#define TUN_FASYNC IFF_ATTACH_QUEUE
113/* High bits in flags field are unused. */
114#define TUN_VNET_LE 0x80000000
113 115
114#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \ 116#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \
115 IFF_VNET_LE | IFF_MULTI_QUEUE) 117 IFF_MULTI_QUEUE)
116#define GOODCOPY_LEN 128 118#define GOODCOPY_LEN 128
117 119
118#define FLT_EXACT_COUNT 8 120#define FLT_EXACT_COUNT 8
@@ -208,12 +210,12 @@ struct tun_struct {
208 210
209static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val) 211static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val)
210{ 212{
211 return __virtio16_to_cpu(tun->flags & IFF_VNET_LE, val); 213 return __virtio16_to_cpu(tun->flags & TUN_VNET_LE, val);
212} 214}
213 215
214static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val) 216static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val)
215{ 217{
216 return __cpu_to_virtio16(tun->flags & IFF_VNET_LE, val); 218 return __cpu_to_virtio16(tun->flags & TUN_VNET_LE, val);
217} 219}
218 220
219static inline u32 tun_hashfn(u32 rxhash) 221static inline u32 tun_hashfn(u32 rxhash)
@@ -1843,6 +1845,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
1843 int sndbuf; 1845 int sndbuf;
1844 int vnet_hdr_sz; 1846 int vnet_hdr_sz;
1845 unsigned int ifindex; 1847 unsigned int ifindex;
1848 int le;
1846 int ret; 1849 int ret;
1847 1850
1848 if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) { 1851 if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) {
@@ -2042,6 +2045,23 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
2042 tun->vnet_hdr_sz = vnet_hdr_sz; 2045 tun->vnet_hdr_sz = vnet_hdr_sz;
2043 break; 2046 break;
2044 2047
2048 case TUNGETVNETLE:
2049 le = !!(tun->flags & TUN_VNET_LE);
2050 if (put_user(le, (int __user *)argp))
2051 ret = -EFAULT;
2052 break;
2053
2054 case TUNSETVNETLE:
2055 if (get_user(le, (int __user *)argp)) {
2056 ret = -EFAULT;
2057 break;
2058 }
2059 if (le)
2060 tun->flags |= TUN_VNET_LE;
2061 else
2062 tun->flags &= ~TUN_VNET_LE;
2063 break;
2064
2045 case TUNATTACHFILTER: 2065 case TUNATTACHFILTER:
2046 /* Can be set only for TAPs */ 2066 /* Can be set only for TAPs */
2047 ret = -EINVAL; 2067 ret = -EINVAL;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index a104d7ac3796..eb8584a9c49a 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -316,7 +316,7 @@ static const u16 xmtfifo_sz[][NFIFO] = {
316static const char * const fifo_names[] = { 316static const char * const fifo_names[] = {
317 "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" }; 317 "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
318#else 318#else
319static const char fifo_names[6][0]; 319static const char fifo_names[6][1];
320#endif 320#endif
321 321
322#ifdef DEBUG 322#ifdef DEBUG
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index b6ec51923b20..50033aa7c7d5 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -381,18 +381,15 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
381 381
382 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor); 382 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor);
383 if (res != 0) { 383 if (res != 0) {
384 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 384 printk(KERN_DEBUG "%s failed 1 (%d)\n", __func__, res);
385 "(%d)\n", res);
386 return; 385 return;
387 } 386 }
388 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", 387 printk(KERN_DEBUG "%s: original COR %02x\n", __func__, old_cor);
389 old_cor);
390 388
391 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, 389 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
392 old_cor | COR_SOFT_RESET); 390 old_cor | COR_SOFT_RESET);
393 if (res != 0) { 391 if (res != 0) {
394 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 392 printk(KERN_DEBUG "%s failed 2 (%d)\n", __func__, res);
395 "(%d)\n", res);
396 return; 393 return;
397 } 394 }
398 395
@@ -401,8 +398,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
401 /* Setup Genesis mode */ 398 /* Setup Genesis mode */
402 res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr); 399 res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr);
403 if (res != 0) { 400 if (res != 0) {
404 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 401 printk(KERN_DEBUG "%s failed 3 (%d)\n", __func__, res);
405 "(%d)\n", res);
406 return; 402 return;
407 } 403 }
408 mdelay(10); 404 mdelay(10);
@@ -410,8 +406,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
410 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, 406 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
411 old_cor & ~COR_SOFT_RESET); 407 old_cor & ~COR_SOFT_RESET);
412 if (res != 0) { 408 if (res != 0) {
413 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 409 printk(KERN_DEBUG "%s failed 4 (%d)\n", __func__, res);
414 "(%d)\n", res);
415 return; 410 return;
416 } 411 }
417 412
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
index d2ec5160bbf0..5c646d5f7bb8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
@@ -955,6 +955,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
955 local_save_flags(flags); 955 local_save_flags(flags);
956 local_irq_enable(); 956 local_irq_enable();
957 957
958 rtlhal->fw_ready = false;
958 rtlpriv->intf_ops->disable_aspm(hw); 959 rtlpriv->intf_ops->disable_aspm(hw);
959 rtstatus = _rtl92ce_init_mac(hw); 960 rtstatus = _rtl92ce_init_mac(hw);
960 if (!rtstatus) { 961 if (!rtstatus) {
@@ -971,6 +972,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
971 goto exit; 972 goto exit;
972 } 973 }
973 974
975 rtlhal->fw_ready = true;
974 rtlhal->last_hmeboxnum = 0; 976 rtlhal->last_hmeboxnum = 0;
975 rtl92c_phy_mac_config(hw); 977 rtl92c_phy_mac_config(hw);
976 /* because last function modify RCR, so we update 978 /* because last function modify RCR, so we update
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index 873363acbacf..551321728ae0 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -1592,7 +1592,7 @@ void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1592 } 1592 }
1593} 1593}
1594 1594
1595bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb) 1595static bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
1596{ 1596{
1597 /* Currently nothing happens here. 1597 /* Currently nothing happens here.
1598 * Traffic stops after some seconds in WPA2 802.11n mode. 1598 * Traffic stops after some seconds in WPA2 802.11n mode.
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c b/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c
index 9be106109921..ba30b0d250fd 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c
@@ -2078,8 +2078,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw,
2078 if (rtldm->tx_rate != 0xFF) 2078 if (rtldm->tx_rate != 0xFF)
2079 tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate); 2079 tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate);
2080 2080
2081 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 2081 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "===>%s\n", __func__);
2082 "===>rtl8812ae_dm_txpwr_track_set_pwr\n");
2083 2082
2084 if (tx_rate != 0xFF) { /* Mimic Modify High Rate BBSwing Limit.*/ 2083 if (tx_rate != 0xFF) { /* Mimic Modify High Rate BBSwing Limit.*/
2085 /*CCK*/ 2084 /*CCK*/
@@ -2128,7 +2127,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw,
2128 2127
2129 if (method == BBSWING) { 2128 if (method == BBSWING) {
2130 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 2129 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
2131 "===>rtl8812ae_dm_txpwr_track_set_pwr\n"); 2130 "===>%s\n", __func__);
2132 if (rf_path == RF90_PATH_A) { 2131 if (rf_path == RF90_PATH_A) {
2133 final_swing_idx[RF90_PATH_A] = 2132 final_swing_idx[RF90_PATH_A] =
2134 (rtldm->ofdm_index[RF90_PATH_A] > 2133 (rtldm->ofdm_index[RF90_PATH_A] >
@@ -2260,7 +2259,8 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter(
2260 rtldm->txpower_trackinginit = true; 2259 rtldm->txpower_trackinginit = true;
2261 2260
2262 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 2261 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
2263 "===>rtl8812ae_dm_txpower_tracking_callback_thermalmeter,\n pDM_Odm->BbSwingIdxCckBase: %d,pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmIndex: %d\n", 2262 "===>%s,\n pDM_Odm->BbSwingIdxCckBase: %d,pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmIndex: %d\n",
2263 __func__,
2264 rtldm->swing_idx_cck_base, 2264 rtldm->swing_idx_cck_base,
2265 rtldm->swing_idx_ofdm_base[RF90_PATH_A], 2265 rtldm->swing_idx_ofdm_base[RF90_PATH_A],
2266 rtldm->default_ofdm_index); 2266 rtldm->default_ofdm_index);
@@ -2539,8 +2539,7 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter(
2539 } 2539 }
2540 } 2540 }
2541 2541
2542 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 2542 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===%s\n", __func__);
2543 "<===rtl8812ae_dm_txpower_tracking_callback_thermalmeter\n");
2544} 2543}
2545 2544
2546void rtl8821ae_dm_check_txpower_tracking_thermalmeter(struct ieee80211_hw *hw) 2545void rtl8821ae_dm_check_txpower_tracking_thermalmeter(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 73a49b868035..07b94eda9604 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -129,7 +129,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
129 r = zd_ioread16v_locked(chip, v16, a16, count16); 129 r = zd_ioread16v_locked(chip, v16, a16, count16);
130 if (r) { 130 if (r) {
131 dev_dbg_f(zd_chip_dev(chip), 131 dev_dbg_f(zd_chip_dev(chip),
132 "error: zd_ioread16v_locked. Error number %d\n", r); 132 "error: %s. Error number %d\n", __func__, r);
133 return r; 133 return r;
134 } 134 }
135 135
@@ -256,8 +256,8 @@ int zd_iowrite32a_locked(struct zd_chip *chip,
256 if (r) { 256 if (r) {
257 zd_usb_iowrite16v_async_end(&chip->usb, 0); 257 zd_usb_iowrite16v_async_end(&chip->usb, 0);
258 dev_dbg_f(zd_chip_dev(chip), 258 dev_dbg_f(zd_chip_dev(chip),
259 "error _zd_iowrite32v_locked." 259 "error _%s. Error number %d\n", __func__,
260 " Error number %d\n", r); 260 r);
261 return r; 261 return r;
262 } 262 }
263 } 263 }
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 083ecc93fe5e..5f1fda44882b 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -230,6 +230,8 @@ struct xenvif {
230 */ 230 */
231 bool disabled; 231 bool disabled;
232 unsigned long status; 232 unsigned long status;
233 unsigned long drain_timeout;
234 unsigned long stall_timeout;
233 235
234 /* Queues */ 236 /* Queues */
235 struct xenvif_queue *queues; 237 struct xenvif_queue *queues;
@@ -328,7 +330,7 @@ irqreturn_t xenvif_interrupt(int irq, void *dev_id);
328extern bool separate_tx_rx_irq; 330extern bool separate_tx_rx_irq;
329 331
330extern unsigned int rx_drain_timeout_msecs; 332extern unsigned int rx_drain_timeout_msecs;
331extern unsigned int rx_drain_timeout_jiffies; 333extern unsigned int rx_stall_timeout_msecs;
332extern unsigned int xenvif_max_queues; 334extern unsigned int xenvif_max_queues;
333 335
334#ifdef CONFIG_DEBUG_FS 336#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index a6a32d337bbb..9259a732e8a4 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -166,7 +166,7 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
166 goto drop; 166 goto drop;
167 167
168 cb = XENVIF_RX_CB(skb); 168 cb = XENVIF_RX_CB(skb);
169 cb->expires = jiffies + rx_drain_timeout_jiffies; 169 cb->expires = jiffies + vif->drain_timeout;
170 170
171 xenvif_rx_queue_tail(queue, skb); 171 xenvif_rx_queue_tail(queue, skb);
172 xenvif_kick_thread(queue); 172 xenvif_kick_thread(queue);
@@ -414,6 +414,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
414 vif->ip_csum = 1; 414 vif->ip_csum = 1;
415 vif->dev = dev; 415 vif->dev = dev;
416 vif->disabled = false; 416 vif->disabled = false;
417 vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs);
418 vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs);
417 419
418 /* Start out with no queues. */ 420 /* Start out with no queues. */
419 vif->queues = NULL; 421 vif->queues = NULL;
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 4a509f715fe8..908e65e9b821 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -60,14 +60,12 @@ module_param(separate_tx_rx_irq, bool, 0644);
60 */ 60 */
61unsigned int rx_drain_timeout_msecs = 10000; 61unsigned int rx_drain_timeout_msecs = 10000;
62module_param(rx_drain_timeout_msecs, uint, 0444); 62module_param(rx_drain_timeout_msecs, uint, 0444);
63unsigned int rx_drain_timeout_jiffies;
64 63
65/* The length of time before the frontend is considered unresponsive 64/* The length of time before the frontend is considered unresponsive
66 * because it isn't providing Rx slots. 65 * because it isn't providing Rx slots.
67 */ 66 */
68static unsigned int rx_stall_timeout_msecs = 60000; 67unsigned int rx_stall_timeout_msecs = 60000;
69module_param(rx_stall_timeout_msecs, uint, 0444); 68module_param(rx_stall_timeout_msecs, uint, 0444);
70static unsigned int rx_stall_timeout_jiffies;
71 69
72unsigned int xenvif_max_queues; 70unsigned int xenvif_max_queues;
73module_param_named(max_queues, xenvif_max_queues, uint, 0644); 71module_param_named(max_queues, xenvif_max_queues, uint, 0644);
@@ -2020,7 +2018,7 @@ static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue)
2020 return !queue->stalled 2018 return !queue->stalled
2021 && prod - cons < XEN_NETBK_RX_SLOTS_MAX 2019 && prod - cons < XEN_NETBK_RX_SLOTS_MAX
2022 && time_after(jiffies, 2020 && time_after(jiffies,
2023 queue->last_rx_time + rx_stall_timeout_jiffies); 2021 queue->last_rx_time + queue->vif->stall_timeout);
2024} 2022}
2025 2023
2026static bool xenvif_rx_queue_ready(struct xenvif_queue *queue) 2024static bool xenvif_rx_queue_ready(struct xenvif_queue *queue)
@@ -2038,8 +2036,9 @@ static bool xenvif_have_rx_work(struct xenvif_queue *queue)
2038{ 2036{
2039 return (!skb_queue_empty(&queue->rx_queue) 2037 return (!skb_queue_empty(&queue->rx_queue)
2040 && xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX)) 2038 && xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX))
2041 || xenvif_rx_queue_stalled(queue) 2039 || (queue->vif->stall_timeout &&
2042 || xenvif_rx_queue_ready(queue) 2040 (xenvif_rx_queue_stalled(queue)
2041 || xenvif_rx_queue_ready(queue)))
2043 || kthread_should_stop() 2042 || kthread_should_stop()
2044 || queue->vif->disabled; 2043 || queue->vif->disabled;
2045} 2044}
@@ -2092,6 +2091,9 @@ int xenvif_kthread_guest_rx(void *data)
2092 struct xenvif_queue *queue = data; 2091 struct xenvif_queue *queue = data;
2093 struct xenvif *vif = queue->vif; 2092 struct xenvif *vif = queue->vif;
2094 2093
2094 if (!vif->stall_timeout)
2095 xenvif_queue_carrier_on(queue);
2096
2095 for (;;) { 2097 for (;;) {
2096 xenvif_wait_for_rx_work(queue); 2098 xenvif_wait_for_rx_work(queue);
2097 2099
@@ -2118,10 +2120,12 @@ int xenvif_kthread_guest_rx(void *data)
2118 * while it's probably not responsive, drop the 2120 * while it's probably not responsive, drop the
2119 * carrier so packets are dropped earlier. 2121 * carrier so packets are dropped earlier.
2120 */ 2122 */
2121 if (xenvif_rx_queue_stalled(queue)) 2123 if (vif->stall_timeout) {
2122 xenvif_queue_carrier_off(queue); 2124 if (xenvif_rx_queue_stalled(queue))
2123 else if (xenvif_rx_queue_ready(queue)) 2125 xenvif_queue_carrier_off(queue);
2124 xenvif_queue_carrier_on(queue); 2126 else if (xenvif_rx_queue_ready(queue))
2127 xenvif_queue_carrier_on(queue);
2128 }
2125 2129
2126 /* Queued packets may have foreign pages from other 2130 /* Queued packets may have foreign pages from other
2127 * domains. These cannot be queued indefinitely as 2131 * domains. These cannot be queued indefinitely as
@@ -2192,9 +2196,6 @@ static int __init netback_init(void)
2192 if (rc) 2196 if (rc)
2193 goto failed_init; 2197 goto failed_init;
2194 2198
2195 rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs);
2196 rx_stall_timeout_jiffies = msecs_to_jiffies(rx_stall_timeout_msecs);
2197
2198#ifdef CONFIG_DEBUG_FS 2199#ifdef CONFIG_DEBUG_FS
2199 xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL); 2200 xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL);
2200 if (IS_ERR_OR_NULL(xen_netback_dbg_root)) 2201 if (IS_ERR_OR_NULL(xen_netback_dbg_root))
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index d44cd19169bd..efbaf2ae1999 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -887,9 +887,15 @@ static int read_xenbus_vif_flags(struct backend_info *be)
887 return -EOPNOTSUPP; 887 return -EOPNOTSUPP;
888 888
889 if (xenbus_scanf(XBT_NIL, dev->otherend, 889 if (xenbus_scanf(XBT_NIL, dev->otherend,
890 "feature-rx-notify", "%d", &val) < 0 || val == 0) { 890 "feature-rx-notify", "%d", &val) < 0)
891 xenbus_dev_fatal(dev, -EINVAL, "feature-rx-notify is mandatory"); 891 val = 0;
892 return -EINVAL; 892 if (!val) {
893 /* - Reduce drain timeout to poll more frequently for
894 * Rx requests.
895 * - Disable Rx stall detection.
896 */
897 be->vif->drain_timeout = msecs_to_jiffies(30);
898 be->vif->stall_timeout = 0;
893 } 899 }
894 900
895 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", 901 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 2f0a9ce9ff73..22bcb4e12e2a 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -977,7 +977,6 @@ static int xennet_poll(struct napi_struct *napi, int budget)
977 struct sk_buff_head rxq; 977 struct sk_buff_head rxq;
978 struct sk_buff_head errq; 978 struct sk_buff_head errq;
979 struct sk_buff_head tmpq; 979 struct sk_buff_head tmpq;
980 unsigned long flags;
981 int err; 980 int err;
982 981
983 spin_lock(&queue->rx_lock); 982 spin_lock(&queue->rx_lock);
@@ -1050,15 +1049,11 @@ err:
1050 if (work_done < budget) { 1049 if (work_done < budget) {
1051 int more_to_do = 0; 1050 int more_to_do = 0;
1052 1051
1053 napi_gro_flush(napi, false); 1052 napi_complete(napi);
1054
1055 local_irq_save(flags);
1056 1053
1057 RING_FINAL_CHECK_FOR_RESPONSES(&queue->rx, more_to_do); 1054 RING_FINAL_CHECK_FOR_RESPONSES(&queue->rx, more_to_do);
1058 if (!more_to_do) 1055 if (more_to_do)
1059 __napi_complete(napi); 1056 napi_schedule(napi);
1060
1061 local_irq_restore(flags);
1062 } 1057 }
1063 1058
1064 spin_unlock(&queue->rx_lock); 1059 spin_unlock(&queue->rx_lock);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index f2ca1b459377..7e75bfe37cc7 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -11,7 +11,7 @@ struct fixed_phy_status {
11 11
12struct device_node; 12struct device_node;
13 13
14#ifdef CONFIG_FIXED_PHY 14#if IS_ENABLED(CONFIG_FIXED_PHY)
15extern int fixed_phy_add(unsigned int irq, int phy_id, 15extern int fixed_phy_add(unsigned int irq, int phy_id,
16 struct fixed_phy_status *status); 16 struct fixed_phy_status *status);
17extern struct phy_device *fixed_phy_register(unsigned int irq, 17extern struct phy_device *fixed_phy_register(unsigned int irq,
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 18b2403982f9..50ae24335444 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -48,6 +48,8 @@
48#define TUNSETQUEUE _IOW('T', 217, int) 48#define TUNSETQUEUE _IOW('T', 217, int)
49#define TUNSETIFINDEX _IOW('T', 218, unsigned int) 49#define TUNSETIFINDEX _IOW('T', 218, unsigned int)
50#define TUNGETFILTER _IOR('T', 219, struct sock_fprog) 50#define TUNGETFILTER _IOR('T', 219, struct sock_fprog)
51#define TUNSETVNETLE _IOW('T', 220, int)
52#define TUNGETVNETLE _IOR('T', 221, int)
51 53
52/* TUNSETIFF ifr flags */ 54/* TUNSETIFF ifr flags */
53#define IFF_TUN 0x0001 55#define IFF_TUN 0x0001
@@ -57,7 +59,6 @@
57#define IFF_ONE_QUEUE 0x2000 59#define IFF_ONE_QUEUE 0x2000
58#define IFF_VNET_HDR 0x4000 60#define IFF_VNET_HDR 0x4000
59#define IFF_TUN_EXCL 0x8000 61#define IFF_TUN_EXCL 0x8000
60#define IFF_VNET_LE 0x10000
61#define IFF_MULTI_QUEUE 0x0100 62#define IFF_MULTI_QUEUE 0x0100
62#define IFF_ATTACH_QUEUE 0x0200 63#define IFF_ATTACH_QUEUE 0x0200
63#define IFF_DETACH_QUEUE 0x0400 64#define IFF_DETACH_QUEUE 0x0400
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 79d84b88b8f0..fe18825cc8a4 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -661,7 +661,7 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
661 memset(&cp, 0, sizeof(cp)); 661 memset(&cp, 0, sizeof(cp));
662 662
663 /* Update random address, but set require_privacy to false so 663 /* Update random address, but set require_privacy to false so
664 * that we never connect with an unresolvable address. 664 * that we never connect with an non-resolvable address.
665 */ 665 */
666 if (hci_update_random_address(req, false, &own_addr_type)) 666 if (hci_update_random_address(req, false, &own_addr_type))
667 return; 667 return;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 93f92a085506..5dcacf9607e4 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1373,8 +1373,6 @@ static void hci_init1_req(struct hci_request *req, unsigned long opt)
1373 1373
1374static void bredr_setup(struct hci_request *req) 1374static void bredr_setup(struct hci_request *req)
1375{ 1375{
1376 struct hci_dev *hdev = req->hdev;
1377
1378 __le16 param; 1376 __le16 param;
1379 __u8 flt_type; 1377 __u8 flt_type;
1380 1378
@@ -1403,14 +1401,6 @@ static void bredr_setup(struct hci_request *req)
1403 /* Connection accept timeout ~20 secs */ 1401 /* Connection accept timeout ~20 secs */
1404 param = cpu_to_le16(0x7d00); 1402 param = cpu_to_le16(0x7d00);
1405 hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, &param); 1403 hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, &param);
1406
1407 /* AVM Berlin (31), aka "BlueFRITZ!", reports version 1.2,
1408 * but it does not support page scan related HCI commands.
1409 */
1410 if (hdev->manufacturer != 31 && hdev->hci_ver > BLUETOOTH_VER_1_1) {
1411 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
1412 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_TYPE, 0, NULL);
1413 }
1414} 1404}
1415 1405
1416static void le_setup(struct hci_request *req) 1406static void le_setup(struct hci_request *req)
@@ -1718,6 +1708,16 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
1718 if (hdev->commands[5] & 0x10) 1708 if (hdev->commands[5] & 0x10)
1719 hci_setup_link_policy(req); 1709 hci_setup_link_policy(req);
1720 1710
1711 if (hdev->commands[8] & 0x01)
1712 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
1713
1714 /* Some older Broadcom based Bluetooth 1.2 controllers do not
1715 * support the Read Page Scan Type command. Check support for
1716 * this command in the bit mask of supported commands.
1717 */
1718 if (hdev->commands[13] & 0x01)
1719 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_TYPE, 0, NULL);
1720
1721 if (lmp_le_capable(hdev)) { 1721 if (lmp_le_capable(hdev)) {
1722 u8 events[8]; 1722 u8 events[8];
1723 1723
@@ -2634,6 +2634,12 @@ static int hci_dev_do_close(struct hci_dev *hdev)
2634 drain_workqueue(hdev->workqueue); 2634 drain_workqueue(hdev->workqueue);
2635 2635
2636 hci_dev_lock(hdev); 2636 hci_dev_lock(hdev);
2637
2638 if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
2639 if (hdev->dev_type == HCI_BREDR)
2640 mgmt_powered(hdev, 0);
2641 }
2642
2637 hci_inquiry_cache_flush(hdev); 2643 hci_inquiry_cache_flush(hdev);
2638 hci_pend_le_actions_clear(hdev); 2644 hci_pend_le_actions_clear(hdev);
2639 hci_conn_hash_flush(hdev); 2645 hci_conn_hash_flush(hdev);
@@ -2681,14 +2687,6 @@ static int hci_dev_do_close(struct hci_dev *hdev)
2681 hdev->flags &= BIT(HCI_RAW); 2687 hdev->flags &= BIT(HCI_RAW);
2682 hdev->dev_flags &= ~HCI_PERSISTENT_MASK; 2688 hdev->dev_flags &= ~HCI_PERSISTENT_MASK;
2683 2689
2684 if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
2685 if (hdev->dev_type == HCI_BREDR) {
2686 hci_dev_lock(hdev);
2687 mgmt_powered(hdev, 0);
2688 hci_dev_unlock(hdev);
2689 }
2690 }
2691
2692 /* Controller radio is available but is currently powered down */ 2690 /* Controller radio is available but is currently powered down */
2693 hdev->amp_status = AMP_STATUS_POWERED_DOWN; 2691 hdev->amp_status = AMP_STATUS_POWERED_DOWN;
2694 2692
@@ -3083,7 +3081,9 @@ static void hci_power_on(struct work_struct *work)
3083 3081
3084 err = hci_dev_do_open(hdev); 3082 err = hci_dev_do_open(hdev);
3085 if (err < 0) { 3083 if (err < 0) {
3084 hci_dev_lock(hdev);
3086 mgmt_set_powered_failed(hdev, err); 3085 mgmt_set_powered_failed(hdev, err);
3086 hci_dev_unlock(hdev);
3087 return; 3087 return;
3088 } 3088 }
3089 3089
@@ -3959,17 +3959,29 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
3959 } 3959 }
3960 3960
3961 /* In case of required privacy without resolvable private address, 3961 /* In case of required privacy without resolvable private address,
3962 * use an unresolvable private address. This is useful for active 3962 * use an non-resolvable private address. This is useful for active
3963 * scanning and non-connectable advertising. 3963 * scanning and non-connectable advertising.
3964 */ 3964 */
3965 if (require_privacy) { 3965 if (require_privacy) {
3966 bdaddr_t urpa; 3966 bdaddr_t nrpa;
3967
3968 while (true) {
3969 /* The non-resolvable private address is generated
3970 * from random six bytes with the two most significant
3971 * bits cleared.
3972 */
3973 get_random_bytes(&nrpa, 6);
3974 nrpa.b[5] &= 0x3f;
3967 3975
3968 get_random_bytes(&urpa, 6); 3976 /* The non-resolvable private address shall not be
3969 urpa.b[5] &= 0x3f; /* Clear two most significant bits */ 3977 * equal to the public address.
3978 */
3979 if (bacmp(&hdev->bdaddr, &nrpa))
3980 break;
3981 }
3970 3982
3971 *own_addr_type = ADDR_LE_DEV_RANDOM; 3983 *own_addr_type = ADDR_LE_DEV_RANDOM;
3972 set_random_addr(req, &urpa); 3984 set_random_addr(req, &nrpa);
3973 return 0; 3985 return 0;
3974 } 3986 }
3975 3987
@@ -5625,7 +5637,7 @@ void hci_req_add_le_passive_scan(struct hci_request *req)
5625 u8 filter_policy; 5637 u8 filter_policy;
5626 5638
5627 /* Set require_privacy to false since no SCAN_REQ are send 5639 /* Set require_privacy to false since no SCAN_REQ are send
5628 * during passive scanning. Not using an unresolvable address 5640 * during passive scanning. Not using an non-resolvable address
5629 * here is important so that peer devices using direct 5641 * here is important so that peer devices using direct
5630 * advertising with our address will be correctly reported 5642 * advertising with our address will be correctly reported
5631 * by the controller. 5643 * by the controller.
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 322abbbbcef9..39a5c8a01726 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -257,6 +257,8 @@ static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb)
257 if (!sent) 257 if (!sent)
258 return; 258 return;
259 259
260 hci_dev_lock(hdev);
261
260 if (!status) { 262 if (!status) {
261 __u8 param = *((__u8 *) sent); 263 __u8 param = *((__u8 *) sent);
262 264
@@ -268,6 +270,8 @@ static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb)
268 270
269 if (test_bit(HCI_MGMT, &hdev->dev_flags)) 271 if (test_bit(HCI_MGMT, &hdev->dev_flags))
270 mgmt_auth_enable_complete(hdev, status); 272 mgmt_auth_enable_complete(hdev, status);
273
274 hci_dev_unlock(hdev);
271} 275}
272 276
273static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) 277static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb)
@@ -443,6 +447,8 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb)
443 if (!sent) 447 if (!sent)
444 return; 448 return;
445 449
450 hci_dev_lock(hdev);
451
446 if (!status) { 452 if (!status) {
447 if (sent->mode) 453 if (sent->mode)
448 hdev->features[1][0] |= LMP_HOST_SSP; 454 hdev->features[1][0] |= LMP_HOST_SSP;
@@ -458,6 +464,8 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb)
458 else 464 else
459 clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags); 465 clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags);
460 } 466 }
467
468 hci_dev_unlock(hdev);
461} 469}
462 470
463static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb) 471static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb)
@@ -471,6 +479,8 @@ static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb)
471 if (!sent) 479 if (!sent)
472 return; 480 return;
473 481
482 hci_dev_lock(hdev);
483
474 if (!status) { 484 if (!status) {
475 if (sent->support) 485 if (sent->support)
476 hdev->features[1][0] |= LMP_HOST_SC; 486 hdev->features[1][0] |= LMP_HOST_SC;
@@ -486,6 +496,8 @@ static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb)
486 else 496 else
487 clear_bit(HCI_SC_ENABLED, &hdev->dev_flags); 497 clear_bit(HCI_SC_ENABLED, &hdev->dev_flags);
488 } 498 }
499
500 hci_dev_unlock(hdev);
489} 501}
490 502
491static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) 503static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb)
@@ -1135,6 +1147,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
1135 if (!cp) 1147 if (!cp)
1136 return; 1148 return;
1137 1149
1150 hci_dev_lock(hdev);
1151
1138 switch (cp->enable) { 1152 switch (cp->enable) {
1139 case LE_SCAN_ENABLE: 1153 case LE_SCAN_ENABLE:
1140 set_bit(HCI_LE_SCAN, &hdev->dev_flags); 1154 set_bit(HCI_LE_SCAN, &hdev->dev_flags);
@@ -1184,6 +1198,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
1184 BT_ERR("Used reserved LE_Scan_Enable param %d", cp->enable); 1198 BT_ERR("Used reserved LE_Scan_Enable param %d", cp->enable);
1185 break; 1199 break;
1186 } 1200 }
1201
1202 hci_dev_unlock(hdev);
1187} 1203}
1188 1204
1189static void hci_cc_le_read_white_list_size(struct hci_dev *hdev, 1205static void hci_cc_le_read_white_list_size(struct hci_dev *hdev,
@@ -1278,6 +1294,8 @@ static void hci_cc_write_le_host_supported(struct hci_dev *hdev,
1278 if (!sent) 1294 if (!sent)
1279 return; 1295 return;
1280 1296
1297 hci_dev_lock(hdev);
1298
1281 if (sent->le) { 1299 if (sent->le) {
1282 hdev->features[1][0] |= LMP_HOST_LE; 1300 hdev->features[1][0] |= LMP_HOST_LE;
1283 set_bit(HCI_LE_ENABLED, &hdev->dev_flags); 1301 set_bit(HCI_LE_ENABLED, &hdev->dev_flags);
@@ -1291,6 +1309,8 @@ static void hci_cc_write_le_host_supported(struct hci_dev *hdev,
1291 hdev->features[1][0] |= LMP_HOST_LE_BREDR; 1309 hdev->features[1][0] |= LMP_HOST_LE_BREDR;
1292 else 1310 else
1293 hdev->features[1][0] &= ~LMP_HOST_LE_BREDR; 1311 hdev->features[1][0] &= ~LMP_HOST_LE_BREDR;
1312
1313 hci_dev_unlock(hdev);
1294} 1314}
1295 1315
1296static void hci_cc_set_adv_param(struct hci_dev *hdev, struct sk_buff *skb) 1316static void hci_cc_set_adv_param(struct hci_dev *hdev, struct sk_buff *skb)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a2b6dfa38a0c..d04dc0095736 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6966,8 +6966,9 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon)
6966 test_bit(HCI_HS_ENABLED, &hcon->hdev->dev_flags)) 6966 test_bit(HCI_HS_ENABLED, &hcon->hdev->dev_flags))
6967 conn->local_fixed_chan |= L2CAP_FC_A2MP; 6967 conn->local_fixed_chan |= L2CAP_FC_A2MP;
6968 6968
6969 if (bredr_sc_enabled(hcon->hdev) && 6969 if (test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags) &&
6970 test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags)) 6970 (bredr_sc_enabled(hcon->hdev) ||
6971 test_bit(HCI_FORCE_LESC, &hcon->hdev->dbg_flags)))
6971 conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR; 6972 conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR;
6972 6973
6973 mutex_init(&conn->ident_lock); 6974 mutex_init(&conn->ident_lock);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7384f1161336..693ce8bcd06e 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2199,12 +2199,14 @@ static void le_enable_complete(struct hci_dev *hdev, u8 status)
2199{ 2199{
2200 struct cmd_lookup match = { NULL, hdev }; 2200 struct cmd_lookup match = { NULL, hdev };
2201 2201
2202 hci_dev_lock(hdev);
2203
2202 if (status) { 2204 if (status) {
2203 u8 mgmt_err = mgmt_status(status); 2205 u8 mgmt_err = mgmt_status(status);
2204 2206
2205 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, cmd_status_rsp, 2207 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, cmd_status_rsp,
2206 &mgmt_err); 2208 &mgmt_err);
2207 return; 2209 goto unlock;
2208 } 2210 }
2209 2211
2210 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, settings_rsp, &match); 2212 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, settings_rsp, &match);
@@ -2222,17 +2224,16 @@ static void le_enable_complete(struct hci_dev *hdev, u8 status)
2222 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { 2224 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
2223 struct hci_request req; 2225 struct hci_request req;
2224 2226
2225 hci_dev_lock(hdev);
2226
2227 hci_req_init(&req, hdev); 2227 hci_req_init(&req, hdev);
2228 update_adv_data(&req); 2228 update_adv_data(&req);
2229 update_scan_rsp_data(&req); 2229 update_scan_rsp_data(&req);
2230 hci_req_run(&req, NULL); 2230 hci_req_run(&req, NULL);
2231 2231
2232 hci_update_background_scan(hdev); 2232 hci_update_background_scan(hdev);
2233
2234 hci_dev_unlock(hdev);
2235 } 2233 }
2234
2235unlock:
2236 hci_dev_unlock(hdev);
2236} 2237}
2237 2238
2238static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) 2239static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
@@ -3114,14 +3115,13 @@ static void pairing_complete(struct pending_cmd *cmd, u8 status)
3114 conn->disconn_cfm_cb = NULL; 3115 conn->disconn_cfm_cb = NULL;
3115 3116
3116 hci_conn_drop(conn); 3117 hci_conn_drop(conn);
3117 hci_conn_put(conn);
3118
3119 mgmt_pending_remove(cmd);
3120 3118
3121 /* The device is paired so there is no need to remove 3119 /* The device is paired so there is no need to remove
3122 * its connection parameters anymore. 3120 * its connection parameters anymore.
3123 */ 3121 */
3124 clear_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags); 3122 clear_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags);
3123
3124 hci_conn_put(conn);
3125} 3125}
3126 3126
3127void mgmt_smp_complete(struct hci_conn *conn, bool complete) 3127void mgmt_smp_complete(struct hci_conn *conn, bool complete)
@@ -3130,8 +3130,10 @@ void mgmt_smp_complete(struct hci_conn *conn, bool complete)
3130 struct pending_cmd *cmd; 3130 struct pending_cmd *cmd;
3131 3131
3132 cmd = find_pairing(conn); 3132 cmd = find_pairing(conn);
3133 if (cmd) 3133 if (cmd) {
3134 cmd->cmd_complete(cmd, status); 3134 cmd->cmd_complete(cmd, status);
3135 mgmt_pending_remove(cmd);
3136 }
3135} 3137}
3136 3138
3137static void pairing_complete_cb(struct hci_conn *conn, u8 status) 3139static void pairing_complete_cb(struct hci_conn *conn, u8 status)
@@ -3141,10 +3143,13 @@ static void pairing_complete_cb(struct hci_conn *conn, u8 status)
3141 BT_DBG("status %u", status); 3143 BT_DBG("status %u", status);
3142 3144
3143 cmd = find_pairing(conn); 3145 cmd = find_pairing(conn);
3144 if (!cmd) 3146 if (!cmd) {
3145 BT_DBG("Unable to find a pending command"); 3147 BT_DBG("Unable to find a pending command");
3146 else 3148 return;
3147 cmd->cmd_complete(cmd, mgmt_status(status)); 3149 }
3150
3151 cmd->cmd_complete(cmd, mgmt_status(status));
3152 mgmt_pending_remove(cmd);
3148} 3153}
3149 3154
3150static void le_pairing_complete_cb(struct hci_conn *conn, u8 status) 3155static void le_pairing_complete_cb(struct hci_conn *conn, u8 status)
@@ -3157,10 +3162,13 @@ static void le_pairing_complete_cb(struct hci_conn *conn, u8 status)
3157 return; 3162 return;
3158 3163
3159 cmd = find_pairing(conn); 3164 cmd = find_pairing(conn);
3160 if (!cmd) 3165 if (!cmd) {
3161 BT_DBG("Unable to find a pending command"); 3166 BT_DBG("Unable to find a pending command");
3162 else 3167 return;
3163 cmd->cmd_complete(cmd, mgmt_status(status)); 3168 }
3169
3170 cmd->cmd_complete(cmd, mgmt_status(status));
3171 mgmt_pending_remove(cmd);
3164} 3172}
3165 3173
3166static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data, 3174static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
@@ -3274,8 +3282,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3274 cmd->user_data = hci_conn_get(conn); 3282 cmd->user_data = hci_conn_get(conn);
3275 3283
3276 if ((conn->state == BT_CONNECTED || conn->state == BT_CONFIG) && 3284 if ((conn->state == BT_CONNECTED || conn->state == BT_CONFIG) &&
3277 hci_conn_security(conn, sec_level, auth_type, true)) 3285 hci_conn_security(conn, sec_level, auth_type, true)) {
3278 pairing_complete(cmd, 0); 3286 cmd->cmd_complete(cmd, 0);
3287 mgmt_pending_remove(cmd);
3288 }
3279 3289
3280 err = 0; 3290 err = 0;
3281 3291
@@ -3317,7 +3327,8 @@ static int cancel_pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3317 goto unlock; 3327 goto unlock;
3318 } 3328 }
3319 3329
3320 pairing_complete(cmd, MGMT_STATUS_CANCELLED); 3330 cmd->cmd_complete(cmd, MGMT_STATUS_CANCELLED);
3331 mgmt_pending_remove(cmd);
3321 3332
3322 err = cmd_complete(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 0, 3333 err = cmd_complete(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 0,
3323 addr, sizeof(*addr)); 3334 addr, sizeof(*addr));
@@ -3791,7 +3802,7 @@ static bool trigger_discovery(struct hci_request *req, u8 *status)
3791 3802
3792 /* All active scans will be done with either a resolvable 3803 /* All active scans will be done with either a resolvable
3793 * private address (when privacy feature has been enabled) 3804 * private address (when privacy feature has been enabled)
3794 * or unresolvable private address. 3805 * or non-resolvable private address.
3795 */ 3806 */
3796 err = hci_update_random_address(req, true, &own_addr_type); 3807 err = hci_update_random_address(req, true, &own_addr_type);
3797 if (err < 0) { 3808 if (err < 0) {
@@ -4279,12 +4290,14 @@ static void set_advertising_complete(struct hci_dev *hdev, u8 status)
4279{ 4290{
4280 struct cmd_lookup match = { NULL, hdev }; 4291 struct cmd_lookup match = { NULL, hdev };
4281 4292
4293 hci_dev_lock(hdev);
4294
4282 if (status) { 4295 if (status) {
4283 u8 mgmt_err = mgmt_status(status); 4296 u8 mgmt_err = mgmt_status(status);
4284 4297
4285 mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev, 4298 mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev,
4286 cmd_status_rsp, &mgmt_err); 4299 cmd_status_rsp, &mgmt_err);
4287 return; 4300 goto unlock;
4288 } 4301 }
4289 4302
4290 if (test_bit(HCI_LE_ADV, &hdev->dev_flags)) 4303 if (test_bit(HCI_LE_ADV, &hdev->dev_flags))
@@ -4299,6 +4312,9 @@ static void set_advertising_complete(struct hci_dev *hdev, u8 status)
4299 4312
4300 if (match.sk) 4313 if (match.sk)
4301 sock_put(match.sk); 4314 sock_put(match.sk);
4315
4316unlock:
4317 hci_dev_unlock(hdev);
4302} 4318}
4303 4319
4304static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data, 4320static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data,
@@ -6081,6 +6097,11 @@ static int powered_update_hci(struct hci_dev *hdev)
6081 hci_req_add(&req, HCI_OP_WRITE_SSP_MODE, 1, &ssp); 6097 hci_req_add(&req, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
6082 } 6098 }
6083 6099
6100 if (bredr_sc_enabled(hdev) && !lmp_host_sc_capable(hdev)) {
6101 u8 sc = 0x01;
6102 hci_req_add(&req, HCI_OP_WRITE_SC_SUPPORT, sizeof(sc), &sc);
6103 }
6104
6084 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags) && 6105 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags) &&
6085 lmp_bredr_capable(hdev)) { 6106 lmp_bredr_capable(hdev)) {
6086 struct hci_cp_write_le_host_supported cp; 6107 struct hci_cp_write_le_host_supported cp;
@@ -6130,8 +6151,7 @@ static int powered_update_hci(struct hci_dev *hdev)
6130int mgmt_powered(struct hci_dev *hdev, u8 powered) 6151int mgmt_powered(struct hci_dev *hdev, u8 powered)
6131{ 6152{
6132 struct cmd_lookup match = { NULL, hdev }; 6153 struct cmd_lookup match = { NULL, hdev };
6133 u8 status_not_powered = MGMT_STATUS_NOT_POWERED; 6154 u8 status, zero_cod[] = { 0, 0, 0 };
6134 u8 zero_cod[] = { 0, 0, 0 };
6135 int err; 6155 int err;
6136 6156
6137 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) 6157 if (!test_bit(HCI_MGMT, &hdev->dev_flags))
@@ -6147,7 +6167,20 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
6147 } 6167 }
6148 6168
6149 mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match); 6169 mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match);
6150 mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status_not_powered); 6170
6171 /* If the power off is because of hdev unregistration let
6172 * use the appropriate INVALID_INDEX status. Otherwise use
6173 * NOT_POWERED. We cover both scenarios here since later in
6174 * mgmt_index_removed() any hci_conn callbacks will have already
6175 * been triggered, potentially causing misleading DISCONNECTED
6176 * status responses.
6177 */
6178 if (test_bit(HCI_UNREGISTER, &hdev->dev_flags))
6179 status = MGMT_STATUS_INVALID_INDEX;
6180 else
6181 status = MGMT_STATUS_NOT_POWERED;
6182
6183 mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status);
6151 6184
6152 if (memcmp(hdev->dev_class, zero_cod, sizeof(zero_cod)) != 0) 6185 if (memcmp(hdev->dev_class, zero_cod, sizeof(zero_cod)) != 0)
6153 mgmt_event(MGMT_EV_CLASS_OF_DEV_CHANGED, hdev, 6186 mgmt_event(MGMT_EV_CLASS_OF_DEV_CHANGED, hdev,
@@ -6681,8 +6714,10 @@ void mgmt_auth_failed(struct hci_conn *conn, u8 hci_status)
6681 mgmt_event(MGMT_EV_AUTH_FAILED, conn->hdev, &ev, sizeof(ev), 6714 mgmt_event(MGMT_EV_AUTH_FAILED, conn->hdev, &ev, sizeof(ev),
6682 cmd ? cmd->sk : NULL); 6715 cmd ? cmd->sk : NULL);
6683 6716
6684 if (cmd) 6717 if (cmd) {
6685 pairing_complete(cmd, status); 6718 cmd->cmd_complete(cmd, status);
6719 mgmt_pending_remove(cmd);
6720 }
6686} 6721}
6687 6722
6688void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status) 6723void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)
@@ -7046,13 +7081,15 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
7046 * kept and checking possible scan response data 7081 * kept and checking possible scan response data
7047 * will be skipped. 7082 * will be skipped.
7048 */ 7083 */
7049 if (hdev->discovery.uuid_count > 0) { 7084 if (hdev->discovery.uuid_count > 0)
7050 match = eir_has_uuids(eir, eir_len, 7085 match = eir_has_uuids(eir, eir_len,
7051 hdev->discovery.uuid_count, 7086 hdev->discovery.uuid_count,
7052 hdev->discovery.uuids); 7087 hdev->discovery.uuids);
7053 if (!match) 7088 else
7054 return; 7089 match = true;
7055 } 7090
7091 if (!match && !scan_rsp_len)
7092 return;
7056 7093
7057 /* Copy EIR or advertising data into event */ 7094 /* Copy EIR or advertising data into event */
7058 memcpy(ev->eir, eir, eir_len); 7095 memcpy(ev->eir, eir, eir_len);
@@ -7061,8 +7098,10 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
7061 * provided, results with empty EIR or advertising data 7098 * provided, results with empty EIR or advertising data
7062 * should be dropped since they do not match any UUID. 7099 * should be dropped since they do not match any UUID.
7063 */ 7100 */
7064 if (hdev->discovery.uuid_count > 0) 7101 if (hdev->discovery.uuid_count > 0 && !scan_rsp_len)
7065 return; 7102 return;
7103
7104 match = false;
7066 } 7105 }
7067 7106
7068 if (dev_class && !eir_has_data_type(ev->eir, eir_len, EIR_CLASS_OF_DEV)) 7107 if (dev_class && !eir_has_data_type(ev->eir, eir_len, EIR_CLASS_OF_DEV))
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 6a46252fe66f..b67749bb55bf 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1673,7 +1673,8 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
1673 /* SMP over BR/EDR requires special treatment */ 1673 /* SMP over BR/EDR requires special treatment */
1674 if (conn->hcon->type == ACL_LINK) { 1674 if (conn->hcon->type == ACL_LINK) {
1675 /* We must have a BR/EDR SC link */ 1675 /* We must have a BR/EDR SC link */
1676 if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags)) 1676 if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags) &&
1677 !test_bit(HCI_FORCE_LESC, &hdev->dbg_flags))
1677 return SMP_CROSS_TRANSP_NOT_ALLOWED; 1678 return SMP_CROSS_TRANSP_NOT_ALLOWED;
1678 1679
1679 set_bit(SMP_FLAG_SC, &smp->flags); 1680 set_bit(SMP_FLAG_SC, &smp->flags);
@@ -2927,7 +2928,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid)
2927 tfm_aes = crypto_alloc_blkcipher("ecb(aes)", 0, 0); 2928 tfm_aes = crypto_alloc_blkcipher("ecb(aes)", 0, 0);
2928 if (IS_ERR(tfm_aes)) { 2929 if (IS_ERR(tfm_aes)) {
2929 BT_ERR("Unable to create crypto context"); 2930 BT_ERR("Unable to create crypto context");
2930 return ERR_PTR(PTR_ERR(tfm_aes)); 2931 return ERR_CAST(tfm_aes);
2931 } 2932 }
2932 2933
2933create_chan: 2934create_chan:
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d06107d36ec8..9cf6fe9ddc0c 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2368,6 +2368,11 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
2368 return err; 2368 return err;
2369 } 2369 }
2370 2370
2371 if (vid) {
2372 pr_info("%s: vlans aren't supported yet for dev_uc|mc_add()\n", dev->name);
2373 return err;
2374 }
2375
2371 if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) 2376 if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr))
2372 err = dev_uc_add_excl(dev, addr); 2377 err = dev_uc_add_excl(dev, addr);
2373 else if (is_multicast_ether_addr(addr)) 2378 else if (is_multicast_ether_addr(addr))
diff --git a/net/ipv4/geneve.c b/net/ipv4/geneve.c
index a457232f0131..95e47c97585e 100644
--- a/net/ipv4/geneve.c
+++ b/net/ipv4/geneve.c
@@ -159,6 +159,15 @@ static void geneve_notify_add_rx_port(struct geneve_sock *gs)
159 } 159 }
160} 160}
161 161
162static void geneve_notify_del_rx_port(struct geneve_sock *gs)
163{
164 struct sock *sk = gs->sock->sk;
165 sa_family_t sa_family = sk->sk_family;
166
167 if (sa_family == AF_INET)
168 udp_del_offload(&gs->udp_offloads);
169}
170
162/* Callback from net/ipv4/udp.c to receive packets */ 171/* Callback from net/ipv4/udp.c to receive packets */
163static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb) 172static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
164{ 173{
@@ -287,6 +296,7 @@ struct geneve_sock *geneve_sock_add(struct net *net, __be16 port,
287 geneve_rcv_t *rcv, void *data, 296 geneve_rcv_t *rcv, void *data,
288 bool no_share, bool ipv6) 297 bool no_share, bool ipv6)
289{ 298{
299 struct geneve_net *gn = net_generic(net, geneve_net_id);
290 struct geneve_sock *gs; 300 struct geneve_sock *gs;
291 301
292 gs = geneve_socket_create(net, port, rcv, data, ipv6); 302 gs = geneve_socket_create(net, port, rcv, data, ipv6);
@@ -296,15 +306,15 @@ struct geneve_sock *geneve_sock_add(struct net *net, __be16 port,
296 if (no_share) /* Return error if sharing is not allowed. */ 306 if (no_share) /* Return error if sharing is not allowed. */
297 return ERR_PTR(-EINVAL); 307 return ERR_PTR(-EINVAL);
298 308
309 spin_lock(&gn->sock_lock);
299 gs = geneve_find_sock(net, port); 310 gs = geneve_find_sock(net, port);
300 if (gs) { 311 if (gs && ((gs->rcv != rcv) ||
301 if (gs->rcv == rcv) 312 !atomic_add_unless(&gs->refcnt, 1, 0)))
302 atomic_inc(&gs->refcnt);
303 else
304 gs = ERR_PTR(-EBUSY); 313 gs = ERR_PTR(-EBUSY);
305 } else { 314 spin_unlock(&gn->sock_lock);
315
316 if (!gs)
306 gs = ERR_PTR(-EINVAL); 317 gs = ERR_PTR(-EINVAL);
307 }
308 318
309 return gs; 319 return gs;
310} 320}
@@ -312,9 +322,17 @@ EXPORT_SYMBOL_GPL(geneve_sock_add);
312 322
313void geneve_sock_release(struct geneve_sock *gs) 323void geneve_sock_release(struct geneve_sock *gs)
314{ 324{
325 struct net *net = sock_net(gs->sock->sk);
326 struct geneve_net *gn = net_generic(net, geneve_net_id);
327
315 if (!atomic_dec_and_test(&gs->refcnt)) 328 if (!atomic_dec_and_test(&gs->refcnt))
316 return; 329 return;
317 330
331 spin_lock(&gn->sock_lock);
332 hlist_del_rcu(&gs->hlist);
333 geneve_notify_del_rx_port(gs);
334 spin_unlock(&gn->sock_lock);
335
318 queue_work(geneve_wq, &gs->del_work); 336 queue_work(geneve_wq, &gs->del_work);
319} 337}
320EXPORT_SYMBOL_GPL(geneve_sock_release); 338EXPORT_SYMBOL_GPL(geneve_sock_release);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index ac8491245e5b..4f4bf5b99686 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -252,10 +252,6 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
252 struct ip_tunnel *tunnel = netdev_priv(dev); 252 struct ip_tunnel *tunnel = netdev_priv(dev);
253 const struct iphdr *tnl_params; 253 const struct iphdr *tnl_params;
254 254
255 skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM));
256 if (IS_ERR(skb))
257 goto out;
258
259 if (dev->header_ops) { 255 if (dev->header_ops) {
260 /* Need space for new headers */ 256 /* Need space for new headers */
261 if (skb_cow_head(skb, dev->needed_headroom - 257 if (skb_cow_head(skb, dev->needed_headroom -
@@ -268,6 +264,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
268 * to gre header. 264 * to gre header.
269 */ 265 */
270 skb_pull(skb, tunnel->hlen + sizeof(struct iphdr)); 266 skb_pull(skb, tunnel->hlen + sizeof(struct iphdr));
267 skb_reset_mac_header(skb);
271 } else { 268 } else {
272 if (skb_cow_head(skb, dev->needed_headroom)) 269 if (skb_cow_head(skb, dev->needed_headroom))
273 goto free_skb; 270 goto free_skb;
@@ -275,6 +272,10 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
275 tnl_params = &tunnel->parms.iph; 272 tnl_params = &tunnel->parms.iph;
276 } 273 }
277 274
275 skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM));
276 if (IS_ERR(skb))
277 goto out;
278
278 __gre_xmit(skb, dev, tnl_params, skb->protocol); 279 __gre_xmit(skb, dev, tnl_params, skb->protocol);
279 280
280 return NETDEV_TX_OK; 281 return NETDEV_TX_OK;
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 63e745aadab6..d3e447936720 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -514,6 +514,9 @@ const struct ip_tunnel_encap_ops __rcu *
514int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *ops, 514int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *ops,
515 unsigned int num) 515 unsigned int num)
516{ 516{
517 if (num >= MAX_IPTUN_ENCAP_OPS)
518 return -ERANGE;
519
517 return !cmpxchg((const struct ip_tunnel_encap_ops **) 520 return !cmpxchg((const struct ip_tunnel_encap_ops **)
518 &iptun_encaps[num], 521 &iptun_encaps[num],
519 NULL, ops) ? 0 : -1; 522 NULL, ops) ? 0 : -1;
@@ -525,6 +528,9 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *ops,
525{ 528{
526 int ret; 529 int ret;
527 530
531 if (num >= MAX_IPTUN_ENCAP_OPS)
532 return -ERANGE;
533
528 ret = (cmpxchg((const struct ip_tunnel_encap_ops **) 534 ret = (cmpxchg((const struct ip_tunnel_encap_ops **)
529 &iptun_encaps[num], 535 &iptun_encaps[num],
530 ops, NULL) == ops) ? 0 : -1; 536 ops, NULL) == ops) ? 0 : -1;
@@ -567,6 +573,9 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
567 if (t->encap.type == TUNNEL_ENCAP_NONE) 573 if (t->encap.type == TUNNEL_ENCAP_NONE)
568 return 0; 574 return 0;
569 575
576 if (t->encap.type >= MAX_IPTUN_ENCAP_OPS)
577 return -EINVAL;
578
570 rcu_read_lock(); 579 rcu_read_lock();
571 ops = rcu_dereference(iptun_encaps[t->encap.type]); 580 ops = rcu_dereference(iptun_encaps[t->encap.type]);
572 if (likely(ops && ops->build_header)) 581 if (likely(ops && ops->build_header))
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 5d6dae9e4aac..da1c12c34487 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -1011,6 +1011,10 @@ ieee80211_vif_use_reserved_reassign(struct ieee80211_sub_if_data *sdata)
1011 1011
1012 ieee80211_vif_update_chandef(sdata, &sdata->reserved_chandef); 1012 ieee80211_vif_update_chandef(sdata, &sdata->reserved_chandef);
1013 1013
1014 ieee80211_recalc_smps_chanctx(local, new_ctx);
1015 ieee80211_recalc_radar_chanctx(local, new_ctx);
1016 ieee80211_recalc_chanctx_min_def(local, new_ctx);
1017
1014 if (changed) 1018 if (changed)
1015 ieee80211_bss_info_change_notify(sdata, changed); 1019 ieee80211_bss_info_change_notify(sdata, changed);
1016 1020
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 434a91ad12c8..0bb7038121ac 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -656,7 +656,7 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
656 int i; 656 int i;
657 657
658 mutex_lock(&local->key_mtx); 658 mutex_lock(&local->key_mtx);
659 for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 659 for (i = 0; i < ARRAY_SIZE(sta->gtk); i++) {
660 key = key_mtx_dereference(local, sta->gtk[i]); 660 key = key_mtx_dereference(local, sta->gtk[i]);
661 if (!key) 661 if (!key)
662 continue; 662 continue;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 75a9bf50207e..2c36c4765f47 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -174,6 +174,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
174 if (!(ht_cap->cap_info & 174 if (!(ht_cap->cap_info &
175 cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40))) { 175 cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40))) {
176 ret = IEEE80211_STA_DISABLE_40MHZ; 176 ret = IEEE80211_STA_DISABLE_40MHZ;
177 vht_chandef = *chandef;
177 goto out; 178 goto out;
178 } 179 }
179 180
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 49c23bdf08bb..683b10f46505 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1761,14 +1761,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1761 sc = le16_to_cpu(hdr->seq_ctrl); 1761 sc = le16_to_cpu(hdr->seq_ctrl);
1762 frag = sc & IEEE80211_SCTL_FRAG; 1762 frag = sc & IEEE80211_SCTL_FRAG;
1763 1763
1764 if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
1765 goto out;
1766
1767 if (is_multicast_ether_addr(hdr->addr1)) { 1764 if (is_multicast_ether_addr(hdr->addr1)) {
1768 rx->local->dot11MulticastReceivedFrameCount++; 1765 rx->local->dot11MulticastReceivedFrameCount++;
1769 goto out; 1766 goto out_no_led;
1770 } 1767 }
1771 1768
1769 if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
1770 goto out;
1771
1772 I802_DEBUG_INC(rx->local->rx_handlers_fragments); 1772 I802_DEBUG_INC(rx->local->rx_handlers_fragments);
1773 1773
1774 if (skb_linearize(rx->skb)) 1774 if (skb_linearize(rx->skb))
@@ -1859,9 +1859,10 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1859 status->rx_flags |= IEEE80211_RX_FRAGMENTED; 1859 status->rx_flags |= IEEE80211_RX_FRAGMENTED;
1860 1860
1861 out: 1861 out:
1862 ieee80211_led_rx(rx->local);
1863 out_no_led:
1862 if (rx->sta) 1864 if (rx->sta)
1863 rx->sta->rx_packets++; 1865 rx->sta->rx_packets++;
1864 ieee80211_led_rx(rx->local);
1865 return RX_CONTINUE; 1866 return RX_CONTINUE;
1866} 1867}
1867 1868
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index ef5f77b44ec7..074cf3e91c6f 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -525,14 +525,14 @@ out:
525 return err; 525 return err;
526} 526}
527 527
528static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr) 528static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr, unsigned int nm_len)
529{ 529{
530#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1 530#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
531 struct page *p_start, *p_end; 531 struct page *p_start, *p_end;
532 532
533 /* First page is flushed through netlink_{get,set}_status */ 533 /* First page is flushed through netlink_{get,set}_status */
534 p_start = pgvec_to_page(hdr + PAGE_SIZE); 534 p_start = pgvec_to_page(hdr + PAGE_SIZE);
535 p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + hdr->nm_len - 1); 535 p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + nm_len - 1);
536 while (p_start <= p_end) { 536 while (p_start <= p_end) {
537 flush_dcache_page(p_start); 537 flush_dcache_page(p_start);
538 p_start++; 538 p_start++;
@@ -550,9 +550,9 @@ static enum nl_mmap_status netlink_get_status(const struct nl_mmap_hdr *hdr)
550static void netlink_set_status(struct nl_mmap_hdr *hdr, 550static void netlink_set_status(struct nl_mmap_hdr *hdr,
551 enum nl_mmap_status status) 551 enum nl_mmap_status status)
552{ 552{
553 smp_mb();
553 hdr->nm_status = status; 554 hdr->nm_status = status;
554 flush_dcache_page(pgvec_to_page(hdr)); 555 flush_dcache_page(pgvec_to_page(hdr));
555 smp_wmb();
556} 556}
557 557
558static struct nl_mmap_hdr * 558static struct nl_mmap_hdr *
@@ -714,24 +714,16 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg,
714 struct nl_mmap_hdr *hdr; 714 struct nl_mmap_hdr *hdr;
715 struct sk_buff *skb; 715 struct sk_buff *skb;
716 unsigned int maxlen; 716 unsigned int maxlen;
717 bool excl = true;
718 int err = 0, len = 0; 717 int err = 0, len = 0;
719 718
720 /* Netlink messages are validated by the receiver before processing.
721 * In order to avoid userspace changing the contents of the message
722 * after validation, the socket and the ring may only be used by a
723 * single process, otherwise we fall back to copying.
724 */
725 if (atomic_long_read(&sk->sk_socket->file->f_count) > 1 ||
726 atomic_read(&nlk->mapped) > 1)
727 excl = false;
728
729 mutex_lock(&nlk->pg_vec_lock); 719 mutex_lock(&nlk->pg_vec_lock);
730 720
731 ring = &nlk->tx_ring; 721 ring = &nlk->tx_ring;
732 maxlen = ring->frame_size - NL_MMAP_HDRLEN; 722 maxlen = ring->frame_size - NL_MMAP_HDRLEN;
733 723
734 do { 724 do {
725 unsigned int nm_len;
726
735 hdr = netlink_current_frame(ring, NL_MMAP_STATUS_VALID); 727 hdr = netlink_current_frame(ring, NL_MMAP_STATUS_VALID);
736 if (hdr == NULL) { 728 if (hdr == NULL) {
737 if (!(msg->msg_flags & MSG_DONTWAIT) && 729 if (!(msg->msg_flags & MSG_DONTWAIT) &&
@@ -739,35 +731,23 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg,
739 schedule(); 731 schedule();
740 continue; 732 continue;
741 } 733 }
742 if (hdr->nm_len > maxlen) { 734
735 nm_len = ACCESS_ONCE(hdr->nm_len);
736 if (nm_len > maxlen) {
743 err = -EINVAL; 737 err = -EINVAL;
744 goto out; 738 goto out;
745 } 739 }
746 740
747 netlink_frame_flush_dcache(hdr); 741 netlink_frame_flush_dcache(hdr, nm_len);
748 742
749 if (likely(dst_portid == 0 && dst_group == 0 && excl)) { 743 skb = alloc_skb(nm_len, GFP_KERNEL);
750 skb = alloc_skb_head(GFP_KERNEL); 744 if (skb == NULL) {
751 if (skb == NULL) { 745 err = -ENOBUFS;
752 err = -ENOBUFS; 746 goto out;
753 goto out;
754 }
755 sock_hold(sk);
756 netlink_ring_setup_skb(skb, sk, ring, hdr);
757 NETLINK_CB(skb).flags |= NETLINK_SKB_TX;
758 __skb_put(skb, hdr->nm_len);
759 netlink_set_status(hdr, NL_MMAP_STATUS_RESERVED);
760 atomic_inc(&ring->pending);
761 } else {
762 skb = alloc_skb(hdr->nm_len, GFP_KERNEL);
763 if (skb == NULL) {
764 err = -ENOBUFS;
765 goto out;
766 }
767 __skb_put(skb, hdr->nm_len);
768 memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, hdr->nm_len);
769 netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
770 } 747 }
748 __skb_put(skb, nm_len);
749 memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, nm_len);
750 netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
771 751
772 netlink_increment_head(ring); 752 netlink_increment_head(ring);
773 753
@@ -813,7 +793,7 @@ static void netlink_queue_mmaped_skb(struct sock *sk, struct sk_buff *skb)
813 hdr->nm_pid = NETLINK_CB(skb).creds.pid; 793 hdr->nm_pid = NETLINK_CB(skb).creds.pid;
814 hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid); 794 hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid);
815 hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid); 795 hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid);
816 netlink_frame_flush_dcache(hdr); 796 netlink_frame_flush_dcache(hdr, hdr->nm_len);
817 netlink_set_status(hdr, NL_MMAP_STATUS_VALID); 797 netlink_set_status(hdr, NL_MMAP_STATUS_VALID);
818 798
819 NETLINK_CB(skb).flags |= NETLINK_SKB_DELIVERED; 799 NETLINK_CB(skb).flags |= NETLINK_SKB_DELIVERED;
diff --git a/net/rds/message.c b/net/rds/message.c
index ff2202218187..5a21e6f5986f 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -325,7 +325,8 @@ int rds_message_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to)
325 copied = 0; 325 copied = 0;
326 326
327 while (iov_iter_count(to) && copied < len) { 327 while (iov_iter_count(to) && copied < len) {
328 to_copy = min(iov_iter_count(to), sg->length - vec_off); 328 to_copy = min_t(unsigned long, iov_iter_count(to),
329 sg->length - vec_off);
329 to_copy = min_t(unsigned long, to_copy, len - copied); 330 to_copy = min_t(unsigned long, to_copy, len - copied);
330 331
331 rds_stats_add(s_copy_to_user, to_copy); 332 rds_stats_add(s_copy_to_user, to_copy);
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 85506f1d0789..7aaf7415dc4c 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -603,7 +603,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
603{ 603{
604 struct ieee80211_sta_ht_cap *ht_cap; 604 struct ieee80211_sta_ht_cap *ht_cap;
605 struct ieee80211_sta_vht_cap *vht_cap; 605 struct ieee80211_sta_vht_cap *vht_cap;
606 u32 width, control_freq; 606 u32 width, control_freq, cap;
607 607
608 if (WARN_ON(!cfg80211_chandef_valid(chandef))) 608 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
609 return false; 609 return false;
@@ -643,7 +643,8 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
643 return false; 643 return false;
644 break; 644 break;
645 case NL80211_CHAN_WIDTH_80P80: 645 case NL80211_CHAN_WIDTH_80P80:
646 if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) 646 cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
647 if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
647 return false; 648 return false;
648 case NL80211_CHAN_WIDTH_80: 649 case NL80211_CHAN_WIDTH_80:
649 if (!vht_cap->vht_supported) 650 if (!vht_cap->vht_supported)
@@ -654,7 +655,9 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
654 case NL80211_CHAN_WIDTH_160: 655 case NL80211_CHAN_WIDTH_160:
655 if (!vht_cap->vht_supported) 656 if (!vht_cap->vht_supported)
656 return false; 657 return false;
657 if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)) 658 cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
659 if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
660 cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
658 return false; 661 return false;
659 prohibited_flags |= IEEE80211_CHAN_NO_160MHZ; 662 prohibited_flags |= IEEE80211_CHAN_NO_160MHZ;
660 width = 160; 663 width = 160;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a17d6bc6b22c..7ca4b5133123 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6002,7 +6002,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev,
6002 } 6002 }
6003 6003
6004 /* there was no other matchset, so the RSSI one is alone */ 6004 /* there was no other matchset, so the RSSI one is alone */
6005 if (i == 0) 6005 if (i == 0 && n_match_sets)
6006 request->match_sets[0].rssi_thold = default_match_rssi; 6006 request->match_sets[0].rssi_thold = default_match_rssi;
6007 6007
6008 request->min_rssi_thold = INT_MAX; 6008 request->min_rssi_thold = INT_MAX;
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 47be6163381c..7b8309840d4e 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1549,9 +1549,15 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
1549 ret = cfg80211_reg_can_beacon(wiphy, 1549 ret = cfg80211_reg_can_beacon(wiphy,
1550 &wdev->chandef, wdev->iftype); 1550 &wdev->chandef, wdev->iftype);
1551 break; 1551 break;
1552 case NL80211_IFTYPE_ADHOC:
1553 if (!wdev->ssid_len)
1554 goto out;
1555
1556 ret = cfg80211_reg_can_beacon(wiphy,
1557 &wdev->chandef, wdev->iftype);
1558 break;
1552 case NL80211_IFTYPE_STATION: 1559 case NL80211_IFTYPE_STATION:
1553 case NL80211_IFTYPE_P2P_CLIENT: 1560 case NL80211_IFTYPE_P2P_CLIENT:
1554 case NL80211_IFTYPE_ADHOC:
1555 if (!wdev->current_bss || 1561 if (!wdev->current_bss ||
1556 !wdev->current_bss->pub.channel) 1562 !wdev->current_bss->pub.channel)
1557 goto out; 1563 goto out;
@@ -1907,7 +1913,7 @@ static enum reg_request_treatment
1907reg_process_hint_driver(struct wiphy *wiphy, 1913reg_process_hint_driver(struct wiphy *wiphy,
1908 struct regulatory_request *driver_request) 1914 struct regulatory_request *driver_request)
1909{ 1915{
1910 const struct ieee80211_regdomain *regd; 1916 const struct ieee80211_regdomain *regd, *tmp;
1911 enum reg_request_treatment treatment; 1917 enum reg_request_treatment treatment;
1912 1918
1913 treatment = __reg_process_hint_driver(driver_request); 1919 treatment = __reg_process_hint_driver(driver_request);
@@ -1927,7 +1933,10 @@ reg_process_hint_driver(struct wiphy *wiphy,
1927 reg_free_request(driver_request); 1933 reg_free_request(driver_request);
1928 return REG_REQ_IGNORE; 1934 return REG_REQ_IGNORE;
1929 } 1935 }
1936
1937 tmp = get_wiphy_regdom(wiphy);
1930 rcu_assign_pointer(wiphy->regd, regd); 1938 rcu_assign_pointer(wiphy->regd, regd);
1939 rcu_free_regdom(tmp);
1931 } 1940 }
1932 1941
1933 1942
@@ -1986,11 +1995,8 @@ __reg_process_hint_country_ie(struct wiphy *wiphy,
1986 return REG_REQ_IGNORE; 1995 return REG_REQ_IGNORE;
1987 return REG_REQ_ALREADY_SET; 1996 return REG_REQ_ALREADY_SET;
1988 } 1997 }
1989 /* 1998
1990 * Two consecutive Country IE hints on the same wiphy. 1999 if (regdom_changes(country_ie_request->alpha2))
1991 * This should be picked up early by the driver/stack
1992 */
1993 if (WARN_ON(regdom_changes(country_ie_request->alpha2)))
1994 return REG_REQ_OK; 2000 return REG_REQ_OK;
1995 return REG_REQ_ALREADY_SET; 2001 return REG_REQ_ALREADY_SET;
1996} 2002}