History

Merge tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski: "Including fixes from wireless, bluetooth, bpf and netfilter. Current release - regressions: - Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf", fix nsna_ping mode of team - wifi: mt76: fix bugs in Rx queue handling and DMA mapping - eth: mlx5: - add missing mutex_unlock in error reporter - protect global IPsec ASO with a lock Current release - new code bugs: - rxrpc: fix wrong error return in rxrpc_connect_call() Previous releases - regressions: - bluetooth: hci_sync: fix use of HCI_OP_LE_READ_BUFFER_SIZE_V2 - wifi: - mac80211: fix crashes on Rx due to incorrect initialization of rx->link and rx->link_sta - mac80211: fix bugs in iTXQ conversion - Tx stalls, incorrect aggregation handling, crashes - brcmfmac: fix regression for Broadcom PCIe wifi devices - rndis_wlan: prevent buffer overflow in rndis_query_oid - netfilter: conntrack: handle tcp challenge acks during connection reuse - sched: avoid grafting on htb_destroy_class_offload when destroying - virtio-net: correctly enable callback during start_xmit, fix stalls - tcp: avoid the lookup process failing to get sk in ehash table - ipa: disable ipa interrupt during suspend - eth: stmmac: enable all safety features by default Previous releases - always broken: - bpf: - fix pointer-leak due to insufficient speculative store bypass mitigation (Spectre v4) - skip task with pid=1 in send_signal_common() to avoid a splat - fix BPF program ID information in BPF_AUDIT_UNLOAD as well as PERF_BPF_EVENT_PROG_UNLOAD events - fix potential deadlock in htab_lock_bucket from same bucket index but different map_locked index - bluetooth: - fix a buffer overflow in mgmt_mesh_add() - hci_qca: fix driver shutdown on closed serdev - ISO: fix possible circular locking dependency - CIS: hci_event: fix invalid wait context - wifi: brcmfmac: fixes for survey dump handling - mptcp: explicitly specify sock family at subflow creation time - netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits - tcp: fix rate_app_limited to default to 1 - l2tp: close all race conditions in l2tp_tunnel_register() - eth: mlx5: fixes for QoS config and eswitch configuration - eth: enetc: avoid deadlock in enetc_tx_onestep_tstamp() - eth: stmmac: fix invalid call to mdiobus_get_phy() Misc: - ethtool: add netlink attr in rss get reply only if the value is not empty" * tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (88 commits) Revert "Merge branch 'octeontx2-af-CPT'" tcp: fix rate_app_limited to default to 1 bnxt: Do not read past the end of test names net: stmmac: enable all safety features by default octeontx2-af: add mbox to return CPT_AF_FLT_INT info octeontx2-af: update cpt lf alloc mailbox octeontx2-af: restore rxc conf after teardown sequence octeontx2-af: optimize cpt pf identification octeontx2-af: modify FLR sequence for CPT octeontx2-af: add mbox for CPT LF reset octeontx2-af: recover CPT engine when it gets fault net: dsa: microchip: ksz9477: port map correction in ALU table entry register selftests/net: toeplitz: fix race on tpacket_v3 block close net/ulp: use consistent error code when blocking ULP octeontx2-pf: Fix the use of GFP_KERNEL in atomic context on rt tcp: avoid the lookup process failing to get sk in ehash table Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf" MAINTAINERS: add networking entries for Willem net: sched: gred: prevent races when adding offloads to stats l2tp: prevent lockdep issue in l2tp_tunnel_register() ...

Linus Torvalds committed 3 years ago

Commit 5deaa982 parents 4a0c7a6 45a919b90 files · +804 −560Browse files

Unified · Split

90 files
  1. MAINTAINERS +20 −1
  2. drivers/bluetooth/hci_qca.c +7 −0
  3. drivers/net/dsa/microchip/ksz9477.c +2 −2
  4. drivers/net/ethernet/amd/xgbe/xgbe-dev.c +15 −8
  5. drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +24 −0
  6. drivers/net/ethernet/amd/xgbe/xgbe.h +2 −0
  7. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +4 −9
  8. drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +1 −8
  9. drivers/net/ethernet/cadence/macb_main.c +1 −8
  10. drivers/net/ethernet/freescale/enetc/enetc.c +2 −2
  11. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +2 −9
  12. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 −0
  13. drivers/net/ethernet/mellanox/mlx5/core/en/htb.c +2 −2
  14. drivers/net/ethernet/mellanox/mlx5/core/en/params.c +1 −2
  15. drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c +2 −3
  16. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +2 −5
  17. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +6 −6
  18. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 −0
  19. drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +3 −15
  20. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 −0
  21. drivers/net/ethernet/mellanox/mlx5/core/health.c +1 −0
  22. drivers/net/ethernet/mellanox/mlx5/core/main.c +4 −4
  23. drivers/net/ethernet/mellanox/mlx5/core/qos.c +1 −2
  24. drivers/net/ethernet/mellanox/mlx5/core/qos.h +1 −1
  25. drivers/net/ethernet/microchip/lan966x/lan966x_main.c +8 −5
  26. drivers/net/ethernet/stmicro/stmmac/dwmac5.c +14 −0
  27. drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +4 −4
  28. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 −0
  29. drivers/net/ipa/ipa_interrupt.c +10 −0
  30. drivers/net/ipa/ipa_interrupt.h +16 −0
  31. drivers/net/ipa/ipa_power.c +17 −0
  32. drivers/net/phy/mdio_bus.c +6 −1
  33. drivers/net/team/team.c +0 −2
  34. drivers/net/usb/sr9700.c +1 −1
  35. drivers/net/virtio_net.c +4 −2
  36. drivers/net/wan/fsl_ucc_hdlc.c +4 −2
  37. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +19 −18
  38. drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +1 −1
  39. drivers/net/wireless/mediatek/mt76/dma.c +80 −51
  40. drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +7 −0
  41. drivers/net/wireless/mediatek/mt76/tx.c +4 −3
  42. drivers/net/wireless/rndis_wlan.c +6 −13
  43. include/linux/bpf.h +1 −1
  44. include/net/mac80211.h +0 −4
  45. include/net/sch_generic.h +7 −0
  46. kernel/bpf/hashtab.c +2 −2
  47. kernel/bpf/offload.c +0 −3
  48. kernel/bpf/syscall.c +7 −17
  49. kernel/bpf/verifier.c +9 −1
  50. kernel/trace/bpf_trace.c +3 −0
  51. net/bluetooth/hci_conn.c +14 −4
  52. net/bluetooth/hci_event.c +4 −1
  53. net/bluetooth/hci_sync.c +6 −13
  54. net/bluetooth/iso.c +26 −38
  55. net/bluetooth/mgmt_util.h +1 −1
  56. net/bluetooth/rfcomm/sock.c +6 −1
  57. net/ethtool/rss.c +7 −4
  58. net/ipv4/inet_hashtables.c +15 −2
  59. net/ipv4/inet_timewait_sock.c +4 −4
  60. net/ipv4/tcp.c +2 −0
  61. net/ipv4/tcp_ulp.c +1 −1
  62. net/l2tp/l2tp_core.c +50 −52
  63. net/mac80211/agg-tx.c +5 −3
  64. net/mac80211/cfg.c +7 −0
  65. net/mac80211/debugfs_sta.c +3 −2
  66. net/mac80211/driver-ops.c +3 −0
  67. net/mac80211/driver-ops.h +1 −1
  68. net/mac80211/ht.c +31 −0
  69. net/mac80211/ieee80211_i.h +1 −1
  70. net/mac80211/iface.c +3 −2
  71. net/mac80211/rx.c +102 −123
  72. net/mac80211/tx.c +17 −17
  73. net/mac80211/util.c +3 −39
  74. net/mptcp/pm.c +25 −0
  75. net/mptcp/pm_userspace.c +7 −0
  76. net/mptcp/protocol.c +1 −1
  77. net/mptcp/protocol.h +5 −1
  78. net/mptcp/subflow.c +5 −4
  79. net/netfilter/ipset/ip_set_bitmap_ip.c +2 −2
  80. net/netfilter/nf_conntrack_proto_tcp.c +15 −0
  81. net/netfilter/nft_payload.c +1 −1
  82. net/nfc/llcp_core.c +1 −0
  83. net/rxrpc/call_object.c +1 −1
  84. net/sched/sch_gred.c +2 −0
  85. net/sched/sch_htb.c +16 −11
  86. net/sched/sch_taprio.c +3 −0
  87. tools/testing/selftests/net/mptcp/userspace_pm.sh +47 −0
  88. tools/testing/selftests/net/toeplitz.c +7 −5
  89. tools/testing/selftests/netfilter/nft_trans_stress.sh +9 −7
  90. tools/testing/selftests/netfilter/settings +1 −0
