aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-03-31 00:47:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-03-31 00:47:28 -0400
commita44406ec3d31de773ce50e794900546f22c1cc7b (patch)
treec313035c8c2fc77103e0b34523168e81aa170650
parent9dd2326890d89a5179967c947dab2bab34d7ddee (diff)
parente81b5e01c14add8395dfba7130f8829206bb507d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix RCU locking in xfrm_local_error(), from Taehee Yoo. 2) Fix return value assignments and thus error checking in iwl_mvm_start_ap_ibss(), from Johannes Berg. 3) Don't count header length twice in vti4, from Stefano Brivio. 4) Fix deadlock in rt6_age_examine_exception, from Eric Dumazet. 5) Fix out-of-bounds access in nf_sk_lookup_slow{v4,v6}() from Subash Abhinov. 6) Check nladdr size in netlink_connect(), from Alexander Potapenko. 7) VF representor SQ numbers are 32 not 16 bits, in mlx5 driver, from Or Gerlitz. 8) Out of bounds read in skb_network_protocol(), from Eric Dumazet. 9) r8169 driver sets driver data pointer after register_netdev() which is too late. Fix from Heiner Kallweit. 10) Fix memory leak in mlx4 driver, from Moshe Shemesh. 11) The multi-VLAN decap fix added a regression when dealing with device that lack a MAC header, such as tun. Fix from Toshiaki Makita. 12) Fix integer overflow in dynamic interrupt coalescing code. From Tal Gilboa. 13) Use after free in vrf code, from David Ahern. 14) IPV6 route leak between VRFs fix, also from David Ahern. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (81 commits) net: mvneta: fix enable of all initialized RXQs net/ipv6: Fix route leaking between VRFs vrf: Fix use after free and double free in vrf_finish_output ipv6: sr: fix seg6 encap performances with TSO enabled net/dim: Fix int overflow vlan: Fix vlan insertion for packets without ethernet header net: Fix untag for vlan packets without ethernet header atm: iphase: fix spelling mistake: "Receiverd" -> "Received" vhost: validate log when IOTLB is enabled qede: Do not drop rx-checksum invalidated packets. hv_netvsc: enable multicast if necessary ip_tunnel: Resolve ipsec merge conflict properly. lan78xx: Crash in lan78xx_writ_reg (Workqueue: events lan78xx_deferred_multicast_write) qede: Fix barrier usage after tx doorbell write. vhost: correctly remove wait queue during poll failure net/mlx4_core: Fix memory leak while delete slave's resources net/mlx4_en: Fix mixed PFC and Global pause user control requests net/smc: use announced length in sock_recvmsg() llc: properly handle dev_queue_xmit() return value strparser: Fix sign of err codes ...
-rw-r--r--Documentation/isdn/INTERFACE.CAPI2
-rw-r--r--Documentation/isdn/README4
-rw-r--r--Documentation/isdn/README.FAQ4
-rw-r--r--Documentation/isdn/README.gigaset16
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/net/bonding/bond_main.c73
-rw-r--r--drivers/net/dsa/mt7530.c2
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c72
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c33
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_main.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/Kconfig2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c34
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c78
-rw-r--r--drivers/net/ethernet/netronome/nfp/bpf/jit.c6
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_fp.c20
-rw-r--r--drivers/net/ethernet/realtek/r8169.c4
-rw-r--r--drivers/net/hyperv/rndis_filter.c2
-rw-r--r--drivers/net/team/team.c12
-rw-r--r--drivers/net/usb/lan78xx.c33
-rw-r--r--drivers/net/usb/qmi_wwan.c5
-rw-r--r--drivers/net/vrf.c5
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c2
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c5
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h1
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c57
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/9000.c62
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/file.h1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-config.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c9
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c21
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c74
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/time-event.c15
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tx.c10
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c38
-rw-r--r--drivers/vhost/net.c4
-rw-r--r--drivers/vhost/vhost.c17
-rw-r--r--include/linux/if_vlan.h15
-rw-r--r--include/linux/net_dim.h2
-rw-r--r--include/net/llc_conn.h2
-rw-r--r--include/net/netfilter/nf_tables.h4
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--net/batman-adv/gateway_client.c5
-rw-r--r--net/batman-adv/multicast.c4
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/skbuff.c6
-rw-r--r--net/ipv4/ip_tunnel.c31
-rw-r--r--net/ipv4/ip_vti.c2
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c14
-rw-r--r--net/ipv4/netfilter/nf_socket_ipv4.c6
-rw-r--r--net/ipv4/syncookies.c2
-rw-r--r--net/ipv4/tcp_input.c3
-rw-r--r--net/ipv6/ip6_output.c13
-rw-r--r--net/ipv6/ip6_vti.c36
-rw-r--r--net/ipv6/netfilter/nf_socket_ipv6.c6
-rw-r--r--net/ipv6/route.c16
-rw-r--r--net/ipv6/seg6_iptunnel.c16
-rw-r--r--net/ipv6/syncookies.c2
-rw-r--r--net/llc/llc_c_ac.c15
-rw-r--r--net/llc/llc_conn.c32
-rw-r--r--net/netfilter/nf_tables_api.c106
-rw-r--r--net/netfilter/nft_set_hash.c2
-rw-r--r--net/netlink/af_netlink.c3
-rw-r--r--net/sched/act_api.c4
-rw-r--r--net/sched/sch_generic.c17
-rw-r--r--net/smc/smc_clc.c2
-rw-r--r--net/strparser/strparser.c4
-rw-r--r--net/xfrm/xfrm_input.c6
-rw-r--r--net/xfrm/xfrm_output.c5
-rw-r--r--tools/bpf/bpftool/map.c2
76 files changed, 793 insertions, 384 deletions
diff --git a/Documentation/isdn/INTERFACE.CAPI b/Documentation/isdn/INTERFACE.CAPI
index 1688b5a1fd77..021aa9cf139d 100644
--- a/Documentation/isdn/INTERFACE.CAPI
+++ b/Documentation/isdn/INTERFACE.CAPI
@@ -18,7 +18,7 @@ corresponding hardware driver. Kernel CAPI then forwards CAPI messages in both
18directions between the application and the hardware driver. 18directions between the application and the hardware driver.
19 19
20Format and semantics of CAPI messages are specified in the CAPI 2.0 standard. 20Format and semantics of CAPI messages are specified in the CAPI 2.0 standard.
21This standard is freely available from http://www.capi.org. 21This standard is freely available from https://www.capi.org.
22 22
23 23
242. Driver and Device Registration 242. Driver and Device Registration
diff --git a/Documentation/isdn/README b/Documentation/isdn/README
index 32d4e80c2c03..74bd2bdb455b 100644
--- a/Documentation/isdn/README
+++ b/Documentation/isdn/README
@@ -33,10 +33,10 @@ README for the ISDN-subsystem
33 de.alt.comm.isdn4linux 33 de.alt.comm.isdn4linux
34 34
35 There is also a well maintained FAQ in English available at 35 There is also a well maintained FAQ in English available at
36 http://www.mhessler.de/i4lfaq/ 36 https://www.mhessler.de/i4lfaq/
37 It can be viewed online, or downloaded in sgml/text/html format. 37 It can be viewed online, or downloaded in sgml/text/html format.
38 The FAQ can also be viewed online at 38 The FAQ can also be viewed online at
39 http://www.isdn4linux.de/faq/ 39 https://www.isdn4linux.de/faq/i4lfaq.html
40 or downloaded from 40 or downloaded from
41 ftp://ftp.isdn4linux.de/pub/isdn4linux/FAQ/ 41 ftp://ftp.isdn4linux.de/pub/isdn4linux/FAQ/
42 42
diff --git a/Documentation/isdn/README.FAQ b/Documentation/isdn/README.FAQ
index 356f7944641d..e5dd1addacdd 100644
--- a/Documentation/isdn/README.FAQ
+++ b/Documentation/isdn/README.FAQ
@@ -8,9 +8,9 @@ You find it in:
8 8
9In case you just want to see the FAQ online, or download the newest version, 9In case you just want to see the FAQ online, or download the newest version,
10you can have a look at my website: 10you can have a look at my website:
11http://www.mhessler.de/i4lfaq/ (view + download) 11https://www.mhessler.de/i4lfaq/ (view + download)
12or: 12or:
13http://www.isdn4linux.de/faq/ (view) 13https://www.isdn4linux.de/faq/4lfaq.html (view)
14 14
15As the extension tells, the FAQ is in SGML format, and you can convert it 15As the extension tells, the FAQ is in SGML format, and you can convert it
16into text/html/... format by using the sgml2txt/sgml2html/... tools. 16into text/html/... format by using the sgml2txt/sgml2html/... tools.
diff --git a/Documentation/isdn/README.gigaset b/Documentation/isdn/README.gigaset
index 7534c6039adc..9b1ce277ca3d 100644
--- a/Documentation/isdn/README.gigaset
+++ b/Documentation/isdn/README.gigaset
@@ -29,8 +29,9 @@ GigaSet 307x Device Driver
29 T-Com Sinus 721 data 29 T-Com Sinus 721 data
30 Chicago 390 USB (KPN) 30 Chicago 390 USB (KPN)
31 31
32 See also http://www.erbze.info/sinus_gigaset.htm and 32 See also http://www.erbze.info/sinus_gigaset.htm
33 http://gigaset307x.sourceforge.net/ 33 (archived at https://web.archive.org/web/20100717020421/http://www.erbze.info:80/sinus_gigaset.htm ) and
34 http://gigaset307x.sourceforge.net/
34 35
35 We had also reports from users of Gigaset M105 who could use the drivers 36 We had also reports from users of Gigaset M105 who could use the drivers
36 with SX 100 and CX 100 ISDN bases (only in unimodem mode, see section 2.5.) 37 with SX 100 and CX 100 ISDN bases (only in unimodem mode, see section 2.5.)
@@ -52,7 +53,7 @@ GigaSet 307x Device Driver
52 to use CAPI 2.0 or ISDN4Linux for ISDN connections (voice or data). 53 to use CAPI 2.0 or ISDN4Linux for ISDN connections (voice or data).
53 54
54 There are some user space tools available at 55 There are some user space tools available at
55 http://sourceforge.net/projects/gigaset307x/ 56 https://sourceforge.net/projects/gigaset307x/
56 which provide access to additional device specific functions like SMS, 57 which provide access to additional device specific functions like SMS,
57 phonebook or call journal. 58 phonebook or call journal.
58 59
@@ -202,7 +203,7 @@ GigaSet 307x Device Driver
202 You can use some configuration tool of your distribution to configure this 203 You can use some configuration tool of your distribution to configure this
203 "modem" or configure pppd/wvdial manually. There are some example ppp 204 "modem" or configure pppd/wvdial manually. There are some example ppp
204 configuration files and chat scripts in the gigaset-VERSION/ppp directory 205 configuration files and chat scripts in the gigaset-VERSION/ppp directory
205 in the driver packages from http://sourceforge.net/projects/gigaset307x/. 206 in the driver packages from https://sourceforge.net/projects/gigaset307x/.
206 Please note that the USB drivers are not able to change the state of the 207 Please note that the USB drivers are not able to change the state of the
207 control lines. This means you must use "Stupid Mode" if you are using 208 control lines. This means you must use "Stupid Mode" if you are using
208 wvdial or you should use the nocrtscts option of pppd. 209 wvdial or you should use the nocrtscts option of pppd.
@@ -361,7 +362,7 @@ GigaSet 307x Device Driver
361 --------------------------- 362 ---------------------------
362 If you can't solve problems with the driver on your own, feel free to 363 If you can't solve problems with the driver on your own, feel free to
363 use one of the forums, bug trackers, or mailing lists on 364 use one of the forums, bug trackers, or mailing lists on
364 http://sourceforge.net/projects/gigaset307x 365 https://sourceforge.net/projects/gigaset307x
365 or write an electronic mail to the maintainers. 366 or write an electronic mail to the maintainers.
366 367
367 Try to provide as much information as possible, such as 368 Try to provide as much information as possible, such as
@@ -391,11 +392,12 @@ GigaSet 307x Device Driver
3914. Links, other software 3924. Links, other software
392 --------------------- 393 ---------------------
393 - Sourceforge project developing this driver and associated tools 394 - Sourceforge project developing this driver and associated tools
394 http://sourceforge.net/projects/gigaset307x 395 https://sourceforge.net/projects/gigaset307x
395 - Yahoo! Group on the Siemens Gigaset family of devices 396 - Yahoo! Group on the Siemens Gigaset family of devices
396 http://de.groups.yahoo.com/group/Siemens-Gigaset 397 https://de.groups.yahoo.com/group/Siemens-Gigaset
397 - Siemens Gigaset/T-Sinus compatibility table 398 - Siemens Gigaset/T-Sinus compatibility table
398 http://www.erbze.info/sinus_gigaset.htm 399 http://www.erbze.info/sinus_gigaset.htm
400 (archived at https://web.archive.org/web/20100717020421/http://www.erbze.info:80/sinus_gigaset.htm )
399 401
400 402
4015. Credits 4035. Credits
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 98a3a43484c8..44abb8a0a5e5 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -3147,7 +3147,7 @@ static int ia_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
3147 " Size of Tx Buffer : %u\n" 3147 " Size of Tx Buffer : %u\n"
3148 " Number of Rx Buffer: %u\n" 3148 " Number of Rx Buffer: %u\n"
3149 " Size of Rx Buffer : %u\n" 3149 " Size of Rx Buffer : %u\n"
3150 " Packets Receiverd : %u\n" 3150 " Packets Received : %u\n"
3151 " Packets Transmitted: %u\n" 3151 " Packets Transmitted: %u\n"
3152 " Cells Received : %u\n" 3152 " Cells Received : %u\n"
3153 " Cells Transmitted : %u\n" 3153 " Cells Transmitted : %u\n"
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c669554d70bb..b7b113018853 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1528,39 +1528,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1528 goto err_close; 1528 goto err_close;
1529 } 1529 }
1530 1530
1531 /* If the mode uses primary, then the following is handled by
1532 * bond_change_active_slave().
1533 */
1534 if (!bond_uses_primary(bond)) {
1535 /* set promiscuity level to new slave */
1536 if (bond_dev->flags & IFF_PROMISC) {
1537 res = dev_set_promiscuity(slave_dev, 1);
1538 if (res)
1539 goto err_close;
1540 }
1541
1542 /* set allmulti level to new slave */
1543 if (bond_dev->flags & IFF_ALLMULTI) {
1544 res = dev_set_allmulti(slave_dev, 1);
1545 if (res)
1546 goto err_close;
1547 }
1548
1549 netif_addr_lock_bh(bond_dev);
1550
1551 dev_mc_sync_multiple(slave_dev, bond_dev);
1552 dev_uc_sync_multiple(slave_dev, bond_dev);
1553
1554 netif_addr_unlock_bh(bond_dev);
1555 }
1556
1557 if (BOND_MODE(bond) == BOND_MODE_8023AD) {
1558 /* add lacpdu mc addr to mc list */
1559 u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
1560
1561 dev_mc_add(slave_dev, lacpdu_multicast);
1562 }
1563
1564 res = vlan_vids_add_by_dev(slave_dev, bond_dev); 1531 res = vlan_vids_add_by_dev(slave_dev, bond_dev);
1565 if (res) { 1532 if (res) {
1566 netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", 1533 netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n",
@@ -1725,6 +1692,40 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1725 goto err_upper_unlink; 1692 goto err_upper_unlink;
1726 } 1693 }
1727 1694
1695 /* If the mode uses primary, then the following is handled by
1696 * bond_change_active_slave().
1697 */
1698 if (!bond_uses_primary(bond)) {
1699 /* set promiscuity level to new slave */
1700 if (bond_dev->flags & IFF_PROMISC) {
1701 res = dev_set_promiscuity(slave_dev, 1);
1702 if (res)
1703 goto err_sysfs_del;
1704 }
1705
1706 /* set allmulti level to new slave */
1707 if (bond_dev->flags & IFF_ALLMULTI) {
1708 res = dev_set_allmulti(slave_dev, 1);
1709 if (res) {
1710 if (bond_dev->flags & IFF_PROMISC)
1711 dev_set_promiscuity(slave_dev, -1);
1712 goto err_sysfs_del;
1713 }
1714 }
1715
1716 netif_addr_lock_bh(bond_dev);
1717 dev_mc_sync_multiple(slave_dev, bond_dev);
1718 dev_uc_sync_multiple(slave_dev, bond_dev);
1719 netif_addr_unlock_bh(bond_dev);
1720
1721 if (BOND_MODE(bond) == BOND_MODE_8023AD) {
1722 /* add lacpdu mc addr to mc list */
1723 u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
1724
1725 dev_mc_add(slave_dev, lacpdu_multicast);
1726 }
1727 }
1728
1728 bond->slave_cnt++; 1729 bond->slave_cnt++;
1729 bond_compute_features(bond); 1730 bond_compute_features(bond);
1730 bond_set_carrier(bond); 1731 bond_set_carrier(bond);
@@ -1748,6 +1749,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1748 return 0; 1749 return 0;
1749 1750
1750/* Undo stages on error */ 1751/* Undo stages on error */
1752err_sysfs_del:
1753 bond_sysfs_slave_del(new_slave);
1754
1751err_upper_unlink: 1755err_upper_unlink:
1752 bond_upper_dev_unlink(bond, new_slave); 1756 bond_upper_dev_unlink(bond, new_slave);
1753 1757
@@ -1755,9 +1759,6 @@ err_unregister:
1755 netdev_rx_handler_unregister(slave_dev); 1759 netdev_rx_handler_unregister(slave_dev);
1756 1760
1757err_detach: 1761err_detach:
1758 if (!bond_uses_primary(bond))
1759 bond_hw_addr_flush(bond_dev, slave_dev);
1760
1761 vlan_vids_del_by_dev(slave_dev, bond_dev); 1762 vlan_vids_del_by_dev(slave_dev, bond_dev);
1762 if (rcu_access_pointer(bond->primary_slave) == new_slave) 1763 if (rcu_access_pointer(bond->primary_slave) == new_slave)
1763 RCU_INIT_POINTER(bond->primary_slave, NULL); 1764 RCU_INIT_POINTER(bond->primary_slave, NULL);
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 8a0bb000d056..4e53c5ce23ff 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1409,6 +1409,7 @@ static const struct of_device_id mt7530_of_match[] = {
1409 { .compatible = "mediatek,mt7530" }, 1409 { .compatible = "mediatek,mt7530" },
1410 { /* sentinel */ }, 1410 { /* sentinel */ },
1411}; 1411};
1412MODULE_DEVICE_TABLE(of, mt7530_of_match);
1412 1413
1413static struct mdio_driver mt7530_mdio_driver = { 1414static struct mdio_driver mt7530_mdio_driver = {
1414 .probe = mt7530_probe, 1415 .probe = mt7530_probe,
@@ -1424,4 +1425,3 @@ mdio_module_driver(mt7530_mdio_driver);
1424MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>"); 1425MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
1425MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch"); 1426MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch");
1426MODULE_LICENSE("GPL"); 1427MODULE_LICENSE("GPL");
1427MODULE_ALIAS("platform:mediatek-mt7530");
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 25e9a551cc8c..3f6fb635738c 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -1132,6 +1132,7 @@ static void mvneta_port_up(struct mvneta_port *pp)
1132 } 1132 }
1133 mvreg_write(pp, MVNETA_TXQ_CMD, q_map); 1133 mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
1134 1134
1135 q_map = 0;
1135 /* Enable all initialized RXQs. */ 1136 /* Enable all initialized RXQs. */
1136 for (queue = 0; queue < rxq_number; queue++) { 1137 for (queue = 0; queue < rxq_number; queue++) {
1137 struct mvneta_rx_queue *rxq = &pp->rxqs[queue]; 1138 struct mvneta_rx_queue *rxq = &pp->rxqs[queue];
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
index 1a0c3bf86ead..752a72499b4f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
@@ -156,57 +156,63 @@ static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
156static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) 156static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev)
157{ 157{
158 struct mlx4_en_priv *priv = netdev_priv(netdev); 158 struct mlx4_en_priv *priv = netdev_priv(netdev);
159 struct mlx4_en_port_profile *prof = priv->prof;
159 struct mlx4_en_dev *mdev = priv->mdev; 160 struct mlx4_en_dev *mdev = priv->mdev;
161 u8 tx_pause, tx_ppp, rx_pause, rx_ppp;
160 162
161 if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 163 if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
162 return 1; 164 return 1;
163 165
164 if (priv->cee_config.pfc_state) { 166 if (priv->cee_config.pfc_state) {
165 int tc; 167 int tc;
168 rx_ppp = prof->rx_ppp;
169 tx_ppp = prof->tx_ppp;
166 170
167 priv->prof->rx_pause = 0;
168 priv->prof->tx_pause = 0;
169 for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { 171 for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) {
170 u8 tc_mask = 1 << tc; 172 u8 tc_mask = 1 << tc;
171 173
172 switch (priv->cee_config.dcb_pfc[tc]) { 174 switch (priv->cee_config.dcb_pfc[tc]) {
173 case pfc_disabled: 175 case pfc_disabled:
174 priv->prof->tx_ppp &= ~tc_mask; 176 tx_ppp &= ~tc_mask;
175 priv->prof->rx_ppp &= ~tc_mask; 177 rx_ppp &= ~tc_mask;
176 break; 178 break;
177 case pfc_enabled_full: 179 case pfc_enabled_full:
178 priv->prof->tx_ppp |= tc_mask; 180 tx_ppp |= tc_mask;
179 priv->prof->rx_ppp |= tc_mask; 181 rx_ppp |= tc_mask;
180 break; 182 break;
181 case pfc_enabled_tx: 183 case pfc_enabled_tx:
182 priv->prof->tx_ppp |= tc_mask; 184 tx_ppp |= tc_mask;
183 priv->prof->rx_ppp &= ~tc_mask; 185 rx_ppp &= ~tc_mask;
184 break; 186 break;
185 case pfc_enabled_rx: 187 case pfc_enabled_rx:
186 priv->prof->tx_ppp &= ~tc_mask; 188 tx_ppp &= ~tc_mask;
187 priv->prof->rx_ppp |= tc_mask; 189 rx_ppp |= tc_mask;
188 break; 190 break;
189 default: 191 default:
190 break; 192 break;
191 } 193 }
192 } 194 }
193 en_dbg(DRV, priv, "Set pfc on\n"); 195 rx_pause = !!(rx_ppp || tx_ppp) ? 0 : prof->rx_pause;
196 tx_pause = !!(rx_ppp || tx_ppp) ? 0 : prof->tx_pause;
194 } else { 197 } else {
195 priv->prof->rx_pause = 1; 198 rx_ppp = 0;
196 priv->prof->tx_pause = 1; 199 tx_ppp = 0;
197 en_dbg(DRV, priv, "Set pfc off\n"); 200 rx_pause = prof->rx_pause;
201 tx_pause = prof->tx_pause;
198 } 202 }
199 203
200 if (mlx4_SET_PORT_general(mdev->dev, priv->port, 204 if (mlx4_SET_PORT_general(mdev->dev, priv->port,
201 priv->rx_skb_size + ETH_FCS_LEN, 205 priv->rx_skb_size + ETH_FCS_LEN,
202 priv->prof->tx_pause, 206 tx_pause, tx_ppp, rx_pause, rx_ppp)) {
203 priv->prof->tx_ppp,
204 priv->prof->rx_pause,
205 priv->prof->rx_ppp)) {
206 en_err(priv, "Failed setting pause params\n"); 207 en_err(priv, "Failed setting pause params\n");
207 return 1; 208 return 1;
208 } 209 }
209 210
211 prof->tx_ppp = tx_ppp;
212 prof->rx_ppp = rx_ppp;
213 prof->tx_pause = tx_pause;
214 prof->rx_pause = rx_pause;
215
210 return 0; 216 return 0;
211} 217}
212 218
@@ -408,6 +414,7 @@ static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
408 struct mlx4_en_priv *priv = netdev_priv(dev); 414 struct mlx4_en_priv *priv = netdev_priv(dev);
409 struct mlx4_en_port_profile *prof = priv->prof; 415 struct mlx4_en_port_profile *prof = priv->prof;
410 struct mlx4_en_dev *mdev = priv->mdev; 416 struct mlx4_en_dev *mdev = priv->mdev;
417 u32 tx_pause, tx_ppp, rx_pause, rx_ppp;
411 int err; 418 int err;
412 419
413 en_dbg(DRV, priv, "cap: 0x%x en: 0x%x mbc: 0x%x delay: %d\n", 420 en_dbg(DRV, priv, "cap: 0x%x en: 0x%x mbc: 0x%x delay: %d\n",
@@ -416,23 +423,26 @@ static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
416 pfc->mbc, 423 pfc->mbc,
417 pfc->delay); 424 pfc->delay);
418 425
419 prof->rx_pause = !pfc->pfc_en; 426 rx_pause = prof->rx_pause && !pfc->pfc_en;
420 prof->tx_pause = !pfc->pfc_en; 427 tx_pause = prof->tx_pause && !pfc->pfc_en;
421 prof->rx_ppp = pfc->pfc_en; 428 rx_ppp = pfc->pfc_en;
422 prof->tx_ppp = pfc->pfc_en; 429 tx_ppp = pfc->pfc_en;
423 430
424 err = mlx4_SET_PORT_general(mdev->dev, priv->port, 431 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
425 priv->rx_skb_size + ETH_FCS_LEN, 432 priv->rx_skb_size + ETH_FCS_LEN,
426 prof->tx_pause, 433 tx_pause, tx_ppp, rx_pause, rx_ppp);
427 prof->tx_ppp, 434 if (err) {
428 prof->rx_pause,
429 prof->rx_ppp);
430 if (err)
431 en_err(priv, "Failed setting pause params\n"); 435 en_err(priv, "Failed setting pause params\n");
432 else 436 return err;
433 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap, 437 }
434 prof->rx_ppp, prof->rx_pause, 438
435 prof->tx_ppp, prof->tx_pause); 439 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap,
440 rx_ppp, rx_pause, tx_ppp, tx_pause);
441
442 prof->tx_ppp = tx_ppp;
443 prof->rx_ppp = rx_ppp;
444 prof->rx_pause = rx_pause;
445 prof->tx_pause = tx_pause;
436 446
437 return err; 447 return err;
438} 448}
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index ebc1f566a4d9..f3302edba8b4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1046,27 +1046,32 @@ static int mlx4_en_set_pauseparam(struct net_device *dev,
1046{ 1046{
1047 struct mlx4_en_priv *priv = netdev_priv(dev); 1047 struct mlx4_en_priv *priv = netdev_priv(dev);
1048 struct mlx4_en_dev *mdev = priv->mdev; 1048 struct mlx4_en_dev *mdev = priv->mdev;
1049 u8 tx_pause, tx_ppp, rx_pause, rx_ppp;
1049 int err; 1050 int err;
1050 1051
1051 if (pause->autoneg) 1052 if (pause->autoneg)
1052 return -EINVAL; 1053 return -EINVAL;
1053 1054
1054 priv->prof->tx_pause = pause->tx_pause != 0; 1055 tx_pause = !!(pause->tx_pause);
1055 priv->prof->rx_pause = pause->rx_pause != 0; 1056 rx_pause = !!(pause->rx_pause);
1057 rx_ppp = priv->prof->rx_ppp && !(tx_pause || rx_pause);
1058 tx_ppp = priv->prof->tx_ppp && !(tx_pause || rx_pause);
1059
1056 err = mlx4_SET_PORT_general(mdev->dev, priv->port, 1060 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
1057 priv->rx_skb_size + ETH_FCS_LEN, 1061 priv->rx_skb_size + ETH_FCS_LEN,
1058 priv->prof->tx_pause, 1062 tx_pause, tx_ppp, rx_pause, rx_ppp);
1059 priv->prof->tx_ppp, 1063 if (err) {
1060 priv->prof->rx_pause, 1064 en_err(priv, "Failed setting pause params, err = %d\n", err);
1061 priv->prof->rx_ppp); 1065 return err;
1062 if (err) 1066 }
1063 en_err(priv, "Failed setting pause params\n"); 1067
1064 else 1068 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap,
1065 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap, 1069 rx_ppp, rx_pause, tx_ppp, tx_pause);
1066 priv->prof->rx_ppp, 1070
1067 priv->prof->rx_pause, 1071 priv->prof->tx_pause = tx_pause;
1068 priv->prof->tx_ppp, 1072 priv->prof->rx_pause = rx_pause;
1069 priv->prof->tx_pause); 1073 priv->prof->tx_ppp = tx_ppp;
1074 priv->prof->rx_ppp = rx_ppp;
1070 1075
1071 return err; 1076 return err;
1072} 1077}
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c
index 2c2965497ed3..d25e16d2c319 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c
@@ -163,9 +163,9 @@ static void mlx4_en_get_profile(struct mlx4_en_dev *mdev)
163 params->udp_rss = 0; 163 params->udp_rss = 0;
164 } 164 }
165 for (i = 1; i <= MLX4_MAX_PORTS; i++) { 165 for (i = 1; i <= MLX4_MAX_PORTS; i++) {
166 params->prof[i].rx_pause = 1; 166 params->prof[i].rx_pause = !(pfcrx || pfctx);
167 params->prof[i].rx_ppp = pfcrx; 167 params->prof[i].rx_ppp = pfcrx;
168 params->prof[i].tx_pause = 1; 168 params->prof[i].tx_pause = !(pfcrx || pfctx);
169 params->prof[i].tx_ppp = pfctx; 169 params->prof[i].tx_ppp = pfctx;
170 params->prof[i].tx_ring_size = MLX4_EN_DEF_TX_RING_SIZE; 170 params->prof[i].tx_ring_size = MLX4_EN_DEF_TX_RING_SIZE;
171 params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE; 171 params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 606a0e0beeae..29e50f787349 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -5088,6 +5088,7 @@ static void rem_slave_fs_rule(struct mlx4_dev *dev, int slave)
5088 &tracker->res_tree[RES_FS_RULE]); 5088 &tracker->res_tree[RES_FS_RULE]);
5089 list_del(&fs_rule->com.list); 5089 list_del(&fs_rule->com.list);
5090 spin_unlock_irq(mlx4_tlock(dev)); 5090 spin_unlock_irq(mlx4_tlock(dev));
5091 kfree(fs_rule->mirr_mbox);
5091 kfree(fs_rule); 5092 kfree(fs_rule);
5092 state = 0; 5093 state = 0;
5093 break; 5094 break;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 25deaa5a534c..c032319f1cb9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -46,7 +46,7 @@ config MLX5_MPFS
46 46
47config MLX5_ESWITCH 47config MLX5_ESWITCH
48 bool "Mellanox Technologies MLX5 SRIOV E-Switch support" 48 bool "Mellanox Technologies MLX5 SRIOV E-Switch support"
49 depends on MLX5_CORE_EN 49 depends on MLX5_CORE_EN && NET_SWITCHDEV
50 default y 50 default y
51 ---help--- 51 ---help---
52 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC. 52 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index cc8048f68f11..59ebfdae6695 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -477,6 +477,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
477 return mlx5e_ethtool_get_coalesce(priv, coal); 477 return mlx5e_ethtool_get_coalesce(priv, coal);
478} 478}
479 479
480#define MLX5E_MAX_COAL_TIME MLX5_MAX_CQ_PERIOD
481#define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT
482
480static void 483static void
481mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) 484mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
482{ 485{
@@ -511,6 +514,20 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
511 if (!MLX5_CAP_GEN(mdev, cq_moderation)) 514 if (!MLX5_CAP_GEN(mdev, cq_moderation))
512 return -EOPNOTSUPP; 515 return -EOPNOTSUPP;
513 516
517 if (coal->tx_coalesce_usecs > MLX5E_MAX_COAL_TIME ||
518 coal->rx_coalesce_usecs > MLX5E_MAX_COAL_TIME) {
519 netdev_info(priv->netdev, "%s: maximum coalesce time supported is %lu usecs\n",
520 __func__, MLX5E_MAX_COAL_TIME);
521 return -ERANGE;
522 }
523
524 if (coal->tx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES ||
525 coal->rx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES) {
526 netdev_info(priv->netdev, "%s: maximum coalesced frames supported is %lu\n",
527 __func__, MLX5E_MAX_COAL_FRAMES);
528 return -ERANGE;
529 }
530
514 mutex_lock(&priv->state_lock); 531 mutex_lock(&priv->state_lock);
515 new_channels.params = priv->channels.params; 532 new_channels.params = priv->channels.params;
516 533
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index da94c8cba5ee..9b4827d36e3e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2572,6 +2572,9 @@ int mlx5e_open(struct net_device *netdev)
2572 mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); 2572 mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP);
2573 mutex_unlock(&priv->state_lock); 2573 mutex_unlock(&priv->state_lock);
2574 2574
2575 if (mlx5e_vxlan_allowed(priv->mdev))
2576 udp_tunnel_get_rx_info(netdev);
2577
2575 return err; 2578 return err;
2576} 2579}
2577 2580
@@ -4069,7 +4072,7 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev)
4069 } 4072 }
4070} 4073}
4071 4074
4072#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) 4075#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
4073static const struct switchdev_ops mlx5e_switchdev_ops = { 4076static const struct switchdev_ops mlx5e_switchdev_ops = {
4074 .switchdev_port_attr_get = mlx5e_attr_get, 4077 .switchdev_port_attr_get = mlx5e_attr_get,
4075}; 4078};
@@ -4175,7 +4178,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
4175 4178
4176 mlx5e_set_netdev_dev_addr(netdev); 4179 mlx5e_set_netdev_dev_addr(netdev);
4177 4180
4178#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) 4181#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
4179 if (MLX5_VPORT_MANAGER(mdev)) 4182 if (MLX5_VPORT_MANAGER(mdev))
4180 netdev->switchdev_ops = &mlx5e_switchdev_ops; 4183 netdev->switchdev_ops = &mlx5e_switchdev_ops;
4181#endif 4184#endif
@@ -4327,12 +4330,6 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
4327#ifdef CONFIG_MLX5_CORE_EN_DCB 4330#ifdef CONFIG_MLX5_CORE_EN_DCB
4328 mlx5e_dcbnl_init_app(priv); 4331 mlx5e_dcbnl_init_app(priv);
4329#endif 4332#endif
4330 /* Device already registered: sync netdev system state */
4331 if (mlx5e_vxlan_allowed(mdev)) {
4332 rtnl_lock();
4333 udp_tunnel_get_rx_info(netdev);
4334 rtnl_unlock();
4335 }
4336 4333
4337 queue_work(priv->wq, &priv->set_rx_mode_work); 4334 queue_work(priv->wq, &priv->set_rx_mode_work);
4338 4335
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 363d8dcb7f17..500d817d2b0a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -44,6 +44,11 @@
44#include "en_tc.h" 44#include "en_tc.h"
45#include "fs_core.h" 45#include "fs_core.h"
46 46
47#define MLX5E_REP_PARAMS_LOG_SQ_SIZE \
48 max(0x6, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
49#define MLX5E_REP_PARAMS_LOG_RQ_SIZE \
50 max(0x6, MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)
51
47static const char mlx5e_rep_driver_name[] = "mlx5e_rep"; 52static const char mlx5e_rep_driver_name[] = "mlx5e_rep";
48 53
49static void mlx5e_rep_get_drvinfo(struct net_device *dev, 54static void mlx5e_rep_get_drvinfo(struct net_device *dev,
@@ -209,7 +214,7 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw,
209 214
210static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw, 215static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
211 struct mlx5_eswitch_rep *rep, 216 struct mlx5_eswitch_rep *rep,
212 u16 *sqns_array, int sqns_num) 217 u32 *sqns_array, int sqns_num)
213{ 218{
214 struct mlx5_flow_handle *flow_rule; 219 struct mlx5_flow_handle *flow_rule;
215 struct mlx5e_rep_priv *rpriv; 220 struct mlx5e_rep_priv *rpriv;
@@ -255,9 +260,9 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
255 struct mlx5e_channel *c; 260 struct mlx5e_channel *c;
256 int n, tc, num_sqs = 0; 261 int n, tc, num_sqs = 0;
257 int err = -ENOMEM; 262 int err = -ENOMEM;
258 u16 *sqs; 263 u32 *sqs;
259 264
260 sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(u16), GFP_KERNEL); 265 sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL);
261 if (!sqs) 266 if (!sqs)
262 goto out; 267 goto out;
263 268
@@ -288,7 +293,7 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
288static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv) 293static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv)
289{ 294{
290#if IS_ENABLED(CONFIG_IPV6) 295#if IS_ENABLED(CONFIG_IPV6)
291 unsigned long ipv6_interval = NEIGH_VAR(&ipv6_stub->nd_tbl->parms, 296 unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms,
292 DELAY_PROBE_TIME); 297 DELAY_PROBE_TIME);
293#else 298#else
294 unsigned long ipv6_interval = ~0UL; 299 unsigned long ipv6_interval = ~0UL;
@@ -424,7 +429,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
424 case NETEVENT_NEIGH_UPDATE: 429 case NETEVENT_NEIGH_UPDATE:
425 n = ptr; 430 n = ptr;
426#if IS_ENABLED(CONFIG_IPV6) 431#if IS_ENABLED(CONFIG_IPV6)
427 if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) 432 if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
428#else 433#else
429 if (n->tbl != &arp_tbl) 434 if (n->tbl != &arp_tbl)
430#endif 435#endif
@@ -472,7 +477,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
472 * done per device delay prob time parameter. 477 * done per device delay prob time parameter.
473 */ 478 */
474#if IS_ENABLED(CONFIG_IPV6) 479#if IS_ENABLED(CONFIG_IPV6)
475 if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl)) 480 if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
476#else 481#else
477 if (!p->dev || p->tbl != &arp_tbl) 482 if (!p->dev || p->tbl != &arp_tbl)
478#endif 483#endif
@@ -668,7 +673,6 @@ static int mlx5e_rep_open(struct net_device *dev)
668 struct mlx5e_priv *priv = netdev_priv(dev); 673 struct mlx5e_priv *priv = netdev_priv(dev);
669 struct mlx5e_rep_priv *rpriv = priv->ppriv; 674 struct mlx5e_rep_priv *rpriv = priv->ppriv;
670 struct mlx5_eswitch_rep *rep = rpriv->rep; 675 struct mlx5_eswitch_rep *rep = rpriv->rep;
671 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
672 int err; 676 int err;
673 677
674 mutex_lock(&priv->state_lock); 678 mutex_lock(&priv->state_lock);
@@ -676,8 +680,9 @@ static int mlx5e_rep_open(struct net_device *dev)
676 if (err) 680 if (err)
677 goto unlock; 681 goto unlock;
678 682
679 if (!mlx5_eswitch_set_vport_state(esw, rep->vport, 683 if (!mlx5_modify_vport_admin_state(priv->mdev,
680 MLX5_ESW_VPORT_ADMIN_STATE_UP)) 684 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
685 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
681 netif_carrier_on(dev); 686 netif_carrier_on(dev);
682 687
683unlock: 688unlock:
@@ -690,11 +695,12 @@ static int mlx5e_rep_close(struct net_device *dev)
690 struct mlx5e_priv *priv = netdev_priv(dev); 695 struct mlx5e_priv *priv = netdev_priv(dev);
691 struct mlx5e_rep_priv *rpriv = priv->ppriv; 696 struct mlx5e_rep_priv *rpriv = priv->ppriv;
692 struct mlx5_eswitch_rep *rep = rpriv->rep; 697 struct mlx5_eswitch_rep *rep = rpriv->rep;
693 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
694 int ret; 698 int ret;
695 699
696 mutex_lock(&priv->state_lock); 700 mutex_lock(&priv->state_lock);
697 (void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN); 701 mlx5_modify_vport_admin_state(priv->mdev,
702 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
703 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
698 ret = mlx5e_close_locked(dev); 704 ret = mlx5e_close_locked(dev);
699 mutex_unlock(&priv->state_lock); 705 mutex_unlock(&priv->state_lock);
700 return ret; 706 return ret;
@@ -877,9 +883,9 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
877 MLX5_CQ_PERIOD_MODE_START_FROM_CQE : 883 MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
878 MLX5_CQ_PERIOD_MODE_START_FROM_EQE; 884 MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
879 885
880 params->log_sq_size = MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; 886 params->log_sq_size = MLX5E_REP_PARAMS_LOG_SQ_SIZE;
881 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST; 887 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST;
882 params->log_rq_size = MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE; 888 params->log_rq_size = MLX5E_REP_PARAMS_LOG_RQ_SIZE;
883 889
884 params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation); 890 params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
885 mlx5e_set_rx_cq_mode_params(params, cq_period_mode); 891 mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
@@ -899,9 +905,7 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
899 905
900 netdev->ethtool_ops = &mlx5e_rep_ethtool_ops; 906 netdev->ethtool_ops = &mlx5e_rep_ethtool_ops;
901 907
902#ifdef CONFIG_NET_SWITCHDEV
903 netdev->switchdev_ops = &mlx5e_rep_switchdev_ops; 908 netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
904#endif
905 909
906 netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL; 910 netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
907 netdev->hw_features |= NETIF_F_HW_TC; 911 netdev->hw_features |= NETIF_F_HW_TC;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index fa86a1466718..43234cabf444 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -963,7 +963,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
963 tbl = &arp_tbl; 963 tbl = &arp_tbl;
964#if IS_ENABLED(CONFIG_IPV6) 964#if IS_ENABLED(CONFIG_IPV6)
965 else if (m_neigh->family == AF_INET6) 965 else if (m_neigh->family == AF_INET6)
966 tbl = ipv6_stub->nd_tbl; 966 tbl = &nd_tbl;
967#endif 967#endif
968 else 968 else
969 return; 969 return;
@@ -2608,19 +2608,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
2608 if (err != -EAGAIN) 2608 if (err != -EAGAIN)
2609 flow->flags |= MLX5E_TC_FLOW_OFFLOADED; 2609 flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
2610 2610
2611 if (!(flow->flags & MLX5E_TC_FLOW_ESWITCH) ||
2612 !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
2613 kvfree(parse_attr);
2614
2611 err = rhashtable_insert_fast(&tc->ht, &flow->node, 2615 err = rhashtable_insert_fast(&tc->ht, &flow->node,
2612 tc->ht_params); 2616 tc->ht_params);
2613 if (err) 2617 if (err) {
2614 goto err_del_rule; 2618 mlx5e_tc_del_flow(priv, flow);
2619 kfree(flow);
2620 }
2615 2621
2616 if (flow->flags & MLX5E_TC_FLOW_ESWITCH &&
2617 !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
2618 kvfree(parse_attr);
2619 return err; 2622 return err;
2620 2623
2621err_del_rule:
2622 mlx5e_tc_del_flow(priv, flow);
2623
2624err_free: 2624err_free:
2625 kvfree(parse_attr); 2625 kvfree(parse_attr);
2626 kfree(flow); 2626 kfree(flow);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index f7948e983637..997e24dcb053 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -1380,6 +1380,55 @@ mlxsw_sp_ipip_entry_ol_up_event(struct mlxsw_sp *mlxsw_sp,
1380 decap_fib_entry); 1380 decap_fib_entry);
1381} 1381}
1382 1382
1383static int
1384mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
1385 struct mlxsw_sp_vr *ul_vr, bool enable)
1386{
1387 struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
1388 struct mlxsw_sp_rif *rif = &lb_rif->common;
1389 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
1390 char ritr_pl[MLXSW_REG_RITR_LEN];
1391 u32 saddr4;
1392
1393 switch (lb_cf.ul_protocol) {
1394 case MLXSW_SP_L3_PROTO_IPV4:
1395 saddr4 = be32_to_cpu(lb_cf.saddr.addr4);
1396 mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
1397 rif->rif_index, rif->vr_id, rif->dev->mtu);
1398 mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
1399 MLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,
1400 ul_vr->id, saddr4, lb_cf.okey);
1401 break;
1402
1403 case MLXSW_SP_L3_PROTO_IPV6:
1404 return -EAFNOSUPPORT;
1405 }
1406
1407 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
1408}
1409
1410static int mlxsw_sp_netdevice_ipip_ol_update_mtu(struct mlxsw_sp *mlxsw_sp,
1411 struct net_device *ol_dev)
1412{
1413 struct mlxsw_sp_ipip_entry *ipip_entry;
1414 struct mlxsw_sp_rif_ipip_lb *lb_rif;
1415 struct mlxsw_sp_vr *ul_vr;
1416 int err = 0;
1417
1418 ipip_entry = mlxsw_sp_ipip_entry_find_by_ol_dev(mlxsw_sp, ol_dev);
1419 if (ipip_entry) {
1420 lb_rif = ipip_entry->ol_lb;
1421 ul_vr = &mlxsw_sp->router->vrs[lb_rif->ul_vr_id];
1422 err = mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr, true);
1423 if (err)
1424 goto out;
1425 lb_rif->common.mtu = ol_dev->mtu;
1426 }
1427
1428out:
1429 return err;
1430}
1431
1383static void mlxsw_sp_netdevice_ipip_ol_up_event(struct mlxsw_sp *mlxsw_sp, 1432static void mlxsw_sp_netdevice_ipip_ol_up_event(struct mlxsw_sp *mlxsw_sp,
1384 struct net_device *ol_dev) 1433 struct net_device *ol_dev)
1385{ 1434{
@@ -1660,6 +1709,8 @@ int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp,
1660 extack = info->extack; 1709 extack = info->extack;
1661 return mlxsw_sp_netdevice_ipip_ol_change_event(mlxsw_sp, 1710 return mlxsw_sp_netdevice_ipip_ol_change_event(mlxsw_sp,
1662 ol_dev, extack); 1711 ol_dev, extack);
1712 case NETDEV_CHANGEMTU:
1713 return mlxsw_sp_netdevice_ipip_ol_update_mtu(mlxsw_sp, ol_dev);
1663 } 1714 }
1664 return 0; 1715 return 0;
1665} 1716}
@@ -6844,33 +6895,6 @@ mlxsw_sp_rif_ipip_lb_setup(struct mlxsw_sp_rif *rif,
6844} 6895}
6845 6896
6846static int 6897static int
6847mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
6848 struct mlxsw_sp_vr *ul_vr, bool enable)
6849{
6850 struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
6851 struct mlxsw_sp_rif *rif = &lb_rif->common;
6852 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
6853 char ritr_pl[MLXSW_REG_RITR_LEN];
6854 u32 saddr4;
6855
6856 switch (lb_cf.ul_protocol) {
6857 case MLXSW_SP_L3_PROTO_IPV4:
6858 saddr4 = be32_to_cpu(lb_cf.saddr.addr4);
6859 mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
6860 rif->rif_index, rif->vr_id, rif->dev->mtu);
6861 mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
6862 MLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,
6863 ul_vr->id, saddr4, lb_cf.okey);
6864 break;
6865
6866 case MLXSW_SP_L3_PROTO_IPV6:
6867 return -EAFNOSUPPORT;
6868 }
6869
6870 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
6871}
6872
6873static int
6874mlxsw_sp_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif) 6898mlxsw_sp_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif)
6875{ 6899{
6876 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif); 6900 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif);
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
index 56451edf01c2..ecd7c33baf3c 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
@@ -74,7 +74,9 @@ nfp_meta_has_prev(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
74 74
75static void nfp_prog_push(struct nfp_prog *nfp_prog, u64 insn) 75static void nfp_prog_push(struct nfp_prog *nfp_prog, u64 insn)
76{ 76{
77 if (nfp_prog->__prog_alloc_len == nfp_prog->prog_len) { 77 if (nfp_prog->__prog_alloc_len / sizeof(u64) == nfp_prog->prog_len) {
78 pr_warn("instruction limit reached (%u NFP instructions)\n",
79 nfp_prog->prog_len);
78 nfp_prog->error = -ENOSPC; 80 nfp_prog->error = -ENOSPC;
79 return; 81 return;
80 } 82 }
@@ -2463,6 +2465,8 @@ static int nfp_translate(struct nfp_prog *nfp_prog)
2463 err = cb(nfp_prog, meta); 2465 err = cb(nfp_prog, meta);
2464 if (err) 2466 if (err)
2465 return err; 2467 return err;
2468 if (nfp_prog->error)
2469 return nfp_prog->error;
2466 2470
2467 nfp_prog->n_translated++; 2471 nfp_prog->n_translated++;
2468 } 2472 }
diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c
index dafc079ab6b9..14941303189d 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_fp.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c
@@ -320,13 +320,11 @@ static inline void qede_update_tx_producer(struct qede_tx_queue *txq)
320 barrier(); 320 barrier();
321 writel(txq->tx_db.raw, txq->doorbell_addr); 321 writel(txq->tx_db.raw, txq->doorbell_addr);
322 322
323 /* mmiowb is needed to synchronize doorbell writes from more than one 323 /* Fence required to flush the write combined buffer, since another
324 * processor. It guarantees that the write arrives to the device before 324 * CPU may write to the same doorbell address and data may be lost
325 * the queue lock is released and another start_xmit is called (possibly 325 * due to relaxed order nature of write combined bar.
326 * on another CPU). Without this barrier, the next doorbell can bypass
327 * this doorbell. This is applicable to IA64/Altix systems.
328 */ 326 */
329 mmiowb(); 327 wmb();
330} 328}
331 329
332static int qede_xdp_xmit(struct qede_dev *edev, struct qede_fastpath *fp, 330static int qede_xdp_xmit(struct qede_dev *edev, struct qede_fastpath *fp,
@@ -1249,16 +1247,10 @@ static int qede_rx_process_cqe(struct qede_dev *edev,
1249 1247
1250 csum_flag = qede_check_csum(parse_flag); 1248 csum_flag = qede_check_csum(parse_flag);
1251 if (unlikely(csum_flag == QEDE_CSUM_ERROR)) { 1249 if (unlikely(csum_flag == QEDE_CSUM_ERROR)) {
1252 if (qede_pkt_is_ip_fragmented(fp_cqe, parse_flag)) { 1250 if (qede_pkt_is_ip_fragmented(fp_cqe, parse_flag))
1253 rxq->rx_ip_frags++; 1251 rxq->rx_ip_frags++;
1254 } else { 1252 else
1255 DP_NOTICE(edev,
1256 "CQE has error, flags = %x, dropping incoming packet\n",
1257 parse_flag);
1258 rxq->rx_hw_errors++; 1253 rxq->rx_hw_errors++;
1259 qede_recycle_rx_bd_ring(rxq, fp_cqe->bd_num);
1260 return 0;
1261 }
1262 } 1254 }
1263 1255
1264 /* Basic validation passed; Need to prepare an SKB. This would also 1256 /* Basic validation passed; Need to prepare an SKB. This would also
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 0bf7d1759250..b4779acb6b5c 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -8660,12 +8660,12 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8660 if (!tp->counters) 8660 if (!tp->counters)
8661 return -ENOMEM; 8661 return -ENOMEM;
8662 8662
8663 pci_set_drvdata(pdev, dev);
8664
8663 rc = register_netdev(dev); 8665 rc = register_netdev(dev);
8664 if (rc < 0) 8666 if (rc < 0)
8665 return rc; 8667 return rc;
8666 8668
8667 pci_set_drvdata(pdev, dev);
8668
8669 netif_info(tp, probe, dev, "%s at 0x%p, %pM, XID %08x IRQ %d\n", 8669 netif_info(tp, probe, dev, "%s at 0x%p, %pM, XID %08x IRQ %d\n",
8670 rtl_chip_infos[chipset].name, ioaddr, dev->dev_addr, 8670 rtl_chip_infos[chipset].name, ioaddr, dev->dev_addr,
8671 (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), pdev->irq); 8671 (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), pdev->irq);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index a6ec41c399d6..465c42e30508 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -858,7 +858,7 @@ static void rndis_set_multicast(struct work_struct *w)
858 if (flags & IFF_PROMISC) { 858 if (flags & IFF_PROMISC) {
859 filter = NDIS_PACKET_TYPE_PROMISCUOUS; 859 filter = NDIS_PACKET_TYPE_PROMISCUOUS;
860 } else { 860 } else {
861 if (flags & IFF_ALLMULTI) 861 if (!netdev_mc_empty(rdev->ndev) || (flags & IFF_ALLMULTI))
862 filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; 862 filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
863 if (flags & IFF_BROADCAST) 863 if (flags & IFF_BROADCAST)
864 filter |= NDIS_PACKET_TYPE_BROADCAST; 864 filter |= NDIS_PACKET_TYPE_BROADCAST;
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 56c701b73c12..befed2d22bf4 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1197,11 +1197,6 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
1197 goto err_dev_open; 1197 goto err_dev_open;
1198 } 1198 }
1199 1199
1200 netif_addr_lock_bh(dev);
1201 dev_uc_sync_multiple(port_dev, dev);
1202 dev_mc_sync_multiple(port_dev, dev);
1203 netif_addr_unlock_bh(dev);
1204
1205 err = vlan_vids_add_by_dev(port_dev, dev); 1200 err = vlan_vids_add_by_dev(port_dev, dev);
1206 if (err) { 1201 if (err) {
1207 netdev_err(dev, "Failed to add vlan ids to device %s\n", 1202 netdev_err(dev, "Failed to add vlan ids to device %s\n",
@@ -1241,6 +1236,11 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
1241 goto err_option_port_add; 1236 goto err_option_port_add;
1242 } 1237 }
1243 1238
1239 netif_addr_lock_bh(dev);
1240 dev_uc_sync_multiple(port_dev, dev);
1241 dev_mc_sync_multiple(port_dev, dev);
1242 netif_addr_unlock_bh(dev);
1243
1244 port->index = -1; 1244 port->index = -1;
1245 list_add_tail_rcu(&port->list, &team->port_list); 1245 list_add_tail_rcu(&port->list, &team->port_list);
1246 team_port_enable(team, port); 1246 team_port_enable(team, port);
@@ -1265,8 +1265,6 @@ err_enable_netpoll:
1265 vlan_vids_del_by_dev(port_dev, dev); 1265 vlan_vids_del_by_dev(port_dev, dev);
1266 1266
1267err_vids_add: 1267err_vids_add:
1268 dev_uc_unsync(port_dev, dev);
1269 dev_mc_unsync(port_dev, dev);
1270 dev_close(port_dev); 1268 dev_close(port_dev);
1271 1269
1272err_dev_open: 1270err_dev_open:
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 60a604cc7647..55a78eb96961 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2351,6 +2351,7 @@ static int lan78xx_reset(struct lan78xx_net *dev)
2351 u32 buf; 2351 u32 buf;
2352 int ret = 0; 2352 int ret = 0;
2353 unsigned long timeout; 2353 unsigned long timeout;
2354 u8 sig;
2354 2355
2355 ret = lan78xx_read_reg(dev, HW_CFG, &buf); 2356 ret = lan78xx_read_reg(dev, HW_CFG, &buf);
2356 buf |= HW_CFG_LRST_; 2357 buf |= HW_CFG_LRST_;
@@ -2450,6 +2451,15 @@ static int lan78xx_reset(struct lan78xx_net *dev)
2450 /* LAN7801 only has RGMII mode */ 2451 /* LAN7801 only has RGMII mode */
2451 if (dev->chipid == ID_REV_CHIP_ID_7801_) 2452 if (dev->chipid == ID_REV_CHIP_ID_7801_)
2452 buf &= ~MAC_CR_GMII_EN_; 2453 buf &= ~MAC_CR_GMII_EN_;
2454
2455 if (dev->chipid == ID_REV_CHIP_ID_7800_) {
2456 ret = lan78xx_read_raw_eeprom(dev, 0, 1, &sig);
2457 if (!ret && sig != EEPROM_INDICATOR) {
2458 /* Implies there is no external eeprom. Set mac speed */
2459 netdev_info(dev->net, "No External EEPROM. Setting MAC Speed\n");
2460 buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
2461 }
2462 }
2453 ret = lan78xx_write_reg(dev, MAC_CR, buf); 2463 ret = lan78xx_write_reg(dev, MAC_CR, buf);
2454 2464
2455 ret = lan78xx_read_reg(dev, MAC_TX, &buf); 2465 ret = lan78xx_read_reg(dev, MAC_TX, &buf);
@@ -2863,8 +2873,7 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
2863 if (ret < 0) { 2873 if (ret < 0) {
2864 netdev_warn(dev->net, 2874 netdev_warn(dev->net,
2865 "lan78xx_setup_irq_domain() failed : %d", ret); 2875 "lan78xx_setup_irq_domain() failed : %d", ret);
2866 kfree(pdata); 2876 goto out1;
2867 return ret;
2868 } 2877 }
2869 2878
2870 dev->net->hard_header_len += TX_OVERHEAD; 2879 dev->net->hard_header_len += TX_OVERHEAD;
@@ -2872,14 +2881,32 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
2872 2881
2873 /* Init all registers */ 2882 /* Init all registers */
2874 ret = lan78xx_reset(dev); 2883 ret = lan78xx_reset(dev);
2884 if (ret) {
2885 netdev_warn(dev->net, "Registers INIT FAILED....");
2886 goto out2;
2887 }
2875 2888
2876 ret = lan78xx_mdio_init(dev); 2889 ret = lan78xx_mdio_init(dev);
2890 if (ret) {
2891 netdev_warn(dev->net, "MDIO INIT FAILED.....");
2892 goto out2;
2893 }
2877 2894
2878 dev->net->flags |= IFF_MULTICAST; 2895 dev->net->flags |= IFF_MULTICAST;
2879 2896
2880 pdata->wol = WAKE_MAGIC; 2897 pdata->wol = WAKE_MAGIC;
2881 2898
2882 return ret; 2899 return ret;
2900
2901out2:
2902 lan78xx_remove_irq_domain(dev);
2903
2904out1:
2905 netdev_warn(dev->net, "Bind routine FAILED");
2906 cancel_work_sync(&pdata->set_multicast);
2907 cancel_work_sync(&pdata->set_vlan);
2908 kfree(pdata);
2909 return ret;
2883} 2910}
2884 2911
2885static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf) 2912static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf)
@@ -2891,6 +2918,8 @@ static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf)
2891 lan78xx_remove_mdio(dev); 2918 lan78xx_remove_mdio(dev);
2892 2919
2893 if (pdata) { 2920 if (pdata) {
2921 cancel_work_sync(&pdata->set_multicast);
2922 cancel_work_sync(&pdata->set_vlan);
2894 netif_dbg(dev, ifdown, dev->net, "free pdata"); 2923 netif_dbg(dev, ifdown, dev->net, "free pdata");
2895 kfree(pdata); 2924 kfree(pdata);
2896 pdata = NULL; 2925 pdata = NULL;
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 76ac48095c29..ca066b785e9f 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1104,6 +1104,9 @@ static const struct usb_device_id products[] = {
1104 {QMI_FIXED_INTF(0x0846, 0x68a2, 8)}, 1104 {QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
1105 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ 1105 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
1106 {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ 1106 {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
1107 {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */
1108 {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */
1109 {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */
1107 {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ 1110 {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
1108 {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */ 1111 {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */
1109 {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */ 1112 {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */
@@ -1180,6 +1183,7 @@ static const struct usb_device_id products[] = {
1180 {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ 1183 {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
1181 {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ 1184 {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */
1182 {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ 1185 {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */
1186 {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */
1183 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ 1187 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
1184 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ 1188 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
1185 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ 1189 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
@@ -1240,6 +1244,7 @@ static const struct usb_device_id products[] = {
1240 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ 1244 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
1241 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ 1245 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
1242 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ 1246 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
1247 {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
1243 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ 1248 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
1244 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */ 1249 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
1245 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ 1250 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 139c61c8244a..ac40924fe437 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -578,12 +578,13 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s
578 if (!IS_ERR(neigh)) { 578 if (!IS_ERR(neigh)) {
579 sock_confirm_neigh(skb, neigh); 579 sock_confirm_neigh(skb, neigh);
580 ret = neigh_output(neigh, skb); 580 ret = neigh_output(neigh, skb);
581 rcu_read_unlock_bh();
582 return ret;
581 } 583 }
582 584
583 rcu_read_unlock_bh(); 585 rcu_read_unlock_bh();
584err: 586err:
585 if (unlikely(ret < 0)) 587 vrf_tx_error(skb->dev, skb);
586 vrf_tx_error(skb->dev, skb);
587 return ret; 588 return ret;
588} 589}
589 590
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 15fa00d79fc6..1ad97a40940d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6802,7 +6802,7 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
6802 return; 6802 return;
6803 6803
6804 /* ignore non-ISO3166 country codes */ 6804 /* ignore non-ISO3166 country codes */
6805 for (i = 0; i < sizeof(req->alpha2); i++) 6805 for (i = 0; i < 2; i++)
6806 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { 6806 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
6807 brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n", 6807 brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n",
6808 req->alpha2[0], req->alpha2[1]); 6808 req->alpha2[0], req->alpha2[1]);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 9be0b051066a..ebe35e6a40e7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -75,6 +75,10 @@ static int brcmf_roamoff;
75module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR); 75module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR);
76MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); 76MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine");
77 77
78static int brcmf_iapp_enable;
79module_param_named(iapp, brcmf_iapp_enable, int, 0);
80MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol");
81
78#ifdef DEBUG 82#ifdef DEBUG
79/* always succeed brcmf_bus_started() */ 83/* always succeed brcmf_bus_started() */
80static int brcmf_ignore_probe_fail; 84static int brcmf_ignore_probe_fail;
@@ -441,6 +445,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
441 settings->feature_disable = brcmf_feature_disable; 445 settings->feature_disable = brcmf_feature_disable;
442 settings->fcmode = brcmf_fcmode; 446 settings->fcmode = brcmf_fcmode;
443 settings->roamoff = !!brcmf_roamoff; 447 settings->roamoff = !!brcmf_roamoff;
448 settings->iapp = !!brcmf_iapp_enable;
444#ifdef DEBUG 449#ifdef DEBUG
445 settings->ignore_probe_fail = !!brcmf_ignore_probe_fail; 450 settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
446#endif 451#endif
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
index a62f8e70b320..ef914619e8e1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
@@ -58,6 +58,7 @@ struct brcmf_mp_device {
58 unsigned int feature_disable; 58 unsigned int feature_disable;
59 int fcmode; 59 int fcmode;
60 bool roamoff; 60 bool roamoff;
61 bool iapp;
61 bool ignore_probe_fail; 62 bool ignore_probe_fail;
62 struct brcmfmac_pd_cc *country_codes; 63 struct brcmfmac_pd_cc *country_codes;
63 union { 64 union {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 930e423f83a8..44b7774ebd02 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -230,6 +230,37 @@ static void brcmf_netdev_set_multicast_list(struct net_device *ndev)
230 schedule_work(&ifp->multicast_work); 230 schedule_work(&ifp->multicast_work);
231} 231}
232 232
233/**
234 * brcmf_skb_is_iapp - checks if skb is an IAPP packet
235 *
236 * @skb: skb to check
237 */
238static bool brcmf_skb_is_iapp(struct sk_buff *skb)
239{
240 static const u8 iapp_l2_update_packet[6] __aligned(2) = {
241 0x00, 0x01, 0xaf, 0x81, 0x01, 0x00,
242 };
243 unsigned char *eth_data;
244#if !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
245 const u16 *a, *b;
246#endif
247
248 if (skb->len - skb->mac_len != 6 ||
249 !is_multicast_ether_addr(eth_hdr(skb)->h_dest))
250 return false;
251
252 eth_data = skb_mac_header(skb) + ETH_HLEN;
253#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
254 return !(((*(const u32 *)eth_data) ^ (*(const u32 *)iapp_l2_update_packet)) |
255 ((*(const u16 *)(eth_data + 4)) ^ (*(const u16 *)(iapp_l2_update_packet + 4))));
256#else
257 a = (const u16 *)eth_data;
258 b = (const u16 *)iapp_l2_update_packet;
259
260 return !((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2]));
261#endif
262}
263
233static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, 264static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
234 struct net_device *ndev) 265 struct net_device *ndev)
235{ 266{
@@ -250,6 +281,23 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
250 goto done; 281 goto done;
251 } 282 }
252 283
284 /* Some recent Broadcom's firmwares disassociate STA when they receive
285 * an 802.11f ADD frame. This behavior can lead to a local DoS security
286 * issue. Attacker may trigger disassociation of any STA by sending a
287 * proper Ethernet frame to the wireless interface.
288 *
289 * Moreover this feature may break AP interfaces in some specific
290 * setups. This applies e.g. to the bridge with hairpin mode enabled and
291 * IFLA_BRPORT_MCAST_TO_UCAST set. IAPP packet generated by a firmware
292 * will get passed back to the wireless interface and cause immediate
293 * disassociation of a just-connected STA.
294 */
295 if (!drvr->settings->iapp && brcmf_skb_is_iapp(skb)) {
296 dev_kfree_skb(skb);
297 ret = -EINVAL;
298 goto done;
299 }
300
253 /* Make sure there's enough writeable headroom */ 301 /* Make sure there's enough writeable headroom */
254 if (skb_headroom(skb) < drvr->hdrlen || skb_header_cloned(skb)) { 302 if (skb_headroom(skb) < drvr->hdrlen || skb_header_cloned(skb)) {
255 head_delta = max_t(int, drvr->hdrlen - skb_headroom(skb), 0); 303 head_delta = max_t(int, drvr->hdrlen - skb_headroom(skb), 0);
@@ -325,6 +373,15 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp,
325 373
326void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb) 374void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
327{ 375{
376 /* Most of Broadcom's firmwares send 802.11f ADD frame every time a new
377 * STA connects to the AP interface. This is an obsoleted standard most
378 * users don't use, so don't pass these frames up unless requested.
379 */
380 if (!ifp->drvr->settings->iapp && brcmf_skb_is_iapp(skb)) {
381 brcmu_pkt_buf_free_skb(skb);
382 return;
383 }
384
328 if (skb->pkt_type == PACKET_MULTICAST) 385 if (skb->pkt_type == PACKET_MULTICAST)
329 ifp->ndev->stats.multicast++; 386 ifp->ndev->stats.multicast++;
330 387
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
index 90a1d14cf7d2..ab1469473e4f 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
@@ -53,6 +53,7 @@
53#include <linux/stringify.h> 53#include <linux/stringify.h>
54#include "iwl-config.h" 54#include "iwl-config.h"
55#include "iwl-agn-hw.h" 55#include "iwl-agn-hw.h"
56#include "fw/file.h"
56 57
57/* Highest firmware API version supported */ 58/* Highest firmware API version supported */
58#define IWL9000_UCODE_API_MAX 36 59#define IWL9000_UCODE_API_MAX 36
@@ -265,6 +266,67 @@ const struct iwl_cfg iwl9560_2ac_cfg_soc = {
265 .integrated = true, 266 .integrated = true,
266 .soc_latency = 5000, 267 .soc_latency = 5000,
267}; 268};
269
270const struct iwl_cfg iwl9460_2ac_cfg_shared_clk = {
271 .name = "Intel(R) Dual Band Wireless AC 9460",
272 .fw_name_pre = IWL9000A_FW_PRE,
273 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
274 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
275 IWL_DEVICE_9000,
276 .ht_params = &iwl9000_ht_params,
277 .nvm_ver = IWL9000_NVM_VERSION,
278 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
279 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
280 .integrated = true,
281 .soc_latency = 5000,
282 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
283};
284
285const struct iwl_cfg iwl9461_2ac_cfg_shared_clk = {
286 .name = "Intel(R) Dual Band Wireless AC 9461",
287 .fw_name_pre = IWL9000A_FW_PRE,
288 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
289 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
290 IWL_DEVICE_9000,
291 .ht_params = &iwl9000_ht_params,
292 .nvm_ver = IWL9000_NVM_VERSION,
293 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
294 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
295 .integrated = true,
296 .soc_latency = 5000,
297 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
298};
299
300const struct iwl_cfg iwl9462_2ac_cfg_shared_clk = {
301 .name = "Intel(R) Dual Band Wireless AC 9462",
302 .fw_name_pre = IWL9000A_FW_PRE,
303 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
304 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
305 IWL_DEVICE_9000,
306 .ht_params = &iwl9000_ht_params,
307 .nvm_ver = IWL9000_NVM_VERSION,
308 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
309 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
310 .integrated = true,
311 .soc_latency = 5000,
312 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
313};
314
315const struct iwl_cfg iwl9560_2ac_cfg_shared_clk = {
316 .name = "Intel(R) Dual Band Wireless AC 9560",
317 .fw_name_pre = IWL9000A_FW_PRE,
318 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
319 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
320 IWL_DEVICE_9000,
321 .ht_params = &iwl9000_ht_params,
322 .nvm_ver = IWL9000_NVM_VERSION,
323 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
324 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
325 .integrated = true,
326 .soc_latency = 5000,
327 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
328};
329
268MODULE_FIRMWARE(IWL9000A_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); 330MODULE_FIRMWARE(IWL9000A_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
269MODULE_FIRMWARE(IWL9000B_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); 331MODULE_FIRMWARE(IWL9000B_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
270MODULE_FIRMWARE(IWL9000RFB_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); 332MODULE_FIRMWARE(IWL9000RFB_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
index 1a05d506ac9a..2cb303c5c42e 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
@@ -441,6 +441,7 @@ enum iwl_fw_phy_cfg {
441 FW_PHY_CFG_TX_CHAIN = 0xf << FW_PHY_CFG_TX_CHAIN_POS, 441 FW_PHY_CFG_TX_CHAIN = 0xf << FW_PHY_CFG_TX_CHAIN_POS,
442 FW_PHY_CFG_RX_CHAIN_POS = 20, 442 FW_PHY_CFG_RX_CHAIN_POS = 20,
443 FW_PHY_CFG_RX_CHAIN = 0xf << FW_PHY_CFG_RX_CHAIN_POS, 443 FW_PHY_CFG_RX_CHAIN = 0xf << FW_PHY_CFG_RX_CHAIN_POS,
444 FW_PHY_CFG_SHARED_CLK = BIT(31),
444}; 445};
445 446
446#define IWL_UCODE_MAX_CS 1 447#define IWL_UCODE_MAX_CS 1
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 258d439bb0a9..f0f5636dd3ea 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -398,6 +398,7 @@ struct iwl_cfg {
398 u8 ucode_api_max; 398 u8 ucode_api_max;
399 u8 ucode_api_min; 399 u8 ucode_api_min;
400 u32 min_umac_error_event_table; 400 u32 min_umac_error_event_table;
401 u32 extra_phy_cfg_flags;
401}; 402};
402 403
403/* 404/*
@@ -477,6 +478,10 @@ extern const struct iwl_cfg iwl9460_2ac_cfg_soc;
477extern const struct iwl_cfg iwl9461_2ac_cfg_soc; 478extern const struct iwl_cfg iwl9461_2ac_cfg_soc;
478extern const struct iwl_cfg iwl9462_2ac_cfg_soc; 479extern const struct iwl_cfg iwl9462_2ac_cfg_soc;
479extern const struct iwl_cfg iwl9560_2ac_cfg_soc; 480extern const struct iwl_cfg iwl9560_2ac_cfg_soc;
481extern const struct iwl_cfg iwl9460_2ac_cfg_shared_clk;
482extern const struct iwl_cfg iwl9461_2ac_cfg_shared_clk;
483extern const struct iwl_cfg iwl9462_2ac_cfg_shared_clk;
484extern const struct iwl_cfg iwl9560_2ac_cfg_shared_clk;
480extern const struct iwl_cfg iwl22000_2ac_cfg_hr; 485extern const struct iwl_cfg iwl22000_2ac_cfg_hr;
481extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb; 486extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb;
482extern const struct iwl_cfg iwl22000_2ac_cfg_jf; 487extern const struct iwl_cfg iwl22000_2ac_cfg_jf;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 0920be637b57..3c59109bea20 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -433,6 +433,10 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
433 433
434 /* Set parameters */ 434 /* Set parameters */
435 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm)); 435 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm));
436
437 /* set flags extra PHY configuration flags from the device's cfg */
438 phy_cfg_cmd.phy_cfg |= cpu_to_le32(mvm->cfg->extra_phy_cfg_flags);
439
436 phy_cfg_cmd.calib_control.event_trigger = 440 phy_cfg_cmd.calib_control.event_trigger =
437 mvm->fw->default_calib[ucode_type].event_trigger; 441 mvm->fw->default_calib[ucode_type].event_trigger;
438 phy_cfg_cmd.calib_control.flow_trigger = 442 phy_cfg_cmd.calib_control.flow_trigger =
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index ebf511150f4d..7152fdc00fb1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2132,10 +2132,10 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
2132 * Send the bcast station. At this stage the TBTT and DTIM time 2132 * Send the bcast station. At this stage the TBTT and DTIM time
2133 * events are added and applied to the scheduler 2133 * events are added and applied to the scheduler
2134 */ 2134 */
2135 iwl_mvm_send_add_bcast_sta(mvm, vif); 2135 ret = iwl_mvm_send_add_bcast_sta(mvm, vif);
2136 if (ret) 2136 if (ret)
2137 goto out_unbind; 2137 goto out_unbind;
2138 iwl_mvm_add_mcast_sta(mvm, vif); 2138 ret = iwl_mvm_add_mcast_sta(mvm, vif);
2139 if (ret) { 2139 if (ret) {
2140 iwl_mvm_send_rm_bcast_sta(mvm, vif); 2140 iwl_mvm_send_rm_bcast_sta(mvm, vif);
2141 goto out_unbind; 2141 goto out_unbind;
@@ -3494,6 +3494,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3494 ret = 0; 3494 ret = 0;
3495 goto out; 3495 goto out;
3496 case NL80211_IFTYPE_STATION: 3496 case NL80211_IFTYPE_STATION:
3497 mvmvif->csa_bcn_pending = false;
3497 break; 3498 break;
3498 case NL80211_IFTYPE_MONITOR: 3499 case NL80211_IFTYPE_MONITOR:
3499 /* always disable PS when a monitor interface is active */ 3500 /* always disable PS when a monitor interface is active */
@@ -3537,7 +3538,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3537 } 3538 }
3538 3539
3539 if (switching_chanctx && vif->type == NL80211_IFTYPE_STATION) { 3540 if (switching_chanctx && vif->type == NL80211_IFTYPE_STATION) {
3540 u32 duration = 2 * vif->bss_conf.beacon_int; 3541 u32 duration = 3 * vif->bss_conf.beacon_int;
3541 3542
3542 /* iwl_mvm_protect_session() reads directly from the 3543 /* iwl_mvm_protect_session() reads directly from the
3543 * device (the system time), so make sure it is 3544 * device (the system time), so make sure it is
@@ -3550,6 +3551,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3550 /* Protect the session to make sure we hear the first 3551 /* Protect the session to make sure we hear the first
3551 * beacon on the new channel. 3552 * beacon on the new channel.
3552 */ 3553 */
3554 mvmvif->csa_bcn_pending = true;
3553 iwl_mvm_protect_session(mvm, vif, duration, duration, 3555 iwl_mvm_protect_session(mvm, vif, duration, duration,
3554 vif->bss_conf.beacon_int / 2, 3556 vif->bss_conf.beacon_int / 2,
3555 true); 3557 true);
@@ -3988,6 +3990,7 @@ static int iwl_mvm_post_channel_switch(struct ieee80211_hw *hw,
3988 if (vif->type == NL80211_IFTYPE_STATION) { 3990 if (vif->type == NL80211_IFTYPE_STATION) {
3989 struct iwl_mvm_sta *mvmsta; 3991 struct iwl_mvm_sta *mvmsta;
3990 3992
3993 mvmvif->csa_bcn_pending = false;
3991 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, 3994 mvmsta = iwl_mvm_sta_from_staid_protected(mvm,
3992 mvmvif->ap_sta_id); 3995 mvmvif->ap_sta_id);
3993 3996
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 89ff02d7c876..625b238a3f0a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -438,6 +438,9 @@ struct iwl_mvm_vif {
438 bool csa_failed; 438 bool csa_failed;
439 u16 csa_target_freq; 439 u16 csa_target_freq;
440 440
441 /* Indicates that we are waiting for a beacon on a new channel */
442 bool csa_bcn_pending;
443
441 /* TCP Checksum Offload */ 444 /* TCP Checksum Offload */
442 netdev_features_t features; 445 netdev_features_t features;
443}; 446};
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
index 305cd56bf746..7f5434b34d0d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
@@ -8,6 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright(c) 2017 Intel Deutschland GmbH 10 * Copyright(c) 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -18,11 +19,6 @@
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details. 20 * General Public License for more details.
20 * 21 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution 22 * The full GNU General Public License is included in this distribution
27 * in the file called COPYING. 23 * in the file called COPYING.
28 * 24 *
@@ -34,6 +30,7 @@
34 * 30 *
35 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
33 * Copyright(c) 2018 Intel Corporation
37 * All rights reserved. 34 * All rights reserved.
38 * 35 *
39 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
@@ -286,6 +283,20 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
286 return; 283 return;
287 284
288 ctxt->ref--; 285 ctxt->ref--;
286
287 /*
288 * Move unused phy's to a default channel. When the phy is moved the,
289 * fw will cleanup immediate quiet bit if it was previously set,
290 * otherwise we might not be able to reuse this phy.
291 */
292 if (ctxt->ref == 0) {
293 struct ieee80211_channel *chan;
294 struct cfg80211_chan_def chandef;
295
296 chan = &mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[0];
297 cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
298 iwl_mvm_phy_ctxt_changed(mvm, ctxt, &chandef, 1, 1);
299 }
289} 300}
290 301
291static void iwl_mvm_binding_iterator(void *_data, u8 *mac, 302static void iwl_mvm_binding_iterator(void *_data, u8 *mac,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 630e23cb0ffb..80067eb9ea05 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1695,7 +1695,8 @@ int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm,
1695 u32 qmask, enum nl80211_iftype iftype, 1695 u32 qmask, enum nl80211_iftype iftype,
1696 enum iwl_sta_type type) 1696 enum iwl_sta_type type)
1697{ 1697{
1698 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { 1698 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) ||
1699 sta->sta_id == IWL_MVM_INVALID_STA) {
1699 sta->sta_id = iwl_mvm_find_free_sta_id(mvm, iftype); 1700 sta->sta_id = iwl_mvm_find_free_sta_id(mvm, iftype);
1700 if (WARN_ON_ONCE(sta->sta_id == IWL_MVM_INVALID_STA)) 1701 if (WARN_ON_ONCE(sta->sta_id == IWL_MVM_INVALID_STA))
1701 return -ENOSPC; 1702 return -ENOSPC;
@@ -2478,28 +2479,12 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2478 2479
2479 /* 2480 /*
2480 * Note the possible cases: 2481 * Note the possible cases:
2481 * 1. In DQA mode with an enabled TXQ - TXQ needs to become agg'ed 2482 * 1. An enabled TXQ - TXQ needs to become agg'ed
2482 * 2. Non-DQA mode: the TXQ hasn't yet been enabled, so find a free 2483 * 2. The TXQ hasn't yet been enabled, so find a free one and mark
2483 * one and mark it as reserved 2484 * it as reserved
2484 * 3. In DQA mode, but no traffic yet on this TID: same treatment as in
2485 * non-DQA mode, since the TXQ hasn't yet been allocated
2486 * Don't support case 3 for new TX path as it is not expected to happen
2487 * and aggregation will be offloaded soon anyway
2488 */ 2485 */
2489 txq_id = mvmsta->tid_data[tid].txq_id; 2486 txq_id = mvmsta->tid_data[tid].txq_id;
2490 if (iwl_mvm_has_new_tx_api(mvm)) { 2487 if (txq_id == IWL_MVM_INVALID_QUEUE) {
2491 if (txq_id == IWL_MVM_INVALID_QUEUE) {
2492 ret = -ENXIO;
2493 goto release_locks;
2494 }
2495 } else if (unlikely(mvm->queue_info[txq_id].status ==
2496 IWL_MVM_QUEUE_SHARED)) {
2497 ret = -ENXIO;
2498 IWL_DEBUG_TX_QUEUES(mvm,
2499 "Can't start tid %d agg on shared queue!\n",
2500 tid);
2501 goto release_locks;
2502 } else if (mvm->queue_info[txq_id].status != IWL_MVM_QUEUE_READY) {
2503 txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, 2488 txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id,
2504 IWL_MVM_DQA_MIN_DATA_QUEUE, 2489 IWL_MVM_DQA_MIN_DATA_QUEUE,
2505 IWL_MVM_DQA_MAX_DATA_QUEUE); 2490 IWL_MVM_DQA_MAX_DATA_QUEUE);
@@ -2508,16 +2493,16 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2508 IWL_ERR(mvm, "Failed to allocate agg queue\n"); 2493 IWL_ERR(mvm, "Failed to allocate agg queue\n");
2509 goto release_locks; 2494 goto release_locks;
2510 } 2495 }
2511 /*
2512 * TXQ shouldn't be in inactive mode for non-DQA, so getting
2513 * an inactive queue from iwl_mvm_find_free_queue() is
2514 * certainly a bug
2515 */
2516 WARN_ON(mvm->queue_info[txq_id].status ==
2517 IWL_MVM_QUEUE_INACTIVE);
2518 2496
2519 /* TXQ hasn't yet been enabled, so mark it only as reserved */ 2497 /* TXQ hasn't yet been enabled, so mark it only as reserved */
2520 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED; 2498 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED;
2499 } else if (unlikely(mvm->queue_info[txq_id].status ==
2500 IWL_MVM_QUEUE_SHARED)) {
2501 ret = -ENXIO;
2502 IWL_DEBUG_TX_QUEUES(mvm,
2503 "Can't start tid %d agg on shared queue!\n",
2504 tid);
2505 goto release_locks;
2521 } 2506 }
2522 2507
2523 spin_unlock(&mvm->queue_info_lock); 2508 spin_unlock(&mvm->queue_info_lock);
@@ -2696,8 +2681,10 @@ out:
2696 2681
2697static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm, 2682static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm,
2698 struct iwl_mvm_sta *mvmsta, 2683 struct iwl_mvm_sta *mvmsta,
2699 u16 txq_id) 2684 struct iwl_mvm_tid_data *tid_data)
2700{ 2685{
2686 u16 txq_id = tid_data->txq_id;
2687
2701 if (iwl_mvm_has_new_tx_api(mvm)) 2688 if (iwl_mvm_has_new_tx_api(mvm))
2702 return; 2689 return;
2703 2690
@@ -2709,8 +2696,10 @@ static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm,
2709 * allocated through iwl_mvm_enable_txq, so we can just mark it back as 2696 * allocated through iwl_mvm_enable_txq, so we can just mark it back as
2710 * free. 2697 * free.
2711 */ 2698 */
2712 if (mvm->queue_info[txq_id].status == IWL_MVM_QUEUE_RESERVED) 2699 if (mvm->queue_info[txq_id].status == IWL_MVM_QUEUE_RESERVED) {
2713 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_FREE; 2700 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_FREE;
2701 tid_data->txq_id = IWL_MVM_INVALID_QUEUE;
2702 }
2714 2703
2715 spin_unlock_bh(&mvm->queue_info_lock); 2704 spin_unlock_bh(&mvm->queue_info_lock);
2716} 2705}
@@ -2741,7 +2730,7 @@ int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2741 2730
2742 mvmsta->agg_tids &= ~BIT(tid); 2731 mvmsta->agg_tids &= ~BIT(tid);
2743 2732
2744 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, txq_id); 2733 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, tid_data);
2745 2734
2746 switch (tid_data->state) { 2735 switch (tid_data->state) {
2747 case IWL_AGG_ON: 2736 case IWL_AGG_ON:
@@ -2808,7 +2797,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2808 mvmsta->agg_tids &= ~BIT(tid); 2797 mvmsta->agg_tids &= ~BIT(tid);
2809 spin_unlock_bh(&mvmsta->lock); 2798 spin_unlock_bh(&mvmsta->lock);
2810 2799
2811 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, txq_id); 2800 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, tid_data);
2812 2801
2813 if (old_state >= IWL_AGG_ON) { 2802 if (old_state >= IWL_AGG_ON) {
2814 iwl_mvm_drain_sta(mvm, mvmsta, true); 2803 iwl_mvm_drain_sta(mvm, mvmsta, true);
@@ -3233,17 +3222,9 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
3233 } 3222 }
3234 sta_id = mvm_sta->sta_id; 3223 sta_id = mvm_sta->sta_id;
3235 3224
3236 if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
3237 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 ||
3238 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256) {
3239 ret = iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id,
3240 false);
3241 goto end;
3242 }
3243
3244 /* 3225 /*
3245 * It is possible that the 'sta' parameter is NULL, and thus 3226 * It is possible that the 'sta' parameter is NULL, and thus
3246 * there is a need to retrieve the sta from the local station 3227 * there is a need to retrieve the sta from the local station
3247 * table. 3228 * table.
3248 */ 3229 */
3249 if (!sta) { 3230 if (!sta) {
@@ -3258,6 +3239,17 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
3258 3239
3259 if (WARN_ON_ONCE(iwl_mvm_sta_from_mac80211(sta)->vif != vif)) 3240 if (WARN_ON_ONCE(iwl_mvm_sta_from_mac80211(sta)->vif != vif))
3260 return -EINVAL; 3241 return -EINVAL;
3242 } else {
3243 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3244
3245 sta_id = mvmvif->mcast_sta.sta_id;
3246 }
3247
3248 if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
3249 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 ||
3250 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256) {
3251 ret = iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, false);
3252 goto end;
3261 } 3253 }
3262 3254
3263 /* If the key_offset is not pre-assigned, we need to find a 3255 /* If the key_offset is not pre-assigned, we need to find a
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
index acb217e666db..cd91bc44259c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
@@ -8,6 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2017 Intel Deutschland GmbH 10 * Copyright(c) 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -18,11 +19,6 @@
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details. 20 * General Public License for more details.
20 * 21 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution 22 * The full GNU General Public License is included in this distribution
27 * in the file called COPYING. 23 * in the file called COPYING.
28 * 24 *
@@ -35,6 +31,7 @@
35 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
37 * Copyright(c) 2017 Intel Deutschland GmbH 33 * Copyright(c) 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation
38 * All rights reserved. 35 * All rights reserved.
39 * 36 *
40 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -198,9 +195,13 @@ static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm,
198 struct ieee80211_vif *vif, 195 struct ieee80211_vif *vif,
199 const char *errmsg) 196 const char *errmsg)
200{ 197{
198 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
199
201 if (vif->type != NL80211_IFTYPE_STATION) 200 if (vif->type != NL80211_IFTYPE_STATION)
202 return false; 201 return false;
203 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) 202
203 if (!mvmvif->csa_bcn_pending && vif->bss_conf.assoc &&
204 vif->bss_conf.dtim_period)
204 return false; 205 return false;
205 if (errmsg) 206 if (errmsg)
206 IWL_ERR(mvm, "%s\n", errmsg); 207 IWL_ERR(mvm, "%s\n", errmsg);
@@ -344,7 +345,7 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
344 * and know the dtim period. 345 * and know the dtim period.
345 */ 346 */
346 iwl_mvm_te_check_disconnect(mvm, te_data->vif, 347 iwl_mvm_te_check_disconnect(mvm, te_data->vif,
347 "No association and the time event is over already..."); 348 "No beacon heard and the time event is over already...");
348 break; 349 break;
349 default: 350 default:
350 break; 351 break;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index af6dfceab6b8..7dfe4cde55e3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1894,14 +1894,12 @@ int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 flags)
1894 struct iwl_mvm_int_sta *int_sta = sta; 1894 struct iwl_mvm_int_sta *int_sta = sta;
1895 struct iwl_mvm_sta *mvm_sta = sta; 1895 struct iwl_mvm_sta *mvm_sta = sta;
1896 1896
1897 if (iwl_mvm_has_new_tx_api(mvm)) { 1897 BUILD_BUG_ON(offsetof(struct iwl_mvm_int_sta, sta_id) !=
1898 if (internal) 1898 offsetof(struct iwl_mvm_sta, sta_id));
1899 return iwl_mvm_flush_sta_tids(mvm, int_sta->sta_id,
1900 BIT(IWL_MGMT_TID), flags);
1901 1899
1900 if (iwl_mvm_has_new_tx_api(mvm))
1902 return iwl_mvm_flush_sta_tids(mvm, mvm_sta->sta_id, 1901 return iwl_mvm_flush_sta_tids(mvm, mvm_sta->sta_id,
1903 0xFF, flags); 1902 0xff | BIT(IWL_MGMT_TID), flags);
1904 }
1905 1903
1906 if (internal) 1904 if (internal)
1907 return iwl_mvm_flush_tx_path(mvm, int_sta->tfd_queue_msk, 1905 return iwl_mvm_flush_tx_path(mvm, int_sta->tfd_queue_msk,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 56fc28750a41..e323d3abb6ac 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -579,25 +579,25 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
579 {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)}, 579 {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)},
580 {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)}, 580 {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)},
581 {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)}, 581 {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)},
582 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_cfg_soc)}, 582 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_cfg_shared_clk)},
583 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_soc)}, 583 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)},
584 {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_cfg_soc)}, 584 {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_cfg_shared_clk)},
585 {IWL_PCI_DEVICE(0x31DC, 0x003C, iwl9560_2ac_cfg_soc)}, 585 {IWL_PCI_DEVICE(0x31DC, 0x003C, iwl9560_2ac_cfg_shared_clk)},
586 {IWL_PCI_DEVICE(0x31DC, 0x0060, iwl9460_2ac_cfg_soc)}, 586 {IWL_PCI_DEVICE(0x31DC, 0x0060, iwl9460_2ac_cfg_shared_clk)},
587 {IWL_PCI_DEVICE(0x31DC, 0x0064, iwl9461_2ac_cfg_soc)}, 587 {IWL_PCI_DEVICE(0x31DC, 0x0064, iwl9461_2ac_cfg_shared_clk)},
588 {IWL_PCI_DEVICE(0x31DC, 0x00A0, iwl9462_2ac_cfg_soc)}, 588 {IWL_PCI_DEVICE(0x31DC, 0x00A0, iwl9462_2ac_cfg_shared_clk)},
589 {IWL_PCI_DEVICE(0x31DC, 0x00A4, iwl9462_2ac_cfg_soc)}, 589 {IWL_PCI_DEVICE(0x31DC, 0x00A4, iwl9462_2ac_cfg_shared_clk)},
590 {IWL_PCI_DEVICE(0x31DC, 0x0230, iwl9560_2ac_cfg_soc)}, 590 {IWL_PCI_DEVICE(0x31DC, 0x0230, iwl9560_2ac_cfg_shared_clk)},
591 {IWL_PCI_DEVICE(0x31DC, 0x0234, iwl9560_2ac_cfg_soc)}, 591 {IWL_PCI_DEVICE(0x31DC, 0x0234, iwl9560_2ac_cfg_shared_clk)},
592 {IWL_PCI_DEVICE(0x31DC, 0x0238, iwl9560_2ac_cfg_soc)}, 592 {IWL_PCI_DEVICE(0x31DC, 0x0238, iwl9560_2ac_cfg_shared_clk)},
593 {IWL_PCI_DEVICE(0x31DC, 0x023C, iwl9560_2ac_cfg_soc)}, 593 {IWL_PCI_DEVICE(0x31DC, 0x023C, iwl9560_2ac_cfg_shared_clk)},
594 {IWL_PCI_DEVICE(0x31DC, 0x0260, iwl9461_2ac_cfg_soc)}, 594 {IWL_PCI_DEVICE(0x31DC, 0x0260, iwl9461_2ac_cfg_shared_clk)},
595 {IWL_PCI_DEVICE(0x31DC, 0x0264, iwl9461_2ac_cfg_soc)}, 595 {IWL_PCI_DEVICE(0x31DC, 0x0264, iwl9461_2ac_cfg_shared_clk)},
596 {IWL_PCI_DEVICE(0x31DC, 0x02A0, iwl9462_2ac_cfg_soc)}, 596 {IWL_PCI_DEVICE(0x31DC, 0x02A0, iwl9462_2ac_cfg_shared_clk)},
597 {IWL_PCI_DEVICE(0x31DC, 0x02A4, iwl9462_2ac_cfg_soc)}, 597 {IWL_PCI_DEVICE(0x31DC, 0x02A4, iwl9462_2ac_cfg_shared_clk)},
598 {IWL_PCI_DEVICE(0x31DC, 0x4030, iwl9560_2ac_cfg_soc)}, 598 {IWL_PCI_DEVICE(0x31DC, 0x4030, iwl9560_2ac_cfg_shared_clk)},
599 {IWL_PCI_DEVICE(0x31DC, 0x4034, iwl9560_2ac_cfg_soc)}, 599 {IWL_PCI_DEVICE(0x31DC, 0x4034, iwl9560_2ac_cfg_shared_clk)},
600 {IWL_PCI_DEVICE(0x31DC, 0x40A4, iwl9462_2ac_cfg_soc)}, 600 {IWL_PCI_DEVICE(0x31DC, 0x40A4, iwl9462_2ac_cfg_shared_clk)},
601 {IWL_PCI_DEVICE(0x34F0, 0x0030, iwl9560_2ac_cfg_soc)}, 601 {IWL_PCI_DEVICE(0x34F0, 0x0030, iwl9560_2ac_cfg_soc)},
602 {IWL_PCI_DEVICE(0x34F0, 0x0034, iwl9560_2ac_cfg_soc)}, 602 {IWL_PCI_DEVICE(0x34F0, 0x0034, iwl9560_2ac_cfg_soc)},
603 {IWL_PCI_DEVICE(0x34F0, 0x02A4, iwl9462_2ac_cfg_soc)}, 603 {IWL_PCI_DEVICE(0x34F0, 0x02A4, iwl9462_2ac_cfg_soc)},
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 8139bc70ad7d..12bcfbac2cc9 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -630,7 +630,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk)
630 630
631 if (!len && vq->busyloop_timeout) { 631 if (!len && vq->busyloop_timeout) {
632 /* Both tx vq and rx socket were polled here */ 632 /* Both tx vq and rx socket were polled here */
633 mutex_lock(&vq->mutex); 633 mutex_lock_nested(&vq->mutex, 1);
634 vhost_disable_notify(&net->dev, vq); 634 vhost_disable_notify(&net->dev, vq);
635 635
636 preempt_disable(); 636 preempt_disable();
@@ -763,7 +763,7 @@ static void handle_rx(struct vhost_net *net)
763 struct iov_iter fixup; 763 struct iov_iter fixup;
764 __virtio16 num_buffers; 764 __virtio16 num_buffers;
765 765
766 mutex_lock(&vq->mutex); 766 mutex_lock_nested(&vq->mutex, 0);
767 sock = vq->private_data; 767 sock = vq->private_data;
768 if (!sock) 768 if (!sock)
769 goto out; 769 goto out;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 1b3e8d2d5c8b..5320039671b7 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -212,8 +212,7 @@ int vhost_poll_start(struct vhost_poll *poll, struct file *file)
212 if (mask) 212 if (mask)
213 vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask)); 213 vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask));
214 if (mask & EPOLLERR) { 214 if (mask & EPOLLERR) {
215 if (poll->wqh) 215 vhost_poll_stop(poll);
216 remove_wait_queue(poll->wqh, &poll->wait);
217 ret = -EINVAL; 216 ret = -EINVAL;
218 } 217 }
219 218
@@ -1245,14 +1244,12 @@ static int vq_log_access_ok(struct vhost_virtqueue *vq,
1245/* Caller should have vq mutex and device mutex */ 1244/* Caller should have vq mutex and device mutex */
1246int vhost_vq_access_ok(struct vhost_virtqueue *vq) 1245int vhost_vq_access_ok(struct vhost_virtqueue *vq)
1247{ 1246{
1248 if (vq->iotlb) { 1247 int ret = vq_log_access_ok(vq, vq->log_base);
1249 /* When device IOTLB was used, the access validation 1248
1250 * will be validated during prefetching. 1249 if (ret || vq->iotlb)
1251 */ 1250 return ret;
1252 return 1; 1251
1253 } 1252 return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used);
1254 return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used) &&
1255 vq_log_access_ok(vq, vq->log_base);
1256} 1253}
1257EXPORT_SYMBOL_GPL(vhost_vq_access_ok); 1254EXPORT_SYMBOL_GPL(vhost_vq_access_ok);
1258 1255
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index c4a1cff9c768..7d30892da064 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -323,13 +323,24 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb,
323 skb_push(skb, VLAN_HLEN); 323 skb_push(skb, VLAN_HLEN);
324 324
325 /* Move the mac header sans proto to the beginning of the new header. */ 325 /* Move the mac header sans proto to the beginning of the new header. */
326 memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN); 326 if (likely(mac_len > ETH_TLEN))
327 memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN);
327 skb->mac_header -= VLAN_HLEN; 328 skb->mac_header -= VLAN_HLEN;
328 329
329 veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN); 330 veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN);
330 331
331 /* first, the ethernet type */ 332 /* first, the ethernet type */
332 veth->h_vlan_proto = vlan_proto; 333 if (likely(mac_len >= ETH_TLEN)) {
334 /* h_vlan_encapsulated_proto should already be populated, and
335 * skb->data has space for h_vlan_proto
336 */
337 veth->h_vlan_proto = vlan_proto;
338 } else {
339 /* h_vlan_encapsulated_proto should not be populated, and
340 * skb->data has no space for h_vlan_proto
341 */
342 veth->h_vlan_encapsulated_proto = skb->protocol;
343 }
333 344
334 /* now, the TCI */ 345 /* now, the TCI */
335 veth->h_vlan_TCI = htons(vlan_tci); 346 veth->h_vlan_TCI = htons(vlan_tci);
diff --git a/include/linux/net_dim.h b/include/linux/net_dim.h
index bebeaad897cc..29ed8fd6379a 100644
--- a/include/linux/net_dim.h
+++ b/include/linux/net_dim.h
@@ -231,7 +231,7 @@ static inline void net_dim_exit_parking(struct net_dim *dim)
231} 231}
232 232
233#define IS_SIGNIFICANT_DIFF(val, ref) \ 233#define IS_SIGNIFICANT_DIFF(val, ref) \
234 (((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */ 234 (((100UL * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
235 235
236static inline int net_dim_stats_compare(struct net_dim_stats *curr, 236static inline int net_dim_stats_compare(struct net_dim_stats *curr,
237 struct net_dim_stats *prev) 237 struct net_dim_stats *prev)
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index fe994d2e5286..5c40f118c0fa 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -103,7 +103,7 @@ void llc_sk_reset(struct sock *sk);
103 103
104/* Access to a connection */ 104/* Access to a connection */
105int llc_conn_state_process(struct sock *sk, struct sk_buff *skb); 105int llc_conn_state_process(struct sock *sk, struct sk_buff *skb);
106void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb); 106int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
107void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb); 107void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb);
108void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit); 108void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit);
109void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit); 109void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit);
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 663b015dace5..30eb0652b025 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1068,6 +1068,8 @@ struct nft_object_ops {
1068int nft_register_obj(struct nft_object_type *obj_type); 1068int nft_register_obj(struct nft_object_type *obj_type);
1069void nft_unregister_obj(struct nft_object_type *obj_type); 1069void nft_unregister_obj(struct nft_object_type *obj_type);
1070 1070
1071#define NFT_FLOWTABLE_DEVICE_MAX 8
1072
1071/** 1073/**
1072 * struct nft_flowtable - nf_tables flow table 1074 * struct nft_flowtable - nf_tables flow table
1073 * 1075 *
@@ -1080,6 +1082,7 @@ void nft_unregister_obj(struct nft_object_type *obj_type);
1080 * @genmask: generation mask 1082 * @genmask: generation mask
1081 * @use: number of references to this flow table 1083 * @use: number of references to this flow table
1082 * @handle: unique object handle 1084 * @handle: unique object handle
1085 * @dev_name: array of device names
1083 * @data: rhashtable and garbage collector 1086 * @data: rhashtable and garbage collector
1084 * @ops: array of hooks 1087 * @ops: array of hooks
1085 */ 1088 */
@@ -1093,6 +1096,7 @@ struct nft_flowtable {
1093 u32 genmask:2, 1096 u32 genmask:2,
1094 use:30; 1097 use:30;
1095 u64 handle; 1098 u64 handle;
1099 char *dev_name[NFT_FLOWTABLE_DEVICE_MAX];
1096 /* runtime data below here */ 1100 /* runtime data below here */
1097 struct nf_hook_ops *ops ____cacheline_aligned; 1101 struct nf_hook_ops *ops ____cacheline_aligned;
1098 struct nf_flowtable data; 1102 struct nf_flowtable data;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 2092d33194dd..8da32678ce18 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -30,6 +30,7 @@ struct qdisc_rate_table {
30enum qdisc_state_t { 30enum qdisc_state_t {
31 __QDISC_STATE_SCHED, 31 __QDISC_STATE_SCHED,
32 __QDISC_STATE_DEACTIVATED, 32 __QDISC_STATE_DEACTIVATED,
33 __QDISC_STATE_RUNNING,
33}; 34};
34 35
35struct qdisc_size_table { 36struct qdisc_size_table {
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 37fe9a644f22..808d2dd4a839 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -746,7 +746,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
746{ 746{
747 struct batadv_neigh_node *neigh_curr = NULL; 747 struct batadv_neigh_node *neigh_curr = NULL;
748 struct batadv_neigh_node *neigh_old = NULL; 748 struct batadv_neigh_node *neigh_old = NULL;
749 struct batadv_orig_node *orig_dst_node; 749 struct batadv_orig_node *orig_dst_node = NULL;
750 struct batadv_gw_node *gw_node = NULL; 750 struct batadv_gw_node *gw_node = NULL;
751 struct batadv_gw_node *curr_gw = NULL; 751 struct batadv_gw_node *curr_gw = NULL;
752 struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo; 752 struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo;
@@ -757,6 +757,9 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
757 757
758 vid = batadv_get_vid(skb, 0); 758 vid = batadv_get_vid(skb, 0);
759 759
760 if (is_multicast_ether_addr(ethhdr->h_dest))
761 goto out;
762
760 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, 763 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
761 ethhdr->h_dest, vid); 764 ethhdr->h_dest, vid);
762 if (!orig_dst_node) 765 if (!orig_dst_node)
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index d70640135e3a..ee56af5c43e0 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -814,8 +814,8 @@ static struct batadv_orig_node *
814batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, 814batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv,
815 struct ethhdr *ethhdr) 815 struct ethhdr *ethhdr)
816{ 816{
817 return batadv_transtable_search(bat_priv, ethhdr->h_source, 817 return batadv_transtable_search(bat_priv, NULL, ethhdr->h_dest,
818 ethhdr->h_dest, BATADV_NO_FLAGS); 818 BATADV_NO_FLAGS);
819} 819}
820 820
821/** 821/**
diff --git a/net/core/dev.c b/net/core/dev.c
index 12be20535714..ef0cc6ea5f8d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2735,7 +2735,7 @@ __be16 skb_network_protocol(struct sk_buff *skb, int *depth)
2735 if (unlikely(!pskb_may_pull(skb, sizeof(struct ethhdr)))) 2735 if (unlikely(!pskb_may_pull(skb, sizeof(struct ethhdr))))
2736 return 0; 2736 return 0;
2737 2737
2738 eth = (struct ethhdr *)skb_mac_header(skb); 2738 eth = (struct ethhdr *)skb->data;
2739 type = eth->h_proto; 2739 type = eth->h_proto;
2740 } 2740 }
2741 2741
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1e7acdc30732..857e4e6f751a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5028,8 +5028,10 @@ static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
5028 } 5028 }
5029 5029
5030 mac_len = skb->data - skb_mac_header(skb); 5030 mac_len = skb->data - skb_mac_header(skb);
5031 memmove(skb_mac_header(skb) + VLAN_HLEN, skb_mac_header(skb), 5031 if (likely(mac_len > VLAN_HLEN + ETH_TLEN)) {
5032 mac_len - VLAN_HLEN - ETH_TLEN); 5032 memmove(skb_mac_header(skb) + VLAN_HLEN, skb_mac_header(skb),
5033 mac_len - VLAN_HLEN - ETH_TLEN);
5034 }
5033 skb->mac_header += VLAN_HLEN; 5035 skb->mac_header += VLAN_HLEN;
5034 return skb; 5036 return skb;
5035} 5037}
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 6d21068f9b55..a7fd1c5a2a14 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -362,13 +362,18 @@ static struct ip_tunnel *ip_tunnel_create(struct net *net,
362 struct ip_tunnel *nt; 362 struct ip_tunnel *nt;
363 struct net_device *dev; 363 struct net_device *dev;
364 int t_hlen; 364 int t_hlen;
365 int mtu;
366 int err;
365 367
366 BUG_ON(!itn->fb_tunnel_dev); 368 BUG_ON(!itn->fb_tunnel_dev);
367 dev = __ip_tunnel_create(net, itn->fb_tunnel_dev->rtnl_link_ops, parms); 369 dev = __ip_tunnel_create(net, itn->fb_tunnel_dev->rtnl_link_ops, parms);
368 if (IS_ERR(dev)) 370 if (IS_ERR(dev))
369 return ERR_CAST(dev); 371 return ERR_CAST(dev);
370 372
371 dev->mtu = ip_tunnel_bind_dev(dev); 373 mtu = ip_tunnel_bind_dev(dev);
374 err = dev_set_mtu(dev, mtu);
375 if (err)
376 goto err_dev_set_mtu;
372 377
373 nt = netdev_priv(dev); 378 nt = netdev_priv(dev);
374 t_hlen = nt->hlen + sizeof(struct iphdr); 379 t_hlen = nt->hlen + sizeof(struct iphdr);
@@ -376,6 +381,10 @@ static struct ip_tunnel *ip_tunnel_create(struct net *net,
376 dev->max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen; 381 dev->max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen;
377 ip_tunnel_add(itn, nt); 382 ip_tunnel_add(itn, nt);
378 return nt; 383 return nt;
384
385err_dev_set_mtu:
386 unregister_netdevice(dev);
387 return ERR_PTR(err);
379} 388}
380 389
381int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, 390int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
@@ -1102,17 +1111,29 @@ int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
1102 nt->fwmark = fwmark; 1111 nt->fwmark = fwmark;
1103 err = register_netdevice(dev); 1112 err = register_netdevice(dev);
1104 if (err) 1113 if (err)
1105 goto out; 1114 goto err_register_netdevice;
1106 1115
1107 if (dev->type == ARPHRD_ETHER && !tb[IFLA_ADDRESS]) 1116 if (dev->type == ARPHRD_ETHER && !tb[IFLA_ADDRESS])
1108 eth_hw_addr_random(dev); 1117 eth_hw_addr_random(dev);
1109 1118
1110 mtu = ip_tunnel_bind_dev(dev); 1119 mtu = ip_tunnel_bind_dev(dev);
1111 if (!tb[IFLA_MTU]) 1120 if (tb[IFLA_MTU]) {
1112 dev->mtu = mtu; 1121 unsigned int max = 0xfff8 - dev->hard_header_len - nt->hlen;
1122
1123 mtu = clamp(dev->mtu, (unsigned int)ETH_MIN_MTU,
1124 (unsigned int)(max - sizeof(struct iphdr)));
1125 }
1126
1127 err = dev_set_mtu(dev, mtu);
1128 if (err)
1129 goto err_dev_set_mtu;
1113 1130
1114 ip_tunnel_add(itn, nt); 1131 ip_tunnel_add(itn, nt);
1115out: 1132 return 0;
1133
1134err_dev_set_mtu:
1135 unregister_netdevice(dev);
1136err_register_netdevice:
1116 return err; 1137 return err;
1117} 1138}
1118EXPORT_SYMBOL_GPL(ip_tunnel_newlink); 1139EXPORT_SYMBOL_GPL(ip_tunnel_newlink);
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 51b1669334fe..3f091ccad9af 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -387,8 +387,6 @@ static int vti_tunnel_init(struct net_device *dev)
387 memcpy(dev->dev_addr, &iph->saddr, 4); 387 memcpy(dev->dev_addr, &iph->saddr, 4);
388 memcpy(dev->broadcast, &iph->daddr, 4); 388 memcpy(dev->broadcast, &iph->daddr, 4);
389 389
390 dev->hard_header_len = LL_MAX_HEADER + sizeof(struct iphdr);
391 dev->mtu = ETH_DATA_LEN;
392 dev->flags = IFF_NOARP; 390 dev->flags = IFF_NOARP;
393 dev->addr_len = 4; 391 dev->addr_len = 4;
394 dev->features |= NETIF_F_LLTX; 392 dev->features |= NETIF_F_LLTX;
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index b50721d9d30e..9db988f9a4d7 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -154,8 +154,20 @@ static unsigned int ipv4_conntrack_local(void *priv,
154 struct sk_buff *skb, 154 struct sk_buff *skb,
155 const struct nf_hook_state *state) 155 const struct nf_hook_state *state)
156{ 156{
157 if (ip_is_fragment(ip_hdr(skb))) /* IP_NODEFRAG setsockopt set */ 157 if (ip_is_fragment(ip_hdr(skb))) { /* IP_NODEFRAG setsockopt set */
158 enum ip_conntrack_info ctinfo;
159 struct nf_conn *tmpl;
160
161 tmpl = nf_ct_get(skb, &ctinfo);
162 if (tmpl && nf_ct_is_template(tmpl)) {
163 /* when skipping ct, clear templates to avoid fooling
164 * later targets/matches
165 */
166 skb->_nfct = 0;
167 nf_ct_put(tmpl);
168 }
158 return NF_ACCEPT; 169 return NF_ACCEPT;
170 }
159 171
160 return nf_conntrack_in(state->net, PF_INET, state->hook, skb); 172 return nf_conntrack_in(state->net, PF_INET, state->hook, skb);
161} 173}
diff --git a/net/ipv4/netfilter/nf_socket_ipv4.c b/net/ipv4/netfilter/nf_socket_ipv4.c
index e9293bdebba0..4824b1e183a1 100644
--- a/net/ipv4/netfilter/nf_socket_ipv4.c
+++ b/net/ipv4/netfilter/nf_socket_ipv4.c
@@ -108,10 +108,12 @@ struct sock *nf_sk_lookup_slow_v4(struct net *net, const struct sk_buff *skb,
108 int doff = 0; 108 int doff = 0;
109 109
110 if (iph->protocol == IPPROTO_UDP || iph->protocol == IPPROTO_TCP) { 110 if (iph->protocol == IPPROTO_UDP || iph->protocol == IPPROTO_TCP) {
111 struct udphdr _hdr, *hp; 111 struct tcphdr _hdr;
112 struct udphdr *hp;
112 113
113 hp = skb_header_pointer(skb, ip_hdrlen(skb), 114 hp = skb_header_pointer(skb, ip_hdrlen(skb),
114 sizeof(_hdr), &_hdr); 115 iph->protocol == IPPROTO_UDP ?
116 sizeof(*hp) : sizeof(_hdr), &_hdr);
115 if (hp == NULL) 117 if (hp == NULL)
116 return NULL; 118 return NULL;
117 119
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index fda37f2862c9..c3387dfd725b 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -349,6 +349,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
349 req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0; 349 req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;
350 treq->snt_synack = 0; 350 treq->snt_synack = 0;
351 treq->tfo_listener = false; 351 treq->tfo_listener = false;
352 if (IS_ENABLED(CONFIG_SMC))
353 ireq->smc_ok = 0;
352 354
353 ireq->ir_iif = inet_request_bound_dev_if(sk, skb); 355 ireq->ir_iif = inet_request_bound_dev_if(sk, skb);
354 356
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 9a1b3c1c1c14..ff6cd98ce8d5 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6256,6 +6256,9 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
6256 if (want_cookie && !tmp_opt.saw_tstamp) 6256 if (want_cookie && !tmp_opt.saw_tstamp)
6257 tcp_clear_options(&tmp_opt); 6257 tcp_clear_options(&tmp_opt);
6258 6258
6259 if (IS_ENABLED(CONFIG_SMC) && want_cookie)
6260 tmp_opt.smc_ok = 0;
6261
6259 tmp_opt.tstamp_ok = tmp_opt.saw_tstamp; 6262 tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
6260 tcp_openreq_init(req, &tmp_opt, skb, sk); 6263 tcp_openreq_init(req, &tmp_opt, skb, sk);
6261 inet_rsk(req)->no_srccheck = inet_sk(sk)->transparent; 6264 inet_rsk(req)->no_srccheck = inet_sk(sk)->transparent;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index a8a919520090..5cb18c8ba9b2 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1246,7 +1246,7 @@ static int __ip6_append_data(struct sock *sk,
1246 const struct sockcm_cookie *sockc) 1246 const struct sockcm_cookie *sockc)
1247{ 1247{
1248 struct sk_buff *skb, *skb_prev = NULL; 1248 struct sk_buff *skb, *skb_prev = NULL;
1249 unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu; 1249 unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu;
1250 int exthdrlen = 0; 1250 int exthdrlen = 0;
1251 int dst_exthdrlen = 0; 1251 int dst_exthdrlen = 0;
1252 int hh_len; 1252 int hh_len;
@@ -1282,6 +1282,12 @@ static int __ip6_append_data(struct sock *sk,
1282 sizeof(struct frag_hdr) : 0) + 1282 sizeof(struct frag_hdr) : 0) +
1283 rt->rt6i_nfheader_len; 1283 rt->rt6i_nfheader_len;
1284 1284
1285 /* as per RFC 7112 section 5, the entire IPv6 Header Chain must fit
1286 * the first fragment
1287 */
1288 if (headersize + transhdrlen > mtu)
1289 goto emsgsize;
1290
1285 if (cork->length + length > mtu - headersize && ipc6->dontfrag && 1291 if (cork->length + length > mtu - headersize && ipc6->dontfrag &&
1286 (sk->sk_protocol == IPPROTO_UDP || 1292 (sk->sk_protocol == IPPROTO_UDP ||
1287 sk->sk_protocol == IPPROTO_RAW)) { 1293 sk->sk_protocol == IPPROTO_RAW)) {
@@ -1297,9 +1303,8 @@ static int __ip6_append_data(struct sock *sk,
1297 1303
1298 if (cork->length + length > maxnonfragsize - headersize) { 1304 if (cork->length + length > maxnonfragsize - headersize) {
1299emsgsize: 1305emsgsize:
1300 ipv6_local_error(sk, EMSGSIZE, fl6, 1306 pmtu = max_t(int, mtu - headersize + sizeof(struct ipv6hdr), 0);
1301 mtu - headersize + 1307 ipv6_local_error(sk, EMSGSIZE, fl6, pmtu);
1302 sizeof(struct ipv6hdr));
1303 return -EMSGSIZE; 1308 return -EMSGSIZE;
1304 } 1309 }
1305 1310
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index fa3ae1cb50d3..ce18cd20389d 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -622,11 +622,12 @@ static int vti6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
622 return 0; 622 return 0;
623} 623}
624 624
625static void vti6_link_config(struct ip6_tnl *t) 625static void vti6_link_config(struct ip6_tnl *t, bool keep_mtu)
626{ 626{
627 struct net_device *dev = t->dev; 627 struct net_device *dev = t->dev;
628 struct __ip6_tnl_parm *p = &t->parms; 628 struct __ip6_tnl_parm *p = &t->parms;
629 struct net_device *tdev = NULL; 629 struct net_device *tdev = NULL;
630 int mtu;
630 631
631 memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); 632 memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
632 memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); 633 memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
@@ -640,6 +641,11 @@ static void vti6_link_config(struct ip6_tnl *t)
640 else 641 else
641 dev->flags &= ~IFF_POINTOPOINT; 642 dev->flags &= ~IFF_POINTOPOINT;
642 643
644 if (keep_mtu && dev->mtu) {
645 dev->mtu = clamp(dev->mtu, dev->min_mtu, dev->max_mtu);
646 return;
647 }
648
643 if (p->flags & IP6_TNL_F_CAP_XMIT) { 649 if (p->flags & IP6_TNL_F_CAP_XMIT) {
644 int strict = (ipv6_addr_type(&p->raddr) & 650 int strict = (ipv6_addr_type(&p->raddr) &
645 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); 651 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL));
@@ -656,20 +662,25 @@ static void vti6_link_config(struct ip6_tnl *t)
656 tdev = __dev_get_by_index(t->net, p->link); 662 tdev = __dev_get_by_index(t->net, p->link);
657 663
658 if (tdev) 664 if (tdev)
659 dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len, 665 mtu = tdev->mtu - sizeof(struct ipv6hdr);
660 IPV6_MIN_MTU); 666 else
667 mtu = ETH_DATA_LEN - LL_MAX_HEADER - sizeof(struct ipv6hdr);
668
669 dev->mtu = max_t(int, mtu, IPV6_MIN_MTU);
661} 670}
662 671
663/** 672/**
664 * vti6_tnl_change - update the tunnel parameters 673 * vti6_tnl_change - update the tunnel parameters
665 * @t: tunnel to be changed 674 * @t: tunnel to be changed
666 * @p: tunnel configuration parameters 675 * @p: tunnel configuration parameters
676 * @keep_mtu: MTU was set from userspace, don't re-compute it
667 * 677 *
668 * Description: 678 * Description:
669 * vti6_tnl_change() updates the tunnel parameters 679 * vti6_tnl_change() updates the tunnel parameters
670 **/ 680 **/
671static int 681static int
672vti6_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p) 682vti6_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p,
683 bool keep_mtu)
673{ 684{
674 t->parms.laddr = p->laddr; 685 t->parms.laddr = p->laddr;
675 t->parms.raddr = p->raddr; 686 t->parms.raddr = p->raddr;
@@ -679,11 +690,12 @@ vti6_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p)
679 t->parms.proto = p->proto; 690 t->parms.proto = p->proto;
680 t->parms.fwmark = p->fwmark; 691 t->parms.fwmark = p->fwmark;
681 dst_cache_reset(&t->dst_cache); 692 dst_cache_reset(&t->dst_cache);
682 vti6_link_config(t); 693 vti6_link_config(t, keep_mtu);
683 return 0; 694 return 0;
684} 695}
685 696
686static int vti6_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p) 697static int vti6_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p,
698 bool keep_mtu)
687{ 699{
688 struct net *net = dev_net(t->dev); 700 struct net *net = dev_net(t->dev);
689 struct vti6_net *ip6n = net_generic(net, vti6_net_id); 701 struct vti6_net *ip6n = net_generic(net, vti6_net_id);
@@ -691,7 +703,7 @@ static int vti6_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p)
691 703
692 vti6_tnl_unlink(ip6n, t); 704 vti6_tnl_unlink(ip6n, t);
693 synchronize_net(); 705 synchronize_net();
694 err = vti6_tnl_change(t, p); 706 err = vti6_tnl_change(t, p, keep_mtu);
695 vti6_tnl_link(ip6n, t); 707 vti6_tnl_link(ip6n, t);
696 netdev_state_change(t->dev); 708 netdev_state_change(t->dev);
697 return err; 709 return err;
@@ -804,7 +816,7 @@ vti6_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
804 } else 816 } else
805 t = netdev_priv(dev); 817 t = netdev_priv(dev);
806 818
807 err = vti6_update(t, &p1); 819 err = vti6_update(t, &p1, false);
808 } 820 }
809 if (t) { 821 if (t) {
810 err = 0; 822 err = 0;
@@ -866,10 +878,8 @@ static void vti6_dev_setup(struct net_device *dev)
866 dev->priv_destructor = vti6_dev_free; 878 dev->priv_destructor = vti6_dev_free;
867 879
868 dev->type = ARPHRD_TUNNEL6; 880 dev->type = ARPHRD_TUNNEL6;
869 dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr);
870 dev->mtu = ETH_DATA_LEN;
871 dev->min_mtu = IPV6_MIN_MTU; 881 dev->min_mtu = IPV6_MIN_MTU;
872 dev->max_mtu = IP_MAX_MTU; 882 dev->max_mtu = IP_MAX_MTU - sizeof(struct ipv6hdr);
873 dev->flags |= IFF_NOARP; 883 dev->flags |= IFF_NOARP;
874 dev->addr_len = sizeof(struct in6_addr); 884 dev->addr_len = sizeof(struct in6_addr);
875 netif_keep_dst(dev); 885 netif_keep_dst(dev);
@@ -905,7 +915,7 @@ static int vti6_dev_init(struct net_device *dev)
905 915
906 if (err) 916 if (err)
907 return err; 917 return err;
908 vti6_link_config(t); 918 vti6_link_config(t, true);
909 return 0; 919 return 0;
910} 920}
911 921
@@ -1010,7 +1020,7 @@ static int vti6_changelink(struct net_device *dev, struct nlattr *tb[],
1010 } else 1020 } else
1011 t = netdev_priv(dev); 1021 t = netdev_priv(dev);
1012 1022
1013 return vti6_update(t, &p); 1023 return vti6_update(t, &p, tb && tb[IFLA_MTU]);
1014} 1024}
1015 1025
1016static size_t vti6_get_size(const struct net_device *dev) 1026static size_t vti6_get_size(const struct net_device *dev)
diff --git a/net/ipv6/netfilter/nf_socket_ipv6.c b/net/ipv6/netfilter/nf_socket_ipv6.c
index ebb2bf84232a..f14de4b6d639 100644
--- a/net/ipv6/netfilter/nf_socket_ipv6.c
+++ b/net/ipv6/netfilter/nf_socket_ipv6.c
@@ -116,9 +116,11 @@ struct sock *nf_sk_lookup_slow_v6(struct net *net, const struct sk_buff *skb,
116 } 116 }
117 117
118 if (tproto == IPPROTO_UDP || tproto == IPPROTO_TCP) { 118 if (tproto == IPPROTO_UDP || tproto == IPPROTO_TCP) {
119 struct udphdr _hdr, *hp; 119 struct tcphdr _hdr;
120 struct udphdr *hp;
120 121
121 hp = skb_header_pointer(skb, thoff, sizeof(_hdr), &_hdr); 122 hp = skb_header_pointer(skb, thoff, tproto == IPPROTO_UDP ?
123 sizeof(*hp) : sizeof(_hdr), &_hdr);
122 if (hp == NULL) 124 if (hp == NULL)
123 return NULL; 125 return NULL;
124 126
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b0d5c64e1978..fc74352fac12 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -919,6 +919,9 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
919 struct rt6_info *rt, *rt_cache; 919 struct rt6_info *rt, *rt_cache;
920 struct fib6_node *fn; 920 struct fib6_node *fn;
921 921
922 if (fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF)
923 flags &= ~RT6_LOOKUP_F_IFACE;
924
922 rcu_read_lock(); 925 rcu_read_lock();
923 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr); 926 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
924restart: 927restart:
@@ -1626,11 +1629,10 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
1626 struct neighbour *neigh; 1629 struct neighbour *neigh;
1627 __u8 neigh_flags = 0; 1630 __u8 neigh_flags = 0;
1628 1631
1629 neigh = dst_neigh_lookup(&rt->dst, &rt->rt6i_gateway); 1632 neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway);
1630 if (neigh) { 1633 if (neigh)
1631 neigh_flags = neigh->flags; 1634 neigh_flags = neigh->flags;
1632 neigh_release(neigh); 1635
1633 }
1634 if (!(neigh_flags & NTF_ROUTER)) { 1636 if (!(neigh_flags & NTF_ROUTER)) {
1635 RT6_TRACE("purging route %p via non-router but gateway\n", 1637 RT6_TRACE("purging route %p via non-router but gateway\n",
1636 rt); 1638 rt);
@@ -1654,7 +1656,8 @@ void rt6_age_exceptions(struct rt6_info *rt,
1654 if (!rcu_access_pointer(rt->rt6i_exception_bucket)) 1656 if (!rcu_access_pointer(rt->rt6i_exception_bucket))
1655 return; 1657 return;
1656 1658
1657 spin_lock_bh(&rt6_exception_lock); 1659 rcu_read_lock_bh();
1660 spin_lock(&rt6_exception_lock);
1658 bucket = rcu_dereference_protected(rt->rt6i_exception_bucket, 1661 bucket = rcu_dereference_protected(rt->rt6i_exception_bucket,
1659 lockdep_is_held(&rt6_exception_lock)); 1662 lockdep_is_held(&rt6_exception_lock));
1660 1663
@@ -1668,7 +1671,8 @@ void rt6_age_exceptions(struct rt6_info *rt,
1668 bucket++; 1671 bucket++;
1669 } 1672 }
1670 } 1673 }
1671 spin_unlock_bh(&rt6_exception_lock); 1674 spin_unlock(&rt6_exception_lock);
1675 rcu_read_unlock_bh();
1672} 1676}
1673 1677
1674struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, 1678struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index 7a78dcfda68a..f343e6f0fc95 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -16,6 +16,7 @@
16#include <linux/net.h> 16#include <linux/net.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <net/ip.h> 18#include <net/ip.h>
19#include <net/ip_tunnels.h>
19#include <net/lwtunnel.h> 20#include <net/lwtunnel.h>
20#include <net/netevent.h> 21#include <net/netevent.h>
21#include <net/netns/generic.h> 22#include <net/netns/generic.h>
@@ -211,11 +212,6 @@ static int seg6_do_srh(struct sk_buff *skb)
211 212
212 tinfo = seg6_encap_lwtunnel(dst->lwtstate); 213 tinfo = seg6_encap_lwtunnel(dst->lwtstate);
213 214
214 if (likely(!skb->encapsulation)) {
215 skb_reset_inner_headers(skb);
216 skb->encapsulation = 1;
217 }
218
219 switch (tinfo->mode) { 215 switch (tinfo->mode) {
220 case SEG6_IPTUN_MODE_INLINE: 216 case SEG6_IPTUN_MODE_INLINE:
221 if (skb->protocol != htons(ETH_P_IPV6)) 217 if (skb->protocol != htons(ETH_P_IPV6))
@@ -224,10 +220,12 @@ static int seg6_do_srh(struct sk_buff *skb)
224 err = seg6_do_srh_inline(skb, tinfo->srh); 220 err = seg6_do_srh_inline(skb, tinfo->srh);
225 if (err) 221 if (err)
226 return err; 222 return err;
227
228 skb_reset_inner_headers(skb);
229 break; 223 break;
230 case SEG6_IPTUN_MODE_ENCAP: 224 case SEG6_IPTUN_MODE_ENCAP:
225 err = iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6);
226 if (err)
227 return err;
228
231 if (skb->protocol == htons(ETH_P_IPV6)) 229 if (skb->protocol == htons(ETH_P_IPV6))
232 proto = IPPROTO_IPV6; 230 proto = IPPROTO_IPV6;
233 else if (skb->protocol == htons(ETH_P_IP)) 231 else if (skb->protocol == htons(ETH_P_IP))
@@ -239,6 +237,8 @@ static int seg6_do_srh(struct sk_buff *skb)
239 if (err) 237 if (err)
240 return err; 238 return err;
241 239
240 skb_set_inner_transport_header(skb, skb_transport_offset(skb));
241 skb_set_inner_protocol(skb, skb->protocol);
242 skb->protocol = htons(ETH_P_IPV6); 242 skb->protocol = htons(ETH_P_IPV6);
243 break; 243 break;
244 case SEG6_IPTUN_MODE_L2ENCAP: 244 case SEG6_IPTUN_MODE_L2ENCAP:
@@ -262,8 +262,6 @@ static int seg6_do_srh(struct sk_buff *skb)
262 ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); 262 ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
263 skb_set_transport_header(skb, sizeof(struct ipv6hdr)); 263 skb_set_transport_header(skb, sizeof(struct ipv6hdr));
264 264
265 skb_set_inner_protocol(skb, skb->protocol);
266
267 return 0; 265 return 0;
268} 266}
269 267
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index e7a3a6b6cf56..e997141aed8c 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -217,6 +217,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
217 treq->snt_isn = cookie; 217 treq->snt_isn = cookie;
218 treq->ts_off = 0; 218 treq->ts_off = 0;
219 treq->txhash = net_tx_rndhash(); 219 treq->txhash = net_tx_rndhash();
220 if (IS_ENABLED(CONFIG_SMC))
221 ireq->smc_ok = 0;
220 222
221 /* 223 /*
222 * We need to lookup the dst_entry to get the correct window size. 224 * We need to lookup the dst_entry to get the correct window size.
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
index f59648018060..163121192aca 100644
--- a/net/llc/llc_c_ac.c
+++ b/net/llc/llc_c_ac.c
@@ -389,7 +389,7 @@ static int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk, struct sk_buff *skb)
389 llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); 389 llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR);
390 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); 390 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
391 if (likely(!rc)) { 391 if (likely(!rc)) {
392 llc_conn_send_pdu(sk, skb); 392 rc = llc_conn_send_pdu(sk, skb);
393 llc_conn_ac_inc_vs_by_1(sk, skb); 393 llc_conn_ac_inc_vs_by_1(sk, skb);
394 } 394 }
395 return rc; 395 return rc;
@@ -916,7 +916,7 @@ static int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk,
916 llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR); 916 llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR);
917 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); 917 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
918 if (likely(!rc)) { 918 if (likely(!rc)) {
919 llc_conn_send_pdu(sk, skb); 919 rc = llc_conn_send_pdu(sk, skb);
920 llc_conn_ac_inc_vs_by_1(sk, skb); 920 llc_conn_ac_inc_vs_by_1(sk, skb);
921 } 921 }
922 return rc; 922 return rc;
@@ -935,14 +935,17 @@ static int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk,
935int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb) 935int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb)
936{ 936{
937 struct llc_sock *llc = llc_sk(sk); 937 struct llc_sock *llc = llc_sk(sk);
938 int ret;
938 939
939 if (llc->ack_must_be_send) { 940 if (llc->ack_must_be_send) {
940 llc_conn_ac_send_i_rsp_f_set_ackpf(sk, skb); 941 ret = llc_conn_ac_send_i_rsp_f_set_ackpf(sk, skb);
941 llc->ack_must_be_send = 0 ; 942 llc->ack_must_be_send = 0 ;
942 llc->ack_pf = 0; 943 llc->ack_pf = 0;
943 } else 944 } else {
944 llc_conn_ac_send_i_cmd_p_set_0(sk, skb); 945 ret = llc_conn_ac_send_i_cmd_p_set_0(sk, skb);
945 return 0; 946 }
947
948 return ret;
946} 949}
947 950
948/** 951/**
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 9177dbb16dce..110e32bcb399 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -30,7 +30,7 @@
30#endif 30#endif
31 31
32static int llc_find_offset(int state, int ev_type); 32static int llc_find_offset(int state, int ev_type);
33static void llc_conn_send_pdus(struct sock *sk); 33static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *skb);
34static int llc_conn_service(struct sock *sk, struct sk_buff *skb); 34static int llc_conn_service(struct sock *sk, struct sk_buff *skb);
35static int llc_exec_conn_trans_actions(struct sock *sk, 35static int llc_exec_conn_trans_actions(struct sock *sk,
36 struct llc_conn_state_trans *trans, 36 struct llc_conn_state_trans *trans,
@@ -193,11 +193,11 @@ out_skb_put:
193 return rc; 193 return rc;
194} 194}
195 195
196void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb) 196int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
197{ 197{
198 /* queue PDU to send to MAC layer */ 198 /* queue PDU to send to MAC layer */
199 skb_queue_tail(&sk->sk_write_queue, skb); 199 skb_queue_tail(&sk->sk_write_queue, skb);
200 llc_conn_send_pdus(sk); 200 return llc_conn_send_pdus(sk, skb);
201} 201}
202 202
203/** 203/**
@@ -255,7 +255,7 @@ void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit)
255 if (howmany_resend > 0) 255 if (howmany_resend > 0)
256 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; 256 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO;
257 /* any PDUs to re-send are queued up; start sending to MAC */ 257 /* any PDUs to re-send are queued up; start sending to MAC */
258 llc_conn_send_pdus(sk); 258 llc_conn_send_pdus(sk, NULL);
259out:; 259out:;
260} 260}
261 261
@@ -296,7 +296,7 @@ void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit)
296 if (howmany_resend > 0) 296 if (howmany_resend > 0)
297 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; 297 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO;
298 /* any PDUs to re-send are queued up; start sending to MAC */ 298 /* any PDUs to re-send are queued up; start sending to MAC */
299 llc_conn_send_pdus(sk); 299 llc_conn_send_pdus(sk, NULL);
300out:; 300out:;
301} 301}
302 302
@@ -340,12 +340,16 @@ out:
340/** 340/**
341 * llc_conn_send_pdus - Sends queued PDUs 341 * llc_conn_send_pdus - Sends queued PDUs
342 * @sk: active connection 342 * @sk: active connection
343 * @hold_skb: the skb held by caller, or NULL if does not care
343 * 344 *
344 * Sends queued pdus to MAC layer for transmission. 345 * Sends queued pdus to MAC layer for transmission. When @hold_skb is
346 * NULL, always return 0. Otherwise, return 0 if @hold_skb is sent
347 * successfully, or 1 for failure.
345 */ 348 */
346static void llc_conn_send_pdus(struct sock *sk) 349static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb)
347{ 350{
348 struct sk_buff *skb; 351 struct sk_buff *skb;
352 int ret = 0;
349 353
350 while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) { 354 while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) {
351 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 355 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
@@ -357,10 +361,20 @@ static void llc_conn_send_pdus(struct sock *sk)
357 skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb); 361 skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb);
358 if (!skb2) 362 if (!skb2)
359 break; 363 break;
360 skb = skb2; 364 dev_queue_xmit(skb2);
365 } else {
366 bool is_target = skb == hold_skb;
367 int rc;
368
369 if (is_target)
370 skb_get(skb);
371 rc = dev_queue_xmit(skb);
372 if (is_target)
373 ret = rc;
361 } 374 }
362 dev_queue_xmit(skb);
363 } 375 }
376
377 return ret;
364} 378}
365 379
366/** 380/**
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index c4acc7340eb1..530e12ae52d7 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -74,15 +74,77 @@ static void nft_trans_destroy(struct nft_trans *trans)
74 kfree(trans); 74 kfree(trans);
75} 75}
76 76
77/* removal requests are queued in the commit_list, but not acted upon
78 * until after all new rules are in place.
79 *
80 * Therefore, nf_register_net_hook(net, &nat_hook) runs before pending
81 * nf_unregister_net_hook().
82 *
83 * nf_register_net_hook thus fails if a nat hook is already in place
84 * even if the conflicting hook is about to be removed.
85 *
86 * If collision is detected, search commit_log for DELCHAIN matching
87 * the new nat hooknum; if we find one collision is temporary:
88 *
89 * Either transaction is aborted (new/colliding hook is removed), or
90 * transaction is committed (old hook is removed).
91 */
92static bool nf_tables_allow_nat_conflict(const struct net *net,
93 const struct nf_hook_ops *ops)
94{
95 const struct nft_trans *trans;
96 bool ret = false;
97
98 if (!ops->nat_hook)
99 return false;
100
101 list_for_each_entry(trans, &net->nft.commit_list, list) {
102 const struct nf_hook_ops *pending_ops;
103 const struct nft_chain *pending;
104
105 if (trans->msg_type != NFT_MSG_NEWCHAIN &&
106 trans->msg_type != NFT_MSG_DELCHAIN)
107 continue;
108
109 pending = trans->ctx.chain;
110 if (!nft_is_base_chain(pending))
111 continue;
112
113 pending_ops = &nft_base_chain(pending)->ops;
114 if (pending_ops->nat_hook &&
115 pending_ops->pf == ops->pf &&
116 pending_ops->hooknum == ops->hooknum) {
117 /* other hook registration already pending? */
118 if (trans->msg_type == NFT_MSG_NEWCHAIN)
119 return false;
120
121 ret = true;
122 }
123 }
124
125 return ret;
126}
127
77static int nf_tables_register_hook(struct net *net, 128static int nf_tables_register_hook(struct net *net,
78 const struct nft_table *table, 129 const struct nft_table *table,
79 struct nft_chain *chain) 130 struct nft_chain *chain)
80{ 131{
132 struct nf_hook_ops *ops;
133 int ret;
134
81 if (table->flags & NFT_TABLE_F_DORMANT || 135 if (table->flags & NFT_TABLE_F_DORMANT ||
82 !nft_is_base_chain(chain)) 136 !nft_is_base_chain(chain))
83 return 0; 137 return 0;
84 138
85 return nf_register_net_hook(net, &nft_base_chain(chain)->ops); 139 ops = &nft_base_chain(chain)->ops;
140 ret = nf_register_net_hook(net, ops);
141 if (ret == -EBUSY && nf_tables_allow_nat_conflict(net, ops)) {
142 ops->nat_hook = false;
143 ret = nf_register_net_hook(net, ops);
144 ops->nat_hook = true;
145 }
146
147 return ret;
86} 148}
87 149
88static void nf_tables_unregister_hook(struct net *net, 150static void nf_tables_unregister_hook(struct net *net,
@@ -1226,8 +1288,6 @@ static void nf_tables_chain_destroy(struct nft_chain *chain)
1226 free_percpu(basechain->stats); 1288 free_percpu(basechain->stats);
1227 if (basechain->stats) 1289 if (basechain->stats)
1228 static_branch_dec(&nft_counters_enabled); 1290 static_branch_dec(&nft_counters_enabled);
1229 if (basechain->ops.dev != NULL)
1230 dev_put(basechain->ops.dev);
1231 kfree(chain->name); 1291 kfree(chain->name);
1232 kfree(basechain); 1292 kfree(basechain);
1233 } else { 1293 } else {
@@ -1294,7 +1354,7 @@ static int nft_chain_parse_hook(struct net *net,
1294 } 1354 }
1295 1355
1296 nla_strlcpy(ifname, ha[NFTA_HOOK_DEV], IFNAMSIZ); 1356 nla_strlcpy(ifname, ha[NFTA_HOOK_DEV], IFNAMSIZ);
1297 dev = dev_get_by_name(net, ifname); 1357 dev = __dev_get_by_name(net, ifname);
1298 if (!dev) { 1358 if (!dev) {
1299 module_put(type->owner); 1359 module_put(type->owner);
1300 return -ENOENT; 1360 return -ENOENT;
@@ -1311,8 +1371,6 @@ static int nft_chain_parse_hook(struct net *net,
1311static void nft_chain_release_hook(struct nft_chain_hook *hook) 1371static void nft_chain_release_hook(struct nft_chain_hook *hook)
1312{ 1372{
1313 module_put(hook->type->owner); 1373 module_put(hook->type->owner);
1314 if (hook->dev != NULL)
1315 dev_put(hook->dev);
1316} 1374}
1317 1375
1318static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask, 1376static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
@@ -1911,6 +1969,7 @@ static const struct nla_policy nft_rule_policy[NFTA_RULE_MAX + 1] = {
1911 [NFTA_RULE_POSITION] = { .type = NLA_U64 }, 1969 [NFTA_RULE_POSITION] = { .type = NLA_U64 },
1912 [NFTA_RULE_USERDATA] = { .type = NLA_BINARY, 1970 [NFTA_RULE_USERDATA] = { .type = NLA_BINARY,
1913 .len = NFT_USERDATA_MAXLEN }, 1971 .len = NFT_USERDATA_MAXLEN },
1972 [NFTA_RULE_ID] = { .type = NLA_U32 },
1914}; 1973};
1915 1974
1916static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net, 1975static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net,
@@ -2446,6 +2505,9 @@ EXPORT_SYMBOL_GPL(nft_unregister_set);
2446 2505
2447static bool nft_set_ops_candidate(const struct nft_set_ops *ops, u32 flags) 2506static bool nft_set_ops_candidate(const struct nft_set_ops *ops, u32 flags)
2448{ 2507{
2508 if ((flags & NFT_SET_EVAL) && !ops->update)
2509 return false;
2510
2449 return (flags & ops->features) == (flags & NFT_SET_FEATURES); 2511 return (flags & ops->features) == (flags & NFT_SET_FEATURES);
2450} 2512}
2451 2513
@@ -2510,7 +2572,7 @@ nft_select_set_ops(const struct nft_ctx *ctx,
2510 if (est.space == best.space && 2572 if (est.space == best.space &&
2511 est.lookup < best.lookup) 2573 est.lookup < best.lookup)
2512 break; 2574 break;
2513 } else if (est.size < best.size) { 2575 } else if (est.size < best.size || !bops) {
2514 break; 2576 break;
2515 } 2577 }
2516 continue; 2578 continue;
@@ -3315,6 +3377,8 @@ static const struct nla_policy nft_set_elem_policy[NFTA_SET_ELEM_MAX + 1] = {
3315 [NFTA_SET_ELEM_TIMEOUT] = { .type = NLA_U64 }, 3377 [NFTA_SET_ELEM_TIMEOUT] = { .type = NLA_U64 },
3316 [NFTA_SET_ELEM_USERDATA] = { .type = NLA_BINARY, 3378 [NFTA_SET_ELEM_USERDATA] = { .type = NLA_BINARY,
3317 .len = NFT_USERDATA_MAXLEN }, 3379 .len = NFT_USERDATA_MAXLEN },
3380 [NFTA_SET_ELEM_EXPR] = { .type = NLA_NESTED },
3381 [NFTA_SET_ELEM_OBJREF] = { .type = NLA_STRING },
3318}; 3382};
3319 3383
3320static const struct nla_policy nft_set_elem_list_policy[NFTA_SET_ELEM_LIST_MAX + 1] = { 3384static const struct nla_policy nft_set_elem_list_policy[NFTA_SET_ELEM_LIST_MAX + 1] = {
@@ -4864,8 +4928,6 @@ nf_tables_flowtable_lookup_byhandle(const struct nft_table *table,
4864 return ERR_PTR(-ENOENT); 4928 return ERR_PTR(-ENOENT);
4865} 4929}
4866 4930
4867#define NFT_FLOWTABLE_DEVICE_MAX 8
4868
4869static int nf_tables_parse_devices(const struct nft_ctx *ctx, 4931static int nf_tables_parse_devices(const struct nft_ctx *ctx,
4870 const struct nlattr *attr, 4932 const struct nlattr *attr,
4871 struct net_device *dev_array[], int *len) 4933 struct net_device *dev_array[], int *len)
@@ -4882,7 +4944,7 @@ static int nf_tables_parse_devices(const struct nft_ctx *ctx,
4882 } 4944 }
4883 4945
4884 nla_strlcpy(ifname, tmp, IFNAMSIZ); 4946 nla_strlcpy(ifname, tmp, IFNAMSIZ);
4885 dev = dev_get_by_name(ctx->net, ifname); 4947 dev = __dev_get_by_name(ctx->net, ifname);
4886 if (!dev) { 4948 if (!dev) {
4887 err = -ENOENT; 4949 err = -ENOENT;
4888 goto err1; 4950 goto err1;
@@ -4938,13 +5000,11 @@ static int nf_tables_flowtable_parse_hook(const struct nft_ctx *ctx,
4938 err = nf_tables_parse_devices(ctx, tb[NFTA_FLOWTABLE_HOOK_DEVS], 5000 err = nf_tables_parse_devices(ctx, tb[NFTA_FLOWTABLE_HOOK_DEVS],
4939 dev_array, &n); 5001 dev_array, &n);
4940 if (err < 0) 5002 if (err < 0)
4941 goto err1; 5003 return err;
4942 5004
4943 ops = kzalloc(sizeof(struct nf_hook_ops) * n, GFP_KERNEL); 5005 ops = kzalloc(sizeof(struct nf_hook_ops) * n, GFP_KERNEL);
4944 if (!ops) { 5006 if (!ops)
4945 err = -ENOMEM; 5007 return -ENOMEM;
4946 goto err1;
4947 }
4948 5008
4949 flowtable->hooknum = hooknum; 5009 flowtable->hooknum = hooknum;
4950 flowtable->priority = priority; 5010 flowtable->priority = priority;
@@ -4958,13 +5018,10 @@ static int nf_tables_flowtable_parse_hook(const struct nft_ctx *ctx,
4958 flowtable->ops[i].priv = &flowtable->data.rhashtable; 5018 flowtable->ops[i].priv = &flowtable->data.rhashtable;
4959 flowtable->ops[i].hook = flowtable->data.type->hook; 5019 flowtable->ops[i].hook = flowtable->data.type->hook;
4960 flowtable->ops[i].dev = dev_array[i]; 5020 flowtable->ops[i].dev = dev_array[i];
5021 flowtable->dev_name[i] = kstrdup(dev_array[i]->name,
5022 GFP_KERNEL);
4961 } 5023 }
4962 5024
4963 err = 0;
4964err1:
4965 for (i = 0; i < n; i++)
4966 dev_put(dev_array[i]);
4967
4968 return err; 5025 return err;
4969} 5026}
4970 5027
@@ -5135,8 +5192,10 @@ static int nf_tables_newflowtable(struct net *net, struct sock *nlsk,
5135err5: 5192err5:
5136 i = flowtable->ops_len; 5193 i = flowtable->ops_len;
5137err4: 5194err4:
5138 for (k = i - 1; k >= 0; k--) 5195 for (k = i - 1; k >= 0; k--) {
5196 kfree(flowtable->dev_name[k]);
5139 nf_unregister_net_hook(net, &flowtable->ops[k]); 5197 nf_unregister_net_hook(net, &flowtable->ops[k]);
5198 }
5140 5199
5141 kfree(flowtable->ops); 5200 kfree(flowtable->ops);
5142err3: 5201err3:
@@ -5226,9 +5285,9 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net,
5226 goto nla_put_failure; 5285 goto nla_put_failure;
5227 5286
5228 for (i = 0; i < flowtable->ops_len; i++) { 5287 for (i = 0; i < flowtable->ops_len; i++) {
5229 if (flowtable->ops[i].dev && 5288 if (flowtable->dev_name[i][0] &&
5230 nla_put_string(skb, NFTA_DEVICE_NAME, 5289 nla_put_string(skb, NFTA_DEVICE_NAME,
5231 flowtable->ops[i].dev->name)) 5290 flowtable->dev_name[i]))
5232 goto nla_put_failure; 5291 goto nla_put_failure;
5233 } 5292 }
5234 nla_nest_end(skb, nest_devs); 5293 nla_nest_end(skb, nest_devs);
@@ -5470,6 +5529,7 @@ static void nft_flowtable_event(unsigned long event, struct net_device *dev,
5470 continue; 5529 continue;
5471 5530
5472 nf_unregister_net_hook(dev_net(dev), &flowtable->ops[i]); 5531 nf_unregister_net_hook(dev_net(dev), &flowtable->ops[i]);
5532 flowtable->dev_name[i][0] = '\0';
5473 flowtable->ops[i].dev = NULL; 5533 flowtable->ops[i].dev = NULL;
5474 break; 5534 break;
5475 } 5535 }
diff --git a/net/netfilter/nft_set_hash.c b/net/netfilter/nft_set_hash.c
index d40591fe1b2f..fc9c6d5d64cd 100644
--- a/net/netfilter/nft_set_hash.c
+++ b/net/netfilter/nft_set_hash.c
@@ -674,7 +674,7 @@ static const struct nft_set_ops *
674nft_hash_select_ops(const struct nft_ctx *ctx, const struct nft_set_desc *desc, 674nft_hash_select_ops(const struct nft_ctx *ctx, const struct nft_set_desc *desc,
675 u32 flags) 675 u32 flags)
676{ 676{
677 if (desc->size && !(flags & NFT_SET_TIMEOUT)) { 677 if (desc->size && !(flags & (NFT_SET_EVAL | NFT_SET_TIMEOUT))) {
678 switch (desc->klen) { 678 switch (desc->klen) {
679 case 4: 679 case 4:
680 return &nft_hash_fast_ops; 680 return &nft_hash_fast_ops;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 07e8478068f0..70c455341243 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1085,6 +1085,9 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,
1085 if (addr->sa_family != AF_NETLINK) 1085 if (addr->sa_family != AF_NETLINK)
1086 return -EINVAL; 1086 return -EINVAL;
1087 1087
1088 if (alen < sizeof(struct sockaddr_nl))
1089 return -EINVAL;
1090
1088 if ((nladdr->nl_groups || nladdr->nl_pid) && 1091 if ((nladdr->nl_groups || nladdr->nl_pid) &&
1089 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND)) 1092 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND))
1090 return -EPERM; 1093 return -EPERM;
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index eba6682727dd..efc6bfb9a4e0 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -135,8 +135,10 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
135 continue; 135 continue;
136 136
137 nest = nla_nest_start(skb, n_i); 137 nest = nla_nest_start(skb, n_i);
138 if (!nest) 138 if (!nest) {
139 index--;
139 goto nla_put_failure; 140 goto nla_put_failure;
141 }
140 err = tcf_action_dump_1(skb, p, 0, 0); 142 err = tcf_action_dump_1(skb, p, 0, 0);
141 if (err < 0) { 143 if (err < 0) {
142 index--; 144 index--;
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 7e3fbe9cc936..39c144b6ff98 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -373,24 +373,33 @@ bool sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
373 */ 373 */
374static inline bool qdisc_restart(struct Qdisc *q, int *packets) 374static inline bool qdisc_restart(struct Qdisc *q, int *packets)
375{ 375{
376 bool more, validate, nolock = q->flags & TCQ_F_NOLOCK;
376 spinlock_t *root_lock = NULL; 377 spinlock_t *root_lock = NULL;
377 struct netdev_queue *txq; 378 struct netdev_queue *txq;
378 struct net_device *dev; 379 struct net_device *dev;
379 struct sk_buff *skb; 380 struct sk_buff *skb;
380 bool validate;
381 381
382 /* Dequeue packet */ 382 /* Dequeue packet */
383 if (nolock && test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
384 return false;
385
383 skb = dequeue_skb(q, &validate, packets); 386 skb = dequeue_skb(q, &validate, packets);
384 if (unlikely(!skb)) 387 if (unlikely(!skb)) {
388 if (nolock)
389 clear_bit(__QDISC_STATE_RUNNING, &q->state);
385 return false; 390 return false;
391 }
386 392
387 if (!(q->flags & TCQ_F_NOLOCK)) 393 if (!nolock)
388 root_lock = qdisc_lock(q); 394 root_lock = qdisc_lock(q);
389 395
390 dev = qdisc_dev(q); 396 dev = qdisc_dev(q);
391 txq = skb_get_tx_queue(dev, skb); 397 txq = skb_get_tx_queue(dev, skb);
392 398
393 return sch_direct_xmit(skb, q, dev, txq, root_lock, validate); 399 more = sch_direct_xmit(skb, q, dev, txq, root_lock, validate);
400 if (nolock)
401 clear_bit(__QDISC_STATE_RUNNING, &q->state);
402 return more;
394} 403}
395 404
396void __qdisc_run(struct Qdisc *q) 405void __qdisc_run(struct Qdisc *q)
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
index 8ac51583a063..15c213250606 100644
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@ -133,7 +133,7 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
133 133
134 /* receive the complete CLC message */ 134 /* receive the complete CLC message */
135 memset(&msg, 0, sizeof(struct msghdr)); 135 memset(&msg, 0, sizeof(struct msghdr));
136 iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, buflen); 136 iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, datlen);
137 krflags = MSG_WAITALL; 137 krflags = MSG_WAITALL;
138 smc->clcsock->sk->sk_rcvtimeo = CLC_WAIT_TIME; 138 smc->clcsock->sk->sk_rcvtimeo = CLC_WAIT_TIME;
139 len = sock_recvmsg(smc->clcsock, &msg, krflags); 139 len = sock_recvmsg(smc->clcsock, &msg, krflags);
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
index 1fdab5c4eda8..b9283ce5cd85 100644
--- a/net/strparser/strparser.c
+++ b/net/strparser/strparser.c
@@ -60,7 +60,7 @@ static void strp_abort_strp(struct strparser *strp, int err)
60 struct sock *sk = strp->sk; 60 struct sock *sk = strp->sk;
61 61
62 /* Report an error on the lower socket */ 62 /* Report an error on the lower socket */
63 sk->sk_err = err; 63 sk->sk_err = -err;
64 sk->sk_error_report(sk); 64 sk->sk_error_report(sk);
65 } 65 }
66} 66}
@@ -458,7 +458,7 @@ static void strp_msg_timeout(struct work_struct *w)
458 /* Message assembly timed out */ 458 /* Message assembly timed out */
459 STRP_STATS_INCR(strp->stats.msg_timeouts); 459 STRP_STATS_INCR(strp->stats.msg_timeouts);
460 strp->cb.lock(strp); 460 strp->cb.lock(strp);
461 strp->cb.abort_parser(strp, ETIMEDOUT); 461 strp->cb.abort_parser(strp, -ETIMEDOUT);
462 strp->cb.unlock(strp); 462 strp->cb.unlock(strp);
463} 463}
464 464
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 1472c0857975..81788105c164 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -26,6 +26,12 @@ struct xfrm_trans_tasklet {
26}; 26};
27 27
28struct xfrm_trans_cb { 28struct xfrm_trans_cb {
29 union {
30 struct inet_skb_parm h4;
31#if IS_ENABLED(CONFIG_IPV6)
32 struct inet6_skb_parm h6;
33#endif
34 } header;
29 int (*finish)(struct net *net, struct sock *sk, struct sk_buff *skb); 35 int (*finish)(struct net *net, struct sock *sk, struct sk_buff *skb);
30}; 36};
31 37
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 23468672a767..89b178a78dc7 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -285,8 +285,9 @@ void xfrm_local_error(struct sk_buff *skb, int mtu)
285 return; 285 return;
286 286
287 afinfo = xfrm_state_get_afinfo(proto); 287 afinfo = xfrm_state_get_afinfo(proto);
288 if (afinfo) 288 if (afinfo) {
289 afinfo->local_error(skb, mtu); 289 afinfo->local_error(skb, mtu);
290 rcu_read_unlock(); 290 rcu_read_unlock();
291 }
291} 292}
292EXPORT_SYMBOL_GPL(xfrm_local_error); 293EXPORT_SYMBOL_GPL(xfrm_local_error);
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index f95fa67bb498..f509c86faede 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -428,7 +428,7 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
428 jsonw_string_field(json_wtr, "name", info->name); 428 jsonw_string_field(json_wtr, "name", info->name);
429 429
430 jsonw_name(json_wtr, "flags"); 430 jsonw_name(json_wtr, "flags");
431 jsonw_printf(json_wtr, "%#x", info->map_flags); 431 jsonw_printf(json_wtr, "%d", info->map_flags);
432 432
433 print_dev_json(info->ifindex, info->netns_dev, info->netns_ino); 433 print_dev_json(info->ifindex, info->netns_dev, info->netns_ino);
434 434