aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-08-15 21:52:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-15 21:52:28 -0400
commit510c8a899caf095cb13d09d203573deef15db2fe (patch)
tree5ddaa46e8ecef7029c6dd0a4a7801597df707b78
parent40c6d1b9e2fc4251ca19fa69398f6fa34e813e27 (diff)
parent88a5c690b66110ad255380d8f629c629cf6ca559 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix TCP checksum offload handling in iwlwifi driver, from Emmanuel Grumbach. 2) In ksz DSA tagging code, free SKB if skb_put_padto() fails. From Vivien Didelot. 3) Fix two regressions with bonding on wireless, from Andreas Born. 4) Fix build when busypoll is disabled, from Daniel Borkmann. 5) Fix copy_linear_skb() wrt. SO_PEEK_OFF, from Eric Dumazet. 6) Set SKB cached route properly in inet_rtm_getroute(), from Florian Westphal. 7) Fix PCI-E relaxed ordering handling in cxgb4 driver, from Ding Tianhong. 8) Fix module refcnt leak in ULP code, from Sabrina Dubroca. 9) Fix use of GFP_KERNEL in atomic contexts in AF_KEY code, from Eric Dumazet. 10) Need to purge socket write queue in dccp_destroy_sock(), also from Eric Dumazet. 11) Make bpf_trace_printk() work properly on 32-bit architectures, from Daniel Borkmann. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (47 commits) bpf: fix bpf_trace_printk on 32 bit archs PCI: fix oops when try to find Root Port for a PCI device sfc: don't try and read ef10 data on non-ef10 NIC net_sched: remove warning from qdisc_hash_add net_sched/sfq: update hierarchical backlog when drop packet net_sched: reset pointers to tcf blocks in classful qdiscs' destructors ipv4: fix NULL dereference in free_fib_info_rcu() net: Fix a typo in comment about sock flags. ipv6: fix NULL dereference in ip6_route_dev_notify() tcp: fix possible deadlock in TCP stack vs BPF filter dccp: purge write queue in dccp_destroy_sock() udp: fix linear skb reception with PEEK_OFF ipv6: release rt6->rt6i_idev properly during ifdown af_key: do not use GFP_KERNEL in atomic contexts tcp: ulp: avoid module refcnt leak in tcp_set_ulp net/cxgb4vf: Use new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag net/cxgb4: Use new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag PCI: Disable Relaxed Ordering Attributes for AMD A1100 PCI: Disable Relaxed Ordering for some Intel processors PCI: Disable PCIe Relaxed Ordering if unsupported ...
-rw-r--r--drivers/isdn/mISDN/fsm.c5
-rw-r--r--drivers/isdn/mISDN/fsm.h2
-rw-r--r--drivers/isdn/mISDN/layer1.c3
-rw-r--r--drivers/isdn/mISDN/layer2.c15
-rw-r--r--drivers/isdn/mISDN/tei.c20
-rw-r--r--drivers/net/bonding/bond_main.c13
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4.h1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c23
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/sge.c5
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/adapter.h1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c18
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/sge.c3
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/cmsg.c8
-rw-r--r--drivers/net/ethernet/sfc/mcdi_port.c8
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c9
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/9000.c14
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/file.h2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-config.h8
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-drv.c5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c19
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c12
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rs.c8
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c10
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tx.c12
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c20
-rw-r--r--drivers/pci/pci.c7
-rw-r--r--drivers/pci/probe.c43
-rw-r--r--drivers/pci/quirks.c89
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/pci.h3
-rw-r--r--include/net/addrconf.h10
-rw-r--r--include/net/bonding.h5
-rw-r--r--include/net/busy_poll.h12
-rw-r--r--include/net/mac80211.h15
-rw-r--r--include/net/udp.h7
-rw-r--r--kernel/trace/bpf_trace.c34
-rw-r--r--net/core/filter.c2
-rw-r--r--net/dccp/proto.c5
-rw-r--r--net/dsa/tag_ksz.c13
-rw-r--r--net/ipv4/fib_semantics.c12
-rw-r--r--net/ipv4/route.c3
-rw-r--r--net/ipv4/tcp_ipv4.c4
-rw-r--r--net/ipv4/tcp_ulp.c14
-rw-r--r--net/ipv6/route.c19
-rw-r--r--net/ipv6/tcp_ipv6.c4
-rw-r--r--net/key/af_key.c48
-rw-r--r--net/mac80211/agg-rx.c22
-rw-r--r--net/sched/sch_api.c3
-rw-r--r--net/sched/sch_atm.c4
-rw-r--r--net/sched/sch_cbq.c4
-rw-r--r--net/sched/sch_hfsc.c12
-rw-r--r--net/sched/sch_htb.c4
-rw-r--r--net/sched/sch_sfq.c5
-rw-r--r--net/tipc/bearer.c2
-rw-r--r--net/tipc/msg.c1
58 files changed, 512 insertions, 159 deletions
diff --git a/drivers/isdn/mISDN/fsm.c b/drivers/isdn/mISDN/fsm.c
index 78fc5d5e9051..92e6570b1143 100644
--- a/drivers/isdn/mISDN/fsm.c
+++ b/drivers/isdn/mISDN/fsm.c
@@ -26,7 +26,7 @@
26 26
27#define FSM_TIMER_DEBUG 0 27#define FSM_TIMER_DEBUG 0
28 28
29void 29int
30mISDN_FsmNew(struct Fsm *fsm, 30mISDN_FsmNew(struct Fsm *fsm,
31 struct FsmNode *fnlist, int fncount) 31 struct FsmNode *fnlist, int fncount)
32{ 32{
@@ -34,6 +34,8 @@ mISDN_FsmNew(struct Fsm *fsm,
34 34
35 fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count * 35 fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count *
36 fsm->event_count, GFP_KERNEL); 36 fsm->event_count, GFP_KERNEL);
37 if (fsm->jumpmatrix == NULL)
38 return -ENOMEM;
37 39
38 for (i = 0; i < fncount; i++) 40 for (i = 0; i < fncount; i++)
39 if ((fnlist[i].state >= fsm->state_count) || 41 if ((fnlist[i].state >= fsm->state_count) ||
@@ -45,6 +47,7 @@ mISDN_FsmNew(struct Fsm *fsm,
45 } else 47 } else
46 fsm->jumpmatrix[fsm->state_count * fnlist[i].event + 48 fsm->jumpmatrix[fsm->state_count * fnlist[i].event +
47 fnlist[i].state] = (FSMFNPTR) fnlist[i].routine; 49 fnlist[i].state] = (FSMFNPTR) fnlist[i].routine;
50 return 0;
48} 51}
49EXPORT_SYMBOL(mISDN_FsmNew); 52EXPORT_SYMBOL(mISDN_FsmNew);
50 53
diff --git a/drivers/isdn/mISDN/fsm.h b/drivers/isdn/mISDN/fsm.h
index 928f5be192c1..e1def8490221 100644
--- a/drivers/isdn/mISDN/fsm.h
+++ b/drivers/isdn/mISDN/fsm.h
@@ -55,7 +55,7 @@ struct FsmTimer {
55 void *arg; 55 void *arg;
56}; 56};
57 57
58extern void mISDN_FsmNew(struct Fsm *, struct FsmNode *, int); 58extern int mISDN_FsmNew(struct Fsm *, struct FsmNode *, int);
59extern void mISDN_FsmFree(struct Fsm *); 59extern void mISDN_FsmFree(struct Fsm *);
60extern int mISDN_FsmEvent(struct FsmInst *, int , void *); 60extern int mISDN_FsmEvent(struct FsmInst *, int , void *);
61extern void mISDN_FsmChangeState(struct FsmInst *, int); 61extern void mISDN_FsmChangeState(struct FsmInst *, int);
diff --git a/drivers/isdn/mISDN/layer1.c b/drivers/isdn/mISDN/layer1.c
index bebc57b72138..3192b0eb3944 100644
--- a/drivers/isdn/mISDN/layer1.c
+++ b/drivers/isdn/mISDN/layer1.c
@@ -414,8 +414,7 @@ l1_init(u_int *deb)
414 l1fsm_s.event_count = L1_EVENT_COUNT; 414 l1fsm_s.event_count = L1_EVENT_COUNT;
415 l1fsm_s.strEvent = strL1Event; 415 l1fsm_s.strEvent = strL1Event;
416 l1fsm_s.strState = strL1SState; 416 l1fsm_s.strState = strL1SState;
417 mISDN_FsmNew(&l1fsm_s, L1SFnList, ARRAY_SIZE(L1SFnList)); 417 return mISDN_FsmNew(&l1fsm_s, L1SFnList, ARRAY_SIZE(L1SFnList));
418 return 0;
419} 418}
420 419
421void 420void
diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c
index 7243a6746f8b..9ff0903a0e89 100644
--- a/drivers/isdn/mISDN/layer2.c
+++ b/drivers/isdn/mISDN/layer2.c
@@ -2247,15 +2247,26 @@ static struct Bprotocol X75SLP = {
2247int 2247int
2248Isdnl2_Init(u_int *deb) 2248Isdnl2_Init(u_int *deb)
2249{ 2249{
2250 int res;
2250 debug = deb; 2251 debug = deb;
2251 mISDN_register_Bprotocol(&X75SLP); 2252 mISDN_register_Bprotocol(&X75SLP);
2252 l2fsm.state_count = L2_STATE_COUNT; 2253 l2fsm.state_count = L2_STATE_COUNT;
2253 l2fsm.event_count = L2_EVENT_COUNT; 2254 l2fsm.event_count = L2_EVENT_COUNT;
2254 l2fsm.strEvent = strL2Event; 2255 l2fsm.strEvent = strL2Event;
2255 l2fsm.strState = strL2State; 2256 l2fsm.strState = strL2State;
2256 mISDN_FsmNew(&l2fsm, L2FnList, ARRAY_SIZE(L2FnList)); 2257 res = mISDN_FsmNew(&l2fsm, L2FnList, ARRAY_SIZE(L2FnList));
2257 TEIInit(deb); 2258 if (res)
2259 goto error;
2260 res = TEIInit(deb);
2261 if (res)
2262 goto error_fsm;
2258 return 0; 2263 return 0;
2264
2265error_fsm:
2266 mISDN_FsmFree(&l2fsm);
2267error:
2268 mISDN_unregister_Bprotocol(&X75SLP);
2269 return res;
2259} 2270}
2260 2271
2261void 2272void
diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c
index 908127efccf8..12d9e5f4beb1 100644
--- a/drivers/isdn/mISDN/tei.c
+++ b/drivers/isdn/mISDN/tei.c
@@ -1387,23 +1387,37 @@ create_teimanager(struct mISDNdevice *dev)
1387 1387
1388int TEIInit(u_int *deb) 1388int TEIInit(u_int *deb)
1389{ 1389{
1390 int res;
1390 debug = deb; 1391 debug = deb;
1391 teifsmu.state_count = TEI_STATE_COUNT; 1392 teifsmu.state_count = TEI_STATE_COUNT;
1392 teifsmu.event_count = TEI_EVENT_COUNT; 1393 teifsmu.event_count = TEI_EVENT_COUNT;
1393 teifsmu.strEvent = strTeiEvent; 1394 teifsmu.strEvent = strTeiEvent;
1394 teifsmu.strState = strTeiState; 1395 teifsmu.strState = strTeiState;
1395 mISDN_FsmNew(&teifsmu, TeiFnListUser, ARRAY_SIZE(TeiFnListUser)); 1396 res = mISDN_FsmNew(&teifsmu, TeiFnListUser, ARRAY_SIZE(TeiFnListUser));
1397 if (res)
1398 goto error;
1396 teifsmn.state_count = TEI_STATE_COUNT; 1399 teifsmn.state_count = TEI_STATE_COUNT;
1397 teifsmn.event_count = TEI_EVENT_COUNT; 1400 teifsmn.event_count = TEI_EVENT_COUNT;
1398 teifsmn.strEvent = strTeiEvent; 1401 teifsmn.strEvent = strTeiEvent;
1399 teifsmn.strState = strTeiState; 1402 teifsmn.strState = strTeiState;
1400 mISDN_FsmNew(&teifsmn, TeiFnListNet, ARRAY_SIZE(TeiFnListNet)); 1403 res = mISDN_FsmNew(&teifsmn, TeiFnListNet, ARRAY_SIZE(TeiFnListNet));
1404 if (res)
1405 goto error_smn;
1401 deactfsm.state_count = DEACT_STATE_COUNT; 1406 deactfsm.state_count = DEACT_STATE_COUNT;
1402 deactfsm.event_count = DEACT_EVENT_COUNT; 1407 deactfsm.event_count = DEACT_EVENT_COUNT;
1403 deactfsm.strEvent = strDeactEvent; 1408 deactfsm.strEvent = strDeactEvent;
1404 deactfsm.strState = strDeactState; 1409 deactfsm.strState = strDeactState;
1405 mISDN_FsmNew(&deactfsm, DeactFnList, ARRAY_SIZE(DeactFnList)); 1410 res = mISDN_FsmNew(&deactfsm, DeactFnList, ARRAY_SIZE(DeactFnList));
1411 if (res)
1412 goto error_deact;
1406 return 0; 1413 return 0;
1414
1415error_deact:
1416 mISDN_FsmFree(&teifsmn);
1417error_smn:
1418 mISDN_FsmFree(&teifsmu);
1419error:
1420 return res;
1407} 1421}
1408 1422
1409void TEIFree(void) 1423void TEIFree(void)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9bee6c1c70cc..fc63992ab0e0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1569,7 +1569,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1569 new_slave->delay = 0; 1569 new_slave->delay = 0;
1570 new_slave->link_failure_count = 0; 1570 new_slave->link_failure_count = 0;
1571 1571
1572 if (bond_update_speed_duplex(new_slave)) 1572 if (bond_update_speed_duplex(new_slave) &&
1573 bond_needs_speed_duplex(bond))
1573 new_slave->link = BOND_LINK_DOWN; 1574 new_slave->link = BOND_LINK_DOWN;
1574 1575
1575 new_slave->last_rx = jiffies - 1576 new_slave->last_rx = jiffies -
@@ -2140,11 +2141,13 @@ static void bond_miimon_commit(struct bonding *bond)
2140 continue; 2141 continue;
2141 2142
2142 case BOND_LINK_UP: 2143 case BOND_LINK_UP:
2143 if (bond_update_speed_duplex(slave)) { 2144 if (bond_update_speed_duplex(slave) &&
2145 bond_needs_speed_duplex(bond)) {
2144 slave->link = BOND_LINK_DOWN; 2146 slave->link = BOND_LINK_DOWN;
2145 netdev_warn(bond->dev, 2147 if (net_ratelimit())
2146 "failed to get link speed/duplex for %s\n", 2148 netdev_warn(bond->dev,
2147 slave->dev->name); 2149 "failed to get link speed/duplex for %s\n",
2150 slave->dev->name);
2148 continue; 2151 continue;
2149 } 2152 }
2150 bond_set_slave_link_state(slave, BOND_LINK_UP, 2153 bond_set_slave_link_state(slave, BOND_LINK_UP,
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index ef4be781fd05..09ea62ee96d3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -529,6 +529,7 @@ enum { /* adapter flags */
529 USING_SOFT_PARAMS = (1 << 6), 529 USING_SOFT_PARAMS = (1 << 6),
530 MASTER_PF = (1 << 7), 530 MASTER_PF = (1 << 7),
531 FW_OFLD_CONN = (1 << 9), 531 FW_OFLD_CONN = (1 << 9),
532 ROOT_NO_RELAXED_ORDERING = (1 << 10),
532}; 533};
533 534
534enum { 535enum {
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index e403fa18f1b1..33bb8678833a 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4654,11 +4654,6 @@ static void print_port_info(const struct net_device *dev)
4654 dev->name, adap->params.vpd.id, adap->name, buf); 4654 dev->name, adap->params.vpd.id, adap->name, buf);
4655} 4655}
4656 4656
4657static void enable_pcie_relaxed_ordering(struct pci_dev *dev)
4658{
4659 pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN);
4660}
4661
4662/* 4657/*
4663 * Free the following resources: 4658 * Free the following resources:
4664 * - memory used for tables 4659 * - memory used for tables
@@ -4908,7 +4903,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
4908 } 4903 }
4909 4904
4910 pci_enable_pcie_error_reporting(pdev); 4905 pci_enable_pcie_error_reporting(pdev);
4911 enable_pcie_relaxed_ordering(pdev);
4912 pci_set_master(pdev); 4906 pci_set_master(pdev);
4913 pci_save_state(pdev); 4907 pci_save_state(pdev);
4914 4908
@@ -4947,6 +4941,23 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
4947 adapter->msg_enable = DFLT_MSG_ENABLE; 4941 adapter->msg_enable = DFLT_MSG_ENABLE;
4948 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); 4942 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
4949 4943
4944 /* If possible, we use PCIe Relaxed Ordering Attribute to deliver
4945 * Ingress Packet Data to Free List Buffers in order to allow for
4946 * chipset performance optimizations between the Root Complex and
4947 * Memory Controllers. (Messages to the associated Ingress Queue
4948 * notifying new Packet Placement in the Free Lists Buffers will be
4949 * send without the Relaxed Ordering Attribute thus guaranteeing that
4950 * all preceding PCIe Transaction Layer Packets will be processed
4951 * first.) But some Root Complexes have various issues with Upstream
4952 * Transaction Layer Packets with the Relaxed Ordering Attribute set.
4953 * The PCIe devices which under the Root Complexes will be cleared the
4954 * Relaxed Ordering bit in the configuration space, So we check our
4955 * PCIe configuration space to see if it's flagged with advice against
4956 * using Relaxed Ordering.
4957 */
4958 if (!pcie_relaxed_ordering_enabled(pdev))
4959 adapter->flags |= ROOT_NO_RELAXED_ORDERING;
4960
4950 spin_lock_init(&adapter->stats_lock); 4961 spin_lock_init(&adapter->stats_lock);
4951 spin_lock_init(&adapter->tid_release_lock); 4962 spin_lock_init(&adapter->tid_release_lock);
4952 spin_lock_init(&adapter->win0_lock); 4963 spin_lock_init(&adapter->win0_lock);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index ede12209f20b..4ef68f69b58c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2719,6 +2719,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
2719 struct fw_iq_cmd c; 2719 struct fw_iq_cmd c;
2720 struct sge *s = &adap->sge; 2720 struct sge *s = &adap->sge;
2721 struct port_info *pi = netdev_priv(dev); 2721 struct port_info *pi = netdev_priv(dev);
2722 int relaxed = !(adap->flags & ROOT_NO_RELAXED_ORDERING);
2722 2723
2723 /* Size needs to be multiple of 16, including status entry. */ 2724 /* Size needs to be multiple of 16, including status entry. */
2724 iq->size = roundup(iq->size, 16); 2725 iq->size = roundup(iq->size, 16);
@@ -2772,8 +2773,8 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
2772 2773
2773 flsz = fl->size / 8 + s->stat_len / sizeof(struct tx_desc); 2774 flsz = fl->size / 8 + s->stat_len / sizeof(struct tx_desc);
2774 c.iqns_to_fl0congen |= htonl(FW_IQ_CMD_FL0PACKEN_F | 2775 c.iqns_to_fl0congen |= htonl(FW_IQ_CMD_FL0PACKEN_F |
2775 FW_IQ_CMD_FL0FETCHRO_F | 2776 FW_IQ_CMD_FL0FETCHRO_V(relaxed) |
2776 FW_IQ_CMD_FL0DATARO_F | 2777 FW_IQ_CMD_FL0DATARO_V(relaxed) |
2777 FW_IQ_CMD_FL0PADEN_F); 2778 FW_IQ_CMD_FL0PADEN_F);
2778 if (cong >= 0) 2779 if (cong >= 0)
2779 c.iqns_to_fl0congen |= 2780 c.iqns_to_fl0congen |=
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
index 109bc630408b..08c6ddb84a04 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
@@ -408,6 +408,7 @@ enum { /* adapter flags */
408 USING_MSI = (1UL << 1), 408 USING_MSI = (1UL << 1),
409 USING_MSIX = (1UL << 2), 409 USING_MSIX = (1UL << 2),
410 QUEUES_BOUND = (1UL << 3), 410 QUEUES_BOUND = (1UL << 3),
411 ROOT_NO_RELAXED_ORDERING = (1UL << 4),
411}; 412};
412 413
413/* 414/*
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index ac7a150c54e9..2b85b874fd0d 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -2888,6 +2888,24 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
2888 */ 2888 */
2889 adapter->name = pci_name(pdev); 2889 adapter->name = pci_name(pdev);
2890 adapter->msg_enable = DFLT_MSG_ENABLE; 2890 adapter->msg_enable = DFLT_MSG_ENABLE;
2891
2892 /* If possible, we use PCIe Relaxed Ordering Attribute to deliver
2893 * Ingress Packet Data to Free List Buffers in order to allow for
2894 * chipset performance optimizations between the Root Complex and
2895 * Memory Controllers. (Messages to the associated Ingress Queue
2896 * notifying new Packet Placement in the Free Lists Buffers will be
2897 * send without the Relaxed Ordering Attribute thus guaranteeing that
2898 * all preceding PCIe Transaction Layer Packets will be processed
2899 * first.) But some Root Complexes have various issues with Upstream
2900 * Transaction Layer Packets with the Relaxed Ordering Attribute set.
2901 * The PCIe devices which under the Root Complexes will be cleared the
2902 * Relaxed Ordering bit in the configuration space, So we check our
2903 * PCIe configuration space to see if it's flagged with advice against
2904 * using Relaxed Ordering.
2905 */
2906 if (!pcie_relaxed_ordering_enabled(pdev))
2907 adapter->flags |= ROOT_NO_RELAXED_ORDERING;
2908
2891 err = adap_init0(adapter); 2909 err = adap_init0(adapter);
2892 if (err) 2910 if (err)
2893 goto err_unmap_bar; 2911 goto err_unmap_bar;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index e37dde2ba97f..05498e7f2840 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -2205,6 +2205,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq,
2205 struct port_info *pi = netdev_priv(dev); 2205 struct port_info *pi = netdev_priv(dev);
2206 struct fw_iq_cmd cmd, rpl; 2206 struct fw_iq_cmd cmd, rpl;
2207 int ret, iqandst, flsz = 0; 2207 int ret, iqandst, flsz = 0;
2208 int relaxed = !(adapter->flags & ROOT_NO_RELAXED_ORDERING);
2208 2209
2209 /* 2210 /*
2210 * If we're using MSI interrupts and we're not initializing the 2211 * If we're using MSI interrupts and we're not initializing the
@@ -2300,6 +2301,8 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq,
2300 cpu_to_be32( 2301 cpu_to_be32(
2301 FW_IQ_CMD_FL0HOSTFCMODE_V(SGE_HOSTFCMODE_NONE) | 2302 FW_IQ_CMD_FL0HOSTFCMODE_V(SGE_HOSTFCMODE_NONE) |
2302 FW_IQ_CMD_FL0PACKEN_F | 2303 FW_IQ_CMD_FL0PACKEN_F |
2304 FW_IQ_CMD_FL0FETCHRO_V(relaxed) |
2305 FW_IQ_CMD_FL0DATARO_V(relaxed) |
2303 FW_IQ_CMD_FL0PADEN_F); 2306 FW_IQ_CMD_FL0PADEN_F);
2304 2307
2305 /* In T6, for egress queue type FL there is internal overhead 2308 /* In T6, for egress queue type FL there is internal overhead
diff --git a/drivers/net/ethernet/netronome/nfp/flower/cmsg.c b/drivers/net/ethernet/netronome/nfp/flower/cmsg.c
index dd7fa9cf225f..b0837b58c3a1 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/cmsg.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/cmsg.c
@@ -115,14 +115,10 @@ nfp_flower_cmsg_portmod_rx(struct nfp_app *app, struct sk_buff *skb)
115 return; 115 return;
116 } 116 }
117 117
118 if (link) { 118 if (link)
119 netif_carrier_on(netdev); 119 netif_carrier_on(netdev);
120 rtnl_lock(); 120 else
121 dev_set_mtu(netdev, be16_to_cpu(msg->mtu));
122 rtnl_unlock();
123 } else {
124 netif_carrier_off(netdev); 121 netif_carrier_off(netdev);
125 }
126 rcu_read_unlock(); 122 rcu_read_unlock();
127} 123}
128 124
diff --git a/drivers/net/ethernet/sfc/mcdi_port.c b/drivers/net/ethernet/sfc/mcdi_port.c
index c905971c5f3a..990a63d7fcb7 100644
--- a/drivers/net/ethernet/sfc/mcdi_port.c
+++ b/drivers/net/ethernet/sfc/mcdi_port.c
@@ -938,7 +938,6 @@ enum efx_stats_action {
938static int efx_mcdi_mac_stats(struct efx_nic *efx, 938static int efx_mcdi_mac_stats(struct efx_nic *efx,
939 enum efx_stats_action action, int clear) 939 enum efx_stats_action action, int clear)
940{ 940{
941 struct efx_ef10_nic_data *nic_data = efx->nic_data;
942 MCDI_DECLARE_BUF(inbuf, MC_CMD_MAC_STATS_IN_LEN); 941 MCDI_DECLARE_BUF(inbuf, MC_CMD_MAC_STATS_IN_LEN);
943 int rc; 942 int rc;
944 int change = action == EFX_STATS_PULL ? 0 : 1; 943 int change = action == EFX_STATS_PULL ? 0 : 1;
@@ -960,7 +959,12 @@ static int efx_mcdi_mac_stats(struct efx_nic *efx,
960 MAC_STATS_IN_PERIODIC_NOEVENT, 1, 959 MAC_STATS_IN_PERIODIC_NOEVENT, 1,
961 MAC_STATS_IN_PERIOD_MS, period); 960 MAC_STATS_IN_PERIOD_MS, period);
962 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len); 961 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len);
963 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, nic_data->vport_id); 962
963 if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0) {
964 struct efx_ef10_nic_data *nic_data = efx->nic_data;
965
966 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, nic_data->vport_id);
967 }
964 968
965 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), 969 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf),
966 NULL, 0, NULL); 970 NULL, 0, NULL);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index db157a47000c..72ec711fcba2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -204,6 +204,7 @@ int stmmac_mdio_register(struct net_device *ndev)
204 struct stmmac_priv *priv = netdev_priv(ndev); 204 struct stmmac_priv *priv = netdev_priv(ndev);
205 struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; 205 struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
206 struct device_node *mdio_node = priv->plat->mdio_node; 206 struct device_node *mdio_node = priv->plat->mdio_node;
207 struct device *dev = ndev->dev.parent;
207 int addr, found; 208 int addr, found;
208 209
209 if (!mdio_bus_data) 210 if (!mdio_bus_data)
@@ -237,7 +238,7 @@ int stmmac_mdio_register(struct net_device *ndev)
237 else 238 else
238 err = mdiobus_register(new_bus); 239 err = mdiobus_register(new_bus);
239 if (err != 0) { 240 if (err != 0) {
240 netdev_err(ndev, "Cannot register the MDIO bus\n"); 241 dev_err(dev, "Cannot register the MDIO bus\n");
241 goto bus_register_fail; 242 goto bus_register_fail;
242 } 243 }
243 244
@@ -285,14 +286,12 @@ int stmmac_mdio_register(struct net_device *ndev)
285 irq_str = irq_num; 286 irq_str = irq_num;
286 break; 287 break;
287 } 288 }
288 netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n", 289 phy_attached_info(phydev);
289 phydev->phy_id, addr, irq_str, phydev_name(phydev),
290 act ? " active" : "");
291 found = 1; 290 found = 1;
292 } 291 }
293 292
294 if (!found && !mdio_node) { 293 if (!found && !mdio_node) {
295 netdev_warn(ndev, "No PHY found\n"); 294 dev_warn(dev, "No PHY found\n");
296 mdiobus_unregister(new_bus); 295 mdiobus_unregister(new_bus);
297 mdiobus_free(new_bus); 296 mdiobus_free(new_bus);
298 return -ENODEV; 297 return -ENODEV;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
index d21258d277ce..f1b60740e020 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
@@ -159,8 +159,10 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
159 159
160 brcmf_feat_firmware_capabilities(ifp); 160 brcmf_feat_firmware_capabilities(ifp);
161 memset(&gscan_cfg, 0, sizeof(gscan_cfg)); 161 memset(&gscan_cfg, 0, sizeof(gscan_cfg));
162 brcmf_feat_iovar_data_set(ifp, BRCMF_FEAT_GSCAN, "pfn_gscan_cfg", 162 if (drvr->bus_if->chip != BRCM_CC_43430_CHIP_ID)
163 &gscan_cfg, sizeof(gscan_cfg)); 163 brcmf_feat_iovar_data_set(ifp, BRCMF_FEAT_GSCAN,
164 "pfn_gscan_cfg",
165 &gscan_cfg, sizeof(gscan_cfg));
164 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn"); 166 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
165 if (drvr->bus_if->wowl_supported) 167 if (drvr->bus_if->wowl_supported)
166 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl"); 168 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
index b4ecd1fe1374..97208ce19f92 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
@@ -154,7 +154,7 @@ static const struct iwl_tt_params iwl9000_tt_params = {
154const struct iwl_cfg iwl9160_2ac_cfg = { 154const struct iwl_cfg iwl9160_2ac_cfg = {
155 .name = "Intel(R) Dual Band Wireless AC 9160", 155 .name = "Intel(R) Dual Band Wireless AC 9160",
156 .fw_name_pre = IWL9260A_FW_PRE, 156 .fw_name_pre = IWL9260A_FW_PRE,
157 .fw_name_pre_next_step = IWL9260B_FW_PRE, 157 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
158 IWL_DEVICE_9000, 158 IWL_DEVICE_9000,
159 .ht_params = &iwl9000_ht_params, 159 .ht_params = &iwl9000_ht_params,
160 .nvm_ver = IWL9000_NVM_VERSION, 160 .nvm_ver = IWL9000_NVM_VERSION,
@@ -165,7 +165,7 @@ const struct iwl_cfg iwl9160_2ac_cfg = {
165const struct iwl_cfg iwl9260_2ac_cfg = { 165const struct iwl_cfg iwl9260_2ac_cfg = {
166 .name = "Intel(R) Dual Band Wireless AC 9260", 166 .name = "Intel(R) Dual Band Wireless AC 9260",
167 .fw_name_pre = IWL9260A_FW_PRE, 167 .fw_name_pre = IWL9260A_FW_PRE,
168 .fw_name_pre_next_step = IWL9260B_FW_PRE, 168 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
169 IWL_DEVICE_9000, 169 IWL_DEVICE_9000,
170 .ht_params = &iwl9000_ht_params, 170 .ht_params = &iwl9000_ht_params,
171 .nvm_ver = IWL9000_NVM_VERSION, 171 .nvm_ver = IWL9000_NVM_VERSION,
@@ -176,7 +176,7 @@ const struct iwl_cfg iwl9260_2ac_cfg = {
176const struct iwl_cfg iwl9270_2ac_cfg = { 176const struct iwl_cfg iwl9270_2ac_cfg = {
177 .name = "Intel(R) Dual Band Wireless AC 9270", 177 .name = "Intel(R) Dual Band Wireless AC 9270",
178 .fw_name_pre = IWL9260A_FW_PRE, 178 .fw_name_pre = IWL9260A_FW_PRE,
179 .fw_name_pre_next_step = IWL9260B_FW_PRE, 179 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
180 IWL_DEVICE_9000, 180 IWL_DEVICE_9000,
181 .ht_params = &iwl9000_ht_params, 181 .ht_params = &iwl9000_ht_params,
182 .nvm_ver = IWL9000_NVM_VERSION, 182 .nvm_ver = IWL9000_NVM_VERSION,
@@ -186,8 +186,8 @@ const struct iwl_cfg iwl9270_2ac_cfg = {
186 186
187const struct iwl_cfg iwl9460_2ac_cfg = { 187const struct iwl_cfg iwl9460_2ac_cfg = {
188 .name = "Intel(R) Dual Band Wireless AC 9460", 188 .name = "Intel(R) Dual Band Wireless AC 9460",
189 .fw_name_pre = IWL9000_FW_PRE, 189 .fw_name_pre = IWL9260A_FW_PRE,
190 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 190 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
191 IWL_DEVICE_9000, 191 IWL_DEVICE_9000,
192 .ht_params = &iwl9000_ht_params, 192 .ht_params = &iwl9000_ht_params,
193 .nvm_ver = IWL9000_NVM_VERSION, 193 .nvm_ver = IWL9000_NVM_VERSION,
@@ -198,8 +198,8 @@ const struct iwl_cfg iwl9460_2ac_cfg = {
198 198
199const struct iwl_cfg iwl9560_2ac_cfg = { 199const struct iwl_cfg iwl9560_2ac_cfg = {
200 .name = "Intel(R) Dual Band Wireless AC 9560", 200 .name = "Intel(R) Dual Band Wireless AC 9560",
201 .fw_name_pre = IWL9000_FW_PRE, 201 .fw_name_pre = IWL9260A_FW_PRE,
202 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 202 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
203 IWL_DEVICE_9000, 203 IWL_DEVICE_9000,
204 .ht_params = &iwl9000_ht_params, 204 .ht_params = &iwl9000_ht_params,
205 .nvm_ver = IWL9000_NVM_VERSION, 205 .nvm_ver = IWL9000_NVM_VERSION,
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
index 0fa8c473f1e2..c73a6438ce8f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
@@ -328,6 +328,7 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
328 * @IWL_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger 328 * @IWL_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger
329 * command size (command version 4) that supports toggling ACK TX 329 * command size (command version 4) that supports toggling ACK TX
330 * power reduction. 330 * power reduction.
331 * @IWL_UCODE_TLV_CAPA_MLME_OFFLOAD: supports MLME offload
331 * 332 *
332 * @NUM_IWL_UCODE_TLV_CAPA: number of bits used 333 * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
333 */ 334 */
@@ -373,6 +374,7 @@ enum iwl_ucode_tlv_capa {
373 IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG = (__force iwl_ucode_tlv_capa_t)80, 374 IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG = (__force iwl_ucode_tlv_capa_t)80,
374 IWL_UCODE_TLV_CAPA_LQM_SUPPORT = (__force iwl_ucode_tlv_capa_t)81, 375 IWL_UCODE_TLV_CAPA_LQM_SUPPORT = (__force iwl_ucode_tlv_capa_t)81,
375 IWL_UCODE_TLV_CAPA_TX_POWER_ACK = (__force iwl_ucode_tlv_capa_t)84, 376 IWL_UCODE_TLV_CAPA_TX_POWER_ACK = (__force iwl_ucode_tlv_capa_t)84,
377 IWL_UCODE_TLV_CAPA_MLME_OFFLOAD = (__force iwl_ucode_tlv_capa_t)96,
376 378
377 NUM_IWL_UCODE_TLV_CAPA 379 NUM_IWL_UCODE_TLV_CAPA
378#ifdef __CHECKER__ 380#ifdef __CHECKER__
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index c52623cb7c2a..d19c74827fbb 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -276,10 +276,10 @@ struct iwl_pwr_tx_backoff {
276 * @fw_name_pre: Firmware filename prefix. The api version and extension 276 * @fw_name_pre: Firmware filename prefix. The api version and extension
277 * (.ucode) will be added to filename before loading from disk. The 277 * (.ucode) will be added to filename before loading from disk. The
278 * filename is constructed as fw_name_pre<api>.ucode. 278 * filename is constructed as fw_name_pre<api>.ucode.
279 * @fw_name_pre_next_step: same as @fw_name_pre, only for next step 279 * @fw_name_pre_b_or_c_step: same as @fw_name_pre, only for b or c steps
280 * (if supported) 280 * (if supported)
281 * @fw_name_pre_rf_next_step: same as @fw_name_pre_next_step, only for rf next 281 * @fw_name_pre_rf_next_step: same as @fw_name_pre_b_or_c_step, only for rf
282 * step. Supported only in integrated solutions. 282 * next step. Supported only in integrated solutions.
283 * @ucode_api_max: Highest version of uCode API supported by driver. 283 * @ucode_api_max: Highest version of uCode API supported by driver.
284 * @ucode_api_min: Lowest version of uCode API supported by driver. 284 * @ucode_api_min: Lowest version of uCode API supported by driver.
285 * @max_inst_size: The maximal length of the fw inst section 285 * @max_inst_size: The maximal length of the fw inst section
@@ -330,7 +330,7 @@ struct iwl_cfg {
330 /* params specific to an individual device within a device family */ 330 /* params specific to an individual device within a device family */
331 const char *name; 331 const char *name;
332 const char *fw_name_pre; 332 const char *fw_name_pre;
333 const char *fw_name_pre_next_step; 333 const char *fw_name_pre_b_or_c_step;
334 const char *fw_name_pre_rf_next_step; 334 const char *fw_name_pre_rf_next_step;
335 /* params not likely to change within a device family */ 335 /* params not likely to change within a device family */
336 const struct iwl_base_params *base_params; 336 const struct iwl_base_params *base_params;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 6fdb5921e17f..4e0f86fe0a6f 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -216,8 +216,9 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
216 const char *fw_pre_name; 216 const char *fw_pre_name;
217 217
218 if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_9000 && 218 if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_9000 &&
219 CSR_HW_REV_STEP(drv->trans->hw_rev) == SILICON_B_STEP) 219 (CSR_HW_REV_STEP(drv->trans->hw_rev) == SILICON_B_STEP ||
220 fw_pre_name = cfg->fw_name_pre_next_step; 220 CSR_HW_REV_STEP(drv->trans->hw_rev) == SILICON_C_STEP))
221 fw_pre_name = cfg->fw_name_pre_b_or_c_step;
221 else if (drv->trans->cfg->integrated && 222 else if (drv->trans->cfg->integrated &&
222 CSR_HW_RFID_STEP(drv->trans->hw_rf_id) == SILICON_B_STEP && 223 CSR_HW_RFID_STEP(drv->trans->hw_rf_id) == SILICON_B_STEP &&
223 cfg->fw_name_pre_rf_next_step) 224 cfg->fw_name_pre_rf_next_step)
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index 5c08f4d40f6a..3ee6767392b6 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -785,7 +785,8 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
785 int num_of_ch, __le32 *channels, u16 fw_mcc) 785 int num_of_ch, __le32 *channels, u16 fw_mcc)
786{ 786{
787 int ch_idx; 787 int ch_idx;
788 u16 ch_flags, prev_ch_flags = 0; 788 u16 ch_flags;
789 u32 reg_rule_flags, prev_reg_rule_flags = 0;
789 const u8 *nvm_chan = cfg->ext_nvm ? 790 const u8 *nvm_chan = cfg->ext_nvm ?
790 iwl_ext_nvm_channels : iwl_nvm_channels; 791 iwl_ext_nvm_channels : iwl_nvm_channels;
791 struct ieee80211_regdomain *regd; 792 struct ieee80211_regdomain *regd;
@@ -834,8 +835,11 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
834 continue; 835 continue;
835 } 836 }
836 837
838 reg_rule_flags = iwl_nvm_get_regdom_bw_flags(nvm_chan, ch_idx,
839 ch_flags, cfg);
840
837 /* we can't continue the same rule */ 841 /* we can't continue the same rule */
838 if (ch_idx == 0 || prev_ch_flags != ch_flags || 842 if (ch_idx == 0 || prev_reg_rule_flags != reg_rule_flags ||
839 center_freq - prev_center_freq > 20) { 843 center_freq - prev_center_freq > 20) {
840 valid_rules++; 844 valid_rules++;
841 new_rule = true; 845 new_rule = true;
@@ -854,18 +858,17 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
854 rule->power_rule.max_eirp = 858 rule->power_rule.max_eirp =
855 DBM_TO_MBM(IWL_DEFAULT_MAX_TX_POWER); 859 DBM_TO_MBM(IWL_DEFAULT_MAX_TX_POWER);
856 860
857 rule->flags = iwl_nvm_get_regdom_bw_flags(nvm_chan, ch_idx, 861 rule->flags = reg_rule_flags;
858 ch_flags, cfg);
859 862
860 /* rely on auto-calculation to merge BW of contiguous chans */ 863 /* rely on auto-calculation to merge BW of contiguous chans */
861 rule->flags |= NL80211_RRF_AUTO_BW; 864 rule->flags |= NL80211_RRF_AUTO_BW;
862 rule->freq_range.max_bandwidth_khz = 0; 865 rule->freq_range.max_bandwidth_khz = 0;
863 866
864 prev_ch_flags = ch_flags;
865 prev_center_freq = center_freq; 867 prev_center_freq = center_freq;
868 prev_reg_rule_flags = reg_rule_flags;
866 869
867 IWL_DEBUG_DEV(dev, IWL_DL_LAR, 870 IWL_DEBUG_DEV(dev, IWL_DL_LAR,
868 "Ch. %d [%sGHz] %s%s%s%s%s%s%s%s%s(0x%02x): Ad-Hoc %ssupported\n", 871 "Ch. %d [%sGHz] %s%s%s%s%s%s%s%s%s(0x%02x) reg_flags 0x%x: %s\n",
869 center_freq, 872 center_freq,
870 band == NL80211_BAND_5GHZ ? "5.2" : "2.4", 873 band == NL80211_BAND_5GHZ ? "5.2" : "2.4",
871 CHECK_AND_PRINT_I(VALID), 874 CHECK_AND_PRINT_I(VALID),
@@ -877,10 +880,10 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
877 CHECK_AND_PRINT_I(160MHZ), 880 CHECK_AND_PRINT_I(160MHZ),
878 CHECK_AND_PRINT_I(INDOOR_ONLY), 881 CHECK_AND_PRINT_I(INDOOR_ONLY),
879 CHECK_AND_PRINT_I(GO_CONCURRENT), 882 CHECK_AND_PRINT_I(GO_CONCURRENT),
880 ch_flags, 883 ch_flags, reg_rule_flags,
881 ((ch_flags & NVM_CHANNEL_ACTIVE) && 884 ((ch_flags & NVM_CHANNEL_ACTIVE) &&
882 !(ch_flags & NVM_CHANNEL_RADAR)) 885 !(ch_flags & NVM_CHANNEL_RADAR))
883 ? "" : "not "); 886 ? "Ad-Hoc" : "");
884 } 887 }
885 888
886 regd->n_reg_rules = valid_rules; 889 regd->n_reg_rules = valid_rules;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 79e7a7a285dc..82863e9273eb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1275,8 +1275,10 @@ static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm)
1275 1275
1276 entry = &wifi_pkg->package.elements[idx++]; 1276 entry = &wifi_pkg->package.elements[idx++];
1277 if ((entry->type != ACPI_TYPE_INTEGER) || 1277 if ((entry->type != ACPI_TYPE_INTEGER) ||
1278 (entry->integer.value > U8_MAX)) 1278 (entry->integer.value > U8_MAX)) {
1279 return -EINVAL; 1279 ret = -EINVAL;
1280 goto out_free;
1281 }
1280 1282
1281 mvm->geo_profiles[i].values[j] = entry->integer.value; 1283 mvm->geo_profiles[i].values[j] = entry->integer.value;
1282 } 1284 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index c7b1e58e3384..ce901be5fba8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2597,8 +2597,18 @@ static void iwl_mvm_purge_deferred_tx_frames(struct iwl_mvm *mvm,
2597 spin_lock_bh(&mvm_sta->lock); 2597 spin_lock_bh(&mvm_sta->lock);
2598 for (i = 0; i <= IWL_MAX_TID_COUNT; i++) { 2598 for (i = 0; i <= IWL_MAX_TID_COUNT; i++) {
2599 tid_data = &mvm_sta->tid_data[i]; 2599 tid_data = &mvm_sta->tid_data[i];
2600 while ((skb = __skb_dequeue(&tid_data->deferred_tx_frames))) 2600
2601 while ((skb = __skb_dequeue(&tid_data->deferred_tx_frames))) {
2602 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2603
2604 /*
2605 * The first deferred frame should've stopped the MAC
2606 * queues, so we should never get a second deferred
2607 * frame for the RA/TID.
2608 */
2609 iwl_mvm_start_mac_queues(mvm, info->hw_queue);
2601 ieee80211_free_txskb(mvm->hw, skb); 2610 ieee80211_free_txskb(mvm->hw, skb);
2611 }
2602 } 2612 }
2603 spin_unlock_bh(&mvm_sta->lock); 2613 spin_unlock_bh(&mvm_sta->lock);
2604} 2614}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 65beca3a457a..8999a1199d60 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -1291,7 +1291,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1291 * first index into rate scale table. 1291 * first index into rate scale table.
1292 */ 1292 */
1293 if (info->flags & IEEE80211_TX_STAT_AMPDU) { 1293 if (info->flags & IEEE80211_TX_STAT_AMPDU) {
1294 rs_collect_tpc_data(mvm, lq_sta, curr_tbl, lq_rate.index, 1294 rs_collect_tpc_data(mvm, lq_sta, curr_tbl, tx_resp_rate.index,
1295 info->status.ampdu_len, 1295 info->status.ampdu_len,
1296 info->status.ampdu_ack_len, 1296 info->status.ampdu_ack_len,
1297 reduced_txp); 1297 reduced_txp);
@@ -1312,7 +1312,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1312 if (info->status.ampdu_ack_len == 0) 1312 if (info->status.ampdu_ack_len == 0)
1313 info->status.ampdu_len = 1; 1313 info->status.ampdu_len = 1;
1314 1314
1315 rs_collect_tlc_data(mvm, lq_sta, curr_tbl, lq_rate.index, 1315 rs_collect_tlc_data(mvm, lq_sta, curr_tbl, tx_resp_rate.index,
1316 info->status.ampdu_len, 1316 info->status.ampdu_len,
1317 info->status.ampdu_ack_len); 1317 info->status.ampdu_ack_len);
1318 1318
@@ -1348,11 +1348,11 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1348 continue; 1348 continue;
1349 1349
1350 rs_collect_tpc_data(mvm, lq_sta, tmp_tbl, 1350 rs_collect_tpc_data(mvm, lq_sta, tmp_tbl,
1351 lq_rate.index, 1, 1351 tx_resp_rate.index, 1,
1352 i < retries ? 0 : legacy_success, 1352 i < retries ? 0 : legacy_success,
1353 reduced_txp); 1353 reduced_txp);
1354 rs_collect_tlc_data(mvm, lq_sta, tmp_tbl, 1354 rs_collect_tlc_data(mvm, lq_sta, tmp_tbl,
1355 lq_rate.index, 1, 1355 tx_resp_rate.index, 1,
1356 i < retries ? 0 : legacy_success); 1356 i < retries ? 0 : legacy_success);
1357 } 1357 }
1358 1358
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index f3e608196369..71c8b800ffa9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -636,9 +636,9 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
636 636
637 baid_data = rcu_dereference(mvm->baid_map[baid]); 637 baid_data = rcu_dereference(mvm->baid_map[baid]);
638 if (!baid_data) { 638 if (!baid_data) {
639 WARN(!(reorder & IWL_RX_MPDU_REORDER_BA_OLD_SN), 639 IWL_DEBUG_RX(mvm,
640 "Received baid %d, but no data exists for this BAID\n", 640 "Got valid BAID but no baid allocated, bypass the re-ordering buffer. Baid %d reorder 0x%x\n",
641 baid); 641 baid, reorder);
642 return false; 642 return false;
643 } 643 }
644 644
@@ -759,7 +759,9 @@ static void iwl_mvm_agg_rx_received(struct iwl_mvm *mvm,
759 759
760 data = rcu_dereference(mvm->baid_map[baid]); 760 data = rcu_dereference(mvm->baid_map[baid]);
761 if (!data) { 761 if (!data) {
762 WARN_ON(!(reorder_data & IWL_RX_MPDU_REORDER_BA_OLD_SN)); 762 IWL_DEBUG_RX(mvm,
763 "Got valid BAID but no baid allocated, bypass the re-ordering buffer. Baid %d reorder 0x%x\n",
764 baid, reorder_data);
763 goto out; 765 goto out;
764 } 766 }
765 767
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index ab66b4394dfc..027ee5e72172 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -121,7 +121,8 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
121 .mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color), 121 .mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color),
122 .add_modify = update ? 1 : 0, 122 .add_modify = update ? 1 : 0,
123 .station_flags_msk = cpu_to_le32(STA_FLG_FAT_EN_MSK | 123 .station_flags_msk = cpu_to_le32(STA_FLG_FAT_EN_MSK |
124 STA_FLG_MIMO_EN_MSK), 124 STA_FLG_MIMO_EN_MSK |
125 STA_FLG_RTS_MIMO_PROT),
125 .tid_disable_tx = cpu_to_le16(mvm_sta->tid_disable_agg), 126 .tid_disable_tx = cpu_to_le16(mvm_sta->tid_disable_agg),
126 }; 127 };
127 int ret; 128 int ret;
@@ -290,8 +291,8 @@ static void iwl_mvm_rx_agg_session_expired(unsigned long data)
290 goto unlock; 291 goto unlock;
291 292
292 mvm_sta = iwl_mvm_sta_from_mac80211(sta); 293 mvm_sta = iwl_mvm_sta_from_mac80211(sta);
293 ieee80211_stop_rx_ba_session_offl(mvm_sta->vif, 294 ieee80211_rx_ba_timer_expired(mvm_sta->vif,
294 sta->addr, ba_data->tid); 295 sta->addr, ba_data->tid);
295unlock: 296unlock:
296 rcu_read_unlock(); 297 rcu_read_unlock();
297} 298}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 60360ed73f26..5fcc9dd6be56 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -185,8 +185,14 @@ static u16 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
185 else 185 else
186 udp_hdr(skb)->check = 0; 186 udp_hdr(skb)->check = 0;
187 187
188 /* mac header len should include IV, size is in words */ 188 /*
189 if (info->control.hw_key) 189 * mac header len should include IV, size is in words unless
190 * the IV is added by the firmware like in WEP.
191 * In new Tx API, the IV is always added by the firmware.
192 */
193 if (!iwl_mvm_has_new_tx_api(mvm) && info->control.hw_key &&
194 info->control.hw_key->cipher != WLAN_CIPHER_SUITE_WEP40 &&
195 info->control.hw_key->cipher != WLAN_CIPHER_SUITE_WEP104)
190 mh_len += info->control.hw_key->iv_len; 196 mh_len += info->control.hw_key->iv_len;
191 mh_len /= 2; 197 mh_len /= 2;
192 offload_assist |= mh_len << TX_CMD_OFFLD_MH_SIZE; 198 offload_assist |= mh_len << TX_CMD_OFFLD_MH_SIZE;
@@ -1815,6 +1821,8 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
1815 struct iwl_mvm_tid_data *tid_data; 1821 struct iwl_mvm_tid_data *tid_data;
1816 struct iwl_mvm_sta *mvmsta; 1822 struct iwl_mvm_sta *mvmsta;
1817 1823
1824 ba_info.flags = IEEE80211_TX_STAT_AMPDU;
1825
1818 if (iwl_mvm_has_new_tx_api(mvm)) { 1826 if (iwl_mvm_has_new_tx_api(mvm)) {
1819 struct iwl_mvm_compressed_ba_notif *ba_res = 1827 struct iwl_mvm_compressed_ba_notif *ba_res =
1820 (void *)pkt->data; 1828 (void *)pkt->data;
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index f16c1bb9bf94..84f4ba01e14f 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -510,9 +510,17 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
510 510
511/* 9000 Series */ 511/* 9000 Series */
512 {IWL_PCI_DEVICE(0x271B, 0x0010, iwl9160_2ac_cfg)}, 512 {IWL_PCI_DEVICE(0x271B, 0x0010, iwl9160_2ac_cfg)},
513 {IWL_PCI_DEVICE(0x271B, 0x0014, iwl9160_2ac_cfg)},
514 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)},
513 {IWL_PCI_DEVICE(0x2526, 0x0000, iwl9260_2ac_cfg)}, 515 {IWL_PCI_DEVICE(0x2526, 0x0000, iwl9260_2ac_cfg)},
514 {IWL_PCI_DEVICE(0x2526, 0x0010, iwl9260_2ac_cfg)}, 516 {IWL_PCI_DEVICE(0x2526, 0x0010, iwl9260_2ac_cfg)},
517 {IWL_PCI_DEVICE(0x2526, 0x0014, iwl9260_2ac_cfg)},
518 {IWL_PCI_DEVICE(0x2526, 0xA014, iwl9260_2ac_cfg)},
519 {IWL_PCI_DEVICE(0x2526, 0x4010, iwl9260_2ac_cfg)},
520 {IWL_PCI_DEVICE(0x2526, 0x0210, iwl9260_2ac_cfg)},
521 {IWL_PCI_DEVICE(0x2526, 0x0214, iwl9260_2ac_cfg)},
515 {IWL_PCI_DEVICE(0x2526, 0x1410, iwl9270_2ac_cfg)}, 522 {IWL_PCI_DEVICE(0x2526, 0x1410, iwl9270_2ac_cfg)},
523 {IWL_PCI_DEVICE(0x2526, 0x1610, iwl9270_2ac_cfg)},
516 {IWL_PCI_DEVICE(0x9DF0, 0x0A10, iwl9460_2ac_cfg)}, 524 {IWL_PCI_DEVICE(0x9DF0, 0x0A10, iwl9460_2ac_cfg)},
517 {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9460_2ac_cfg)}, 525 {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9460_2ac_cfg)},
518 {IWL_PCI_DEVICE(0x9DF0, 0x0210, iwl9460_2ac_cfg)}, 526 {IWL_PCI_DEVICE(0x9DF0, 0x0210, iwl9460_2ac_cfg)},
@@ -527,10 +535,22 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
527 {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl9460_2ac_cfg)}, 535 {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl9460_2ac_cfg)},
528 {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg)}, 536 {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg)},
529 {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9460_2ac_cfg)}, 537 {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9460_2ac_cfg)},
538 {IWL_PCI_DEVICE(0x2526, 0x0260, iwl9460_2ac_cfg)},
539 {IWL_PCI_DEVICE(0x2526, 0x0064, iwl9460_2ac_cfg)},
540 {IWL_PCI_DEVICE(0x2526, 0x00A4, iwl9460_2ac_cfg)},
541 {IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9460_2ac_cfg)},
542 {IWL_PCI_DEVICE(0x2526, 0x02A4, iwl9460_2ac_cfg)},
543 {IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9460_2ac_cfg)},
544 {IWL_PCI_DEVICE(0x2526, 0x02A0, iwl9460_2ac_cfg)},
530 {IWL_PCI_DEVICE(0x9DF0, 0x0060, iwl9460_2ac_cfg)}, 545 {IWL_PCI_DEVICE(0x9DF0, 0x0060, iwl9460_2ac_cfg)},
531 {IWL_PCI_DEVICE(0xA370, 0x0060, iwl9460_2ac_cfg)}, 546 {IWL_PCI_DEVICE(0xA370, 0x0060, iwl9460_2ac_cfg)},
532 {IWL_PCI_DEVICE(0x31DC, 0x0060, iwl9460_2ac_cfg)}, 547 {IWL_PCI_DEVICE(0x31DC, 0x0060, iwl9460_2ac_cfg)},
533 {IWL_PCI_DEVICE(0x2526, 0x0030, iwl9560_2ac_cfg)}, 548 {IWL_PCI_DEVICE(0x2526, 0x0030, iwl9560_2ac_cfg)},
549 {IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_cfg)},
550 {IWL_PCI_DEVICE(0x2526, 0x0230, iwl9560_2ac_cfg)},
551 {IWL_PCI_DEVICE(0x2526, 0x0234, iwl9560_2ac_cfg)},
552 {IWL_PCI_DEVICE(0x2526, 0x0238, iwl9560_2ac_cfg)},
553 {IWL_PCI_DEVICE(0x2526, 0x023C, iwl9560_2ac_cfg)},
534 {IWL_PCI_DEVICE(0x9DF0, 0x0030, iwl9560_2ac_cfg)}, 554 {IWL_PCI_DEVICE(0x9DF0, 0x0030, iwl9560_2ac_cfg)},
535 {IWL_PCI_DEVICE(0xA370, 0x0030, iwl9560_2ac_cfg)}, 555 {IWL_PCI_DEVICE(0xA370, 0x0030, iwl9560_2ac_cfg)},
536 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_cfg)}, 556 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_cfg)},
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b4b7eab29400..da5570cf5c6a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -522,10 +522,11 @@ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
522 bridge = pci_upstream_bridge(bridge); 522 bridge = pci_upstream_bridge(bridge);
523 } 523 }
524 524
525 if (pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT) 525 if (highest_pcie_bridge &&
526 return NULL; 526 pci_pcie_type(highest_pcie_bridge) == PCI_EXP_TYPE_ROOT_PORT)
527 return highest_pcie_bridge;
527 528
528 return highest_pcie_bridge; 529 return NULL;
529} 530}
530EXPORT_SYMBOL(pci_find_pcie_root_port); 531EXPORT_SYMBOL(pci_find_pcie_root_port);
531 532
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c31310db0404..e6a917b4acd3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1762,6 +1762,48 @@ static void pci_configure_extended_tags(struct pci_dev *dev)
1762 PCI_EXP_DEVCTL_EXT_TAG); 1762 PCI_EXP_DEVCTL_EXT_TAG);
1763} 1763}
1764 1764
1765/**
1766 * pcie_relaxed_ordering_enabled - Probe for PCIe relaxed ordering enable
1767 * @dev: PCI device to query
1768 *
1769 * Returns true if the device has enabled relaxed ordering attribute.
1770 */
1771bool pcie_relaxed_ordering_enabled(struct pci_dev *dev)
1772{
1773 u16 v;
1774
1775 pcie_capability_read_word(dev, PCI_EXP_DEVCTL, &v);
1776
1777 return !!(v & PCI_EXP_DEVCTL_RELAX_EN);
1778}
1779EXPORT_SYMBOL(pcie_relaxed_ordering_enabled);
1780
1781static void pci_configure_relaxed_ordering(struct pci_dev *dev)
1782{
1783 struct pci_dev *root;
1784
1785 /* PCI_EXP_DEVICE_RELAX_EN is RsvdP in VFs */
1786 if (dev->is_virtfn)
1787 return;
1788
1789 if (!pcie_relaxed_ordering_enabled(dev))
1790 return;
1791
1792 /*
1793 * For now, we only deal with Relaxed Ordering issues with Root
1794 * Ports. Peer-to-Peer DMA is another can of worms.
1795 */
1796 root = pci_find_pcie_root_port(dev);
1797 if (!root)
1798 return;
1799
1800 if (root->dev_flags & PCI_DEV_FLAGS_NO_RELAXED_ORDERING) {
1801 pcie_capability_clear_word(dev, PCI_EXP_DEVCTL,
1802 PCI_EXP_DEVCTL_RELAX_EN);
1803 dev_info(&dev->dev, "Disable Relaxed Ordering because the Root Port didn't support it\n");
1804 }
1805}
1806
1765static void pci_configure_device(struct pci_dev *dev) 1807static void pci_configure_device(struct pci_dev *dev)
1766{ 1808{
1767 struct hotplug_params hpp; 1809 struct hotplug_params hpp;
@@ -1769,6 +1811,7 @@ static void pci_configure_device(struct pci_dev *dev)
1769 1811
1770 pci_configure_mps(dev); 1812 pci_configure_mps(dev);
1771 pci_configure_extended_tags(dev); 1813 pci_configure_extended_tags(dev);
1814 pci_configure_relaxed_ordering(dev);
1772 1815
1773 memset(&hpp, 0, sizeof(hpp)); 1816 memset(&hpp, 0, sizeof(hpp));
1774 ret = pci_get_hp_params(dev, &hpp); 1817 ret = pci_get_hp_params(dev, &hpp);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 6967c6b4cf6b..140760403f36 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4016,6 +4016,95 @@ DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6869, PCI_CLASS_NOT_DEFINED, 8,
4016 quirk_tw686x_class); 4016 quirk_tw686x_class);
4017 4017
4018/* 4018/*
4019 * Some devices have problems with Transaction Layer Packets with the Relaxed
4020 * Ordering Attribute set. Such devices should mark themselves and other
4021 * Device Drivers should check before sending TLPs with RO set.
4022 */
4023static void quirk_relaxedordering_disable(struct pci_dev *dev)
4024{
4025 dev->dev_flags |= PCI_DEV_FLAGS_NO_RELAXED_ORDERING;
4026 dev_info(&dev->dev, "Disable Relaxed Ordering Attributes to avoid PCIe Completion erratum\n");
4027}
4028
4029/*
4030 * Intel Xeon processors based on Broadwell/Haswell microarchitecture Root
4031 * Complex has a Flow Control Credit issue which can cause performance
4032 * problems with Upstream Transaction Layer Packets with Relaxed Ordering set.
4033 */
4034DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f01, PCI_CLASS_NOT_DEFINED, 8,
4035 quirk_relaxedordering_disable);
4036DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f02, PCI_CLASS_NOT_DEFINED, 8,
4037 quirk_relaxedordering_disable);
4038DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f03, PCI_CLASS_NOT_DEFINED, 8,
4039 quirk_relaxedordering_disable);
4040DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f04, PCI_CLASS_NOT_DEFINED, 8,
4041 quirk_relaxedordering_disable);
4042DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f05, PCI_CLASS_NOT_DEFINED, 8,
4043 quirk_relaxedordering_disable);
4044DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f06, PCI_CLASS_NOT_DEFINED, 8,
4045 quirk_relaxedordering_disable);
4046DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f07, PCI_CLASS_NOT_DEFINED, 8,
4047 quirk_relaxedordering_disable);
4048DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f08, PCI_CLASS_NOT_DEFINED, 8,
4049 quirk_relaxedordering_disable);
4050DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f09, PCI_CLASS_NOT_DEFINED, 8,
4051 quirk_relaxedordering_disable);
4052DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f0a, PCI_CLASS_NOT_DEFINED, 8,
4053 quirk_relaxedordering_disable);
4054DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f0b, PCI_CLASS_NOT_DEFINED, 8,
4055 quirk_relaxedordering_disable);
4056DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f0c, PCI_CLASS_NOT_DEFINED, 8,
4057 quirk_relaxedordering_disable);
4058DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f0d, PCI_CLASS_NOT_DEFINED, 8,
4059 quirk_relaxedordering_disable);
4060DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x6f0e, PCI_CLASS_NOT_DEFINED, 8,
4061 quirk_relaxedordering_disable);
4062DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f01, PCI_CLASS_NOT_DEFINED, 8,
4063 quirk_relaxedordering_disable);
4064DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f02, PCI_CLASS_NOT_DEFINED, 8,
4065 quirk_relaxedordering_disable);
4066DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f03, PCI_CLASS_NOT_DEFINED, 8,
4067 quirk_relaxedordering_disable);
4068DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f04, PCI_CLASS_NOT_DEFINED, 8,
4069 quirk_relaxedordering_disable);
4070DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f05, PCI_CLASS_NOT_DEFINED, 8,
4071 quirk_relaxedordering_disable);
4072DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f06, PCI_CLASS_NOT_DEFINED, 8,
4073 quirk_relaxedordering_disable);
4074DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f07, PCI_CLASS_NOT_DEFINED, 8,
4075 quirk_relaxedordering_disable);
4076DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f08, PCI_CLASS_NOT_DEFINED, 8,
4077 quirk_relaxedordering_disable);
4078DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f09, PCI_CLASS_NOT_DEFINED, 8,
4079 quirk_relaxedordering_disable);
4080DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f0a, PCI_CLASS_NOT_DEFINED, 8,
4081 quirk_relaxedordering_disable);
4082DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f0b, PCI_CLASS_NOT_DEFINED, 8,
4083 quirk_relaxedordering_disable);
4084DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f0c, PCI_CLASS_NOT_DEFINED, 8,
4085 quirk_relaxedordering_disable);
4086DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f0d, PCI_CLASS_NOT_DEFINED, 8,
4087 quirk_relaxedordering_disable);
4088DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, 0x2f0e, PCI_CLASS_NOT_DEFINED, 8,
4089 quirk_relaxedordering_disable);
4090
4091/*
4092 * The AMD ARM A1100 (AKA "SEATTLE") SoC has a bug in its PCIe Root Complex
4093 * where Upstream Transaction Layer Packets with the Relaxed Ordering
4094 * Attribute clear are allowed to bypass earlier TLPs with Relaxed Ordering
4095 * set. This is a violation of the PCIe 3.0 Transaction Ordering Rules
4096 * outlined in Section 2.4.1 (PCI Express(r) Base Specification Revision 3.0
4097 * November 10, 2010). As a result, on this platform we can't use Relaxed
4098 * Ordering for Upstream TLPs.
4099 */
4100DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_AMD, 0x1a00, PCI_CLASS_NOT_DEFINED, 8,
4101 quirk_relaxedordering_disable);
4102DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_AMD, 0x1a01, PCI_CLASS_NOT_DEFINED, 8,
4103 quirk_relaxedordering_disable);
4104DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_AMD, 0x1a02, PCI_CLASS_NOT_DEFINED, 8,
4105 quirk_relaxedordering_disable);
4106
4107/*
4019 * Per PCIe r3.0, sec 2.2.9, "Completion headers must supply the same 4108 * Per PCIe r3.0, sec 2.2.9, "Completion headers must supply the same
4020 * values for the Attribute as were supplied in the header of the 4109 * values for the Attribute as were supplied in the header of the
4021 * corresponding Request, except as explicitly allowed when IDO is used." 4110 * corresponding Request, except as explicitly allowed when IDO is used."
diff --git a/include/linux/net.h b/include/linux/net.h
index dda2cc939a53..ebeb48c92005 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -37,7 +37,7 @@ struct net;
37 37
38/* Historically, SOCKWQ_ASYNC_NOSPACE & SOCKWQ_ASYNC_WAITDATA were located 38/* Historically, SOCKWQ_ASYNC_NOSPACE & SOCKWQ_ASYNC_WAITDATA were located
39 * in sock->flags, but moved into sk->sk_wq->flags to be RCU protected. 39 * in sock->flags, but moved into sk->sk_wq->flags to be RCU protected.
40 * Eventually all flags will be in sk->sk_wq_flags. 40 * Eventually all flags will be in sk->sk_wq->flags.
41 */ 41 */
42#define SOCKWQ_ASYNC_NOSPACE 0 42#define SOCKWQ_ASYNC_NOSPACE 0
43#define SOCKWQ_ASYNC_WAITDATA 1 43#define SOCKWQ_ASYNC_WAITDATA 1
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a75c13673852..f958d0732af6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -188,6 +188,8 @@ enum pci_dev_flags {
188 * the direct_complete optimization. 188 * the direct_complete optimization.
189 */ 189 */
190 PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11), 190 PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11),
191 /* Don't use Relaxed Ordering for TLPs directed at this device */
192 PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 12),
191}; 193};
192 194
193enum pci_irq_reroute_variant { 195enum pci_irq_reroute_variant {
@@ -1126,6 +1128,7 @@ bool pci_check_pme_status(struct pci_dev *dev);
1126void pci_pme_wakeup_bus(struct pci_bus *bus); 1128void pci_pme_wakeup_bus(struct pci_bus *bus);
1127void pci_d3cold_enable(struct pci_dev *dev); 1129void pci_d3cold_enable(struct pci_dev *dev);
1128void pci_d3cold_disable(struct pci_dev *dev); 1130void pci_d3cold_disable(struct pci_dev *dev);
1131bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);
1129 1132
1130/* PCI Virtual Channel */ 1133/* PCI Virtual Channel */
1131int pci_save_vc_state(struct pci_dev *dev); 1134int pci_save_vc_state(struct pci_dev *dev);
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 6df79e96a780..f44ff2476758 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -336,6 +336,16 @@ static inline void in6_dev_put(struct inet6_dev *idev)
336 in6_dev_finish_destroy(idev); 336 in6_dev_finish_destroy(idev);
337} 337}
338 338
339static inline void in6_dev_put_clear(struct inet6_dev **pidev)
340{
341 struct inet6_dev *idev = *pidev;
342
343 if (idev) {
344 in6_dev_put(idev);
345 *pidev = NULL;
346 }
347}
348
339static inline void __in6_dev_put(struct inet6_dev *idev) 349static inline void __in6_dev_put(struct inet6_dev *idev)
340{ 350{
341 refcount_dec(&idev->refcnt); 351 refcount_dec(&idev->refcnt);
diff --git a/include/net/bonding.h b/include/net/bonding.h
index b00508d22e0a..b2e68657a216 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -277,6 +277,11 @@ static inline bool bond_is_lb(const struct bonding *bond)
277 BOND_MODE(bond) == BOND_MODE_ALB; 277 BOND_MODE(bond) == BOND_MODE_ALB;
278} 278}
279 279
280static inline bool bond_needs_speed_duplex(const struct bonding *bond)
281{
282 return BOND_MODE(bond) == BOND_MODE_8023AD || bond_is_lb(bond);
283}
284
280static inline bool bond_is_nondyn_tlb(const struct bonding *bond) 285static inline bool bond_is_nondyn_tlb(const struct bonding *bond)
281{ 286{
282 return (BOND_MODE(bond) == BOND_MODE_TLB) && 287 return (BOND_MODE(bond) == BOND_MODE_TLB) &&
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
index 8ffd434676b7..71c72a939bf8 100644
--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -29,18 +29,18 @@
29#include <linux/sched/signal.h> 29#include <linux/sched/signal.h>
30#include <net/ip.h> 30#include <net/ip.h>
31 31
32#ifdef CONFIG_NET_RX_BUSY_POLL
33
34struct napi_struct;
35extern unsigned int sysctl_net_busy_read __read_mostly;
36extern unsigned int sysctl_net_busy_poll __read_mostly;
37
38/* 0 - Reserved to indicate value not set 32/* 0 - Reserved to indicate value not set
39 * 1..NR_CPUS - Reserved for sender_cpu 33 * 1..NR_CPUS - Reserved for sender_cpu
40 * NR_CPUS+1..~0 - Region available for NAPI IDs 34 * NR_CPUS+1..~0 - Region available for NAPI IDs
41 */ 35 */
42#define MIN_NAPI_ID ((unsigned int)(NR_CPUS + 1)) 36#define MIN_NAPI_ID ((unsigned int)(NR_CPUS + 1))
43 37
38#ifdef CONFIG_NET_RX_BUSY_POLL
39
40struct napi_struct;
41extern unsigned int sysctl_net_busy_read __read_mostly;
42extern unsigned int sysctl_net_busy_poll __read_mostly;
43
44static inline bool net_busy_loop_on(void) 44static inline bool net_busy_loop_on(void)
45{ 45{
46 return sysctl_net_busy_poll; 46 return sysctl_net_busy_poll;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b2b5419467cc..f8149ca192b4 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -5499,6 +5499,21 @@ static inline void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
5499 ieee80211_manage_rx_ba_offl(vif, addr, tid + IEEE80211_NUM_TIDS); 5499 ieee80211_manage_rx_ba_offl(vif, addr, tid + IEEE80211_NUM_TIDS);
5500} 5500}
5501 5501
5502/**
5503 * ieee80211_rx_ba_timer_expired - stop a Rx BA session due to timeout
5504 *
5505 * Some device drivers do not offload AddBa/DelBa negotiation, but handle rx
5506 * buffer reording internally, and therefore also handle the session timer.
5507 *
5508 * Trigger the timeout flow, which sends a DelBa.
5509 *
5510 * @vif: &struct ieee80211_vif pointer from the add_interface callback
5511 * @addr: station mac address
5512 * @tid: the rx tid
5513 */
5514void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
5515 const u8 *addr, unsigned int tid);
5516
5502/* Rate control API */ 5517/* Rate control API */
5503 5518
5504/** 5519/**
diff --git a/include/net/udp.h b/include/net/udp.h
index cc8036987dcb..586de4b811b5 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -366,12 +366,13 @@ static inline bool udp_skb_is_linear(struct sk_buff *skb)
366static inline int copy_linear_skb(struct sk_buff *skb, int len, int off, 366static inline int copy_linear_skb(struct sk_buff *skb, int len, int off,
367 struct iov_iter *to) 367 struct iov_iter *to)
368{ 368{
369 int n, copy = len - off; 369 int n;
370 370
371 n = copy_to_iter(skb->data + off, copy, to); 371 n = copy_to_iter(skb->data + off, len, to);
372 if (n == copy) 372 if (n == len)
373 return 0; 373 return 0;
374 374
375 iov_iter_revert(to, n);
375 return -EFAULT; 376 return -EFAULT;
376} 377}
377 378
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 37385193a608..dc498b605d5d 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -204,10 +204,36 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
204 fmt_cnt++; 204 fmt_cnt++;
205 } 205 }
206 206
207 return __trace_printk(1/* fake ip will not be printed */, fmt, 207/* Horrid workaround for getting va_list handling working with different
208 mod[0] == 2 ? arg1 : mod[0] == 1 ? (long) arg1 : (u32) arg1, 208 * argument type combinations generically for 32 and 64 bit archs.
209 mod[1] == 2 ? arg2 : mod[1] == 1 ? (long) arg2 : (u32) arg2, 209 */
210 mod[2] == 2 ? arg3 : mod[2] == 1 ? (long) arg3 : (u32) arg3); 210#define __BPF_TP_EMIT() __BPF_ARG3_TP()
211#define __BPF_TP(...) \
212 __trace_printk(1 /* Fake ip will not be printed. */, \
213 fmt, ##__VA_ARGS__)
214
215#define __BPF_ARG1_TP(...) \
216 ((mod[0] == 2 || (mod[0] == 1 && __BITS_PER_LONG == 64)) \
217 ? __BPF_TP(arg1, ##__VA_ARGS__) \
218 : ((mod[0] == 1 || (mod[0] == 0 && __BITS_PER_LONG == 32)) \
219 ? __BPF_TP((long)arg1, ##__VA_ARGS__) \
220 : __BPF_TP((u32)arg1, ##__VA_ARGS__)))
221
222#define __BPF_ARG2_TP(...) \
223 ((mod[1] == 2 || (mod[1] == 1 && __BITS_PER_LONG == 64)) \
224 ? __BPF_ARG1_TP(arg2, ##__VA_ARGS__) \
225 : ((mod[1] == 1 || (mod[1] == 0 && __BITS_PER_LONG == 32)) \
226 ? __BPF_ARG1_TP((long)arg2, ##__VA_ARGS__) \
227 : __BPF_ARG1_TP((u32)arg2, ##__VA_ARGS__)))
228
229#define __BPF_ARG3_TP(...) \
230 ((mod[2] == 2 || (mod[2] == 1 && __BITS_PER_LONG == 64)) \
231 ? __BPF_ARG2_TP(arg3, ##__VA_ARGS__) \
232 : ((mod[2] == 1 || (mod[2] == 0 && __BITS_PER_LONG == 32)) \
233 ? __BPF_ARG2_TP((long)arg3, ##__VA_ARGS__) \
234 : __BPF_ARG2_TP((u32)arg3, ##__VA_ARGS__)))
235
236 return __BPF_TP_EMIT();
211} 237}
212 238
213static const struct bpf_func_proto bpf_trace_printk_proto = { 239static const struct bpf_func_proto bpf_trace_printk_proto = {
diff --git a/net/core/filter.c b/net/core/filter.c
index f44fc22fd45a..6280a602604c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3505,6 +3505,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
3505 bpf_target_off(struct sk_buff, tc_index, 2, 3505 bpf_target_off(struct sk_buff, tc_index, 2,
3506 target_size)); 3506 target_size));
3507#else 3507#else
3508 *target_size = 2;
3508 if (type == BPF_WRITE) 3509 if (type == BPF_WRITE)
3509 *insn++ = BPF_MOV64_REG(si->dst_reg, si->dst_reg); 3510 *insn++ = BPF_MOV64_REG(si->dst_reg, si->dst_reg);
3510 else 3511 else
@@ -3520,6 +3521,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
3520 *insn++ = BPF_JMP_IMM(BPF_JGE, si->dst_reg, MIN_NAPI_ID, 1); 3521 *insn++ = BPF_JMP_IMM(BPF_JGE, si->dst_reg, MIN_NAPI_ID, 1);
3521 *insn++ = BPF_MOV64_IMM(si->dst_reg, 0); 3522 *insn++ = BPF_MOV64_IMM(si->dst_reg, 0);
3522#else 3523#else
3524 *target_size = 4;
3523 *insn++ = BPF_MOV64_IMM(si->dst_reg, 0); 3525 *insn++ = BPF_MOV64_IMM(si->dst_reg, 0);
3524#endif 3526#endif
3525 break; 3527 break;
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 9fe25bf63296..86bc40ba6ba5 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -201,10 +201,7 @@ void dccp_destroy_sock(struct sock *sk)
201{ 201{
202 struct dccp_sock *dp = dccp_sk(sk); 202 struct dccp_sock *dp = dccp_sk(sk);
203 203
204 /* 204 __skb_queue_purge(&sk->sk_write_queue);
205 * DCCP doesn't use sk_write_queue, just sk_send_head
206 * for retransmissions
207 */
208 if (sk->sk_send_head != NULL) { 205 if (sk->sk_send_head != NULL) {
209 kfree_skb(sk->sk_send_head); 206 kfree_skb(sk->sk_send_head);
210 sk->sk_send_head = NULL; 207 sk->sk_send_head = NULL;
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index fab41de8e983..de66ca8e6201 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -42,6 +42,9 @@ static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)
42 padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len; 42 padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
43 43
44 if (skb_tailroom(skb) >= padlen + KSZ_INGRESS_TAG_LEN) { 44 if (skb_tailroom(skb) >= padlen + KSZ_INGRESS_TAG_LEN) {
45 if (skb_put_padto(skb, skb->len + padlen))
46 return NULL;
47
45 nskb = skb; 48 nskb = skb;
46 } else { 49 } else {
47 nskb = alloc_skb(NET_IP_ALIGN + skb->len + 50 nskb = alloc_skb(NET_IP_ALIGN + skb->len +
@@ -56,13 +59,15 @@ static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)
56 skb_set_transport_header(nskb, 59 skb_set_transport_header(nskb,
57 skb_transport_header(skb) - skb->head); 60 skb_transport_header(skb) - skb->head);
58 skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len)); 61 skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
62
63 if (skb_put_padto(nskb, nskb->len + padlen)) {
64 kfree_skb(nskb);
65 return NULL;
66 }
67
59 kfree_skb(skb); 68 kfree_skb(skb);
60 } 69 }
61 70
62 /* skb is freed when it fails */
63 if (skb_put_padto(nskb, nskb->len + padlen))
64 return NULL;
65
66 tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN); 71 tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
67 tag[0] = 0; 72 tag[0] = 0;
68 tag[1] = 1 << p->dp->index; /* destination port */ 73 tag[1] = 1 << p->dp->index; /* destination port */
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index b8d18171cca3..ec3a9ce281a6 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1083,15 +1083,17 @@ struct fib_info *fib_create_info(struct fib_config *cfg,
1083 fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); 1083 fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL);
1084 if (!fi) 1084 if (!fi)
1085 goto failure; 1085 goto failure;
1086 fib_info_cnt++;
1087 if (cfg->fc_mx) { 1086 if (cfg->fc_mx) {
1088 fi->fib_metrics = kzalloc(sizeof(*fi->fib_metrics), GFP_KERNEL); 1087 fi->fib_metrics = kzalloc(sizeof(*fi->fib_metrics), GFP_KERNEL);
1089 if (!fi->fib_metrics) 1088 if (unlikely(!fi->fib_metrics)) {
1090 goto failure; 1089 kfree(fi);
1090 return ERR_PTR(err);
1091 }
1091 atomic_set(&fi->fib_metrics->refcnt, 1); 1092 atomic_set(&fi->fib_metrics->refcnt, 1);
1092 } else 1093 } else {
1093 fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; 1094 fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics;
1094 1095 }
1096 fib_info_cnt++;
1095 fi->fib_net = net; 1097 fi->fib_net = net;
1096 fi->fib_protocol = cfg->fc_protocol; 1098 fi->fib_protocol = cfg->fc_protocol;
1097 fi->fib_scope = cfg->fc_scope; 1099 fi->fib_scope = cfg->fc_scope;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 0383e66f59bc..7effa62beed3 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2750,12 +2750,13 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
2750 err = 0; 2750 err = 0;
2751 if (IS_ERR(rt)) 2751 if (IS_ERR(rt))
2752 err = PTR_ERR(rt); 2752 err = PTR_ERR(rt);
2753 else
2754 skb_dst_set(skb, &rt->dst);
2753 } 2755 }
2754 2756
2755 if (err) 2757 if (err)
2756 goto errout_free; 2758 goto errout_free;
2757 2759
2758 skb_dst_set(skb, &rt->dst);
2759 if (rtm->rtm_flags & RTM_F_NOTIFY) 2760 if (rtm->rtm_flags & RTM_F_NOTIFY)
2760 rt->rt_flags |= RTCF_NOTIFY; 2761 rt->rt_flags |= RTCF_NOTIFY;
2761 2762
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a20e7f03d5f7..e9252c7df809 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1722,6 +1722,8 @@ process:
1722 */ 1722 */
1723 sock_hold(sk); 1723 sock_hold(sk);
1724 refcounted = true; 1724 refcounted = true;
1725 if (tcp_filter(sk, skb))
1726 goto discard_and_relse;
1725 nsk = tcp_check_req(sk, skb, req, false); 1727 nsk = tcp_check_req(sk, skb, req, false);
1726 if (!nsk) { 1728 if (!nsk) {
1727 reqsk_put(req); 1729 reqsk_put(req);
@@ -1729,8 +1731,6 @@ process:
1729 } 1731 }
1730 if (nsk == sk) { 1732 if (nsk == sk) {
1731 reqsk_put(req); 1733 reqsk_put(req);
1732 } else if (tcp_filter(sk, skb)) {
1733 goto discard_and_relse;
1734 } else if (tcp_child_process(sk, nsk, skb)) { 1734 } else if (tcp_child_process(sk, nsk, skb)) {
1735 tcp_v4_send_reset(nsk, skb); 1735 tcp_v4_send_reset(nsk, skb);
1736 goto discard_and_relse; 1736 goto discard_and_relse;
diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
index 2417f55374c5..6bb9e14c710a 100644
--- a/net/ipv4/tcp_ulp.c
+++ b/net/ipv4/tcp_ulp.c
@@ -122,14 +122,14 @@ int tcp_set_ulp(struct sock *sk, const char *name)
122 122
123 ulp_ops = __tcp_ulp_find_autoload(name); 123 ulp_ops = __tcp_ulp_find_autoload(name);
124 if (!ulp_ops) 124 if (!ulp_ops)
125 err = -ENOENT; 125 return -ENOENT;
126 else
127 err = ulp_ops->init(sk);
128 126
129 if (err) 127 err = ulp_ops->init(sk);
130 goto out; 128 if (err) {
129 module_put(ulp_ops->owner);
130 return err;
131 }
131 132
132 icsk->icsk_ulp_ops = ulp_ops; 133 icsk->icsk_ulp_ops = ulp_ops;
133 out: 134 return 0;
134 return err;
135} 135}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a640fbcba15d..94d6a13d47f0 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -417,14 +417,11 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
417 struct net_device *loopback_dev = 417 struct net_device *loopback_dev =
418 dev_net(dev)->loopback_dev; 418 dev_net(dev)->loopback_dev;
419 419
420 if (dev != loopback_dev) { 420 if (idev && idev->dev != loopback_dev) {
421 if (idev && idev->dev == dev) { 421 struct inet6_dev *loopback_idev = in6_dev_get(loopback_dev);
422 struct inet6_dev *loopback_idev = 422 if (loopback_idev) {
423 in6_dev_get(loopback_dev); 423 rt->rt6i_idev = loopback_idev;
424 if (loopback_idev) { 424 in6_dev_put(idev);
425 rt->rt6i_idev = loopback_idev;
426 in6_dev_put(idev);
427 }
428 } 425 }
429 } 426 }
430} 427}
@@ -3724,10 +3721,10 @@ static int ip6_route_dev_notify(struct notifier_block *this,
3724 /* NETDEV_UNREGISTER could be fired for multiple times by 3721 /* NETDEV_UNREGISTER could be fired for multiple times by
3725 * netdev_wait_allrefs(). Make sure we only call this once. 3722 * netdev_wait_allrefs(). Make sure we only call this once.
3726 */ 3723 */
3727 in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev); 3724 in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev);
3728#ifdef CONFIG_IPV6_MULTIPLE_TABLES 3725#ifdef CONFIG_IPV6_MULTIPLE_TABLES
3729 in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev); 3726 in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev);
3730 in6_dev_put(net->ipv6.ip6_blk_hole_entry->rt6i_idev); 3727 in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev);
3731#endif 3728#endif
3732 } 3729 }
3733 3730
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 2521690d62d6..206210125fd7 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1456,6 +1456,8 @@ process:
1456 } 1456 }
1457 sock_hold(sk); 1457 sock_hold(sk);
1458 refcounted = true; 1458 refcounted = true;
1459 if (tcp_filter(sk, skb))
1460 goto discard_and_relse;
1459 nsk = tcp_check_req(sk, skb, req, false); 1461 nsk = tcp_check_req(sk, skb, req, false);
1460 if (!nsk) { 1462 if (!nsk) {
1461 reqsk_put(req); 1463 reqsk_put(req);
@@ -1464,8 +1466,6 @@ process:
1464 if (nsk == sk) { 1466 if (nsk == sk) {
1465 reqsk_put(req); 1467 reqsk_put(req);
1466 tcp_v6_restore_cb(skb); 1468 tcp_v6_restore_cb(skb);
1467 } else if (tcp_filter(sk, skb)) {
1468 goto discard_and_relse;
1469 } else if (tcp_child_process(sk, nsk, skb)) { 1469 } else if (tcp_child_process(sk, nsk, skb)) {
1470 tcp_v6_send_reset(nsk, skb); 1470 tcp_v6_send_reset(nsk, skb);
1471 goto discard_and_relse; 1471 goto discard_and_relse;
diff --git a/net/key/af_key.c b/net/key/af_key.c
index ca9d3ae665e7..98f4d8211b9a 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -228,7 +228,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
228#define BROADCAST_ONE 1 228#define BROADCAST_ONE 1
229#define BROADCAST_REGISTERED 2 229#define BROADCAST_REGISTERED 2
230#define BROADCAST_PROMISC_ONLY 4 230#define BROADCAST_PROMISC_ONLY 4
231static int pfkey_broadcast(struct sk_buff *skb, 231static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,
232 int broadcast_flags, struct sock *one_sk, 232 int broadcast_flags, struct sock *one_sk,
233 struct net *net) 233 struct net *net)
234{ 234{
@@ -278,7 +278,7 @@ static int pfkey_broadcast(struct sk_buff *skb,
278 rcu_read_unlock(); 278 rcu_read_unlock();
279 279
280 if (one_sk != NULL) 280 if (one_sk != NULL)
281 err = pfkey_broadcast_one(skb, &skb2, GFP_KERNEL, one_sk); 281 err = pfkey_broadcast_one(skb, &skb2, allocation, one_sk);
282 282
283 kfree_skb(skb2); 283 kfree_skb(skb2);
284 kfree_skb(skb); 284 kfree_skb(skb);
@@ -311,7 +311,7 @@ static int pfkey_do_dump(struct pfkey_sock *pfk)
311 hdr = (struct sadb_msg *) pfk->dump.skb->data; 311 hdr = (struct sadb_msg *) pfk->dump.skb->data;
312 hdr->sadb_msg_seq = 0; 312 hdr->sadb_msg_seq = 0;
313 hdr->sadb_msg_errno = rc; 313 hdr->sadb_msg_errno = rc;
314 pfkey_broadcast(pfk->dump.skb, BROADCAST_ONE, 314 pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE,
315 &pfk->sk, sock_net(&pfk->sk)); 315 &pfk->sk, sock_net(&pfk->sk));
316 pfk->dump.skb = NULL; 316 pfk->dump.skb = NULL;
317 } 317 }
@@ -355,7 +355,7 @@ static int pfkey_error(const struct sadb_msg *orig, int err, struct sock *sk)
355 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / 355 hdr->sadb_msg_len = (sizeof(struct sadb_msg) /
356 sizeof(uint64_t)); 356 sizeof(uint64_t));
357 357
358 pfkey_broadcast(skb, BROADCAST_ONE, sk, sock_net(sk)); 358 pfkey_broadcast(skb, GFP_KERNEL, BROADCAST_ONE, sk, sock_net(sk));
359 359
360 return 0; 360 return 0;
361} 361}
@@ -1389,7 +1389,7 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, const struct sadb_
1389 1389
1390 xfrm_state_put(x); 1390 xfrm_state_put(x);
1391 1391
1392 pfkey_broadcast(resp_skb, BROADCAST_ONE, sk, net); 1392 pfkey_broadcast(resp_skb, GFP_KERNEL, BROADCAST_ONE, sk, net);
1393 1393
1394 return 0; 1394 return 0;
1395} 1395}
@@ -1476,7 +1476,7 @@ static int key_notify_sa(struct xfrm_state *x, const struct km_event *c)
1476 hdr->sadb_msg_seq = c->seq; 1476 hdr->sadb_msg_seq = c->seq;
1477 hdr->sadb_msg_pid = c->portid; 1477 hdr->sadb_msg_pid = c->portid;
1478 1478
1479 pfkey_broadcast(skb, BROADCAST_ALL, NULL, xs_net(x)); 1479 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xs_net(x));
1480 1480
1481 return 0; 1481 return 0;
1482} 1482}
@@ -1589,7 +1589,7 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, const struct sadb_msg
1589 out_hdr->sadb_msg_reserved = 0; 1589 out_hdr->sadb_msg_reserved = 0;
1590 out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; 1590 out_hdr->sadb_msg_seq = hdr->sadb_msg_seq;
1591 out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; 1591 out_hdr->sadb_msg_pid = hdr->sadb_msg_pid;
1592 pfkey_broadcast(out_skb, BROADCAST_ONE, sk, sock_net(sk)); 1592 pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, sk, sock_net(sk));
1593 1593
1594 return 0; 1594 return 0;
1595} 1595}
@@ -1694,8 +1694,8 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad
1694 return -ENOBUFS; 1694 return -ENOBUFS;
1695 } 1695 }
1696 1696
1697 pfkey_broadcast(supp_skb, BROADCAST_REGISTERED, sk, sock_net(sk)); 1697 pfkey_broadcast(supp_skb, GFP_KERNEL, BROADCAST_REGISTERED, sk,
1698 1698 sock_net(sk));
1699 return 0; 1699 return 0;
1700} 1700}
1701 1701
@@ -1712,7 +1712,8 @@ static int unicast_flush_resp(struct sock *sk, const struct sadb_msg *ihdr)
1712 hdr->sadb_msg_errno = (uint8_t) 0; 1712 hdr->sadb_msg_errno = (uint8_t) 0;
1713 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); 1713 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
1714 1714
1715 return pfkey_broadcast(skb, BROADCAST_ONE, sk, sock_net(sk)); 1715 return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ONE, sk,
1716 sock_net(sk));
1716} 1717}
1717 1718
1718static int key_notify_sa_flush(const struct km_event *c) 1719static int key_notify_sa_flush(const struct km_event *c)
@@ -1733,7 +1734,7 @@ static int key_notify_sa_flush(const struct km_event *c)
1733 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); 1734 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
1734 hdr->sadb_msg_reserved = 0; 1735 hdr->sadb_msg_reserved = 0;
1735 1736
1736 pfkey_broadcast(skb, BROADCAST_ALL, NULL, c->net); 1737 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net);
1737 1738
1738 return 0; 1739 return 0;
1739} 1740}
@@ -1790,7 +1791,7 @@ static int dump_sa(struct xfrm_state *x, int count, void *ptr)
1790 out_hdr->sadb_msg_pid = pfk->dump.msg_portid; 1791 out_hdr->sadb_msg_pid = pfk->dump.msg_portid;
1791 1792
1792 if (pfk->dump.skb) 1793 if (pfk->dump.skb)
1793 pfkey_broadcast(pfk->dump.skb, BROADCAST_ONE, 1794 pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE,
1794 &pfk->sk, sock_net(&pfk->sk)); 1795 &pfk->sk, sock_net(&pfk->sk));
1795 pfk->dump.skb = out_skb; 1796 pfk->dump.skb = out_skb;
1796 1797
@@ -1878,7 +1879,7 @@ static int pfkey_promisc(struct sock *sk, struct sk_buff *skb, const struct sadb
1878 new_hdr->sadb_msg_errno = 0; 1879 new_hdr->sadb_msg_errno = 0;
1879 } 1880 }
1880 1881
1881 pfkey_broadcast(skb, BROADCAST_ALL, NULL, sock_net(sk)); 1882 pfkey_broadcast(skb, GFP_KERNEL, BROADCAST_ALL, NULL, sock_net(sk));
1882 return 0; 1883 return 0;
1883} 1884}
1884 1885
@@ -2206,7 +2207,7 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, const struct km_ev
2206 out_hdr->sadb_msg_errno = 0; 2207 out_hdr->sadb_msg_errno = 0;
2207 out_hdr->sadb_msg_seq = c->seq; 2208 out_hdr->sadb_msg_seq = c->seq;
2208 out_hdr->sadb_msg_pid = c->portid; 2209 out_hdr->sadb_msg_pid = c->portid;
2209 pfkey_broadcast(out_skb, BROADCAST_ALL, NULL, xp_net(xp)); 2210 pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp));
2210 return 0; 2211 return 0;
2211 2212
2212} 2213}
@@ -2426,7 +2427,7 @@ static int key_pol_get_resp(struct sock *sk, struct xfrm_policy *xp, const struc
2426 out_hdr->sadb_msg_errno = 0; 2427 out_hdr->sadb_msg_errno = 0;
2427 out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; 2428 out_hdr->sadb_msg_seq = hdr->sadb_msg_seq;
2428 out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; 2429 out_hdr->sadb_msg_pid = hdr->sadb_msg_pid;
2429 pfkey_broadcast(out_skb, BROADCAST_ONE, sk, xp_net(xp)); 2430 pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, sk, xp_net(xp));
2430 err = 0; 2431 err = 0;
2431 2432
2432out: 2433out:
@@ -2682,7 +2683,7 @@ static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr)
2682 out_hdr->sadb_msg_pid = pfk->dump.msg_portid; 2683 out_hdr->sadb_msg_pid = pfk->dump.msg_portid;
2683 2684
2684 if (pfk->dump.skb) 2685 if (pfk->dump.skb)
2685 pfkey_broadcast(pfk->dump.skb, BROADCAST_ONE, 2686 pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE,
2686 &pfk->sk, sock_net(&pfk->sk)); 2687 &pfk->sk, sock_net(&pfk->sk));
2687 pfk->dump.skb = out_skb; 2688 pfk->dump.skb = out_skb;
2688 2689
@@ -2739,7 +2740,7 @@ static int key_notify_policy_flush(const struct km_event *c)
2739 hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC; 2740 hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC;
2740 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); 2741 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
2741 hdr->sadb_msg_reserved = 0; 2742 hdr->sadb_msg_reserved = 0;
2742 pfkey_broadcast(skb_out, BROADCAST_ALL, NULL, c->net); 2743 pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net);
2743 return 0; 2744 return 0;
2744 2745
2745} 2746}
@@ -2803,7 +2804,7 @@ static int pfkey_process(struct sock *sk, struct sk_buff *skb, const struct sadb
2803 void *ext_hdrs[SADB_EXT_MAX]; 2804 void *ext_hdrs[SADB_EXT_MAX];
2804 int err; 2805 int err;
2805 2806
2806 pfkey_broadcast(skb_clone(skb, GFP_KERNEL), 2807 pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
2807 BROADCAST_PROMISC_ONLY, NULL, sock_net(sk)); 2808 BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
2808 2809
2809 memset(ext_hdrs, 0, sizeof(ext_hdrs)); 2810 memset(ext_hdrs, 0, sizeof(ext_hdrs));
@@ -3024,7 +3025,8 @@ static int key_notify_sa_expire(struct xfrm_state *x, const struct km_event *c)
3024 out_hdr->sadb_msg_seq = 0; 3025 out_hdr->sadb_msg_seq = 0;
3025 out_hdr->sadb_msg_pid = 0; 3026 out_hdr->sadb_msg_pid = 0;
3026 3027
3027 pfkey_broadcast(out_skb, BROADCAST_REGISTERED, NULL, xs_net(x)); 3028 pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL,
3029 xs_net(x));
3028 return 0; 3030 return 0;
3029} 3031}
3030 3032
@@ -3212,7 +3214,8 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct
3212 xfrm_ctx->ctx_len); 3214 xfrm_ctx->ctx_len);
3213 } 3215 }
3214 3216
3215 return pfkey_broadcast(skb, BROADCAST_REGISTERED, NULL, xs_net(x)); 3217 return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL,
3218 xs_net(x));
3216} 3219}
3217 3220
3218static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt, 3221static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
@@ -3408,7 +3411,8 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr,
3408 n_port->sadb_x_nat_t_port_port = sport; 3411 n_port->sadb_x_nat_t_port_port = sport;
3409 n_port->sadb_x_nat_t_port_reserved = 0; 3412 n_port->sadb_x_nat_t_port_reserved = 0;
3410 3413
3411 return pfkey_broadcast(skb, BROADCAST_REGISTERED, NULL, xs_net(x)); 3414 return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL,
3415 xs_net(x));
3412} 3416}
3413 3417
3414#ifdef CONFIG_NET_KEY_MIGRATE 3418#ifdef CONFIG_NET_KEY_MIGRATE
@@ -3599,7 +3603,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
3599 } 3603 }
3600 3604
3601 /* broadcast migrate message to sockets */ 3605 /* broadcast migrate message to sockets */
3602 pfkey_broadcast(skb, BROADCAST_ALL, NULL, &init_net); 3606 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, &init_net);
3603 3607
3604 return 0; 3608 return 0;
3605 3609
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 8708cbe8af5b..2b36eff5d97e 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -7,7 +7,7 @@
7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
9 * Copyright 2007-2010, Intel Corporation 9 * Copyright 2007-2010, Intel Corporation
10 * Copyright(c) 2015 Intel Deutschland GmbH 10 * Copyright(c) 2015-2017 Intel Deutschland GmbH
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -466,3 +466,23 @@ void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif,
466 rcu_read_unlock(); 466 rcu_read_unlock();
467} 467}
468EXPORT_SYMBOL(ieee80211_manage_rx_ba_offl); 468EXPORT_SYMBOL(ieee80211_manage_rx_ba_offl);
469
470void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
471 const u8 *addr, unsigned int tid)
472{
473 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
474 struct ieee80211_local *local = sdata->local;
475 struct sta_info *sta;
476
477 rcu_read_lock();
478 sta = sta_info_get_bss(sdata, addr);
479 if (!sta)
480 goto unlock;
481
482 set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired);
483 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
484
485 unlock:
486 rcu_read_unlock();
487}
488EXPORT_SYMBOL(ieee80211_rx_ba_timer_expired);
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index bd24a550e0f9..a3fa144b8648 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -286,9 +286,6 @@ static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle)
286void qdisc_hash_add(struct Qdisc *q, bool invisible) 286void qdisc_hash_add(struct Qdisc *q, bool invisible)
287{ 287{
288 if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) { 288 if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) {
289 struct Qdisc *root = qdisc_dev(q)->qdisc;
290
291 WARN_ON_ONCE(root == &noop_qdisc);
292 ASSERT_RTNL(); 289 ASSERT_RTNL();
293 hash_add_rcu(qdisc_dev(q)->qdisc_hash, &q->hash, q->handle); 290 hash_add_rcu(qdisc_dev(q)->qdisc_hash, &q->hash, q->handle);
294 if (invisible) 291 if (invisible)
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 572fe2584e48..c403c87aff7a 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -572,8 +572,10 @@ static void atm_tc_destroy(struct Qdisc *sch)
572 struct atm_flow_data *flow, *tmp; 572 struct atm_flow_data *flow, *tmp;
573 573
574 pr_debug("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p); 574 pr_debug("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p);
575 list_for_each_entry(flow, &p->flows, list) 575 list_for_each_entry(flow, &p->flows, list) {
576 tcf_block_put(flow->block); 576 tcf_block_put(flow->block);
577 flow->block = NULL;
578 }
577 579
578 list_for_each_entry_safe(flow, tmp, &p->flows, list) { 580 list_for_each_entry_safe(flow, tmp, &p->flows, list) {
579 if (flow->ref > 1) 581 if (flow->ref > 1)
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 481036f6b54e..780db43300b1 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1431,8 +1431,10 @@ static void cbq_destroy(struct Qdisc *sch)
1431 * be bound to classes which have been destroyed already. --TGR '04 1431 * be bound to classes which have been destroyed already. --TGR '04
1432 */ 1432 */
1433 for (h = 0; h < q->clhash.hashsize; h++) { 1433 for (h = 0; h < q->clhash.hashsize; h++) {
1434 hlist_for_each_entry(cl, &q->clhash.hash[h], common.hnode) 1434 hlist_for_each_entry(cl, &q->clhash.hash[h], common.hnode) {
1435 tcf_block_put(cl->block); 1435 tcf_block_put(cl->block);
1436 cl->block = NULL;
1437 }
1436 } 1438 }
1437 for (h = 0; h < q->clhash.hashsize; h++) { 1439 for (h = 0; h < q->clhash.hashsize; h++) {
1438 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[h], 1440 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[h],
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index b52f74610dc7..fd15200f8627 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1428,6 +1428,10 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
1428 return err; 1428 return err;
1429 q->eligible = RB_ROOT; 1429 q->eligible = RB_ROOT;
1430 1430
1431 err = tcf_block_get(&q->root.block, &q->root.filter_list);
1432 if (err)
1433 goto err_tcf;
1434
1431 q->root.cl_common.classid = sch->handle; 1435 q->root.cl_common.classid = sch->handle;
1432 q->root.refcnt = 1; 1436 q->root.refcnt = 1;
1433 q->root.sched = q; 1437 q->root.sched = q;
@@ -1447,6 +1451,10 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
1447 qdisc_watchdog_init(&q->watchdog, sch); 1451 qdisc_watchdog_init(&q->watchdog, sch);
1448 1452
1449 return 0; 1453 return 0;
1454
1455err_tcf:
1456 qdisc_class_hash_destroy(&q->clhash);
1457 return err;
1450} 1458}
1451 1459
1452static int 1460static int
@@ -1522,8 +1530,10 @@ hfsc_destroy_qdisc(struct Qdisc *sch)
1522 unsigned int i; 1530 unsigned int i;
1523 1531
1524 for (i = 0; i < q->clhash.hashsize; i++) { 1532 for (i = 0; i < q->clhash.hashsize; i++) {
1525 hlist_for_each_entry(cl, &q->clhash.hash[i], cl_common.hnode) 1533 hlist_for_each_entry(cl, &q->clhash.hash[i], cl_common.hnode) {
1526 tcf_block_put(cl->block); 1534 tcf_block_put(cl->block);
1535 cl->block = NULL;
1536 }
1527 } 1537 }
1528 for (i = 0; i < q->clhash.hashsize; i++) { 1538 for (i = 0; i < q->clhash.hashsize; i++) {
1529 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i], 1539 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i],
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 203286ab4427..5d65ec5207e9 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1258,8 +1258,10 @@ static void htb_destroy(struct Qdisc *sch)
1258 tcf_block_put(q->block); 1258 tcf_block_put(q->block);
1259 1259
1260 for (i = 0; i < q->clhash.hashsize; i++) { 1260 for (i = 0; i < q->clhash.hashsize; i++) {
1261 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) 1261 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
1262 tcf_block_put(cl->block); 1262 tcf_block_put(cl->block);
1263 cl->block = NULL;
1264 }
1263 } 1265 }
1264 for (i = 0; i < q->clhash.hashsize; i++) { 1266 for (i = 0; i < q->clhash.hashsize; i++) {
1265 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i], 1267 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i],
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index f80ea2cc5f1f..82469ef9655e 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -437,6 +437,7 @@ congestion_drop:
437 qdisc_drop(head, sch, to_free); 437 qdisc_drop(head, sch, to_free);
438 438
439 slot_queue_add(slot, skb); 439 slot_queue_add(slot, skb);
440 qdisc_tree_reduce_backlog(sch, 0, delta);
440 return NET_XMIT_CN; 441 return NET_XMIT_CN;
441 } 442 }
442 443
@@ -468,8 +469,10 @@ enqueue:
468 /* Return Congestion Notification only if we dropped a packet 469 /* Return Congestion Notification only if we dropped a packet
469 * from this flow. 470 * from this flow.
470 */ 471 */
471 if (qlen != slot->qlen) 472 if (qlen != slot->qlen) {
473 qdisc_tree_reduce_backlog(sch, 0, dropped - qdisc_pkt_len(skb));
472 return NET_XMIT_CN; 474 return NET_XMIT_CN;
475 }
473 476
474 /* As we dropped a packet, better let upper stack know this */ 477 /* As we dropped a packet, better let upper stack know this */
475 qdisc_tree_reduce_backlog(sch, 1, dropped); 478 qdisc_tree_reduce_backlog(sch, 1, dropped);
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index d174ee3254ee..767e0537dde5 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -596,7 +596,7 @@ static int tipc_l2_rcv_msg(struct sk_buff *skb, struct net_device *dev,
596 rcu_read_lock(); 596 rcu_read_lock();
597 b = rcu_dereference_rtnl(dev->tipc_ptr); 597 b = rcu_dereference_rtnl(dev->tipc_ptr);
598 if (likely(b && test_bit(0, &b->up) && 598 if (likely(b && test_bit(0, &b->up) &&
599 (skb->pkt_type <= PACKET_BROADCAST))) { 599 (skb->pkt_type <= PACKET_MULTICAST))) {
600 skb->next = NULL; 600 skb->next = NULL;
601 tipc_rcv(dev_net(dev), skb, b); 601 tipc_rcv(dev_net(dev), skb, b);
602 rcu_read_unlock(); 602 rcu_read_unlock();
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index ab3087687a32..dcd90e6fa7c3 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -513,6 +513,7 @@ bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err)
513 513
514 /* Now reverse the concerned fields */ 514 /* Now reverse the concerned fields */
515 msg_set_errcode(hdr, err); 515 msg_set_errcode(hdr, err);
516 msg_set_non_seq(hdr, 0);
516 msg_set_origport(hdr, msg_destport(&ohdr)); 517 msg_set_origport(hdr, msg_destport(&ohdr));
517 msg_set_destport(hdr, msg_origport(&ohdr)); 518 msg_set_destport(hdr, msg_origport(&ohdr));
518 msg_set_destnode(hdr, msg_prevnode(&ohdr)); 519 msg_set_destnode(hdr, msg_prevnode(&ohdr));