MAINTAINERS+20−1
@@ -1104,7 +1104,6 @@ S: Supported · 1103 unmodified lines
1104F: arch/arm64/boot/dts/amd/1104F: arch/arm64/boot/dts/amd/
1105 1105
1106AMD XGBE DRIVER1106AMD XGBE DRIVER
1107M: Tom Lendacky <thomas.lendacky@amd.com>
1108M: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>1107M: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>
1109L: netdev@vger.kernel.org1108L: netdev@vger.kernel.org
1110S: Supported1109S: Supported
@@ -15750,6 +15749,12 @@ S: Maintained · 14639 unmodified lines
15750W: https://wireless.wiki.kernel.org/en/users/Drivers/p5415749W: https://wireless.wiki.kernel.org/en/users/Drivers/p54
15751F: drivers/net/wireless/intersil/p54/15750F: drivers/net/wireless/intersil/p54/
15752 15751
15752PACKET SOCKETS
15753M: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
15754S: Maintained
15755F: include/uapi/linux/if_packet.h
15756F: net/packet/af_packet.c
15757
15753PACKING15758PACKING
15754M: Vladimir Oltean <olteanv@gmail.com>15759M: Vladimir Oltean <olteanv@gmail.com>
15755L: netdev@vger.kernel.org15760L: netdev@vger.kernel.org
@@ -19326,6 +19331,13 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers) · 3570 unmodified lines
19326S: Orphan19331S: Orphan
19327F: sound/soc/uniphier/19332F: sound/soc/uniphier/
19328 19333
19334SOCKET TIMESTAMPING
19335M: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
19336S: Maintained
19337F: Documentation/networking/timestamping.rst
19338F: include/uapi/linux/net_tstamp.h
19339F: tools/testing/selftests/net/so_txtime.c
19340
19329SOEKRIS NET48XX LED SUPPORT19341SOEKRIS NET48XX LED SUPPORT
19330M: Chris Boot <bootc@bootc.net>19342M: Chris Boot <bootc@bootc.net>
19331S: Maintained19343S: Maintained
@@ -21746,6 +21758,13 @@ T: git git://linuxtv.org/media_tree.git · 2414 unmodified lines
21746F: Documentation/admin-guide/media/zr364xx*21758F: Documentation/admin-guide/media/zr364xx*
21747F: drivers/staging/media/deprecated/zr364xx/21759F: drivers/staging/media/deprecated/zr364xx/
21748 21760
21761USER DATAGRAM PROTOCOL (UDP)
21762M: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
21763S: Maintained
21764F: include/linux/udp.h
21765F: net/ipv4/udp.c
21766F: net/ipv6/udp.c
21767
21749USER-MODE LINUX (UML)21768USER-MODE LINUX (UML)
21750M: Richard Weinberger <richard@nod.at>21769M: Richard Weinberger <richard@nod.at>
21751M: Anton Ivanov <anton.ivanov@cambridgegreys.com>21770M: Anton Ivanov <anton.ivanov@cambridgegreys.com>
drivers/bluetooth/hci_qca.c+7−0
@@ -2164,10 +2164,17 @@ static void qca_serdev_shutdown(struct device *dev) · 2163 unmodified lines
2164 int timeout = msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS);2164 int timeout = msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS);
2165 struct serdev_device *serdev = to_serdev_device(dev);2165 struct serdev_device *serdev = to_serdev_device(dev);
2166 struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);2166 struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
2167 struct hci_uart *hu = &qcadev->serdev_hu;
2168 struct hci_dev *hdev = hu->hdev;
2169 struct qca_data *qca = hu->priv;
2167 const u8 ibs_wake_cmd[] = { 0xFD };2170 const u8 ibs_wake_cmd[] = { 0xFD };
2168 const u8 edl_reset_soc_cmd[] = { 0x01, 0x00, 0xFC, 0x01, 0x05 };2171 const u8 edl_reset_soc_cmd[] = { 0x01, 0x00, 0xFC, 0x01, 0x05 };
2169 2172
2170 if (qcadev->btsoc_type == QCA_QCA6390) {2173 if (qcadev->btsoc_type == QCA_QCA6390) {
2174 if (test_bit(QCA_BT_OFF, &qca->flags) ||
2175 !test_bit(HCI_RUNNING, &hdev->flags))
2176 return;
2177
2171 serdev_device_write_flush(serdev);2178 serdev_device_write_flush(serdev);
2172 ret = serdev_device_write_buf(serdev, ibs_wake_cmd,2179 ret = serdev_device_write_buf(serdev, ibs_wake_cmd,
2173 sizeof(ibs_wake_cmd));2180 sizeof(ibs_wake_cmd));
drivers/net/dsa/microchip/ksz9477.c+2−2
@@ -540,10 +540,10 @@ int ksz9477_fdb_del(struct ksz_device *dev, int port, · 539 unmodified lines
540 ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]);540 ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]);
541 541
542 /* clear forwarding port */542 /* clear forwarding port */
543 alu_table[2] &= ~BIT(port);543 alu_table[1] &= ~BIT(port);
544 544
545 /* if there is no port to forward, clear table */545 /* if there is no port to forward, clear table */
546 if ((alu_table[2] & ALU_V_PORT_MAP) == 0) {546 if ((alu_table[1] & ALU_V_PORT_MAP) == 0) {
547 alu_table[0] = 0;547 alu_table[0] = 0;
548 alu_table[1] = 0;548 alu_table[1] = 0;
549 alu_table[2] = 0;549 alu_table[2] = 0;
drivers/net/ethernet/amd/xgbe/xgbe-dev.c+15−8
@@ -524,19 +524,28 @@ static void xgbe_disable_vxlan(struct xgbe_prv_data *pdata) · 523 unmodified lines
524 netif_dbg(pdata, drv, pdata->netdev, "VXLAN acceleration disabled\n");524 netif_dbg(pdata, drv, pdata->netdev, "VXLAN acceleration disabled\n");
525}525}
526 526
527static unsigned int xgbe_get_fc_queue_count(struct xgbe_prv_data *pdata)
528{
529 unsigned int max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
530
531 /* From MAC ver 30H the TFCR is per priority, instead of per queue */
532 if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) >= 0x30)
533 return max_q_count;
534 else
535 return min_t(unsigned int, pdata->tx_q_count, max_q_count);
536}
537
527static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata)538static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata)
528{539{
529 unsigned int max_q_count, q_count;
530 unsigned int reg, reg_val;540 unsigned int reg, reg_val;
531 unsigned int i;541 unsigned int i, q_count;
532 542
533 /* Clear MTL flow control */543 /* Clear MTL flow control */
534 for (i = 0; i < pdata->rx_q_count; i++)544 for (i = 0; i < pdata->rx_q_count; i++)
535 XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0);545 XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0);
536 546
537 /* Clear MAC flow control */547 /* Clear MAC flow control */
538 max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;548 q_count = xgbe_get_fc_queue_count(pdata);
539 q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
540 reg = MAC_Q0TFCR;549 reg = MAC_Q0TFCR;
541 for (i = 0; i < q_count; i++) {550 for (i = 0; i < q_count; i++) {
542 reg_val = XGMAC_IOREAD(pdata, reg);551 reg_val = XGMAC_IOREAD(pdata, reg);
@@ -553,9 +562,8 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) · 10 unmodified lines
553{562{
554 struct ieee_pfc *pfc = pdata->pfc;563 struct ieee_pfc *pfc = pdata->pfc;
555 struct ieee_ets *ets = pdata->ets;564 struct ieee_ets *ets = pdata->ets;
556 unsigned int max_q_count, q_count;
557 unsigned int reg, reg_val;565 unsigned int reg, reg_val;
558 unsigned int i;566 unsigned int i, q_count;
559 567
560 /* Set MTL flow control */568 /* Set MTL flow control */
561 for (i = 0; i < pdata->rx_q_count; i++) {569 for (i = 0; i < pdata->rx_q_count; i++) {
@@ -579,8 +587,7 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) · 17 unmodified lines
579 }587 }
580 588
581 /* Set MAC flow control */589 /* Set MAC flow control */
582 max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;590 q_count = xgbe_get_fc_queue_count(pdata);
583 q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
584 reg = MAC_Q0TFCR;591 reg = MAC_Q0TFCR;
585 for (i = 0; i < q_count; i++) {592 for (i = 0; i < q_count; i++) {
586 reg_val = XGMAC_IOREAD(pdata, reg);593 reg_val = XGMAC_IOREAD(pdata, reg);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c+24−0
@@ -496,6 +496,7 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata, · 495 unmodified lines
496 reg |= XGBE_KR_TRAINING_ENABLE;496 reg |= XGBE_KR_TRAINING_ENABLE;
497 reg |= XGBE_KR_TRAINING_START;497 reg |= XGBE_KR_TRAINING_START;
498 XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg);498 XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg);
499 pdata->kr_start_time = jiffies;
499 500
500 netif_dbg(pdata, link, pdata->netdev,501 netif_dbg(pdata, link, pdata->netdev,
501 "KR training initiated\n");502 "KR training initiated\n");
@@ -632,6 +633,8 @@ static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata) · 130 unmodified lines
632 633
633 xgbe_switch_mode(pdata);634 xgbe_switch_mode(pdata);
634 635
636 pdata->an_result = XGBE_AN_READY;
637
635 xgbe_an_restart(pdata);638 xgbe_an_restart(pdata);
636 639
637 return XGBE_AN_INCOMPAT_LINK;640 return XGBE_AN_INCOMPAT_LINK;
@@ -1275,9 +1278,30 @@ static bool xgbe_phy_aneg_done(struct xgbe_prv_data *pdata) · 637 unmodified lines
1275static void xgbe_check_link_timeout(struct xgbe_prv_data *pdata)1278static void xgbe_check_link_timeout(struct xgbe_prv_data *pdata)
1276{1279{
1277 unsigned long link_timeout;1280 unsigned long link_timeout;
1281 unsigned long kr_time;
1282 int wait;
1278 1283
1279 link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ);1284 link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ);
1280 if (time_after(jiffies, link_timeout)) {1285 if (time_after(jiffies, link_timeout)) {
1286 if ((xgbe_cur_mode(pdata) == XGBE_MODE_KR) &&
1287 pdata->phy.autoneg == AUTONEG_ENABLE) {
1288 /* AN restart should not happen while KR training is in progress.
1289 * The while loop ensures no AN restart during KR training,
1290 * waits up to 500ms and AN restart is triggered only if KR
1291 * training is failed.
1292 */
1293 wait = XGBE_KR_TRAINING_WAIT_ITER;
1294 while (wait--) {
1295 kr_time = pdata->kr_start_time +
1296 msecs_to_jiffies(XGBE_AN_MS_TIMEOUT);
1297 if (time_after(jiffies, kr_time))
1298 break;
1299 /* AN restart is not required, if AN result is COMPLETE */
1300 if (pdata->an_result == XGBE_AN_COMPLETE)
1301 return;
1302 usleep_range(10000, 11000);
1303 }
1304 }
1281 netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n");1305 netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n");
1282 xgbe_phy_config_aneg(pdata);1306 xgbe_phy_config_aneg(pdata);
1283 }1307 }
drivers/net/ethernet/amd/xgbe/xgbe.h+2−0
@@ -290,6 +290,7 @@ · 289 unmodified lines
290/* Auto-negotiation */290/* Auto-negotiation */
291#define XGBE_AN_MS_TIMEOUT 500291#define XGBE_AN_MS_TIMEOUT 500
292#define XGBE_LINK_TIMEOUT 5292#define XGBE_LINK_TIMEOUT 5
293#define XGBE_KR_TRAINING_WAIT_ITER 50
293 294
294#define XGBE_SGMII_AN_LINK_STATUS BIT(1)295#define XGBE_SGMII_AN_LINK_STATUS BIT(1)
295#define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3))296#define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3))
@@ -1280,6 +1281,7 @@ struct xgbe_prv_data { · 984 unmodified lines
1280 unsigned int parallel_detect;1281 unsigned int parallel_detect;
1281 unsigned int fec_ability;1282 unsigned int fec_ability;
1282 unsigned long an_start;1283 unsigned long an_start;
1284 unsigned long kr_start_time;
1283 enum xgbe_an_mode an_mode;1285 enum xgbe_an_mode an_mode;
1284 1286
1285 /* I2C support */1287 /* I2C support */
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+4−9
@@ -3969,7 +3969,7 @@ void bnxt_ethtool_init(struct bnxt *bp) · 3968 unmodified lines
3969 test_info->timeout = HWRM_CMD_TIMEOUT;3969 test_info->timeout = HWRM_CMD_TIMEOUT;
3970 for (i = 0; i < bp->num_tests; i++) {3970 for (i = 0; i < bp->num_tests; i++) {
3971 char *str = test_info->string[i];3971 char *str = test_info->string[i];
3972 char *fw_str = resp->test0_name + i * 32;3972 char *fw_str = resp->test_name[i];
3973 3973
3974 if (i == BNXT_MACLPBK_TEST_IDX) {3974 if (i == BNXT_MACLPBK_TEST_IDX) {
3975 strcpy(str, "Mac loopback test (offline)");3975 strcpy(str, "Mac loopback test (offline)");
@@ -3980,14 +3980,9 @@ void bnxt_ethtool_init(struct bnxt *bp) · 4 unmodified lines
3980 } else if (i == BNXT_IRQ_TEST_IDX) {3980 } else if (i == BNXT_IRQ_TEST_IDX) {
3981 strcpy(str, "Interrupt_test (offline)");3981 strcpy(str, "Interrupt_test (offline)");
3982 } else {3982 } else {
3983 strscpy(str, fw_str, ETH_GSTRING_LEN);3983 snprintf(str, ETH_GSTRING_LEN, "%s test (%s)",
3984 strncat(str, " test", ETH_GSTRING_LEN - strlen(str));3984 fw_str, test_info->offline_mask & (1 << i) ?
3985 if (test_info->offline_mask & (1 << i))3985 "offline" : "online");
3986 strncat(str, " (offline)",
3987 ETH_GSTRING_LEN - strlen(str));
3988 else
3989 strncat(str, " (online)",
3990 ETH_GSTRING_LEN - strlen(str));
3991 }3986 }
3992 }3987 }
3993 3988
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h+1−8
@@ -10249,14 +10249,7 @@ struct hwrm_selftest_qlist_output { · 10248 unmodified lines
10249 u8 unused_0;10249 u8 unused_0;
10250 __le16 test_timeout;10250 __le16 test_timeout;
10251 u8 unused_1[2];10251 u8 unused_1[2];
10252 char test0_name[32];10252 char test_name[8][32];
10253 char test1_name[32];
10254 char test2_name[32];
10255 char test3_name[32];
10256 char test4_name[32];
10257 char test5_name[32];
10258 char test6_name[32];
10259 char test7_name[32];
10260 u8 eyescope_target_BER_support;10253 u8 eyescope_target_BER_support;
10261 #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E8_SUPPORTED 0x0UL10254 #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E8_SUPPORTED 0x0UL
10262 #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E9_SUPPORTED 0x1UL10255 #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E9_SUPPORTED 0x1UL
drivers/net/ethernet/cadence/macb_main.c+1−8
@@ -2187,7 +2187,6 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 2186 unmodified lines
2187 bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) ||2187 bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) ||
2188 skb_is_nonlinear(*skb);2188 skb_is_nonlinear(*skb);
2189 int padlen = ETH_ZLEN - (*skb)->len;2189 int padlen = ETH_ZLEN - (*skb)->len;
2190 int headroom = skb_headroom(*skb);
2191 int tailroom = skb_tailroom(*skb);2190 int tailroom = skb_tailroom(*skb);
2192 struct sk_buff *nskb;2191 struct sk_buff *nskb;
2193 u32 fcs;2192 u32 fcs;
@@ -2201,9 +2200,6 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 7 unmodified lines
2201 /* FCS could be appeded to tailroom. */2200 /* FCS could be appeded to tailroom. */
2202 if (tailroom >= ETH_FCS_LEN)2201 if (tailroom >= ETH_FCS_LEN)
2203 goto add_fcs;2202 goto add_fcs;
2204 /* FCS could be appeded by moving data to headroom. */
2205 else if (!cloned && headroom + tailroom >= ETH_FCS_LEN)
2206 padlen = 0;
2207 /* No room for FCS, need to reallocate skb. */2203 /* No room for FCS, need to reallocate skb. */
2208 else2204 else
2209 padlen = ETH_FCS_LEN;2205 padlen = ETH_FCS_LEN;
@@ -2212,10 +2208,7 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 2 unmodified lines
2212 padlen += ETH_FCS_LEN;2208 padlen += ETH_FCS_LEN;
2213 }2209 }
2214 2210
2215 if (!cloned && headroom + tailroom >= padlen) {2211 if (cloned || tailroom < padlen) {
2216 (*skb)->data = memmove((*skb)->head, (*skb)->data, (*skb)->len);
2217 skb_set_tail_pointer(*skb, (*skb)->len);
2218 } else {
2219 nskb = skb_copy_expand(*skb, 0, padlen, GFP_ATOMIC);2212 nskb = skb_copy_expand(*skb, 0, padlen, GFP_ATOMIC);
2220 if (!nskb)2213 if (!nskb)
2221 return -ENOMEM;2214 return -ENOMEM;
drivers/net/ethernet/freescale/enetc/enetc.c+2−2
@@ -2290,14 +2290,14 @@ static void enetc_tx_onestep_tstamp(struct work_struct *work) · 2289 unmodified lines
2290 2290
2291 priv = container_of(work, struct enetc_ndev_priv, tx_onestep_tstamp);2291 priv = container_of(work, struct enetc_ndev_priv, tx_onestep_tstamp);
2292 2292
2293 netif_tx_lock(priv->ndev);2293 netif_tx_lock_bh(priv->ndev);
2294 2294
2295 clear_bit_unlock(ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS, &priv->flags);2295 clear_bit_unlock(ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS, &priv->flags);
2296 skb = skb_dequeue(&priv->tx_skbs);2296 skb = skb_dequeue(&priv->tx_skbs);
2297 if (skb)2297 if (skb)
2298 enetc_start_xmit(skb, priv->ndev);2298 enetc_start_xmit(skb, priv->ndev);
2299 2299
2300 netif_tx_unlock(priv->ndev);2300 netif_tx_unlock_bh(priv->ndev);
2301}2301}
2302 2302
2303static void enetc_tx_onestep_tstamp_init(struct enetc_ndev_priv *priv)2303static void enetc_tx_onestep_tstamp_init(struct enetc_ndev_priv *priv)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c+2−9
@@ -1012,7 +1012,6 @@ static void otx2_pool_refill_task(struct work_struct *work) · 1011 unmodified lines
1012 rbpool = cq->rbpool;1012 rbpool = cq->rbpool;
1013 free_ptrs = cq->pool_ptrs;1013 free_ptrs = cq->pool_ptrs;
1014 1014
1015 get_cpu();
1016 while (cq->pool_ptrs) {1015 while (cq->pool_ptrs) {
1017 if (otx2_alloc_rbuf(pfvf, rbpool, &bufptr)) {1016 if (otx2_alloc_rbuf(pfvf, rbpool, &bufptr)) {
1018 /* Schedule a WQ if we fails to free atleast half of the1017 /* Schedule a WQ if we fails to free atleast half of the
@@ -1032,7 +1031,6 @@ static void otx2_pool_refill_task(struct work_struct *work) · 13 unmodified lines
1032 pfvf->hw_ops->aura_freeptr(pfvf, qidx, bufptr + OTX2_HEAD_ROOM);1031 pfvf->hw_ops->aura_freeptr(pfvf, qidx, bufptr + OTX2_HEAD_ROOM);
1033 cq->pool_ptrs--;1032 cq->pool_ptrs--;
1034 }1033 }
1035 put_cpu();
1036 cq->refill_task_sched = false;1034 cq->refill_task_sched = false;
1037}1035}
1038 1036
@@ -1370,7 +1368,6 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) · 331 unmodified lines
1370 if (err)1368 if (err)
1371 goto fail;1369 goto fail;
1372 1370
1373 get_cpu();
1374 /* Allocate pointers and free them to aura/pool */1371 /* Allocate pointers and free them to aura/pool */
1375 for (qidx = 0; qidx < hw->tot_tx_queues; qidx++) {1372 for (qidx = 0; qidx < hw->tot_tx_queues; qidx++) {
1376 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx);1373 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx);
@@ -1394,7 +1391,6 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) · 17 unmodified lines
1394 }1391 }
1395 1392
1396err_mem:1393err_mem:
1397 put_cpu();
1398 return err ? -ENOMEM : 0;1394 return err ? -ENOMEM : 0;
1399 1395
1400fail:1396fail:
@@ -1435,21 +1431,18 @@ int otx2_rq_aura_pool_init(struct otx2_nic *pfvf) · 34 unmodified lines
1435 if (err)1431 if (err)
1436 goto fail;1432 goto fail;
1437 1433
1438 get_cpu();
1439 /* Allocate pointers and free them to aura/pool */1434 /* Allocate pointers and free them to aura/pool */
1440 for (pool_id = 0; pool_id < hw->rqpool_cnt; pool_id++) {1435 for (pool_id = 0; pool_id < hw->rqpool_cnt; pool_id++) {
1441 pool = &pfvf->qset.pool[pool_id];1436 pool = &pfvf->qset.pool[pool_id];
1442 for (ptr = 0; ptr < num_ptrs; ptr++) {1437 for (ptr = 0; ptr < num_ptrs; ptr++) {
1443 err = otx2_alloc_rbuf(pfvf, pool, &bufptr);1438 err = otx2_alloc_rbuf(pfvf, pool, &bufptr);
1444 if (err)1439 if (err)
1445 goto err_mem;1440 return -ENOMEM;
1446 pfvf->hw_ops->aura_freeptr(pfvf, pool_id,1441 pfvf->hw_ops->aura_freeptr(pfvf, pool_id,
1447 bufptr + OTX2_HEAD_ROOM);1442 bufptr + OTX2_HEAD_ROOM);
1448 }1443 }
1449 }1444 }
1450err_mem:1445 return 0;
1451 put_cpu();
1452 return err ? -ENOMEM : 0;
1453fail:1446fail:
1454 otx2_mbox_reset(&pfvf->mbox.mbox, 0);1447 otx2_mbox_reset(&pfvf->mbox.mbox, 0);
1455 otx2_aura_pool_free(pfvf);1448 otx2_aura_pool_free(pfvf);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h+2−0
@@ -736,8 +736,10 @@ static inline void cn10k_aura_freeptr(void *dev, int aura, u64 buf) · 735 unmodified lines
736 u64 ptrs[2];736 u64 ptrs[2];
737 737
738 ptrs[1] = buf;738 ptrs[1] = buf;
739 get_cpu();
739 /* Free only one buffer at time during init and teardown */740 /* Free only one buffer at time during init and teardown */
740 __cn10k_aura_freeptr(pfvf, aura, ptrs, 2);741 __cn10k_aura_freeptr(pfvf, aura, ptrs, 2);
742 put_cpu();
741}743}
742 744
743/* Alloc pointer from pool/aura */745/* Alloc pointer from pool/aura */
drivers/net/ethernet/mellanox/mlx5/core/en/htb.c+2−2
@@ -637,7 +637,7 @@ mlx5e_htb_update_children(struct mlx5e_htb *htb, struct mlx5e_qos_node *node, · 636 unmodified lines
637 if (child->bw_share == old_bw_share)637 if (child->bw_share == old_bw_share)
638 continue;638 continue;
639 639
640 err_one = mlx5_qos_update_node(htb->mdev, child->hw_id, child->bw_share,640 err_one = mlx5_qos_update_node(htb->mdev, child->bw_share,
641 child->max_average_bw, child->hw_id);641 child->max_average_bw, child->hw_id);
642 if (!err && err_one) {642 if (!err && err_one) {
643 err = err_one;643 err = err_one;
@@ -671,7 +671,7 @@ mlx5e_htb_node_modify(struct mlx5e_htb *htb, u16 classid, u64 rate, u64 ceil, · 27 unmodified lines
671 mlx5e_htb_convert_rate(htb, rate, node->parent, &bw_share);671 mlx5e_htb_convert_rate(htb, rate, node->parent, &bw_share);
672 mlx5e_htb_convert_ceil(htb, ceil, &max_average_bw);672 mlx5e_htb_convert_ceil(htb, ceil, &max_average_bw);
673 673
674 err = mlx5_qos_update_node(htb->mdev, node->parent->hw_id, bw_share,674 err = mlx5_qos_update_node(htb->mdev, bw_share,
675 max_average_bw, node->hw_id);675 max_average_bw, node->hw_id);
676 if (err) {676 if (err) {
677 NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a node.");677 NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a node.");
drivers/net/ethernet/mellanox/mlx5/core/en/params.c+1−2
@@ -578,7 +578,6 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa · 577 unmodified lines
578{578{
579 enum mlx5e_mpwrq_umr_mode umr_mode = mlx5e_mpwrq_umr_mode(mdev, xsk);579 enum mlx5e_mpwrq_umr_mode umr_mode = mlx5e_mpwrq_umr_mode(mdev, xsk);
580 u8 page_shift = mlx5e_mpwrq_page_shift(mdev, xsk);580 u8 page_shift = mlx5e_mpwrq_page_shift(mdev, xsk);
581 bool unaligned = xsk ? xsk->unaligned : false;
582 u16 max_mtu_pkts;581 u16 max_mtu_pkts;
583 582
584 if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, umr_mode))583 if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, umr_mode))
@@ -591,7 +590,7 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa · 6 unmodified lines
591 * needed number of WQEs exceeds the maximum.590 * needed number of WQEs exceeds the maximum.
592 */591 */
593 max_mtu_pkts = min_t(u8, MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE,592 max_mtu_pkts = min_t(u8, MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE,
594 mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, unaligned));593 mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, xsk->unaligned));
595 if (params->log_rq_mtu_frames > max_mtu_pkts) {594 if (params->log_rq_mtu_frames > max_mtu_pkts) {
596 mlx5_core_err(mdev, "Current RQ length %d is too big for XSK with given frame size %u\n",595 mlx5_core_err(mdev, "Current RQ length %d is too big for XSK with given frame size %u\n",
597 1 << params->log_rq_mtu_frames, xsk->chunk_size);596 1 << params->log_rq_mtu_frames, xsk->chunk_size);
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c+2−3
@@ -477,7 +477,6 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 476 unmodified lines
477 struct mlx5e_sample_flow *sample_flow;477 struct mlx5e_sample_flow *sample_flow;
478 struct mlx5e_sample_attr *sample_attr;478 struct mlx5e_sample_attr *sample_attr;
479 struct mlx5_flow_attr *pre_attr;479 struct mlx5_flow_attr *pre_attr;
480 u32 tunnel_id = attr->tunnel_id;
481 struct mlx5_eswitch *esw;480 struct mlx5_eswitch *esw;
482 u32 default_tbl_id;481 u32 default_tbl_id;
483 u32 obj_id;482 u32 obj_id;
@@ -522,7 +521,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 38 unmodified lines
522 restore_obj.sample.group_id = sample_attr->group_num;521 restore_obj.sample.group_id = sample_attr->group_num;
523 restore_obj.sample.rate = sample_attr->rate;522 restore_obj.sample.rate = sample_attr->rate;
524 restore_obj.sample.trunc_size = sample_attr->trunc_size;523 restore_obj.sample.trunc_size = sample_attr->trunc_size;
525 restore_obj.sample.tunnel_id = tunnel_id;524 restore_obj.sample.tunnel_id = attr->tunnel_id;
526 err = mapping_add(esw->offloads.reg_c0_obj_pool, &restore_obj, &obj_id);525 err = mapping_add(esw->offloads.reg_c0_obj_pool, &restore_obj, &obj_id);
527 if (err)526 if (err)
528 goto err_obj_id;527 goto err_obj_id;
@@ -548,7 +547,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 19 unmodified lines
548 /* For decap action, do decap in the original flow table instead of the547 /* For decap action, do decap in the original flow table instead of the
549 * default flow table.548 * default flow table.
550 */549 */
551 if (tunnel_id)550 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_DECAP)
552 pre_attr->action |= MLX5_FLOW_CONTEXT_ACTION_DECAP;551 pre_attr->action |= MLX5_FLOW_CONTEXT_ACTION_DECAP;
553 pre_attr->modify_hdr = sample_flow->restore->modify_hdr;552 pre_attr->modify_hdr = sample_flow->restore->modify_hdr;
554 pre_attr->flags = MLX5_ATTR_FLAG_SAMPLE;553 pre_attr->flags = MLX5_ATTR_FLAG_SAMPLE;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h+2−5
@@ -122,11 +122,8 @@ struct mlx5e_ipsec_aso { · 121 unmodified lines
122 u8 ctx[MLX5_ST_SZ_BYTES(ipsec_aso)];122 u8 ctx[MLX5_ST_SZ_BYTES(ipsec_aso)];
123 dma_addr_t dma_addr;123 dma_addr_t dma_addr;
124 struct mlx5_aso *aso;124 struct mlx5_aso *aso;
125 /* IPsec ASO caches data on every query call,125 /* Protect ASO WQ access, as it is global to whole IPsec */
126 * so in nested calls, we can use this boolean to save126 spinlock_t lock;
127 * recursive calls to mlx5e_ipsec_aso_query()
128 */
129 u8 use_cache : 1;
130};127};
131 128
132struct mlx5e_ipsec {129struct mlx5e_ipsec {
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c+6−6
@@ -320,7 +320,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work) · 319 unmodified lines
320 if (ret)320 if (ret)
321 goto unlock;321 goto unlock;
322 322
323 aso->use_cache = true;
324 if (attrs->esn_trigger &&323 if (attrs->esn_trigger &&
325 !MLX5_GET(ipsec_aso, aso->ctx, esn_event_arm)) {324 !MLX5_GET(ipsec_aso, aso->ctx, esn_event_arm)) {
326 u32 mode_param = MLX5_GET(ipsec_aso, aso->ctx, mode_parameter);325 u32 mode_param = MLX5_GET(ipsec_aso, aso->ctx, mode_parameter);
@@ -333,7 +332,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work) · 6 unmodified lines
333 !MLX5_GET(ipsec_aso, aso->ctx, hard_lft_arm) ||332 !MLX5_GET(ipsec_aso, aso->ctx, hard_lft_arm) ||
334 !MLX5_GET(ipsec_aso, aso->ctx, remove_flow_enable))333 !MLX5_GET(ipsec_aso, aso->ctx, remove_flow_enable))
335 xfrm_state_check_expire(sa_entry->x);334 xfrm_state_check_expire(sa_entry->x);
336 aso->use_cache = false;
337 335
338unlock:336unlock:
339 spin_unlock(&sa_entry->x->lock);337 spin_unlock(&sa_entry->x->lock);
@@ -398,6 +396,7 @@ int mlx5e_ipsec_aso_init(struct mlx5e_ipsec *ipsec) · 58 unmodified lines
398 goto err_aso_create;396 goto err_aso_create;
399 }397 }
400 398
399 spin_lock_init(&aso->lock);
401 ipsec->nb.notifier_call = mlx5e_ipsec_event;400 ipsec->nb.notifier_call = mlx5e_ipsec_event;
402 mlx5_notifier_register(mdev, &ipsec->nb);401 mlx5_notifier_register(mdev, &ipsec->nb);
403 402
@@ -456,13 +455,12 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry, · 52 unmodified lines
456 struct mlx5e_hw_objs *res;455 struct mlx5e_hw_objs *res;
457 struct mlx5_aso_wqe *wqe;456 struct mlx5_aso_wqe *wqe;
458 u8 ds_cnt;457 u8 ds_cnt;
458 int ret;
459 459
460 lockdep_assert_held(&sa_entry->x->lock);460 lockdep_assert_held(&sa_entry->x->lock);
461 if (aso->use_cache)
462 return 0;
463
464 res = &mdev->mlx5e_res.hw_objs;461 res = &mdev->mlx5e_res.hw_objs;
465 462
463 spin_lock_bh(&aso->lock);
466 memset(aso->ctx, 0, sizeof(aso->ctx));464 memset(aso->ctx, 0, sizeof(aso->ctx));
467 wqe = mlx5_aso_get_wqe(aso->aso);465 wqe = mlx5_aso_get_wqe(aso->aso);
468 ds_cnt = DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS);466 ds_cnt = DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS);
@@ -477,7 +475,9 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry, · 8 unmodified lines
477 mlx5e_ipsec_aso_copy(ctrl, data);475 mlx5e_ipsec_aso_copy(ctrl, data);
478 476
479 mlx5_aso_post_wqe(aso->aso, false, &wqe->ctrl);477 mlx5_aso_post_wqe(aso->aso, false, &wqe->ctrl);
480 return mlx5_aso_poll_cq(aso->aso, false);478 ret = mlx5_aso_poll_cq(aso->aso, false);
479 spin_unlock_bh(&aso->lock);
480 return ret;
481}481}
482 482
483void mlx5e_ipsec_aso_update_curlft(struct mlx5e_ipsec_sa_entry *sa_entry,483void mlx5e_ipsec_aso_update_curlft(struct mlx5e_ipsec_sa_entry *sa_entry,
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+3−0
@@ -166,6 +166,7 @@ struct mlx5_fs_chains *mlx5e_nic_chains(struct mlx5e_tc_table *tc) · 165 unmodified lines
166 * it's different than the ht->mutex here.166 * it's different than the ht->mutex here.
167 */167 */
168static struct lock_class_key tc_ht_lock_key;168static struct lock_class_key tc_ht_lock_key;
169static struct lock_class_key tc_ht_wq_key;
169 170
170static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow);171static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow);
171static void free_flow_post_acts(struct mlx5e_tc_flow *flow);172static void free_flow_post_acts(struct mlx5e_tc_flow *flow);
@@ -5182,6 +5183,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv) · 5010 unmodified lines
5182 return err;5183 return err;
5183 5184
5184 lockdep_set_class(&tc->ht.mutex, &tc_ht_lock_key);5185 lockdep_set_class(&tc->ht.mutex, &tc_ht_lock_key);
5186 lockdep_init_map(&tc->ht.run_work.lockdep_map, "tc_ht_wq_key", &tc_ht_wq_key, 0);
5185 5187
5186 mapping_id = mlx5_query_nic_system_image_guid(dev);5188 mapping_id = mlx5_query_nic_system_image_guid(dev);
5187 5189
@@ -5288,6 +5290,7 @@ int mlx5e_tc_ht_init(struct rhashtable *tc_ht) · 100 unmodified lines
5288 return err;5290 return err;
5289 5291
5290 lockdep_set_class(&tc_ht->mutex, &tc_ht_lock_key);5292 lockdep_set_class(&tc_ht->mutex, &tc_ht_lock_key);
5293 lockdep_init_map(&tc_ht->run_work.lockdep_map, "tc_ht_wq_key", &tc_ht_wq_key, 0);
5291 5294
5292 return 0;5295 return 0;
5293}5296}
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c+3−15
@@ -22,15 +22,13 @@ struct mlx5_esw_rate_group { · 21 unmodified lines
22};22};
23 23
24static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx,24static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx,
25 u32 parent_ix, u32 tsar_ix,25 u32 tsar_ix, u32 max_rate, u32 bw_share)
26 u32 max_rate, u32 bw_share)
27{26{
28 u32 bitmask = 0;27 u32 bitmask = 0;
29 28
30 if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling))29 if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling))
31 return -EOPNOTSUPP;30 return -EOPNOTSUPP;
32 31
33 MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_ix);
34 MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate);32 MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate);
35 MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share);33 MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share);
36 bitmask |= MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW;34 bitmask |= MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW;
@@ -51,7 +49,7 @@ static int esw_qos_group_config(struct mlx5_eswitch *esw, struct mlx5_esw_rate_g · 14 unmodified lines
51 int err;49 int err;
52 50
53 err = esw_qos_tsar_config(dev, sched_ctx,51 err = esw_qos_tsar_config(dev, sched_ctx,
54 esw->qos.root_tsar_ix, group->tsar_ix,52 group->tsar_ix,
55 max_rate, bw_share);53 max_rate, bw_share);
56 if (err)54 if (err)
57 NL_SET_ERR_MSG_MOD(extack, "E-Switch modify group TSAR element failed");55 NL_SET_ERR_MSG_MOD(extack, "E-Switch modify group TSAR element failed");
@@ -67,23 +65,13 @@ static int esw_qos_vport_config(struct mlx5_eswitch *esw, · 9 unmodified lines
67 struct netlink_ext_ack *extack)65 struct netlink_ext_ack *extack)
68{66{
69 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};67 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
70 struct mlx5_esw_rate_group *group = vport->qos.group;
71 struct mlx5_core_dev *dev = esw->dev;68 struct mlx5_core_dev *dev = esw->dev;
72 u32 parent_tsar_ix;
73 void *vport_elem;
74 int err;69 int err;
75 70
76 if (!vport->qos.enabled)71 if (!vport->qos.enabled)
77 return -EIO;72 return -EIO;
78 73
79 parent_tsar_ix = group ? group->tsar_ix : esw->qos.root_tsar_ix;74 err = esw_qos_tsar_config(dev, sched_ctx, vport->qos.esw_tsar_ix,
80 MLX5_SET(scheduling_context, sched_ctx, element_type,
81 SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT);
82 vport_elem = MLX5_ADDR_OF(scheduling_context, sched_ctx,
83 element_attributes);
84 MLX5_SET(vport_element, vport_elem, vport_number, vport->vport);
85
86 err = esw_qos_tsar_config(dev, sched_ctx, parent_tsar_ix, vport->qos.esw_tsar_ix,
87 max_rate, bw_share);75 max_rate, bw_share);
88 if (err) {76 if (err) {
89 esw_warn(esw->dev,77 esw_warn(esw->dev,
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+1−0
@@ -1464,6 +1464,7 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw) · 1463 unmodified lines
1464 mlx5_lag_disable_change(esw->dev);1464 mlx5_lag_disable_change(esw->dev);
1465 down_write(&esw->mode_lock);1465 down_write(&esw->mode_lock);
1466 mlx5_eswitch_disable_locked(esw);1466 mlx5_eswitch_disable_locked(esw);
1467 esw->mode = MLX5_ESWITCH_LEGACY;
1467 up_write(&esw->mode_lock);1468 up_write(&esw->mode_lock);
1468 mlx5_lag_enable_change(esw->dev);1469 mlx5_lag_enable_change(esw->dev);
1469}1470}
drivers/net/ethernet/mellanox/mlx5/core/health.c+1−0
@@ -677,6 +677,7 @@ static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work) · 676 unmodified lines
677 mutex_lock(&dev->intf_state_mutex);677 mutex_lock(&dev->intf_state_mutex);
678 if (test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) {678 if (test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) {
679 mlx5_core_err(dev, "health works are not permitted at this stage\n");679 mlx5_core_err(dev, "health works are not permitted at this stage\n");
680 mutex_unlock(&dev->intf_state_mutex);
680 return;681 return;
681 }682 }
682 mutex_unlock(&dev->intf_state_mutex);683 mutex_unlock(&dev->intf_state_mutex);
drivers/net/ethernet/mellanox/mlx5/core/main.c+4−4
@@ -2098,7 +2098,7 @@ static void mlx5_core_verify_params(void) · 2097 unmodified lines
2098 }2098 }
2099}2099}
2100 2100
2101static int __init init(void)2101static int __init mlx5_init(void)
2102{2102{
2103 int err;2103 int err;
2104 2104
@@ -2133,7 +2133,7 @@ err_debug: · 28 unmodified lines
2133 return err;2133 return err;
2134}2134}
2135 2135
2136static void __exit cleanup(void)2136static void __exit mlx5_cleanup(void)
2137{2137{
2138 mlx5e_cleanup();2138 mlx5e_cleanup();
2139 mlx5_sf_driver_unregister();2139 mlx5_sf_driver_unregister();
@@ -2141,5 +2141,5 @@ static void __exit cleanup(void) · 1 unmodified line
2141 mlx5_unregister_debugfs();2141 mlx5_unregister_debugfs();
2142}2142}
2143 2143
2144module_init(init);2144module_init(mlx5_init);
2145module_exit(cleanup);2145module_exit(mlx5_cleanup);
drivers/net/ethernet/mellanox/mlx5/core/qos.c+1−2
@@ -62,13 +62,12 @@ int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id) · 61 unmodified lines
62 return mlx5_qos_create_inner_node(mdev, MLX5_QOS_DEFAULT_DWRR_UID, 0, 0, id);62 return mlx5_qos_create_inner_node(mdev, MLX5_QOS_DEFAULT_DWRR_UID, 0, 0, id);
63}63}
64 64
65int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 parent_id,65int mlx5_qos_update_node(struct mlx5_core_dev *mdev,
66 u32 bw_share, u32 max_avg_bw, u32 id)66 u32 bw_share, u32 max_avg_bw, u32 id)
67{67{
68 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0};68 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0};
69 u32 bitmask = 0;69 u32 bitmask = 0;
70 70
71 MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_id);
72 MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share);71 MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share);
73 MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_avg_bw);72 MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_avg_bw);
74 73
drivers/net/ethernet/mellanox/mlx5/core/qos.h+1−1
@@ -23,7 +23,7 @@ int mlx5_qos_create_leaf_node(struct mlx5_core_dev *mdev, u32 parent_id, · 22 unmodified lines
23int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id,23int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id,
24 u32 bw_share, u32 max_avg_bw, u32 *id);24 u32 bw_share, u32 max_avg_bw, u32 *id);
25int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id);25int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id);
26int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 parent_id, u32 bw_share,26int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 bw_share,
27 u32 max_avg_bw, u32 id);27 u32 max_avg_bw, u32 id);
28int mlx5_qos_destroy_node(struct mlx5_core_dev *mdev, u32 id);28int mlx5_qos_destroy_node(struct mlx5_core_dev *mdev, u32 id);
29 29
drivers/net/ethernet/microchip/lan966x/lan966x_main.c+8−5
@@ -1043,11 +1043,6 @@ static int lan966x_probe(struct platform_device *pdev) · 1042 unmodified lines
1043 lan966x->base_mac[5] &= 0xf0;1043 lan966x->base_mac[5] &= 0xf0;
1044 }1044 }
1045 1045
1046 ports = device_get_named_child_node(&pdev->dev, "ethernet-ports");
1047 if (!ports)
1048 return dev_err_probe(&pdev->dev, -ENODEV,
1049 "no ethernet-ports child found\n");
1050
1051 err = lan966x_create_targets(pdev, lan966x);1046 err = lan966x_create_targets(pdev, lan966x);
1052 if (err)1047 if (err)
1053 return dev_err_probe(&pdev->dev, err,1048 return dev_err_probe(&pdev->dev, err,
@@ -1125,6 +1120,11 @@ static int lan966x_probe(struct platform_device *pdev) · 71 unmodified lines
1125 }1120 }
1126 }1121 }
1127 1122
1123 ports = device_get_named_child_node(&pdev->dev, "ethernet-ports");
1124 if (!ports)
1125 return dev_err_probe(&pdev->dev, -ENODEV,
1126 "no ethernet-ports child found\n");
1127
1128 /* init switch */1128 /* init switch */
1129 lan966x_init(lan966x);1129 lan966x_init(lan966x);
1130 lan966x_stats_init(lan966x);1130 lan966x_stats_init(lan966x);
@@ -1162,6 +1162,8 @@ static int lan966x_probe(struct platform_device *pdev) · 31 unmodified lines
1162 goto cleanup_ports;1162 goto cleanup_ports;
1163 }1163 }
1164 1164
1165 fwnode_handle_put(ports);
1166
1165 lan966x_mdb_init(lan966x);1167 lan966x_mdb_init(lan966x);
1166 err = lan966x_fdb_init(lan966x);1168 err = lan966x_fdb_init(lan966x);
1167 if (err)1169 if (err)
@@ -1191,6 +1193,7 @@ cleanup_fdb: · 23 unmodified lines
1191 lan966x_fdb_deinit(lan966x);1193 lan966x_fdb_deinit(lan966x);
1192 1194
1193cleanup_ports:1195cleanup_ports:
1196 fwnode_handle_put(ports);
1194 fwnode_handle_put(portnp);1197 fwnode_handle_put(portnp);
1195 1198
1196 lan966x_cleanup_ports(lan966x);1199 lan966x_cleanup_ports(lan966x);
drivers/net/ethernet/stmicro/stmmac/dwmac5.c+14−0
@@ -186,11 +186,25 @@ static void dwmac5_handle_dma_err(struct net_device *ndev, · 185 unmodified lines
186int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp,186int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp,
187 struct stmmac_safety_feature_cfg *safety_feat_cfg)187 struct stmmac_safety_feature_cfg *safety_feat_cfg)
188{188{
189 struct stmmac_safety_feature_cfg all_safety_feats = {
190 .tsoee = 1,
191 .mrxpee = 1,
192 .mestee = 1,
193 .mrxee = 1,
194 .mtxee = 1,
195 .epsi = 1,
196 .edpp = 1,
197 .prtyen = 1,
198 .tmouten = 1,
199 };
189 u32 value;200 u32 value;
190 201
191 if (!asp)202 if (!asp)
192 return -EINVAL;203 return -EINVAL;
193 204
205 if (!safety_feat_cfg)
206 safety_feat_cfg = &all_safety_feats;
207
194 /* 1. Enable Safety Features */208 /* 1. Enable Safety Features */
195 value = readl(ioaddr + MTL_ECC_CONTROL);209 value = readl(ioaddr + MTL_ECC_CONTROL);
196 value |= MEEAO; /* MTL ECC Error Addr Status Override */210 value |= MEEAO; /* MTL ECC Error Addr Status Override */
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c+4−4
@@ -551,16 +551,16 @@ static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data) · 550 unmodified lines
551 p = (char *)priv + offsetof(struct stmmac_priv,551 p = (char *)priv + offsetof(struct stmmac_priv,
552 xstats.txq_stats[q].tx_pkt_n);552 xstats.txq_stats[q].tx_pkt_n);
553 for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {553 for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
554 *data++ = (*(u64 *)p);554 *data++ = (*(unsigned long *)p);
555 p += sizeof(u64 *);555 p += sizeof(unsigned long);
556 }556 }
557 }557 }
558 for (q = 0; q < rx_cnt; q++) {558 for (q = 0; q < rx_cnt; q++) {
559 p = (char *)priv + offsetof(struct stmmac_priv,559 p = (char *)priv + offsetof(struct stmmac_priv,
560 xstats.rxq_stats[q].rx_pkt_n);560 xstats.rxq_stats[q].rx_pkt_n);
561 for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {561 for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
562 *data++ = (*(u64 *)p);562 *data++ = (*(unsigned long *)p);
563 p += sizeof(u64 *);563 p += sizeof(unsigned long);
564 }564 }
565 }565 }
566}566}
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+5−0
@@ -1150,6 +1150,11 @@ static int stmmac_init_phy(struct net_device *dev) · 1149 unmodified lines
1150 int addr = priv->plat->phy_addr;1150 int addr = priv->plat->phy_addr;
1151 struct phy_device *phydev;1151 struct phy_device *phydev;
1152 1152
1153 if (addr < 0) {
1154 netdev_err(priv->dev, "no phy found\n");
1155 return -ENODEV;
1156 }
1157
1153 phydev = mdiobus_get_phy(priv->mii, addr);1158 phydev = mdiobus_get_phy(priv->mii, addr);
1154 if (!phydev) {1159 if (!phydev) {
1155 netdev_err(priv->dev, "no phy at addr %d\n", addr);1160 netdev_err(priv->dev, "no phy at addr %d\n", addr);
drivers/net/ipa/ipa_interrupt.c+10−0
@@ -127,6 +127,16 @@ out_power_put: · 126 unmodified lines
127 return IRQ_HANDLED;127 return IRQ_HANDLED;
128}128}
129 129
130void ipa_interrupt_irq_disable(struct ipa *ipa)
131{
132 disable_irq(ipa->interrupt->irq);
133}
134
135void ipa_interrupt_irq_enable(struct ipa *ipa)
136{
137 enable_irq(ipa->interrupt->irq);
138}
139
130/* Common function used to enable/disable TX_SUSPEND for an endpoint */140/* Common function used to enable/disable TX_SUSPEND for an endpoint */
131static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,141static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,
132 u32 endpoint_id, bool enable)142 u32 endpoint_id, bool enable)
drivers/net/ipa/ipa_interrupt.h+16−0
@@ -85,6 +85,22 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt); · 84 unmodified lines
85 */85 */
86void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt);86void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt);
87 87
88/**
89 * ipa_interrupt_irq_enable() - Enable IPA interrupts
90 * @ipa: IPA pointer
91 *
92 * This enables the IPA interrupt line
93 */
94void ipa_interrupt_irq_enable(struct ipa *ipa);
95
96/**
97 * ipa_interrupt_irq_disable() - Disable IPA interrupts
98 * @ipa: IPA pointer
99 *
100 * This disables the IPA interrupt line
101 */
102void ipa_interrupt_irq_disable(struct ipa *ipa);
103
88/**104/**
89 * ipa_interrupt_config() - Configure the IPA interrupt framework105 * ipa_interrupt_config() - Configure the IPA interrupt framework
90 * @ipa: IPA pointer106 * @ipa: IPA pointer
drivers/net/ipa/ipa_power.c+17−0
@@ -181,6 +181,17 @@ static int ipa_suspend(struct device *dev) · 180 unmodified lines
181 181
182 __set_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags);182 __set_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags);
183 183
184 /* Increment the disable depth to ensure that the IRQ won't
185 * be re-enabled until the matching _enable call in
186 * ipa_resume(). We do this to ensure that the interrupt
187 * handler won't run whilst PM runtime is disabled.
188 *
189 * Note that disabling the IRQ is NOT the same as disabling
190 * irq wake. If wakeup is enabled for the IPA then the IRQ
191 * will still cause the system to wake up, see irq_set_irq_wake().
192 */
193 ipa_interrupt_irq_disable(ipa);
194
184 return pm_runtime_force_suspend(dev);195 return pm_runtime_force_suspend(dev);
185}196}
186 197
@@ -193,6 +204,12 @@ static int ipa_resume(struct device *dev) · 6 unmodified lines
193 204
194 __clear_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags);205 __clear_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags);
195 206
207 /* Now that PM runtime is enabled again it's safe
208 * to turn the IRQ back on and process any data
209 * that was received during suspend.
210 */
211 ipa_interrupt_irq_enable(ipa);
212
196 return ret;213 return ret;
197}214}
198 215
drivers/net/phy/mdio_bus.c+6−1
@@ -108,7 +108,12 @@ EXPORT_SYMBOL(mdiobus_unregister_device); · 107 unmodified lines
108 108
109struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr)109struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr)
110{110{
111 struct mdio_device *mdiodev = bus->mdio_map[addr];111 struct mdio_device *mdiodev;
112
113 if (addr < 0 || addr >= ARRAY_SIZE(bus->mdio_map))
114 return NULL;
115
116 mdiodev = bus->mdio_map[addr];
112 117
113 if (!mdiodev)118 if (!mdiodev)
114 return NULL;119 return NULL;
drivers/net/team/team.c+0−2
@@ -1044,7 +1044,6 @@ static int team_port_enter(struct team *team, struct team_port *port) · 1043 unmodified lines
1044 goto err_port_enter;1044 goto err_port_enter;
1045 }1045 }
1046 }1046 }
1047 port->dev->priv_flags |= IFF_NO_ADDRCONF;
1048 1047
1049 return 0;1048 return 0;
1050 1049
@@ -1058,7 +1057,6 @@ static void team_port_leave(struct team *team, struct team_port *port) · 7 unmodified lines
1058{1057{
1059 if (team->ops.port_leave)1058 if (team->ops.port_leave)
1060 team->ops.port_leave(team, port);1059 team->ops.port_leave(team, port);
1061 port->dev->priv_flags &= ~IFF_NO_ADDRCONF;
1062 dev_put(team->dev);1060 dev_put(team->dev);
1063}1061}
1064 1062
drivers/net/usb/sr9700.c+1−1
@@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 412 unmodified lines
413 /* ignore the CRC length */413 /* ignore the CRC length */
414 len = (skb->data[1] | (skb->data[2] << 8)) - 4;414 len = (skb->data[1] | (skb->data[2] << 8)) - 4;
415 415
416 if (len > ETH_FRAME_LEN || len > skb->len)416 if (len > ETH_FRAME_LEN || len > skb->len || len < 0)
417 return 0;417 return 0;
418 418
419 /* the last packet of current skb */419 /* the last packet of current skb */
drivers/net/virtio_net.c+4−2
@@ -1877,8 +1877,10 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 1876 unmodified lines
1877 */1877 */
1878 if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {1878 if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
1879 netif_stop_subqueue(dev, qnum);1879 netif_stop_subqueue(dev, qnum);
1880 if (!use_napi &&1880 if (use_napi) {
1881 unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {1881 if (unlikely(!virtqueue_enable_cb_delayed(sq->vq)))
1882 virtqueue_napi_schedule(&sq->napi, sq->vq);
1883 } else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
1882 /* More just got used, free them then recheck. */1884 /* More just got used, free them then recheck. */
1883 free_old_xmit_skbs(sq, false);1885 free_old_xmit_skbs(sq, false);
1884 if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {1886 if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
drivers/net/wan/fsl_ucc_hdlc.c+4−2
@@ -1243,9 +1243,11 @@ static int ucc_hdlc_probe(struct platform_device *pdev) · 1242 unmodified lines
1243free_dev:1243free_dev:
1244 free_netdev(dev);1244 free_netdev(dev);
1245undo_uhdlc_init:1245undo_uhdlc_init:
1246 iounmap(utdm->siram);1246 if (utdm)
1247 iounmap(utdm->siram);
1247unmap_si_regs:1248unmap_si_regs:
1248 iounmap(utdm->si_regs);1249 if (utdm)
1250 iounmap(utdm->si_regs);
1249free_utdm:1251free_utdm:
1250 if (uhdlc_priv->tsa)1252 if (uhdlc_priv->tsa)
1251 kfree(utdm);1253 kfree(utdm);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+19−18
@@ -7937,6 +7937,9 @@ cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, · 7936 unmodified lines
7937 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);7937 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
7938 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));7938 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
7939 7939
7940 if (chan->flags & IEEE80211_CHAN_DISABLED)
7941 return -EINVAL;
7942
7940 /* set_channel */7943 /* set_channel */
7941 chspec = channel_to_chanspec(&cfg->d11inf, chan);7944 chspec = channel_to_chanspec(&cfg->d11inf, chan);
7942 if (chspec != INVCHANSPEC) {7945 if (chspec != INVCHANSPEC) {
@@ -7961,7 +7964,7 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 18 unmodified lines
7961 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));7964 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
7962 struct brcmf_dump_survey survey = {};7965 struct brcmf_dump_survey survey = {};
7963 struct ieee80211_supported_band *band;7966 struct ieee80211_supported_band *band;
7964 struct ieee80211_channel *chan;7967 enum nl80211_band band_id;
7965 struct cca_msrmnt_query req;7968 struct cca_msrmnt_query req;
7966 u32 noise;7969 u32 noise;
7967 int err;7970 int err;
@@ -7974,26 +7977,25 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 6 unmodified lines
7974 return -EBUSY;7977 return -EBUSY;
7975 }7978 }
7976 7979
7977 band = wiphy->bands[NL80211_BAND_2GHZ];7980 for (band_id = 0; band_id < NUM_NL80211_BANDS; band_id++) {
7978 if (band && idx >= band->n_channels) {7981 band = wiphy->bands[band_id];
7979 idx -= band->n_channels;7982 if (!band)
7980 band = NULL;7983 continue;
7981 }7984 if (idx >= band->n_channels) {
7985 idx -= band->n_channels;
7986 continue;
7987 }
7982 7988
7983 if (!band || idx >= band->n_channels) {7989 info->channel = &band->channels[idx];
7984 band = wiphy->bands[NL80211_BAND_5GHZ];7990 break;
7985 if (idx >= band->n_channels)
7986 return -ENOENT;
7987 }7991 }
7992 if (band_id == NUM_NL80211_BANDS)
7993 return -ENOENT;
7988 7994
7989 /* Setting current channel to the requested channel */7995 /* Setting current channel to the requested channel */
7990 chan = &band->channels[idx];7996 info->filled = 0;
7991 err = cfg80211_set_channel(wiphy, ndev, chan, NL80211_CHAN_HT20);7997 if (cfg80211_set_channel(wiphy, ndev, info->channel, NL80211_CHAN_HT20))
7992 if (err) {
7993 info->channel = chan;
7994 info->filled = 0;
7995 return 0;7998 return 0;
7996 }
7997 7999
7998 /* Disable mpc */8000 /* Disable mpc */
7999 brcmf_set_mpc(ifp, 0);8001 brcmf_set_mpc(ifp, 0);
@@ -8028,7 +8030,6 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 28 unmodified lines
8028 if (err)8030 if (err)
8029 goto exit;8031 goto exit;
8030 8032
8031 info->channel = chan;
8032 info->noise = noise;8033 info->noise = noise;
8033 info->time = ACS_MSRMNT_DELAY;8034 info->time = ACS_MSRMNT_DELAY;
8034 info->time_busy = ACS_MSRMNT_DELAY - survey.idle;8035 info->time_busy = ACS_MSRMNT_DELAY - survey.idle;
@@ -8040,7 +8041,7 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 5 unmodified lines
8040 SURVEY_INFO_TIME_TX;8041 SURVEY_INFO_TIME_TX;
8041 8042
8042 brcmf_dbg(INFO, "OBSS dump: channel %d: survey duration %d\n",8043 brcmf_dbg(INFO, "OBSS dump: channel %d: survey duration %d\n",
8043 ieee80211_frequency_to_channel(chan->center_freq),8044 ieee80211_frequency_to_channel(info->channel->center_freq),
8044 ACS_MSRMNT_DELAY);8045 ACS_MSRMNT_DELAY);
8045 brcmf_dbg(INFO, "noise(%d) busy(%llu) rx(%llu) tx(%llu)\n",8046 brcmf_dbg(INFO, "noise(%d) busy(%llu) rx(%llu) tx(%llu)\n",
8046 info->noise, info->time_busy, info->time_rx, info->time_tx);8047 info->noise, info->time_busy, info->time_rx, info->time_tx);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c+1−1
@@ -1228,7 +1228,7 @@ static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo) · 1227 unmodified lines
1228 BRCMF_NROF_H2D_COMMON_MSGRINGS;1228 BRCMF_NROF_H2D_COMMON_MSGRINGS;
1229 max_completionrings = BRCMF_NROF_D2H_COMMON_MSGRINGS;1229 max_completionrings = BRCMF_NROF_D2H_COMMON_MSGRINGS;
1230 }1230 }
1231 if (max_flowrings > 256) {1231 if (max_flowrings > 512) {
1232 brcmf_err(bus, "invalid max_flowrings(%d)\n", max_flowrings);1232 brcmf_err(bus, "invalid max_flowrings(%d)\n", max_flowrings);
1233 return -EIO;1233 return -EIO;
1234 }1234 }
drivers/net/wireless/mediatek/mt76/dma.c+80−51
@@ -205,6 +205,52 @@ mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q) · 204 unmodified lines
205 mt76_dma_sync_idx(dev, q);205 mt76_dma_sync_idx(dev, q);
206}206}
207 207
208static int
209mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
210 struct mt76_queue_buf *buf, void *data)
211{
212 struct mt76_desc *desc = &q->desc[q->head];
213 struct mt76_queue_entry *entry = &q->entry[q->head];
214 struct mt76_txwi_cache *txwi = NULL;
215 u32 buf1 = 0, ctrl;
216 int idx = q->head;
217 int rx_token;
218
219 ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len);
220
221 if ((q->flags & MT_QFLAG_WED) &&
222 FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
223 txwi = mt76_get_rxwi(dev);
224 if (!txwi)
225 return -ENOMEM;
226
227 rx_token = mt76_rx_token_consume(dev, data, txwi, buf->addr);
228 if (rx_token < 0) {
229 mt76_put_rxwi(dev, txwi);
230 return -ENOMEM;
231 }
232
233 buf1 |= FIELD_PREP(MT_DMA_CTL_TOKEN, rx_token);
234 ctrl |= MT_DMA_CTL_TO_HOST;
235 }
236
237 WRITE_ONCE(desc->buf0, cpu_to_le32(buf->addr));
238 WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));
239 WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl));
240 WRITE_ONCE(desc->info, 0);
241
242 entry->dma_addr[0] = buf->addr;
243 entry->dma_len[0] = buf->len;
244 entry->txwi = txwi;
245 entry->buf = data;
246 entry->wcid = 0xffff;
247 entry->skip_buf1 = true;
248 q->head = (q->head + 1) % q->ndesc;
249 q->queued++;
250
251 return idx;
252}
253
208static int254static int
209mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,255mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
210 struct mt76_queue_buf *buf, int nbufs, u32 info,256 struct mt76_queue_buf *buf, int nbufs, u32 info,
@@ -212,65 +258,51 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q, · 1 unmodified line
212{258{
213 struct mt76_queue_entry *entry;259 struct mt76_queue_entry *entry;
214 struct mt76_desc *desc;260 struct mt76_desc *desc;
215 u32 ctrl;
216 int i, idx = -1;261 int i, idx = -1;
262 u32 ctrl, next;
263
264 if (txwi) {
265 q->entry[q->head].txwi = DMA_DUMMY_DATA;
266 q->entry[q->head].skip_buf0 = true;
267 }
217 268
218 for (i = 0; i < nbufs; i += 2, buf += 2) {269 for (i = 0; i < nbufs; i += 2, buf += 2) {
219 u32 buf0 = buf[0].addr, buf1 = 0;270 u32 buf0 = buf[0].addr, buf1 = 0;
220 271
221 idx = q->head;272 idx = q->head;
222 q->head = (q->head + 1) % q->ndesc;273 next = (q->head + 1) % q->ndesc;
223 274
224 desc = &q->desc[idx];275 desc = &q->desc[idx];
225 entry = &q->entry[idx];276 entry = &q->entry[idx];
226 277
227 if ((q->flags & MT_QFLAG_WED) &&278 if (buf[0].skip_unmap)
228 FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {279 entry->skip_buf0 = true;
229 struct mt76_txwi_cache *t = txwi;280 entry->skip_buf1 = i == nbufs - 1;
230 int rx_token;281
231 282 entry->dma_addr[0] = buf[0].addr;
232 if (!t)283 entry->dma_len[0] = buf[0].len;
233 return -ENOMEM;284
234 285 ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len);
235 rx_token = mt76_rx_token_consume(dev, (void *)skb, t,286 if (i < nbufs - 1) {
236 buf[0].addr);287 entry->dma_addr[1] = buf[1].addr;
237 buf1 |= FIELD_PREP(MT_DMA_CTL_TOKEN, rx_token);288 entry->dma_len[1] = buf[1].len;
238 ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len) |289 buf1 = buf[1].addr;
239 MT_DMA_CTL_TO_HOST;290 ctrl |= FIELD_PREP(MT_DMA_CTL_SD_LEN1, buf[1].len);
240 } else {291 if (buf[1].skip_unmap)
241 if (txwi) {292 entry->skip_buf1 = true;
242 q->entry[q->head].txwi = DMA_DUMMY_DATA;
243 q->entry[q->head].skip_buf0 = true;
244 }
245
246 if (buf[0].skip_unmap)
247 entry->skip_buf0 = true;
248 entry->skip_buf1 = i == nbufs - 1;
249
250 entry->dma_addr[0] = buf[0].addr;
251 entry->dma_len[0] = buf[0].len;
252
253 ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len);
254 if (i < nbufs - 1) {
255 entry->dma_addr[1] = buf[1].addr;
256 entry->dma_len[1] = buf[1].len;
257 buf1 = buf[1].addr;
258 ctrl |= FIELD_PREP(MT_DMA_CTL_SD_LEN1, buf[1].len);
259 if (buf[1].skip_unmap)
260 entry->skip_buf1 = true;
261 }
262
263 if (i == nbufs - 1)
264 ctrl |= MT_DMA_CTL_LAST_SEC0;
265 else if (i == nbufs - 2)
266 ctrl |= MT_DMA_CTL_LAST_SEC1;
267 }293 }
268 294
295 if (i == nbufs - 1)
296 ctrl |= MT_DMA_CTL_LAST_SEC0;
297 else if (i == nbufs - 2)
298 ctrl |= MT_DMA_CTL_LAST_SEC1;
299
269 WRITE_ONCE(desc->buf0, cpu_to_le32(buf0));300 WRITE_ONCE(desc->buf0, cpu_to_le32(buf0));
270 WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));301 WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));
271 WRITE_ONCE(desc->info, cpu_to_le32(info));302 WRITE_ONCE(desc->info, cpu_to_le32(info));
272 WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl));303 WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl));
273 304
305 q->head = next;
274 q->queued++;306 q->queued++;
275 }307 }
276 308
@@ -577,17 +609,9 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q) · 300 unmodified lines
577 spin_lock_bh(&q->lock);609 spin_lock_bh(&q->lock);
578 610
579 while (q->queued < q->ndesc - 1) {611 while (q->queued < q->ndesc - 1) {
580 struct mt76_txwi_cache *t = NULL;
581 struct mt76_queue_buf qbuf;612 struct mt76_queue_buf qbuf;
582 void *buf = NULL;613 void *buf = NULL;
583 614
584 if ((q->flags & MT_QFLAG_WED) &&
585 FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
586 t = mt76_get_rxwi(dev);
587 if (!t)
588 break;
589 }
590
591 buf = page_frag_alloc(rx_page, q->buf_size, GFP_ATOMIC);615 buf = page_frag_alloc(rx_page, q->buf_size, GFP_ATOMIC);
592 if (!buf)616 if (!buf)
593 break;617 break;
@@ -601,7 +625,12 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q) · 7 unmodified lines
601 qbuf.addr = addr + offset;625 qbuf.addr = addr + offset;
602 qbuf.len = len - offset;626 qbuf.len = len - offset;
603 qbuf.skip_unmap = false;627 qbuf.skip_unmap = false;
604 mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t);628 if (mt76_dma_add_rx_buf(dev, q, &qbuf, buf) < 0) {
629 dma_unmap_single(dev->dma_dev, addr, len,
630 DMA_FROM_DEVICE);
631 skb_free_frag(buf);
632 break;
633 }
605 frames++;634 frames++;
606 }635 }
607 636
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c+7−0
@@ -653,6 +653,13 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size) · 652 unmodified lines
653 653
654 desc->buf0 = cpu_to_le32(phy_addr);654 desc->buf0 = cpu_to_le32(phy_addr);
655 token = mt76_rx_token_consume(&dev->mt76, ptr, t, phy_addr);655 token = mt76_rx_token_consume(&dev->mt76, ptr, t, phy_addr);
656 if (token < 0) {
657 dma_unmap_single(dev->mt76.dma_dev, phy_addr,
658 wed->wlan.rx_size, DMA_TO_DEVICE);
659 skb_free_frag(ptr);
660 goto unmap;
661 }
662
656 desc->token |= cpu_to_le32(FIELD_PREP(MT_DMA_CTL_TOKEN,663 desc->token |= cpu_to_le32(FIELD_PREP(MT_DMA_CTL_TOKEN,
657 token));664 token));
658 desc++;665 desc++;
drivers/net/wireless/mediatek/mt76/tx.c+4−3
@@ -764,11 +764,12 @@ int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr, · 763 unmodified lines
764 spin_lock_bh(&dev->rx_token_lock);764 spin_lock_bh(&dev->rx_token_lock);
765 token = idr_alloc(&dev->rx_token, t, 0, dev->rx_token_size,765 token = idr_alloc(&dev->rx_token, t, 0, dev->rx_token_size,
766 GFP_ATOMIC);766 GFP_ATOMIC);
767 if (token >= 0) {
768 t->ptr = ptr;
769 t->dma_addr = phys;
770 }
767 spin_unlock_bh(&dev->rx_token_lock);771 spin_unlock_bh(&dev->rx_token_lock);
768 772
769 t->ptr = ptr;
770 t->dma_addr = phys;
771
772 return token;773 return token;
773}774}
774EXPORT_SYMBOL_GPL(mt76_rx_token_consume);775EXPORT_SYMBOL_GPL(mt76_rx_token_consume);
drivers/net/wireless/rndis_wlan.c+6−13
@@ -696,8 +696,8 @@ static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) · 695 unmodified lines
696 struct rndis_query *get;696 struct rndis_query *get;
697 struct rndis_query_c *get_c;697 struct rndis_query_c *get_c;
698 } u;698 } u;
699 int ret, buflen;699 int ret;
700 int resplen, respoffs, copylen;700 size_t buflen, resplen, respoffs, copylen;
701 701
702 buflen = *len + sizeof(*u.get);702 buflen = *len + sizeof(*u.get);
703 if (buflen < CONTROL_BUFFER_SIZE)703 if (buflen < CONTROL_BUFFER_SIZE)
@@ -732,22 +732,15 @@ static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) · 28 unmodified lines
732 732
733 if (respoffs > buflen) {733 if (respoffs > buflen) {
734 /* Device returned data offset outside buffer, error. */734 /* Device returned data offset outside buffer, error. */
735 netdev_dbg(dev->net, "%s(%s): received invalid "735 netdev_dbg(dev->net,
736 "data offset: %d > %d\n", __func__,736 "%s(%s): received invalid data offset: %zu > %zu\n",
737 oid_to_string(oid), respoffs, buflen);737 __func__, oid_to_string(oid), respoffs, buflen);
738 738
739 ret = -EINVAL;739 ret = -EINVAL;
740 goto exit_unlock;740 goto exit_unlock;
741 }741 }
742 742
743 if ((resplen + respoffs) > buflen) {743 copylen = min(resplen, buflen - respoffs);
744 /* Device would have returned more data if buffer would
745 * have been big enough. Copy just the bits that we got.
746 */
747 copylen = buflen - respoffs;
748 } else {
749 copylen = resplen;
750 }
751 744
752 if (copylen > *len)745 if (copylen > *len)
753 copylen = *len;746 copylen = *len;
include/linux/bpf.h+1−1
@@ -1832,7 +1832,7 @@ void bpf_prog_inc(struct bpf_prog *prog); · 1831 unmodified lines
1832struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog);1832struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog);
1833void bpf_prog_put(struct bpf_prog *prog);1833void bpf_prog_put(struct bpf_prog *prog);
1834 1834
1835void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock);1835void bpf_prog_free_id(struct bpf_prog *prog);
1836void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);1836void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);
1837 1837
1838struct btf_field *btf_record_find(const struct btf_record *rec,1838struct btf_field *btf_record_find(const struct btf_record *rec,
include/net/mac80211.h+0−4
@@ -1832,8 +1832,6 @@ struct ieee80211_vif_cfg { · 1831 unmodified lines
1832 * @drv_priv: data area for driver use, will always be aligned to1832 * @drv_priv: data area for driver use, will always be aligned to
1833 * sizeof(void \*).1833 * sizeof(void \*).
1834 * @txq: the multicast data TX queue1834 * @txq: the multicast data TX queue
1835 * @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped,
1836 * protected by fq->lock.
1837 * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see1835 * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see
1838 * &enum ieee80211_offload_flags.1836 * &enum ieee80211_offload_flags.
1839 * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled.1837 * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled.
@@ -1863,8 +1861,6 @@ struct ieee80211_vif { · 23 unmodified lines
1863 bool probe_req_reg;1861 bool probe_req_reg;
1864 bool rx_mcast_action_reg;1862 bool rx_mcast_action_reg;
1865 1863
1866 bool txqs_stopped[IEEE80211_NUM_ACS];
1867
1868 struct ieee80211_vif *mbssid_tx_vif;1864 struct ieee80211_vif *mbssid_tx_vif;
1869 1865
1870 /* must be last */1866 /* must be last */
include/net/sch_generic.h+7−0
@@ -1288,4 +1288,11 @@ void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx); · 1287 unmodified lines
1288 1288
1289int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb));1289int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb));
1290 1290
1291/* Make sure qdisc is no longer in SCHED state. */
1292static inline void qdisc_synchronize(const struct Qdisc *q)
1293{
1294 while (test_bit(__QDISC_STATE_SCHED, &q->state))
1295 msleep(1);
1296}
1297
1291#endif1298#endif
kernel/bpf/hashtab.c+2−2
@@ -152,7 +152,7 @@ static inline int htab_lock_bucket(const struct bpf_htab *htab, · 151 unmodified lines
152{152{
153 unsigned long flags;153 unsigned long flags;
154 154
155 hash = hash & HASHTAB_MAP_LOCK_MASK;155 hash = hash & min_t(u32, HASHTAB_MAP_LOCK_MASK, htab->n_buckets - 1);
156 156
157 preempt_disable();157 preempt_disable();
158 if (unlikely(__this_cpu_inc_return(*(htab->map_locked[hash])) != 1)) {158 if (unlikely(__this_cpu_inc_return(*(htab->map_locked[hash])) != 1)) {
@@ -171,7 +171,7 @@ static inline void htab_unlock_bucket(const struct bpf_htab *htab, · 12 unmodified lines
171 struct bucket *b, u32 hash,171 struct bucket *b, u32 hash,
172 unsigned long flags)172 unsigned long flags)
173{173{
174 hash = hash & HASHTAB_MAP_LOCK_MASK;174 hash = hash & min_t(u32, HASHTAB_MAP_LOCK_MASK, htab->n_buckets - 1);
175 raw_spin_unlock_irqrestore(&b->raw_lock, flags);175 raw_spin_unlock_irqrestore(&b->raw_lock, flags);
176 __this_cpu_dec(*(htab->map_locked[hash]));176 __this_cpu_dec(*(htab->map_locked[hash]));
177 preempt_enable();177 preempt_enable();
kernel/bpf/offload.c+0−3
@@ -216,9 +216,6 @@ static void __bpf_prog_offload_destroy(struct bpf_prog *prog) · 215 unmodified lines
216 if (offload->dev_state)216 if (offload->dev_state)
217 offload->offdev->ops->destroy(prog);217 offload->offdev->ops->destroy(prog);
218 218
219 /* Make sure BPF_PROG_GET_NEXT_ID can't find this dead program */
220 bpf_prog_free_id(prog, true);
221
222 list_del_init(&offload->offloads);219 list_del_init(&offload->offloads);
223 kfree(offload);220 kfree(offload);
224 prog->aux->offload = NULL;221 prog->aux->offload = NULL;
kernel/bpf/syscall.c+7−17
@@ -1972,7 +1972,7 @@ static void bpf_audit_prog(const struct bpf_prog *prog, unsigned int op) · 1971 unmodified lines
1972 return;1972 return;
1973 if (audit_enabled == AUDIT_OFF)1973 if (audit_enabled == AUDIT_OFF)
1974 return;1974 return;
1975 if (op == BPF_AUDIT_LOAD)1975 if (!in_irq() && !irqs_disabled())
1976 ctx = audit_context();1976 ctx = audit_context();
1977 ab = audit_log_start(ctx, GFP_ATOMIC, AUDIT_BPF);1977 ab = audit_log_start(ctx, GFP_ATOMIC, AUDIT_BPF);
1978 if (unlikely(!ab))1978 if (unlikely(!ab))
@@ -2001,7 +2001,7 @@ static int bpf_prog_alloc_id(struct bpf_prog *prog) · 22 unmodified lines
2001 return id > 0 ? 0 : id;2001 return id > 0 ? 0 : id;
2002}2002}
2003 2003
2004void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock)2004void bpf_prog_free_id(struct bpf_prog *prog)
2005{2005{
2006 unsigned long flags;2006 unsigned long flags;
2007 2007
@@ -2013,18 +2013,10 @@ void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock) · 5 unmodified lines
2013 if (!prog->aux->id)2013 if (!prog->aux->id)
2014 return;2014 return;
2015 2015
2016 if (do_idr_lock)2016 spin_lock_irqsave(&prog_idr_lock, flags);
2017 spin_lock_irqsave(&prog_idr_lock, flags);
2018 else
2019 __acquire(&prog_idr_lock);
2020
2021 idr_remove(&prog_idr, prog->aux->id);2017 idr_remove(&prog_idr, prog->aux->id);
2022 prog->aux->id = 0;2018 prog->aux->id = 0;
2023 2019 spin_unlock_irqrestore(&prog_idr_lock, flags);
2024 if (do_idr_lock)
2025 spin_unlock_irqrestore(&prog_idr_lock, flags);
2026 else
2027 __release(&prog_idr_lock);
2028}2020}
2029 2021
2030static void __bpf_prog_put_rcu(struct rcu_head *rcu)2022static void __bpf_prog_put_rcu(struct rcu_head *rcu)
@@ -2067,17 +2059,15 @@ static void bpf_prog_put_deferred(struct work_struct *work) · 36 unmodified lines
2067 prog = aux->prog;2059 prog = aux->prog;
2068 perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0);2060 perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0);
2069 bpf_audit_prog(prog, BPF_AUDIT_UNLOAD);2061 bpf_audit_prog(prog, BPF_AUDIT_UNLOAD);
2062 bpf_prog_free_id(prog);
2070 __bpf_prog_put_noref(prog, true);2063 __bpf_prog_put_noref(prog, true);
2071}2064}
2072 2065
2073static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock)2066static void __bpf_prog_put(struct bpf_prog *prog)
2074{2067{
2075 struct bpf_prog_aux *aux = prog->aux;2068 struct bpf_prog_aux *aux = prog->aux;
2076 2069
2077 if (atomic64_dec_and_test(&aux->refcnt)) {2070 if (atomic64_dec_and_test(&aux->refcnt)) {
2078 /* bpf_prog_free_id() must be called first */
2079 bpf_prog_free_id(prog, do_idr_lock);
2080
2081 if (in_irq() || irqs_disabled()) {2071 if (in_irq() || irqs_disabled()) {
2082 INIT_WORK(&aux->work, bpf_prog_put_deferred);2072 INIT_WORK(&aux->work, bpf_prog_put_deferred);
2083 schedule_work(&aux->work);2073 schedule_work(&aux->work);
@@ -2089,7 +2079,7 @@ static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock) · 5 unmodified lines
2089 2079
2090void bpf_prog_put(struct bpf_prog *prog)2080void bpf_prog_put(struct bpf_prog *prog)
2091{2081{
2092 __bpf_prog_put(prog, true);2082 __bpf_prog_put(prog);
2093}2083}
2094EXPORT_SYMBOL_GPL(bpf_prog_put);2084EXPORT_SYMBOL_GPL(bpf_prog_put);
2095 2085
kernel/bpf/verifier.c+9−1
@@ -2748,6 +2748,12 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, · 2747 unmodified lines
2748 */2748 */
2749 if (insn->src_reg == 0 && is_callback_calling_function(insn->imm))2749 if (insn->src_reg == 0 && is_callback_calling_function(insn->imm))
2750 return -ENOTSUPP;2750 return -ENOTSUPP;
2751 /* kfunc with imm==0 is invalid and fixup_kfunc_call will
2752 * catch this error later. Make backtracking conservative
2753 * with ENOTSUPP.
2754 */
2755 if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL && insn->imm == 0)
2756 return -ENOTSUPP;
2751 /* regular helper call sets R0 */2757 /* regular helper call sets R0 */
2752 *reg_mask &= ~1;2758 *reg_mask &= ~1;
2753 if (*reg_mask & 0x3f) {2759 if (*reg_mask & 0x3f) {
@@ -3289,7 +3295,9 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env, · 535 unmodified lines
3289 bool sanitize = reg && is_spillable_regtype(reg->type);3295 bool sanitize = reg && is_spillable_regtype(reg->type);
3290 3296
3291 for (i = 0; i < size; i++) {3297 for (i = 0; i < size; i++) {
3292 if (state->stack[spi].slot_type[i] == STACK_INVALID) {3298 u8 type = state->stack[spi].slot_type[i];
3299
3300 if (type != STACK_MISC && type != STACK_ZERO) {
3293 sanitize = true;3301 sanitize = true;
3294 break;3302 break;
3295 }3303 }
kernel/trace/bpf_trace.c+3−0
@@ -848,6 +848,9 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type) · 847 unmodified lines
848 return -EPERM;848 return -EPERM;
849 if (unlikely(!nmi_uaccess_okay()))849 if (unlikely(!nmi_uaccess_okay()))
850 return -EPERM;850 return -EPERM;
851 /* Task should not be pid=1 to avoid kernel panic. */
852 if (unlikely(is_global_init(current)))
853 return -EPERM;
851 854
852 if (irqs_disabled()) {855 if (irqs_disabled()) {
853 /* Do an early check on signal validity. Otherwise,856 /* Do an early check on signal validity. Otherwise,
net/bluetooth/hci_conn.c+14−4
@@ -821,6 +821,7 @@ static void terminate_big_destroy(struct hci_dev *hdev, void *data, int err) · 820 unmodified lines
821static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis)821static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis)
822{822{
823 struct iso_list_data *d;823 struct iso_list_data *d;
824 int ret;
824 825
825 bt_dev_dbg(hdev, "big 0x%2.2x bis 0x%2.2x", big, bis);826 bt_dev_dbg(hdev, "big 0x%2.2x bis 0x%2.2x", big, bis);
826 827
@@ -831,8 +832,12 @@ static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis) · 4 unmodified lines
831 d->big = big;832 d->big = big;
832 d->bis = bis;833 d->bis = bis;
833 834
834 return hci_cmd_sync_queue(hdev, terminate_big_sync, d,835 ret = hci_cmd_sync_queue(hdev, terminate_big_sync, d,
835 terminate_big_destroy);836 terminate_big_destroy);
837 if (ret)
838 kfree(d);
839
840 return ret;
836}841}
837 842
838static int big_terminate_sync(struct hci_dev *hdev, void *data)843static int big_terminate_sync(struct hci_dev *hdev, void *data)
@@ -857,6 +862,7 @@ static int big_terminate_sync(struct hci_dev *hdev, void *data) · 18 unmodified lines
857static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle)862static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle)
858{863{
859 struct iso_list_data *d;864 struct iso_list_data *d;
865 int ret;
860 866
861 bt_dev_dbg(hdev, "big 0x%2.2x sync_handle 0x%4.4x", big, sync_handle);867 bt_dev_dbg(hdev, "big 0x%2.2x sync_handle 0x%4.4x", big, sync_handle);
862 868
@@ -867,8 +873,12 @@ static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle) · 4 unmodified lines
867 d->big = big;873 d->big = big;
868 d->sync_handle = sync_handle;874 d->sync_handle = sync_handle;
869 875
870 return hci_cmd_sync_queue(hdev, big_terminate_sync, d,876 ret = hci_cmd_sync_queue(hdev, big_terminate_sync, d,
871 terminate_big_destroy);877 terminate_big_destroy);
878 if (ret)
879 kfree(d);
880
881 return ret;
872}882}
873 883
874/* Cleanup BIS connection884/* Cleanup BIS connection
net/bluetooth/hci_event.c+4−1
@@ -3848,8 +3848,11 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data, · 3847 unmodified lines
3848 conn->handle, conn->link);3848 conn->handle, conn->link);
3849 3849
3850 /* Create CIS if LE is already connected */3850 /* Create CIS if LE is already connected */
3851 if (conn->link && conn->link->state == BT_CONNECTED)3851 if (conn->link && conn->link->state == BT_CONNECTED) {
3852 rcu_read_unlock();
3852 hci_le_create_cis(conn->link);3853 hci_le_create_cis(conn->link);
3854 rcu_read_lock();
3855 }
3853 3856
3854 if (i == rp->num_handles)3857 if (i == rp->num_handles)
3855 break;3858 break;
net/bluetooth/hci_sync.c+6−13
@@ -3572,7 +3572,7 @@ static const struct hci_init_stage hci_init2[] = { · 3571 unmodified lines
3572static int hci_le_read_buffer_size_sync(struct hci_dev *hdev)3572static int hci_le_read_buffer_size_sync(struct hci_dev *hdev)
3573{3573{
3574 /* Use Read LE Buffer Size V2 if supported */3574 /* Use Read LE Buffer Size V2 if supported */
3575 if (hdev->commands[41] & 0x20)3575 if (iso_capable(hdev) && hdev->commands[41] & 0x20)
3576 return __hci_cmd_sync_status(hdev,3576 return __hci_cmd_sync_status(hdev,
3577 HCI_OP_LE_READ_BUFFER_SIZE_V2,3577 HCI_OP_LE_READ_BUFFER_SIZE_V2,
3578 0, NULL, HCI_CMD_TIMEOUT);3578 0, NULL, HCI_CMD_TIMEOUT);
@@ -3597,10 +3597,10 @@ static int hci_le_read_supported_states_sync(struct hci_dev *hdev) · 18 unmodified lines
3597 3597
3598/* LE Controller init stage 2 command sequence */3598/* LE Controller init stage 2 command sequence */
3599static const struct hci_init_stage le_init2[] = {3599static const struct hci_init_stage le_init2[] = {
3600 /* HCI_OP_LE_READ_BUFFER_SIZE */
3601 HCI_INIT(hci_le_read_buffer_size_sync),
3602 /* HCI_OP_LE_READ_LOCAL_FEATURES */3600 /* HCI_OP_LE_READ_LOCAL_FEATURES */
3603 HCI_INIT(hci_le_read_local_features_sync),3601 HCI_INIT(hci_le_read_local_features_sync),
3602 /* HCI_OP_LE_READ_BUFFER_SIZE */
3603 HCI_INIT(hci_le_read_buffer_size_sync),
3604 /* HCI_OP_LE_READ_SUPPORTED_STATES */3604 /* HCI_OP_LE_READ_SUPPORTED_STATES */
3605 HCI_INIT(hci_le_read_supported_states_sync),3605 HCI_INIT(hci_le_read_supported_states_sync),
3606 {}3606 {}
@@ -6187,20 +6187,13 @@ int hci_get_random_address(struct hci_dev *hdev, bool require_privacy, · 2580 unmodified lines
6187 6187
6188static int _update_adv_data_sync(struct hci_dev *hdev, void *data)6188static int _update_adv_data_sync(struct hci_dev *hdev, void *data)
6189{6189{
6190 u8 instance = *(u8 *)data;6190 u8 instance = PTR_ERR(data);
6191
6192 kfree(data);
6193 6191
6194 return hci_update_adv_data_sync(hdev, instance);6192 return hci_update_adv_data_sync(hdev, instance);
6195}6193}
6196 6194
6197int hci_update_adv_data(struct hci_dev *hdev, u8 instance)6195int hci_update_adv_data(struct hci_dev *hdev, u8 instance)
6198{6196{
6199 u8 *inst_ptr = kmalloc(1, GFP_KERNEL);6197 return hci_cmd_sync_queue(hdev, _update_adv_data_sync,
6200 6198 ERR_PTR(instance), NULL);
6201 if (!inst_ptr)
6202 return -ENOMEM;
6203
6204 *inst_ptr = instance;
6205 return hci_cmd_sync_queue(hdev, _update_adv_data_sync, inst_ptr, NULL);
6206}6199}
net/bluetooth/iso.c+26−38
@@ -289,15 +289,15 @@ static int iso_connect_bis(struct sock *sk) · 288 unmodified lines
289 hci_dev_unlock(hdev);289 hci_dev_unlock(hdev);
290 hci_dev_put(hdev);290 hci_dev_put(hdev);
291 291
292 err = iso_chan_add(conn, sk, NULL);
293 if (err)
294 return err;
295
292 lock_sock(sk);296 lock_sock(sk);
293 297
294 /* Update source addr of the socket */298 /* Update source addr of the socket */
295 bacpy(&iso_pi(sk)->src, &hcon->src);299 bacpy(&iso_pi(sk)->src, &hcon->src);
296 300
297 err = iso_chan_add(conn, sk, NULL);
298 if (err)
299 goto release;
300
301 if (hcon->state == BT_CONNECTED) {301 if (hcon->state == BT_CONNECTED) {
302 iso_sock_clear_timer(sk);302 iso_sock_clear_timer(sk);
303 sk->sk_state = BT_CONNECTED;303 sk->sk_state = BT_CONNECTED;
@@ -306,7 +306,6 @@ static int iso_connect_bis(struct sock *sk) · 2 unmodified lines
306 iso_sock_set_timer(sk, sk->sk_sndtimeo);306 iso_sock_set_timer(sk, sk->sk_sndtimeo);
307 }307 }
308 308
309release:
310 release_sock(sk);309 release_sock(sk);
311 return err;310 return err;
312 311
@@ -372,15 +371,15 @@ static int iso_connect_cis(struct sock *sk) · 59 unmodified lines
372 hci_dev_unlock(hdev);371 hci_dev_unlock(hdev);
373 hci_dev_put(hdev);372 hci_dev_put(hdev);
374 373
374 err = iso_chan_add(conn, sk, NULL);
375 if (err)
376 return err;
377
375 lock_sock(sk);378 lock_sock(sk);
376 379
377 /* Update source addr of the socket */380 /* Update source addr of the socket */
378 bacpy(&iso_pi(sk)->src, &hcon->src);381 bacpy(&iso_pi(sk)->src, &hcon->src);
379 382
380 err = iso_chan_add(conn, sk, NULL);
381 if (err)
382 goto release;
383
384 if (hcon->state == BT_CONNECTED) {383 if (hcon->state == BT_CONNECTED) {
385 iso_sock_clear_timer(sk);384 iso_sock_clear_timer(sk);
386 sk->sk_state = BT_CONNECTED;385 sk->sk_state = BT_CONNECTED;
@@ -392,7 +391,6 @@ static int iso_connect_cis(struct sock *sk) · 5 unmodified lines
392 iso_sock_set_timer(sk, sk->sk_sndtimeo);391 iso_sock_set_timer(sk, sk->sk_sndtimeo);
393 }392 }
394 393
395release:
396 release_sock(sk);394 release_sock(sk);
397 return err;395 return err;
398 396
@@ -895,13 +893,10 @@ static int iso_listen_bis(struct sock *sk) · 496 unmodified lines
895 if (!hdev)893 if (!hdev)
896 return -EHOSTUNREACH;894 return -EHOSTUNREACH;
897 895
898 hci_dev_lock(hdev);
899
900 err = hci_pa_create_sync(hdev, &iso_pi(sk)->dst,896 err = hci_pa_create_sync(hdev, &iso_pi(sk)->dst,
901 le_addr_type(iso_pi(sk)->dst_type),897 le_addr_type(iso_pi(sk)->dst_type),
902 iso_pi(sk)->bc_sid);898 iso_pi(sk)->bc_sid);
903 899
904 hci_dev_unlock(hdev);
905 hci_dev_put(hdev);900 hci_dev_put(hdev);
906 901
907 return err;902 return err;
@@ -1432,33 +1427,29 @@ static void iso_conn_ready(struct iso_conn *conn) · 524 unmodified lines
1432 struct sock *parent;1427 struct sock *parent;
1433 struct sock *sk = conn->sk;1428 struct sock *sk = conn->sk;
1434 struct hci_ev_le_big_sync_estabilished *ev;1429 struct hci_ev_le_big_sync_estabilished *ev;
1430 struct hci_conn *hcon;
1435 1431
1436 BT_DBG("conn %p", conn);1432 BT_DBG("conn %p", conn);
1437 1433
1438 if (sk) {1434 if (sk) {
1439 iso_sock_ready(conn->sk);1435 iso_sock_ready(conn->sk);
1440 } else {1436 } else {
1441 iso_conn_lock(conn);1437 hcon = conn->hcon;
1442 1438 if (!hcon)
1443 if (!conn->hcon) {
1444 iso_conn_unlock(conn);
1445 return;1439 return;
1446 }
1447 1440
1448 ev = hci_recv_event_data(conn->hcon->hdev,1441 ev = hci_recv_event_data(hcon->hdev,
1449 HCI_EVT_LE_BIG_SYNC_ESTABILISHED);1442 HCI_EVT_LE_BIG_SYNC_ESTABILISHED);
1450 if (ev)1443 if (ev)
1451 parent = iso_get_sock_listen(&conn->hcon->src,1444 parent = iso_get_sock_listen(&hcon->src,
1452 &conn->hcon->dst,1445 &hcon->dst,
1453 iso_match_big, ev);1446 iso_match_big, ev);
1454 else1447 else
1455 parent = iso_get_sock_listen(&conn->hcon->src,1448 parent = iso_get_sock_listen(&hcon->src,
1456 BDADDR_ANY, NULL, NULL);1449 BDADDR_ANY, NULL, NULL);
1457 1450
1458 if (!parent) {1451 if (!parent)
1459 iso_conn_unlock(conn);
1460 return;1452 return;
1461 }
1462 1453
1463 lock_sock(parent);1454 lock_sock(parent);
1464 1455
@@ -1466,30 +1457,29 @@ static void iso_conn_ready(struct iso_conn *conn) · 1 unmodified line
1466 BTPROTO_ISO, GFP_ATOMIC, 0);1457 BTPROTO_ISO, GFP_ATOMIC, 0);
1467 if (!sk) {1458 if (!sk) {
1468 release_sock(parent);1459 release_sock(parent);
1469 iso_conn_unlock(conn);
1470 return;1460 return;
1471 }1461 }
1472 1462
1473 iso_sock_init(sk, parent);1463 iso_sock_init(sk, parent);
1474 1464
1475 bacpy(&iso_pi(sk)->src, &conn->hcon->src);1465 bacpy(&iso_pi(sk)->src, &hcon->src);
1476 iso_pi(sk)->src_type = conn->hcon->src_type;1466 iso_pi(sk)->src_type = hcon->src_type;
1477 1467
1478 /* If hcon has no destination address (BDADDR_ANY) it means it1468 /* If hcon has no destination address (BDADDR_ANY) it means it
1479 * was created by HCI_EV_LE_BIG_SYNC_ESTABILISHED so we need to1469 * was created by HCI_EV_LE_BIG_SYNC_ESTABILISHED so we need to
1480 * initialize using the parent socket destination address.1470 * initialize using the parent socket destination address.
1481 */1471 */
1482 if (!bacmp(&conn->hcon->dst, BDADDR_ANY)) {1472 if (!bacmp(&hcon->dst, BDADDR_ANY)) {
1483 bacpy(&conn->hcon->dst, &iso_pi(parent)->dst);1473 bacpy(&hcon->dst, &iso_pi(parent)->dst);
1484 conn->hcon->dst_type = iso_pi(parent)->dst_type;1474 hcon->dst_type = iso_pi(parent)->dst_type;
1485 conn->hcon->sync_handle = iso_pi(parent)->sync_handle;1475 hcon->sync_handle = iso_pi(parent)->sync_handle;
1486 }1476 }
1487 1477
1488 bacpy(&iso_pi(sk)->dst, &conn->hcon->dst);1478 bacpy(&iso_pi(sk)->dst, &hcon->dst);
1489 iso_pi(sk)->dst_type = conn->hcon->dst_type;1479 iso_pi(sk)->dst_type = hcon->dst_type;
1490 1480
1491 hci_conn_hold(conn->hcon);1481 hci_conn_hold(hcon);
1492 __iso_chan_add(conn, sk, parent);1482 iso_chan_add(conn, sk, parent);
1493 1483
1494 if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags))1484 if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags))
1495 sk->sk_state = BT_CONNECT2;1485 sk->sk_state = BT_CONNECT2;
@@ -1500,8 +1490,6 @@ static void iso_conn_ready(struct iso_conn *conn) · 4 unmodified lines
1500 parent->sk_data_ready(parent);1490 parent->sk_data_ready(parent);
1501 1491
1502 release_sock(parent);1492 release_sock(parent);
1503
1504 iso_conn_unlock(conn);
1505 }1493 }
1506}1494}
1507 1495
net/bluetooth/mgmt_util.h+1−1
@@ -27,7 +27,7 @@ struct mgmt_mesh_tx { · 26 unmodified lines
27 struct sock *sk;27 struct sock *sk;
28 u8 handle;28 u8 handle;
29 u8 instance;29 u8 instance;
30 u8 param[sizeof(struct mgmt_cp_mesh_send) + 29];30 u8 param[sizeof(struct mgmt_cp_mesh_send) + 31];
31};31};
32 32
33struct mgmt_pending_cmd {33struct mgmt_pending_cmd {
net/bluetooth/rfcomm/sock.c+6−1
@@ -391,6 +391,7 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a · 390 unmodified lines
391 addr->sa_family != AF_BLUETOOTH)391 addr->sa_family != AF_BLUETOOTH)
392 return -EINVAL;392 return -EINVAL;
393 393
394 sock_hold(sk);
394 lock_sock(sk);395 lock_sock(sk);
395 396
396 if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) {397 if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) {
@@ -410,14 +411,18 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a · 13 unmodified lines
410 d->sec_level = rfcomm_pi(sk)->sec_level;411 d->sec_level = rfcomm_pi(sk)->sec_level;
411 d->role_switch = rfcomm_pi(sk)->role_switch;412 d->role_switch = rfcomm_pi(sk)->role_switch;
412 413
414 /* Drop sock lock to avoid potential deadlock with the RFCOMM lock */
415 release_sock(sk);
413 err = rfcomm_dlc_open(d, &rfcomm_pi(sk)->src, &sa->rc_bdaddr,416 err = rfcomm_dlc_open(d, &rfcomm_pi(sk)->src, &sa->rc_bdaddr,
414 sa->rc_channel);417 sa->rc_channel);
415 if (!err)418 lock_sock(sk);
419 if (!err && !sock_flag(sk, SOCK_ZAPPED))
416 err = bt_sock_wait_state(sk, BT_CONNECTED,420 err = bt_sock_wait_state(sk, BT_CONNECTED,
417 sock_sndtimeo(sk, flags & O_NONBLOCK));421 sock_sndtimeo(sk, flags & O_NONBLOCK));
418 422
419done:423done:
420 release_sock(sk);424 release_sock(sk);
425 sock_put(sk);
421 return err;426 return err;
422}427}
423 428
net/ethtool/rss.c+7−4
@@ -122,10 +122,13 @@ rss_fill_reply(struct sk_buff *skb, const struct ethnl_req_info *req_base, · 121 unmodified lines
122{122{
123 const struct rss_reply_data *data = RSS_REPDATA(reply_base);123 const struct rss_reply_data *data = RSS_REPDATA(reply_base);
124 124
125 if (nla_put_u32(skb, ETHTOOL_A_RSS_HFUNC, data->hfunc) ||125 if ((data->hfunc &&
126 nla_put(skb, ETHTOOL_A_RSS_INDIR,126 nla_put_u32(skb, ETHTOOL_A_RSS_HFUNC, data->hfunc)) ||
127 sizeof(u32) * data->indir_size, data->indir_table) ||127 (data->indir_size &&
128 nla_put(skb, ETHTOOL_A_RSS_HKEY, data->hkey_size, data->hkey))128 nla_put(skb, ETHTOOL_A_RSS_INDIR,
129 sizeof(u32) * data->indir_size, data->indir_table)) ||
130 (data->hkey_size &&
131 nla_put(skb, ETHTOOL_A_RSS_HKEY, data->hkey_size, data->hkey)))
129 return -EMSGSIZE;132 return -EMSGSIZE;
130 133
131 return 0;134 return 0;
net/ipv4/inet_hashtables.c+15−2
@@ -650,8 +650,20 @@ bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) · 649 unmodified lines
650 spin_lock(lock);650 spin_lock(lock);
651 if (osk) {651 if (osk) {
652 WARN_ON_ONCE(sk->sk_hash != osk->sk_hash);652 WARN_ON_ONCE(sk->sk_hash != osk->sk_hash);
653 ret = sk_nulls_del_node_init_rcu(osk);653 ret = sk_hashed(osk);
654 } else if (found_dup_sk) {654 if (ret) {
655 /* Before deleting the node, we insert a new one to make
656 * sure that the look-up-sk process would not miss either
657 * of them and that at least one node would exist in ehash
658 * table all the time. Otherwise there's a tiny chance
659 * that lookup process could find nothing in ehash table.
660 */
661 __sk_nulls_add_node_tail_rcu(sk, list);
662 sk_nulls_del_node_init_rcu(osk);
663 }
664 goto unlock;
665 }
666 if (found_dup_sk) {
655 *found_dup_sk = inet_ehash_lookup_by_sk(sk, list);667 *found_dup_sk = inet_ehash_lookup_by_sk(sk, list);
656 if (*found_dup_sk)668 if (*found_dup_sk)
657 ret = false;669 ret = false;
@@ -660,6 +672,7 @@ bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) · 2 unmodified lines
660 if (ret)672 if (ret)
661 __sk_nulls_add_node_rcu(sk, list);673 __sk_nulls_add_node_rcu(sk, list);
662 674
675unlock:
663 spin_unlock(lock);676 spin_unlock(lock);
664 677
665 return ret;678 return ret;
net/ipv4/inet_timewait_sock.c+4−4
@@ -91,10 +91,10 @@ void inet_twsk_put(struct inet_timewait_sock *tw) · 90 unmodified lines
91}91}
92EXPORT_SYMBOL_GPL(inet_twsk_put);92EXPORT_SYMBOL_GPL(inet_twsk_put);
93 93
94static void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,94static void inet_twsk_add_node_tail_rcu(struct inet_timewait_sock *tw,
95 struct hlist_nulls_head *list)95 struct hlist_nulls_head *list)
96{96{
97 hlist_nulls_add_head_rcu(&tw->tw_node, list);97 hlist_nulls_add_tail_rcu(&tw->tw_node, list);
98}98}
99 99
100static void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,100static void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
@@ -147,7 +147,7 @@ void inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, · 46 unmodified lines
147 147
148 spin_lock(lock);148 spin_lock(lock);
149 149
150 inet_twsk_add_node_rcu(tw, &ehead->chain);150 inet_twsk_add_node_tail_rcu(tw, &ehead->chain);
151 151
152 /* Step 3: Remove SK from hash chain */152 /* Step 3: Remove SK from hash chain */
153 if (__sk_nulls_del_node_init_rcu(sk))153 if (__sk_nulls_del_node_init_rcu(sk))
net/ipv4/tcp.c+2−0
@@ -435,6 +435,7 @@ void tcp_init_sock(struct sock *sk) · 434 unmodified lines
435 435
436 /* There's a bubble in the pipe until at least the first ACK. */436 /* There's a bubble in the pipe until at least the first ACK. */
437 tp->app_limited = ~0U;437 tp->app_limited = ~0U;
438 tp->rate_app_limited = 1;
438 439
439 /* See draft-stevens-tcpca-spec-01 for discussion of the440 /* See draft-stevens-tcpca-spec-01 for discussion of the
440 * initialization of these values.441 * initialization of these values.
@@ -3178,6 +3179,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 2737 unmodified lines
3178 tp->plb_rehash = 0;3179 tp->plb_rehash = 0;
3179 /* There's a bubble in the pipe until at least the first ACK. */3180 /* There's a bubble in the pipe until at least the first ACK. */
3180 tp->app_limited = ~0U;3181 tp->app_limited = ~0U;
3182 tp->rate_app_limited = 1;
3181 tp->rack.mstamp = 0;3183 tp->rack.mstamp = 0;
3182 tp->rack.advanced = 0;3184 tp->rack.advanced = 0;
3183 tp->rack.reo_wnd_steps = 1;3185 tp->rack.reo_wnd_steps = 1;
net/ipv4/tcp_ulp.c+1−1
@@ -139,7 +139,7 @@ static int __tcp_set_ulp(struct sock *sk, const struct tcp_ulp_ops *ulp_ops) · 138 unmodified lines
139 if (sk->sk_socket)139 if (sk->sk_socket)
140 clear_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags);140 clear_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags);
141 141
142 err = -EINVAL;142 err = -ENOTCONN;
143 if (!ulp_ops->clone && sk->sk_state == TCP_LISTEN)143 if (!ulp_ops->clone && sk->sk_state == TCP_LISTEN)
144 goto out_err;144 goto out_err;
145 145
net/l2tp/l2tp_core.c+50−52
@@ -104,9 +104,9 @@ static struct workqueue_struct *l2tp_wq; · 103 unmodified lines
104/* per-net private data for this module */104/* per-net private data for this module */
105static unsigned int l2tp_net_id;105static unsigned int l2tp_net_id;
106struct l2tp_net {106struct l2tp_net {
107 struct list_head l2tp_tunnel_list;107 /* Lock for write access to l2tp_tunnel_idr */
108 /* Lock for write access to l2tp_tunnel_list */108 spinlock_t l2tp_tunnel_idr_lock;
109 spinlock_t l2tp_tunnel_list_lock;109 struct idr l2tp_tunnel_idr;
110 struct hlist_head l2tp_session_hlist[L2TP_HASH_SIZE_2];110 struct hlist_head l2tp_session_hlist[L2TP_HASH_SIZE_2];
111 /* Lock for write access to l2tp_session_hlist */111 /* Lock for write access to l2tp_session_hlist */
112 spinlock_t l2tp_session_hlist_lock;112 spinlock_t l2tp_session_hlist_lock;
@@ -208,13 +208,10 @@ struct l2tp_tunnel *l2tp_tunnel_get(const struct net *net, u32 tunnel_id) · 95 unmodified lines
208 struct l2tp_tunnel *tunnel;208 struct l2tp_tunnel *tunnel;
209 209
210 rcu_read_lock_bh();210 rcu_read_lock_bh();
211 list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {211 tunnel = idr_find(&pn->l2tp_tunnel_idr, tunnel_id);
212 if (tunnel->tunnel_id == tunnel_id &&212 if (tunnel && refcount_inc_not_zero(&tunnel->ref_count)) {
213 refcount_inc_not_zero(&tunnel->ref_count)) {213 rcu_read_unlock_bh();
214 rcu_read_unlock_bh();214 return tunnel;
215
216 return tunnel;
217 }
218 }215 }
219 rcu_read_unlock_bh();216 rcu_read_unlock_bh();
220 217
@@ -224,13 +221,14 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_get); · 3 unmodified lines
224 221
225struct l2tp_tunnel *l2tp_tunnel_get_nth(const struct net *net, int nth)222struct l2tp_tunnel *l2tp_tunnel_get_nth(const struct net *net, int nth)
226{223{
227 const struct l2tp_net *pn = l2tp_pernet(net);224 struct l2tp_net *pn = l2tp_pernet(net);
225 unsigned long tunnel_id, tmp;
228 struct l2tp_tunnel *tunnel;226 struct l2tp_tunnel *tunnel;
229 int count = 0;227 int count = 0;
230 228
231 rcu_read_lock_bh();229 rcu_read_lock_bh();
232 list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {230 idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) {
233 if (++count > nth &&231 if (tunnel && ++count > nth &&
234 refcount_inc_not_zero(&tunnel->ref_count)) {232 refcount_inc_not_zero(&tunnel->ref_count)) {
235 rcu_read_unlock_bh();233 rcu_read_unlock_bh();
236 return tunnel;234 return tunnel;
@@ -1043,7 +1041,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, uns · 806 unmodified lines
1043 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED);1041 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED);
1044 nf_reset_ct(skb);1042 nf_reset_ct(skb);
1045 1043
1046 bh_lock_sock(sk);1044 bh_lock_sock_nested(sk);
1047 if (sock_owned_by_user(sk)) {1045 if (sock_owned_by_user(sk)) {
1048 kfree_skb(skb);1046 kfree_skb(skb);
1049 ret = NET_XMIT_DROP;1047 ret = NET_XMIT_DROP;
@@ -1227,6 +1225,15 @@ static void l2tp_udp_encap_destroy(struct sock *sk) · 177 unmodified lines
1227 l2tp_tunnel_delete(tunnel);1225 l2tp_tunnel_delete(tunnel);
1228}1226}
1229 1227
1228static void l2tp_tunnel_remove(struct net *net, struct l2tp_tunnel *tunnel)
1229{
1230 struct l2tp_net *pn = l2tp_pernet(net);
1231
1232 spin_lock_bh(&pn->l2tp_tunnel_idr_lock);
1233 idr_remove(&pn->l2tp_tunnel_idr, tunnel->tunnel_id);
1234 spin_unlock_bh(&pn->l2tp_tunnel_idr_lock);
1235}
1236
1230/* Workqueue tunnel deletion function */1237/* Workqueue tunnel deletion function */
1231static void l2tp_tunnel_del_work(struct work_struct *work)1238static void l2tp_tunnel_del_work(struct work_struct *work)
1232{1239{
@@ -1234,7 +1241,6 @@ static void l2tp_tunnel_del_work(struct work_struct *work) · 1 unmodified line
1234 del_work);1241 del_work);
1235 struct sock *sk = tunnel->sock;1242 struct sock *sk = tunnel->sock;
1236 struct socket *sock = sk->sk_socket;1243 struct socket *sock = sk->sk_socket;
1237 struct l2tp_net *pn;
1238 1244
1239 l2tp_tunnel_closeall(tunnel);1245 l2tp_tunnel_closeall(tunnel);
1240 1246
@@ -1248,12 +1254,7 @@ static void l2tp_tunnel_del_work(struct work_struct *work) · 7 unmodified lines
1248 }1254 }
1249 }1255 }
1250 1256
1251 /* Remove the tunnel struct from the tunnel list */1257 l2tp_tunnel_remove(tunnel->l2tp_net, tunnel);
1252 pn = l2tp_pernet(tunnel->l2tp_net);
1253 spin_lock_bh(&pn->l2tp_tunnel_list_lock);
1254 list_del_rcu(&tunnel->list);
1255 spin_unlock_bh(&pn->l2tp_tunnel_list_lock);
1256
1257 /* drop initial ref */1258 /* drop initial ref */
1258 l2tp_tunnel_dec_refcount(tunnel);1259 l2tp_tunnel_dec_refcount(tunnel);
1259 1260
@@ -1384,8 +1385,6 @@ out: · 124 unmodified lines
1384 return err;1385 return err;
1385}1386}
1386 1387
1387static struct lock_class_key l2tp_socket_class;
1388
1389int l2tp_tunnel_create(int fd, int version, u32 tunnel_id, u32 peer_tunnel_id,1388int l2tp_tunnel_create(int fd, int version, u32 tunnel_id, u32 peer_tunnel_id,
1390 struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp)1389 struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp)
1391{1390{
@@ -1455,12 +1454,19 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net, · 63 unmodified lines
1455int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net,1454int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net,
1456 struct l2tp_tunnel_cfg *cfg)1455 struct l2tp_tunnel_cfg *cfg)
1457{1456{
1458 struct l2tp_tunnel *tunnel_walk;1457 struct l2tp_net *pn = l2tp_pernet(net);
1459 struct l2tp_net *pn;1458 u32 tunnel_id = tunnel->tunnel_id;
1460 struct socket *sock;1459 struct socket *sock;
1461 struct sock *sk;1460 struct sock *sk;
1462 int ret;1461 int ret;
1463 1462
1463 spin_lock_bh(&pn->l2tp_tunnel_idr_lock);
1464 ret = idr_alloc_u32(&pn->l2tp_tunnel_idr, NULL, &tunnel_id, tunnel_id,
1465 GFP_ATOMIC);
1466 spin_unlock_bh(&pn->l2tp_tunnel_idr_lock);
1467 if (ret)
1468 return ret == -ENOSPC ? -EEXIST : ret;
1469
1464 if (tunnel->fd < 0) {1470 if (tunnel->fd < 0) {
1465 ret = l2tp_tunnel_sock_create(net, tunnel->tunnel_id,1471 ret = l2tp_tunnel_sock_create(net, tunnel->tunnel_id,
1466 tunnel->peer_tunnel_id, cfg,1472 tunnel->peer_tunnel_id, cfg,
@@ -1474,6 +1480,7 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 7 unmodified lines
1474 }1480 }
1475 1481
1476 sk = sock->sk;1482 sk = sock->sk;
1483 lock_sock(sk);
1477 write_lock_bh(&sk->sk_callback_lock);1484 write_lock_bh(&sk->sk_callback_lock);
1478 ret = l2tp_validate_socket(sk, net, tunnel->encap);1485 ret = l2tp_validate_socket(sk, net, tunnel->encap);
1479 if (ret < 0)1486 if (ret < 0)
@@ -1481,24 +1488,6 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 1 unmodified line
1481 rcu_assign_sk_user_data(sk, tunnel);1488 rcu_assign_sk_user_data(sk, tunnel);
1482 write_unlock_bh(&sk->sk_callback_lock);1489 write_unlock_bh(&sk->sk_callback_lock);
1483 1490
1484 tunnel->l2tp_net = net;
1485 pn = l2tp_pernet(net);
1486
1487 sock_hold(sk);
1488 tunnel->sock = sk;
1489
1490 spin_lock_bh(&pn->l2tp_tunnel_list_lock);
1491 list_for_each_entry(tunnel_walk, &pn->l2tp_tunnel_list, list) {
1492 if (tunnel_walk->tunnel_id == tunnel->tunnel_id) {
1493 spin_unlock_bh(&pn->l2tp_tunnel_list_lock);
1494 sock_put(sk);
1495 ret = -EEXIST;
1496 goto err_sock;
1497 }
1498 }
1499 list_add_rcu(&tunnel->list, &pn->l2tp_tunnel_list);
1500 spin_unlock_bh(&pn->l2tp_tunnel_list_lock);
1501
1502 if (tunnel->encap == L2TP_ENCAPTYPE_UDP) {1491 if (tunnel->encap == L2TP_ENCAPTYPE_UDP) {
1503 struct udp_tunnel_sock_cfg udp_cfg = {1492 struct udp_tunnel_sock_cfg udp_cfg = {
1504 .sk_user_data = tunnel,1493 .sk_user_data = tunnel,
@@ -1512,9 +1501,16 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 7 unmodified lines
1512 1501
1513 tunnel->old_sk_destruct = sk->sk_destruct;1502 tunnel->old_sk_destruct = sk->sk_destruct;
1514 sk->sk_destruct = &l2tp_tunnel_destruct;1503 sk->sk_destruct = &l2tp_tunnel_destruct;
1515 lockdep_set_class_and_name(&sk->sk_lock.slock, &l2tp_socket_class,
1516 "l2tp_sock");
1517 sk->sk_allocation = GFP_ATOMIC;1504 sk->sk_allocation = GFP_ATOMIC;
1505 release_sock(sk);
1506
1507 sock_hold(sk);
1508 tunnel->sock = sk;
1509 tunnel->l2tp_net = net;
1510
1511 spin_lock_bh(&pn->l2tp_tunnel_idr_lock);
1512 idr_replace(&pn->l2tp_tunnel_idr, tunnel, tunnel->tunnel_id);
1513 spin_unlock_bh(&pn->l2tp_tunnel_idr_lock);
1518 1514
1519 trace_register_tunnel(tunnel);1515 trace_register_tunnel(tunnel);
1520 1516
@@ -1523,17 +1519,16 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 2 unmodified lines
1523 1519
1524 return 0;1520 return 0;
1525 1521
1526err_sock:
1527 write_lock_bh(&sk->sk_callback_lock);
1528 rcu_assign_sk_user_data(sk, NULL);
1529err_inval_sock:1522err_inval_sock:
1530 write_unlock_bh(&sk->sk_callback_lock);1523 write_unlock_bh(&sk->sk_callback_lock);
1524 release_sock(sk);
1531 1525
1532 if (tunnel->fd < 0)1526 if (tunnel->fd < 0)
1533 sock_release(sock);1527 sock_release(sock);
1534 else1528 else
1535 sockfd_put(sock);1529 sockfd_put(sock);
1536err:1530err:
1531 l2tp_tunnel_remove(net, tunnel);
1537 return ret;1532 return ret;
1538}1533}
1539EXPORT_SYMBOL_GPL(l2tp_tunnel_register);1534EXPORT_SYMBOL_GPL(l2tp_tunnel_register);
@@ -1647,8 +1642,8 @@ static __net_init int l2tp_init_net(struct net *net) · 107 unmodified lines
1647 struct l2tp_net *pn = net_generic(net, l2tp_net_id);1642 struct l2tp_net *pn = net_generic(net, l2tp_net_id);
1648 int hash;1643 int hash;
1649 1644
1650 INIT_LIST_HEAD(&pn->l2tp_tunnel_list);1645 idr_init(&pn->l2tp_tunnel_idr);
1651 spin_lock_init(&pn->l2tp_tunnel_list_lock);1646 spin_lock_init(&pn->l2tp_tunnel_idr_lock);
1652 1647
1653 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)1648 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
1654 INIT_HLIST_HEAD(&pn->l2tp_session_hlist[hash]);1649 INIT_HLIST_HEAD(&pn->l2tp_session_hlist[hash]);
@@ -1662,11 +1657,13 @@ static __net_exit void l2tp_exit_net(struct net *net) · 7 unmodified lines
1662{1657{
1663 struct l2tp_net *pn = l2tp_pernet(net);1658 struct l2tp_net *pn = l2tp_pernet(net);
1664 struct l2tp_tunnel *tunnel = NULL;1659 struct l2tp_tunnel *tunnel = NULL;
1660 unsigned long tunnel_id, tmp;
1665 int hash;1661 int hash;
1666 1662
1667 rcu_read_lock_bh();1663 rcu_read_lock_bh();
1668 list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {1664 idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) {
1669 l2tp_tunnel_delete(tunnel);1665 if (tunnel)
1666 l2tp_tunnel_delete(tunnel);
1670 }1667 }
1671 rcu_read_unlock_bh();1668 rcu_read_unlock_bh();
1672 1669
@@ -1676,6 +1673,7 @@ static __net_exit void l2tp_exit_net(struct net *net) · 3 unmodified lines
1676 1673
1677 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)1674 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
1678 WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash]));1675 WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash]));
1676 idr_destroy(&pn->l2tp_tunnel_idr);
1679}1677}
1680 1678
1681static struct pernet_operations l2tp_net_ops = {1679static struct pernet_operations l2tp_net_ops = {
net/mac80211/agg-tx.c+5−3
@@ -491,7 +491,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 490 unmodified lines
491{491{
492 struct tid_ampdu_tx *tid_tx;492 struct tid_ampdu_tx *tid_tx;
493 struct ieee80211_local *local = sta->local;493 struct ieee80211_local *local = sta->local;
494 struct ieee80211_sub_if_data *sdata = sta->sdata;494 struct ieee80211_sub_if_data *sdata;
495 struct ieee80211_ampdu_params params = {495 struct ieee80211_ampdu_params params = {
496 .sta = &sta->sta,496 .sta = &sta->sta,
497 .action = IEEE80211_AMPDU_TX_START,497 .action = IEEE80211_AMPDU_TX_START,
@@ -511,8 +511,6 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 13 unmodified lines
511 */511 */
512 clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);512 clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
513 513
514 ieee80211_agg_stop_txq(sta, tid);
515
516 /*514 /*
517 * Make sure no packets are being processed. This ensures that515 * Make sure no packets are being processed. This ensures that
518 * we have a valid starting sequence number and that in-flight516 * we have a valid starting sequence number and that in-flight
@@ -521,6 +519,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 2 unmodified lines
521 */519 */
522 synchronize_net();520 synchronize_net();
523 521
522 sdata = sta->sdata;
524 params.ssn = sta->tid_seq[tid] >> 4;523 params.ssn = sta->tid_seq[tid] >> 4;
525 ret = drv_ampdu_action(local, sdata, &params);524 ret = drv_ampdu_action(local, sdata, &params);
526 tid_tx->ssn = params.ssn;525 tid_tx->ssn = params.ssn;
@@ -534,6 +533,9 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 7 unmodified lines
534 */533 */
535 set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state);534 set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state);
536 } else if (ret) {535 } else if (ret) {
536 if (!sdata)
537 return;
538
537 ht_dbg(sdata,539 ht_dbg(sdata,
538 "BA request denied - HW unavailable for %pM tid %d\n",540 "BA request denied - HW unavailable for %pM tid %d\n",
539 sta->sta.addr, tid);541 sta->sta.addr, tid);
net/mac80211/cfg.c+7−0
@@ -147,6 +147,7 @@ static int ieee80211_set_ap_mbssid_options(struct ieee80211_sub_if_data *sdata, · 146 unmodified lines
147 link_conf->bssid_index = 0;147 link_conf->bssid_index = 0;
148 link_conf->nontransmitted = false;148 link_conf->nontransmitted = false;
149 link_conf->ema_ap = false;149 link_conf->ema_ap = false;
150 link_conf->bssid_indicator = 0;
150 151
151 if (sdata->vif.type != NL80211_IFTYPE_AP || !params.tx_wdev)152 if (sdata->vif.type != NL80211_IFTYPE_AP || !params.tx_wdev)
152 return -EINVAL;153 return -EINVAL;
@@ -1511,6 +1512,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, · 1358 unmodified lines
1511 kfree(link_conf->ftmr_params);1512 kfree(link_conf->ftmr_params);
1512 link_conf->ftmr_params = NULL;1513 link_conf->ftmr_params = NULL;
1513 1514
1515 sdata->vif.mbssid_tx_vif = NULL;
1516 link_conf->bssid_index = 0;
1517 link_conf->nontransmitted = false;
1518 link_conf->ema_ap = false;
1519 link_conf->bssid_indicator = 0;
1520
1514 __sta_info_flush(sdata, true);1521 __sta_info_flush(sdata, true);
1515 ieee80211_free_keys(sdata, true);1522 ieee80211_free_keys(sdata, true);
1516 1523
net/mac80211/debugfs_sta.c+3−2
@@ -167,7 +167,7 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf, · 166 unmodified lines
167 continue;167 continue;
168 txqi = to_txq_info(sta->sta.txq[i]);168 txqi = to_txq_info(sta->sta.txq[i]);
169 p += scnprintf(p, bufsz + buf - p,169 p += scnprintf(p, bufsz + buf - p,
170 "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s)\n",170 "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s%s)\n",
171 txqi->txq.tid,171 txqi->txq.tid,
172 txqi->txq.ac,172 txqi->txq.ac,
173 txqi->tin.backlog_bytes,173 txqi->tin.backlog_bytes,
@@ -182,7 +182,8 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf, · 8 unmodified lines
182 txqi->flags,182 txqi->flags,
183 test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ? "STOP" : "RUN",183 test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ? "STOP" : "RUN",
184 test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags) ? " AMPDU" : "",184 test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags) ? " AMPDU" : "",
185 test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : "");185 test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : "",
186 test_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) ? " DIRTY" : "");
186 }187 }
187 188
188 rcu_read_unlock();189 rcu_read_unlock();
net/mac80211/driver-ops.c+3−0
@@ -392,6 +392,9 @@ int drv_ampdu_action(struct ieee80211_local *local, · 391 unmodified lines
392 392
393 might_sleep();393 might_sleep();
394 394
395 if (!sdata)
396 return -EIO;
397
395 sdata = get_bss_sdata(sdata);398 sdata = get_bss_sdata(sdata);
396 if (!check_sdata_in_driver(sdata))399 if (!check_sdata_in_driver(sdata))
397 return -EIO;400 return -EIO;
net/mac80211/driver-ops.h+1−1
@@ -1199,7 +1199,7 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, · 1198 unmodified lines
1199 1199
1200 /* In reconfig don't transmit now, but mark for waking later */1200 /* In reconfig don't transmit now, but mark for waking later */
1201 if (local->in_reconfig) {1201 if (local->in_reconfig) {
1202 set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags);1202 set_bit(IEEE80211_TXQ_DIRTY, &txq->flags);
1203 return;1203 return;
1204 }1204 }
1205 1205
net/mac80211/ht.c+31−0
@@ -391,6 +391,37 @@ void ieee80211_ba_session_work(struct work_struct *work) · 390 unmodified lines
391 391
392 tid_tx = sta->ampdu_mlme.tid_start_tx[tid];392 tid_tx = sta->ampdu_mlme.tid_start_tx[tid];
393 if (!blocked && tid_tx) {393 if (!blocked && tid_tx) {
394 struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
395 struct ieee80211_sub_if_data *sdata =
396 vif_to_sdata(txqi->txq.vif);
397 struct fq *fq = &sdata->local->fq;
398
399 spin_lock_bh(&fq->lock);
400
401 /* Allow only frags to be dequeued */
402 set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
403
404 if (!skb_queue_empty(&txqi->frags)) {
405 /* Fragmented Tx is ongoing, wait for it to
406 * finish. Reschedule worker to retry later.
407 */
408
409 spin_unlock_bh(&fq->lock);
410 spin_unlock_bh(&sta->lock);
411
412 /* Give the task working on the txq a chance
413 * to send out the queued frags
414 */
415 synchronize_net();
416
417 mutex_unlock(&sta->ampdu_mlme.mtx);
418
419 ieee80211_queue_work(&sdata->local->hw, work);
420 return;
421 }
422
423 spin_unlock_bh(&fq->lock);
424
394 /*425 /*
395 * Assign it over to the normal tid_tx array426 * Assign it over to the normal tid_tx array
396 * where it "goes live".427 * where it "goes live".
net/mac80211/ieee80211_i.h+1−1
@@ -838,7 +838,7 @@ enum txq_info_flags { · 837 unmodified lines
838 IEEE80211_TXQ_STOP,838 IEEE80211_TXQ_STOP,
839 IEEE80211_TXQ_AMPDU,839 IEEE80211_TXQ_AMPDU,
840 IEEE80211_TXQ_NO_AMSDU,840 IEEE80211_TXQ_NO_AMSDU,
841 IEEE80211_TXQ_STOP_NETIF_TX,841 IEEE80211_TXQ_DIRTY,
842};842};
843 843
844/**844/**
net/mac80211/iface.c+3−2
@@ -364,7 +364,9 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, · 363 unmodified lines
364 364
365 /* No support for VLAN with MLO yet */365 /* No support for VLAN with MLO yet */
366 if (iftype == NL80211_IFTYPE_AP_VLAN &&366 if (iftype == NL80211_IFTYPE_AP_VLAN &&
367 nsdata->wdev.use_4addr)367 sdata->wdev.use_4addr &&
368 nsdata->vif.type == NL80211_IFTYPE_AP &&
369 nsdata->vif.valid_links)
368 return -EOPNOTSUPP;370 return -EOPNOTSUPP;
369 371
370 /*372 /*
@@ -2195,7 +2197,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 1824 unmodified lines
2195 2197
2196 ret = cfg80211_register_netdevice(ndev);2198 ret = cfg80211_register_netdevice(ndev);
2197 if (ret) {2199 if (ret) {
2198 ieee80211_if_free(ndev);
2199 free_netdev(ndev);2200 free_netdev(ndev);
2200 return ret;2201 return ret;
2201 }2202 }
net/mac80211/rx.c+102−123
@@ -4049,6 +4049,58 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx) · 4048 unmodified lines
4049#undef CALL_RXH4049#undef CALL_RXH
4050}4050}
4051 4051
4052static bool
4053ieee80211_rx_is_valid_sta_link_id(struct ieee80211_sta *sta, u8 link_id)
4054{
4055 if (!sta->mlo)
4056 return false;
4057
4058 return !!(sta->valid_links & BIT(link_id));
4059}
4060
4061static bool ieee80211_rx_data_set_link(struct ieee80211_rx_data *rx,
4062 u8 link_id)
4063{
4064 rx->link_id = link_id;
4065 rx->link = rcu_dereference(rx->sdata->link[link_id]);
4066
4067 if (!rx->sta)
4068 return rx->link;
4069
4070 if (!ieee80211_rx_is_valid_sta_link_id(&rx->sta->sta, link_id))
4071 return false;
4072
4073 rx->link_sta = rcu_dereference(rx->sta->link[link_id]);
4074
4075 return rx->link && rx->link_sta;
4076}
4077
4078static bool ieee80211_rx_data_set_sta(struct ieee80211_rx_data *rx,
4079 struct ieee80211_sta *pubsta,
4080 int link_id)
4081{
4082 struct sta_info *sta;
4083
4084 sta = container_of(pubsta, struct sta_info, sta);
4085
4086 rx->link_id = link_id;
4087 rx->sta = sta;
4088
4089 if (sta) {
4090 rx->local = sta->sdata->local;
4091 if (!rx->sdata)
4092 rx->sdata = sta->sdata;
4093 rx->link_sta = &sta->deflink;
4094 }
4095
4096 if (link_id < 0)
4097 rx->link = &rx->sdata->deflink;
4098 else if (!ieee80211_rx_data_set_link(rx, link_id))
4099 return false;
4100
4101 return true;
4102}
4103
4052/*4104/*
4053 * This function makes calls into the RX path, therefore4105 * This function makes calls into the RX path, therefore
4054 * it has to be invoked under RCU read lock.4106 * it has to be invoked under RCU read lock.
@@ -4057,16 +4109,19 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) · 2 unmodified lines
4057{4109{
4058 struct sk_buff_head frames;4110 struct sk_buff_head frames;
4059 struct ieee80211_rx_data rx = {4111 struct ieee80211_rx_data rx = {
4060 .sta = sta,
4061 .sdata = sta->sdata,
4062 .local = sta->local,
4063 /* This is OK -- must be QoS data frame */4112 /* This is OK -- must be QoS data frame */
4064 .security_idx = tid,4113 .security_idx = tid,
4065 .seqno_idx = tid,4114 .seqno_idx = tid,
4066 .link_id = -1,
4067 };4115 };
4068 struct tid_ampdu_rx *tid_agg_rx;4116 struct tid_ampdu_rx *tid_agg_rx;
4069 u8 link_id;4117 int link_id = -1;
4118
4119 /* FIXME: statistics won't be right with this */
4120 if (sta->sta.valid_links)
4121 link_id = ffs(sta->sta.valid_links) - 1;
4122
4123 if (!ieee80211_rx_data_set_sta(&rx, &sta->sta, link_id))
4124 return;
4070 4125
4071 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);4126 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
4072 if (!tid_agg_rx)4127 if (!tid_agg_rx)
@@ -4086,10 +4141,6 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) · 13 unmodified lines
4086 };4141 };
4087 drv_event_callback(rx.local, rx.sdata, &event);4142 drv_event_callback(rx.local, rx.sdata, &event);
4088 }4143 }
4089 /* FIXME: statistics won't be right with this */
4090 link_id = sta->sta.valid_links ? ffs(sta->sta.valid_links) - 1 : 0;
4091 rx.link = rcu_dereference(sta->sdata->link[link_id]);
4092 rx.link_sta = rcu_dereference(sta->link[link_id]);
4093 4144
4094 ieee80211_rx_handlers(&rx, &frames);4145 ieee80211_rx_handlers(&rx, &frames);
4095}4146}
@@ -4105,7 +4156,6 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, · 9 unmodified lines
4105 /* This is OK -- must be QoS data frame */4156 /* This is OK -- must be QoS data frame */
4106 .security_idx = tid,4157 .security_idx = tid,
4107 .seqno_idx = tid,4158 .seqno_idx = tid,
4108 .link_id = -1,
4109 };4159 };
4110 int i, diff;4160 int i, diff;
4111 4161
@@ -4116,10 +4166,8 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, · 4 unmodified lines
4116 4166
4117 sta = container_of(pubsta, struct sta_info, sta);4167 sta = container_of(pubsta, struct sta_info, sta);
4118 4168
4119 rx.sta = sta;4169 if (!ieee80211_rx_data_set_sta(&rx, pubsta, -1))
4120 rx.sdata = sta->sdata;4170 return;
4121 rx.link = &rx.sdata->deflink;
4122 rx.local = sta->local;
4123 4171
4124 rcu_read_lock();4172 rcu_read_lock();
4125 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);4173 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
@@ -4506,15 +4554,6 @@ void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata) · 380 unmodified lines
4506 mutex_unlock(&local->sta_mtx);4554 mutex_unlock(&local->sta_mtx);
4507}4555}
4508 4556
4509static bool
4510ieee80211_rx_is_valid_sta_link_id(struct ieee80211_sta *sta, u8 link_id)
4511{
4512 if (!sta->mlo)
4513 return false;
4514
4515 return !!(sta->valid_links & BIT(link_id));
4516}
4517
4518static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,4557static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
4519 struct ieee80211_fast_rx *fast_rx,4558 struct ieee80211_fast_rx *fast_rx,
4520 int orig_len)4559 int orig_len)
@@ -4625,7 +4664,6 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 104 unmodified lines
4625 struct sk_buff *skb = rx->skb;4664 struct sk_buff *skb = rx->skb;
4626 struct ieee80211_hdr *hdr = (void *)skb->data;4665 struct ieee80211_hdr *hdr = (void *)skb->data;
4627 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);4666 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
4628 struct sta_info *sta = rx->sta;
4629 int orig_len = skb->len;4667 int orig_len = skb->len;
4630 int hdrlen = ieee80211_hdrlen(hdr->frame_control);4668 int hdrlen = ieee80211_hdrlen(hdr->frame_control);
4631 int snap_offs = hdrlen;4669 int snap_offs = hdrlen;
@@ -4637,7 +4675,6 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 5 unmodified lines
4637 u8 da[ETH_ALEN];4675 u8 da[ETH_ALEN];
4638 u8 sa[ETH_ALEN];4676 u8 sa[ETH_ALEN];
4639 } addrs __aligned(2);4677 } addrs __aligned(2);
4640 struct link_sta_info *link_sta;
4641 struct ieee80211_sta_rx_stats *stats;4678 struct ieee80211_sta_rx_stats *stats;
4642 4679
4643 /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write4680 /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write
@@ -4740,18 +4777,10 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 96 unmodified lines
4740 drop:4777 drop:
4741 dev_kfree_skb(skb);4778 dev_kfree_skb(skb);
4742 4779
4743 if (rx->link_id >= 0) {
4744 link_sta = rcu_dereference(sta->link[rx->link_id]);
4745 if (!link_sta)
4746 return true;
4747 } else {
4748 link_sta = &sta->deflink;
4749 }
4750
4751 if (fast_rx->uses_rss)4780 if (fast_rx->uses_rss)
4752 stats = this_cpu_ptr(link_sta->pcpu_rx_stats);4781 stats = this_cpu_ptr(rx->link_sta->pcpu_rx_stats);
4753 else4782 else
4754 stats = &link_sta->rx_stats;4783 stats = &rx->link_sta->rx_stats;
4755 4784
4756 stats->dropped++;4785 stats->dropped++;
4757 return true;4786 return true;
@@ -4769,8 +4798,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 11 unmodified lines
4769 struct ieee80211_local *local = rx->local;4798 struct ieee80211_local *local = rx->local;
4770 struct ieee80211_sub_if_data *sdata = rx->sdata;4799 struct ieee80211_sub_if_data *sdata = rx->sdata;
4771 struct ieee80211_hdr *hdr = (void *)skb->data;4800 struct ieee80211_hdr *hdr = (void *)skb->data;
4772 struct link_sta_info *link_sta = NULL;4801 struct link_sta_info *link_sta = rx->link_sta;
4773 struct ieee80211_link_data *link;4802 struct ieee80211_link_data *link = rx->link;
4774 4803
4775 rx->skb = skb;4804 rx->skb = skb;
4776 4805
@@ -4792,35 +4821,6 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 15 unmodified lines
4792 if (!ieee80211_accept_frame(rx))4821 if (!ieee80211_accept_frame(rx))
4793 return false;4822 return false;
4794 4823
4795 if (rx->link_id >= 0) {
4796 link = rcu_dereference(rx->sdata->link[rx->link_id]);
4797
4798 /* we might race link removal */
4799 if (!link)
4800 return true;
4801 rx->link = link;
4802
4803 if (rx->sta) {
4804 rx->link_sta =
4805 rcu_dereference(rx->sta->link[rx->link_id]);
4806 if (!rx->link_sta)
4807 return true;
4808 }
4809 } else {
4810 if (rx->sta)
4811 rx->link_sta = &rx->sta->deflink;
4812
4813 rx->link = &sdata->deflink;
4814 }
4815
4816 if (unlikely(!is_multicast_ether_addr(hdr->addr1) &&
4817 rx->link_id >= 0 && rx->sta && rx->sta->sta.mlo)) {
4818 link_sta = rcu_dereference(rx->sta->link[rx->link_id]);
4819
4820 if (WARN_ON_ONCE(!link_sta))
4821 return true;
4822 }
4823
4824 if (!consume) {4824 if (!consume) {
4825 struct skb_shared_hwtstamps *shwt;4825 struct skb_shared_hwtstamps *shwt;
4826 4826
@@ -4838,9 +4838,12 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 11 unmodified lines
4838 */4838 */
4839 shwt = skb_hwtstamps(rx->skb);4839 shwt = skb_hwtstamps(rx->skb);
4840 shwt->hwtstamp = skb_hwtstamps(skb)->hwtstamp;4840 shwt->hwtstamp = skb_hwtstamps(skb)->hwtstamp;
4841
4842 /* Update the hdr pointer to the new skb for translation below */
4843 hdr = (struct ieee80211_hdr *)rx->skb->data;
4841 }4844 }
4842 4845
4843 if (unlikely(link_sta)) {4846 if (unlikely(rx->sta && rx->sta->sta.mlo)) {
4844 /* translate to MLD addresses */4847 /* translate to MLD addresses */
4845 if (ether_addr_equal(link->conf->addr, hdr->addr1))4848 if (ether_addr_equal(link->conf->addr, hdr->addr1))
4846 ether_addr_copy(hdr->addr1, rx->sdata->vif.addr);4849 ether_addr_copy(hdr->addr1, rx->sdata->vif.addr);
@@ -4870,6 +4873,7 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, · 23 unmodified lines
4870 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);4873 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
4871 struct ieee80211_fast_rx *fast_rx;4874 struct ieee80211_fast_rx *fast_rx;
4872 struct ieee80211_rx_data rx;4875 struct ieee80211_rx_data rx;
4876 int link_id = -1;
4873 4877
4874 memset(&rx, 0, sizeof(rx));4878 memset(&rx, 0, sizeof(rx));
4875 rx.skb = skb;4879 rx.skb = skb;
@@ -4886,12 +4890,8 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, · 10 unmodified lines
4886 if (!pubsta)4890 if (!pubsta)
4887 goto drop;4891 goto drop;
4888 4892
4889 rx.sta = container_of(pubsta, struct sta_info, sta);4893 if (status->link_valid)
4890 rx.sdata = rx.sta->sdata;4894 link_id = status->link_id;
4891
4892 if (status->link_valid &&
4893 !ieee80211_rx_is_valid_sta_link_id(pubsta, status->link_id))
4894 goto drop;
4895 4895
4896 /*4896 /*
4897 * TODO: Should the frame be dropped if the right link_id is not4897 * TODO: Should the frame be dropped if the right link_id is not
@@ -4900,19 +4900,8 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, · 2 unmodified lines
4900 * link_id is used only for stats purpose and updating the stats on4900 * link_id is used only for stats purpose and updating the stats on
4901 * the deflink is fine?4901 * the deflink is fine?
4902 */4902 */
4903 if (status->link_valid)4903 if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id))
4904 rx.link_id = status->link_id;4904 goto drop;
4905
4906 if (rx.link_id >= 0) {
4907 struct ieee80211_link_data *link;
4908
4909 link = rcu_dereference(rx.sdata->link[rx.link_id]);
4910 if (!link)
4911 goto drop;
4912 rx.link = link;
4913 } else {
4914 rx.link = &rx.sdata->deflink;
4915 }
4916 4905
4917 fast_rx = rcu_dereference(rx.sta->fast_rx);4906 fast_rx = rcu_dereference(rx.sta->fast_rx);
4918 if (!fast_rx)4907 if (!fast_rx)
@@ -4930,6 +4919,8 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx, · 11 unmodified lines
4930{4919{
4931 struct link_sta_info *link_sta;4920 struct link_sta_info *link_sta;
4932 struct ieee80211_hdr *hdr = (void *)skb->data;4921 struct ieee80211_hdr *hdr = (void *)skb->data;
4922 struct sta_info *sta;
4923 int link_id = -1;
4933 4924
4934 /*4925 /*
4935 * Look up link station first, in case there's a4926 * Look up link station first, in case there's a
@@ -4939,24 +4930,19 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx, · 3 unmodified lines
4939 */4930 */
4940 link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);4931 link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);
4941 if (link_sta) {4932 if (link_sta) {
4942 rx->sta = link_sta->sta;4933 sta = link_sta->sta;
4943 rx->link_id = link_sta->link_id;4934 link_id = link_sta->link_id;
4944 } else {4935 } else {
4945 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);4936 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
4946 4937
4947 rx->sta = sta_info_get_bss(rx->sdata, hdr->addr2);4938 sta = sta_info_get_bss(rx->sdata, hdr->addr2);
4948 if (rx->sta) {4939 if (status->link_valid)
4949 if (status->link_valid &&4940 link_id = status->link_id;
4950 !ieee80211_rx_is_valid_sta_link_id(&rx->sta->sta,
4951 status->link_id))
4952 return false;
4953
4954 rx->link_id = status->link_valid ? status->link_id : -1;
4955 } else {
4956 rx->link_id = -1;
4957 }
4958 }4941 }
4959 4942
4943 if (!ieee80211_rx_data_set_sta(rx, &sta->sta, link_id))
4944 return false;
4945
4960 return ieee80211_prepare_and_rx_handle(rx, skb, consume);4946 return ieee80211_prepare_and_rx_handle(rx, skb, consume);
4961}4947}
4962 4948
@@ -5015,19 +5001,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · 52 unmodified lines
5015 5001
5016 if (ieee80211_is_data(fc)) {5002 if (ieee80211_is_data(fc)) {
5017 struct sta_info *sta, *prev_sta;5003 struct sta_info *sta, *prev_sta;
5018 u8 link_id = status->link_id;5004 int link_id = -1;
5019 5005
5020 if (pubsta) {5006 if (status->link_valid)
5021 rx.sta = container_of(pubsta, struct sta_info, sta);5007 link_id = status->link_id;
5022 rx.sdata = rx.sta->sdata;
5023 5008
5024 if (status->link_valid &&5009 if (pubsta) {
5025 !ieee80211_rx_is_valid_sta_link_id(pubsta, link_id))5010 if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id))
5026 goto out;5011 goto out;
5027 5012
5028 if (status->link_valid)
5029 rx.link_id = status->link_id;
5030
5031 /*5013 /*
5032 * In MLO connection, fetch the link_id using addr25014 * In MLO connection, fetch the link_id using addr2
5033 * when the driver does not pass link_id in status.5015 * when the driver does not pass link_id in status.
@@ -5045,7 +5027,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · 11 unmodified lines
5045 if (!link_sta)5027 if (!link_sta)
5046 goto out;5028 goto out;
5047 5029
5048 rx.link_id = link_sta->link_id;5030 ieee80211_rx_data_set_link(&rx, link_sta->link_id);
5049 }5031 }
5050 5032
5051 if (ieee80211_prepare_and_rx_handle(&rx, skb, true))5033 if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
@@ -5061,30 +5043,27 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · 9 unmodified lines
5061 continue;5043 continue;
5062 }5044 }
5063 5045
5064 if ((status->link_valid &&5046 rx.sdata = prev_sta->sdata;
5065 !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta,5047 if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta,
5066 link_id)) ||5048 link_id))
5067 (!status->link_valid && prev_sta->sta.mlo))5049 goto out;
5050
5051 if (!status->link_valid && prev_sta->sta.mlo)
5068 continue;5052 continue;
5069 5053
5070 rx.link_id = status->link_valid ? link_id : -1;
5071 rx.sta = prev_sta;
5072 rx.sdata = prev_sta->sdata;
5073 ieee80211_prepare_and_rx_handle(&rx, skb, false);5054 ieee80211_prepare_and_rx_handle(&rx, skb, false);
5074 5055
5075 prev_sta = sta;5056 prev_sta = sta;
5076 }5057 }
5077 5058
5078 if (prev_sta) {5059 if (prev_sta) {
5079 if ((status->link_valid &&5060 rx.sdata = prev_sta->sdata;
5080 !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta,5061 if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta,
5081 link_id)) ||5062 link_id))
5082 (!status->link_valid && prev_sta->sta.mlo))
5083 goto out;5063 goto out;
5084 5064
5085 rx.link_id = status->link_valid ? link_id : -1;5065 if (!status->link_valid && prev_sta->sta.mlo)
5086 rx.sta = prev_sta;5066 goto out;
5087 rx.sdata = prev_sta->sdata;
5088 5067
5089 if (ieee80211_prepare_and_rx_handle(&rx, skb, true))5068 if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
5090 return;5069 return;
net/mac80211/tx.c+17−17
@@ -1129,7 +1129,6 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, · 1128 unmodified lines
1129 struct sk_buff *purge_skb = NULL;1129 struct sk_buff *purge_skb = NULL;
1130 1130
1131 if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {1131 if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
1132 info->flags |= IEEE80211_TX_CTL_AMPDU;
1133 reset_agg_timer = true;1132 reset_agg_timer = true;
1134 } else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {1133 } else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {
1135 /*1134 /*
@@ -1161,7 +1160,6 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, · 25 unmodified lines
1161 if (!tid_tx) {1160 if (!tid_tx) {
1162 /* do nothing, let packet pass through */1161 /* do nothing, let packet pass through */
1163 } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {1162 } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
1164 info->flags |= IEEE80211_TX_CTL_AMPDU;
1165 reset_agg_timer = true;1163 reset_agg_timer = true;
1166 } else {1164 } else {
1167 queued = true;1165 queued = true;
@@ -3677,8 +3675,7 @@ static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 2509 unmodified lines
3677 info->band = fast_tx->band;3675 info->band = fast_tx->band;
3678 info->control.vif = &sdata->vif;3676 info->control.vif = &sdata->vif;
3679 info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT |3677 info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT |
3680 IEEE80211_TX_CTL_DONTFRAG |3678 IEEE80211_TX_CTL_DONTFRAG;
3681 (ampdu ? IEEE80211_TX_CTL_AMPDU : 0);
3682 info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT |3679 info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT |
3683 u32_encode_bits(IEEE80211_LINK_UNSPECIFIED,3680 u32_encode_bits(IEEE80211_LINK_UNSPECIFIED,
3684 IEEE80211_TX_CTRL_MLO_LINK);3681 IEEE80211_TX_CTRL_MLO_LINK);
@@ -3783,6 +3780,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 98 unmodified lines
3783 struct ieee80211_tx_data tx;3780 struct ieee80211_tx_data tx;
3784 ieee80211_tx_result r;3781 ieee80211_tx_result r;
3785 struct ieee80211_vif *vif = txq->vif;3782 struct ieee80211_vif *vif = txq->vif;
3783 int q = vif->hw_queue[txq->ac];
3784 bool q_stopped;
3786 3785
3787 WARN_ON_ONCE(softirq_count() == 0);3786 WARN_ON_ONCE(softirq_count() == 0);
3788 3787
@@ -3790,17 +3789,18 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 1 unmodified line
3790 return NULL;3789 return NULL;
3791 3790
3792begin:3791begin:
3793 spin_lock_bh(&fq->lock);3792 spin_lock(&local->queue_stop_reason_lock);
3794 3793 q_stopped = local->queue_stop_reasons[q];
3795 if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ||3794 spin_unlock(&local->queue_stop_reason_lock);
3796 test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags))
3797 goto out;
3798 3795
3799 if (vif->txqs_stopped[txq->ac]) {3796 if (unlikely(q_stopped)) {
3800 set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags);3797 /* mark for waking later */
3801 goto out;3798 set_bit(IEEE80211_TXQ_DIRTY, &txqi->flags);
3799 return NULL;
3802 }3800 }
3803 3801
3802 spin_lock_bh(&fq->lock);
3803
3804 /* Make sure fragments stay together. */3804 /* Make sure fragments stay together. */
3805 skb = __skb_dequeue(&txqi->frags);3805 skb = __skb_dequeue(&txqi->frags);
3806 if (unlikely(skb)) {3806 if (unlikely(skb)) {
@@ -3810,6 +3810,9 @@ begin: · 3 unmodified lines
3810 IEEE80211_SKB_CB(skb)->control.flags &=3810 IEEE80211_SKB_CB(skb)->control.flags &=
3811 ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;3811 ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
3812 } else {3812 } else {
3813 if (unlikely(test_bit(IEEE80211_TXQ_STOP, &txqi->flags)))
3814 goto out;
3815
3813 skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);3816 skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);
3814 }3817 }
3815 3818
@@ -3860,9 +3863,8 @@ begin: · 44 unmodified lines
3860 }3863 }
3861 3864
3862 if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))3865 if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
3863 info->flags |= IEEE80211_TX_CTL_AMPDU;3866 info->flags |= (IEEE80211_TX_CTL_AMPDU |
3864 else3867 IEEE80211_TX_CTL_DONTFRAG);
3865 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
3866 3868
3867 if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {3869 if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
3868 if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {3870 if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
@@ -4596,8 +4598,6 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, · 727 unmodified lines
4596 4598
4597 info = IEEE80211_SKB_CB(skb);4599 info = IEEE80211_SKB_CB(skb);
4598 memset(info, 0, sizeof(*info));4600 memset(info, 0, sizeof(*info));
4599 if (tid_tx)
4600 info->flags |= IEEE80211_TX_CTL_AMPDU;
4601 4601
4602 info->hw_queue = sdata->vif.hw_queue[queue];4602 info->hw_queue = sdata->vif.hw_queue[queue];
4603 4603
net/mac80211/util.c+3−39
@@ -292,22 +292,12 @@ static void wake_tx_push_queue(struct ieee80211_local *local, · 291 unmodified lines
292 struct ieee80211_sub_if_data *sdata,292 struct ieee80211_sub_if_data *sdata,
293 struct ieee80211_txq *queue)293 struct ieee80211_txq *queue)
294{294{
295 int q = sdata->vif.hw_queue[queue->ac];
296 struct ieee80211_tx_control control = {295 struct ieee80211_tx_control control = {
297 .sta = queue->sta,296 .sta = queue->sta,
298 };297 };
299 struct sk_buff *skb;298 struct sk_buff *skb;
300 unsigned long flags;
301 bool q_stopped;
302 299
303 while (1) {300 while (1) {
304 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
305 q_stopped = local->queue_stop_reasons[q];
306 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
307
308 if (q_stopped)
309 break;
310
311 skb = ieee80211_tx_dequeue(&local->hw, queue);301 skb = ieee80211_tx_dequeue(&local->hw, queue);
312 if (!skb)302 if (!skb)
313 break;303 break;
@@ -347,8 +337,6 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 33 unmodified lines
347 local_bh_disable();337 local_bh_disable();
348 spin_lock(&fq->lock);338 spin_lock(&fq->lock);
349 339
350 sdata->vif.txqs_stopped[ac] = false;
351
352 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))340 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
353 goto out;341 goto out;
354 342
@@ -370,7 +358,7 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 15 unmodified lines
370 if (ac != txq->ac)358 if (ac != txq->ac)
371 continue;359 continue;
372 360
373 if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX,361 if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY,
374 &txqi->flags))362 &txqi->flags))
375 continue;363 continue;
376 364
@@ -385,7 +373,7 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 8 unmodified lines
385 373
386 txqi = to_txq_info(vif->txq);374 txqi = to_txq_info(vif->txq);
387 375
388 if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags) ||376 if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) ||
389 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac)377 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac)
390 goto out;378 goto out;
391 379
@@ -517,8 +505,6 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, · 125 unmodified lines
517 bool refcounted)505 bool refcounted)
518{506{
519 struct ieee80211_local *local = hw_to_local(hw);507 struct ieee80211_local *local = hw_to_local(hw);
520 struct ieee80211_sub_if_data *sdata;
521 int n_acs = IEEE80211_NUM_ACS;
522 508
523 trace_stop_queue(local, queue, reason);509 trace_stop_queue(local, queue, reason);
524 510
@@ -530,29 +516,7 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, · 5 unmodified lines
530 else516 else
531 local->q_stop_reasons[queue][reason]++;517 local->q_stop_reasons[queue][reason]++;
532 518
533 if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue]))519 set_bit(reason, &local->queue_stop_reasons[queue]);
534 return;
535
536 if (local->hw.queues < IEEE80211_NUM_ACS)
537 n_acs = 1;
538
539 rcu_read_lock();
540 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
541 int ac;
542
543 if (!sdata->dev)
544 continue;
545
546 for (ac = 0; ac < n_acs; ac++) {
547 if (sdata->vif.hw_queue[ac] == queue ||
548 sdata->vif.cab_queue == queue) {
549 spin_lock(&local->fq.lock);
550 sdata->vif.txqs_stopped[ac] = true;
551 spin_unlock(&local->fq.lock);
552 }
553 }
554 }
555 rcu_read_unlock();
556}520}
557 521
558void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,522void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
net/mptcp/pm.c+25−0
@@ -420,6 +420,31 @@ void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) · 419 unmodified lines
420 }420 }
421}421}
422 422
423/* if sk is ipv4 or ipv6_only allows only same-family local and remote addresses,
424 * otherwise allow any matching local/remote pair
425 */
426bool mptcp_pm_addr_families_match(const struct sock *sk,
427 const struct mptcp_addr_info *loc,
428 const struct mptcp_addr_info *rem)
429{
430 bool mptcp_is_v4 = sk->sk_family == AF_INET;
431
432#if IS_ENABLED(CONFIG_MPTCP_IPV6)
433 bool loc_is_v4 = loc->family == AF_INET || ipv6_addr_v4mapped(&loc->addr6);
434 bool rem_is_v4 = rem->family == AF_INET || ipv6_addr_v4mapped(&rem->addr6);
435
436 if (mptcp_is_v4)
437 return loc_is_v4 && rem_is_v4;
438
439 if (ipv6_only_sock(sk))
440 return !loc_is_v4 && !rem_is_v4;
441
442 return loc_is_v4 == rem_is_v4;
443#else
444 return mptcp_is_v4 && loc->family == AF_INET && rem->family == AF_INET;
445#endif
446}
447
423void mptcp_pm_data_reset(struct mptcp_sock *msk)448void mptcp_pm_data_reset(struct mptcp_sock *msk)
424{449{
425 u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk));450 u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk));
net/mptcp/pm_userspace.c+7−0
@@ -294,6 +294,13 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info) · 293 unmodified lines
294 }294 }
295 295
296 sk = (struct sock *)msk;296 sk = (struct sock *)msk;
297
298 if (!mptcp_pm_addr_families_match(sk, &addr_l, &addr_r)) {
299 GENL_SET_ERR_MSG(info, "families mismatch");
300 err = -EINVAL;
301 goto create_err;
302 }
303
297 lock_sock(sk);304 lock_sock(sk);
298 305
299 err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);306 err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
net/mptcp/protocol.c+1−1
@@ -98,7 +98,7 @@ static int __mptcp_socket_create(struct mptcp_sock *msk) · 97 unmodified lines
98 struct socket *ssock;98 struct socket *ssock;
99 int err;99 int err;
100 100
101 err = mptcp_subflow_create_socket(sk, &ssock);101 err = mptcp_subflow_create_socket(sk, sk->sk_family, &ssock);
102 if (err)102 if (err)
103 return err;103 return err;
104 104
net/mptcp/protocol.h+5−1
@@ -641,7 +641,8 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a, · 640 unmodified lines
641/* called with sk socket lock held */641/* called with sk socket lock held */
642int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,642int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
643 const struct mptcp_addr_info *remote);643 const struct mptcp_addr_info *remote);
644int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock);644int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
645 struct socket **new_sock);
645void mptcp_info2sockaddr(const struct mptcp_addr_info *info,646void mptcp_info2sockaddr(const struct mptcp_addr_info *info,
646 struct sockaddr_storage *addr,647 struct sockaddr_storage *addr,
647 unsigned short family);648 unsigned short family);
@@ -776,6 +777,9 @@ int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info, · 128 unmodified lines
776int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,777int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
777 bool require_family,778 bool require_family,
778 struct mptcp_pm_addr_entry *entry);779 struct mptcp_pm_addr_entry *entry);
780bool mptcp_pm_addr_families_match(const struct sock *sk,
781 const struct mptcp_addr_info *loc,
782 const struct mptcp_addr_info *rem);
779void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);783void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);
780void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);784void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);
781void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int server_side);785void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int server_side);
net/mptcp/subflow.c+5−4
@@ -1547,7 +1547,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, · 1546 unmodified lines
1547 if (!mptcp_is_fully_established(sk))1547 if (!mptcp_is_fully_established(sk))
1548 goto err_out;1548 goto err_out;
1549 1549
1550 err = mptcp_subflow_create_socket(sk, &sf);1550 err = mptcp_subflow_create_socket(sk, loc->family, &sf);
1551 if (err)1551 if (err)
1552 goto err_out;1552 goto err_out;
1553 1553
@@ -1660,7 +1660,9 @@ static void mptcp_subflow_ops_undo_override(struct sock *ssk) · 106 unmodified lines
1660#endif1660#endif
1661 ssk->sk_prot = &tcp_prot;1661 ssk->sk_prot = &tcp_prot;
1662}1662}
1663int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock)1663
1664int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
1665 struct socket **new_sock)
1664{1666{
1665 struct mptcp_subflow_context *subflow;1667 struct mptcp_subflow_context *subflow;
1666 struct net *net = sock_net(sk);1668 struct net *net = sock_net(sk);
@@ -1673,8 +1675,7 @@ int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock) · 6 unmodified lines
1673 if (unlikely(!sk->sk_socket))1675 if (unlikely(!sk->sk_socket))
1674 return -EINVAL;1676 return -EINVAL;
1675 1677
1676 err = sock_create_kern(net, sk->sk_family, SOCK_STREAM, IPPROTO_TCP,1678 err = sock_create_kern(net, family, SOCK_STREAM, IPPROTO_TCP, &sf);
1677 &sf);
1678 if (err)1679 if (err)
1679 return err;1680 return err;
1680 1681
net/netfilter/ipset/ip_set_bitmap_ip.c+2−2
@@ -308,8 +308,8 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[], · 307 unmodified lines
308 return -IPSET_ERR_BITMAP_RANGE;308 return -IPSET_ERR_BITMAP_RANGE;
309 309
310 pr_debug("mask_bits %u, netmask %u\n", mask_bits, netmask);310 pr_debug("mask_bits %u, netmask %u\n", mask_bits, netmask);
311 hosts = 2 << (32 - netmask - 1);311 hosts = 2U << (32 - netmask - 1);
312 elements = 2 << (netmask - mask_bits - 1);312 elements = 2UL << (netmask - mask_bits - 1);
313 }313 }
314 if (elements > IPSET_BITMAP_MAX_RANGE + 1)314 if (elements > IPSET_BITMAP_MAX_RANGE + 1)
315 return -IPSET_ERR_BITMAP_RANGE_SIZE;315 return -IPSET_ERR_BITMAP_RANGE_SIZE;
net/netfilter/nf_conntrack_proto_tcp.c+15−0
@@ -1068,6 +1068,13 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 1067 unmodified lines
1068 ct->proto.tcp.last_flags |=1068 ct->proto.tcp.last_flags |=
1069 IP_CT_EXP_CHALLENGE_ACK;1069 IP_CT_EXP_CHALLENGE_ACK;
1070 }1070 }
1071
1072 /* possible challenge ack reply to syn */
1073 if (old_state == TCP_CONNTRACK_SYN_SENT &&
1074 index == TCP_ACK_SET &&
1075 dir == IP_CT_DIR_REPLY)
1076 ct->proto.tcp.last_ack = ntohl(th->ack_seq);
1077
1071 spin_unlock_bh(&ct->lock);1078 spin_unlock_bh(&ct->lock);
1072 nf_ct_l4proto_log_invalid(skb, ct, state,1079 nf_ct_l4proto_log_invalid(skb, ct, state,
1073 "packet (index %d) in dir %d ignored, state %s",1080 "packet (index %d) in dir %d ignored, state %s",
@@ -1193,6 +1200,14 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 119 unmodified lines
1193 * segments we ignored. */1200 * segments we ignored. */
1194 goto in_window;1201 goto in_window;
1195 }1202 }
1203
1204 /* Reset in response to a challenge-ack we let through earlier */
1205 if (old_state == TCP_CONNTRACK_SYN_SENT &&
1206 ct->proto.tcp.last_index == TCP_ACK_SET &&
1207 ct->proto.tcp.last_dir == IP_CT_DIR_REPLY &&
1208 ntohl(th->seq) == ct->proto.tcp.last_ack)
1209 goto in_window;
1210
1196 break;1211 break;
1197 default:1212 default:
1198 /* Keep compilers happy. */1213 /* Keep compilers happy. */
net/netfilter/nft_payload.c+1−1
@@ -63,7 +63,7 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len) · 62 unmodified lines
63 return false;63 return false;
64 64
65 if (offset + len > VLAN_ETH_HLEN + vlan_hlen)65 if (offset + len > VLAN_ETH_HLEN + vlan_hlen)
66 ethlen -= offset + len - VLAN_ETH_HLEN + vlan_hlen;66 ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen;
67 67
68 memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);68 memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);
69 69
net/nfc/llcp_core.c+1−0
@@ -157,6 +157,7 @@ static void local_cleanup(struct nfc_llcp_local *local) · 156 unmodified lines
157 cancel_work_sync(&local->rx_work);157 cancel_work_sync(&local->rx_work);
158 cancel_work_sync(&local->timeout_work);158 cancel_work_sync(&local->timeout_work);
159 kfree_skb(local->rx_pending);159 kfree_skb(local->rx_pending);
160 local->rx_pending = NULL;
160 del_timer_sync(&local->sdreq_timer);161 del_timer_sync(&local->sdreq_timer);
161 cancel_work_sync(&local->sdreq_timeout_work);162 cancel_work_sync(&local->sdreq_timeout_work);
162 nfc_llcp_free_sdp_tlv_list(&local->pending_sdreqs);163 nfc_llcp_free_sdp_tlv_list(&local->pending_sdreqs);
net/rxrpc/call_object.c+1−1
@@ -294,7 +294,7 @@ static void rxrpc_put_call_slot(struct rxrpc_call *call) · 293 unmodified lines
294static int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp)294static int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp)
295{295{
296 struct rxrpc_local *local = call->local;296 struct rxrpc_local *local = call->local;
297 int ret = 0;297 int ret = -ENOMEM;
298 298
299 _enter("{%d,%lx},", call->debug_id, call->user_call_ID);299 _enter("{%d,%lx},", call->debug_id, call->user_call_ID);
300 300
net/sched/sch_gred.c+2−0
@@ -377,6 +377,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch) · 376 unmodified lines
377 /* Even if driver returns failure adjust the stats - in case offload377 /* Even if driver returns failure adjust the stats - in case offload
378 * ended but driver still wants to adjust the values.378 * ended but driver still wants to adjust the values.
379 */379 */
380 sch_tree_lock(sch);
380 for (i = 0; i < MAX_DPs; i++) {381 for (i = 0; i < MAX_DPs; i++) {
381 if (!table->tab[i])382 if (!table->tab[i])
382 continue;383 continue;
@@ -393,6 +394,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch) · 10 unmodified lines
393 sch->qstats.overlimits += hw_stats->stats.qstats[i].overlimits;394 sch->qstats.overlimits += hw_stats->stats.qstats[i].overlimits;
394 }395 }
395 _bstats_update(&sch->bstats, bytes, packets);396 _bstats_update(&sch->bstats, bytes, packets);
397 sch_tree_unlock(sch);
396 398
397 kfree(hw_stats);399 kfree(hw_stats);
398 return ret;400 return ret;
net/sched/sch_htb.c+16−11
@@ -1549,7 +1549,7 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, · 1548 unmodified lines
1549 struct tc_htb_qopt_offload offload_opt;1549 struct tc_htb_qopt_offload offload_opt;
1550 struct netdev_queue *dev_queue;1550 struct netdev_queue *dev_queue;
1551 struct Qdisc *q = cl->leaf.q;1551 struct Qdisc *q = cl->leaf.q;
1552 struct Qdisc *old = NULL;1552 struct Qdisc *old;
1553 int err;1553 int err;
1554 1554
1555 if (cl->level)1555 if (cl->level)
@@ -1557,14 +1557,17 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, · 1 unmodified line
1557 1557
1558 WARN_ON(!q);1558 WARN_ON(!q);
1559 dev_queue = htb_offload_get_queue(cl);1559 dev_queue = htb_offload_get_queue(cl);
1560 old = htb_graft_helper(dev_queue, NULL);1560 /* When destroying, caller qdisc_graft grafts the new qdisc and invokes
1561 if (destroying)1561 * qdisc_put for the qdisc being destroyed. htb_destroy_class_offload
1562 /* Before HTB is destroyed, the kernel grafts noop_qdisc to1562 * does not need to graft or qdisc_put the qdisc being destroyed.
1563 * all queues.1563 */
1564 if (!destroying) {
1565 old = htb_graft_helper(dev_queue, NULL);
1566 /* Last qdisc grafted should be the same as cl->leaf.q when
1567 * calling htb_delete.
1564 */1568 */
1565 WARN_ON(!(old->flags & TCQ_F_BUILTIN));
1566 else
1567 WARN_ON(old != q);1569 WARN_ON(old != q);
1570 }
1568 1571
1569 if (cl->parent) {1572 if (cl->parent) {
1570 _bstats_update(&cl->parent->bstats_bias,1573 _bstats_update(&cl->parent->bstats_bias,
@@ -1581,10 +1584,12 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, · 10 unmodified lines
1581 };1584 };
1582 err = htb_offload(qdisc_dev(sch), &offload_opt);1585 err = htb_offload(qdisc_dev(sch), &offload_opt);
1583 1586
1584 if (!err || destroying)1587 if (!destroying) {
1585 qdisc_put(old);1588 if (!err)
1586 else1589 qdisc_put(old);
1587 htb_graft_helper(dev_queue, old);1590 else
1591 htb_graft_helper(dev_queue, old);
1592 }
1588 1593
1589 if (last_child)1594 if (last_child)
1590 return err;1595 return err;
net/sched/sch_taprio.c+3−0
@@ -1700,6 +1700,8 @@ static void taprio_reset(struct Qdisc *sch) · 1699 unmodified lines
1700 int i;1700 int i;
1701 1701
1702 hrtimer_cancel(&q->advance_timer);1702 hrtimer_cancel(&q->advance_timer);
1703 qdisc_synchronize(sch);
1704
1703 if (q->qdiscs) {1705 if (q->qdiscs) {
1704 for (i = 0; i < dev->num_tx_queues; i++)1706 for (i = 0; i < dev->num_tx_queues; i++)
1705 if (q->qdiscs[i])1707 if (q->qdiscs[i])
@@ -1720,6 +1722,7 @@ static void taprio_destroy(struct Qdisc *sch) · 14 unmodified lines
1720 * happens in qdisc_create(), after taprio_init() has been called.1722 * happens in qdisc_create(), after taprio_init() has been called.
1721 */1723 */
1722 hrtimer_cancel(&q->advance_timer);1724 hrtimer_cancel(&q->advance_timer);
1725 qdisc_synchronize(sch);
1723 1726
1724 taprio_disable_offload(dev, q, NULL);1727 taprio_disable_offload(dev, q, NULL);
1725 1728
tools/testing/selftests/net/mptcp/userspace_pm.sh+47−0
@@ -752,6 +752,52 @@ test_subflows() · 751 unmodified lines
752 "$server4_token" > /dev/null 2>&1752 "$server4_token" > /dev/null 2>&1
753}753}
754 754
755test_subflows_v4_v6_mix()
756{
757 # Attempt to add a listener at 10.0.2.1:<subflow-port>
758 ip netns exec "$ns1" ./pm_nl_ctl listen 10.0.2.1\
759 $app6_port > /dev/null 2>&1 &
760 local listener_pid=$!
761
762 # ADD_ADDR4 from server to client machine reusing the subflow port on
763 # the established v6 connection
764 :>"$client_evts"
765 ip netns exec "$ns1" ./pm_nl_ctl ann 10.0.2.1 token "$server6_token" id\
766 $server_addr_id dev ns1eth2 > /dev/null 2>&1
767 stdbuf -o0 -e0 printf "ADD_ADDR4 id:%d 10.0.2.1 (ns1) => ns2, reuse port\t\t" $server_addr_id
768 sleep 0.5
769 verify_announce_event "$client_evts" "$ANNOUNCED" "$client6_token" "10.0.2.1"\
770 "$server_addr_id" "$app6_port"
771
772 # CREATE_SUBFLOW from client to server machine
773 :>"$client_evts"
774 ip netns exec "$ns2" ./pm_nl_ctl csf lip 10.0.2.2 lid 23 rip 10.0.2.1 rport\
775 $app6_port token "$client6_token" > /dev/null 2>&1
776 sleep 0.5
777 verify_subflow_events "$client_evts" "$SUB_ESTABLISHED" "$client6_token"\
778 "$AF_INET" "10.0.2.2" "10.0.2.1" "$app6_port" "23"\
779 "$server_addr_id" "ns2" "ns1"
780
781 # Delete the listener from the server ns, if one was created
782 kill_wait $listener_pid
783
784 sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
785
786 # DESTROY_SUBFLOW from client to server machine
787 :>"$client_evts"
788 ip netns exec "$ns2" ./pm_nl_ctl dsf lip 10.0.2.2 lport "$sport" rip 10.0.2.1 rport\
789 $app6_port token "$client6_token" > /dev/null 2>&1
790 sleep 0.5
791 verify_subflow_events "$client_evts" "$SUB_CLOSED" "$client6_token" \
792 "$AF_INET" "10.0.2.2" "10.0.2.1" "$app6_port" "23"\
793 "$server_addr_id" "ns2" "ns1"
794
795 # RM_ADDR from server to client machine
796 ip netns exec "$ns1" ./pm_nl_ctl rem id $server_addr_id token\
797 "$server6_token" > /dev/null 2>&1
798 sleep 0.5
799}
800
755test_prio()801test_prio()
756{802{
757 local count803 local count
@@ -861,6 +907,7 @@ make_connection "v6" · 103 unmodified lines
861test_announce907test_announce
862test_remove908test_remove
863test_subflows909test_subflows
910test_subflows_v4_v6_mix
864test_prio911test_prio
865test_listener912test_listener
866 913
tools/testing/selftests/net/toeplitz.c+7−5
@@ -215,7 +215,7 @@ static char *recv_frame(const struct ring_state *ring, char *frame) · 214 unmodified lines
215}215}
216 216
217/* A single TPACKET_V3 block can hold multiple frames */217/* A single TPACKET_V3 block can hold multiple frames */
218static void recv_block(struct ring_state *ring)218static bool recv_block(struct ring_state *ring)
219{219{
220 struct tpacket_block_desc *block;220 struct tpacket_block_desc *block;
221 char *frame;221 char *frame;
@@ -223,7 +223,7 @@ static void recv_block(struct ring_state *ring) · 1 unmodified line
223 223
224 block = (void *)(ring->mmap + ring->idx * ring_block_sz);224 block = (void *)(ring->mmap + ring->idx * ring_block_sz);
225 if (!(block->hdr.bh1.block_status & TP_STATUS_USER))225 if (!(block->hdr.bh1.block_status & TP_STATUS_USER))
226 return;226 return false;
227 227
228 frame = (char *)block;228 frame = (char *)block;
229 frame += block->hdr.bh1.offset_to_first_pkt;229 frame += block->hdr.bh1.offset_to_first_pkt;
@@ -235,6 +235,8 @@ static void recv_block(struct ring_state *ring) · 5 unmodified lines
235 235
236 block->hdr.bh1.block_status = TP_STATUS_KERNEL;236 block->hdr.bh1.block_status = TP_STATUS_KERNEL;
237 ring->idx = (ring->idx + 1) % ring_block_nr;237 ring->idx = (ring->idx + 1) % ring_block_nr;
238
239 return true;
238}240}
239 241
240/* simple test: sleep once unconditionally and then process all rings */242/* simple test: sleep once unconditionally and then process all rings */
@@ -245,7 +247,7 @@ static void process_rings(void) · 4 unmodified lines
245 usleep(1000 * cfg_timeout_msec);247 usleep(1000 * cfg_timeout_msec);
246 248
247 for (i = 0; i < num_cpus; i++)249 for (i = 0; i < num_cpus; i++)
248 recv_block(&rings[i]);250 do {} while (recv_block(&rings[i]));
249 251
250 fprintf(stderr, "count: pass=%u nohash=%u fail=%u\n",252 fprintf(stderr, "count: pass=%u nohash=%u fail=%u\n",
251 frames_received - frames_nohash - frames_error,253 frames_received - frames_nohash - frames_error,
@@ -257,12 +259,12 @@ static char *setup_ring(int fd) · 5 unmodified lines
257 struct tpacket_req3 req3 = {0};259 struct tpacket_req3 req3 = {0};
258 void *ring;260 void *ring;
259 261
260 req3.tp_retire_blk_tov = cfg_timeout_msec;262 req3.tp_retire_blk_tov = cfg_timeout_msec / 8;
261 req3.tp_feature_req_word = TP_FT_REQ_FILL_RXHASH;263 req3.tp_feature_req_word = TP_FT_REQ_FILL_RXHASH;
262 264
263 req3.tp_frame_size = 2048;265 req3.tp_frame_size = 2048;
264 req3.tp_frame_nr = 1 << 10;266 req3.tp_frame_nr = 1 << 10;
265 req3.tp_block_nr = 2;267 req3.tp_block_nr = 16;
266 268
267 req3.tp_block_size = req3.tp_frame_size * req3.tp_frame_nr;269 req3.tp_block_size = req3.tp_frame_size * req3.tp_frame_nr;
268 req3.tp_block_size /= req3.tp_block_nr;270 req3.tp_block_size /= req3.tp_block_nr;
tools/testing/selftests/netfilter/nft_trans_stress.sh+9−7
@@ -10,12 +10,20 @@ · 9 unmodified lines
10ksft_skip=410ksft_skip=4
11 11
12testns=testns-$(mktemp -u "XXXXXXXX")12testns=testns-$(mktemp -u "XXXXXXXX")
13tmp=""
13 14
14tables="foo bar baz quux"15tables="foo bar baz quux"
15global_ret=016global_ret=0
16eret=017eret=0
17lret=018lret=0
18 19
20cleanup() {
21 ip netns pids "$testns" | xargs kill 2>/dev/null
22 ip netns del "$testns"
23
24 rm -f "$tmp"
25}
26
19check_result()27check_result()
20{28{
21 local r=$129 local r=$1
@@ -43,6 +51,7 @@ if [ $? -ne 0 ];then · 21 unmodified lines
43 exit $ksft_skip51 exit $ksft_skip
44fi52fi
45 53
54trap cleanup EXIT
46tmp=$(mktemp)55tmp=$(mktemp)
47 56
48for table in $tables; do57for table in $tables; do
@@ -139,11 +148,4 @@ done · 90 unmodified lines
139 148
140check_result $lret "add/delete with nftrace enabled"149check_result $lret "add/delete with nftrace enabled"
141 150
142pkill -9 ping
143
144wait
145
146rm -f "$tmp"
147ip netns del "$testns"
148
149exit $global_ret151exit $global_ret
tools/testing/selftests/netfilter/settings+1−0
@@ -0,0 +1 @@
1timeout=120

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t