aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-10-19 12:55:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-19 12:55:40 -0400
commit1099f86044111e9a7807f09523e42d4c9d0fb781 (patch)
tree78f5c45947b75a3b5d1c465e2f67b15aa87a8252
parent7379047d5585187d1288486d4627873170d0005a (diff)
parent37850e37fcfb4dd831bc9e33221e8c49a732956f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Account for extra headroom in ath9k driver, from Felix Fietkau. 2) Fix OOPS in pppoe driver due to incorrect socket state transition, from Guillaume Nault. 3) Kill memory leak in amd-xgbe debugfx, from Geliang Tang. 4) Power management fixes for iwlwifi, from Johannes Berg. 5) Fix races in reqsk_queue_unlink(), from Eric Dumazet. 6) Fix dst_entry usage in ARP replies, from Jiri Benc. 7) Cure OOPSes with SO_GET_FILTER, from Daniel Borkmann. 8) Missing allocation failure check in amd-xgbe, from Tom Lendacky. 9) Various resource allocation/freeing cures in DSA< from Neil Armstrong. 10) A series of bug fixes in the openvswitch conntrack support, from Joe Stringer. 11) Fix two cases (BPF and act_mirred) where we have to clean the sender cpu stored in the SKB before transmitting. From WANG Cong and Alexei Starovoitov. 12) Disable VLAN filtering in promiscuous mode in mlx5 driver, from Achiad Shochat. 13) Older bnx2x chips cannot do 4-tuple UDP hashing, so prevent this configuration via ethtool. From Yuval Mintz. 14) Don't call rt6_uncached_list_flush_dev() from rt6_ifdown() when 'dev' is NULL, from Eric Biederman. 15) Prevent stalled link synchronization in tipc, from Jon Paul Maloy. 16) kcalloc() gstrings ethtool buffer before having driver fill it in, in order to prevent kernel memory leaking. From Joe Perches. 17) Fix mixxing rt6_info initialization for blackhole routes, from Martin KaFai Lau. 18) Kill VLAN regression in via-rhine, from Andrej Ota. 19) Missing pfmemalloc check in sk_add_backlog(), from Eric Dumazet. 20) Fix spurious MSG_TRUNC signalling in netlink dumps, from Ronen Arad. 21) Scrube SKBs when pushing them between namespaces in openvswitch, from Joe Stringer. 22) bcmgenet enables link interrupts too early, fix from Florian Fainelli. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (92 commits) net: bcmgenet: Fix early link interrupt enabling tunnels: Don't require remote endpoint or ID during creation. openvswitch: Scrub skb between namespaces xen-netback: correctly check failed allocation net: asix: add support for the Billionton GUSB2AM-1G-B USB adapter netlink: Trim skb to alloc size to avoid MSG_TRUNC net: add pfmemalloc check in sk_add_backlog() via-rhine: fix VLAN receive handling regression. ipv6: Initialize rt6_info properly in ip6_blackhole_route() ipv6: Move common init code for rt6_info to a new function rt6_info_init() Bluetooth: Fix initializing conn_params in scan phase Bluetooth: Fix conn_params list update in hci_connect_le_scan_cleanup Bluetooth: Fix remove_device behavior for explicit connects Bluetooth: Fix LE reconnection logic Bluetooth: Fix reference counting for LE-scan based connections Bluetooth: Fix double scan updates mlxsw: core: Fix race condition in __mlxsw_emad_transmit tipc: move fragment importance field to new header position ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings tipc: eliminate risk of stalled link synchronization ...
-rw-r--r--MAINTAINERS1
-rw-r--r--arch/arm/net/bpf_jit_32.c1
-rw-r--r--drivers/net/can/sja1000/peak_pci.c1
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c7
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c32
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c31
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h10
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c28
-rw-r--r--drivers/net/ethernet/freescale/fsl_pq_mdio.c34
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq.c4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c2
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_adminq.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/port.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/item.h4
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/pci.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/switchx2.c2
-rw-r--r--drivers/net/ethernet/nxp/lpc_eth.c13
-rw-r--r--drivers/net/ethernet/via/via-rhine.c3
-rw-r--r--drivers/net/geneve.c12
-rw-r--r--drivers/net/phy/Kconfig2
-rw-r--r--drivers/net/ppp/pppoe.c1
-rw-r--r--drivers/net/usb/Kconfig1
-rw-r--r--drivers/net/usb/asix_common.c4
-rw-r--r--drivers/net/usb/asix_devices.c4
-rw-r--r--drivers/net/vxlan.c7
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c1
-rw-r--r--drivers/net/wireless/b43/main.c1
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/lib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-7000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/d3.c27
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h5
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c1
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c1
-rw-r--r--drivers/net/wireless/rtlwifi/pci.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8821ae/hw.c17
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8821ae/sw.c5
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h3
-rw-r--r--drivers/net/xen-netback/xenbus.c6
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/inet_timewait_sock.h4
-rw-r--r--include/net/sock.h8
-rw-r--r--include/uapi/linux/openvswitch.h36
-rw-r--r--include/uapi/linux/rtnetlink.h2
-rw-r--r--net/bluetooth/hci_conn.c99
-rw-r--r--net/bluetooth/hci_core.c7
-rw-r--r--net/bluetooth/hci_event.c11
-rw-r--r--net/bluetooth/mgmt.c24
-rw-r--r--net/core/ethtool.c2
-rw-r--r--net/core/filter.c7
-rw-r--r--net/dsa/dsa.c70
-rw-r--r--net/ipv4/arp.c8
-rw-r--r--net/ipv4/inet_connection_sock.c19
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/route.c49
-rw-r--r--net/ipv6/xfrm6_policy.c1
-rw-r--r--net/mac80211/debugfs.c2
-rw-r--r--net/mac80211/status.c1
-rw-r--r--net/mac80211/tx.c7
-rw-r--r--net/netlink/af_netlink.c34
-rw-r--r--net/openvswitch/actions.c19
-rw-r--r--net/openvswitch/conntrack.c89
-rw-r--r--net/openvswitch/conntrack.h14
-rw-r--r--net/openvswitch/flow.h2
-rw-r--r--net/openvswitch/flow_netlink.c30
-rw-r--r--net/openvswitch/flow_table.c3
-rw-r--r--net/openvswitch/vport.c51
-rw-r--r--net/sched/act_mirred.c18
-rw-r--r--net/sched/sch_hhf.c11
-rw-r--r--net/switchdev/switchdev.c3
-rw-r--r--net/tipc/msg.h4
-rw-r--r--net/tipc/node.c6
-rw-r--r--net/unix/af_unix.c12
83 files changed, 668 insertions, 345 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index b8577ad9b8a2..fb7d2e4af200 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6793,7 +6793,6 @@ F: drivers/scsi/megaraid/
6793 6793
6794MELLANOX ETHERNET DRIVER (mlx4_en) 6794MELLANOX ETHERNET DRIVER (mlx4_en)
6795M: Amir Vadai <amirv@mellanox.com> 6795M: Amir Vadai <amirv@mellanox.com>
6796M: Ido Shamay <idos@mellanox.com>
6797L: netdev@vger.kernel.org 6796L: netdev@vger.kernel.org
6798S: Supported 6797S: Supported
6799W: http://www.mellanox.com 6798W: http://www.mellanox.com
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index 876060bcceeb..b8efb8cd1f73 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -614,6 +614,7 @@ load_common:
614 case BPF_LD | BPF_B | BPF_IND: 614 case BPF_LD | BPF_B | BPF_IND:
615 load_order = 0; 615 load_order = 0;
616load_ind: 616load_ind:
617 update_on_xread(ctx);
617 OP_IMM3(ARM_ADD, r_off, r_X, k, ctx); 618 OP_IMM3(ARM_ADD, r_off, r_X, k, ctx);
618 goto load_common; 619 goto load_common;
619 case BPF_LDX | BPF_IMM: 620 case BPF_LDX | BPF_IMM:
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index e5fac368068a..131026fbc2d7 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -87,6 +87,7 @@ static const struct pci_device_id peak_pci_tbl[] = {
87 {PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 87 {PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
88 {PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 88 {PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
89 {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 89 {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
90 {PEAK_PCI_VENDOR_ID, PEAK_PCIE_OEM_ID, PCI_ANY_ID, PCI_ANY_ID,},
90#ifdef CONFIG_CAN_PEAK_PCIEC 91#ifdef CONFIG_CAN_PEAK_PCIEC
91 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 92 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
92 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 93 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
index 2c063b60db4b..96f485ab612e 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
@@ -327,9 +327,13 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
327 pdata->debugfs_xpcs_reg = 0; 327 pdata->debugfs_xpcs_reg = 0;
328 328
329 buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name); 329 buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name);
330 if (!buf)
331 return;
332
330 pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL); 333 pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
331 if (!pdata->xgbe_debugfs) { 334 if (!pdata->xgbe_debugfs) {
332 netdev_err(pdata->netdev, "debugfs_create_dir failed\n"); 335 netdev_err(pdata->netdev, "debugfs_create_dir failed\n");
336 kfree(buf);
333 return; 337 return;
334 } 338 }
335 339
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index aeb7ce64452e..be628bd9fb18 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -3351,6 +3351,13 @@ static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
3351 udp_rss_requested = 0; 3351 udp_rss_requested = 0;
3352 else 3352 else
3353 return -EINVAL; 3353 return -EINVAL;
3354
3355 if (CHIP_IS_E1x(bp) && udp_rss_requested) {
3356 DP(BNX2X_MSG_ETHTOOL,
3357 "57710, 57711 boards don't support RSS according to UDP 4-tuple\n");
3358 return -EINVAL;
3359 }
3360
3354 if ((info->flow_type == UDP_V4_FLOW) && 3361 if ((info->flow_type == UDP_V4_FLOW) &&
3355 (bp->rss_conf_obj.udp_rss_v4 != udp_rss_requested)) { 3362 (bp->rss_conf_obj.udp_rss_v4 != udp_rss_requested)) {
3356 bp->rss_conf_obj.udp_rss_v4 = udp_rss_requested; 3363 bp->rss_conf_obj.udp_rss_v4 = udp_rss_requested;
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 3bc701e4c59e..1805541b4240 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1683,6 +1683,24 @@ static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
1683 bcmgenet_intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); 1683 bcmgenet_intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
1684} 1684}
1685 1685
1686static void bcmgenet_link_intr_enable(struct bcmgenet_priv *priv)
1687{
1688 u32 int0_enable = 0;
1689
1690 /* Monitor cable plug/unplugged event for internal PHY, external PHY
1691 * and MoCA PHY
1692 */
1693 if (priv->internal_phy) {
1694 int0_enable |= UMAC_IRQ_LINK_EVENT;
1695 } else if (priv->ext_phy) {
1696 int0_enable |= UMAC_IRQ_LINK_EVENT;
1697 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1698 if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
1699 int0_enable |= UMAC_IRQ_LINK_EVENT;
1700 }
1701 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
1702}
1703
1686static int init_umac(struct bcmgenet_priv *priv) 1704static int init_umac(struct bcmgenet_priv *priv)
1687{ 1705{
1688 struct device *kdev = &priv->pdev->dev; 1706 struct device *kdev = &priv->pdev->dev;
@@ -1723,15 +1741,8 @@ static int init_umac(struct bcmgenet_priv *priv)
1723 /* Enable Tx default queue 16 interrupts */ 1741 /* Enable Tx default queue 16 interrupts */
1724 int0_enable |= UMAC_IRQ_TXDMA_DONE; 1742 int0_enable |= UMAC_IRQ_TXDMA_DONE;
1725 1743
1726 /* Monitor cable plug/unplugged event for internal PHY */ 1744 /* Configure backpressure vectors for MoCA */
1727 if (priv->internal_phy) { 1745 if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1728 int0_enable |= UMAC_IRQ_LINK_EVENT;
1729 } else if (priv->ext_phy) {
1730 int0_enable |= UMAC_IRQ_LINK_EVENT;
1731 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1732 if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
1733 int0_enable |= UMAC_IRQ_LINK_EVENT;
1734
1735 reg = bcmgenet_bp_mc_get(priv); 1746 reg = bcmgenet_bp_mc_get(priv);
1736 reg |= BIT(priv->hw_params->bp_in_en_shift); 1747 reg |= BIT(priv->hw_params->bp_in_en_shift);
1737 1748
@@ -2645,6 +2656,9 @@ static void bcmgenet_netif_start(struct net_device *dev)
2645 2656
2646 netif_tx_start_all_queues(dev); 2657 netif_tx_start_all_queues(dev);
2647 2658
2659 /* Monitor link interrupts now */
2660 bcmgenet_link_intr_enable(priv);
2661
2648 phy_start(priv->phydev); 2662 phy_start(priv->phydev);
2649} 2663}
2650 2664
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 821540913343..d463563e1f70 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -592,6 +592,7 @@ struct be_adapter {
592 int be_get_temp_freq; 592 int be_get_temp_freq;
593 struct be_hwmon hwmon_info; 593 struct be_hwmon hwmon_info;
594 u8 pf_number; 594 u8 pf_number;
595 u8 pci_func_num;
595 struct rss_info rss_info; 596 struct rss_info rss_info;
596 /* Filters for packets that need to be sent to BMC */ 597 /* Filters for packets that need to be sent to BMC */
597 u32 bmc_filt_mask; 598 u32 bmc_filt_mask;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index eb323913cd39..1795c935ff02 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -851,8 +851,10 @@ static int be_cmd_notify_wait(struct be_adapter *adapter,
851 return status; 851 return status;
852 852
853 dest_wrb = be_cmd_copy(adapter, wrb); 853 dest_wrb = be_cmd_copy(adapter, wrb);
854 if (!dest_wrb) 854 if (!dest_wrb) {
855 return -EBUSY; 855 status = -EBUSY;
856 goto unlock;
857 }
856 858
857 if (use_mcc(adapter)) 859 if (use_mcc(adapter))
858 status = be_mcc_notify_wait(adapter); 860 status = be_mcc_notify_wait(adapter);
@@ -862,6 +864,7 @@ static int be_cmd_notify_wait(struct be_adapter *adapter,
862 if (!status) 864 if (!status)
863 memcpy(wrb, dest_wrb, sizeof(*wrb)); 865 memcpy(wrb, dest_wrb, sizeof(*wrb));
864 866
867unlock:
865 be_cmd_unlock(adapter); 868 be_cmd_unlock(adapter);
866 return status; 869 return status;
867} 870}
@@ -1984,6 +1987,8 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
1984 be_if_cap_flags(adapter)); 1987 be_if_cap_flags(adapter));
1985 } 1988 }
1986 flags &= be_if_cap_flags(adapter); 1989 flags &= be_if_cap_flags(adapter);
1990 if (!flags)
1991 return -ENOTSUPP;
1987 1992
1988 return __be_cmd_rx_filter(adapter, flags, value); 1993 return __be_cmd_rx_filter(adapter, flags, value);
1989} 1994}
@@ -2887,6 +2892,7 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
2887 if (!status) { 2892 if (!status) {
2888 attribs = attribs_cmd.va + sizeof(struct be_cmd_resp_hdr); 2893 attribs = attribs_cmd.va + sizeof(struct be_cmd_resp_hdr);
2889 adapter->hba_port_num = attribs->hba_attribs.phy_port; 2894 adapter->hba_port_num = attribs->hba_attribs.phy_port;
2895 adapter->pci_func_num = attribs->pci_func_num;
2890 serial_num = attribs->hba_attribs.controller_serial_number; 2896 serial_num = attribs->hba_attribs.controller_serial_number;
2891 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++) 2897 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++)
2892 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) & 2898 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) &
@@ -3709,7 +3715,6 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res)
3709 status = -EINVAL; 3715 status = -EINVAL;
3710 goto err; 3716 goto err;
3711 } 3717 }
3712
3713 adapter->pf_number = desc->pf_num; 3718 adapter->pf_number = desc->pf_num;
3714 be_copy_nic_desc(res, desc); 3719 be_copy_nic_desc(res, desc);
3715 } 3720 }
@@ -3721,7 +3726,10 @@ err:
3721 return status; 3726 return status;
3722} 3727}
3723 3728
3724/* Will use MBOX only if MCCQ has not been created */ 3729/* Will use MBOX only if MCCQ has not been created
3730 * non-zero domain => a PF is querying this on behalf of a VF
3731 * zero domain => a PF or a VF is querying this for itself
3732 */
3725int be_cmd_get_profile_config(struct be_adapter *adapter, 3733int be_cmd_get_profile_config(struct be_adapter *adapter,
3726 struct be_resources *res, u8 query, u8 domain) 3734 struct be_resources *res, u8 query, u8 domain)
3727{ 3735{
@@ -3748,10 +3756,15 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
3748 OPCODE_COMMON_GET_PROFILE_CONFIG, 3756 OPCODE_COMMON_GET_PROFILE_CONFIG,
3749 cmd.size, &wrb, &cmd); 3757 cmd.size, &wrb, &cmd);
3750 3758
3751 req->hdr.domain = domain;
3752 if (!lancer_chip(adapter)) 3759 if (!lancer_chip(adapter))
3753 req->hdr.version = 1; 3760 req->hdr.version = 1;
3754 req->type = ACTIVE_PROFILE_TYPE; 3761 req->type = ACTIVE_PROFILE_TYPE;
3762 /* When a function is querying profile information relating to
3763 * itself hdr.pf_number must be set to it's pci_func_num + 1
3764 */
3765 req->hdr.domain = domain;
3766 if (domain == 0)
3767 req->hdr.pf_num = adapter->pci_func_num + 1;
3755 3768
3756 /* When QUERY_MODIFIABLE_FIELDS_TYPE bit is set, cmd returns the 3769 /* When QUERY_MODIFIABLE_FIELDS_TYPE bit is set, cmd returns the
3757 * descriptors with all bits set to "1" for the fields which can be 3770 * descriptors with all bits set to "1" for the fields which can be
@@ -3921,12 +3934,16 @@ static void be_fill_vf_res_template(struct be_adapter *adapter,
3921 vf_if_cap_flags &= ~(BE_IF_FLAGS_RSS | 3934 vf_if_cap_flags &= ~(BE_IF_FLAGS_RSS |
3922 BE_IF_FLAGS_DEFQ_RSS); 3935 BE_IF_FLAGS_DEFQ_RSS);
3923 } 3936 }
3924
3925 nic_vft->cap_flags = cpu_to_le32(vf_if_cap_flags);
3926 } else { 3937 } else {
3927 num_vf_qs = 1; 3938 num_vf_qs = 1;
3928 } 3939 }
3929 3940
3941 if (res_mod.vf_if_cap_flags & BE_IF_FLAGS_VLAN_PROMISCUOUS) {
3942 nic_vft->flags |= BIT(IF_CAPS_FLAGS_VALID_SHIFT);
3943 vf_if_cap_flags &= ~BE_IF_FLAGS_VLAN_PROMISCUOUS;
3944 }
3945
3946 nic_vft->cap_flags = cpu_to_le32(vf_if_cap_flags);
3930 nic_vft->rq_count = cpu_to_le16(num_vf_qs); 3947 nic_vft->rq_count = cpu_to_le16(num_vf_qs);
3931 nic_vft->txq_count = cpu_to_le16(num_vf_qs); 3948 nic_vft->txq_count = cpu_to_le16(num_vf_qs);
3932 nic_vft->rssq_count = cpu_to_le16(num_vf_qs); 3949 nic_vft->rssq_count = cpu_to_le16(num_vf_qs);
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 7d178bdb112e..91155ea74f34 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -289,7 +289,9 @@ struct be_cmd_req_hdr {
289 u32 timeout; /* dword 1 */ 289 u32 timeout; /* dword 1 */
290 u32 request_length; /* dword 2 */ 290 u32 request_length; /* dword 2 */
291 u8 version; /* dword 3 */ 291 u8 version; /* dword 3 */
292 u8 rsvd[3]; /* dword 3 */ 292 u8 rsvd1; /* dword 3 */
293 u8 pf_num; /* dword 3 */
294 u8 rsvd2; /* dword 3 */
293}; 295};
294 296
295#define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ 297#define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
@@ -1652,7 +1654,11 @@ struct mgmt_hba_attribs {
1652 1654
1653struct mgmt_controller_attrib { 1655struct mgmt_controller_attrib {
1654 struct mgmt_hba_attribs hba_attribs; 1656 struct mgmt_hba_attribs hba_attribs;
1655 u32 rsvd0[10]; 1657 u32 rsvd0[2];
1658 u16 rsvd1;
1659 u8 pci_func_num;
1660 u8 rsvd2;
1661 u32 rsvd3[7];
1656} __packed; 1662} __packed;
1657 1663
1658struct be_cmd_req_cntl_attribs { 1664struct be_cmd_req_cntl_attribs {
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7bf51a1a0a77..eb48a977f8da 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1123,11 +1123,12 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,
1123 struct sk_buff *skb, 1123 struct sk_buff *skb,
1124 struct be_wrb_params *wrb_params) 1124 struct be_wrb_params *wrb_params)
1125{ 1125{
1126 /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or 1126 /* Lancer, SH and BE3 in SRIOV mode have a bug wherein
1127 * less may cause a transmit stall on that port. So the work-around is 1127 * packets that are 32b or less may cause a transmit stall
1128 * to pad short packets (<= 32 bytes) to a 36-byte length. 1128 * on that port. The workaround is to pad such packets
1129 * (len <= 32 bytes) to a minimum length of 36b.
1129 */ 1130 */
1130 if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { 1131 if (skb->len <= 32) {
1131 if (skb_put_padto(skb, 36)) 1132 if (skb_put_padto(skb, 36))
1132 return NULL; 1133 return NULL;
1133 } 1134 }
@@ -4205,10 +4206,6 @@ static int be_get_config(struct be_adapter *adapter)
4205 int status, level; 4206 int status, level;
4206 u16 profile_id; 4207 u16 profile_id;
4207 4208
4208 status = be_cmd_get_cntl_attributes(adapter);
4209 if (status)
4210 return status;
4211
4212 status = be_cmd_query_fw_cfg(adapter); 4209 status = be_cmd_query_fw_cfg(adapter);
4213 if (status) 4210 if (status)
4214 return status; 4211 return status;
@@ -4407,6 +4404,11 @@ static int be_setup(struct be_adapter *adapter)
4407 if (!lancer_chip(adapter)) 4404 if (!lancer_chip(adapter))
4408 be_cmd_req_native_mode(adapter); 4405 be_cmd_req_native_mode(adapter);
4409 4406
4407 /* Need to invoke this cmd first to get the PCI Function Number */
4408 status = be_cmd_get_cntl_attributes(adapter);
4409 if (status)
4410 return status;
4411
4410 if (!BE2_chip(adapter) && be_physfn(adapter)) 4412 if (!BE2_chip(adapter) && be_physfn(adapter))
4411 be_alloc_sriov_res(adapter); 4413 be_alloc_sriov_res(adapter);
4412 4414
@@ -4999,7 +5001,15 @@ static bool be_check_ufi_compatibility(struct be_adapter *adapter,
4999 return false; 5001 return false;
5000 } 5002 }
5001 5003
5002 return (fhdr->asic_type_rev >= adapter->asic_rev); 5004 /* In BE3 FW images the "asic_type_rev" field doesn't track the
5005 * asic_rev of the chips it is compatible with.
5006 * When asic_type_rev is 0 the image is compatible only with
5007 * pre-BE3-R chips (asic_rev < 0x10)
5008 */
5009 if (BEx_chip(adapter) && fhdr->asic_type_rev == 0)
5010 return adapter->asic_rev < 0x10;
5011 else
5012 return (fhdr->asic_type_rev >= adapter->asic_rev);
5003} 5013}
5004 5014
5005static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) 5015static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 3c40f6b99224..55c36230e176 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -198,11 +198,13 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
198 198
199#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE) 199#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
200/* 200/*
201 * Return the TBIPA address, starting from the address
202 * of the mapped GFAR MDIO registers (struct gfar)
201 * This is mildly evil, but so is our hardware for doing this. 203 * This is mildly evil, but so is our hardware for doing this.
202 * Also, we have to cast back to struct gfar because of 204 * Also, we have to cast back to struct gfar because of
203 * definition weirdness done in gianfar.h. 205 * definition weirdness done in gianfar.h.
204 */ 206 */
205static uint32_t __iomem *get_gfar_tbipa(void __iomem *p) 207static uint32_t __iomem *get_gfar_tbipa_from_mdio(void __iomem *p)
206{ 208{
207 struct gfar __iomem *enet_regs = p; 209 struct gfar __iomem *enet_regs = p;
208 210
@@ -210,6 +212,15 @@ static uint32_t __iomem *get_gfar_tbipa(void __iomem *p)
210} 212}
211 213
212/* 214/*
215 * Return the TBIPA address, starting from the address
216 * of the mapped GFAR MII registers (gfar_mii_regs[] within struct gfar)
217 */
218static uint32_t __iomem *get_gfar_tbipa_from_mii(void __iomem *p)
219{
220 return get_gfar_tbipa_from_mdio(container_of(p, struct gfar, gfar_mii_regs));
221}
222
223/*
213 * Return the TBIPAR address for an eTSEC2 node 224 * Return the TBIPAR address for an eTSEC2 node
214 */ 225 */
215static uint32_t __iomem *get_etsec_tbipa(void __iomem *p) 226static uint32_t __iomem *get_etsec_tbipa(void __iomem *p)
@@ -220,11 +231,12 @@ static uint32_t __iomem *get_etsec_tbipa(void __iomem *p)
220 231
221#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE) 232#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
222/* 233/*
223 * Return the TBIPAR address for a QE MDIO node 234 * Return the TBIPAR address for a QE MDIO node, starting from the address
235 * of the mapped MII registers (struct fsl_pq_mii)
224 */ 236 */
225static uint32_t __iomem *get_ucc_tbipa(void __iomem *p) 237static uint32_t __iomem *get_ucc_tbipa(void __iomem *p)
226{ 238{
227 struct fsl_pq_mdio __iomem *mdio = p; 239 struct fsl_pq_mdio __iomem *mdio = container_of(p, struct fsl_pq_mdio, mii);
228 240
229 return &mdio->utbipar; 241 return &mdio->utbipar;
230} 242}
@@ -300,14 +312,14 @@ static const struct of_device_id fsl_pq_mdio_match[] = {
300 .compatible = "fsl,gianfar-tbi", 312 .compatible = "fsl,gianfar-tbi",
301 .data = &(struct fsl_pq_mdio_data) { 313 .data = &(struct fsl_pq_mdio_data) {
302 .mii_offset = 0, 314 .mii_offset = 0,
303 .get_tbipa = get_gfar_tbipa, 315 .get_tbipa = get_gfar_tbipa_from_mii,
304 }, 316 },
305 }, 317 },
306 { 318 {
307 .compatible = "fsl,gianfar-mdio", 319 .compatible = "fsl,gianfar-mdio",
308 .data = &(struct fsl_pq_mdio_data) { 320 .data = &(struct fsl_pq_mdio_data) {
309 .mii_offset = 0, 321 .mii_offset = 0,
310 .get_tbipa = get_gfar_tbipa, 322 .get_tbipa = get_gfar_tbipa_from_mii,
311 }, 323 },
312 }, 324 },
313 { 325 {
@@ -315,7 +327,7 @@ static const struct of_device_id fsl_pq_mdio_match[] = {
315 .compatible = "gianfar", 327 .compatible = "gianfar",
316 .data = &(struct fsl_pq_mdio_data) { 328 .data = &(struct fsl_pq_mdio_data) {
317 .mii_offset = offsetof(struct fsl_pq_mdio, mii), 329 .mii_offset = offsetof(struct fsl_pq_mdio, mii),
318 .get_tbipa = get_gfar_tbipa, 330 .get_tbipa = get_gfar_tbipa_from_mdio,
319 }, 331 },
320 }, 332 },
321 { 333 {
@@ -445,6 +457,16 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
445 457
446 tbipa = data->get_tbipa(priv->map); 458 tbipa = data->get_tbipa(priv->map);
447 459
460 /*
461 * Add consistency check to make sure TBI is contained
462 * within the mapped range (not because we would get a
463 * segfault, rather to catch bugs in computing TBI
464 * address). Print error message but continue anyway.
465 */
466 if ((void *)tbipa > priv->map + resource_size(&res) - 4)
467 dev_err(&pdev->dev, "invalid register map (should be at least 0x%04x to contain TBI address)\n",
468 ((void *)tbipa - priv->map) + 4);
469
448 iowrite32be(be32_to_cpup(prop), tbipa); 470 iowrite32be(be32_to_cpup(prop), tbipa);
449 } 471 }
450 } 472 }
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index 62488a67149d..c0e943aecd13 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -386,7 +386,6 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
386 386
387 hw->aq.asq.next_to_use = 0; 387 hw->aq.asq.next_to_use = 0;
388 hw->aq.asq.next_to_clean = 0; 388 hw->aq.asq.next_to_clean = 0;
389 hw->aq.asq.count = hw->aq.num_asq_entries;
390 389
391 /* allocate the ring memory */ 390 /* allocate the ring memory */
392 ret_code = i40e_alloc_adminq_asq_ring(hw); 391 ret_code = i40e_alloc_adminq_asq_ring(hw);
@@ -404,6 +403,7 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
404 goto init_adminq_free_rings; 403 goto init_adminq_free_rings;
405 404
406 /* success! */ 405 /* success! */
406 hw->aq.asq.count = hw->aq.num_asq_entries;
407 goto init_adminq_exit; 407 goto init_adminq_exit;
408 408
409init_adminq_free_rings: 409init_adminq_free_rings:
@@ -445,7 +445,6 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
445 445
446 hw->aq.arq.next_to_use = 0; 446 hw->aq.arq.next_to_use = 0;
447 hw->aq.arq.next_to_clean = 0; 447 hw->aq.arq.next_to_clean = 0;
448 hw->aq.arq.count = hw->aq.num_arq_entries;
449 448
450 /* allocate the ring memory */ 449 /* allocate the ring memory */
451 ret_code = i40e_alloc_adminq_arq_ring(hw); 450 ret_code = i40e_alloc_adminq_arq_ring(hw);
@@ -463,6 +462,7 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
463 goto init_adminq_free_rings; 462 goto init_adminq_free_rings;
464 463
465 /* success! */ 464 /* success! */
465 hw->aq.arq.count = hw->aq.num_arq_entries;
466 goto init_adminq_exit; 466 goto init_adminq_exit;
467 467
468init_adminq_free_rings: 468init_adminq_free_rings:
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2fdf978ae6a5..dd44fafd8798 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -8389,6 +8389,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
8389 8389
8390 netdev->hw_enc_features |= NETIF_F_IP_CSUM | 8390 netdev->hw_enc_features |= NETIF_F_IP_CSUM |
8391 NETIF_F_GSO_UDP_TUNNEL | 8391 NETIF_F_GSO_UDP_TUNNEL |
8392 NETIF_F_GSO_GRE |
8392 NETIF_F_TSO; 8393 NETIF_F_TSO;
8393 8394
8394 netdev->features = NETIF_F_SG | 8395 netdev->features = NETIF_F_SG |
@@ -8396,6 +8397,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
8396 NETIF_F_SCTP_CSUM | 8397 NETIF_F_SCTP_CSUM |
8397 NETIF_F_HIGHDMA | 8398 NETIF_F_HIGHDMA |
8398 NETIF_F_GSO_UDP_TUNNEL | 8399 NETIF_F_GSO_UDP_TUNNEL |
8400 NETIF_F_GSO_GRE |
8399 NETIF_F_HW_VLAN_CTAG_TX | 8401 NETIF_F_HW_VLAN_CTAG_TX |
8400 NETIF_F_HW_VLAN_CTAG_RX | 8402 NETIF_F_HW_VLAN_CTAG_RX |
8401 NETIF_F_HW_VLAN_CTAG_FILTER | 8403 NETIF_F_HW_VLAN_CTAG_FILTER |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
index 929d47152bf2..a23ebfd5cd25 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
@@ -373,7 +373,6 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
373 373
374 hw->aq.asq.next_to_use = 0; 374 hw->aq.asq.next_to_use = 0;
375 hw->aq.asq.next_to_clean = 0; 375 hw->aq.asq.next_to_clean = 0;
376 hw->aq.asq.count = hw->aq.num_asq_entries;
377 376
378 /* allocate the ring memory */ 377 /* allocate the ring memory */
379 ret_code = i40e_alloc_adminq_asq_ring(hw); 378 ret_code = i40e_alloc_adminq_asq_ring(hw);
@@ -391,6 +390,7 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
391 goto init_adminq_free_rings; 390 goto init_adminq_free_rings;
392 391
393 /* success! */ 392 /* success! */
393 hw->aq.asq.count = hw->aq.num_asq_entries;
394 goto init_adminq_exit; 394 goto init_adminq_exit;
395 395
396init_adminq_free_rings: 396init_adminq_free_rings:
@@ -432,7 +432,6 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
432 432
433 hw->aq.arq.next_to_use = 0; 433 hw->aq.arq.next_to_use = 0;
434 hw->aq.arq.next_to_clean = 0; 434 hw->aq.arq.next_to_clean = 0;
435 hw->aq.arq.count = hw->aq.num_arq_entries;
436 435
437 /* allocate the ring memory */ 436 /* allocate the ring memory */
438 ret_code = i40e_alloc_adminq_arq_ring(hw); 437 ret_code = i40e_alloc_adminq_arq_ring(hw);
@@ -450,6 +449,7 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
450 goto init_adminq_free_rings; 449 goto init_adminq_free_rings;
451 450
452 /* success! */ 451 /* success! */
452 hw->aq.arq.count = hw->aq.num_arq_entries;
453 goto init_adminq_exit; 453 goto init_adminq_exit;
454 454
455init_adminq_free_rings: 455init_adminq_free_rings:
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 8e81e53c370e..c34488479365 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1364,6 +1364,10 @@ int mlx4_test_interrupts(struct mlx4_dev *dev)
1364 * and performing a NOP command 1364 * and performing a NOP command
1365 */ 1365 */
1366 for(i = 0; !err && (i < dev->caps.num_comp_vectors); ++i) { 1366 for(i = 0; !err && (i < dev->caps.num_comp_vectors); ++i) {
1367 /* Make sure request_irq was called */
1368 if (!priv->eq_table.eq[i].have_irq)
1369 continue;
1370
1367 /* Temporary use polling for command completions */ 1371 /* Temporary use polling for command completions */
1368 mlx4_cmd_use_polling(dev); 1372 mlx4_cmd_use_polling(dev);
1369 1373
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 006757f80988..cc3a9897574c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2669,14 +2669,11 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
2669 2669
2670 if (msi_x) { 2670 if (msi_x) {
2671 int nreq = dev->caps.num_ports * num_online_cpus() + 1; 2671 int nreq = dev->caps.num_ports * num_online_cpus() + 1;
2672 bool shared_ports = false;
2673 2672
2674 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, 2673 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
2675 nreq); 2674 nreq);
2676 if (nreq > MAX_MSIX) { 2675 if (nreq > MAX_MSIX)
2677 nreq = MAX_MSIX; 2676 nreq = MAX_MSIX;
2678 shared_ports = true;
2679 }
2680 2677
2681 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); 2678 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
2682 if (!entries) 2679 if (!entries)
@@ -2699,9 +2696,6 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
2699 bitmap_zero(priv->eq_table.eq[MLX4_EQ_ASYNC].actv_ports.ports, 2696 bitmap_zero(priv->eq_table.eq[MLX4_EQ_ASYNC].actv_ports.ports,
2700 dev->caps.num_ports); 2697 dev->caps.num_ports);
2701 2698
2702 if (MLX4_IS_LEGACY_EQ_MODE(dev->caps))
2703 shared_ports = true;
2704
2705 for (i = 0; i < dev->caps.num_comp_vectors + 1; i++) { 2699 for (i = 0; i < dev->caps.num_comp_vectors + 1; i++) {
2706 if (i == MLX4_EQ_ASYNC) 2700 if (i == MLX4_EQ_ASYNC)
2707 continue; 2701 continue;
@@ -2709,7 +2703,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
2709 priv->eq_table.eq[i].irq = 2703 priv->eq_table.eq[i].irq =
2710 entries[i + 1 - !!(i > MLX4_EQ_ASYNC)].vector; 2704 entries[i + 1 - !!(i > MLX4_EQ_ASYNC)].vector;
2711 2705
2712 if (shared_ports) { 2706 if (MLX4_IS_LEGACY_EQ_MODE(dev->caps)) {
2713 bitmap_fill(priv->eq_table.eq[i].actv_ports.ports, 2707 bitmap_fill(priv->eq_table.eq[i].actv_ports.ports,
2714 dev->caps.num_ports); 2708 dev->caps.num_ports);
2715 /* We don't set affinity hint when there 2709 /* We don't set affinity hint when there
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
index e71563ce05d1..22d603f78273 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
@@ -598,6 +598,8 @@ void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv)
598 return; 598 return;
599 599
600 priv->vlan.filter_disabled = false; 600 priv->vlan.filter_disabled = false;
601 if (priv->netdev->flags & IFF_PROMISC)
602 return;
601 mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0); 603 mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0);
602} 604}
603 605
@@ -607,6 +609,8 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv)
607 return; 609 return;
608 610
609 priv->vlan.filter_disabled = true; 611 priv->vlan.filter_disabled = true;
612 if (priv->netdev->flags & IFF_PROMISC)
613 return;
610 mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0); 614 mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0);
611} 615}
612 616
@@ -717,8 +721,12 @@ void mlx5e_set_rx_mode_work(struct work_struct *work)
717 bool enable_broadcast = !ea->broadcast_enabled && broadcast_enabled; 721 bool enable_broadcast = !ea->broadcast_enabled && broadcast_enabled;
718 bool disable_broadcast = ea->broadcast_enabled && !broadcast_enabled; 722 bool disable_broadcast = ea->broadcast_enabled && !broadcast_enabled;
719 723
720 if (enable_promisc) 724 if (enable_promisc) {
721 mlx5e_add_eth_addr_rule(priv, &ea->promisc, MLX5E_PROMISC); 725 mlx5e_add_eth_addr_rule(priv, &ea->promisc, MLX5E_PROMISC);
726 if (!priv->vlan.filter_disabled)
727 mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
728 0);
729 }
722 if (enable_allmulti) 730 if (enable_allmulti)
723 mlx5e_add_eth_addr_rule(priv, &ea->allmulti, MLX5E_ALLMULTI); 731 mlx5e_add_eth_addr_rule(priv, &ea->allmulti, MLX5E_ALLMULTI);
724 if (enable_broadcast) 732 if (enable_broadcast)
@@ -730,8 +738,12 @@ void mlx5e_set_rx_mode_work(struct work_struct *work)
730 mlx5e_del_eth_addr_from_flow_table(priv, &ea->broadcast); 738 mlx5e_del_eth_addr_from_flow_table(priv, &ea->broadcast);
731 if (disable_allmulti) 739 if (disable_allmulti)
732 mlx5e_del_eth_addr_from_flow_table(priv, &ea->allmulti); 740 mlx5e_del_eth_addr_from_flow_table(priv, &ea->allmulti);
733 if (disable_promisc) 741 if (disable_promisc) {
742 if (!priv->vlan.filter_disabled)
743 mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
744 0);
734 mlx5e_del_eth_addr_from_flow_table(priv, &ea->promisc); 745 mlx5e_del_eth_addr_from_flow_table(priv, &ea->promisc);
746 }
735 747
736 ea->promisc_enabled = promisc_enabled; 748 ea->promisc_enabled = promisc_enabled;
737 ea->allmulti_enabled = allmulti_enabled; 749 ea->allmulti_enabled = allmulti_enabled;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index 821caaab9bfb..3b9480fa3403 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -311,7 +311,7 @@ static int mlx5_query_port_pvlc(struct mlx5_core_dev *dev, u32 *pvlc,
311 int err; 311 int err;
312 312
313 memset(in, 0, sizeof(in)); 313 memset(in, 0, sizeof(in));
314 MLX5_SET(ptys_reg, in, local_port, local_port); 314 MLX5_SET(pvlc_reg, in, local_port, local_port);
315 315
316 err = mlx5_core_access_reg(dev, in, sizeof(in), pvlc, 316 err = mlx5_core_access_reg(dev, in, sizeof(in), pvlc,
317 pvlc_size, MLX5_REG_PVLC, 0, 0); 317 pvlc_size, MLX5_REG_PVLC, 0, 0);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index dbcaf5df8967..28c19cc1a17c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -374,26 +374,31 @@ static int __mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
374 int err; 374 int err;
375 int ret; 375 int ret;
376 376
377 mlxsw_core->emad.trans_active = true;
378
377 err = mlxsw_core_skb_transmit(mlxsw_core->driver_priv, skb, tx_info); 379 err = mlxsw_core_skb_transmit(mlxsw_core->driver_priv, skb, tx_info);
378 if (err) { 380 if (err) {
379 dev_err(mlxsw_core->bus_info->dev, "Failed to transmit EMAD (tid=%llx)\n", 381 dev_err(mlxsw_core->bus_info->dev, "Failed to transmit EMAD (tid=%llx)\n",
380 mlxsw_core->emad.tid); 382 mlxsw_core->emad.tid);
381 dev_kfree_skb(skb); 383 dev_kfree_skb(skb);
382 return err; 384 goto trans_inactive_out;
383 } 385 }
384 386
385 mlxsw_core->emad.trans_active = true;
386 ret = wait_event_timeout(mlxsw_core->emad.wait, 387 ret = wait_event_timeout(mlxsw_core->emad.wait,
387 !(mlxsw_core->emad.trans_active), 388 !(mlxsw_core->emad.trans_active),
388 msecs_to_jiffies(MLXSW_EMAD_TIMEOUT_MS)); 389 msecs_to_jiffies(MLXSW_EMAD_TIMEOUT_MS));
389 if (!ret) { 390 if (!ret) {
390 dev_warn(mlxsw_core->bus_info->dev, "EMAD timed-out (tid=%llx)\n", 391 dev_warn(mlxsw_core->bus_info->dev, "EMAD timed-out (tid=%llx)\n",
391 mlxsw_core->emad.tid); 392 mlxsw_core->emad.tid);
392 mlxsw_core->emad.trans_active = false; 393 err = -EIO;
393 return -EIO; 394 goto trans_inactive_out;
394 } 395 }
395 396
396 return 0; 397 return 0;
398
399trans_inactive_out:
400 mlxsw_core->emad.trans_active = false;
401 return err;
397} 402}
398 403
399static int mlxsw_emad_process_status(struct mlxsw_core *mlxsw_core, 404static int mlxsw_emad_process_status(struct mlxsw_core *mlxsw_core,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/item.h b/drivers/net/ethernet/mellanox/mlxsw/item.h
index ffd55d030ce2..36fb1cec53c9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/item.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/item.h
@@ -187,6 +187,7 @@ __mlxsw_item_bit_array_offset(struct mlxsw_item *item, u16 index, u8 *shift)
187{ 187{
188 u16 max_index, be_index; 188 u16 max_index, be_index;
189 u16 offset; /* byte offset inside the array */ 189 u16 offset; /* byte offset inside the array */
190 u8 in_byte_index;
190 191
191 BUG_ON(index && !item->element_size); 192 BUG_ON(index && !item->element_size);
192 if (item->offset % sizeof(u32) != 0 || 193 if (item->offset % sizeof(u32) != 0 ||
@@ -199,7 +200,8 @@ __mlxsw_item_bit_array_offset(struct mlxsw_item *item, u16 index, u8 *shift)
199 max_index = (item->size.bytes << 3) / item->element_size - 1; 200 max_index = (item->size.bytes << 3) / item->element_size - 1;
200 be_index = max_index - index; 201 be_index = max_index - index;
201 offset = be_index * item->element_size >> 3; 202 offset = be_index * item->element_size >> 3;
202 *shift = index % (BITS_PER_BYTE / item->element_size) << 1; 203 in_byte_index = index % (BITS_PER_BYTE / item->element_size);
204 *shift = in_byte_index * item->element_size;
203 205
204 return item->offset + offset; 206 return item->offset + offset;
205} 207}
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index 462cea31ecbb..cef866c37648 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -1582,11 +1582,11 @@ static int mlxsw_pci_cmd_exec(void *bus_priv, u16 opcode, u8 opcode_mod,
1582 1582
1583 if (in_mbox) 1583 if (in_mbox)
1584 memcpy(mlxsw_pci->cmd.in_mbox.buf, in_mbox, in_mbox_size); 1584 memcpy(mlxsw_pci->cmd.in_mbox.buf, in_mbox, in_mbox_size);
1585 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_HI, in_mapaddr >> 32); 1585 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_HI, upper_32_bits(in_mapaddr));
1586 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_LO, in_mapaddr); 1586 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_LO, lower_32_bits(in_mapaddr));
1587 1587
1588 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_HI, out_mapaddr >> 32); 1588 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_HI, upper_32_bits(out_mapaddr));
1589 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_LO, out_mapaddr); 1589 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_LO, lower_32_bits(out_mapaddr));
1590 1590
1591 mlxsw_pci_write32(mlxsw_pci, CIR_IN_MODIFIER, in_mod); 1591 mlxsw_pci_write32(mlxsw_pci, CIR_IN_MODIFIER, in_mod);
1592 mlxsw_pci_write32(mlxsw_pci, CIR_TOKEN, 0); 1592 mlxsw_pci_write32(mlxsw_pci, CIR_TOKEN, 0);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
index 3e52ee93438c..62cbbd1ada8d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -1069,9 +1069,9 @@ static int mlxsw_sx_port_create(struct mlxsw_sx *mlxsw_sx, u8 local_port)
1069 return 0; 1069 return 0;
1070 1070
1071err_register_netdev: 1071err_register_netdev:
1072err_port_admin_status_set:
1073err_port_mac_learning_mode_set: 1072err_port_mac_learning_mode_set:
1074err_port_stp_state_set: 1073err_port_stp_state_set:
1074err_port_admin_status_set:
1075err_port_mtu_set: 1075err_port_mtu_set:
1076err_port_speed_set: 1076err_port_speed_set:
1077err_port_swid_set: 1077err_port_swid_set:
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 66fd868152e5..b159ef8303cc 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -476,13 +476,12 @@ static void __lpc_get_mac(struct netdata_local *pldat, u8 *mac)
476 mac[5] = tmp >> 8; 476 mac[5] = tmp >> 8;
477} 477}
478 478
479static void __lpc_eth_clock_enable(struct netdata_local *pldat, 479static void __lpc_eth_clock_enable(struct netdata_local *pldat, bool enable)
480 bool enable)
481{ 480{
482 if (enable) 481 if (enable)
483 clk_enable(pldat->clk); 482 clk_prepare_enable(pldat->clk);
484 else 483 else
485 clk_disable(pldat->clk); 484 clk_disable_unprepare(pldat->clk);
486} 485}
487 486
488static void __lpc_params_setup(struct netdata_local *pldat) 487static void __lpc_params_setup(struct netdata_local *pldat)
@@ -1494,7 +1493,7 @@ err_out_free_irq:
1494err_out_iounmap: 1493err_out_iounmap:
1495 iounmap(pldat->net_base); 1494 iounmap(pldat->net_base);
1496err_out_disable_clocks: 1495err_out_disable_clocks:
1497 clk_disable(pldat->clk); 1496 clk_disable_unprepare(pldat->clk);
1498 clk_put(pldat->clk); 1497 clk_put(pldat->clk);
1499err_out_free_dev: 1498err_out_free_dev:
1500 free_netdev(ndev); 1499 free_netdev(ndev);
@@ -1519,7 +1518,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev)
1519 iounmap(pldat->net_base); 1518 iounmap(pldat->net_base);
1520 mdiobus_unregister(pldat->mii_bus); 1519 mdiobus_unregister(pldat->mii_bus);
1521 mdiobus_free(pldat->mii_bus); 1520 mdiobus_free(pldat->mii_bus);
1522 clk_disable(pldat->clk); 1521 clk_disable_unprepare(pldat->clk);
1523 clk_put(pldat->clk); 1522 clk_put(pldat->clk);
1524 free_netdev(ndev); 1523 free_netdev(ndev);
1525 1524
@@ -1540,7 +1539,7 @@ static int lpc_eth_drv_suspend(struct platform_device *pdev,
1540 if (netif_running(ndev)) { 1539 if (netif_running(ndev)) {
1541 netif_device_detach(ndev); 1540 netif_device_detach(ndev);
1542 __lpc_eth_shutdown(pldat); 1541 __lpc_eth_shutdown(pldat);
1543 clk_disable(pldat->clk); 1542 clk_disable_unprepare(pldat->clk);
1544 1543
1545 /* 1544 /*
1546 * Reset again now clock is disable to be sure 1545 * Reset again now clock is disable to be sure
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index a83263743665..2b7550c43f78 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -2134,10 +2134,11 @@ static int rhine_rx(struct net_device *dev, int limit)
2134 } 2134 }
2135 2135
2136 skb_put(skb, pkt_len); 2136 skb_put(skb, pkt_len);
2137 skb->protocol = eth_type_trans(skb, dev);
2138 2137
2139 rhine_rx_vlan_tag(skb, desc, data_size); 2138 rhine_rx_vlan_tag(skb, desc, data_size);
2140 2139
2140 skb->protocol = eth_type_trans(skb, dev);
2141
2141 netif_receive_skb(skb); 2142 netif_receive_skb(skb);
2142 2143
2143 u64_stats_update_begin(&rp->rx_stats.syncp); 2144 u64_stats_update_begin(&rp->rx_stats.syncp);
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 8f5c02eed47d..cde29f8a37bf 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -870,14 +870,14 @@ static int geneve_newlink(struct net *net, struct net_device *dev,
870 __be16 dst_port = htons(GENEVE_UDP_PORT); 870 __be16 dst_port = htons(GENEVE_UDP_PORT);
871 __u8 ttl = 0, tos = 0; 871 __u8 ttl = 0, tos = 0;
872 bool metadata = false; 872 bool metadata = false;
873 __be32 rem_addr; 873 __be32 rem_addr = 0;
874 __u32 vni; 874 __u32 vni = 0;
875 875
876 if (!data[IFLA_GENEVE_ID] || !data[IFLA_GENEVE_REMOTE]) 876 if (data[IFLA_GENEVE_ID])
877 return -EINVAL; 877 vni = nla_get_u32(data[IFLA_GENEVE_ID]);
878 878
879 vni = nla_get_u32(data[IFLA_GENEVE_ID]); 879 if (data[IFLA_GENEVE_REMOTE])
880 rem_addr = nla_get_in_addr(data[IFLA_GENEVE_REMOTE]); 880 rem_addr = nla_get_in_addr(data[IFLA_GENEVE_REMOTE]);
881 881
882 if (data[IFLA_GENEVE_TTL]) 882 if (data[IFLA_GENEVE_TTL])
883 ttl = nla_get_u8(data[IFLA_GENEVE_TTL]); 883 ttl = nla_get_u8(data[IFLA_GENEVE_TTL]);
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index c5ad98ace5d0..11e3975485c1 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -168,8 +168,6 @@ config MDIO_OCTEON
168 busses. It is required by the Octeon and ThunderX ethernet device 168 busses. It is required by the Octeon and ThunderX ethernet device
169 drivers. 169 drivers.
170 170
171 If in doubt, say Y.
172
173config MDIO_SUN4I 171config MDIO_SUN4I
174 tristate "Allwinner sun4i MDIO interface support" 172 tristate "Allwinner sun4i MDIO interface support"
175 depends on ARCH_SUNXI 173 depends on ARCH_SUNXI
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 3837ae344f63..2ed75060da50 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -313,7 +313,6 @@ static void pppoe_flush_dev(struct net_device *dev)
313 if (po->pppoe_dev == dev && 313 if (po->pppoe_dev == dev &&
314 sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { 314 sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) {
315 pppox_unbind_sock(sk); 315 pppox_unbind_sock(sk);
316 sk->sk_state = PPPOX_ZOMBIE;
317 sk->sk_state_change(sk); 316 sk->sk_state_change(sk);
318 po->pppoe_dev = NULL; 317 po->pppoe_dev = NULL;
319 dev_put(dev); 318 dev_put(dev);
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index fbb9325d1f6e..e66805eeffb4 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -164,6 +164,7 @@ config USB_NET_AX8817X
164 * Aten UC210T 164 * Aten UC210T
165 * ASIX AX88172 165 * ASIX AX88172
166 * Billionton Systems, USB2AR 166 * Billionton Systems, USB2AR
167 * Billionton Systems, GUSB2AM-1G-B
167 * Buffalo LUA-U2-KTX 168 * Buffalo LUA-U2-KTX
168 * Corega FEther USB2-TX 169 * Corega FEther USB2-TX
169 * D-Link DUB-E100 170 * D-Link DUB-E100
diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 75d6f26729a3..079069a060a6 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -91,8 +91,10 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb,
91 } 91 }
92 rx->ax_skb = netdev_alloc_skb_ip_align(dev->net, 92 rx->ax_skb = netdev_alloc_skb_ip_align(dev->net,
93 rx->size); 93 rx->size);
94 if (!rx->ax_skb) 94 if (!rx->ax_skb) {
95 rx->size = 0;
95 return 0; 96 return 0;
97 }
96 } 98 }
97 99
98 if (rx->size > dev->net->mtu + ETH_HLEN + VLAN_HLEN) { 100 if (rx->size > dev->net->mtu + ETH_HLEN + VLAN_HLEN) {
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 1173a24feda3..5cabefc23494 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -959,6 +959,10 @@ static const struct usb_device_id products [] = {
959 USB_DEVICE (0x08dd, 0x90ff), 959 USB_DEVICE (0x08dd, 0x90ff),
960 .driver_info = (unsigned long) &ax8817x_info, 960 .driver_info = (unsigned long) &ax8817x_info,
961}, { 961}, {
962 // Billionton Systems, GUSB2AM-1G-B
963 USB_DEVICE(0x08dd, 0x0114),
964 .driver_info = (unsigned long) &ax88178_info,
965}, {
962 // ATEN UC210T 966 // ATEN UC210T
963 USB_DEVICE (0x0557, 0x2009), 967 USB_DEVICE (0x0557, 0x2009),
964 .driver_info = (unsigned long) &ax8817x_info, 968 .driver_info = (unsigned long) &ax8817x_info,
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index bbac1d35ed4e..afdc65fd5bc5 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2745,11 +2745,10 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
2745 struct vxlan_config conf; 2745 struct vxlan_config conf;
2746 int err; 2746 int err;
2747 2747
2748 if (!data[IFLA_VXLAN_ID])
2749 return -EINVAL;
2750
2751 memset(&conf, 0, sizeof(conf)); 2748 memset(&conf, 0, sizeof(conf));
2752 conf.vni = nla_get_u32(data[IFLA_VXLAN_ID]); 2749
2750 if (data[IFLA_VXLAN_ID])
2751 conf.vni = nla_get_u32(data[IFLA_VXLAN_ID]);
2753 2752
2754 if (data[IFLA_VXLAN_GROUP]) { 2753 if (data[IFLA_VXLAN_GROUP]) {
2755 conf.remote_ip.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_GROUP]); 2754 conf.remote_ip.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_GROUP]);
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 23afcda2de96..678d72af4a9d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -337,7 +337,7 @@ enum ath10k_hw_rate_cck {
337#define TARGET_10X_MAX_FRAG_ENTRIES 0 337#define TARGET_10X_MAX_FRAG_ENTRIES 0
338 338
339/* 10.2 parameters */ 339/* 10.2 parameters */
340#define TARGET_10_2_DMA_BURST_SIZE 1 340#define TARGET_10_2_DMA_BURST_SIZE 0
341 341
342/* Target specific defines for WMI-TLV firmware */ 342/* Target specific defines for WMI-TLV firmware */
343#define TARGET_TLV_NUM_VDEVS 4 343#define TARGET_TLV_NUM_VDEVS 4
@@ -391,7 +391,7 @@ enum ath10k_hw_rate_cck {
391 391
392#define TARGET_10_4_TX_DBG_LOG_SIZE 1024 392#define TARGET_10_4_TX_DBG_LOG_SIZE 1024
393#define TARGET_10_4_NUM_WDS_ENTRIES 32 393#define TARGET_10_4_NUM_WDS_ENTRIES 32
394#define TARGET_10_4_DMA_BURST_SIZE 1 394#define TARGET_10_4_DMA_BURST_SIZE 0
395#define TARGET_10_4_MAC_AGGR_DELIM 0 395#define TARGET_10_4_MAC_AGGR_DELIM 0
396#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1 396#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
397#define TARGET_10_4_VOW_CONFIG 0 397#define TARGET_10_4_VOW_CONFIG 0
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 57f95f2dca5b..90eb75012e4f 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -880,6 +880,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
880 hw->max_rate_tries = 10; 880 hw->max_rate_tries = 10;
881 hw->sta_data_size = sizeof(struct ath_node); 881 hw->sta_data_size = sizeof(struct ath_node);
882 hw->vif_data_size = sizeof(struct ath_vif); 882 hw->vif_data_size = sizeof(struct ath_vif);
883 hw->extra_tx_headroom = 4;
883 884
884 hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1; 885 hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
885 hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1; 886 hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 28490702124a..71d3e9adbf3c 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -120,6 +120,7 @@ MODULE_PARM_DESC(allhwsupport, "Enable support for all hardware (even it if over
120#ifdef CONFIG_B43_BCMA 120#ifdef CONFIG_B43_BCMA
121static const struct bcma_device_id b43_bcma_tbl[] = { 121static const struct bcma_device_id b43_bcma_tbl[] = {
122 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS), 122 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS),
123 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x15, BCMA_ANY_CLASS),
123 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS), 124 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS),
124 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS), 125 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS),
125 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1C, BCMA_ANY_CLASS), 126 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1C, BCMA_ANY_CLASS),
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
index ab45819c1fbb..e18629a16fb0 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -1020,7 +1020,7 @@ static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw,
1020 u8 *pn = seq.ccmp.pn; 1020 u8 *pn = seq.ccmp.pn;
1021 1021
1022 ieee80211_get_key_rx_seq(key, i, &seq); 1022 ieee80211_get_key_rx_seq(key, i, &seq);
1023 aes_sc->pn = cpu_to_le64( 1023 aes_sc[i].pn = cpu_to_le64(
1024 (u64)pn[5] | 1024 (u64)pn[5] |
1025 ((u64)pn[4] << 8) | 1025 ((u64)pn[4] << 8) |
1026 ((u64)pn[3] << 16) | 1026 ((u64)pn[3] << 16) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
index 6951aba620eb..3fb327d5a911 100644
--- a/drivers/net/wireless/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
@@ -348,6 +348,6 @@ const struct iwl_cfg iwl7265d_n_cfg = {
348}; 348};
349 349
350MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 350MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
351MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); 351MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
352MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 352MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
353MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 353MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 04264e417c1c..576187611e61 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -274,18 +274,13 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
274 break; 274 break;
275 case WLAN_CIPHER_SUITE_CCMP: 275 case WLAN_CIPHER_SUITE_CCMP:
276 if (sta) { 276 if (sta) {
277 u8 *pn = seq.ccmp.pn; 277 u64 pn64;
278 278
279 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; 279 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc;
280 aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; 280 aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc;
281 281
282 ieee80211_get_key_tx_seq(key, &seq); 282 pn64 = atomic64_read(&key->tx_pn);
283 aes_tx_sc->pn = cpu_to_le64((u64)pn[5] | 283 aes_tx_sc->pn = cpu_to_le64(pn64);
284 ((u64)pn[4] << 8) |
285 ((u64)pn[3] << 16) |
286 ((u64)pn[2] << 24) |
287 ((u64)pn[1] << 32) |
288 ((u64)pn[0] << 40));
289 } else { 284 } else {
290 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; 285 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc;
291 } 286 }
@@ -298,12 +293,12 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
298 u8 *pn = seq.ccmp.pn; 293 u8 *pn = seq.ccmp.pn;
299 294
300 ieee80211_get_key_rx_seq(key, i, &seq); 295 ieee80211_get_key_rx_seq(key, i, &seq);
301 aes_sc->pn = cpu_to_le64((u64)pn[5] | 296 aes_sc[i].pn = cpu_to_le64((u64)pn[5] |
302 ((u64)pn[4] << 8) | 297 ((u64)pn[4] << 8) |
303 ((u64)pn[3] << 16) | 298 ((u64)pn[3] << 16) |
304 ((u64)pn[2] << 24) | 299 ((u64)pn[2] << 24) |
305 ((u64)pn[1] << 32) | 300 ((u64)pn[1] << 32) |
306 ((u64)pn[0] << 40)); 301 ((u64)pn[0] << 40));
307 } 302 }
308 data->use_rsc_tsc = true; 303 data->use_rsc_tsc = true;
309 break; 304 break;
@@ -1453,15 +1448,15 @@ static void iwl_mvm_d3_update_gtks(struct ieee80211_hw *hw,
1453 1448
1454 switch (key->cipher) { 1449 switch (key->cipher) {
1455 case WLAN_CIPHER_SUITE_CCMP: 1450 case WLAN_CIPHER_SUITE_CCMP:
1456 iwl_mvm_aes_sc_to_seq(&sc->aes.tsc, &seq);
1457 iwl_mvm_set_aes_rx_seq(sc->aes.unicast_rsc, key); 1451 iwl_mvm_set_aes_rx_seq(sc->aes.unicast_rsc, key);
1452 atomic64_set(&key->tx_pn, le64_to_cpu(sc->aes.tsc.pn));
1458 break; 1453 break;
1459 case WLAN_CIPHER_SUITE_TKIP: 1454 case WLAN_CIPHER_SUITE_TKIP:
1460 iwl_mvm_tkip_sc_to_seq(&sc->tkip.tsc, &seq); 1455 iwl_mvm_tkip_sc_to_seq(&sc->tkip.tsc, &seq);
1461 iwl_mvm_set_tkip_rx_seq(sc->tkip.unicast_rsc, key); 1456 iwl_mvm_set_tkip_rx_seq(sc->tkip.unicast_rsc, key);
1457 ieee80211_set_key_tx_seq(key, &seq);
1462 break; 1458 break;
1463 } 1459 }
1464 ieee80211_set_key_tx_seq(key, &seq);
1465 1460
1466 /* that's it for this key */ 1461 /* that's it for this key */
1467 return; 1462 return;
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index 4a0ce83315bd..5c7f7cc9ffcc 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -703,7 +703,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
703 * abort after reading the nvm in case RF Kill is on, we will complete 703 * abort after reading the nvm in case RF Kill is on, we will complete
704 * the init seq later when RF kill will switch to off 704 * the init seq later when RF kill will switch to off
705 */ 705 */
706 if (iwl_mvm_is_radio_killed(mvm)) { 706 if (iwl_mvm_is_radio_hw_killed(mvm)) {
707 IWL_DEBUG_RF_KILL(mvm, 707 IWL_DEBUG_RF_KILL(mvm,
708 "jump over all phy activities due to RF kill\n"); 708 "jump over all phy activities due to RF kill\n");
709 iwl_remove_notification(&mvm->notif_wait, &calib_wait); 709 iwl_remove_notification(&mvm->notif_wait, &calib_wait);
@@ -736,7 +736,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
736 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, 736 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
737 MVM_UCODE_CALIB_TIMEOUT); 737 MVM_UCODE_CALIB_TIMEOUT);
738 738
739 if (ret && iwl_mvm_is_radio_killed(mvm)) { 739 if (ret && iwl_mvm_is_radio_hw_killed(mvm)) {
740 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); 740 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
741 ret = 1; 741 ret = 1;
742 } 742 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index aa8c2b7f23c7..7c2944a72470 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -2388,6 +2388,7 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
2388 iwl_mvm_remove_time_event(mvm, mvmvif, 2388 iwl_mvm_remove_time_event(mvm, mvmvif,
2389 &mvmvif->time_event_data); 2389 &mvmvif->time_event_data);
2390 RCU_INIT_POINTER(mvm->csa_vif, NULL); 2390 RCU_INIT_POINTER(mvm->csa_vif, NULL);
2391 mvmvif->csa_countdown = false;
2391 } 2392 }
2392 2393
2393 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) { 2394 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) {
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index b95a07ec9e36..c754051a4cea 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -860,6 +860,11 @@ static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
860 test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); 860 test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
861} 861}
862 862
863static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)
864{
865 return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);
866}
867
863/* Must be called with rcu_read_lock() held and it can only be 868/* Must be called with rcu_read_lock() held and it can only be
864 * released when mvmsta is not needed anymore. 869 * released when mvmsta is not needed anymore.
865 */ 870 */
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index a37de3f410a0..f0cb092f980e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -590,6 +590,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
590 ieee80211_unregister_hw(mvm->hw); 590 ieee80211_unregister_hw(mvm->hw);
591 iwl_mvm_leds_exit(mvm); 591 iwl_mvm_leds_exit(mvm);
592 out_free: 592 out_free:
593 flush_delayed_work(&mvm->fw_dump_wk);
593 iwl_phy_db_free(mvm->phy_db); 594 iwl_phy_db_free(mvm->phy_db);
594 kfree(mvm->scan_cmd); 595 kfree(mvm->scan_cmd);
595 if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name) 596 if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name)
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index b0825c402c73..644b58bc5226 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -414,6 +414,11 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
414 {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)}, 414 {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)},
415 {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)}, 415 {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)},
416 {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)}, 416 {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)},
417 {IWL_PCI_DEVICE(0x095A, 0x5F10, iwl7265_2ac_cfg)},
418 {IWL_PCI_DEVICE(0x095B, 0x5212, iwl7265_2ac_cfg)},
419 {IWL_PCI_DEVICE(0x095B, 0x520A, iwl7265_2ac_cfg)},
420 {IWL_PCI_DEVICE(0x095A, 0x9000, iwl7265_2ac_cfg)},
421 {IWL_PCI_DEVICE(0x095A, 0x9400, iwl7265_2ac_cfg)},
417 422
418/* 8000 Series */ 423/* 8000 Series */
419 {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, 424 {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)},
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 5932306084fd..bf9afbf46c1b 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1114,6 +1114,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
1114 { USB_DEVICE(0x0db0, 0x871c) }, 1114 { USB_DEVICE(0x0db0, 0x871c) },
1115 { USB_DEVICE(0x0db0, 0x899a) }, 1115 { USB_DEVICE(0x0db0, 0x899a) },
1116 /* Ovislink */ 1116 /* Ovislink */
1117 { USB_DEVICE(0x1b75, 0x3070) },
1117 { USB_DEVICE(0x1b75, 0x3071) }, 1118 { USB_DEVICE(0x1b75, 0x3071) },
1118 { USB_DEVICE(0x1b75, 0x3072) }, 1119 { USB_DEVICE(0x1b75, 0x3072) },
1119 { USB_DEVICE(0x1b75, 0xa200) }, 1120 { USB_DEVICE(0x1b75, 0xa200) },
diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
index d4567d12e07e..5da6703942d9 100644
--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -247,6 +247,8 @@ struct rtl_pci {
247 /* MSI support */ 247 /* MSI support */
248 bool msi_support; 248 bool msi_support;
249 bool using_msi; 249 bool using_msi;
250 /* interrupt clear before set */
251 bool int_clear;
250}; 252};
251 253
252struct mp_adapter { 254struct mp_adapter {
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
index b7f18e2155eb..6e9418ed90c2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
@@ -2253,11 +2253,28 @@ void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci)
2253 } 2253 }
2254} 2254}
2255 2255
2256static void rtl8821ae_clear_interrupt(struct ieee80211_hw *hw)
2257{
2258 struct rtl_priv *rtlpriv = rtl_priv(hw);
2259 u32 tmp = rtl_read_dword(rtlpriv, REG_HISR);
2260
2261 rtl_write_dword(rtlpriv, REG_HISR, tmp);
2262
2263 tmp = rtl_read_dword(rtlpriv, REG_HISRE);
2264 rtl_write_dword(rtlpriv, REG_HISRE, tmp);
2265
2266 tmp = rtl_read_dword(rtlpriv, REG_HSISR);
2267 rtl_write_dword(rtlpriv, REG_HSISR, tmp);
2268}
2269
2256void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw) 2270void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw)
2257{ 2271{
2258 struct rtl_priv *rtlpriv = rtl_priv(hw); 2272 struct rtl_priv *rtlpriv = rtl_priv(hw);
2259 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2273 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
2260 2274
2275 if (!rtlpci->int_clear)
2276 rtl8821ae_clear_interrupt(hw);/*clear it here first*/
2277
2261 rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); 2278 rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF);
2262 rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); 2279 rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF);
2263 rtlpci->irq_enabled = true; 2280 rtlpci->irq_enabled = true;
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
index a4988121e1ab..8ee141a55bc5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
@@ -96,6 +96,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
96 96
97 rtl8821ae_bt_reg_init(hw); 97 rtl8821ae_bt_reg_init(hw);
98 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; 98 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
99 rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
99 rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); 100 rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
100 101
101 rtlpriv->dm.dm_initialgain_enable = 1; 102 rtlpriv->dm.dm_initialgain_enable = 1;
@@ -167,6 +168,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
167 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; 168 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
168 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; 169 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
169 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; 170 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
171 rtlpci->msi_support = rtlpriv->cfg->mod_params->int_clear;
170 if (rtlpriv->cfg->mod_params->disable_watchdog) 172 if (rtlpriv->cfg->mod_params->disable_watchdog)
171 pr_info("watchdog disabled\n"); 173 pr_info("watchdog disabled\n");
172 rtlpriv->psc.reg_fwctrl_lps = 3; 174 rtlpriv->psc.reg_fwctrl_lps = 3;
@@ -308,6 +310,7 @@ static struct rtl_mod_params rtl8821ae_mod_params = {
308 .swctrl_lps = false, 310 .swctrl_lps = false,
309 .fwctrl_lps = true, 311 .fwctrl_lps = true,
310 .msi_support = true, 312 .msi_support = true,
313 .int_clear = true,
311 .debug = DBG_EMERG, 314 .debug = DBG_EMERG,
312 .disable_watchdog = 0, 315 .disable_watchdog = 0,
313}; 316};
@@ -437,6 +440,7 @@ module_param_named(fwlps, rtl8821ae_mod_params.fwctrl_lps, bool, 0444);
437module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444); 440module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444);
438module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog, 441module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog,
439 bool, 0444); 442 bool, 0444);
443module_param_named(int_clear, rtl8821ae_mod_params.int_clear, bool, 0444);
440MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); 444MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
441MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); 445MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
442MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); 446MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
@@ -444,6 +448,7 @@ MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
444MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n"); 448MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n");
445MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 449MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
446MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n"); 450MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n");
451MODULE_PARM_DESC(int_clear, "Set to 1 to disable interrupt clear before set (default 0)\n");
447 452
448static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); 453static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
449 454
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index b90ca618b123..4544752a2ba8 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -2249,6 +2249,9 @@ struct rtl_mod_params {
2249 2249
2250 /* default 0: 1 means disable */ 2250 /* default 0: 1 means disable */
2251 bool disable_watchdog; 2251 bool disable_watchdog;
2252
2253 /* default 0: 1 means do not disable interrupts */
2254 bool int_clear;
2252}; 2255};
2253 2256
2254struct rtl_hal_usbint_cfg { 2257struct rtl_hal_usbint_cfg {
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 929a6e7e5ecf..56ebd8267386 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -788,6 +788,12 @@ static void connect(struct backend_info *be)
788 /* Use the number of queues requested by the frontend */ 788 /* Use the number of queues requested by the frontend */
789 be->vif->queues = vzalloc(requested_num_queues * 789 be->vif->queues = vzalloc(requested_num_queues *
790 sizeof(struct xenvif_queue)); 790 sizeof(struct xenvif_queue));
791 if (!be->vif->queues) {
792 xenbus_dev_fatal(dev, -ENOMEM,
793 "allocating queues");
794 return;
795 }
796
791 be->vif->num_queues = requested_num_queues; 797 be->vif->num_queues = requested_num_queues;
792 be->vif->stalled_queues = requested_num_queues; 798 be->vif->stalled_queues = requested_num_queues;
793 799
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index cb1b9bbda332..b36d837c701e 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -64,7 +64,7 @@ struct unix_sock {
64 struct socket_wq peer_wq; 64 struct socket_wq peer_wq;
65}; 65};
66 66
67static inline struct unix_sock *unix_sk(struct sock *sk) 67static inline struct unix_sock *unix_sk(const struct sock *sk)
68{ 68{
69 return (struct unix_sock *)sk; 69 return (struct unix_sock *)sk;
70} 70}
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 186f3a1e1b1f..fc1937698625 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -113,12 +113,12 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
113void __inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo, 113void __inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo,
114 bool rearm); 114 bool rearm);
115 115
116static void inline inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo) 116static inline void inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo)
117{ 117{
118 __inet_twsk_schedule(tw, timeo, false); 118 __inet_twsk_schedule(tw, timeo, false);
119} 119}
120 120
121static void inline inet_twsk_reschedule(struct inet_timewait_sock *tw, int timeo) 121static inline void inet_twsk_reschedule(struct inet_timewait_sock *tw, int timeo)
122{ 122{
123 __inet_twsk_schedule(tw, timeo, true); 123 __inet_twsk_schedule(tw, timeo, true);
124} 124}
diff --git a/include/net/sock.h b/include/net/sock.h
index 7aa78440559a..e23717013a4e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -828,6 +828,14 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s
828 if (sk_rcvqueues_full(sk, limit)) 828 if (sk_rcvqueues_full(sk, limit))
829 return -ENOBUFS; 829 return -ENOBUFS;
830 830
831 /*
832 * If the skb was allocated from pfmemalloc reserves, only
833 * allow SOCK_MEMALLOC sockets to use it as this socket is
834 * helping free memory
835 */
836 if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC))
837 return -ENOMEM;
838
831 __sk_add_backlog(sk, skb); 839 __sk_add_backlog(sk, skb);
832 sk->sk_backlog.len += skb->truesize; 840 sk->sk_backlog.len += skb->truesize;
833 return 0; 841 return 0;
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 32e07d8cbaf4..036f73bc54cd 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -323,10 +323,10 @@ enum ovs_key_attr {
323 OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls. 323 OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls.
324 * The implementation may restrict 324 * The implementation may restrict
325 * the accepted length of the array. */ 325 * the accepted length of the array. */
326 OVS_KEY_ATTR_CT_STATE, /* u8 bitmask of OVS_CS_F_* */ 326 OVS_KEY_ATTR_CT_STATE, /* u32 bitmask of OVS_CS_F_* */
327 OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */ 327 OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */
328 OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */ 328 OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */
329 OVS_KEY_ATTR_CT_LABEL, /* 16-octet connection tracking label */ 329 OVS_KEY_ATTR_CT_LABELS, /* 16-octet connection tracking label */
330 330
331#ifdef __KERNEL__ 331#ifdef __KERNEL__
332 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ip_tunnel_info */ 332 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ip_tunnel_info */
@@ -439,9 +439,9 @@ struct ovs_key_nd {
439 __u8 nd_tll[ETH_ALEN]; 439 __u8 nd_tll[ETH_ALEN];
440}; 440};
441 441
442#define OVS_CT_LABEL_LEN 16 442#define OVS_CT_LABELS_LEN 16
443struct ovs_key_ct_label { 443struct ovs_key_ct_labels {
444 __u8 ct_label[OVS_CT_LABEL_LEN]; 444 __u8 ct_labels[OVS_CT_LABELS_LEN];
445}; 445};
446 446
447/* OVS_KEY_ATTR_CT_STATE flags */ 447/* OVS_KEY_ATTR_CT_STATE flags */
@@ -449,9 +449,9 @@ struct ovs_key_ct_label {
449#define OVS_CS_F_ESTABLISHED 0x02 /* Part of an existing connection. */ 449#define OVS_CS_F_ESTABLISHED 0x02 /* Part of an existing connection. */
450#define OVS_CS_F_RELATED 0x04 /* Related to an established 450#define OVS_CS_F_RELATED 0x04 /* Related to an established
451 * connection. */ 451 * connection. */
452#define OVS_CS_F_INVALID 0x20 /* Could not track connection. */ 452#define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */
453#define OVS_CS_F_REPLY_DIR 0x40 /* Flow is in the reply direction. */ 453#define OVS_CS_F_INVALID 0x10 /* Could not track connection. */
454#define OVS_CS_F_TRACKED 0x80 /* Conntrack has occurred. */ 454#define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */
455 455
456/** 456/**
457 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. 457 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
@@ -618,22 +618,24 @@ struct ovs_action_hash {
618 618
619/** 619/**
620 * enum ovs_ct_attr - Attributes for %OVS_ACTION_ATTR_CT action. 620 * enum ovs_ct_attr - Attributes for %OVS_ACTION_ATTR_CT action.
621 * @OVS_CT_ATTR_FLAGS: u32 connection tracking flags. 621 * @OVS_CT_ATTR_COMMIT: If present, commits the connection to the conntrack
622 * table. This allows future packets for the same connection to be identified
623 * as 'established' or 'related'.
622 * @OVS_CT_ATTR_ZONE: u16 connection tracking zone. 624 * @OVS_CT_ATTR_ZONE: u16 connection tracking zone.
623 * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the 625 * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the
624 * mask, the corresponding bit in the value is copied to the connection 626 * mask, the corresponding bit in the value is copied to the connection
625 * tracking mark field in the connection. 627 * tracking mark field in the connection.
626 * @OVS_CT_ATTR_LABEL: %OVS_CT_LABEL_LEN value followed by %OVS_CT_LABEL_LEN 628 * @OVS_CT_ATTR_LABEL: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN
627 * mask. For each bit set in the mask, the corresponding bit in the value is 629 * mask. For each bit set in the mask, the corresponding bit in the value is
628 * copied to the connection tracking label field in the connection. 630 * copied to the connection tracking label field in the connection.
629 * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. 631 * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG.
630 */ 632 */
631enum ovs_ct_attr { 633enum ovs_ct_attr {
632 OVS_CT_ATTR_UNSPEC, 634 OVS_CT_ATTR_UNSPEC,
633 OVS_CT_ATTR_FLAGS, /* u8 bitmask of OVS_CT_F_*. */ 635 OVS_CT_ATTR_COMMIT, /* No argument, commits connection. */
634 OVS_CT_ATTR_ZONE, /* u16 zone id. */ 636 OVS_CT_ATTR_ZONE, /* u16 zone id. */
635 OVS_CT_ATTR_MARK, /* mark to associate with this connection. */ 637 OVS_CT_ATTR_MARK, /* mark to associate with this connection. */
636 OVS_CT_ATTR_LABEL, /* label to associate with this connection. */ 638 OVS_CT_ATTR_LABELS, /* labels to associate with this connection. */
637 OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of 639 OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of
638 related connections. */ 640 related connections. */
639 __OVS_CT_ATTR_MAX 641 __OVS_CT_ATTR_MAX
@@ -641,14 +643,6 @@ enum ovs_ct_attr {
641 643
642#define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1) 644#define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1)
643 645
644/*
645 * OVS_CT_ATTR_FLAGS flags - bitmask of %OVS_CT_F_*
646 * @OVS_CT_F_COMMIT: Commits the flow to the conntrack table. This allows
647 * future packets for the same connection to be identified as 'established'
648 * or 'related'.
649 */
650#define OVS_CT_F_COMMIT 0x01
651
652/** 646/**
653 * enum ovs_action_attr - Action types. 647 * enum ovs_action_attr - Action types.
654 * 648 *
@@ -705,7 +699,7 @@ enum ovs_action_attr {
705 * data immediately followed by a mask. 699 * data immediately followed by a mask.
706 * The data must be zero for the unmasked 700 * The data must be zero for the unmasked
707 * bits. */ 701 * bits. */
708 OVS_ACTION_ATTR_CT, /* One nested OVS_CT_ATTR_* . */ 702 OVS_ACTION_ATTR_CT, /* Nested OVS_CT_ATTR_* . */
709 703
710 __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted 704 __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted
711 * from userspace. */ 705 * from userspace. */
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 702024769c74..9d8f5d10c1e5 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -160,7 +160,7 @@ struct rtattr {
160 160
161/* Macros to handle rtattributes */ 161/* Macros to handle rtattributes */
162 162
163#define RTA_ALIGNTO 4 163#define RTA_ALIGNTO 4U
164#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) 164#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
165#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ 165#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
166 (rta)->rta_len >= sizeof(struct rtattr) && \ 166 (rta)->rta_len >= sizeof(struct rtattr) && \
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b4548c739a64..2dda439c8cb8 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -91,10 +91,50 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn)
91 * autoconnect action, remove them completely. If they are, just unmark 91 * autoconnect action, remove them completely. If they are, just unmark
92 * them as waiting for connection, by clearing explicit_connect field. 92 * them as waiting for connection, by clearing explicit_connect field.
93 */ 93 */
94 if (params->auto_connect == HCI_AUTO_CONN_EXPLICIT) 94 params->explicit_connect = false;
95
96 list_del_init(&params->action);
97
98 switch (params->auto_connect) {
99 case HCI_AUTO_CONN_EXPLICIT:
95 hci_conn_params_del(conn->hdev, bdaddr, bdaddr_type); 100 hci_conn_params_del(conn->hdev, bdaddr, bdaddr_type);
96 else 101 /* return instead of break to avoid duplicate scan update */
97 params->explicit_connect = false; 102 return;
103 case HCI_AUTO_CONN_DIRECT:
104 case HCI_AUTO_CONN_ALWAYS:
105 list_add(&params->action, &conn->hdev->pend_le_conns);
106 break;
107 case HCI_AUTO_CONN_REPORT:
108 list_add(&params->action, &conn->hdev->pend_le_reports);
109 break;
110 default:
111 break;
112 }
113
114 hci_update_background_scan(conn->hdev);
115}
116
117static void hci_conn_cleanup(struct hci_conn *conn)
118{
119 struct hci_dev *hdev = conn->hdev;
120
121 if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags))
122 hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type);
123
124 hci_chan_list_flush(conn);
125
126 hci_conn_hash_del(hdev, conn);
127
128 if (hdev->notify)
129 hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
130
131 hci_conn_del_sysfs(conn);
132
133 debugfs_remove_recursive(conn->debugfs);
134
135 hci_dev_put(hdev);
136
137 hci_conn_put(conn);
98} 138}
99 139
100/* This function requires the caller holds hdev->lock */ 140/* This function requires the caller holds hdev->lock */
@@ -102,8 +142,13 @@ static void hci_connect_le_scan_remove(struct hci_conn *conn)
102{ 142{
103 hci_connect_le_scan_cleanup(conn); 143 hci_connect_le_scan_cleanup(conn);
104 144
105 hci_conn_hash_del(conn->hdev, conn); 145 /* We can't call hci_conn_del here since that would deadlock
106 hci_update_background_scan(conn->hdev); 146 * with trying to call cancel_delayed_work_sync(&conn->disc_work).
147 * Instead, call just hci_conn_cleanup() which contains the bare
148 * minimum cleanup operations needed for a connection in this
149 * state.
150 */
151 hci_conn_cleanup(conn);
107} 152}
108 153
109static void hci_acl_create_connection(struct hci_conn *conn) 154static void hci_acl_create_connection(struct hci_conn *conn)
@@ -581,27 +626,17 @@ int hci_conn_del(struct hci_conn *conn)
581 } 626 }
582 } 627 }
583 628
584 hci_chan_list_flush(conn);
585
586 if (conn->amp_mgr) 629 if (conn->amp_mgr)
587 amp_mgr_put(conn->amp_mgr); 630 amp_mgr_put(conn->amp_mgr);
588 631
589 hci_conn_hash_del(hdev, conn);
590 if (hdev->notify)
591 hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
592
593 skb_queue_purge(&conn->data_q); 632 skb_queue_purge(&conn->data_q);
594 633
595 hci_conn_del_sysfs(conn); 634 /* Remove the connection from the list and cleanup its remaining
596 635 * state. This is a separate function since for some cases like
597 debugfs_remove_recursive(conn->debugfs); 636 * BT_CONNECT_SCAN we *only* want the cleanup part without the
598 637 * rest of hci_conn_del.
599 if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags)) 638 */
600 hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type); 639 hci_conn_cleanup(conn);
601
602 hci_dev_put(hdev);
603
604 hci_conn_put(conn);
605 640
606 return 0; 641 return 0;
607} 642}
@@ -973,15 +1008,23 @@ static int hci_explicit_conn_params_set(struct hci_request *req,
973 if (is_connected(hdev, addr, addr_type)) 1008 if (is_connected(hdev, addr, addr_type))
974 return -EISCONN; 1009 return -EISCONN;
975 1010
976 params = hci_conn_params_add(hdev, addr, addr_type); 1011 params = hci_conn_params_lookup(hdev, addr, addr_type);
977 if (!params) 1012 if (!params) {
978 return -EIO; 1013 params = hci_conn_params_add(hdev, addr, addr_type);
1014 if (!params)
1015 return -ENOMEM;
979 1016
980 /* If we created new params, or existing params were marked as disabled, 1017 /* If we created new params, mark them to be deleted in
981 * mark them to be used just once to connect. 1018 * hci_connect_le_scan_cleanup. It's different case than
982 */ 1019 * existing disabled params, those will stay after cleanup.
983 if (params->auto_connect == HCI_AUTO_CONN_DISABLED) { 1020 */
984 params->auto_connect = HCI_AUTO_CONN_EXPLICIT; 1021 params->auto_connect = HCI_AUTO_CONN_EXPLICIT;
1022 }
1023
1024 /* We're trying to connect, so make sure params are at pend_le_conns */
1025 if (params->auto_connect == HCI_AUTO_CONN_DISABLED ||
1026 params->auto_connect == HCI_AUTO_CONN_REPORT ||
1027 params->auto_connect == HCI_AUTO_CONN_EXPLICIT) {
985 list_del_init(&params->action); 1028 list_del_init(&params->action);
986 list_add(&params->action, &hdev->pend_le_conns); 1029 list_add(&params->action, &hdev->pend_le_conns);
987 } 1030 }
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index adcbc74c2432..e837539452fb 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2861,13 +2861,6 @@ struct hci_conn_params *hci_explicit_connect_lookup(struct hci_dev *hdev,
2861 return param; 2861 return param;
2862 } 2862 }
2863 2863
2864 list_for_each_entry(param, &hdev->pend_le_reports, action) {
2865 if (bacmp(&param->addr, addr) == 0 &&
2866 param->addr_type == addr_type &&
2867 param->explicit_connect)
2868 return param;
2869 }
2870
2871 return NULL; 2864 return NULL;
2872} 2865}
2873 2866
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 186041866315..bc31099d3b5b 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -55,7 +55,12 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
55 wake_up_bit(&hdev->flags, HCI_INQUIRY); 55 wake_up_bit(&hdev->flags, HCI_INQUIRY);
56 56
57 hci_dev_lock(hdev); 57 hci_dev_lock(hdev);
58 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); 58 /* Set discovery state to stopped if we're not doing LE active
59 * scanning.
60 */
61 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN) ||
62 hdev->le_scan_type != LE_SCAN_ACTIVE)
63 hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
59 hci_dev_unlock(hdev); 64 hci_dev_unlock(hdev);
60 65
61 hci_conn_check_pending(hdev); 66 hci_conn_check_pending(hdev);
@@ -4648,8 +4653,8 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
4648 /* If we're not connectable only connect devices that we have in 4653 /* If we're not connectable only connect devices that we have in
4649 * our pend_le_conns list. 4654 * our pend_le_conns list.
4650 */ 4655 */
4651 params = hci_explicit_connect_lookup(hdev, addr, addr_type); 4656 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, addr,
4652 4657 addr_type);
4653 if (!params) 4658 if (!params)
4654 return NULL; 4659 return NULL;
4655 4660
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ccaf5a436d8f..c4fe2fee753f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3545,6 +3545,7 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3545 auth_type); 3545 auth_type);
3546 } else { 3546 } else {
3547 u8 addr_type; 3547 u8 addr_type;
3548 struct hci_conn_params *p;
3548 3549
3549 /* Convert from L2CAP channel address type to HCI address type 3550 /* Convert from L2CAP channel address type to HCI address type
3550 */ 3551 */
@@ -3562,7 +3563,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3562 * If connection parameters already exist, then they 3563 * If connection parameters already exist, then they
3563 * will be kept and this function does nothing. 3564 * will be kept and this function does nothing.
3564 */ 3565 */
3565 hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type); 3566 p = hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type);
3567
3568 if (p->auto_connect == HCI_AUTO_CONN_EXPLICIT)
3569 p->auto_connect = HCI_AUTO_CONN_DISABLED;
3566 3570
3567 conn = hci_connect_le_scan(hdev, &cp->addr.bdaddr, 3571 conn = hci_connect_le_scan(hdev, &cp->addr.bdaddr,
3568 addr_type, sec_level, 3572 addr_type, sec_level,
@@ -6117,14 +6121,21 @@ static int hci_conn_params_set(struct hci_request *req, bdaddr_t *addr,
6117 __hci_update_background_scan(req); 6121 __hci_update_background_scan(req);
6118 break; 6122 break;
6119 case HCI_AUTO_CONN_REPORT: 6123 case HCI_AUTO_CONN_REPORT:
6120 list_add(&params->action, &hdev->pend_le_reports); 6124 if (params->explicit_connect)
6125 list_add(&params->action, &hdev->pend_le_conns);
6126 else
6127 list_add(&params->action, &hdev->pend_le_reports);
6121 __hci_update_background_scan(req); 6128 __hci_update_background_scan(req);
6122 break; 6129 break;
6123 case HCI_AUTO_CONN_DIRECT: 6130 case HCI_AUTO_CONN_DIRECT:
6124 case HCI_AUTO_CONN_ALWAYS: 6131 case HCI_AUTO_CONN_ALWAYS:
6125 if (!is_connected(hdev, addr, addr_type)) { 6132 if (!is_connected(hdev, addr, addr_type)) {
6126 list_add(&params->action, &hdev->pend_le_conns); 6133 list_add(&params->action, &hdev->pend_le_conns);
6127 __hci_update_background_scan(req); 6134 /* If we are in scan phase of connecting, we were
6135 * already added to pend_le_conns and scanning.
6136 */
6137 if (params->auto_connect != HCI_AUTO_CONN_EXPLICIT)
6138 __hci_update_background_scan(req);
6128 } 6139 }
6129 break; 6140 break;
6130 } 6141 }
@@ -6379,7 +6390,8 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
6379 goto unlock; 6390 goto unlock;
6380 } 6391 }
6381 6392
6382 if (params->auto_connect == HCI_AUTO_CONN_DISABLED) { 6393 if (params->auto_connect == HCI_AUTO_CONN_DISABLED ||
6394 params->auto_connect == HCI_AUTO_CONN_EXPLICIT) {
6383 err = cmd->cmd_complete(cmd, 6395 err = cmd->cmd_complete(cmd,
6384 MGMT_STATUS_INVALID_PARAMS); 6396 MGMT_STATUS_INVALID_PARAMS);
6385 mgmt_pending_remove(cmd); 6397 mgmt_pending_remove(cmd);
@@ -6415,6 +6427,10 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
6415 if (p->auto_connect == HCI_AUTO_CONN_DISABLED) 6427 if (p->auto_connect == HCI_AUTO_CONN_DISABLED)
6416 continue; 6428 continue;
6417 device_removed(sk, hdev, &p->addr, p->addr_type); 6429 device_removed(sk, hdev, &p->addr, p->addr_type);
6430 if (p->explicit_connect) {
6431 p->auto_connect = HCI_AUTO_CONN_EXPLICIT;
6432 continue;
6433 }
6418 list_del(&p->action); 6434 list_del(&p->action);
6419 list_del(&p->list); 6435 list_del(&p->list);
6420 kfree(p); 6436 kfree(p);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index b495ab1797fa..29edf74846fc 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1284,7 +1284,7 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
1284 1284
1285 gstrings.len = ret; 1285 gstrings.len = ret;
1286 1286
1287 data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); 1287 data = kcalloc(gstrings.len, ETH_GSTRING_LEN, GFP_USER);
1288 if (!data) 1288 if (!data)
1289 return -ENOMEM; 1289 return -ENOMEM;
1290 1290
diff --git a/net/core/filter.c b/net/core/filter.c
index 05a04ea87172..bb18c3680001 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -1415,6 +1415,7 @@ static u64 bpf_clone_redirect(u64 r1, u64 ifindex, u64 flags, u64 r4, u64 r5)
1415 return dev_forward_skb(dev, skb2); 1415 return dev_forward_skb(dev, skb2);
1416 1416
1417 skb2->dev = dev; 1417 skb2->dev = dev;
1418 skb_sender_cpu_clear(skb2);
1418 return dev_queue_xmit(skb2); 1419 return dev_queue_xmit(skb2);
1419} 1420}
1420 1421
@@ -1854,9 +1855,13 @@ int sk_get_filter(struct sock *sk, struct sock_filter __user *ubuf,
1854 goto out; 1855 goto out;
1855 1856
1856 /* We're copying the filter that has been originally attached, 1857 /* We're copying the filter that has been originally attached,
1857 * so no conversion/decode needed anymore. 1858 * so no conversion/decode needed anymore. eBPF programs that
1859 * have no original program cannot be dumped through this.
1858 */ 1860 */
1861 ret = -EACCES;
1859 fprog = filter->prog->orig_prog; 1862 fprog = filter->prog->orig_prog;
1863 if (!fprog)
1864 goto out;
1860 1865
1861 ret = fprog->len; 1866 ret = fprog->len;
1862 if (!len) 1867 if (!len)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index c59fa5d9c22c..adb5325f4934 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -22,6 +22,7 @@
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/of_net.h> 23#include <linux/of_net.h>
24#include <linux/sysfs.h> 24#include <linux/sysfs.h>
25#include <linux/phy_fixed.h>
25#include "dsa_priv.h" 26#include "dsa_priv.h"
26 27
27char dsa_driver_version[] = "0.1"; 28char dsa_driver_version[] = "0.1";
@@ -305,7 +306,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
305 if (ret < 0) 306 if (ret < 0)
306 goto out; 307 goto out;
307 308
308 ds->slave_mii_bus = mdiobus_alloc(); 309 ds->slave_mii_bus = devm_mdiobus_alloc(parent);
309 if (ds->slave_mii_bus == NULL) { 310 if (ds->slave_mii_bus == NULL) {
310 ret = -ENOMEM; 311 ret = -ENOMEM;
311 goto out; 312 goto out;
@@ -314,7 +315,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
314 315
315 ret = mdiobus_register(ds->slave_mii_bus); 316 ret = mdiobus_register(ds->slave_mii_bus);
316 if (ret < 0) 317 if (ret < 0)
317 goto out_free; 318 goto out;
318 319
319 320
320 /* 321 /*
@@ -367,10 +368,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
367 368
368 return ret; 369 return ret;
369 370
370out_free:
371 mdiobus_free(ds->slave_mii_bus);
372out: 371out:
373 kfree(ds);
374 return ret; 372 return ret;
375} 373}
376 374
@@ -400,7 +398,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
400 /* 398 /*
401 * Allocate and initialise switch state. 399 * Allocate and initialise switch state.
402 */ 400 */
403 ds = kzalloc(sizeof(*ds) + drv->priv_size, GFP_KERNEL); 401 ds = devm_kzalloc(parent, sizeof(*ds) + drv->priv_size, GFP_KERNEL);
404 if (ds == NULL) 402 if (ds == NULL)
405 return ERR_PTR(-ENOMEM); 403 return ERR_PTR(-ENOMEM);
406 404
@@ -420,10 +418,47 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
420 418
421static void dsa_switch_destroy(struct dsa_switch *ds) 419static void dsa_switch_destroy(struct dsa_switch *ds)
422{ 420{
421 struct device_node *port_dn;
422 struct phy_device *phydev;
423 struct dsa_chip_data *cd = ds->pd;
424 int port;
425
423#ifdef CONFIG_NET_DSA_HWMON 426#ifdef CONFIG_NET_DSA_HWMON
424 if (ds->hwmon_dev) 427 if (ds->hwmon_dev)
425 hwmon_device_unregister(ds->hwmon_dev); 428 hwmon_device_unregister(ds->hwmon_dev);
426#endif 429#endif
430
431 /* Disable configuration of the CPU and DSA ports */
432 for (port = 0; port < DSA_MAX_PORTS; port++) {
433 if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)))
434 continue;
435
436 port_dn = cd->port_dn[port];
437 if (of_phy_is_fixed_link(port_dn)) {
438 phydev = of_phy_find_device(port_dn);
439 if (phydev) {
440 int addr = phydev->addr;
441
442 phy_device_free(phydev);
443 of_node_put(port_dn);
444 fixed_phy_del(addr);
445 }
446 }
447 }
448
449 /* Destroy network devices for physical switch ports. */
450 for (port = 0; port < DSA_MAX_PORTS; port++) {
451 if (!(ds->phys_port_mask & (1 << port)))
452 continue;
453
454 if (!ds->ports[port])
455 continue;
456
457 unregister_netdev(ds->ports[port]);
458 free_netdev(ds->ports[port]);
459 }
460
461 mdiobus_unregister(ds->slave_mii_bus);
427} 462}
428 463
429#ifdef CONFIG_PM_SLEEP 464#ifdef CONFIG_PM_SLEEP
@@ -802,10 +837,11 @@ static inline void dsa_of_remove(struct device *dev)
802} 837}
803#endif 838#endif
804 839
805static void dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev, 840static int dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,
806 struct device *parent, struct dsa_platform_data *pd) 841 struct device *parent, struct dsa_platform_data *pd)
807{ 842{
808 int i; 843 int i;
844 unsigned configured = 0;
809 845
810 dst->pd = pd; 846 dst->pd = pd;
811 dst->master_netdev = dev; 847 dst->master_netdev = dev;
@@ -825,9 +861,17 @@ static void dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,
825 dst->ds[i] = ds; 861 dst->ds[i] = ds;
826 if (ds->drv->poll_link != NULL) 862 if (ds->drv->poll_link != NULL)
827 dst->link_poll_needed = 1; 863 dst->link_poll_needed = 1;
864
865 ++configured;
828 } 866 }
829 867
830 /* 868 /*
869 * If no switch was found, exit cleanly
870 */
871 if (!configured)
872 return -EPROBE_DEFER;
873
874 /*
831 * If we use a tagging format that doesn't have an ethertype 875 * If we use a tagging format that doesn't have an ethertype
832 * field, make sure that all packets from this point on get 876 * field, make sure that all packets from this point on get
833 * sent to the tag format's receive function. 877 * sent to the tag format's receive function.
@@ -843,6 +887,8 @@ static void dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,
843 dst->link_poll_timer.expires = round_jiffies(jiffies + HZ); 887 dst->link_poll_timer.expires = round_jiffies(jiffies + HZ);
844 add_timer(&dst->link_poll_timer); 888 add_timer(&dst->link_poll_timer);
845 } 889 }
890
891 return 0;
846} 892}
847 893
848static int dsa_probe(struct platform_device *pdev) 894static int dsa_probe(struct platform_device *pdev)
@@ -883,7 +929,7 @@ static int dsa_probe(struct platform_device *pdev)
883 goto out; 929 goto out;
884 } 930 }
885 931
886 dst = kzalloc(sizeof(*dst), GFP_KERNEL); 932 dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
887 if (dst == NULL) { 933 if (dst == NULL) {
888 dev_put(dev); 934 dev_put(dev);
889 ret = -ENOMEM; 935 ret = -ENOMEM;
@@ -892,7 +938,9 @@ static int dsa_probe(struct platform_device *pdev)
892 938
893 platform_set_drvdata(pdev, dst); 939 platform_set_drvdata(pdev, dst);
894 940
895 dsa_setup_dst(dst, dev, &pdev->dev, pd); 941 ret = dsa_setup_dst(dst, dev, &pdev->dev, pd);
942 if (ret)
943 goto out;
896 944
897 return 0; 945 return 0;
898 946
@@ -914,7 +962,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
914 for (i = 0; i < dst->pd->nr_chips; i++) { 962 for (i = 0; i < dst->pd->nr_chips; i++) {
915 struct dsa_switch *ds = dst->ds[i]; 963 struct dsa_switch *ds = dst->ds[i];
916 964
917 if (ds != NULL) 965 if (ds)
918 dsa_switch_destroy(ds); 966 dsa_switch_destroy(ds);
919 } 967 }
920} 968}
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index f03db8b7abee..0c9c3482e419 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -312,7 +312,7 @@ static void arp_send_dst(int type, int ptype, __be32 dest_ip,
312 if (!skb) 312 if (!skb)
313 return; 313 return;
314 314
315 skb_dst_set(skb, dst); 315 skb_dst_set(skb, dst_clone(dst));
316 arp_xmit(skb); 316 arp_xmit(skb);
317} 317}
318 318
@@ -384,7 +384,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
384 } 384 }
385 385
386 if (skb && !(dev->priv_flags & IFF_XMIT_DST_RELEASE)) 386 if (skb && !(dev->priv_flags & IFF_XMIT_DST_RELEASE))
387 dst = dst_clone(skb_dst(skb)); 387 dst = skb_dst(skb);
388 arp_send_dst(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, 388 arp_send_dst(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
389 dst_hw, dev->dev_addr, NULL, dst); 389 dst_hw, dev->dev_addr, NULL, dst);
390} 390}
@@ -811,7 +811,7 @@ static int arp_process(struct sock *sk, struct sk_buff *skb)
811 } else { 811 } else {
812 pneigh_enqueue(&arp_tbl, 812 pneigh_enqueue(&arp_tbl,
813 in_dev->arp_parms, skb); 813 in_dev->arp_parms, skb);
814 return 0; 814 goto out_free_dst;
815 } 815 }
816 goto out; 816 goto out;
817 } 817 }
@@ -865,6 +865,8 @@ static int arp_process(struct sock *sk, struct sk_buff *skb)
865 865
866out: 866out:
867 consume_skb(skb); 867 consume_skb(skb);
868out_free_dst:
869 dst_release(reply_dst);
868 return 0; 870 return 0;
869} 871}
870 872
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 7bb9c39e0a4d..61b45a17fc73 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -577,21 +577,22 @@ EXPORT_SYMBOL(inet_rtx_syn_ack);
577static bool reqsk_queue_unlink(struct request_sock_queue *queue, 577static bool reqsk_queue_unlink(struct request_sock_queue *queue,
578 struct request_sock *req) 578 struct request_sock *req)
579{ 579{
580 struct listen_sock *lopt = queue->listen_opt;
581 struct request_sock **prev; 580 struct request_sock **prev;
581 struct listen_sock *lopt;
582 bool found = false; 582 bool found = false;
583 583
584 spin_lock(&queue->syn_wait_lock); 584 spin_lock(&queue->syn_wait_lock);
585 585 lopt = queue->listen_opt;
586 for (prev = &lopt->syn_table[req->rsk_hash]; *prev != NULL; 586 if (lopt) {
587 prev = &(*prev)->dl_next) { 587 for (prev = &lopt->syn_table[req->rsk_hash]; *prev != NULL;
588 if (*prev == req) { 588 prev = &(*prev)->dl_next) {
589 *prev = req->dl_next; 589 if (*prev == req) {
590 found = true; 590 *prev = req->dl_next;
591 break; 591 found = true;
592 break;
593 }
592 } 594 }
593 } 595 }
594
595 spin_unlock(&queue->syn_wait_lock); 596 spin_unlock(&queue->syn_wait_lock);
596 if (timer_pending(&req->rsk_timer) && del_timer_sync(&req->rsk_timer)) 597 if (timer_pending(&req->rsk_timer) && del_timer_sync(&req->rsk_timer))
597 reqsk_put(req); 598 reqsk_put(req);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 900113376d4e..36b85bd05ac8 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3119,6 +3119,8 @@ static void addrconf_gre_config(struct net_device *dev)
3119 } 3119 }
3120 3120
3121 addrconf_addr_gen(idev, true); 3121 addrconf_addr_gen(idev, true);
3122 if (dev->flags & IFF_POINTOPOINT)
3123 addrconf_add_mroute(dev);
3122} 3124}
3123#endif 3125#endif
3124 3126
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 92b1aa38f121..61d403ee1031 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -376,6 +376,9 @@ int ip6_forward(struct sk_buff *skb)
376 if (skb->pkt_type != PACKET_HOST) 376 if (skb->pkt_type != PACKET_HOST)
377 goto drop; 377 goto drop;
378 378
379 if (unlikely(skb->sk))
380 goto drop;
381
379 if (skb_warn_if_lro(skb)) 382 if (skb_warn_if_lro(skb))
380 goto drop; 383 goto drop;
381 384
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index cb32ce250db0..968f31c01f89 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -142,6 +142,9 @@ static void rt6_uncached_list_flush_dev(struct net *net, struct net_device *dev)
142 struct net_device *loopback_dev = net->loopback_dev; 142 struct net_device *loopback_dev = net->loopback_dev;
143 int cpu; 143 int cpu;
144 144
145 if (dev == loopback_dev)
146 return;
147
145 for_each_possible_cpu(cpu) { 148 for_each_possible_cpu(cpu) {
146 struct uncached_list *ul = per_cpu_ptr(&rt6_uncached_list, cpu); 149 struct uncached_list *ul = per_cpu_ptr(&rt6_uncached_list, cpu);
147 struct rt6_info *rt; 150 struct rt6_info *rt;
@@ -151,14 +154,12 @@ static void rt6_uncached_list_flush_dev(struct net *net, struct net_device *dev)
151 struct inet6_dev *rt_idev = rt->rt6i_idev; 154 struct inet6_dev *rt_idev = rt->rt6i_idev;
152 struct net_device *rt_dev = rt->dst.dev; 155 struct net_device *rt_dev = rt->dst.dev;
153 156
154 if (rt_idev && (rt_idev->dev == dev || !dev) && 157 if (rt_idev->dev == dev) {
155 rt_idev->dev != loopback_dev) {
156 rt->rt6i_idev = in6_dev_get(loopback_dev); 158 rt->rt6i_idev = in6_dev_get(loopback_dev);
157 in6_dev_put(rt_idev); 159 in6_dev_put(rt_idev);
158 } 160 }
159 161
160 if (rt_dev && (rt_dev == dev || !dev) && 162 if (rt_dev == dev) {
161 rt_dev != loopback_dev) {
162 rt->dst.dev = loopback_dev; 163 rt->dst.dev = loopback_dev;
163 dev_hold(rt->dst.dev); 164 dev_hold(rt->dst.dev);
164 dev_put(rt_dev); 165 dev_put(rt_dev);
@@ -247,12 +248,6 @@ static void ip6_rt_blackhole_redirect(struct dst_entry *dst, struct sock *sk,
247{ 248{
248} 249}
249 250
250static u32 *ip6_rt_blackhole_cow_metrics(struct dst_entry *dst,
251 unsigned long old)
252{
253 return NULL;
254}
255
256static struct dst_ops ip6_dst_blackhole_ops = { 251static struct dst_ops ip6_dst_blackhole_ops = {
257 .family = AF_INET6, 252 .family = AF_INET6,
258 .destroy = ip6_dst_destroy, 253 .destroy = ip6_dst_destroy,
@@ -261,7 +256,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
261 .default_advmss = ip6_default_advmss, 256 .default_advmss = ip6_default_advmss,
262 .update_pmtu = ip6_rt_blackhole_update_pmtu, 257 .update_pmtu = ip6_rt_blackhole_update_pmtu,
263 .redirect = ip6_rt_blackhole_redirect, 258 .redirect = ip6_rt_blackhole_redirect,
264 .cow_metrics = ip6_rt_blackhole_cow_metrics, 259 .cow_metrics = dst_cow_metrics_generic,
265 .neigh_lookup = ip6_neigh_lookup, 260 .neigh_lookup = ip6_neigh_lookup,
266}; 261};
267 262
@@ -318,6 +313,15 @@ static const struct rt6_info ip6_blk_hole_entry_template = {
318 313
319#endif 314#endif
320 315
316static void rt6_info_init(struct rt6_info *rt)
317{
318 struct dst_entry *dst = &rt->dst;
319
320 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
321 INIT_LIST_HEAD(&rt->rt6i_siblings);
322 INIT_LIST_HEAD(&rt->rt6i_uncached);
323}
324
321/* allocate dst with ip6_dst_ops */ 325/* allocate dst with ip6_dst_ops */
322static struct rt6_info *__ip6_dst_alloc(struct net *net, 326static struct rt6_info *__ip6_dst_alloc(struct net *net,
323 struct net_device *dev, 327 struct net_device *dev,
@@ -326,13 +330,9 @@ static struct rt6_info *__ip6_dst_alloc(struct net *net,
326 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, 330 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev,
327 0, DST_OBSOLETE_FORCE_CHK, flags); 331 0, DST_OBSOLETE_FORCE_CHK, flags);
328 332
329 if (rt) { 333 if (rt)
330 struct dst_entry *dst = &rt->dst; 334 rt6_info_init(rt);
331 335
332 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
333 INIT_LIST_HEAD(&rt->rt6i_siblings);
334 INIT_LIST_HEAD(&rt->rt6i_uncached);
335 }
336 return rt; 336 return rt;
337} 337}
338 338
@@ -1213,24 +1213,20 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
1213 1213
1214 rt = dst_alloc(&ip6_dst_blackhole_ops, ort->dst.dev, 1, DST_OBSOLETE_NONE, 0); 1214 rt = dst_alloc(&ip6_dst_blackhole_ops, ort->dst.dev, 1, DST_OBSOLETE_NONE, 0);
1215 if (rt) { 1215 if (rt) {
1216 new = &rt->dst; 1216 rt6_info_init(rt);
1217
1218 memset(new + 1, 0, sizeof(*rt) - sizeof(*new));
1219 1217
1218 new = &rt->dst;
1220 new->__use = 1; 1219 new->__use = 1;
1221 new->input = dst_discard; 1220 new->input = dst_discard;
1222 new->output = dst_discard_sk; 1221 new->output = dst_discard_sk;
1223 1222
1224 if (dst_metrics_read_only(&ort->dst)) 1223 dst_copy_metrics(new, &ort->dst);
1225 new->_metrics = ort->dst._metrics;
1226 else
1227 dst_copy_metrics(new, &ort->dst);
1228 rt->rt6i_idev = ort->rt6i_idev; 1224 rt->rt6i_idev = ort->rt6i_idev;
1229 if (rt->rt6i_idev) 1225 if (rt->rt6i_idev)
1230 in6_dev_hold(rt->rt6i_idev); 1226 in6_dev_hold(rt->rt6i_idev);
1231 1227
1232 rt->rt6i_gateway = ort->rt6i_gateway; 1228 rt->rt6i_gateway = ort->rt6i_gateway;
1233 rt->rt6i_flags = ort->rt6i_flags; 1229 rt->rt6i_flags = ort->rt6i_flags & ~RTF_PCPU;
1234 rt->rt6i_metric = 0; 1230 rt->rt6i_metric = 0;
1235 1231
1236 memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); 1232 memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key));
@@ -2622,7 +2618,8 @@ void rt6_ifdown(struct net *net, struct net_device *dev)
2622 2618
2623 fib6_clean_all(net, fib6_ifdown, &adn); 2619 fib6_clean_all(net, fib6_ifdown, &adn);
2624 icmp6_clean_all(fib6_ifdown, &adn); 2620 icmp6_clean_all(fib6_ifdown, &adn);
2625 rt6_uncached_list_flush_dev(net, dev); 2621 if (dev)
2622 rt6_uncached_list_flush_dev(net, dev);
2626} 2623}
2627 2624
2628struct rt6_mtu_change_arg { 2625struct rt6_mtu_change_arg {
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 30caa289c5db..5cedfda4b241 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -37,6 +37,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, int oif,
37 37
38 memset(&fl6, 0, sizeof(fl6)); 38 memset(&fl6, 0, sizeof(fl6));
39 fl6.flowi6_oif = oif; 39 fl6.flowi6_oif = oif;
40 fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF;
40 memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr)); 41 memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr));
41 if (saddr) 42 if (saddr)
42 memcpy(&fl6.saddr, saddr, sizeof(fl6.saddr)); 43 memcpy(&fl6.saddr, saddr, sizeof(fl6.saddr));
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index ced6bf3be8d6..1560c8482bcb 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -149,7 +149,7 @@ static ssize_t hwflags_read(struct file *file, char __user *user_buf,
149 149
150 for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) { 150 for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) {
151 if (test_bit(i, local->hw.flags)) 151 if (test_bit(i, local->hw.flags))
152 pos += scnprintf(pos, end - pos, "%s", 152 pos += scnprintf(pos, end - pos, "%s\n",
153 hw_flag_names[i]); 153 hw_flag_names[i]);
154 } 154 }
155 155
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 8ba583243509..3ed7ddfbf8e8 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -101,6 +101,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
101 * when it wakes up for the next time. 101 * when it wakes up for the next time.
102 */ 102 */
103 set_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT); 103 set_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT);
104 ieee80211_clear_fast_xmit(sta);
104 105
105 /* 106 /*
106 * This code races in the following way: 107 * This code races in the following way:
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 84e0e8c7fb23..7892eb8ed4c8 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1218,8 +1218,10 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1218 1218
1219 if (!tx->sta) 1219 if (!tx->sta)
1220 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; 1220 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1221 else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) 1221 else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
1222 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; 1222 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1223 ieee80211_check_fast_xmit(tx->sta);
1224 }
1223 1225
1224 info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT; 1226 info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
1225 1227
@@ -2451,7 +2453,8 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
2451 2453
2452 if (test_sta_flag(sta, WLAN_STA_PS_STA) || 2454 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
2453 test_sta_flag(sta, WLAN_STA_PS_DRIVER) || 2455 test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
2454 test_sta_flag(sta, WLAN_STA_PS_DELIVER)) 2456 test_sta_flag(sta, WLAN_STA_PS_DELIVER) ||
2457 test_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT))
2455 goto out; 2458 goto out;
2456 2459
2457 if (sdata->noack_map) 2460 if (sdata->noack_map)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 8f060d7f9a0e..0a49a8c7c564 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2785,6 +2785,7 @@ static int netlink_dump(struct sock *sk)
2785 struct sk_buff *skb = NULL; 2785 struct sk_buff *skb = NULL;
2786 struct nlmsghdr *nlh; 2786 struct nlmsghdr *nlh;
2787 int len, err = -ENOBUFS; 2787 int len, err = -ENOBUFS;
2788 int alloc_min_size;
2788 int alloc_size; 2789 int alloc_size;
2789 2790
2790 mutex_lock(nlk->cb_mutex); 2791 mutex_lock(nlk->cb_mutex);
@@ -2793,9 +2794,6 @@ static int netlink_dump(struct sock *sk)
2793 goto errout_skb; 2794 goto errout_skb;
2794 } 2795 }
2795 2796
2796 cb = &nlk->cb;
2797 alloc_size = max_t(int, cb->min_dump_alloc, NLMSG_GOODSIZE);
2798
2799 if (!netlink_rx_is_mmaped(sk) && 2797 if (!netlink_rx_is_mmaped(sk) &&
2800 atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) 2798 atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
2801 goto errout_skb; 2799 goto errout_skb;
@@ -2805,23 +2803,35 @@ static int netlink_dump(struct sock *sk)
2805 * to reduce number of system calls on dump operations, if user 2803 * to reduce number of system calls on dump operations, if user
2806 * ever provided a big enough buffer. 2804 * ever provided a big enough buffer.
2807 */ 2805 */
2808 if (alloc_size < nlk->max_recvmsg_len) { 2806 cb = &nlk->cb;
2809 skb = netlink_alloc_skb(sk, 2807 alloc_min_size = max_t(int, cb->min_dump_alloc, NLMSG_GOODSIZE);
2810 nlk->max_recvmsg_len, 2808
2811 nlk->portid, 2809 if (alloc_min_size < nlk->max_recvmsg_len) {
2810 alloc_size = nlk->max_recvmsg_len;
2811 skb = netlink_alloc_skb(sk, alloc_size, nlk->portid,
2812 GFP_KERNEL | 2812 GFP_KERNEL |
2813 __GFP_NOWARN | 2813 __GFP_NOWARN |
2814 __GFP_NORETRY); 2814 __GFP_NORETRY);
2815 /* available room should be exact amount to avoid MSG_TRUNC */
2816 if (skb)
2817 skb_reserve(skb, skb_tailroom(skb) -
2818 nlk->max_recvmsg_len);
2819 } 2815 }
2820 if (!skb) 2816 if (!skb) {
2817 alloc_size = alloc_min_size;
2821 skb = netlink_alloc_skb(sk, alloc_size, nlk->portid, 2818 skb = netlink_alloc_skb(sk, alloc_size, nlk->portid,
2822 GFP_KERNEL); 2819 GFP_KERNEL);
2820 }
2823 if (!skb) 2821 if (!skb)
2824 goto errout_skb; 2822 goto errout_skb;
2823
2824 /* Trim skb to allocated size. User is expected to provide buffer as
2825 * large as max(min_dump_alloc, 16KiB (mac_recvmsg_len capped at
2826 * netlink_recvmsg())). dump will pack as many smaller messages as
2827 * could fit within the allocated skb. skb is typically allocated
2828 * with larger space than required (could be as much as near 2x the
2829 * requested size with align to next power of 2 approach). Allowing
2830 * dump to use the excess space makes it difficult for a user to have a
2831 * reasonable static buffer based on the expected largest dump of a
2832 * single netdev. The outcome is MSG_TRUNC error.
2833 */
2834 skb_reserve(skb, skb_tailroom(skb) - alloc_size);
2825 netlink_skb_set_owner_r(skb, sk); 2835 netlink_skb_set_owner_r(skb, sk);
2826 2836
2827 len = cb->dump(skb, cb); 2837 len = cb->dump(skb, cb);
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 315f5330b6e5..c6a39bf2c3b9 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -684,7 +684,7 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
684{ 684{
685 if (skb_network_offset(skb) > MAX_L2_LEN) { 685 if (skb_network_offset(skb) > MAX_L2_LEN) {
686 OVS_NLERR(1, "L2 header too long to fragment"); 686 OVS_NLERR(1, "L2 header too long to fragment");
687 return; 687 goto err;
688 } 688 }
689 689
690 if (ethertype == htons(ETH_P_IP)) { 690 if (ethertype == htons(ETH_P_IP)) {
@@ -708,8 +708,7 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
708 struct rt6_info ovs_rt; 708 struct rt6_info ovs_rt;
709 709
710 if (!v6ops) { 710 if (!v6ops) {
711 kfree_skb(skb); 711 goto err;
712 return;
713 } 712 }
714 713
715 prepare_frag(vport, skb); 714 prepare_frag(vport, skb);
@@ -728,8 +727,12 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
728 WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.", 727 WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
729 ovs_vport_name(vport), ntohs(ethertype), mru, 728 ovs_vport_name(vport), ntohs(ethertype), mru,
730 vport->dev->mtu); 729 vport->dev->mtu);
731 kfree_skb(skb); 730 goto err;
732 } 731 }
732
733 return;
734err:
735 kfree_skb(skb);
733} 736}
734 737
735static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port, 738static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
@@ -968,7 +971,7 @@ static int execute_masked_set_action(struct sk_buff *skb,
968 case OVS_KEY_ATTR_CT_STATE: 971 case OVS_KEY_ATTR_CT_STATE:
969 case OVS_KEY_ATTR_CT_ZONE: 972 case OVS_KEY_ATTR_CT_ZONE:
970 case OVS_KEY_ATTR_CT_MARK: 973 case OVS_KEY_ATTR_CT_MARK:
971 case OVS_KEY_ATTR_CT_LABEL: 974 case OVS_KEY_ATTR_CT_LABELS:
972 err = -EINVAL; 975 err = -EINVAL;
973 break; 976 break;
974 } 977 }
@@ -1099,6 +1102,12 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
1099 break; 1102 break;
1100 1103
1101 case OVS_ACTION_ATTR_CT: 1104 case OVS_ACTION_ATTR_CT:
1105 if (!is_flow_key_valid(key)) {
1106 err = ovs_flow_key_update(skb, key);
1107 if (err)
1108 return err;
1109 }
1110
1102 err = ovs_ct_execute(ovs_dp_get_net(dp), skb, key, 1111 err = ovs_ct_execute(ovs_dp_get_net(dp), skb, key,
1103 nla_data(a)); 1112 nla_data(a));
1104 1113
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index 002a755fa07e..80bf702715bb 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -37,9 +37,9 @@ struct md_mark {
37}; 37};
38 38
39/* Metadata label for masked write to conntrack label. */ 39/* Metadata label for masked write to conntrack label. */
40struct md_label { 40struct md_labels {
41 struct ovs_key_ct_label value; 41 struct ovs_key_ct_labels value;
42 struct ovs_key_ct_label mask; 42 struct ovs_key_ct_labels mask;
43}; 43};
44 44
45/* Conntrack action context for execution. */ 45/* Conntrack action context for execution. */
@@ -47,10 +47,10 @@ struct ovs_conntrack_info {
47 struct nf_conntrack_helper *helper; 47 struct nf_conntrack_helper *helper;
48 struct nf_conntrack_zone zone; 48 struct nf_conntrack_zone zone;
49 struct nf_conn *ct; 49 struct nf_conn *ct;
50 u32 flags; 50 u8 commit : 1;
51 u16 family; 51 u16 family;
52 struct md_mark mark; 52 struct md_mark mark;
53 struct md_label label; 53 struct md_labels labels;
54}; 54};
55 55
56static u16 key_to_nfproto(const struct sw_flow_key *key) 56static u16 key_to_nfproto(const struct sw_flow_key *key)
@@ -109,21 +109,21 @@ static u32 ovs_ct_get_mark(const struct nf_conn *ct)
109#endif 109#endif
110} 110}
111 111
112static void ovs_ct_get_label(const struct nf_conn *ct, 112static void ovs_ct_get_labels(const struct nf_conn *ct,
113 struct ovs_key_ct_label *label) 113 struct ovs_key_ct_labels *labels)
114{ 114{
115 struct nf_conn_labels *cl = ct ? nf_ct_labels_find(ct) : NULL; 115 struct nf_conn_labels *cl = ct ? nf_ct_labels_find(ct) : NULL;
116 116
117 if (cl) { 117 if (cl) {
118 size_t len = cl->words * sizeof(long); 118 size_t len = cl->words * sizeof(long);
119 119
120 if (len > OVS_CT_LABEL_LEN) 120 if (len > OVS_CT_LABELS_LEN)
121 len = OVS_CT_LABEL_LEN; 121 len = OVS_CT_LABELS_LEN;
122 else if (len < OVS_CT_LABEL_LEN) 122 else if (len < OVS_CT_LABELS_LEN)
123 memset(label, 0, OVS_CT_LABEL_LEN); 123 memset(labels, 0, OVS_CT_LABELS_LEN);
124 memcpy(label, cl->bits, len); 124 memcpy(labels, cl->bits, len);
125 } else { 125 } else {
126 memset(label, 0, OVS_CT_LABEL_LEN); 126 memset(labels, 0, OVS_CT_LABELS_LEN);
127 } 127 }
128} 128}
129 129
@@ -134,7 +134,7 @@ static void __ovs_ct_update_key(struct sw_flow_key *key, u8 state,
134 key->ct.state = state; 134 key->ct.state = state;
135 key->ct.zone = zone->id; 135 key->ct.zone = zone->id;
136 key->ct.mark = ovs_ct_get_mark(ct); 136 key->ct.mark = ovs_ct_get_mark(ct);
137 ovs_ct_get_label(ct, &key->ct.label); 137 ovs_ct_get_labels(ct, &key->ct.labels);
138} 138}
139 139
140/* Update 'key' based on skb->nfct. If 'post_ct' is true, then OVS has 140/* Update 'key' based on skb->nfct. If 'post_ct' is true, then OVS has
@@ -167,7 +167,7 @@ void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key)
167 167
168int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb) 168int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb)
169{ 169{
170 if (nla_put_u8(skb, OVS_KEY_ATTR_CT_STATE, key->ct.state)) 170 if (nla_put_u32(skb, OVS_KEY_ATTR_CT_STATE, key->ct.state))
171 return -EMSGSIZE; 171 return -EMSGSIZE;
172 172
173 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) && 173 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) &&
@@ -179,8 +179,8 @@ int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb)
179 return -EMSGSIZE; 179 return -EMSGSIZE;
180 180
181 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) && 181 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
182 nla_put(skb, OVS_KEY_ATTR_CT_LABEL, sizeof(key->ct.label), 182 nla_put(skb, OVS_KEY_ATTR_CT_LABELS, sizeof(key->ct.labels),
183 &key->ct.label)) 183 &key->ct.labels))
184 return -EMSGSIZE; 184 return -EMSGSIZE;
185 185
186 return 0; 186 return 0;
@@ -213,9 +213,9 @@ static int ovs_ct_set_mark(struct sk_buff *skb, struct sw_flow_key *key,
213#endif 213#endif
214} 214}
215 215
216static int ovs_ct_set_label(struct sk_buff *skb, struct sw_flow_key *key, 216static int ovs_ct_set_labels(struct sk_buff *skb, struct sw_flow_key *key,
217 const struct ovs_key_ct_label *label, 217 const struct ovs_key_ct_labels *labels,
218 const struct ovs_key_ct_label *mask) 218 const struct ovs_key_ct_labels *mask)
219{ 219{
220 enum ip_conntrack_info ctinfo; 220 enum ip_conntrack_info ctinfo;
221 struct nf_conn_labels *cl; 221 struct nf_conn_labels *cl;
@@ -235,15 +235,15 @@ static int ovs_ct_set_label(struct sk_buff *skb, struct sw_flow_key *key,
235 nf_ct_labels_ext_add(ct); 235 nf_ct_labels_ext_add(ct);
236 cl = nf_ct_labels_find(ct); 236 cl = nf_ct_labels_find(ct);
237 } 237 }
238 if (!cl || cl->words * sizeof(long) < OVS_CT_LABEL_LEN) 238 if (!cl || cl->words * sizeof(long) < OVS_CT_LABELS_LEN)
239 return -ENOSPC; 239 return -ENOSPC;
240 240
241 err = nf_connlabels_replace(ct, (u32 *)label, (u32 *)mask, 241 err = nf_connlabels_replace(ct, (u32 *)labels, (u32 *)mask,
242 OVS_CT_LABEL_LEN / sizeof(u32)); 242 OVS_CT_LABELS_LEN / sizeof(u32));
243 if (err) 243 if (err)
244 return err; 244 return err;
245 245
246 ovs_ct_get_label(ct, &key->ct.label); 246 ovs_ct_get_labels(ct, &key->ct.labels);
247 return 0; 247 return 0;
248} 248}
249 249
@@ -465,12 +465,12 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key,
465 return 0; 465 return 0;
466} 466}
467 467
468static bool label_nonzero(const struct ovs_key_ct_label *label) 468static bool labels_nonzero(const struct ovs_key_ct_labels *labels)
469{ 469{
470 size_t i; 470 size_t i;
471 471
472 for (i = 0; i < sizeof(*label); i++) 472 for (i = 0; i < sizeof(*labels); i++)
473 if (label->ct_label[i]) 473 if (labels->ct_labels[i])
474 return true; 474 return true;
475 475
476 return false; 476 return false;
@@ -493,7 +493,7 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb,
493 return err; 493 return err;
494 } 494 }
495 495
496 if (info->flags & OVS_CT_F_COMMIT) 496 if (info->commit)
497 err = ovs_ct_commit(net, key, info, skb); 497 err = ovs_ct_commit(net, key, info, skb);
498 else 498 else
499 err = ovs_ct_lookup(net, key, info, skb); 499 err = ovs_ct_lookup(net, key, info, skb);
@@ -506,9 +506,9 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb,
506 if (err) 506 if (err)
507 goto err; 507 goto err;
508 } 508 }
509 if (label_nonzero(&info->label.mask)) 509 if (labels_nonzero(&info->labels.mask))
510 err = ovs_ct_set_label(skb, key, &info->label.value, 510 err = ovs_ct_set_labels(skb, key, &info->labels.value,
511 &info->label.mask); 511 &info->labels.mask);
512err: 512err:
513 skb_push(skb, nh_ofs); 513 skb_push(skb, nh_ofs);
514 return err; 514 return err;
@@ -539,14 +539,13 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
539} 539}
540 540
541static const struct ovs_ct_len_tbl ovs_ct_attr_lens[OVS_CT_ATTR_MAX + 1] = { 541static const struct ovs_ct_len_tbl ovs_ct_attr_lens[OVS_CT_ATTR_MAX + 1] = {
542 [OVS_CT_ATTR_FLAGS] = { .minlen = sizeof(u32), 542 [OVS_CT_ATTR_COMMIT] = { .minlen = 0, .maxlen = 0 },
543 .maxlen = sizeof(u32) },
544 [OVS_CT_ATTR_ZONE] = { .minlen = sizeof(u16), 543 [OVS_CT_ATTR_ZONE] = { .minlen = sizeof(u16),
545 .maxlen = sizeof(u16) }, 544 .maxlen = sizeof(u16) },
546 [OVS_CT_ATTR_MARK] = { .minlen = sizeof(struct md_mark), 545 [OVS_CT_ATTR_MARK] = { .minlen = sizeof(struct md_mark),
547 .maxlen = sizeof(struct md_mark) }, 546 .maxlen = sizeof(struct md_mark) },
548 [OVS_CT_ATTR_LABEL] = { .minlen = sizeof(struct md_label), 547 [OVS_CT_ATTR_LABELS] = { .minlen = sizeof(struct md_labels),
549 .maxlen = sizeof(struct md_label) }, 548 .maxlen = sizeof(struct md_labels) },
550 [OVS_CT_ATTR_HELPER] = { .minlen = 1, 549 [OVS_CT_ATTR_HELPER] = { .minlen = 1,
551 .maxlen = NF_CT_HELPER_NAME_LEN } 550 .maxlen = NF_CT_HELPER_NAME_LEN }
552}; 551};
@@ -576,8 +575,8 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
576 } 575 }
577 576
578 switch (type) { 577 switch (type) {
579 case OVS_CT_ATTR_FLAGS: 578 case OVS_CT_ATTR_COMMIT:
580 info->flags = nla_get_u32(a); 579 info->commit = true;
581 break; 580 break;
582#ifdef CONFIG_NF_CONNTRACK_ZONES 581#ifdef CONFIG_NF_CONNTRACK_ZONES
583 case OVS_CT_ATTR_ZONE: 582 case OVS_CT_ATTR_ZONE:
@@ -593,10 +592,10 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
593 } 592 }
594#endif 593#endif
595#ifdef CONFIG_NF_CONNTRACK_LABELS 594#ifdef CONFIG_NF_CONNTRACK_LABELS
596 case OVS_CT_ATTR_LABEL: { 595 case OVS_CT_ATTR_LABELS: {
597 struct md_label *label = nla_data(a); 596 struct md_labels *labels = nla_data(a);
598 597
599 info->label = *label; 598 info->labels = *labels;
600 break; 599 break;
601 } 600 }
602#endif 601#endif
@@ -633,7 +632,7 @@ bool ovs_ct_verify(struct net *net, enum ovs_key_attr attr)
633 attr == OVS_KEY_ATTR_CT_MARK) 632 attr == OVS_KEY_ATTR_CT_MARK)
634 return true; 633 return true;
635 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) && 634 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
636 attr == OVS_KEY_ATTR_CT_LABEL) { 635 attr == OVS_KEY_ATTR_CT_LABELS) {
637 struct ovs_net *ovs_net = net_generic(net, ovs_net_id); 636 struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
638 637
639 return ovs_net->xt_label; 638 return ovs_net->xt_label;
@@ -701,7 +700,7 @@ int ovs_ct_action_to_attr(const struct ovs_conntrack_info *ct_info,
701 if (!start) 700 if (!start)
702 return -EMSGSIZE; 701 return -EMSGSIZE;
703 702
704 if (nla_put_u32(skb, OVS_CT_ATTR_FLAGS, ct_info->flags)) 703 if (ct_info->commit && nla_put_flag(skb, OVS_CT_ATTR_COMMIT))
705 return -EMSGSIZE; 704 return -EMSGSIZE;
706 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) && 705 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) &&
707 nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id)) 706 nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id))
@@ -711,8 +710,8 @@ int ovs_ct_action_to_attr(const struct ovs_conntrack_info *ct_info,
711 &ct_info->mark)) 710 &ct_info->mark))
712 return -EMSGSIZE; 711 return -EMSGSIZE;
713 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) && 712 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
714 nla_put(skb, OVS_CT_ATTR_LABEL, sizeof(ct_info->label), 713 nla_put(skb, OVS_CT_ATTR_LABELS, sizeof(ct_info->labels),
715 &ct_info->label)) 714 &ct_info->labels))
716 return -EMSGSIZE; 715 return -EMSGSIZE;
717 if (ct_info->helper) { 716 if (ct_info->helper) {
718 if (nla_put_string(skb, OVS_CT_ATTR_HELPER, 717 if (nla_put_string(skb, OVS_CT_ATTR_HELPER,
@@ -737,7 +736,7 @@ void ovs_ct_free_action(const struct nlattr *a)
737 736
738void ovs_ct_init(struct net *net) 737void ovs_ct_init(struct net *net)
739{ 738{
740 unsigned int n_bits = sizeof(struct ovs_key_ct_label) * BITS_PER_BYTE; 739 unsigned int n_bits = sizeof(struct ovs_key_ct_labels) * BITS_PER_BYTE;
741 struct ovs_net *ovs_net = net_generic(net, ovs_net_id); 740 struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
742 741
743 if (nf_connlabels_get(net, n_bits)) { 742 if (nf_connlabels_get(net, n_bits)) {
diff --git a/net/openvswitch/conntrack.h b/net/openvswitch/conntrack.h
index 43f5dd7a5577..da8714942c95 100644
--- a/net/openvswitch/conntrack.h
+++ b/net/openvswitch/conntrack.h
@@ -34,6 +34,13 @@ int ovs_ct_execute(struct net *, struct sk_buff *, struct sw_flow_key *,
34void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key); 34void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key);
35int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb); 35int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb);
36void ovs_ct_free_action(const struct nlattr *a); 36void ovs_ct_free_action(const struct nlattr *a);
37
38static inline bool ovs_ct_state_supported(u32 state)
39{
40 return !(state & ~(OVS_CS_F_NEW | OVS_CS_F_ESTABLISHED |
41 OVS_CS_F_RELATED | OVS_CS_F_REPLY_DIR |
42 OVS_CS_F_INVALID | OVS_CS_F_TRACKED));
43}
37#else 44#else
38#include <linux/errno.h> 45#include <linux/errno.h>
39 46
@@ -46,6 +53,11 @@ static inline bool ovs_ct_verify(struct net *net, int attr)
46 return false; 53 return false;
47} 54}
48 55
56static inline bool ovs_ct_state_supported(u32 state)
57{
58 return false;
59}
60
49static inline int ovs_ct_copy_action(struct net *net, const struct nlattr *nla, 61static inline int ovs_ct_copy_action(struct net *net, const struct nlattr *nla,
50 const struct sw_flow_key *key, 62 const struct sw_flow_key *key,
51 struct sw_flow_actions **acts, bool log) 63 struct sw_flow_actions **acts, bool log)
@@ -72,7 +84,7 @@ static inline void ovs_ct_fill_key(const struct sk_buff *skb,
72 key->ct.state = 0; 84 key->ct.state = 0;
73 key->ct.zone = 0; 85 key->ct.zone = 0;
74 key->ct.mark = 0; 86 key->ct.mark = 0;
75 memset(&key->ct.label, 0, sizeof(key->ct.label)); 87 memset(&key->ct.labels, 0, sizeof(key->ct.labels));
76} 88}
77 89
78static inline int ovs_ct_put_key(const struct sw_flow_key *key, 90static inline int ovs_ct_put_key(const struct sw_flow_key *key,
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
index fe527d2dd4b7..8cfa15a08668 100644
--- a/net/openvswitch/flow.h
+++ b/net/openvswitch/flow.h
@@ -116,7 +116,7 @@ struct sw_flow_key {
116 u16 zone; 116 u16 zone;
117 u32 mark; 117 u32 mark;
118 u8 state; 118 u8 state;
119 struct ovs_key_ct_label label; 119 struct ovs_key_ct_labels labels;
120 } ct; 120 } ct;
121 121
122} __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as longs. */ 122} __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as longs. */
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 5c030a4d7338..171a691f1c32 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -291,10 +291,10 @@ size_t ovs_key_attr_size(void)
291 + nla_total_size(4) /* OVS_KEY_ATTR_SKB_MARK */ 291 + nla_total_size(4) /* OVS_KEY_ATTR_SKB_MARK */
292 + nla_total_size(4) /* OVS_KEY_ATTR_DP_HASH */ 292 + nla_total_size(4) /* OVS_KEY_ATTR_DP_HASH */
293 + nla_total_size(4) /* OVS_KEY_ATTR_RECIRC_ID */ 293 + nla_total_size(4) /* OVS_KEY_ATTR_RECIRC_ID */
294 + nla_total_size(1) /* OVS_KEY_ATTR_CT_STATE */ 294 + nla_total_size(4) /* OVS_KEY_ATTR_CT_STATE */
295 + nla_total_size(2) /* OVS_KEY_ATTR_CT_ZONE */ 295 + nla_total_size(2) /* OVS_KEY_ATTR_CT_ZONE */
296 + nla_total_size(4) /* OVS_KEY_ATTR_CT_MARK */ 296 + nla_total_size(4) /* OVS_KEY_ATTR_CT_MARK */
297 + nla_total_size(16) /* OVS_KEY_ATTR_CT_LABEL */ 297 + nla_total_size(16) /* OVS_KEY_ATTR_CT_LABELS */
298 + nla_total_size(12) /* OVS_KEY_ATTR_ETHERNET */ 298 + nla_total_size(12) /* OVS_KEY_ATTR_ETHERNET */
299 + nla_total_size(2) /* OVS_KEY_ATTR_ETHERTYPE */ 299 + nla_total_size(2) /* OVS_KEY_ATTR_ETHERTYPE */
300 + nla_total_size(4) /* OVS_KEY_ATTR_VLAN */ 300 + nla_total_size(4) /* OVS_KEY_ATTR_VLAN */
@@ -349,10 +349,10 @@ static const struct ovs_len_tbl ovs_key_lens[OVS_KEY_ATTR_MAX + 1] = {
349 [OVS_KEY_ATTR_TUNNEL] = { .len = OVS_ATTR_NESTED, 349 [OVS_KEY_ATTR_TUNNEL] = { .len = OVS_ATTR_NESTED,
350 .next = ovs_tunnel_key_lens, }, 350 .next = ovs_tunnel_key_lens, },
351 [OVS_KEY_ATTR_MPLS] = { .len = sizeof(struct ovs_key_mpls) }, 351 [OVS_KEY_ATTR_MPLS] = { .len = sizeof(struct ovs_key_mpls) },
352 [OVS_KEY_ATTR_CT_STATE] = { .len = sizeof(u8) }, 352 [OVS_KEY_ATTR_CT_STATE] = { .len = sizeof(u32) },
353 [OVS_KEY_ATTR_CT_ZONE] = { .len = sizeof(u16) }, 353 [OVS_KEY_ATTR_CT_ZONE] = { .len = sizeof(u16) },
354 [OVS_KEY_ATTR_CT_MARK] = { .len = sizeof(u32) }, 354 [OVS_KEY_ATTR_CT_MARK] = { .len = sizeof(u32) },
355 [OVS_KEY_ATTR_CT_LABEL] = { .len = sizeof(struct ovs_key_ct_label) }, 355 [OVS_KEY_ATTR_CT_LABELS] = { .len = sizeof(struct ovs_key_ct_labels) },
356}; 356};
357 357
358static bool check_attr_len(unsigned int attr_len, unsigned int expected_len) 358static bool check_attr_len(unsigned int attr_len, unsigned int expected_len)
@@ -814,7 +814,13 @@ static int metadata_from_nlattrs(struct net *net, struct sw_flow_match *match,
814 814
815 if (*attrs & (1 << OVS_KEY_ATTR_CT_STATE) && 815 if (*attrs & (1 << OVS_KEY_ATTR_CT_STATE) &&
816 ovs_ct_verify(net, OVS_KEY_ATTR_CT_STATE)) { 816 ovs_ct_verify(net, OVS_KEY_ATTR_CT_STATE)) {
817 u8 ct_state = nla_get_u8(a[OVS_KEY_ATTR_CT_STATE]); 817 u32 ct_state = nla_get_u32(a[OVS_KEY_ATTR_CT_STATE]);
818
819 if (!is_mask && !ovs_ct_state_supported(ct_state)) {
820 OVS_NLERR(log, "ct_state flags %08x unsupported",
821 ct_state);
822 return -EINVAL;
823 }
818 824
819 SW_FLOW_KEY_PUT(match, ct.state, ct_state, is_mask); 825 SW_FLOW_KEY_PUT(match, ct.state, ct_state, is_mask);
820 *attrs &= ~(1ULL << OVS_KEY_ATTR_CT_STATE); 826 *attrs &= ~(1ULL << OVS_KEY_ATTR_CT_STATE);
@@ -833,14 +839,14 @@ static int metadata_from_nlattrs(struct net *net, struct sw_flow_match *match,
833 SW_FLOW_KEY_PUT(match, ct.mark, mark, is_mask); 839 SW_FLOW_KEY_PUT(match, ct.mark, mark, is_mask);
834 *attrs &= ~(1ULL << OVS_KEY_ATTR_CT_MARK); 840 *attrs &= ~(1ULL << OVS_KEY_ATTR_CT_MARK);
835 } 841 }
836 if (*attrs & (1 << OVS_KEY_ATTR_CT_LABEL) && 842 if (*attrs & (1 << OVS_KEY_ATTR_CT_LABELS) &&
837 ovs_ct_verify(net, OVS_KEY_ATTR_CT_LABEL)) { 843 ovs_ct_verify(net, OVS_KEY_ATTR_CT_LABELS)) {
838 const struct ovs_key_ct_label *cl; 844 const struct ovs_key_ct_labels *cl;
839 845
840 cl = nla_data(a[OVS_KEY_ATTR_CT_LABEL]); 846 cl = nla_data(a[OVS_KEY_ATTR_CT_LABELS]);
841 SW_FLOW_KEY_MEMCPY(match, ct.label, cl->ct_label, 847 SW_FLOW_KEY_MEMCPY(match, ct.labels, cl->ct_labels,
842 sizeof(*cl), is_mask); 848 sizeof(*cl), is_mask);
843 *attrs &= ~(1ULL << OVS_KEY_ATTR_CT_LABEL); 849 *attrs &= ~(1ULL << OVS_KEY_ATTR_CT_LABELS);
844 } 850 }
845 return 0; 851 return 0;
846} 852}
@@ -1973,7 +1979,7 @@ static int validate_set(const struct nlattr *a,
1973 case OVS_KEY_ATTR_PRIORITY: 1979 case OVS_KEY_ATTR_PRIORITY:
1974 case OVS_KEY_ATTR_SKB_MARK: 1980 case OVS_KEY_ATTR_SKB_MARK:
1975 case OVS_KEY_ATTR_CT_MARK: 1981 case OVS_KEY_ATTR_CT_MARK:
1976 case OVS_KEY_ATTR_CT_LABEL: 1982 case OVS_KEY_ATTR_CT_LABELS:
1977 case OVS_KEY_ATTR_ETHERNET: 1983 case OVS_KEY_ATTR_ETHERNET:
1978 break; 1984 break;
1979 1985
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
index f2ea83ba4763..c7f74aab34b9 100644
--- a/net/openvswitch/flow_table.c
+++ b/net/openvswitch/flow_table.c
@@ -93,7 +93,8 @@ struct sw_flow *ovs_flow_alloc(void)
93 93
94 /* Initialize the default stat node. */ 94 /* Initialize the default stat node. */
95 stats = kmem_cache_alloc_node(flow_stats_cache, 95 stats = kmem_cache_alloc_node(flow_stats_cache,
96 GFP_KERNEL | __GFP_ZERO, 0); 96 GFP_KERNEL | __GFP_ZERO,
97 node_online(0) ? 0 : NUMA_NO_NODE);
97 if (!stats) 98 if (!stats)
98 goto err; 99 goto err;
99 100
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index dc81dc619aa2..12a36ac21eda 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -280,35 +280,19 @@ void ovs_vport_del(struct vport *vport)
280 */ 280 */
281void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats) 281void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats)
282{ 282{
283 struct net_device *dev = vport->dev; 283 const struct rtnl_link_stats64 *dev_stats;
284 int i; 284 struct rtnl_link_stats64 temp;
285 285
286 memset(stats, 0, sizeof(*stats)); 286 dev_stats = dev_get_stats(vport->dev, &temp);
287 stats->rx_errors = dev->stats.rx_errors; 287 stats->rx_errors = dev_stats->rx_errors;
288 stats->tx_errors = dev->stats.tx_errors; 288 stats->tx_errors = dev_stats->tx_errors;
289 stats->tx_dropped = dev->stats.tx_dropped; 289 stats->tx_dropped = dev_stats->tx_dropped;
290 stats->rx_dropped = dev->stats.rx_dropped; 290 stats->rx_dropped = dev_stats->rx_dropped;
291 291
292 stats->rx_dropped += atomic_long_read(&dev->rx_dropped); 292 stats->rx_bytes = dev_stats->rx_bytes;
293 stats->tx_dropped += atomic_long_read(&dev->tx_dropped); 293 stats->rx_packets = dev_stats->rx_packets;
294 294 stats->tx_bytes = dev_stats->tx_bytes;
295 for_each_possible_cpu(i) { 295 stats->tx_packets = dev_stats->tx_packets;
296 const struct pcpu_sw_netstats *percpu_stats;
297 struct pcpu_sw_netstats local_stats;
298 unsigned int start;
299
300 percpu_stats = per_cpu_ptr(dev->tstats, i);
301
302 do {
303 start = u64_stats_fetch_begin_irq(&percpu_stats->syncp);
304 local_stats = *percpu_stats;
305 } while (u64_stats_fetch_retry_irq(&percpu_stats->syncp, start));
306
307 stats->rx_bytes += local_stats.rx_bytes;
308 stats->rx_packets += local_stats.rx_packets;
309 stats->tx_bytes += local_stats.tx_bytes;
310 stats->tx_packets += local_stats.tx_packets;
311 }
312} 296}
313 297
314/** 298/**
@@ -460,6 +444,15 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
460 444
461 OVS_CB(skb)->input_vport = vport; 445 OVS_CB(skb)->input_vport = vport;
462 OVS_CB(skb)->mru = 0; 446 OVS_CB(skb)->mru = 0;
447 if (unlikely(dev_net(skb->dev) != ovs_dp_get_net(vport->dp))) {
448 u32 mark;
449
450 mark = skb->mark;
451 skb_scrub_packet(skb, true);
452 skb->mark = mark;
453 tun_info = NULL;
454 }
455
463 /* Extract flow from 'skb' into 'key'. */ 456 /* Extract flow from 'skb' into 'key'. */
464 error = ovs_flow_key_extract(tun_info, skb, &key); 457 error = ovs_flow_key_extract(tun_info, skb, &key);
465 if (unlikely(error)) { 458 if (unlikely(error)) {
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 2d1be4a760fd..32fcdecdb9e2 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -31,13 +31,17 @@
31 31
32#define MIRRED_TAB_MASK 7 32#define MIRRED_TAB_MASK 7
33static LIST_HEAD(mirred_list); 33static LIST_HEAD(mirred_list);
34static DEFINE_SPINLOCK(mirred_list_lock);
34 35
35static void tcf_mirred_release(struct tc_action *a, int bind) 36static void tcf_mirred_release(struct tc_action *a, int bind)
36{ 37{
37 struct tcf_mirred *m = to_mirred(a); 38 struct tcf_mirred *m = to_mirred(a);
38 struct net_device *dev = rcu_dereference_protected(m->tcfm_dev, 1); 39 struct net_device *dev = rcu_dereference_protected(m->tcfm_dev, 1);
39 40
41 /* We could be called either in a RCU callback or with RTNL lock held. */
42 spin_lock_bh(&mirred_list_lock);
40 list_del(&m->tcfm_list); 43 list_del(&m->tcfm_list);
44 spin_unlock_bh(&mirred_list_lock);
41 if (dev) 45 if (dev)
42 dev_put(dev); 46 dev_put(dev);
43} 47}
@@ -103,10 +107,10 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
103 } else { 107 } else {
104 if (bind) 108 if (bind)
105 return 0; 109 return 0;
106 if (!ovr) { 110
107 tcf_hash_release(a, bind); 111 tcf_hash_release(a, bind);
112 if (!ovr)
108 return -EEXIST; 113 return -EEXIST;
109 }
110 } 114 }
111 m = to_mirred(a); 115 m = to_mirred(a);
112 116
@@ -123,7 +127,9 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
123 } 127 }
124 128
125 if (ret == ACT_P_CREATED) { 129 if (ret == ACT_P_CREATED) {
130 spin_lock_bh(&mirred_list_lock);
126 list_add(&m->tcfm_list, &mirred_list); 131 list_add(&m->tcfm_list, &mirred_list);
132 spin_unlock_bh(&mirred_list_lock);
127 tcf_hash_insert(a); 133 tcf_hash_insert(a);
128 } 134 }
129 135
@@ -173,6 +179,7 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
173 179
174 skb2->skb_iif = skb->dev->ifindex; 180 skb2->skb_iif = skb->dev->ifindex;
175 skb2->dev = dev; 181 skb2->dev = dev;
182 skb_sender_cpu_clear(skb2);
176 err = dev_queue_xmit(skb2); 183 err = dev_queue_xmit(skb2);
177 184
178 if (err) { 185 if (err) {
@@ -221,7 +228,8 @@ static int mirred_device_event(struct notifier_block *unused,
221 struct tcf_mirred *m; 228 struct tcf_mirred *m;
222 229
223 ASSERT_RTNL(); 230 ASSERT_RTNL();
224 if (event == NETDEV_UNREGISTER) 231 if (event == NETDEV_UNREGISTER) {
232 spin_lock_bh(&mirred_list_lock);
225 list_for_each_entry(m, &mirred_list, tcfm_list) { 233 list_for_each_entry(m, &mirred_list, tcfm_list) {
226 if (rcu_access_pointer(m->tcfm_dev) == dev) { 234 if (rcu_access_pointer(m->tcfm_dev) == dev) {
227 dev_put(dev); 235 dev_put(dev);
@@ -231,6 +239,8 @@ static int mirred_device_event(struct notifier_block *unused,
231 RCU_INIT_POINTER(m->tcfm_dev, NULL); 239 RCU_INIT_POINTER(m->tcfm_dev, NULL);
232 } 240 }
233 } 241 }
242 spin_unlock_bh(&mirred_list_lock);
243 }
234 244
235 return NOTIFY_DONE; 245 return NOTIFY_DONE;
236} 246}
diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c
index 9d15cb6b8cb1..86b04e31e60b 100644
--- a/net/sched/sch_hhf.c
+++ b/net/sched/sch_hhf.c
@@ -368,6 +368,15 @@ static unsigned int hhf_drop(struct Qdisc *sch)
368 return bucket - q->buckets; 368 return bucket - q->buckets;
369} 369}
370 370
371static unsigned int hhf_qdisc_drop(struct Qdisc *sch)
372{
373 unsigned int prev_backlog;
374
375 prev_backlog = sch->qstats.backlog;
376 hhf_drop(sch);
377 return prev_backlog - sch->qstats.backlog;
378}
379
371static int hhf_enqueue(struct sk_buff *skb, struct Qdisc *sch) 380static int hhf_enqueue(struct sk_buff *skb, struct Qdisc *sch)
372{ 381{
373 struct hhf_sched_data *q = qdisc_priv(sch); 382 struct hhf_sched_data *q = qdisc_priv(sch);
@@ -696,7 +705,7 @@ static struct Qdisc_ops hhf_qdisc_ops __read_mostly = {
696 .enqueue = hhf_enqueue, 705 .enqueue = hhf_enqueue,
697 .dequeue = hhf_dequeue, 706 .dequeue = hhf_dequeue,
698 .peek = qdisc_peek_dequeued, 707 .peek = qdisc_peek_dequeued,
699 .drop = hhf_drop, 708 .drop = hhf_qdisc_drop,
700 .init = hhf_init, 709 .init = hhf_init,
701 .reset = hhf_reset, 710 .reset = hhf_reset,
702 .destroy = hhf_destroy, 711 .destroy = hhf_destroy,
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index fda38f830a10..77f5d17e2612 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -16,6 +16,7 @@
16#include <linux/notifier.h> 16#include <linux/notifier.h>
17#include <linux/netdevice.h> 17#include <linux/netdevice.h>
18#include <linux/if_bridge.h> 18#include <linux/if_bridge.h>
19#include <linux/if_vlan.h>
19#include <net/ip_fib.h> 20#include <net/ip_fib.h>
20#include <net/switchdev.h> 21#include <net/switchdev.h>
21 22
@@ -634,6 +635,8 @@ static int switchdev_port_br_afspec(struct net_device *dev,
634 if (nla_len(attr) != sizeof(struct bridge_vlan_info)) 635 if (nla_len(attr) != sizeof(struct bridge_vlan_info))
635 return -EINVAL; 636 return -EINVAL;
636 vinfo = nla_data(attr); 637 vinfo = nla_data(attr);
638 if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
639 return -EINVAL;
637 vlan->flags = vinfo->flags; 640 vlan->flags = vinfo->flags;
638 if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) { 641 if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
639 if (vlan->vid_begin) 642 if (vlan->vid_begin)
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index a82c5848d4bc..5351a3f97e8e 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -357,7 +357,7 @@ static inline u32 msg_importance(struct tipc_msg *m)
357 if (likely((usr <= TIPC_CRITICAL_IMPORTANCE) && !msg_errcode(m))) 357 if (likely((usr <= TIPC_CRITICAL_IMPORTANCE) && !msg_errcode(m)))
358 return usr; 358 return usr;
359 if ((usr == MSG_FRAGMENTER) || (usr == MSG_BUNDLER)) 359 if ((usr == MSG_FRAGMENTER) || (usr == MSG_BUNDLER))
360 return msg_bits(m, 5, 13, 0x7); 360 return msg_bits(m, 9, 0, 0x7);
361 return TIPC_SYSTEM_IMPORTANCE; 361 return TIPC_SYSTEM_IMPORTANCE;
362} 362}
363 363
@@ -366,7 +366,7 @@ static inline void msg_set_importance(struct tipc_msg *m, u32 i)
366 int usr = msg_user(m); 366 int usr = msg_user(m);
367 367
368 if (likely((usr == MSG_FRAGMENTER) || (usr == MSG_BUNDLER))) 368 if (likely((usr == MSG_FRAGMENTER) || (usr == MSG_BUNDLER)))
369 msg_set_bits(m, 5, 13, 0x7, i); 369 msg_set_bits(m, 9, 0, 0x7, i);
370 else if (i < TIPC_SYSTEM_IMPORTANCE) 370 else if (i < TIPC_SYSTEM_IMPORTANCE)
371 msg_set_user(m, i); 371 msg_set_user(m, i);
372 else 372 else
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 703875fd6cde..2c32a83037a3 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1116,7 +1116,7 @@ static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb,
1116 } 1116 }
1117 1117
1118 /* Ignore duplicate packets */ 1118 /* Ignore duplicate packets */
1119 if (less(oseqno, rcv_nxt)) 1119 if ((usr != LINK_PROTOCOL) && less(oseqno, rcv_nxt))
1120 return true; 1120 return true;
1121 1121
1122 /* Initiate or update failover mode if applicable */ 1122 /* Initiate or update failover mode if applicable */
@@ -1146,8 +1146,8 @@ static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb,
1146 if (!pl || !tipc_link_is_up(pl)) 1146 if (!pl || !tipc_link_is_up(pl))
1147 return true; 1147 return true;
1148 1148
1149 /* Initiate or update synch mode if applicable */ 1149 /* Initiate synch mode if applicable */
1150 if ((usr == TUNNEL_PROTOCOL) && (mtyp == SYNCH_MSG)) { 1150 if ((usr == TUNNEL_PROTOCOL) && (mtyp == SYNCH_MSG) && (oseqno == 1)) {
1151 syncpt = iseqno + exp_pkts - 1; 1151 syncpt = iseqno + exp_pkts - 1;
1152 if (!tipc_link_is_up(l)) { 1152 if (!tipc_link_is_up(l)) {
1153 tipc_link_fsm_evt(l, LINK_ESTABLISH_EVT); 1153 tipc_link_fsm_evt(l, LINK_ESTABLISH_EVT);
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index ef31b40ad550..94f658235fb4 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2064,6 +2064,11 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)
2064 goto out; 2064 goto out;
2065 } 2065 }
2066 2066
2067 if (flags & MSG_PEEK)
2068 skip = sk_peek_offset(sk, flags);
2069 else
2070 skip = 0;
2071
2067 do { 2072 do {
2068 int chunk; 2073 int chunk;
2069 struct sk_buff *skb, *last; 2074 struct sk_buff *skb, *last;
@@ -2112,7 +2117,6 @@ unlock:
2112 break; 2117 break;
2113 } 2118 }
2114 2119
2115 skip = sk_peek_offset(sk, flags);
2116 while (skip >= unix_skb_len(skb)) { 2120 while (skip >= unix_skb_len(skb)) {
2117 skip -= unix_skb_len(skb); 2121 skip -= unix_skb_len(skb);
2118 last = skb; 2122 last = skb;
@@ -2179,14 +2183,12 @@ unlock:
2179 if (UNIXCB(skb).fp) 2183 if (UNIXCB(skb).fp)
2180 scm.fp = scm_fp_dup(UNIXCB(skb).fp); 2184 scm.fp = scm_fp_dup(UNIXCB(skb).fp);
2181 2185
2182 if (skip) { 2186 sk_peek_offset_fwd(sk, chunk);
2183 sk_peek_offset_fwd(sk, chunk);
2184 skip -= chunk;
2185 }
2186 2187
2187 if (UNIXCB(skb).fp) 2188 if (UNIXCB(skb).fp)
2188 break; 2189 break;
2189 2190
2191 skip = 0;
2190 last = skb; 2192 last = skb;
2191 last_len = skb->len; 2193 last_len = skb->len;
2192 unix_state_lock(sk); 2194 unix_state_lock(sk);