aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-09 13:50:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-09 13:50:44 -0400
commit9ef11ceb0d380d4c9b43083fd920049aa05d3f8d (patch)
tree389cd1905c0b63c3956088b89f0b172b0a9281ba
parent839a3f765728cdca0057a12e2dc0bf669ac1c22e (diff)
parent30d237a6c2e9be1bb816fe8e787b88fd7aad833b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Stale SKB data pointer access across pskb_may_pull() calls in L2TP, from Haishuang Yan. 2) Fix multicast frame handling in mac80211 AP code, from Felix Fietkau. 3) mac80211 station hashtable insert errors not handled properly, fix from Johannes Berg. 4) Fix TX descriptor count limit handling in e1000, from Alexander Duyck. 5) Revert a buggy netdev refcount fix in netpoll, from Bjorn Helgaas. 6) Must assign rtnl_link_ops of the device before registering it, fix in ip6_tunnel from Thadeu Lima de Souza Cascardo. 7) Memory leak fix in tc action net exit, from WANG Cong. 8) Add missing AF_KCM entries to name tables, from Dexuan Cui. 9) Fix regression in GRE handling of csums wrt. FOU, from Alexander Duyck. 10) Fix memory allocation alignment and congestion map corruption in RDS, from Shamir Rabinovitch. 11) Fix default qdisc regression in tuntap driver, from Jason Wang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits) bridge, netem: mark mailing lists as moderated tuntap: restore default qdisc mpls: find_outdev: check for err ptr in addition to NULL check ipv6: Count in extension headers in skb->network_header RDS: fix congestion map corruption for PAGE_SIZE > 4k RDS: memory allocated must be align to 8 GRE: Disable segmentation offloads w/ CSUM and we are encapsulated via FOU net: add the AF_KCM entries to family name tables MAINTAINERS: intel-wired-lan list is moderated lib/test_bpf: Add additional BPF_ADD tests lib/test_bpf: Add test to check for result of 32-bit add that overflows lib/test_bpf: Add tests for unsigned BPF_JGT lib/test_bpf: Fix JMP_JSET tests VSOCK: Detach QP check should filter out non matching QPs. stmmac: fix adjust link call in case of a switch is attached af_packet: tone down the Tx-ring unsupported spew. net_sched: fix a memory leak in tc action samples/bpf: Enable powerpc support samples/bpf: Use llc in PATH, rather than a hardcoded value samples/bpf: Fix build breakage with map_perf_test_user.c ...
-rw-r--r--MAINTAINERS6
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h1
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c21
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c22
-rw-r--r--drivers/net/tun.c4
-rw-r--r--include/linux/netdevice.h5
-rw-r--r--include/net/act_api.h1
-rw-r--r--include/net/mac80211.h2
-rw-r--r--include/net/sctp/sctp.h6
-rw-r--r--lib/test_bpf.c229
-rw-r--r--net/core/dev.c1
-rw-r--r--net/core/netpoll.c3
-rw-r--r--net/core/sock.c9
-rw-r--r--net/ipv4/fou.c6
-rw-r--r--net/ipv4/gre_offload.c8
-rw-r--r--net/ipv4/ip_gre.c13
-rw-r--r--net/ipv6/ip6_output.c8
-rw-r--r--net/ipv6/ip6_tunnel.c2
-rw-r--r--net/l2tp/l2tp_ip.c8
-rw-r--r--net/l2tp/l2tp_ip6.c8
-rw-r--r--net/mac80211/chan.c4
-rw-r--r--net/mac80211/ieee80211_i.h4
-rw-r--r--net/mac80211/mesh_hwmp.c2
-rw-r--r--net/mac80211/sta_info.c14
-rw-r--r--net/mac80211/sta_info.h1
-rw-r--r--net/mac80211/tdls.c43
-rw-r--r--net/mac80211/tx.c13
-rw-r--r--net/mac80211/vht.c30
-rw-r--r--net/mpls/af_mpls.c3
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/rds/ib_recv.c2
-rw-r--r--net/rds/page.c4
-rw-r--r--net/sctp/output.c3
-rw-r--r--net/vmw_vsock/vmci_transport.c4
-rw-r--r--samples/bpf/Makefile12
-rw-r--r--samples/bpf/bpf_helpers.h26
-rw-r--r--samples/bpf/map_perf_test_user.c1
-rw-r--r--samples/bpf/spintest_kern.c2
-rw-r--r--samples/bpf/tracex2_kern.c4
-rw-r--r--samples/bpf/tracex4_kern.c2
41 files changed, 448 insertions, 92 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index d8c901bbec89..24997a7c0bbe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4302,7 +4302,7 @@ F: drivers/net/ethernet/agere/
4302 4302
4303ETHERNET BRIDGE 4303ETHERNET BRIDGE
4304M: Stephen Hemminger <stephen@networkplumber.org> 4304M: Stephen Hemminger <stephen@networkplumber.org>
4305L: bridge@lists.linux-foundation.org 4305L: bridge@lists.linux-foundation.org (moderated for non-subscribers)
4306L: netdev@vger.kernel.org 4306L: netdev@vger.kernel.org
4307W: http://www.linuxfoundation.org/en/Net:Bridge 4307W: http://www.linuxfoundation.org/en/Net:Bridge
4308S: Maintained 4308S: Maintained
@@ -5751,7 +5751,7 @@ R: Don Skidmore <donald.c.skidmore@intel.com>
5751R: Bruce Allan <bruce.w.allan@intel.com> 5751R: Bruce Allan <bruce.w.allan@intel.com>
5752R: John Ronciak <john.ronciak@intel.com> 5752R: John Ronciak <john.ronciak@intel.com>
5753R: Mitch Williams <mitch.a.williams@intel.com> 5753R: Mitch Williams <mitch.a.williams@intel.com>
5754L: intel-wired-lan@lists.osuosl.org 5754L: intel-wired-lan@lists.osuosl.org (moderated for non-subscribers)
5755W: http://www.intel.com/support/feedback.htm 5755W: http://www.intel.com/support/feedback.htm
5756W: http://e1000.sourceforge.net/ 5756W: http://e1000.sourceforge.net/
5757Q: http://patchwork.ozlabs.org/project/intel-wired-lan/list/ 5757Q: http://patchwork.ozlabs.org/project/intel-wired-lan/list/
@@ -7576,7 +7576,7 @@ F: drivers/infiniband/hw/nes/
7576 7576
7577NETEM NETWORK EMULATOR 7577NETEM NETWORK EMULATOR
7578M: Stephen Hemminger <stephen@networkplumber.org> 7578M: Stephen Hemminger <stephen@networkplumber.org>
7579L: netem@lists.linux-foundation.org 7579L: netem@lists.linux-foundation.org (moderated for non-subscribers)
7580S: Maintained 7580S: Maintained
7581F: net/sched/sch_netem.c 7581F: net/sched/sch_netem.c
7582 7582
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h
index 06bc2d2e7a73..a2cdfc1261dc 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h
@@ -166,6 +166,7 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN
166 CH_PCI_ID_TABLE_FENTRY(0x5099), /* Custom 2x40G QSFP */ 166 CH_PCI_ID_TABLE_FENTRY(0x5099), /* Custom 2x40G QSFP */
167 CH_PCI_ID_TABLE_FENTRY(0x509a), /* Custom T520-CR */ 167 CH_PCI_ID_TABLE_FENTRY(0x509a), /* Custom T520-CR */
168 CH_PCI_ID_TABLE_FENTRY(0x509b), /* Custom T540-CR LOM */ 168 CH_PCI_ID_TABLE_FENTRY(0x509b), /* Custom T540-CR LOM */
169 CH_PCI_ID_TABLE_FENTRY(0x509c), /* Custom T520-CR*/
169 170
170 /* T6 adapters: 171 /* T6 adapters:
171 */ 172 */
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 3fc7bde699ba..ae90d4f12b70 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -3106,7 +3106,7 @@ static int e1000_maybe_stop_tx(struct net_device *netdev,
3106 return __e1000_maybe_stop_tx(netdev, size); 3106 return __e1000_maybe_stop_tx(netdev, size);
3107} 3107}
3108 3108
3109#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1) 3109#define TXD_USE_COUNT(S, X) (((S) + ((1 << (X)) - 1)) >> (X))
3110static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, 3110static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
3111 struct net_device *netdev) 3111 struct net_device *netdev)
3112{ 3112{
@@ -3256,12 +3256,29 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
3256 nr_frags, mss); 3256 nr_frags, mss);
3257 3257
3258 if (count) { 3258 if (count) {
3259 /* The descriptors needed is higher than other Intel drivers
3260 * due to a number of workarounds. The breakdown is below:
3261 * Data descriptors: MAX_SKB_FRAGS + 1
3262 * Context Descriptor: 1
3263 * Keep head from touching tail: 2
3264 * Workarounds: 3
3265 */
3266 int desc_needed = MAX_SKB_FRAGS + 7;
3267
3259 netdev_sent_queue(netdev, skb->len); 3268 netdev_sent_queue(netdev, skb->len);
3260 skb_tx_timestamp(skb); 3269 skb_tx_timestamp(skb);
3261 3270
3262 e1000_tx_queue(adapter, tx_ring, tx_flags, count); 3271 e1000_tx_queue(adapter, tx_ring, tx_flags, count);
3272
3273 /* 82544 potentially requires twice as many data descriptors
3274 * in order to guarantee buffers don't end on evenly-aligned
3275 * dwords
3276 */
3277 if (adapter->pcix_82544)
3278 desc_needed += MAX_SKB_FRAGS + 1;
3279
3263 /* Make sure there is space in the ring for the next send. */ 3280 /* Make sure there is space in the ring for the next send. */
3264 e1000_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2); 3281 e1000_maybe_stop_tx(netdev, tx_ring, desc_needed);
3265 3282
3266 if (!skb->xmit_more || 3283 if (!skb->xmit_more ||
3267 netif_xmit_stopped(netdev_get_tx_queue(netdev, 0))) { 3284 netif_xmit_stopped(netdev_get_tx_queue(netdev, 0))) {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 67006431726a..344912957cab 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -8559,6 +8559,7 @@ static int i40e_sw_init(struct i40e_pf *pf)
8559 I40E_FLAG_OUTER_UDP_CSUM_CAPABLE | 8559 I40E_FLAG_OUTER_UDP_CSUM_CAPABLE |
8560 I40E_FLAG_WB_ON_ITR_CAPABLE | 8560 I40E_FLAG_WB_ON_ITR_CAPABLE |
8561 I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE | 8561 I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE |
8562 I40E_FLAG_NO_PCI_LINK_CHECK |
8562 I40E_FLAG_100M_SGMII_CAPABLE | 8563 I40E_FLAG_100M_SGMII_CAPABLE |
8563 I40E_FLAG_USE_SET_LLDP_MIB | 8564 I40E_FLAG_USE_SET_LLDP_MIB |
8564 I40E_FLAG_GENEVE_OFFLOAD_CAPABLE; 8565 I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 78464fa7fe1f..fcbd4be562e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -288,10 +288,6 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
288 (priv->pcs == STMMAC_PCS_RTBI)) 288 (priv->pcs == STMMAC_PCS_RTBI))
289 goto out; 289 goto out;
290 290
291 /* Never init EEE in case of a switch is attached */
292 if (priv->phydev->is_pseudo_fixed_link)
293 goto out;
294
295 /* MAC core supports the EEE feature. */ 291 /* MAC core supports the EEE feature. */
296 if (priv->dma_cap.eee) { 292 if (priv->dma_cap.eee) {
297 int tx_lpi_timer = priv->tx_lpi_timer; 293 int tx_lpi_timer = priv->tx_lpi_timer;
@@ -771,10 +767,16 @@ static void stmmac_adjust_link(struct net_device *dev)
771 767
772 spin_unlock_irqrestore(&priv->lock, flags); 768 spin_unlock_irqrestore(&priv->lock, flags);
773 769
774 /* At this stage, it could be needed to setup the EEE or adjust some 770 if (phydev->is_pseudo_fixed_link)
775 * MAC related HW registers. 771 /* Stop PHY layer to call the hook to adjust the link in case
776 */ 772 * of a switch is attached to the stmmac driver.
777 priv->eee_enabled = stmmac_eee_init(priv); 773 */
774 phydev->irq = PHY_IGNORE_INTERRUPT;
775 else
776 /* At this stage, init the EEE if supported.
777 * Never called in case of fixed_link.
778 */
779 priv->eee_enabled = stmmac_eee_init(priv);
778} 780}
779 781
780/** 782/**
@@ -865,10 +867,6 @@ static int stmmac_init_phy(struct net_device *dev)
865 return -ENODEV; 867 return -ENODEV;
866 } 868 }
867 869
868 /* If attached to a switch, there is no reason to poll phy handler */
869 if (phydev->is_pseudo_fixed_link)
870 phydev->irq = PHY_IGNORE_INTERRUPT;
871
872 pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)" 870 pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)"
873 " Link = %d\n", dev->name, phydev->phy_id, phydev->link); 871 " Link = %d\n", dev->name, phydev->phy_id, phydev->link);
874 872
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 510e90a6bb26..2c9e45f50edb 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1015,7 +1015,6 @@ static void tun_net_init(struct net_device *dev)
1015 /* Zero header length */ 1015 /* Zero header length */
1016 dev->type = ARPHRD_NONE; 1016 dev->type = ARPHRD_NONE;
1017 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; 1017 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
1018 dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
1019 break; 1018 break;
1020 1019
1021 case IFF_TAP: 1020 case IFF_TAP:
@@ -1027,7 +1026,6 @@ static void tun_net_init(struct net_device *dev)
1027 1026
1028 eth_hw_addr_random(dev); 1027 eth_hw_addr_random(dev);
1029 1028
1030 dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
1031 break; 1029 break;
1032 } 1030 }
1033} 1031}
@@ -1481,6 +1479,8 @@ static void tun_setup(struct net_device *dev)
1481 1479
1482 dev->ethtool_ops = &tun_ethtool_ops; 1480 dev->ethtool_ops = &tun_ethtool_ops;
1483 dev->destructor = tun_free_netdev; 1481 dev->destructor = tun_free_netdev;
1482 /* We prefer our own queue length */
1483 dev->tx_queue_len = TUN_READQ_SIZE;
1484} 1484}
1485 1485
1486/* Trivial set of netlink ops to allow deleting tun or tap 1486/* Trivial set of netlink ops to allow deleting tun or tap
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cb0d5d09c2e4..8395308a2445 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2120,7 +2120,10 @@ struct napi_gro_cb {
2120 /* Used in foo-over-udp, set in udp[46]_gro_receive */ 2120 /* Used in foo-over-udp, set in udp[46]_gro_receive */
2121 u8 is_ipv6:1; 2121 u8 is_ipv6:1;
2122 2122
2123 /* 7 bit hole */ 2123 /* Used in GRE, set in fou/gue_gro_receive */
2124 u8 is_fou:1;
2125
2126 /* 6 bit hole */
2124 2127
2125 /* used to support CHECKSUM_COMPLETE for tunneling protocols */ 2128 /* used to support CHECKSUM_COMPLETE for tunneling protocols */
2126 __wsum csum; 2129 __wsum csum;
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 2a19fe111c78..03e322b30218 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -135,6 +135,7 @@ void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
135static inline void tc_action_net_exit(struct tc_action_net *tn) 135static inline void tc_action_net_exit(struct tc_action_net *tn)
136{ 136{
137 tcf_hashinfo_destroy(tn->ops, tn->hinfo); 137 tcf_hashinfo_destroy(tn->ops, tn->hinfo);
138 kfree(tn->hinfo);
138} 139}
139 140
140int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, 141int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 0c09da34b67a..e385eb3076a1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1001,6 +1001,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
1001 * flag indicates that the PN was verified for replay protection. 1001 * flag indicates that the PN was verified for replay protection.
1002 * Note that this flag is also currently only supported when a frame 1002 * Note that this flag is also currently only supported when a frame
1003 * is also decrypted (ie. @RX_FLAG_DECRYPTED must be set) 1003 * is also decrypted (ie. @RX_FLAG_DECRYPTED must be set)
1004 * @RX_FLAG_DUP_VALIDATED: The driver should set this flag if it did
1005 * de-duplication by itself.
1004 * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on 1006 * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on
1005 * the frame. 1007 * the frame.
1006 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on 1008 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 65521cfdcade..03fb33efcae2 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -386,11 +386,9 @@ static inline struct list_head *sctp_list_dequeue(struct list_head *list)
386{ 386{
387 struct list_head *result = NULL; 387 struct list_head *result = NULL;
388 388
389 if (list->next != list) { 389 if (!list_empty(list)) {
390 result = list->next; 390 result = list->next;
391 list->next = result->next; 391 list_del_init(result);
392 list->next->prev = list;
393 INIT_LIST_HEAD(result);
394 } 392 }
395 return result; 393 return result;
396} 394}
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 27a7a26b1ece..8f22fbedc3a6 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -2444,6 +2444,22 @@ static struct bpf_test tests[] = {
2444 { { 0, 4294967295U } }, 2444 { { 0, 4294967295U } },
2445 }, 2445 },
2446 { 2446 {
2447 "ALU_ADD_X: 2 + 4294967294 = 0",
2448 .u.insns_int = {
2449 BPF_LD_IMM64(R0, 2),
2450 BPF_LD_IMM64(R1, 4294967294U),
2451 BPF_ALU32_REG(BPF_ADD, R0, R1),
2452 BPF_JMP_IMM(BPF_JEQ, R0, 0, 2),
2453 BPF_ALU32_IMM(BPF_MOV, R0, 0),
2454 BPF_EXIT_INSN(),
2455 BPF_ALU32_IMM(BPF_MOV, R0, 1),
2456 BPF_EXIT_INSN(),
2457 },
2458 INTERNAL,
2459 { },
2460 { { 0, 1 } },
2461 },
2462 {
2447 "ALU64_ADD_X: 1 + 2 = 3", 2463 "ALU64_ADD_X: 1 + 2 = 3",
2448 .u.insns_int = { 2464 .u.insns_int = {
2449 BPF_LD_IMM64(R0, 1), 2465 BPF_LD_IMM64(R0, 1),
@@ -2467,6 +2483,23 @@ static struct bpf_test tests[] = {
2467 { }, 2483 { },
2468 { { 0, 4294967295U } }, 2484 { { 0, 4294967295U } },
2469 }, 2485 },
2486 {
2487 "ALU64_ADD_X: 2 + 4294967294 = 4294967296",
2488 .u.insns_int = {
2489 BPF_LD_IMM64(R0, 2),
2490 BPF_LD_IMM64(R1, 4294967294U),
2491 BPF_LD_IMM64(R2, 4294967296ULL),
2492 BPF_ALU64_REG(BPF_ADD, R0, R1),
2493 BPF_JMP_REG(BPF_JEQ, R0, R2, 2),
2494 BPF_MOV32_IMM(R0, 0),
2495 BPF_EXIT_INSN(),
2496 BPF_MOV32_IMM(R0, 1),
2497 BPF_EXIT_INSN(),
2498 },
2499 INTERNAL,
2500 { },
2501 { { 0, 1 } },
2502 },
2470 /* BPF_ALU | BPF_ADD | BPF_K */ 2503 /* BPF_ALU | BPF_ADD | BPF_K */
2471 { 2504 {
2472 "ALU_ADD_K: 1 + 2 = 3", 2505 "ALU_ADD_K: 1 + 2 = 3",
@@ -2502,6 +2535,21 @@ static struct bpf_test tests[] = {
2502 { { 0, 4294967295U } }, 2535 { { 0, 4294967295U } },
2503 }, 2536 },
2504 { 2537 {
2538 "ALU_ADD_K: 4294967294 + 2 = 0",
2539 .u.insns_int = {
2540 BPF_LD_IMM64(R0, 4294967294U),
2541 BPF_ALU32_IMM(BPF_ADD, R0, 2),
2542 BPF_JMP_IMM(BPF_JEQ, R0, 0, 2),
2543 BPF_ALU32_IMM(BPF_MOV, R0, 0),
2544 BPF_EXIT_INSN(),
2545 BPF_ALU32_IMM(BPF_MOV, R0, 1),
2546 BPF_EXIT_INSN(),
2547 },
2548 INTERNAL,
2549 { },
2550 { { 0, 1 } },
2551 },
2552 {
2505 "ALU_ADD_K: 0 + (-1) = 0x00000000ffffffff", 2553 "ALU_ADD_K: 0 + (-1) = 0x00000000ffffffff",
2506 .u.insns_int = { 2554 .u.insns_int = {
2507 BPF_LD_IMM64(R2, 0x0), 2555 BPF_LD_IMM64(R2, 0x0),
@@ -2518,6 +2566,70 @@ static struct bpf_test tests[] = {
2518 { { 0, 0x1 } }, 2566 { { 0, 0x1 } },
2519 }, 2567 },
2520 { 2568 {
2569 "ALU_ADD_K: 0 + 0xffff = 0xffff",
2570 .u.insns_int = {
2571 BPF_LD_IMM64(R2, 0x0),
2572 BPF_LD_IMM64(R3, 0xffff),
2573 BPF_ALU32_IMM(BPF_ADD, R2, 0xffff),
2574 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2575 BPF_MOV32_IMM(R0, 2),
2576 BPF_EXIT_INSN(),
2577 BPF_MOV32_IMM(R0, 1),
2578 BPF_EXIT_INSN(),
2579 },
2580 INTERNAL,
2581 { },
2582 { { 0, 0x1 } },
2583 },
2584 {
2585 "ALU_ADD_K: 0 + 0x7fffffff = 0x7fffffff",
2586 .u.insns_int = {
2587 BPF_LD_IMM64(R2, 0x0),
2588 BPF_LD_IMM64(R3, 0x7fffffff),
2589 BPF_ALU32_IMM(BPF_ADD, R2, 0x7fffffff),
2590 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2591 BPF_MOV32_IMM(R0, 2),
2592 BPF_EXIT_INSN(),
2593 BPF_MOV32_IMM(R0, 1),
2594 BPF_EXIT_INSN(),
2595 },
2596 INTERNAL,
2597 { },
2598 { { 0, 0x1 } },
2599 },
2600 {
2601 "ALU_ADD_K: 0 + 0x80000000 = 0x80000000",
2602 .u.insns_int = {
2603 BPF_LD_IMM64(R2, 0x0),
2604 BPF_LD_IMM64(R3, 0x80000000),
2605 BPF_ALU32_IMM(BPF_ADD, R2, 0x80000000),
2606 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2607 BPF_MOV32_IMM(R0, 2),
2608 BPF_EXIT_INSN(),
2609 BPF_MOV32_IMM(R0, 1),
2610 BPF_EXIT_INSN(),
2611 },
2612 INTERNAL,
2613 { },
2614 { { 0, 0x1 } },
2615 },
2616 {
2617 "ALU_ADD_K: 0 + 0x80008000 = 0x80008000",
2618 .u.insns_int = {
2619 BPF_LD_IMM64(R2, 0x0),
2620 BPF_LD_IMM64(R3, 0x80008000),
2621 BPF_ALU32_IMM(BPF_ADD, R2, 0x80008000),
2622 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2623 BPF_MOV32_IMM(R0, 2),
2624 BPF_EXIT_INSN(),
2625 BPF_MOV32_IMM(R0, 1),
2626 BPF_EXIT_INSN(),
2627 },
2628 INTERNAL,
2629 { },
2630 { { 0, 0x1 } },
2631 },
2632 {
2521 "ALU64_ADD_K: 1 + 2 = 3", 2633 "ALU64_ADD_K: 1 + 2 = 3",
2522 .u.insns_int = { 2634 .u.insns_int = {
2523 BPF_LD_IMM64(R0, 1), 2635 BPF_LD_IMM64(R0, 1),
@@ -2551,6 +2663,22 @@ static struct bpf_test tests[] = {
2551 { { 0, 2147483647 } }, 2663 { { 0, 2147483647 } },
2552 }, 2664 },
2553 { 2665 {
2666 "ALU64_ADD_K: 4294967294 + 2 = 4294967296",
2667 .u.insns_int = {
2668 BPF_LD_IMM64(R0, 4294967294U),
2669 BPF_LD_IMM64(R1, 4294967296ULL),
2670 BPF_ALU64_IMM(BPF_ADD, R0, 2),
2671 BPF_JMP_REG(BPF_JEQ, R0, R1, 2),
2672 BPF_ALU32_IMM(BPF_MOV, R0, 0),
2673 BPF_EXIT_INSN(),
2674 BPF_ALU32_IMM(BPF_MOV, R0, 1),
2675 BPF_EXIT_INSN(),
2676 },
2677 INTERNAL,
2678 { },
2679 { { 0, 1 } },
2680 },
2681 {
2554 "ALU64_ADD_K: 2147483646 + -2147483647 = -1", 2682 "ALU64_ADD_K: 2147483646 + -2147483647 = -1",
2555 .u.insns_int = { 2683 .u.insns_int = {
2556 BPF_LD_IMM64(R0, 2147483646), 2684 BPF_LD_IMM64(R0, 2147483646),
@@ -2593,6 +2721,70 @@ static struct bpf_test tests[] = {
2593 { }, 2721 { },
2594 { { 0, 0x1 } }, 2722 { { 0, 0x1 } },
2595 }, 2723 },
2724 {
2725 "ALU64_ADD_K: 0 + 0xffff = 0xffff",
2726 .u.insns_int = {
2727 BPF_LD_IMM64(R2, 0x0),
2728 BPF_LD_IMM64(R3, 0xffff),
2729 BPF_ALU64_IMM(BPF_ADD, R2, 0xffff),
2730 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2731 BPF_MOV32_IMM(R0, 2),
2732 BPF_EXIT_INSN(),
2733 BPF_MOV32_IMM(R0, 1),
2734 BPF_EXIT_INSN(),
2735 },
2736 INTERNAL,
2737 { },
2738 { { 0, 0x1 } },
2739 },
2740 {
2741 "ALU64_ADD_K: 0 + 0x7fffffff = 0x7fffffff",
2742 .u.insns_int = {
2743 BPF_LD_IMM64(R2, 0x0),
2744 BPF_LD_IMM64(R3, 0x7fffffff),
2745 BPF_ALU64_IMM(BPF_ADD, R2, 0x7fffffff),
2746 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2747 BPF_MOV32_IMM(R0, 2),
2748 BPF_EXIT_INSN(),
2749 BPF_MOV32_IMM(R0, 1),
2750 BPF_EXIT_INSN(),
2751 },
2752 INTERNAL,
2753 { },
2754 { { 0, 0x1 } },
2755 },
2756 {
2757 "ALU64_ADD_K: 0 + 0x80000000 = 0xffffffff80000000",
2758 .u.insns_int = {
2759 BPF_LD_IMM64(R2, 0x0),
2760 BPF_LD_IMM64(R3, 0xffffffff80000000LL),
2761 BPF_ALU64_IMM(BPF_ADD, R2, 0x80000000),
2762 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2763 BPF_MOV32_IMM(R0, 2),
2764 BPF_EXIT_INSN(),
2765 BPF_MOV32_IMM(R0, 1),
2766 BPF_EXIT_INSN(),
2767 },
2768 INTERNAL,
2769 { },
2770 { { 0, 0x1 } },
2771 },
2772 {
2773 "ALU_ADD_K: 0 + 0x80008000 = 0xffffffff80008000",
2774 .u.insns_int = {
2775 BPF_LD_IMM64(R2, 0x0),
2776 BPF_LD_IMM64(R3, 0xffffffff80008000LL),
2777 BPF_ALU64_IMM(BPF_ADD, R2, 0x80008000),
2778 BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2779 BPF_MOV32_IMM(R0, 2),
2780 BPF_EXIT_INSN(),
2781 BPF_MOV32_IMM(R0, 1),
2782 BPF_EXIT_INSN(),
2783 },
2784 INTERNAL,
2785 { },
2786 { { 0, 0x1 } },
2787 },
2596 /* BPF_ALU | BPF_SUB | BPF_X */ 2788 /* BPF_ALU | BPF_SUB | BPF_X */
2597 { 2789 {
2598 "ALU_SUB_X: 3 - 1 = 2", 2790 "ALU_SUB_X: 3 - 1 = 2",
@@ -4222,6 +4414,20 @@ static struct bpf_test tests[] = {
4222 { }, 4414 { },
4223 { { 0, 1 } }, 4415 { { 0, 1 } },
4224 }, 4416 },
4417 {
4418 "JMP_JGT_K: Unsigned jump: if (-1 > 1) return 1",
4419 .u.insns_int = {
4420 BPF_ALU32_IMM(BPF_MOV, R0, 0),
4421 BPF_LD_IMM64(R1, -1),
4422 BPF_JMP_IMM(BPF_JGT, R1, 1, 1),
4423 BPF_EXIT_INSN(),
4424 BPF_ALU32_IMM(BPF_MOV, R0, 1),
4425 BPF_EXIT_INSN(),
4426 },
4427 INTERNAL,
4428 { },
4429 { { 0, 1 } },
4430 },
4225 /* BPF_JMP | BPF_JGE | BPF_K */ 4431 /* BPF_JMP | BPF_JGE | BPF_K */
4226 { 4432 {
4227 "JMP_JGE_K: if (3 >= 2) return 1", 4433 "JMP_JGE_K: if (3 >= 2) return 1",
@@ -4303,7 +4509,7 @@ static struct bpf_test tests[] = {
4303 .u.insns_int = { 4509 .u.insns_int = {
4304 BPF_ALU32_IMM(BPF_MOV, R0, 0), 4510 BPF_ALU32_IMM(BPF_MOV, R0, 0),
4305 BPF_LD_IMM64(R1, 3), 4511 BPF_LD_IMM64(R1, 3),
4306 BPF_JMP_IMM(BPF_JNE, R1, 2, 1), 4512 BPF_JMP_IMM(BPF_JSET, R1, 2, 1),
4307 BPF_EXIT_INSN(), 4513 BPF_EXIT_INSN(),
4308 BPF_ALU32_IMM(BPF_MOV, R0, 1), 4514 BPF_ALU32_IMM(BPF_MOV, R0, 1),
4309 BPF_EXIT_INSN(), 4515 BPF_EXIT_INSN(),
@@ -4317,7 +4523,7 @@ static struct bpf_test tests[] = {
4317 .u.insns_int = { 4523 .u.insns_int = {
4318 BPF_ALU32_IMM(BPF_MOV, R0, 0), 4524 BPF_ALU32_IMM(BPF_MOV, R0, 0),
4319 BPF_LD_IMM64(R1, 3), 4525 BPF_LD_IMM64(R1, 3),
4320 BPF_JMP_IMM(BPF_JNE, R1, 0xffffffff, 1), 4526 BPF_JMP_IMM(BPF_JSET, R1, 0xffffffff, 1),
4321 BPF_EXIT_INSN(), 4527 BPF_EXIT_INSN(),
4322 BPF_ALU32_IMM(BPF_MOV, R0, 1), 4528 BPF_ALU32_IMM(BPF_MOV, R0, 1),
4323 BPF_EXIT_INSN(), 4529 BPF_EXIT_INSN(),
@@ -4404,6 +4610,21 @@ static struct bpf_test tests[] = {
4404 { }, 4610 { },
4405 { { 0, 1 } }, 4611 { { 0, 1 } },
4406 }, 4612 },
4613 {
4614 "JMP_JGT_X: Unsigned jump: if (-1 > 1) return 1",
4615 .u.insns_int = {
4616 BPF_ALU32_IMM(BPF_MOV, R0, 0),
4617 BPF_LD_IMM64(R1, -1),
4618 BPF_LD_IMM64(R2, 1),
4619 BPF_JMP_REG(BPF_JGT, R1, R2, 1),
4620 BPF_EXIT_INSN(),
4621 BPF_ALU32_IMM(BPF_MOV, R0, 1),
4622 BPF_EXIT_INSN(),
4623 },
4624 INTERNAL,
4625 { },
4626 { { 0, 1 } },
4627 },
4407 /* BPF_JMP | BPF_JGE | BPF_X */ 4628 /* BPF_JMP | BPF_JGE | BPF_X */
4408 { 4629 {
4409 "JMP_JGE_X: if (3 >= 2) return 1", 4630 "JMP_JGE_X: if (3 >= 2) return 1",
@@ -4474,7 +4695,7 @@ static struct bpf_test tests[] = {
4474 BPF_ALU32_IMM(BPF_MOV, R0, 0), 4695 BPF_ALU32_IMM(BPF_MOV, R0, 0),
4475 BPF_LD_IMM64(R1, 3), 4696 BPF_LD_IMM64(R1, 3),
4476 BPF_LD_IMM64(R2, 2), 4697 BPF_LD_IMM64(R2, 2),
4477 BPF_JMP_REG(BPF_JNE, R1, R2, 1), 4698 BPF_JMP_REG(BPF_JSET, R1, R2, 1),
4478 BPF_EXIT_INSN(), 4699 BPF_EXIT_INSN(),
4479 BPF_ALU32_IMM(BPF_MOV, R0, 1), 4700 BPF_ALU32_IMM(BPF_MOV, R0, 1),
4480 BPF_EXIT_INSN(), 4701 BPF_EXIT_INSN(),
@@ -4489,7 +4710,7 @@ static struct bpf_test tests[] = {
4489 BPF_ALU32_IMM(BPF_MOV, R0, 0), 4710 BPF_ALU32_IMM(BPF_MOV, R0, 0),
4490 BPF_LD_IMM64(R1, 3), 4711 BPF_LD_IMM64(R1, 3),
4491 BPF_LD_IMM64(R2, 0xffffffff), 4712 BPF_LD_IMM64(R2, 0xffffffff),
4492 BPF_JMP_REG(BPF_JNE, R1, R2, 1), 4713 BPF_JMP_REG(BPF_JSET, R1, R2, 1),
4493 BPF_EXIT_INSN(), 4714 BPF_EXIT_INSN(),
4494 BPF_ALU32_IMM(BPF_MOV, R0, 1), 4715 BPF_ALU32_IMM(BPF_MOV, R0, 1),
4495 BPF_EXIT_INSN(), 4716 BPF_EXIT_INSN(),
diff --git a/net/core/dev.c b/net/core/dev.c
index b9bcbe77d913..77a71cd68535 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4439,6 +4439,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
4439 NAPI_GRO_CB(skb)->flush = 0; 4439 NAPI_GRO_CB(skb)->flush = 0;
4440 NAPI_GRO_CB(skb)->free = 0; 4440 NAPI_GRO_CB(skb)->free = 0;
4441 NAPI_GRO_CB(skb)->encap_mark = 0; 4441 NAPI_GRO_CB(skb)->encap_mark = 0;
4442 NAPI_GRO_CB(skb)->is_fou = 0;
4442 NAPI_GRO_CB(skb)->gro_remcsum_start = 0; 4443 NAPI_GRO_CB(skb)->gro_remcsum_start = 0;
4443 4444
4444 /* Setup for GRO checksum validation */ 4445 /* Setup for GRO checksum validation */
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index a57bd17805b4..94acfc89ad97 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -603,6 +603,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev)
603 const struct net_device_ops *ops; 603 const struct net_device_ops *ops;
604 int err; 604 int err;
605 605
606 np->dev = ndev;
606 strlcpy(np->dev_name, ndev->name, IFNAMSIZ); 607 strlcpy(np->dev_name, ndev->name, IFNAMSIZ);
607 INIT_WORK(&np->cleanup_work, netpoll_async_cleanup); 608 INIT_WORK(&np->cleanup_work, netpoll_async_cleanup);
608 609
@@ -669,7 +670,6 @@ int netpoll_setup(struct netpoll *np)
669 goto unlock; 670 goto unlock;
670 } 671 }
671 dev_hold(ndev); 672 dev_hold(ndev);
672 np->dev = ndev;
673 673
674 if (netdev_master_upper_dev_get(ndev)) { 674 if (netdev_master_upper_dev_get(ndev)) {
675 np_err(np, "%s is a slave device, aborting\n", np->dev_name); 675 np_err(np, "%s is a slave device, aborting\n", np->dev_name);
@@ -770,7 +770,6 @@ int netpoll_setup(struct netpoll *np)
770 return 0; 770 return 0;
771 771
772put: 772put:
773 np->dev = NULL;
774 dev_put(ndev); 773 dev_put(ndev);
775unlock: 774unlock:
776 rtnl_unlock(); 775 rtnl_unlock();
diff --git a/net/core/sock.c b/net/core/sock.c
index b67b9aedb230..7e73c26b6bb4 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -221,7 +221,8 @@ static const char *const af_family_key_strings[AF_MAX+1] = {
221 "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" , 221 "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" ,
222 "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" , 222 "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" ,
223 "sk_lock-AF_IEEE802154", "sk_lock-AF_CAIF" , "sk_lock-AF_ALG" , 223 "sk_lock-AF_IEEE802154", "sk_lock-AF_CAIF" , "sk_lock-AF_ALG" ,
224 "sk_lock-AF_NFC" , "sk_lock-AF_VSOCK" , "sk_lock-AF_MAX" 224 "sk_lock-AF_NFC" , "sk_lock-AF_VSOCK" , "sk_lock-AF_KCM" ,
225 "sk_lock-AF_MAX"
225}; 226};
226static const char *const af_family_slock_key_strings[AF_MAX+1] = { 227static const char *const af_family_slock_key_strings[AF_MAX+1] = {
227 "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" , 228 "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" ,
@@ -237,7 +238,8 @@ static const char *const af_family_slock_key_strings[AF_MAX+1] = {
237 "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" , 238 "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" ,
238 "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" , 239 "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" ,
239 "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG" , 240 "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG" ,
240 "slock-AF_NFC" , "slock-AF_VSOCK" ,"slock-AF_MAX" 241 "slock-AF_NFC" , "slock-AF_VSOCK" ,"slock-AF_KCM" ,
242 "slock-AF_MAX"
241}; 243};
242static const char *const af_family_clock_key_strings[AF_MAX+1] = { 244static const char *const af_family_clock_key_strings[AF_MAX+1] = {
243 "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" , 245 "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" ,
@@ -253,7 +255,8 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = {
253 "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" , 255 "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" ,
254 "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , 256 "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" ,
255 "clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG" , 257 "clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG" ,
256 "clock-AF_NFC" , "clock-AF_VSOCK" , "clock-AF_MAX" 258 "clock-AF_NFC" , "clock-AF_VSOCK" , "clock-AF_KCM" ,
259 "clock-AF_MAX"
257}; 260};
258 261
259/* 262/*
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index 5a94aea280d3..a39068b4a4d9 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -203,6 +203,9 @@ static struct sk_buff **fou_gro_receive(struct sk_buff **head,
203 */ 203 */
204 NAPI_GRO_CB(skb)->encap_mark = 0; 204 NAPI_GRO_CB(skb)->encap_mark = 0;
205 205
206 /* Flag this frame as already having an outer encap header */
207 NAPI_GRO_CB(skb)->is_fou = 1;
208
206 rcu_read_lock(); 209 rcu_read_lock();
207 offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; 210 offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
208 ops = rcu_dereference(offloads[proto]); 211 ops = rcu_dereference(offloads[proto]);
@@ -368,6 +371,9 @@ static struct sk_buff **gue_gro_receive(struct sk_buff **head,
368 */ 371 */
369 NAPI_GRO_CB(skb)->encap_mark = 0; 372 NAPI_GRO_CB(skb)->encap_mark = 0;
370 373
374 /* Flag this frame as already having an outer encap header */
375 NAPI_GRO_CB(skb)->is_fou = 1;
376
371 rcu_read_lock(); 377 rcu_read_lock();
372 offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; 378 offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
373 ops = rcu_dereference(offloads[guehdr->proto_ctype]); 379 ops = rcu_dereference(offloads[guehdr->proto_ctype]);
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index c47539d04b88..6a5bd4317866 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -150,6 +150,14 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
150 if ((greh->flags & ~(GRE_KEY|GRE_CSUM)) != 0) 150 if ((greh->flags & ~(GRE_KEY|GRE_CSUM)) != 0)
151 goto out; 151 goto out;
152 152
153 /* We can only support GRE_CSUM if we can track the location of
154 * the GRE header. In the case of FOU/GUE we cannot because the
155 * outer UDP header displaces the GRE header leaving us in a state
156 * of limbo.
157 */
158 if ((greh->flags & GRE_CSUM) && NAPI_GRO_CB(skb)->is_fou)
159 goto out;
160
153 type = greh->protocol; 161 type = greh->protocol;
154 162
155 rcu_read_lock(); 163 rcu_read_lock();
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 31936d387cfd..af5d1f38217f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -862,9 +862,16 @@ static void __gre_tunnel_init(struct net_device *dev)
862 dev->hw_features |= GRE_FEATURES; 862 dev->hw_features |= GRE_FEATURES;
863 863
864 if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { 864 if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) {
865 /* TCP offload with GRE SEQ is not supported. */ 865 /* TCP offload with GRE SEQ is not supported, nor
866 dev->features |= NETIF_F_GSO_SOFTWARE; 866 * can we support 2 levels of outer headers requiring
867 dev->hw_features |= NETIF_F_GSO_SOFTWARE; 867 * an update.
868 */
869 if (!(tunnel->parms.o_flags & TUNNEL_CSUM) ||
870 (tunnel->encap.type == TUNNEL_ENCAP_NONE)) {
871 dev->features |= NETIF_F_GSO_SOFTWARE;
872 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
873 }
874
868 /* Can use a lockless transmit, unless we generate 875 /* Can use a lockless transmit, unless we generate
869 * output sequences 876 * output sequences
870 */ 877 */
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 9428345d3a07..bc972e7152c7 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1090,8 +1090,8 @@ static inline int ip6_ufo_append_data(struct sock *sk,
1090 int getfrag(void *from, char *to, int offset, int len, 1090 int getfrag(void *from, char *to, int offset, int len,
1091 int odd, struct sk_buff *skb), 1091 int odd, struct sk_buff *skb),
1092 void *from, int length, int hh_len, int fragheaderlen, 1092 void *from, int length, int hh_len, int fragheaderlen,
1093 int transhdrlen, int mtu, unsigned int flags, 1093 int exthdrlen, int transhdrlen, int mtu,
1094 const struct flowi6 *fl6) 1094 unsigned int flags, const struct flowi6 *fl6)
1095 1095
1096{ 1096{
1097 struct sk_buff *skb; 1097 struct sk_buff *skb;
@@ -1116,7 +1116,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
1116 skb_put(skb, fragheaderlen + transhdrlen); 1116 skb_put(skb, fragheaderlen + transhdrlen);
1117 1117
1118 /* initialize network header pointer */ 1118 /* initialize network header pointer */
1119 skb_reset_network_header(skb); 1119 skb_set_network_header(skb, exthdrlen);
1120 1120
1121 /* initialize protocol header pointer */ 1121 /* initialize protocol header pointer */
1122 skb->transport_header = skb->network_header + fragheaderlen; 1122 skb->transport_header = skb->network_header + fragheaderlen;
@@ -1358,7 +1358,7 @@ emsgsize:
1358 (rt->dst.dev->features & NETIF_F_UFO) && 1358 (rt->dst.dev->features & NETIF_F_UFO) &&
1359 (sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk)) { 1359 (sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk)) {
1360 err = ip6_ufo_append_data(sk, queue, getfrag, from, length, 1360 err = ip6_ufo_append_data(sk, queue, getfrag, from, length,
1361 hh_len, fragheaderlen, 1361 hh_len, fragheaderlen, exthdrlen,
1362 transhdrlen, mtu, flags, fl6); 1362 transhdrlen, mtu, flags, fl6);
1363 if (err) 1363 if (err)
1364 goto error; 1364 goto error;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index eb2ac4bb09ce..1f20345cbc97 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -252,12 +252,12 @@ static int ip6_tnl_create2(struct net_device *dev)
252 252
253 t = netdev_priv(dev); 253 t = netdev_priv(dev);
254 254
255 dev->rtnl_link_ops = &ip6_link_ops;
255 err = register_netdevice(dev); 256 err = register_netdevice(dev);
256 if (err < 0) 257 if (err < 0)
257 goto out; 258 goto out;
258 259
259 strcpy(t->parms.name, dev->name); 260 strcpy(t->parms.name, dev->name);
260 dev->rtnl_link_ops = &ip6_link_ops;
261 261
262 dev_hold(dev); 262 dev_hold(dev);
263 ip6_tnl_link(ip6n, t); 263 ip6_tnl_link(ip6n, t);
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index ec22078b0914..42de4ccd159f 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -123,12 +123,11 @@ static int l2tp_ip_recv(struct sk_buff *skb)
123 struct l2tp_tunnel *tunnel = NULL; 123 struct l2tp_tunnel *tunnel = NULL;
124 int length; 124 int length;
125 125
126 /* Point to L2TP header */
127 optr = ptr = skb->data;
128
129 if (!pskb_may_pull(skb, 4)) 126 if (!pskb_may_pull(skb, 4))
130 goto discard; 127 goto discard;
131 128
129 /* Point to L2TP header */
130 optr = ptr = skb->data;
132 session_id = ntohl(*((__be32 *) ptr)); 131 session_id = ntohl(*((__be32 *) ptr));
133 ptr += 4; 132 ptr += 4;
134 133
@@ -156,6 +155,9 @@ static int l2tp_ip_recv(struct sk_buff *skb)
156 if (!pskb_may_pull(skb, length)) 155 if (!pskb_may_pull(skb, length))
157 goto discard; 156 goto discard;
158 157
158 /* Point to L2TP header */
159 optr = ptr = skb->data;
160 ptr += 4;
159 pr_debug("%s: ip recv\n", tunnel->name); 161 pr_debug("%s: ip recv\n", tunnel->name);
160 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); 162 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length);
161 } 163 }
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 6b54ff3ff4cb..cd479903d943 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -136,12 +136,11 @@ static int l2tp_ip6_recv(struct sk_buff *skb)
136 struct l2tp_tunnel *tunnel = NULL; 136 struct l2tp_tunnel *tunnel = NULL;
137 int length; 137 int length;
138 138
139 /* Point to L2TP header */
140 optr = ptr = skb->data;
141
142 if (!pskb_may_pull(skb, 4)) 139 if (!pskb_may_pull(skb, 4))
143 goto discard; 140 goto discard;
144 141
142 /* Point to L2TP header */
143 optr = ptr = skb->data;
145 session_id = ntohl(*((__be32 *) ptr)); 144 session_id = ntohl(*((__be32 *) ptr));
146 ptr += 4; 145 ptr += 4;
147 146
@@ -169,6 +168,9 @@ static int l2tp_ip6_recv(struct sk_buff *skb)
169 if (!pskb_may_pull(skb, length)) 168 if (!pskb_may_pull(skb, length))
170 goto discard; 169 goto discard;
171 170
171 /* Point to L2TP header */
172 optr = ptr = skb->data;
173 ptr += 4;
172 pr_debug("%s: ip recv\n", tunnel->name); 174 pr_debug("%s: ip recv\n", tunnel->name);
173 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); 175 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length);
174 } 176 }
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 283981108ca8..74142d07ad31 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -343,8 +343,10 @@ static void ieee80211_change_chanctx(struct ieee80211_local *local,
343 struct ieee80211_chanctx *ctx, 343 struct ieee80211_chanctx *ctx,
344 const struct cfg80211_chan_def *chandef) 344 const struct cfg80211_chan_def *chandef)
345{ 345{
346 if (cfg80211_chandef_identical(&ctx->conf.def, chandef)) 346 if (cfg80211_chandef_identical(&ctx->conf.def, chandef)) {
347 ieee80211_recalc_chanctx_min_def(local, ctx);
347 return; 348 return;
349 }
348 350
349 WARN_ON(!cfg80211_chandef_compatible(&ctx->conf.def, chandef)); 351 WARN_ON(!cfg80211_chandef_compatible(&ctx->conf.def, chandef));
350 352
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 804575ff7af5..422003540169 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1719,6 +1719,10 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
1719enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta); 1719enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta);
1720enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); 1720enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta);
1721void ieee80211_sta_set_rx_nss(struct sta_info *sta); 1721void ieee80211_sta_set_rx_nss(struct sta_info *sta);
1722enum ieee80211_sta_rx_bandwidth
1723ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width);
1724enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta);
1725void ieee80211_sta_set_rx_nss(struct sta_info *sta);
1722void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata, 1726void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
1723 struct ieee80211_mgmt *mgmt); 1727 struct ieee80211_mgmt *mgmt);
1724u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 1728u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 5b6aec1a0630..002244bca948 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -530,7 +530,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
530 const u8 *target_addr, *orig_addr; 530 const u8 *target_addr, *orig_addr;
531 const u8 *da; 531 const u8 *da;
532 u8 target_flags, ttl, flags; 532 u8 target_flags, ttl, flags;
533 u32 orig_sn, target_sn, lifetime, target_metric; 533 u32 orig_sn, target_sn, lifetime, target_metric = 0;
534 bool reply = false; 534 bool reply = false;
535 bool forward = true; 535 bool forward = true;
536 bool root_is_gate; 536 bool root_is_gate;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index d20bab5c146c..861b93ffbe92 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -67,6 +67,7 @@
67 67
68static const struct rhashtable_params sta_rht_params = { 68static const struct rhashtable_params sta_rht_params = {
69 .nelem_hint = 3, /* start small */ 69 .nelem_hint = 3, /* start small */
70 .insecure_elasticity = true, /* Disable chain-length checks. */
70 .automatic_shrinking = true, 71 .automatic_shrinking = true,
71 .head_offset = offsetof(struct sta_info, hash_node), 72 .head_offset = offsetof(struct sta_info, hash_node),
72 .key_offset = offsetof(struct sta_info, addr), 73 .key_offset = offsetof(struct sta_info, addr),
@@ -258,11 +259,11 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
258} 259}
259 260
260/* Caller must hold local->sta_mtx */ 261/* Caller must hold local->sta_mtx */
261static void sta_info_hash_add(struct ieee80211_local *local, 262static int sta_info_hash_add(struct ieee80211_local *local,
262 struct sta_info *sta) 263 struct sta_info *sta)
263{ 264{
264 rhashtable_insert_fast(&local->sta_hash, &sta->hash_node, 265 return rhashtable_insert_fast(&local->sta_hash, &sta->hash_node,
265 sta_rht_params); 266 sta_rht_params);
266} 267}
267 268
268static void sta_deliver_ps_frames(struct work_struct *wk) 269static void sta_deliver_ps_frames(struct work_struct *wk)
@@ -524,7 +525,9 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
524 set_sta_flag(sta, WLAN_STA_BLOCK_BA); 525 set_sta_flag(sta, WLAN_STA_BLOCK_BA);
525 526
526 /* make the station visible */ 527 /* make the station visible */
527 sta_info_hash_add(local, sta); 528 err = sta_info_hash_add(local, sta);
529 if (err)
530 goto out_drop_sta;
528 531
529 list_add_tail_rcu(&sta->list, &local->sta_list); 532 list_add_tail_rcu(&sta->list, &local->sta_list);
530 533
@@ -557,6 +560,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
557 out_remove: 560 out_remove:
558 sta_info_hash_del(local, sta); 561 sta_info_hash_del(local, sta);
559 list_del_rcu(&sta->list); 562 list_del_rcu(&sta->list);
563 out_drop_sta:
560 local->num_sta--; 564 local->num_sta--;
561 synchronize_net(); 565 synchronize_net();
562 __cleanup_single_sta(sta); 566 __cleanup_single_sta(sta);
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 053f5c4fa495..62193f4bc37b 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -377,7 +377,6 @@ DECLARE_EWMA(signal, 1024, 8)
377 * @uploaded: set to true when sta is uploaded to the driver 377 * @uploaded: set to true when sta is uploaded to the driver
378 * @sta: station information we share with the driver 378 * @sta: station information we share with the driver
379 * @sta_state: duplicates information about station state (for debug) 379 * @sta_state: duplicates information about station state (for debug)
380 * @beacon_loss_count: number of times beacon loss has triggered
381 * @rcu_head: RCU head used for freeing this station struct 380 * @rcu_head: RCU head used for freeing this station struct
382 * @cur_max_bandwidth: maximum bandwidth to use for TX to the station, 381 * @cur_max_bandwidth: maximum bandwidth to use for TX to the station,
383 * taken from HT/VHT capabilities or VHT operating mode notification 382 * taken from HT/VHT capabilities or VHT operating mode notification
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index c9eeb3f12808..a29ea813b7d5 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -4,7 +4,7 @@
4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
5 * Copyright 2014, Intel Corporation 5 * Copyright 2014, Intel Corporation
6 * Copyright 2014 Intel Mobile Communications GmbH 6 * Copyright 2014 Intel Mobile Communications GmbH
7 * Copyright 2015 Intel Deutschland GmbH 7 * Copyright 2015 - 2016 Intel Deutschland GmbH
8 * 8 *
9 * This file is GPLv2 as found in COPYING. 9 * This file is GPLv2 as found in COPYING.
10 */ 10 */
@@ -15,6 +15,7 @@
15#include <linux/rtnetlink.h> 15#include <linux/rtnetlink.h>
16#include "ieee80211_i.h" 16#include "ieee80211_i.h"
17#include "driver-ops.h" 17#include "driver-ops.h"
18#include "rate.h"
18 19
19/* give usermode some time for retries in setting up the TDLS session */ 20/* give usermode some time for retries in setting up the TDLS session */
20#define TDLS_PEER_SETUP_TIMEOUT (15 * HZ) 21#define TDLS_PEER_SETUP_TIMEOUT (15 * HZ)
@@ -302,7 +303,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata,
302 /* IEEE802.11ac-2013 Table E-4 */ 303 /* IEEE802.11ac-2013 Table E-4 */
303 u16 centers_80mhz[] = { 5210, 5290, 5530, 5610, 5690, 5775 }; 304 u16 centers_80mhz[] = { 5210, 5290, 5530, 5610, 5690, 5775 };
304 struct cfg80211_chan_def uc = sta->tdls_chandef; 305 struct cfg80211_chan_def uc = sta->tdls_chandef;
305 enum nl80211_chan_width max_width = ieee80211_get_sta_bw(&sta->sta); 306 enum nl80211_chan_width max_width = ieee80211_sta_cap_chan_bw(sta);
306 int i; 307 int i;
307 308
308 /* only support upgrading non-narrow channels up to 80Mhz */ 309 /* only support upgrading non-narrow channels up to 80Mhz */
@@ -313,7 +314,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata,
313 if (max_width > NL80211_CHAN_WIDTH_80) 314 if (max_width > NL80211_CHAN_WIDTH_80)
314 max_width = NL80211_CHAN_WIDTH_80; 315 max_width = NL80211_CHAN_WIDTH_80;
315 316
316 if (uc.width == max_width) 317 if (uc.width >= max_width)
317 return; 318 return;
318 /* 319 /*
319 * Channel usage constrains in the IEEE802.11ac-2013 specification only 320 * Channel usage constrains in the IEEE802.11ac-2013 specification only
@@ -324,6 +325,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata,
324 for (i = 0; i < ARRAY_SIZE(centers_80mhz); i++) 325 for (i = 0; i < ARRAY_SIZE(centers_80mhz); i++)
325 if (abs(uc.chan->center_freq - centers_80mhz[i]) <= 30) { 326 if (abs(uc.chan->center_freq - centers_80mhz[i]) <= 30) {
326 uc.center_freq1 = centers_80mhz[i]; 327 uc.center_freq1 = centers_80mhz[i];
328 uc.center_freq2 = 0;
327 uc.width = NL80211_CHAN_WIDTH_80; 329 uc.width = NL80211_CHAN_WIDTH_80;
328 break; 330 break;
329 } 331 }
@@ -332,7 +334,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata,
332 return; 334 return;
333 335
334 /* proceed to downgrade the chandef until usable or the same */ 336 /* proceed to downgrade the chandef until usable or the same */
335 while (uc.width > max_width && 337 while (uc.width > max_width ||
336 !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, 338 !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc,
337 sdata->wdev.iftype)) 339 sdata->wdev.iftype))
338 ieee80211_chandef_downgrade(&uc); 340 ieee80211_chandef_downgrade(&uc);
@@ -1242,18 +1244,44 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
1242 return ret; 1244 return ret;
1243} 1245}
1244 1246
1245static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata) 1247static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata,
1248 struct sta_info *sta)
1246{ 1249{
1247 struct ieee80211_local *local = sdata->local; 1250 struct ieee80211_local *local = sdata->local;
1248 struct ieee80211_chanctx_conf *conf; 1251 struct ieee80211_chanctx_conf *conf;
1249 struct ieee80211_chanctx *ctx; 1252 struct ieee80211_chanctx *ctx;
1253 enum nl80211_chan_width width;
1254 struct ieee80211_supported_band *sband;
1250 1255
1251 mutex_lock(&local->chanctx_mtx); 1256 mutex_lock(&local->chanctx_mtx);
1252 conf = rcu_dereference_protected(sdata->vif.chanctx_conf, 1257 conf = rcu_dereference_protected(sdata->vif.chanctx_conf,
1253 lockdep_is_held(&local->chanctx_mtx)); 1258 lockdep_is_held(&local->chanctx_mtx));
1254 if (conf) { 1259 if (conf) {
1260 width = conf->def.width;
1261 sband = local->hw.wiphy->bands[conf->def.chan->band];
1255 ctx = container_of(conf, struct ieee80211_chanctx, conf); 1262 ctx = container_of(conf, struct ieee80211_chanctx, conf);
1256 ieee80211_recalc_chanctx_chantype(local, ctx); 1263 ieee80211_recalc_chanctx_chantype(local, ctx);
1264
1265 /* if width changed and a peer is given, update its BW */
1266 if (width != conf->def.width && sta &&
1267 test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW)) {
1268 enum ieee80211_sta_rx_bandwidth bw;
1269
1270 bw = ieee80211_chan_width_to_rx_bw(conf->def.width);
1271 bw = min(bw, ieee80211_sta_cap_rx_bw(sta));
1272 if (bw != sta->sta.bandwidth) {
1273 sta->sta.bandwidth = bw;
1274 rate_control_rate_update(local, sband, sta,
1275 IEEE80211_RC_BW_CHANGED);
1276 /*
1277 * if a TDLS peer BW was updated, we need to
1278 * recalc the chandef width again, to get the
1279 * correct chanctx min_def
1280 */
1281 ieee80211_recalc_chanctx_chantype(local, ctx);
1282 }
1283 }
1284
1257 } 1285 }
1258 mutex_unlock(&local->chanctx_mtx); 1286 mutex_unlock(&local->chanctx_mtx);
1259} 1287}
@@ -1350,8 +1378,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
1350 break; 1378 break;
1351 } 1379 }
1352 1380
1353 iee80211_tdls_recalc_chanctx(sdata);
1354
1355 mutex_lock(&local->sta_mtx); 1381 mutex_lock(&local->sta_mtx);
1356 sta = sta_info_get(sdata, peer); 1382 sta = sta_info_get(sdata, peer);
1357 if (!sta) { 1383 if (!sta) {
@@ -1360,6 +1386,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
1360 break; 1386 break;
1361 } 1387 }
1362 1388
1389 iee80211_tdls_recalc_chanctx(sdata, sta);
1363 iee80211_tdls_recalc_ht_protection(sdata, sta); 1390 iee80211_tdls_recalc_ht_protection(sdata, sta);
1364 1391
1365 set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH); 1392 set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH);
@@ -1390,7 +1417,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
1390 iee80211_tdls_recalc_ht_protection(sdata, NULL); 1417 iee80211_tdls_recalc_ht_protection(sdata, NULL);
1391 mutex_unlock(&local->sta_mtx); 1418 mutex_unlock(&local->sta_mtx);
1392 1419
1393 iee80211_tdls_recalc_chanctx(sdata); 1420 iee80211_tdls_recalc_chanctx(sdata, NULL);
1394 break; 1421 break;
1395 default: 1422 default:
1396 ret = -ENOTSUPP; 1423 ret = -ENOTSUPP;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 62ad5321257d..21f6602395f7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1116,11 +1116,15 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1116 reset_agg_timer = true; 1116 reset_agg_timer = true;
1117 } else { 1117 } else {
1118 queued = true; 1118 queued = true;
1119 if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER) {
1120 clear_sta_flag(tx->sta, WLAN_STA_SP);
1121 ps_dbg(tx->sta->sdata,
1122 "STA %pM aid %d: SP frame queued, close the SP w/o telling the peer\n",
1123 tx->sta->sta.addr, tx->sta->sta.aid);
1124 }
1119 info->control.vif = &tx->sdata->vif; 1125 info->control.vif = &tx->sdata->vif;
1120 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; 1126 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
1121 info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS | 1127 info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS;
1122 IEEE80211_TX_CTL_NO_PS_BUFFER |
1123 IEEE80211_TX_STATUS_EOSP;
1124 __skb_queue_tail(&tid_tx->pending, skb); 1128 __skb_queue_tail(&tid_tx->pending, skb);
1125 if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER) 1129 if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER)
1126 purge_skb = __skb_dequeue(&tid_tx->pending); 1130 purge_skb = __skb_dequeue(&tid_tx->pending);
@@ -1247,7 +1251,8 @@ static void ieee80211_drv_tx(struct ieee80211_local *local,
1247 struct txq_info *txqi; 1251 struct txq_info *txqi;
1248 u8 ac; 1252 u8 ac;
1249 1253
1250 if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE) 1254 if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) ||
1255 (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
1251 goto tx_normal; 1256 goto tx_normal;
1252 1257
1253 if (!ieee80211_is_data(hdr->frame_control)) 1258 if (!ieee80211_is_data(hdr->frame_control))
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index 89e04d55aa18..e590e2ef9eaf 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -319,7 +319,30 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta)
319 return IEEE80211_STA_RX_BW_80; 319 return IEEE80211_STA_RX_BW_80;
320} 320}
321 321
322static enum ieee80211_sta_rx_bandwidth 322enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta)
323{
324 struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.vht_cap;
325 u32 cap_width;
326
327 if (!vht_cap->vht_supported) {
328 if (!sta->sta.ht_cap.ht_supported)
329 return NL80211_CHAN_WIDTH_20_NOHT;
330
331 return sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
332 NL80211_CHAN_WIDTH_40 : NL80211_CHAN_WIDTH_20;
333 }
334
335 cap_width = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
336
337 if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)
338 return NL80211_CHAN_WIDTH_160;
339 else if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
340 return NL80211_CHAN_WIDTH_80P80;
341
342 return NL80211_CHAN_WIDTH_80;
343}
344
345enum ieee80211_sta_rx_bandwidth
323ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width) 346ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width)
324{ 347{
325 switch (width) { 348 switch (width) {
@@ -347,10 +370,7 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta)
347 370
348 bw = ieee80211_sta_cap_rx_bw(sta); 371 bw = ieee80211_sta_cap_rx_bw(sta);
349 bw = min(bw, sta->cur_max_bandwidth); 372 bw = min(bw, sta->cur_max_bandwidth);
350 373 bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width));
351 /* do not cap the BW of TDLS WIDER_BW peers by the bss */
352 if (!test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW))
353 bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width));
354 374
355 return bw; 375 return bw;
356} 376}
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index b18c5ed42d95..0b80a7140cc4 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -543,6 +543,9 @@ static struct net_device *find_outdev(struct net *net,
543 if (!dev) 543 if (!dev)
544 return ERR_PTR(-ENODEV); 544 return ERR_PTR(-ENODEV);
545 545
546 if (IS_ERR(dev))
547 return dev;
548
546 /* The caller is holding rtnl anyways, so release the dev reference */ 549 /* The caller is holding rtnl anyways, so release the dev reference */
547 dev_put(dev); 550 dev_put(dev);
548 551
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 1ecfa710ca98..f12c17f355d9 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4151,7 +4151,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
4151 4151
4152 /* Opening a Tx-ring is NOT supported in TPACKET_V3 */ 4152 /* Opening a Tx-ring is NOT supported in TPACKET_V3 */
4153 if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) { 4153 if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) {
4154 WARN(1, "Tx-ring is not supported.\n"); 4154 net_warn_ratelimited("Tx-ring is not supported.\n");
4155 goto out; 4155 goto out;
4156 } 4156 }
4157 4157
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 977fb86065b7..abc8cc805e8d 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -796,7 +796,7 @@ static void rds_ib_cong_recv(struct rds_connection *conn,
796 796
797 addr = kmap_atomic(sg_page(&frag->f_sg)); 797 addr = kmap_atomic(sg_page(&frag->f_sg));
798 798
799 src = addr + frag_off; 799 src = addr + frag->f_sg.offset + frag_off;
800 dst = (void *)map->m_page_addrs[map_page] + map_off; 800 dst = (void *)map->m_page_addrs[map_page] + map_off;
801 for (k = 0; k < to_copy; k += 8) { 801 for (k = 0; k < to_copy; k += 8) {
802 /* Record ports that became uncongested, ie 802 /* Record ports that became uncongested, ie
diff --git a/net/rds/page.c b/net/rds/page.c
index 616f21f4e7d7..e2b5a5832d3d 100644
--- a/net/rds/page.c
+++ b/net/rds/page.c
@@ -135,8 +135,8 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
135 if (rem->r_offset != 0) 135 if (rem->r_offset != 0)
136 rds_stats_inc(s_page_remainder_hit); 136 rds_stats_inc(s_page_remainder_hit);
137 137
138 rem->r_offset += bytes; 138 rem->r_offset += ALIGN(bytes, 8);
139 if (rem->r_offset == PAGE_SIZE) { 139 if (rem->r_offset >= PAGE_SIZE) {
140 __free_page(rem->r_page); 140 __free_page(rem->r_page);
141 rem->r_page = NULL; 141 rem->r_page = NULL;
142 } 142 }
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 97745351d58c..9844fe573029 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -705,7 +705,8 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
705 /* Check whether this chunk and all the rest of pending data will fit 705 /* Check whether this chunk and all the rest of pending data will fit
706 * or delay in hopes of bundling a full sized packet. 706 * or delay in hopes of bundling a full sized packet.
707 */ 707 */
708 if (chunk->skb->len + q->out_qlen >= transport->pathmtu - packet->overhead) 708 if (chunk->skb->len + q->out_qlen >
709 transport->pathmtu - packet->overhead - sizeof(sctp_data_chunk_t) - 4)
709 /* Enough data queued to fill a packet */ 710 /* Enough data queued to fill a packet */
710 return SCTP_XMIT_OK; 711 return SCTP_XMIT_OK;
711 712
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 0a369bb440e7..662bdd20a748 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -842,7 +842,7 @@ static void vmci_transport_peer_detach_cb(u32 sub_id,
842 * qp_handle. 842 * qp_handle.
843 */ 843 */
844 if (vmci_handle_is_invalid(e_payload->handle) || 844 if (vmci_handle_is_invalid(e_payload->handle) ||
845 vmci_handle_is_equal(trans->qp_handle, e_payload->handle)) 845 !vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
846 return; 846 return;
847 847
848 /* We don't ask for delayed CBs when we subscribe to this event (we 848 /* We don't ask for delayed CBs when we subscribe to this event (we
@@ -2154,7 +2154,7 @@ module_exit(vmci_transport_exit);
2154 2154
2155MODULE_AUTHOR("VMware, Inc."); 2155MODULE_AUTHOR("VMware, Inc.");
2156MODULE_DESCRIPTION("VMCI transport for Virtual Sockets"); 2156MODULE_DESCRIPTION("VMCI transport for Virtual Sockets");
2157MODULE_VERSION("1.0.2.0-k"); 2157MODULE_VERSION("1.0.3.0-k");
2158MODULE_LICENSE("GPL v2"); 2158MODULE_LICENSE("GPL v2");
2159MODULE_ALIAS("vmware_vsock"); 2159MODULE_ALIAS("vmware_vsock");
2160MODULE_ALIAS_NETPROTO(PF_VSOCK); 2160MODULE_ALIAS_NETPROTO(PF_VSOCK);
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 502c9fc8db85..b820cc96a3bc 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -76,16 +76,10 @@ HOSTLOADLIBES_offwaketime += -lelf
76HOSTLOADLIBES_spintest += -lelf 76HOSTLOADLIBES_spintest += -lelf
77HOSTLOADLIBES_map_perf_test += -lelf -lrt 77HOSTLOADLIBES_map_perf_test += -lelf -lrt
78 78
79# point this to your LLVM backend with bpf support 79# asm/sysreg.h - inline assembly used by it is incompatible with llvm.
80LLC=$(srctree)/tools/bpf/llvm/bld/Debug+Asserts/bin/llc 80# But, there is no easy way to fix it, so just exclude it since it is
81
82# asm/sysreg.h inline assmbly used by it is incompatible with llvm.
83# But, ehere is not easy way to fix it, so just exclude it since it is
84# useless for BPF samples. 81# useless for BPF samples.
85$(obj)/%.o: $(src)/%.c 82$(obj)/%.o: $(src)/%.c
86 clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ 83 clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \
87 -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ 84 -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
88 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ 85 -O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=obj -o $@
89 clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \
90 -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
91 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=asm -o $@.s
diff --git a/samples/bpf/bpf_helpers.h b/samples/bpf/bpf_helpers.h
index 9363500131a7..7904a2a493de 100644
--- a/samples/bpf/bpf_helpers.h
+++ b/samples/bpf/bpf_helpers.h
@@ -82,6 +82,7 @@ static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flag
82#define PT_REGS_FP(x) ((x)->bp) 82#define PT_REGS_FP(x) ((x)->bp)
83#define PT_REGS_RC(x) ((x)->ax) 83#define PT_REGS_RC(x) ((x)->ax)
84#define PT_REGS_SP(x) ((x)->sp) 84#define PT_REGS_SP(x) ((x)->sp)
85#define PT_REGS_IP(x) ((x)->ip)
85 86
86#elif defined(__s390x__) 87#elif defined(__s390x__)
87 88
@@ -94,6 +95,7 @@ static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flag
94#define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */ 95#define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */
95#define PT_REGS_RC(x) ((x)->gprs[2]) 96#define PT_REGS_RC(x) ((x)->gprs[2])
96#define PT_REGS_SP(x) ((x)->gprs[15]) 97#define PT_REGS_SP(x) ((x)->gprs[15])
98#define PT_REGS_IP(x) ((x)->ip)
97 99
98#elif defined(__aarch64__) 100#elif defined(__aarch64__)
99 101
@@ -106,6 +108,30 @@ static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flag
106#define PT_REGS_FP(x) ((x)->regs[29]) /* Works only with CONFIG_FRAME_POINTER */ 108#define PT_REGS_FP(x) ((x)->regs[29]) /* Works only with CONFIG_FRAME_POINTER */
107#define PT_REGS_RC(x) ((x)->regs[0]) 109#define PT_REGS_RC(x) ((x)->regs[0])
108#define PT_REGS_SP(x) ((x)->sp) 110#define PT_REGS_SP(x) ((x)->sp)
111#define PT_REGS_IP(x) ((x)->pc)
112
113#elif defined(__powerpc__)
114
115#define PT_REGS_PARM1(x) ((x)->gpr[3])
116#define PT_REGS_PARM2(x) ((x)->gpr[4])
117#define PT_REGS_PARM3(x) ((x)->gpr[5])
118#define PT_REGS_PARM4(x) ((x)->gpr[6])
119#define PT_REGS_PARM5(x) ((x)->gpr[7])
120#define PT_REGS_RC(x) ((x)->gpr[3])
121#define PT_REGS_SP(x) ((x)->sp)
122#define PT_REGS_IP(x) ((x)->nip)
109 123
110#endif 124#endif
125
126#ifdef __powerpc__
127#define BPF_KPROBE_READ_RET_IP(ip, ctx) ({ (ip) = (ctx)->link; })
128#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP
129#else
130#define BPF_KPROBE_READ_RET_IP(ip, ctx) ({ \
131 bpf_probe_read(&(ip), sizeof(ip), (void *)PT_REGS_RET(ctx)); })
132#define BPF_KRETPROBE_READ_RET_IP(ip, ctx) ({ \
133 bpf_probe_read(&(ip), sizeof(ip), \
134 (void *)(PT_REGS_FP(ctx) + sizeof(ip))); })
135#endif
136
111#endif 137#endif
diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c
index 95af56ec5739..3147377e8fd3 100644
--- a/samples/bpf/map_perf_test_user.c
+++ b/samples/bpf/map_perf_test_user.c
@@ -17,6 +17,7 @@
17#include <linux/bpf.h> 17#include <linux/bpf.h>
18#include <string.h> 18#include <string.h>
19#include <time.h> 19#include <time.h>
20#include <sys/resource.h>
20#include "libbpf.h" 21#include "libbpf.h"
21#include "bpf_load.h" 22#include "bpf_load.h"
22 23
diff --git a/samples/bpf/spintest_kern.c b/samples/bpf/spintest_kern.c
index 4b27619d91a4..ce0167d09cdc 100644
--- a/samples/bpf/spintest_kern.c
+++ b/samples/bpf/spintest_kern.c
@@ -34,7 +34,7 @@ struct bpf_map_def SEC("maps") stackmap = {
34#define PROG(foo) \ 34#define PROG(foo) \
35int foo(struct pt_regs *ctx) \ 35int foo(struct pt_regs *ctx) \
36{ \ 36{ \
37 long v = ctx->ip, *val; \ 37 long v = PT_REGS_IP(ctx), *val; \
38\ 38\
39 val = bpf_map_lookup_elem(&my_map, &v); \ 39 val = bpf_map_lookup_elem(&my_map, &v); \
40 bpf_map_update_elem(&my_map, &v, &v, BPF_ANY); \ 40 bpf_map_update_elem(&my_map, &v, &v, BPF_ANY); \
diff --git a/samples/bpf/tracex2_kern.c b/samples/bpf/tracex2_kern.c
index 09c1adc27d42..6d6eefd0d465 100644
--- a/samples/bpf/tracex2_kern.c
+++ b/samples/bpf/tracex2_kern.c
@@ -27,10 +27,10 @@ int bpf_prog2(struct pt_regs *ctx)
27 long init_val = 1; 27 long init_val = 1;
28 long *value; 28 long *value;
29 29
30 /* x64/s390x specific: read ip of kfree_skb caller. 30 /* read ip of kfree_skb caller.
31 * non-portable version of __builtin_return_address(0) 31 * non-portable version of __builtin_return_address(0)
32 */ 32 */
33 bpf_probe_read(&loc, sizeof(loc), (void *)PT_REGS_RET(ctx)); 33 BPF_KPROBE_READ_RET_IP(loc, ctx);
34 34
35 value = bpf_map_lookup_elem(&my_map, &loc); 35 value = bpf_map_lookup_elem(&my_map, &loc);
36 if (value) 36 if (value)
diff --git a/samples/bpf/tracex4_kern.c b/samples/bpf/tracex4_kern.c
index ac4671420cf1..6dd8e384de96 100644
--- a/samples/bpf/tracex4_kern.c
+++ b/samples/bpf/tracex4_kern.c
@@ -40,7 +40,7 @@ int bpf_prog2(struct pt_regs *ctx)
40 long ip = 0; 40 long ip = 0;
41 41
42 /* get ip address of kmem_cache_alloc_node() caller */ 42 /* get ip address of kmem_cache_alloc_node() caller */
43 bpf_probe_read(&ip, sizeof(ip), (void *)(PT_REGS_FP(ctx) + sizeof(ip))); 43 BPF_KRETPROBE_READ_RET_IP(ip, ctx);
44 44
45 struct pair v = { 45 struct pair v = {
46 .val = bpf_ktime_get_ns(), 46 .val = bpf_ktime_get_ns(),