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() ...
Unified · Split
| @@ -1104,7 +1104,6 @@ S: Supported · 1103 unmodified lines | ||
| 1104 | 1104 | F: arch/arm64/boot/dts/amd/ |
| 1105 | 1105 | |
| 1106 | 1106 | AMD XGBE DRIVER |
| 1107 | −M: Tom Lendacky <thomas.lendacky@amd.com> | |
| 1108 | 1107 | M: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com> |
| 1109 | 1108 | L: netdev@vger.kernel.org |
| 1110 | 1109 | S: Supported |
| @@ -15750,6 +15749,12 @@ S: Maintained · 14639 unmodified lines | ||
| 15750 | 15749 | W: https://wireless.wiki.kernel.org/en/users/Drivers/p54 |
| 15751 | 15750 | F: drivers/net/wireless/intersil/p54/ |
| 15752 | 15751 | |
| 15752 | +PACKET SOCKETS | |
| 15753 | +M: Willem de Bruijn <willemdebruijn.kernel@gmail.com> | |
| 15754 | +S: Maintained | |
| 15755 | +F: include/uapi/linux/if_packet.h | |
| 15756 | +F: net/packet/af_packet.c | |
| 15757 | + | |
| 15753 | 15758 | PACKING |
| 15754 | 15759 | M: Vladimir Oltean <olteanv@gmail.com> |
| 15755 | 15760 | L: netdev@vger.kernel.org |
| @@ -19326,6 +19331,13 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers) · 3570 unmodified lines | ||
| 19326 | 19331 | S: Orphan |
| 19327 | 19332 | F: sound/soc/uniphier/ |
| 19328 | 19333 | |
| 19334 | +SOCKET TIMESTAMPING | |
| 19335 | +M: Willem de Bruijn <willemdebruijn.kernel@gmail.com> | |
| 19336 | +S: Maintained | |
| 19337 | +F: Documentation/networking/timestamping.rst | |
| 19338 | +F: include/uapi/linux/net_tstamp.h | |
| 19339 | +F: tools/testing/selftests/net/so_txtime.c | |
| 19340 | + | |
| 19329 | 19341 | SOEKRIS NET48XX LED SUPPORT |
| 19330 | 19342 | M: Chris Boot <bootc@bootc.net> |
| 19331 | 19343 | S: Maintained |
| @@ -21746,6 +21758,13 @@ T: git git://linuxtv.org/media_tree.git · 2414 unmodified lines | ||
| 21746 | 21758 | F: Documentation/admin-guide/media/zr364xx* |
| 21747 | 21759 | F: drivers/staging/media/deprecated/zr364xx/ |
| 21748 | 21760 | |
| 21761 | +USER DATAGRAM PROTOCOL (UDP) | |
| 21762 | +M: Willem de Bruijn <willemdebruijn.kernel@gmail.com> | |
| 21763 | +S: Maintained | |
| 21764 | +F: include/linux/udp.h | |
| 21765 | +F: net/ipv4/udp.c | |
| 21766 | +F: net/ipv6/udp.c | |
| 21767 | + | |
| 21749 | 21768 | USER-MODE LINUX (UML) |
| 21750 | 21769 | M: Richard Weinberger <richard@nod.at> |
| 21751 | 21770 | M: Anton Ivanov <anton.ivanov@cambridgegreys.com> |
| @@ -2164,10 +2164,17 @@ static void qca_serdev_shutdown(struct device *dev) · 2163 unmodified lines | ||
| 2164 | 2164 | int timeout = msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS); |
| 2165 | 2165 | struct serdev_device *serdev = to_serdev_device(dev); |
| 2166 | 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 | 2170 | const u8 ibs_wake_cmd[] = { 0xFD }; |
| 2168 | 2171 | const u8 edl_reset_soc_cmd[] = { 0x01, 0x00, 0xFC, 0x01, 0x05 }; |
| 2169 | 2172 | |
| 2170 | 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 | 2178 | serdev_device_write_flush(serdev); |
| 2172 | 2179 | ret = serdev_device_write_buf(serdev, ibs_wake_cmd, |
| 2173 | 2180 | sizeof(ibs_wake_cmd)); |
| @@ -540,10 +540,10 @@ int ksz9477_fdb_del(struct ksz_device *dev, int port, · 539 unmodified lines | ||
| 540 | 540 | ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]); |
| 541 | 541 | |
| 542 | 542 | /* clear forwarding port */ |
| 543 | − alu_table[2] &= ~BIT(port); | |
| 543 | + alu_table[1] &= ~BIT(port); | |
| 544 | 544 | |
| 545 | 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 | 547 | alu_table[0] = 0; |
| 548 | 548 | alu_table[1] = 0; |
| 549 | 549 | alu_table[2] = 0; |
| @@ -524,19 +524,28 @@ static void xgbe_disable_vxlan(struct xgbe_prv_data *pdata) · 523 unmodified lines | ||
| 524 | 524 | netif_dbg(pdata, drv, pdata->netdev, "VXLAN acceleration disabled\n"); |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | +static 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 | + | |
| 527 | 538 | static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata) |
| 528 | 539 | { |
| 529 | − unsigned int max_q_count, q_count; | |
| 530 | 540 | unsigned int reg, reg_val; |
| 531 | − unsigned int i; | |
| 541 | + unsigned int i, q_count; | |
| 532 | 542 | |
| 533 | 543 | /* Clear MTL flow control */ |
| 534 | 544 | for (i = 0; i < pdata->rx_q_count; i++) |
| 535 | 545 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0); |
| 536 | 546 | |
| 537 | 547 | /* Clear MAC flow control */ |
| 538 | − max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; | |
| 539 | − q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); | |
| 548 | + q_count = xgbe_get_fc_queue_count(pdata); | |
| 540 | 549 | reg = MAC_Q0TFCR; |
| 541 | 550 | for (i = 0; i < q_count; i++) { |
| 542 | 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 | 563 | struct ieee_pfc *pfc = pdata->pfc; |
| 555 | 564 | struct ieee_ets *ets = pdata->ets; |
| 556 | − unsigned int max_q_count, q_count; | |
| 557 | 565 | unsigned int reg, reg_val; |
| 558 | − unsigned int i; | |
| 566 | + unsigned int i, q_count; | |
| 559 | 567 | |
| 560 | 568 | /* Set MTL flow control */ |
| 561 | 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 | 589 | /* Set MAC flow control */ |
| 582 | − max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; | |
| 583 | − q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); | |
| 590 | + q_count = xgbe_get_fc_queue_count(pdata); | |
| 584 | 591 | reg = MAC_Q0TFCR; |
| 585 | 592 | for (i = 0; i < q_count; i++) { |
| 586 | 593 | reg_val = XGMAC_IOREAD(pdata, reg); |
| @@ -496,6 +496,7 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata, · 495 unmodified lines | ||
| 496 | 496 | reg |= XGBE_KR_TRAINING_ENABLE; |
| 497 | 497 | reg |= XGBE_KR_TRAINING_START; |
| 498 | 498 | XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); |
| 499 | + pdata->kr_start_time = jiffies; | |
| 499 | 500 | |
| 500 | 501 | netif_dbg(pdata, link, pdata->netdev, |
| 501 | 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 | 634 | xgbe_switch_mode(pdata); |
| 634 | 635 | |
| 636 | + pdata->an_result = XGBE_AN_READY; | |
| 637 | + | |
| 635 | 638 | xgbe_an_restart(pdata); |
| 636 | 639 | |
| 637 | 640 | return XGBE_AN_INCOMPAT_LINK; |
| @@ -1275,9 +1278,30 @@ static bool xgbe_phy_aneg_done(struct xgbe_prv_data *pdata) · 637 unmodified lines | ||
| 1275 | 1278 | static void xgbe_check_link_timeout(struct xgbe_prv_data *pdata) |
| 1276 | 1279 | { |
| 1277 | 1280 | unsigned long link_timeout; |
| 1281 | + unsigned long kr_time; | |
| 1282 | + int wait; | |
| 1278 | 1283 | |
| 1279 | 1284 | link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ); |
| 1280 | 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 | 1305 | netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n"); |
| 1282 | 1306 | xgbe_phy_config_aneg(pdata); |
| 1283 | 1307 | } |
| @@ -290,6 +290,7 @@ · 289 unmodified lines | ||
| 290 | 290 | /* Auto-negotiation */ |
| 291 | 291 | #define XGBE_AN_MS_TIMEOUT 500 |
| 292 | 292 | #define XGBE_LINK_TIMEOUT 5 |
| 293 | +#define XGBE_KR_TRAINING_WAIT_ITER 50 | |
| 293 | 294 | |
| 294 | 295 | #define XGBE_SGMII_AN_LINK_STATUS BIT(1) |
| 295 | 296 | #define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3)) |
| @@ -1280,6 +1281,7 @@ struct xgbe_prv_data { · 984 unmodified lines | ||
| 1280 | 1281 | unsigned int parallel_detect; |
| 1281 | 1282 | unsigned int fec_ability; |
| 1282 | 1283 | unsigned long an_start; |
| 1284 | + unsigned long kr_start_time; | |
| 1283 | 1285 | enum xgbe_an_mode an_mode; |
| 1284 | 1286 | |
| 1285 | 1287 | /* I2C support */ |
| @@ -3969,7 +3969,7 @@ void bnxt_ethtool_init(struct bnxt *bp) · 3968 unmodified lines | ||
| 3969 | 3969 | test_info->timeout = HWRM_CMD_TIMEOUT; |
| 3970 | 3970 | for (i = 0; i < bp->num_tests; i++) { |
| 3971 | 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 | 3974 | if (i == BNXT_MACLPBK_TEST_IDX) { |
| 3975 | 3975 | strcpy(str, "Mac loopback test (offline)"); |
| @@ -3980,14 +3980,9 @@ void bnxt_ethtool_init(struct bnxt *bp) · 4 unmodified lines | ||
| 3980 | 3980 | } else if (i == BNXT_IRQ_TEST_IDX) { |
| 3981 | 3981 | strcpy(str, "Interrupt_test (offline)"); |
| 3982 | 3982 | } else { |
| 3983 | − strscpy(str, fw_str, ETH_GSTRING_LEN); | |
| 3984 | − strncat(str, " test", ETH_GSTRING_LEN - strlen(str)); | |
| 3985 | − if (test_info->offline_mask & (1 << i)) | |
| 3986 | − strncat(str, " (offline)", | |
| 3987 | − ETH_GSTRING_LEN - strlen(str)); | |
| 3988 | − else | |
| 3989 | − strncat(str, " (online)", | |
| 3990 | − ETH_GSTRING_LEN - strlen(str)); | |
| 3983 | + snprintf(str, ETH_GSTRING_LEN, "%s test (%s)", | |
| 3984 | + fw_str, test_info->offline_mask & (1 << i) ? | |
| 3985 | + "offline" : "online"); | |
| 3991 | 3986 | } |
| 3992 | 3987 | } |
| 3993 | 3988 | |
| @@ -10249,14 +10249,7 @@ struct hwrm_selftest_qlist_output { · 10248 unmodified lines | ||
| 10249 | 10249 | u8 unused_0; |
| 10250 | 10250 | __le16 test_timeout; |
| 10251 | 10251 | u8 unused_1[2]; |
| 10252 | − char test0_name[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]; | |
| 10252 | + char test_name[8][32]; | |
| 10260 | 10253 | u8 eyescope_target_BER_support; |
| 10261 | 10254 | #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E8_SUPPORTED 0x0UL |
| 10262 | 10255 | #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E9_SUPPORTED 0x1UL |
| @@ -2187,7 +2187,6 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 2186 unmodified lines | ||
| 2187 | 2187 | bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) || |
| 2188 | 2188 | skb_is_nonlinear(*skb); |
| 2189 | 2189 | int padlen = ETH_ZLEN - (*skb)->len; |
| 2190 | − int headroom = skb_headroom(*skb); | |
| 2191 | 2190 | int tailroom = skb_tailroom(*skb); |
| 2192 | 2191 | struct sk_buff *nskb; |
| 2193 | 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 | 2200 | /* FCS could be appeded to tailroom. */ |
| 2202 | 2201 | if (tailroom >= ETH_FCS_LEN) |
| 2203 | 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 | 2203 | /* No room for FCS, need to reallocate skb. */ |
| 2208 | 2204 | else |
| 2209 | 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 | 2208 | padlen += ETH_FCS_LEN; |
| 2213 | 2209 | } |
| 2214 | 2210 | |
| 2215 | − if (!cloned && headroom + tailroom >= padlen) { | |
| 2216 | − (*skb)->data = memmove((*skb)->head, (*skb)->data, (*skb)->len); | |
| 2217 | − skb_set_tail_pointer(*skb, (*skb)->len); | |
| 2218 | − } else { | |
| 2211 | + if (cloned || tailroom < padlen) { | |
| 2219 | 2212 | nskb = skb_copy_expand(*skb, 0, padlen, GFP_ATOMIC); |
| 2220 | 2213 | if (!nskb) |
| 2221 | 2214 | return -ENOMEM; |
| @@ -2290,14 +2290,14 @@ static void enetc_tx_onestep_tstamp(struct work_struct *work) · 2289 unmodified lines | ||
| 2290 | 2290 | |
| 2291 | 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 | 2295 | clear_bit_unlock(ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS, &priv->flags); |
| 2296 | 2296 | skb = skb_dequeue(&priv->tx_skbs); |
| 2297 | 2297 | if (skb) |
| 2298 | 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 | |
| 2303 | 2303 | static void enetc_tx_onestep_tstamp_init(struct enetc_ndev_priv *priv) |
| @@ -1012,7 +1012,6 @@ static void otx2_pool_refill_task(struct work_struct *work) · 1011 unmodified lines | ||
| 1012 | 1012 | rbpool = cq->rbpool; |
| 1013 | 1013 | free_ptrs = cq->pool_ptrs; |
| 1014 | 1014 | |
| 1015 | − get_cpu(); | |
| 1016 | 1015 | while (cq->pool_ptrs) { |
| 1017 | 1016 | if (otx2_alloc_rbuf(pfvf, rbpool, &bufptr)) { |
| 1018 | 1017 | /* 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 | 1031 | pfvf->hw_ops->aura_freeptr(pfvf, qidx, bufptr + OTX2_HEAD_ROOM); |
| 1033 | 1032 | cq->pool_ptrs--; |
| 1034 | 1033 | } |
| 1035 | − put_cpu(); | |
| 1036 | 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 | 1368 | if (err) |
| 1371 | 1369 | goto fail; |
| 1372 | 1370 | |
| 1373 | − get_cpu(); | |
| 1374 | 1371 | /* Allocate pointers and free them to aura/pool */ |
| 1375 | 1372 | for (qidx = 0; qidx < hw->tot_tx_queues; qidx++) { |
| 1376 | 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 | |
| 1396 | 1393 | err_mem: |
| 1397 | − put_cpu(); | |
| 1398 | 1394 | return err ? -ENOMEM : 0; |
| 1399 | 1395 | |
| 1400 | 1396 | fail: |
| @@ -1435,21 +1431,18 @@ int otx2_rq_aura_pool_init(struct otx2_nic *pfvf) · 34 unmodified lines | ||
| 1435 | 1431 | if (err) |
| 1436 | 1432 | goto fail; |
| 1437 | 1433 | |
| 1438 | − get_cpu(); | |
| 1439 | 1434 | /* Allocate pointers and free them to aura/pool */ |
| 1440 | 1435 | for (pool_id = 0; pool_id < hw->rqpool_cnt; pool_id++) { |
| 1441 | 1436 | pool = &pfvf->qset.pool[pool_id]; |
| 1442 | 1437 | for (ptr = 0; ptr < num_ptrs; ptr++) { |
| 1443 | 1438 | err = otx2_alloc_rbuf(pfvf, pool, &bufptr); |
| 1444 | 1439 | if (err) |
| 1445 | − goto err_mem; | |
| 1440 | + return -ENOMEM; | |
| 1446 | 1441 | pfvf->hw_ops->aura_freeptr(pfvf, pool_id, |
| 1447 | 1442 | bufptr + OTX2_HEAD_ROOM); |
| 1448 | 1443 | } |
| 1449 | 1444 | } |
| 1450 | −err_mem: | |
| 1451 | − put_cpu(); | |
| 1452 | − return err ? -ENOMEM : 0; | |
| 1445 | + return 0; | |
| 1453 | 1446 | fail: |
| 1454 | 1447 | otx2_mbox_reset(&pfvf->mbox.mbox, 0); |
| 1455 | 1448 | otx2_aura_pool_free(pfvf); |
| @@ -736,8 +736,10 @@ static inline void cn10k_aura_freeptr(void *dev, int aura, u64 buf) · 735 unmodified lines | ||
| 736 | 736 | u64 ptrs[2]; |
| 737 | 737 | |
| 738 | 738 | ptrs[1] = buf; |
| 739 | + get_cpu(); | |
| 739 | 740 | /* Free only one buffer at time during init and teardown */ |
| 740 | 741 | __cn10k_aura_freeptr(pfvf, aura, ptrs, 2); |
| 742 | + put_cpu(); | |
| 741 | 743 | } |
| 742 | 744 | |
| 743 | 745 | /* Alloc pointer from pool/aura */ |
| @@ -637,7 +637,7 @@ mlx5e_htb_update_children(struct mlx5e_htb *htb, struct mlx5e_qos_node *node, · 636 unmodified lines | ||
| 637 | 637 | if (child->bw_share == old_bw_share) |
| 638 | 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 | 641 | child->max_average_bw, child->hw_id); |
| 642 | 642 | if (!err && err_one) { |
| 643 | 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 | 671 | mlx5e_htb_convert_rate(htb, rate, node->parent, &bw_share); |
| 672 | 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 | 675 | max_average_bw, node->hw_id); |
| 676 | 676 | if (err) { |
| 677 | 677 | NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a node."); |
| @@ -578,7 +578,6 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa · 577 unmodified lines | ||
| 578 | 578 | { |
| 579 | 579 | enum mlx5e_mpwrq_umr_mode umr_mode = mlx5e_mpwrq_umr_mode(mdev, xsk); |
| 580 | 580 | u8 page_shift = mlx5e_mpwrq_page_shift(mdev, xsk); |
| 581 | − bool unaligned = xsk ? xsk->unaligned : false; | |
| 582 | 581 | u16 max_mtu_pkts; |
| 583 | 582 | |
| 584 | 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 | 590 | * needed number of WQEs exceeds the maximum. |
| 592 | 591 | */ |
| 593 | 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 | 594 | if (params->log_rq_mtu_frames > max_mtu_pkts) { |
| 596 | 595 | mlx5_core_err(mdev, "Current RQ length %d is too big for XSK with given frame size %u\n", |
| 597 | 596 | 1 << params->log_rq_mtu_frames, xsk->chunk_size); |
| @@ -477,7 +477,6 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 476 unmodified lines | ||
| 477 | 477 | struct mlx5e_sample_flow *sample_flow; |
| 478 | 478 | struct mlx5e_sample_attr *sample_attr; |
| 479 | 479 | struct mlx5_flow_attr *pre_attr; |
| 480 | − u32 tunnel_id = attr->tunnel_id; | |
| 481 | 480 | struct mlx5_eswitch *esw; |
| 482 | 481 | u32 default_tbl_id; |
| 483 | 482 | u32 obj_id; |
| @@ -522,7 +521,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 38 unmodified lines | ||
| 522 | 521 | restore_obj.sample.group_id = sample_attr->group_num; |
| 523 | 522 | restore_obj.sample.rate = sample_attr->rate; |
| 524 | 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 | 525 | err = mapping_add(esw->offloads.reg_c0_obj_pool, &restore_obj, &obj_id); |
| 527 | 526 | if (err) |
| 528 | 527 | goto err_obj_id; |
| @@ -548,7 +547,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 19 unmodified lines | ||
| 548 | 547 | /* For decap action, do decap in the original flow table instead of the |
| 549 | 548 | * default flow table. |
| 550 | 549 | */ |
| 551 | − if (tunnel_id) | |
| 550 | + if (attr->action & MLX5_FLOW_CONTEXT_ACTION_DECAP) | |
| 552 | 551 | pre_attr->action |= MLX5_FLOW_CONTEXT_ACTION_DECAP; |
| 553 | 552 | pre_attr->modify_hdr = sample_flow->restore->modify_hdr; |
| 554 | 553 | pre_attr->flags = MLX5_ATTR_FLAG_SAMPLE; |
| @@ -122,11 +122,8 @@ struct mlx5e_ipsec_aso { · 121 unmodified lines | ||
| 122 | 122 | u8 ctx[MLX5_ST_SZ_BYTES(ipsec_aso)]; |
| 123 | 123 | dma_addr_t dma_addr; |
| 124 | 124 | struct mlx5_aso *aso; |
| 125 | − /* IPsec ASO caches data on every query call, | |
| 126 | − * so in nested calls, we can use this boolean to save | |
| 127 | − * recursive calls to mlx5e_ipsec_aso_query() | |
| 128 | − */ | |
| 129 | − u8 use_cache : 1; | |
| 125 | + /* Protect ASO WQ access, as it is global to whole IPsec */ | |
| 126 | + spinlock_t lock; | |
| 130 | 127 | }; |
| 131 | 128 | |
| 132 | 129 | struct mlx5e_ipsec { |
| @@ -320,7 +320,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work) · 319 unmodified lines | ||
| 320 | 320 | if (ret) |
| 321 | 321 | goto unlock; |
| 322 | 322 | |
| 323 | − aso->use_cache = true; | |
| 324 | 323 | if (attrs->esn_trigger && |
| 325 | 324 | !MLX5_GET(ipsec_aso, aso->ctx, esn_event_arm)) { |
| 326 | 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 | 332 | !MLX5_GET(ipsec_aso, aso->ctx, hard_lft_arm) || |
| 334 | 333 | !MLX5_GET(ipsec_aso, aso->ctx, remove_flow_enable)) |
| 335 | 334 | xfrm_state_check_expire(sa_entry->x); |
| 336 | − aso->use_cache = false; | |
| 337 | 335 | |
| 338 | 336 | unlock: |
| 339 | 337 | spin_unlock(&sa_entry->x->lock); |
| @@ -398,6 +396,7 @@ int mlx5e_ipsec_aso_init(struct mlx5e_ipsec *ipsec) · 58 unmodified lines | ||
| 398 | 396 | goto err_aso_create; |
| 399 | 397 | } |
| 400 | 398 | |
| 399 | + spin_lock_init(&aso->lock); | |
| 401 | 400 | ipsec->nb.notifier_call = mlx5e_ipsec_event; |
| 402 | 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 | 455 | struct mlx5e_hw_objs *res; |
| 457 | 456 | struct mlx5_aso_wqe *wqe; |
| 458 | 457 | u8 ds_cnt; |
| 458 | + int ret; | |
| 459 | 459 | |
| 460 | 460 | lockdep_assert_held(&sa_entry->x->lock); |
| 461 | − if (aso->use_cache) | |
| 462 | − return 0; | |
| 463 | − | |
| 464 | 461 | res = &mdev->mlx5e_res.hw_objs; |
| 465 | 462 | |
| 463 | + spin_lock_bh(&aso->lock); | |
| 466 | 464 | memset(aso->ctx, 0, sizeof(aso->ctx)); |
| 467 | 465 | wqe = mlx5_aso_get_wqe(aso->aso); |
| 468 | 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 | 475 | mlx5e_ipsec_aso_copy(ctrl, data); |
| 478 | 476 | |
| 479 | 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 | |
| 483 | 483 | void mlx5e_ipsec_aso_update_curlft(struct mlx5e_ipsec_sa_entry *sa_entry, |
| @@ -166,6 +166,7 @@ struct mlx5_fs_chains *mlx5e_nic_chains(struct mlx5e_tc_table *tc) · 165 unmodified lines | ||
| 166 | 166 | * it's different than the ht->mutex here. |
| 167 | 167 | */ |
| 168 | 168 | static struct lock_class_key tc_ht_lock_key; |
| 169 | +static struct lock_class_key tc_ht_wq_key; | |
| 169 | 170 | |
| 170 | 171 | static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow); |
| 171 | 172 | static 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 | 5183 | return err; |
| 5183 | 5184 | |
| 5184 | 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 | 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 | 5290 | return err; |
| 5289 | 5291 | |
| 5290 | 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 | 5295 | return 0; |
| 5293 | 5296 | } |
| @@ -22,15 +22,13 @@ struct mlx5_esw_rate_group { · 21 unmodified lines | ||
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | 24 | static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx, |
| 25 | − u32 parent_ix, u32 tsar_ix, | |
| 26 | − u32 max_rate, u32 bw_share) | |
| 25 | + u32 tsar_ix, u32 max_rate, u32 bw_share) | |
| 27 | 26 | { |
| 28 | 27 | u32 bitmask = 0; |
| 29 | 28 | |
| 30 | 29 | if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) |
| 31 | 30 | return -EOPNOTSUPP; |
| 32 | 31 | |
| 33 | − MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_ix); | |
| 34 | 32 | MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate); |
| 35 | 33 | MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share); |
| 36 | 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 | 49 | int err; |
| 52 | 50 | |
| 53 | 51 | err = esw_qos_tsar_config(dev, sched_ctx, |
| 54 | − esw->qos.root_tsar_ix, group->tsar_ix, | |
| 52 | + group->tsar_ix, | |
| 55 | 53 | max_rate, bw_share); |
| 56 | 54 | if (err) |
| 57 | 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 | 65 | struct netlink_ext_ack *extack) |
| 68 | 66 | { |
| 69 | 67 | u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; |
| 70 | − struct mlx5_esw_rate_group *group = vport->qos.group; | |
| 71 | 68 | struct mlx5_core_dev *dev = esw->dev; |
| 72 | − u32 parent_tsar_ix; | |
| 73 | − void *vport_elem; | |
| 74 | 69 | int err; |
| 75 | 70 | |
| 76 | 71 | if (!vport->qos.enabled) |
| 77 | 72 | return -EIO; |
| 78 | 73 | |
| 79 | − parent_tsar_ix = group ? group->tsar_ix : esw->qos.root_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, | |
| 74 | + err = esw_qos_tsar_config(dev, sched_ctx, vport->qos.esw_tsar_ix, | |
| 87 | 75 | max_rate, bw_share); |
| 88 | 76 | if (err) { |
| 89 | 77 | esw_warn(esw->dev, |
| @@ -1464,6 +1464,7 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw) · 1463 unmodified lines | ||
| 1464 | 1464 | mlx5_lag_disable_change(esw->dev); |
| 1465 | 1465 | down_write(&esw->mode_lock); |
| 1466 | 1466 | mlx5_eswitch_disable_locked(esw); |
| 1467 | + esw->mode = MLX5_ESWITCH_LEGACY; | |
| 1467 | 1468 | up_write(&esw->mode_lock); |
| 1468 | 1469 | mlx5_lag_enable_change(esw->dev); |
| 1469 | 1470 | } |
| @@ -677,6 +677,7 @@ static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work) · 676 unmodified lines | ||
| 677 | 677 | mutex_lock(&dev->intf_state_mutex); |
| 678 | 678 | if (test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) { |
| 679 | 679 | mlx5_core_err(dev, "health works are not permitted at this stage\n"); |
| 680 | + mutex_unlock(&dev->intf_state_mutex); | |
| 680 | 681 | return; |
| 681 | 682 | } |
| 682 | 683 | mutex_unlock(&dev->intf_state_mutex); |
| @@ -2098,7 +2098,7 @@ static void mlx5_core_verify_params(void) · 2097 unmodified lines | ||
| 2098 | 2098 | } |
| 2099 | 2099 | } |
| 2100 | 2100 | |
| 2101 | −static int __init init(void) | |
| 2101 | +static int __init mlx5_init(void) | |
| 2102 | 2102 | { |
| 2103 | 2103 | int err; |
| 2104 | 2104 | |
| @@ -2133,7 +2133,7 @@ err_debug: · 28 unmodified lines | ||
| 2133 | 2133 | return err; |
| 2134 | 2134 | } |
| 2135 | 2135 | |
| 2136 | −static void __exit cleanup(void) | |
| 2136 | +static void __exit mlx5_cleanup(void) | |
| 2137 | 2137 | { |
| 2138 | 2138 | mlx5e_cleanup(); |
| 2139 | 2139 | mlx5_sf_driver_unregister(); |
| @@ -2141,5 +2141,5 @@ static void __exit cleanup(void) · 1 unmodified line | ||
| 2141 | 2141 | mlx5_unregister_debugfs(); |
| 2142 | 2142 | } |
| 2143 | 2143 | |
| 2144 | −module_init(init); | |
| 2145 | −module_exit(cleanup); | |
| 2144 | +module_init(mlx5_init); | |
| 2145 | +module_exit(mlx5_cleanup); | |
| @@ -62,13 +62,12 @@ int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id) · 61 unmodified lines | ||
| 62 | 62 | return mlx5_qos_create_inner_node(mdev, MLX5_QOS_DEFAULT_DWRR_UID, 0, 0, id); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | −int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 parent_id, | |
| 65 | +int mlx5_qos_update_node(struct mlx5_core_dev *mdev, | |
| 66 | 66 | u32 bw_share, u32 max_avg_bw, u32 id) |
| 67 | 67 | { |
| 68 | 68 | u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0}; |
| 69 | 69 | u32 bitmask = 0; |
| 70 | 70 | |
| 71 | − MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_id); | |
| 72 | 71 | MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share); |
| 73 | 72 | MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_avg_bw); |
| 74 | 73 | |
| @@ -23,7 +23,7 @@ int mlx5_qos_create_leaf_node(struct mlx5_core_dev *mdev, u32 parent_id, · 22 unmodified lines | ||
| 23 | 23 | int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id, |
| 24 | 24 | u32 bw_share, u32 max_avg_bw, u32 *id); |
| 25 | 25 | int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id); |
| 26 | −int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 parent_id, u32 bw_share, | |
| 26 | +int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 bw_share, | |
| 27 | 27 | u32 max_avg_bw, u32 id); |
| 28 | 28 | int mlx5_qos_destroy_node(struct mlx5_core_dev *mdev, u32 id); |
| 29 | 29 | |
| @@ -1043,11 +1043,6 @@ static int lan966x_probe(struct platform_device *pdev) · 1042 unmodified lines | ||
| 1043 | 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 | 1046 | err = lan966x_create_targets(pdev, lan966x); |
| 1052 | 1047 | if (err) |
| 1053 | 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 | 1128 | /* init switch */ |
| 1129 | 1129 | lan966x_init(lan966x); |
| 1130 | 1130 | lan966x_stats_init(lan966x); |
| @@ -1162,6 +1162,8 @@ static int lan966x_probe(struct platform_device *pdev) · 31 unmodified lines | ||
| 1162 | 1162 | goto cleanup_ports; |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | + fwnode_handle_put(ports); | |
| 1166 | + | |
| 1165 | 1167 | lan966x_mdb_init(lan966x); |
| 1166 | 1168 | err = lan966x_fdb_init(lan966x); |
| 1167 | 1169 | if (err) |
| @@ -1191,6 +1193,7 @@ cleanup_fdb: · 23 unmodified lines | ||
| 1191 | 1193 | lan966x_fdb_deinit(lan966x); |
| 1192 | 1194 | |
| 1193 | 1195 | cleanup_ports: |
| 1196 | + fwnode_handle_put(ports); | |
| 1194 | 1197 | fwnode_handle_put(portnp); |
| 1195 | 1198 | |
| 1196 | 1199 | lan966x_cleanup_ports(lan966x); |
| @@ -186,11 +186,25 @@ static void dwmac5_handle_dma_err(struct net_device *ndev, · 185 unmodified lines | ||
| 186 | 186 | int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp, |
| 187 | 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 | 200 | u32 value; |
| 190 | 201 | |
| 191 | 202 | if (!asp) |
| 192 | 203 | return -EINVAL; |
| 193 | 204 | |
| 205 | + if (!safety_feat_cfg) | |
| 206 | + safety_feat_cfg = &all_safety_feats; | |
| 207 | + | |
| 194 | 208 | /* 1. Enable Safety Features */ |
| 195 | 209 | value = readl(ioaddr + MTL_ECC_CONTROL); |
| 196 | 210 | value |= MEEAO; /* MTL ECC Error Addr Status Override */ |
| @@ -551,16 +551,16 @@ static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data) · 550 unmodified lines | ||
| 551 | 551 | p = (char *)priv + offsetof(struct stmmac_priv, |
| 552 | 552 | xstats.txq_stats[q].tx_pkt_n); |
| 553 | 553 | for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) { |
| 554 | − *data++ = (*(u64 *)p); | |
| 555 | − p += sizeof(u64 *); | |
| 554 | + *data++ = (*(unsigned long *)p); | |
| 555 | + p += sizeof(unsigned long); | |
| 556 | 556 | } |
| 557 | 557 | } |
| 558 | 558 | for (q = 0; q < rx_cnt; q++) { |
| 559 | 559 | p = (char *)priv + offsetof(struct stmmac_priv, |
| 560 | 560 | xstats.rxq_stats[q].rx_pkt_n); |
| 561 | 561 | for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) { |
| 562 | − *data++ = (*(u64 *)p); | |
| 563 | − p += sizeof(u64 *); | |
| 562 | + *data++ = (*(unsigned long *)p); | |
| 563 | + p += sizeof(unsigned long); | |
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | } |
| @@ -1150,6 +1150,11 @@ static int stmmac_init_phy(struct net_device *dev) · 1149 unmodified lines | ||
| 1150 | 1150 | int addr = priv->plat->phy_addr; |
| 1151 | 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 | 1158 | phydev = mdiobus_get_phy(priv->mii, addr); |
| 1154 | 1159 | if (!phydev) { |
| 1155 | 1160 | netdev_err(priv->dev, "no phy at addr %d\n", addr); |
| @@ -127,6 +127,16 @@ out_power_put: · 126 unmodified lines | ||
| 127 | 127 | return IRQ_HANDLED; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | +void ipa_interrupt_irq_disable(struct ipa *ipa) | |
| 131 | +{ | |
| 132 | + disable_irq(ipa->interrupt->irq); | |
| 133 | +} | |
| 134 | + | |
| 135 | +void ipa_interrupt_irq_enable(struct ipa *ipa) | |
| 136 | +{ | |
| 137 | + enable_irq(ipa->interrupt->irq); | |
| 138 | +} | |
| 139 | + | |
| 130 | 140 | /* Common function used to enable/disable TX_SUSPEND for an endpoint */ |
| 131 | 141 | static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt, |
| 132 | 142 | u32 endpoint_id, bool enable) |
| @@ -85,6 +85,22 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt); · 84 unmodified lines | ||
| 85 | 85 | */ |
| 86 | 86 | void 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 | + */ | |
| 94 | +void 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 | + */ | |
| 102 | +void ipa_interrupt_irq_disable(struct ipa *ipa); | |
| 103 | + | |
| 88 | 104 | /** |
| 89 | 105 | * ipa_interrupt_config() - Configure the IPA interrupt framework |
| 90 | 106 | * @ipa: IPA pointer |
| @@ -181,6 +181,17 @@ static int ipa_suspend(struct device *dev) · 180 unmodified lines | ||
| 181 | 181 | |
| 182 | 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 | 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 | 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 | 213 | return ret; |
| 197 | 214 | } |
| 198 | 215 | |
| @@ -108,7 +108,12 @@ EXPORT_SYMBOL(mdiobus_unregister_device); · 107 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | struct 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 | 118 | if (!mdiodev) |
| 114 | 119 | return NULL; |
| @@ -1044,7 +1044,6 @@ static int team_port_enter(struct team *team, struct team_port *port) · 1043 unmodified lines | ||
| 1044 | 1044 | goto err_port_enter; |
| 1045 | 1045 | } |
| 1046 | 1046 | } |
| 1047 | − port->dev->priv_flags |= IFF_NO_ADDRCONF; | |
| 1048 | 1047 | |
| 1049 | 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 | 1058 | if (team->ops.port_leave) |
| 1060 | 1059 | team->ops.port_leave(team, port); |
| 1061 | − port->dev->priv_flags &= ~IFF_NO_ADDRCONF; | |
| 1062 | 1060 | dev_put(team->dev); |
| 1063 | 1061 | } |
| 1064 | 1062 | |
| @@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 412 unmodified lines | ||
| 413 | 413 | /* ignore the CRC length */ |
| 414 | 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 | 417 | return 0; |
| 418 | 418 | |
| 419 | 419 | /* the last packet of current skb */ |
| @@ -1877,8 +1877,10 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 1876 unmodified lines | ||
| 1877 | 1877 | */ |
| 1878 | 1878 | if (sq->vq->num_free < 2+MAX_SKB_FRAGS) { |
| 1879 | 1879 | netif_stop_subqueue(dev, qnum); |
| 1880 | − if (!use_napi && | |
| 1881 | − unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { | |
| 1880 | + if (use_napi) { | |
| 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 | 1884 | /* More just got used, free them then recheck. */ |
| 1883 | 1885 | free_old_xmit_skbs(sq, false); |
| 1884 | 1886 | if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) { |
| @@ -1243,9 +1243,11 @@ static int ucc_hdlc_probe(struct platform_device *pdev) · 1242 unmodified lines | ||
| 1243 | 1243 | free_dev: |
| 1244 | 1244 | free_netdev(dev); |
| 1245 | 1245 | undo_uhdlc_init: |
| 1246 | − iounmap(utdm->siram); | |
| 1246 | + if (utdm) | |
| 1247 | + iounmap(utdm->siram); | |
| 1247 | 1248 | unmap_si_regs: |
| 1248 | − iounmap(utdm->si_regs); | |
| 1249 | + if (utdm) | |
| 1250 | + iounmap(utdm->si_regs); | |
| 1249 | 1251 | free_utdm: |
| 1250 | 1252 | if (uhdlc_priv->tsa) |
| 1251 | 1253 | kfree(utdm); |
| @@ -7937,6 +7937,9 @@ cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, · 7936 unmodified lines | ||
| 7937 | 7937 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); |
| 7938 | 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 | 7943 | /* set_channel */ |
| 7941 | 7944 | chspec = channel_to_chanspec(&cfg->d11inf, chan); |
| 7942 | 7945 | if (chspec != INVCHANSPEC) { |
| @@ -7961,7 +7964,7 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 18 unmodified lines | ||
| 7961 | 7964 | struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); |
| 7962 | 7965 | struct brcmf_dump_survey survey = {}; |
| 7963 | 7966 | struct ieee80211_supported_band *band; |
| 7964 | − struct ieee80211_channel *chan; | |
| 7967 | + enum nl80211_band band_id; | |
| 7965 | 7968 | struct cca_msrmnt_query req; |
| 7966 | 7969 | u32 noise; |
| 7967 | 7970 | int err; |
| @@ -7974,26 +7977,25 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 6 unmodified lines | ||
| 7974 | 7977 | return -EBUSY; |
| 7975 | 7978 | } |
| 7976 | 7979 | |
| 7977 | − band = wiphy->bands[NL80211_BAND_2GHZ]; | |
| 7978 | − if (band && idx >= band->n_channels) { | |
| 7979 | − idx -= band->n_channels; | |
| 7980 | − band = NULL; | |
| 7981 | − } | |
| 7980 | + for (band_id = 0; band_id < NUM_NL80211_BANDS; band_id++) { | |
| 7981 | + band = wiphy->bands[band_id]; | |
| 7982 | + if (!band) | |
| 7983 | + continue; | |
| 7984 | + if (idx >= band->n_channels) { | |
| 7985 | + idx -= band->n_channels; | |
| 7986 | + continue; | |
| 7987 | + } | |
| 7982 | 7988 | |
| 7983 | − if (!band || idx >= band->n_channels) { | |
| 7984 | − band = wiphy->bands[NL80211_BAND_5GHZ]; | |
| 7985 | − if (idx >= band->n_channels) | |
| 7986 | − return -ENOENT; | |
| 7989 | + info->channel = &band->channels[idx]; | |
| 7990 | + break; | |
| 7987 | 7991 | } |
| 7992 | + if (band_id == NUM_NL80211_BANDS) | |
| 7993 | + return -ENOENT; | |
| 7988 | 7994 | |
| 7989 | 7995 | /* Setting current channel to the requested channel */ |
| 7990 | − chan = &band->channels[idx]; | |
| 7991 | − err = cfg80211_set_channel(wiphy, ndev, chan, NL80211_CHAN_HT20); | |
| 7992 | − if (err) { | |
| 7993 | − info->channel = chan; | |
| 7994 | − info->filled = 0; | |
| 7996 | + info->filled = 0; | |
| 7997 | + if (cfg80211_set_channel(wiphy, ndev, info->channel, NL80211_CHAN_HT20)) | |
| 7995 | 7998 | return 0; |
| 7996 | − } | |
| 7997 | 7999 | |
| 7998 | 8000 | /* Disable mpc */ |
| 7999 | 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 | 8030 | if (err) |
| 8029 | 8031 | goto exit; |
| 8030 | 8032 | |
| 8031 | − info->channel = chan; | |
| 8032 | 8033 | info->noise = noise; |
| 8033 | 8034 | info->time = ACS_MSRMNT_DELAY; |
| 8034 | 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 | 8041 | SURVEY_INFO_TIME_TX; |
| 8041 | 8042 | |
| 8042 | 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 | 8045 | ACS_MSRMNT_DELAY); |
| 8045 | 8046 | brcmf_dbg(INFO, "noise(%d) busy(%llu) rx(%llu) tx(%llu)\n", |
| 8046 | 8047 | info->noise, info->time_busy, info->time_rx, info->time_tx); |
| @@ -1228,7 +1228,7 @@ static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo) · 1227 unmodified lines | ||
| 1228 | 1228 | BRCMF_NROF_H2D_COMMON_MSGRINGS; |
| 1229 | 1229 | max_completionrings = BRCMF_NROF_D2H_COMMON_MSGRINGS; |
| 1230 | 1230 | } |
| 1231 | − if (max_flowrings > 256) { | |
| 1231 | + if (max_flowrings > 512) { | |
| 1232 | 1232 | brcmf_err(bus, "invalid max_flowrings(%d)\n", max_flowrings); |
| 1233 | 1233 | return -EIO; |
| 1234 | 1234 | } |
| @@ -205,6 +205,52 @@ mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q) · 204 unmodified lines | ||
| 205 | 205 | mt76_dma_sync_idx(dev, q); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | +static int | |
| 209 | +mt76_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 | + | |
| 208 | 254 | static int |
| 209 | 255 | mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q, |
| 210 | 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 | 259 | struct mt76_queue_entry *entry; |
| 214 | 260 | struct mt76_desc *desc; |
| 215 | − u32 ctrl; | |
| 216 | 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 | 269 | for (i = 0; i < nbufs; i += 2, buf += 2) { |
| 219 | 270 | u32 buf0 = buf[0].addr, buf1 = 0; |
| 220 | 271 | |
| 221 | 272 | idx = q->head; |
| 222 | − q->head = (q->head + 1) % q->ndesc; | |
| 273 | + next = (q->head + 1) % q->ndesc; | |
| 223 | 274 | |
| 224 | 275 | desc = &q->desc[idx]; |
| 225 | 276 | entry = &q->entry[idx]; |
| 226 | 277 | |
| 227 | − if ((q->flags & MT_QFLAG_WED) && | |
| 228 | − FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) { | |
| 229 | − struct mt76_txwi_cache *t = txwi; | |
| 230 | − int rx_token; | |
| 231 | − | |
| 232 | − if (!t) | |
| 233 | − return -ENOMEM; | |
| 234 | − | |
| 235 | − rx_token = mt76_rx_token_consume(dev, (void *)skb, t, | |
| 236 | − buf[0].addr); | |
| 237 | − buf1 |= FIELD_PREP(MT_DMA_CTL_TOKEN, rx_token); | |
| 238 | − ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len) | | |
| 239 | − MT_DMA_CTL_TO_HOST; | |
| 240 | − } else { | |
| 241 | − if (txwi) { | |
| 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; | |
| 278 | + if (buf[0].skip_unmap) | |
| 279 | + entry->skip_buf0 = true; | |
| 280 | + entry->skip_buf1 = i == nbufs - 1; | |
| 281 | + | |
| 282 | + entry->dma_addr[0] = buf[0].addr; | |
| 283 | + entry->dma_len[0] = buf[0].len; | |
| 284 | + | |
| 285 | + ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len); | |
| 286 | + if (i < nbufs - 1) { | |
| 287 | + entry->dma_addr[1] = buf[1].addr; | |
| 288 | + entry->dma_len[1] = buf[1].len; | |
| 289 | + buf1 = buf[1].addr; | |
| 290 | + ctrl |= FIELD_PREP(MT_DMA_CTL_SD_LEN1, buf[1].len); | |
| 291 | + if (buf[1].skip_unmap) | |
| 292 | + entry->skip_buf1 = true; | |
| 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 | 300 | WRITE_ONCE(desc->buf0, cpu_to_le32(buf0)); |
| 270 | 301 | WRITE_ONCE(desc->buf1, cpu_to_le32(buf1)); |
| 271 | 302 | WRITE_ONCE(desc->info, cpu_to_le32(info)); |
| 272 | 303 | WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl)); |
| 273 | 304 | |
| 305 | + q->head = next; | |
| 274 | 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 | 609 | spin_lock_bh(&q->lock); |
| 578 | 610 | |
| 579 | 611 | while (q->queued < q->ndesc - 1) { |
| 580 | − struct mt76_txwi_cache *t = NULL; | |
| 581 | 612 | struct mt76_queue_buf qbuf; |
| 582 | 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 | 615 | buf = page_frag_alloc(rx_page, q->buf_size, GFP_ATOMIC); |
| 592 | 616 | if (!buf) |
| 593 | 617 | break; |
| @@ -601,7 +625,12 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q) · 7 unmodified lines | ||
| 601 | 625 | qbuf.addr = addr + offset; |
| 602 | 626 | qbuf.len = len - offset; |
| 603 | 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 | 634 | frames++; |
| 606 | 635 | } |
| 607 | 636 | |
| @@ -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 | 654 | desc->buf0 = cpu_to_le32(phy_addr); |
| 655 | 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 | 663 | desc->token |= cpu_to_le32(FIELD_PREP(MT_DMA_CTL_TOKEN, |
| 657 | 664 | token)); |
| 658 | 665 | desc++; |
| @@ -764,11 +764,12 @@ int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr, · 763 unmodified lines | ||
| 764 | 764 | spin_lock_bh(&dev->rx_token_lock); |
| 765 | 765 | token = idr_alloc(&dev->rx_token, t, 0, dev->rx_token_size, |
| 766 | 766 | GFP_ATOMIC); |
| 767 | + if (token >= 0) { | |
| 768 | + t->ptr = ptr; | |
| 769 | + t->dma_addr = phys; | |
| 770 | + } | |
| 767 | 771 | spin_unlock_bh(&dev->rx_token_lock); |
| 768 | 772 | |
| 769 | − t->ptr = ptr; | |
| 770 | − t->dma_addr = phys; | |
| 771 | − | |
| 772 | 773 | return token; |
| 773 | 774 | } |
| 774 | 775 | EXPORT_SYMBOL_GPL(mt76_rx_token_consume); |
| @@ -696,8 +696,8 @@ static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) · 695 unmodified lines | ||
| 696 | 696 | struct rndis_query *get; |
| 697 | 697 | struct rndis_query_c *get_c; |
| 698 | 698 | } u; |
| 699 | − int ret, buflen; | |
| 700 | − int resplen, respoffs, copylen; | |
| 699 | + int ret; | |
| 700 | + size_t buflen, resplen, respoffs, copylen; | |
| 701 | 701 | |
| 702 | 702 | buflen = *len + sizeof(*u.get); |
| 703 | 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 | 733 | if (respoffs > buflen) { |
| 734 | 734 | /* Device returned data offset outside buffer, error. */ |
| 735 | − netdev_dbg(dev->net, "%s(%s): received invalid " | |
| 736 | − "data offset: %d > %d\n", __func__, | |
| 737 | − oid_to_string(oid), respoffs, buflen); | |
| 735 | + netdev_dbg(dev->net, | |
| 736 | + "%s(%s): received invalid data offset: %zu > %zu\n", | |
| 737 | + __func__, oid_to_string(oid), respoffs, buflen); | |
| 738 | 738 | |
| 739 | 739 | ret = -EINVAL; |
| 740 | 740 | goto exit_unlock; |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | − if ((resplen + respoffs) > buflen) { | |
| 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 | − } | |
| 743 | + copylen = min(resplen, buflen - respoffs); | |
| 751 | 744 | |
| 752 | 745 | if (copylen > *len) |
| 753 | 746 | copylen = *len; |
| @@ -1832,7 +1832,7 @@ void bpf_prog_inc(struct bpf_prog *prog); · 1831 unmodified lines | ||
| 1832 | 1832 | struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog); |
| 1833 | 1833 | void bpf_prog_put(struct bpf_prog *prog); |
| 1834 | 1834 | |
| 1835 | −void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); | |
| 1835 | +void bpf_prog_free_id(struct bpf_prog *prog); | |
| 1836 | 1836 | void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock); |
| 1837 | 1837 | |
| 1838 | 1838 | struct btf_field *btf_record_find(const struct btf_record *rec, |
| @@ -1832,8 +1832,6 @@ struct ieee80211_vif_cfg { · 1831 unmodified lines | ||
| 1832 | 1832 | * @drv_priv: data area for driver use, will always be aligned to |
| 1833 | 1833 | * sizeof(void \*). |
| 1834 | 1834 | * @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 | 1835 | * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see |
| 1838 | 1836 | * &enum ieee80211_offload_flags. |
| 1839 | 1837 | * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled. |
| @@ -1863,8 +1861,6 @@ struct ieee80211_vif { · 23 unmodified lines | ||
| 1863 | 1861 | bool probe_req_reg; |
| 1864 | 1862 | bool rx_mcast_action_reg; |
| 1865 | 1863 | |
| 1866 | − bool txqs_stopped[IEEE80211_NUM_ACS]; | |
| 1867 | − | |
| 1868 | 1864 | struct ieee80211_vif *mbssid_tx_vif; |
| 1869 | 1865 | |
| 1870 | 1866 | /* must be last */ |
| @@ -1288,4 +1288,11 @@ void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx); · 1287 unmodified lines | ||
| 1288 | 1288 | |
| 1289 | 1289 | int 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. */ | |
| 1292 | +static inline void qdisc_synchronize(const struct Qdisc *q) | |
| 1293 | +{ | |
| 1294 | + while (test_bit(__QDISC_STATE_SCHED, &q->state)) | |
| 1295 | + msleep(1); | |
| 1296 | +} | |
| 1297 | + | |
| 1291 | 1298 | #endif |
| @@ -152,7 +152,7 @@ static inline int htab_lock_bucket(const struct bpf_htab *htab, · 151 unmodified lines | ||
| 152 | 152 | { |
| 153 | 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 | 157 | preempt_disable(); |
| 158 | 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 | 171 | struct bucket *b, u32 hash, |
| 172 | 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 | 175 | raw_spin_unlock_irqrestore(&b->raw_lock, flags); |
| 176 | 176 | __this_cpu_dec(*(htab->map_locked[hash])); |
| 177 | 177 | preempt_enable(); |
| @@ -216,9 +216,6 @@ static void __bpf_prog_offload_destroy(struct bpf_prog *prog) · 215 unmodified lines | ||
| 216 | 216 | if (offload->dev_state) |
| 217 | 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 | 219 | list_del_init(&offload->offloads); |
| 223 | 220 | kfree(offload); |
| 224 | 221 | prog->aux->offload = NULL; |
| @@ -1972,7 +1972,7 @@ static void bpf_audit_prog(const struct bpf_prog *prog, unsigned int op) · 1971 unmodified lines | ||
| 1972 | 1972 | return; |
| 1973 | 1973 | if (audit_enabled == AUDIT_OFF) |
| 1974 | 1974 | return; |
| 1975 | − if (op == BPF_AUDIT_LOAD) | |
| 1975 | + if (!in_irq() && !irqs_disabled()) | |
| 1976 | 1976 | ctx = audit_context(); |
| 1977 | 1977 | ab = audit_log_start(ctx, GFP_ATOMIC, AUDIT_BPF); |
| 1978 | 1978 | if (unlikely(!ab)) |
| @@ -2001,7 +2001,7 @@ static int bpf_prog_alloc_id(struct bpf_prog *prog) · 22 unmodified lines | ||
| 2001 | 2001 | return id > 0 ? 0 : id; |
| 2002 | 2002 | } |
| 2003 | 2003 | |
| 2004 | −void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock) | |
| 2004 | +void bpf_prog_free_id(struct bpf_prog *prog) | |
| 2005 | 2005 | { |
| 2006 | 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 | 2013 | if (!prog->aux->id) |
| 2014 | 2014 | return; |
| 2015 | 2015 | |
| 2016 | − if (do_idr_lock) | |
| 2017 | − spin_lock_irqsave(&prog_idr_lock, flags); | |
| 2018 | − else | |
| 2019 | − __acquire(&prog_idr_lock); | |
| 2020 | − | |
| 2016 | + spin_lock_irqsave(&prog_idr_lock, flags); | |
| 2021 | 2017 | idr_remove(&prog_idr, prog->aux->id); |
| 2022 | 2018 | prog->aux->id = 0; |
| 2023 | − | |
| 2024 | − if (do_idr_lock) | |
| 2025 | − spin_unlock_irqrestore(&prog_idr_lock, flags); | |
| 2026 | − else | |
| 2027 | − __release(&prog_idr_lock); | |
| 2019 | + spin_unlock_irqrestore(&prog_idr_lock, flags); | |
| 2028 | 2020 | } |
| 2029 | 2021 | |
| 2030 | 2022 | static 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 | 2059 | prog = aux->prog; |
| 2068 | 2060 | perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0); |
| 2069 | 2061 | bpf_audit_prog(prog, BPF_AUDIT_UNLOAD); |
| 2062 | + bpf_prog_free_id(prog); | |
| 2070 | 2063 | __bpf_prog_put_noref(prog, true); |
| 2071 | 2064 | } |
| 2072 | 2065 | |
| 2073 | −static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock) | |
| 2066 | +static void __bpf_prog_put(struct bpf_prog *prog) | |
| 2074 | 2067 | { |
| 2075 | 2068 | struct bpf_prog_aux *aux = prog->aux; |
| 2076 | 2069 | |
| 2077 | 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 | 2071 | if (in_irq() || irqs_disabled()) { |
| 2082 | 2072 | INIT_WORK(&aux->work, bpf_prog_put_deferred); |
| 2083 | 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 | |
| 2090 | 2080 | void bpf_prog_put(struct bpf_prog *prog) |
| 2091 | 2081 | { |
| 2092 | − __bpf_prog_put(prog, true); | |
| 2082 | + __bpf_prog_put(prog); | |
| 2093 | 2083 | } |
| 2094 | 2084 | EXPORT_SYMBOL_GPL(bpf_prog_put); |
| 2095 | 2085 | |
| @@ -2748,6 +2748,12 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, · 2747 unmodified lines | ||
| 2748 | 2748 | */ |
| 2749 | 2749 | if (insn->src_reg == 0 && is_callback_calling_function(insn->imm)) |
| 2750 | 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 | 2757 | /* regular helper call sets R0 */ |
| 2752 | 2758 | *reg_mask &= ~1; |
| 2753 | 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 | 3295 | bool sanitize = reg && is_spillable_regtype(reg->type); |
| 3290 | 3296 | |
| 3291 | 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 | 3301 | sanitize = true; |
| 3294 | 3302 | break; |
| 3295 | 3303 | } |
| @@ -848,6 +848,9 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type) · 847 unmodified lines | ||
| 848 | 848 | return -EPERM; |
| 849 | 849 | if (unlikely(!nmi_uaccess_okay())) |
| 850 | 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 | 855 | if (irqs_disabled()) { |
| 853 | 856 | /* Do an early check on signal validity. Otherwise, |
| @@ -821,6 +821,7 @@ static void terminate_big_destroy(struct hci_dev *hdev, void *data, int err) · 820 unmodified lines | ||
| 821 | 821 | static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis) |
| 822 | 822 | { |
| 823 | 823 | struct iso_list_data *d; |
| 824 | + int ret; | |
| 824 | 825 | |
| 825 | 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 | 832 | d->big = big; |
| 832 | 833 | d->bis = bis; |
| 833 | 834 | |
| 834 | − return hci_cmd_sync_queue(hdev, terminate_big_sync, d, | |
| 835 | − terminate_big_destroy); | |
| 835 | + ret = hci_cmd_sync_queue(hdev, terminate_big_sync, d, | |
| 836 | + terminate_big_destroy); | |
| 837 | + if (ret) | |
| 838 | + kfree(d); | |
| 839 | + | |
| 840 | + return ret; | |
| 836 | 841 | } |
| 837 | 842 | |
| 838 | 843 | static 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 | ||
| 857 | 862 | static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle) |
| 858 | 863 | { |
| 859 | 864 | struct iso_list_data *d; |
| 865 | + int ret; | |
| 860 | 866 | |
| 861 | 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 | 873 | d->big = big; |
| 868 | 874 | d->sync_handle = sync_handle; |
| 869 | 875 | |
| 870 | − return hci_cmd_sync_queue(hdev, big_terminate_sync, d, | |
| 871 | − terminate_big_destroy); | |
| 876 | + ret = hci_cmd_sync_queue(hdev, big_terminate_sync, d, | |
| 877 | + terminate_big_destroy); | |
| 878 | + if (ret) | |
| 879 | + kfree(d); | |
| 880 | + | |
| 881 | + return ret; | |
| 872 | 882 | } |
| 873 | 883 | |
| 874 | 884 | /* Cleanup BIS connection |
| @@ -3848,8 +3848,11 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data, · 3847 unmodified lines | ||
| 3848 | 3848 | conn->handle, conn->link); |
| 3849 | 3849 | |
| 3850 | 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 | 3853 | hci_le_create_cis(conn->link); |
| 3854 | + rcu_read_lock(); | |
| 3855 | + } | |
| 3853 | 3856 | |
| 3854 | 3857 | if (i == rp->num_handles) |
| 3855 | 3858 | break; |
| @@ -3572,7 +3572,7 @@ static const struct hci_init_stage hci_init2[] = { · 3571 unmodified lines | ||
| 3572 | 3572 | static int hci_le_read_buffer_size_sync(struct hci_dev *hdev) |
| 3573 | 3573 | { |
| 3574 | 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 | 3576 | return __hci_cmd_sync_status(hdev, |
| 3577 | 3577 | HCI_OP_LE_READ_BUFFER_SIZE_V2, |
| 3578 | 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 | 3598 | /* LE Controller init stage 2 command sequence */ |
| 3599 | 3599 | static const struct hci_init_stage le_init2[] = { |
| 3600 | − /* HCI_OP_LE_READ_BUFFER_SIZE */ | |
| 3601 | − HCI_INIT(hci_le_read_buffer_size_sync), | |
| 3602 | 3600 | /* HCI_OP_LE_READ_LOCAL_FEATURES */ |
| 3603 | 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 | 3604 | /* HCI_OP_LE_READ_SUPPORTED_STATES */ |
| 3605 | 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 | |
| 6188 | 6188 | static int _update_adv_data_sync(struct hci_dev *hdev, void *data) |
| 6189 | 6189 | { |
| 6190 | − u8 instance = *(u8 *)data; | |
| 6191 | − | |
| 6192 | − kfree(data); | |
| 6190 | + u8 instance = PTR_ERR(data); | |
| 6193 | 6191 | |
| 6194 | 6192 | return hci_update_adv_data_sync(hdev, instance); |
| 6195 | 6193 | } |
| 6196 | 6194 | |
| 6197 | 6195 | int hci_update_adv_data(struct hci_dev *hdev, u8 instance) |
| 6198 | 6196 | { |
| 6199 | − u8 *inst_ptr = kmalloc(1, GFP_KERNEL); | |
| 6200 | − | |
| 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); | |
| 6197 | + return hci_cmd_sync_queue(hdev, _update_adv_data_sync, | |
| 6198 | + ERR_PTR(instance), NULL); | |
| 6206 | 6199 | } |
| @@ -289,15 +289,15 @@ static int iso_connect_bis(struct sock *sk) · 288 unmodified lines | ||
| 289 | 289 | hci_dev_unlock(hdev); |
| 290 | 290 | hci_dev_put(hdev); |
| 291 | 291 | |
| 292 | + err = iso_chan_add(conn, sk, NULL); | |
| 293 | + if (err) | |
| 294 | + return err; | |
| 295 | + | |
| 292 | 296 | lock_sock(sk); |
| 293 | 297 | |
| 294 | 298 | /* Update source addr of the socket */ |
| 295 | 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 | 301 | if (hcon->state == BT_CONNECTED) { |
| 302 | 302 | iso_sock_clear_timer(sk); |
| 303 | 303 | sk->sk_state = BT_CONNECTED; |
| @@ -306,7 +306,6 @@ static int iso_connect_bis(struct sock *sk) · 2 unmodified lines | ||
| 306 | 306 | iso_sock_set_timer(sk, sk->sk_sndtimeo); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | −release: | |
| 310 | 309 | release_sock(sk); |
| 311 | 310 | return err; |
| 312 | 311 | |
| @@ -372,15 +371,15 @@ static int iso_connect_cis(struct sock *sk) · 59 unmodified lines | ||
| 372 | 371 | hci_dev_unlock(hdev); |
| 373 | 372 | hci_dev_put(hdev); |
| 374 | 373 | |
| 374 | + err = iso_chan_add(conn, sk, NULL); | |
| 375 | + if (err) | |
| 376 | + return err; | |
| 377 | + | |
| 375 | 378 | lock_sock(sk); |
| 376 | 379 | |
| 377 | 380 | /* Update source addr of the socket */ |
| 378 | 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 | 383 | if (hcon->state == BT_CONNECTED) { |
| 385 | 384 | iso_sock_clear_timer(sk); |
| 386 | 385 | sk->sk_state = BT_CONNECTED; |
| @@ -392,7 +391,6 @@ static int iso_connect_cis(struct sock *sk) · 5 unmodified lines | ||
| 392 | 391 | iso_sock_set_timer(sk, sk->sk_sndtimeo); |
| 393 | 392 | } |
| 394 | 393 | |
| 395 | −release: | |
| 396 | 394 | release_sock(sk); |
| 397 | 395 | return err; |
| 398 | 396 | |
| @@ -895,13 +893,10 @@ static int iso_listen_bis(struct sock *sk) · 496 unmodified lines | ||
| 895 | 893 | if (!hdev) |
| 896 | 894 | return -EHOSTUNREACH; |
| 897 | 895 | |
| 898 | − hci_dev_lock(hdev); | |
| 899 | − | |
| 900 | 896 | err = hci_pa_create_sync(hdev, &iso_pi(sk)->dst, |
| 901 | 897 | le_addr_type(iso_pi(sk)->dst_type), |
| 902 | 898 | iso_pi(sk)->bc_sid); |
| 903 | 899 | |
| 904 | − hci_dev_unlock(hdev); | |
| 905 | 900 | hci_dev_put(hdev); |
| 906 | 901 | |
| 907 | 902 | return err; |
| @@ -1432,33 +1427,29 @@ static void iso_conn_ready(struct iso_conn *conn) · 524 unmodified lines | ||
| 1432 | 1427 | struct sock *parent; |
| 1433 | 1428 | struct sock *sk = conn->sk; |
| 1434 | 1429 | struct hci_ev_le_big_sync_estabilished *ev; |
| 1430 | + struct hci_conn *hcon; | |
| 1435 | 1431 | |
| 1436 | 1432 | BT_DBG("conn %p", conn); |
| 1437 | 1433 | |
| 1438 | 1434 | if (sk) { |
| 1439 | 1435 | iso_sock_ready(conn->sk); |
| 1440 | 1436 | } else { |
| 1441 | − iso_conn_lock(conn); | |
| 1442 | − | |
| 1443 | − if (!conn->hcon) { | |
| 1444 | − iso_conn_unlock(conn); | |
| 1437 | + hcon = conn->hcon; | |
| 1438 | + if (!hcon) | |
| 1445 | 1439 | return; |
| 1446 | − } | |
| 1447 | 1440 | |
| 1448 | − ev = hci_recv_event_data(conn->hcon->hdev, | |
| 1441 | + ev = hci_recv_event_data(hcon->hdev, | |
| 1449 | 1442 | HCI_EVT_LE_BIG_SYNC_ESTABILISHED); |
| 1450 | 1443 | if (ev) |
| 1451 | − parent = iso_get_sock_listen(&conn->hcon->src, | |
| 1452 | − &conn->hcon->dst, | |
| 1444 | + parent = iso_get_sock_listen(&hcon->src, | |
| 1445 | + &hcon->dst, | |
| 1453 | 1446 | iso_match_big, ev); |
| 1454 | 1447 | else |
| 1455 | − parent = iso_get_sock_listen(&conn->hcon->src, | |
| 1448 | + parent = iso_get_sock_listen(&hcon->src, | |
| 1456 | 1449 | BDADDR_ANY, NULL, NULL); |
| 1457 | 1450 | |
| 1458 | − if (!parent) { | |
| 1459 | − iso_conn_unlock(conn); | |
| 1451 | + if (!parent) | |
| 1460 | 1452 | return; |
| 1461 | − } | |
| 1462 | 1453 | |
| 1463 | 1454 | lock_sock(parent); |
| 1464 | 1455 | |
| @@ -1466,30 +1457,29 @@ static void iso_conn_ready(struct iso_conn *conn) · 1 unmodified line | ||
| 1466 | 1457 | BTPROTO_ISO, GFP_ATOMIC, 0); |
| 1467 | 1458 | if (!sk) { |
| 1468 | 1459 | release_sock(parent); |
| 1469 | − iso_conn_unlock(conn); | |
| 1470 | 1460 | return; |
| 1471 | 1461 | } |
| 1472 | 1462 | |
| 1473 | 1463 | iso_sock_init(sk, parent); |
| 1474 | 1464 | |
| 1475 | − bacpy(&iso_pi(sk)->src, &conn->hcon->src); | |
| 1476 | − iso_pi(sk)->src_type = conn->hcon->src_type; | |
| 1465 | + bacpy(&iso_pi(sk)->src, &hcon->src); | |
| 1466 | + iso_pi(sk)->src_type = hcon->src_type; | |
| 1477 | 1467 | |
| 1478 | 1468 | /* If hcon has no destination address (BDADDR_ANY) it means it |
| 1479 | 1469 | * was created by HCI_EV_LE_BIG_SYNC_ESTABILISHED so we need to |
| 1480 | 1470 | * initialize using the parent socket destination address. |
| 1481 | 1471 | */ |
| 1482 | − if (!bacmp(&conn->hcon->dst, BDADDR_ANY)) { | |
| 1483 | − bacpy(&conn->hcon->dst, &iso_pi(parent)->dst); | |
| 1484 | − conn->hcon->dst_type = iso_pi(parent)->dst_type; | |
| 1485 | − conn->hcon->sync_handle = iso_pi(parent)->sync_handle; | |
| 1472 | + if (!bacmp(&hcon->dst, BDADDR_ANY)) { | |
| 1473 | + bacpy(&hcon->dst, &iso_pi(parent)->dst); | |
| 1474 | + hcon->dst_type = iso_pi(parent)->dst_type; | |
| 1475 | + hcon->sync_handle = iso_pi(parent)->sync_handle; | |
| 1486 | 1476 | } |
| 1487 | 1477 | |
| 1488 | − bacpy(&iso_pi(sk)->dst, &conn->hcon->dst); | |
| 1489 | − iso_pi(sk)->dst_type = conn->hcon->dst_type; | |
| 1478 | + bacpy(&iso_pi(sk)->dst, &hcon->dst); | |
| 1479 | + iso_pi(sk)->dst_type = hcon->dst_type; | |
| 1490 | 1480 | |
| 1491 | − hci_conn_hold(conn->hcon); | |
| 1492 | − __iso_chan_add(conn, sk, parent); | |
| 1481 | + hci_conn_hold(hcon); | |
| 1482 | + iso_chan_add(conn, sk, parent); | |
| 1493 | 1483 | |
| 1494 | 1484 | if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags)) |
| 1495 | 1485 | sk->sk_state = BT_CONNECT2; |
| @@ -1500,8 +1490,6 @@ static void iso_conn_ready(struct iso_conn *conn) · 4 unmodified lines | ||
| 1500 | 1490 | parent->sk_data_ready(parent); |
| 1501 | 1491 | |
| 1502 | 1492 | release_sock(parent); |
| 1503 | − | |
| 1504 | − iso_conn_unlock(conn); | |
| 1505 | 1493 | } |
| 1506 | 1494 | } |
| 1507 | 1495 | |
| @@ -27,7 +27,7 @@ struct mgmt_mesh_tx { · 26 unmodified lines | ||
| 27 | 27 | struct sock *sk; |
| 28 | 28 | u8 handle; |
| 29 | 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 | |
| 33 | 33 | struct mgmt_pending_cmd { |
| @@ -391,6 +391,7 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a · 390 unmodified lines | ||
| 391 | 391 | addr->sa_family != AF_BLUETOOTH) |
| 392 | 392 | return -EINVAL; |
| 393 | 393 | |
| 394 | + sock_hold(sk); | |
| 394 | 395 | lock_sock(sk); |
| 395 | 396 | |
| 396 | 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 | 411 | d->sec_level = rfcomm_pi(sk)->sec_level; |
| 411 | 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 | 416 | err = rfcomm_dlc_open(d, &rfcomm_pi(sk)->src, &sa->rc_bdaddr, |
| 414 | 417 | sa->rc_channel); |
| 415 | − if (!err) | |
| 418 | + lock_sock(sk); | |
| 419 | + if (!err && !sock_flag(sk, SOCK_ZAPPED)) | |
| 416 | 420 | err = bt_sock_wait_state(sk, BT_CONNECTED, |
| 417 | 421 | sock_sndtimeo(sk, flags & O_NONBLOCK)); |
| 418 | 422 | |
| 419 | 423 | done: |
| 420 | 424 | release_sock(sk); |
| 425 | + sock_put(sk); | |
| 421 | 426 | return err; |
| 422 | 427 | } |
| 423 | 428 | |
| @@ -122,10 +122,13 @@ rss_fill_reply(struct sk_buff *skb, const struct ethnl_req_info *req_base, · 121 unmodified lines | ||
| 122 | 122 | { |
| 123 | 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) || | |
| 126 | − nla_put(skb, ETHTOOL_A_RSS_INDIR, | |
| 127 | − sizeof(u32) * data->indir_size, data->indir_table) || | |
| 128 | − nla_put(skb, ETHTOOL_A_RSS_HKEY, data->hkey_size, data->hkey)) | |
| 125 | + if ((data->hfunc && | |
| 126 | + nla_put_u32(skb, ETHTOOL_A_RSS_HFUNC, data->hfunc)) || | |
| 127 | + (data->indir_size && | |
| 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 | 132 | return -EMSGSIZE; |
| 130 | 133 | |
| 131 | 134 | return 0; |
| @@ -650,8 +650,20 @@ bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) · 649 unmodified lines | ||
| 650 | 650 | spin_lock(lock); |
| 651 | 651 | if (osk) { |
| 652 | 652 | WARN_ON_ONCE(sk->sk_hash != osk->sk_hash); |
| 653 | − ret = sk_nulls_del_node_init_rcu(osk); | |
| 654 | − } else if (found_dup_sk) { | |
| 653 | + ret = sk_hashed(osk); | |
| 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 | 667 | *found_dup_sk = inet_ehash_lookup_by_sk(sk, list); |
| 656 | 668 | if (*found_dup_sk) |
| 657 | 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 | 672 | if (ret) |
| 661 | 673 | __sk_nulls_add_node_rcu(sk, list); |
| 662 | 674 | |
| 675 | +unlock: | |
| 663 | 676 | spin_unlock(lock); |
| 664 | 677 | |
| 665 | 678 | return ret; |
| @@ -91,10 +91,10 @@ void inet_twsk_put(struct inet_timewait_sock *tw) · 90 unmodified lines | ||
| 91 | 91 | } |
| 92 | 92 | EXPORT_SYMBOL_GPL(inet_twsk_put); |
| 93 | 93 | |
| 94 | −static void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw, | |
| 95 | − struct hlist_nulls_head *list) | |
| 94 | +static void inet_twsk_add_node_tail_rcu(struct inet_timewait_sock *tw, | |
| 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 | |
| 100 | 100 | static 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 | 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 | 152 | /* Step 3: Remove SK from hash chain */ |
| 153 | 153 | if (__sk_nulls_del_node_init_rcu(sk)) |
| @@ -435,6 +435,7 @@ void tcp_init_sock(struct sock *sk) · 434 unmodified lines | ||
| 435 | 435 | |
| 436 | 436 | /* There's a bubble in the pipe until at least the first ACK. */ |
| 437 | 437 | tp->app_limited = ~0U; |
| 438 | + tp->rate_app_limited = 1; | |
| 438 | 439 | |
| 439 | 440 | /* See draft-stevens-tcpca-spec-01 for discussion of the |
| 440 | 441 | * initialization of these values. |
| @@ -3178,6 +3179,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 2737 unmodified lines | ||
| 3178 | 3179 | tp->plb_rehash = 0; |
| 3179 | 3180 | /* There's a bubble in the pipe until at least the first ACK. */ |
| 3180 | 3181 | tp->app_limited = ~0U; |
| 3182 | + tp->rate_app_limited = 1; | |
| 3181 | 3183 | tp->rack.mstamp = 0; |
| 3182 | 3184 | tp->rack.advanced = 0; |
| 3183 | 3185 | tp->rack.reo_wnd_steps = 1; |
| @@ -139,7 +139,7 @@ static int __tcp_set_ulp(struct sock *sk, const struct tcp_ulp_ops *ulp_ops) · 138 unmodified lines | ||
| 139 | 139 | if (sk->sk_socket) |
| 140 | 140 | clear_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); |
| 141 | 141 | |
| 142 | − err = -EINVAL; | |
| 142 | + err = -ENOTCONN; | |
| 143 | 143 | if (!ulp_ops->clone && sk->sk_state == TCP_LISTEN) |
| 144 | 144 | goto out_err; |
| 145 | 145 | |
| @@ -104,9 +104,9 @@ static struct workqueue_struct *l2tp_wq; · 103 unmodified lines | ||
| 104 | 104 | /* per-net private data for this module */ |
| 105 | 105 | static unsigned int l2tp_net_id; |
| 106 | 106 | struct l2tp_net { |
| 107 | − struct list_head l2tp_tunnel_list; | |
| 108 | − /* Lock for write access to l2tp_tunnel_list */ | |
| 109 | − spinlock_t l2tp_tunnel_list_lock; | |
| 107 | + /* Lock for write access to l2tp_tunnel_idr */ | |
| 108 | + spinlock_t l2tp_tunnel_idr_lock; | |
| 109 | + struct idr l2tp_tunnel_idr; | |
| 110 | 110 | struct hlist_head l2tp_session_hlist[L2TP_HASH_SIZE_2]; |
| 111 | 111 | /* Lock for write access to l2tp_session_hlist */ |
| 112 | 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 | 208 | struct l2tp_tunnel *tunnel; |
| 209 | 209 | |
| 210 | 210 | rcu_read_lock_bh(); |
| 211 | − list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { | |
| 212 | − if (tunnel->tunnel_id == tunnel_id && | |
| 213 | − refcount_inc_not_zero(&tunnel->ref_count)) { | |
| 214 | − rcu_read_unlock_bh(); | |
| 215 | − | |
| 216 | − return tunnel; | |
| 217 | − } | |
| 211 | + tunnel = idr_find(&pn->l2tp_tunnel_idr, tunnel_id); | |
| 212 | + if (tunnel && refcount_inc_not_zero(&tunnel->ref_count)) { | |
| 213 | + rcu_read_unlock_bh(); | |
| 214 | + return tunnel; | |
| 218 | 215 | } |
| 219 | 216 | rcu_read_unlock_bh(); |
| 220 | 217 | |
| @@ -224,13 +221,14 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_get); · 3 unmodified lines | ||
| 224 | 221 | |
| 225 | 222 | struct 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 | 226 | struct l2tp_tunnel *tunnel; |
| 229 | 227 | int count = 0; |
| 230 | 228 | |
| 231 | 229 | rcu_read_lock_bh(); |
| 232 | − list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { | |
| 233 | − if (++count > nth && | |
| 230 | + idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) { | |
| 231 | + if (tunnel && ++count > nth && | |
| 234 | 232 | refcount_inc_not_zero(&tunnel->ref_count)) { |
| 235 | 233 | rcu_read_unlock_bh(); |
| 236 | 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 | 1041 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED); |
| 1044 | 1042 | nf_reset_ct(skb); |
| 1045 | 1043 | |
| 1046 | − bh_lock_sock(sk); | |
| 1044 | + bh_lock_sock_nested(sk); | |
| 1047 | 1045 | if (sock_owned_by_user(sk)) { |
| 1048 | 1046 | kfree_skb(skb); |
| 1049 | 1047 | ret = NET_XMIT_DROP; |
| @@ -1227,6 +1225,15 @@ static void l2tp_udp_encap_destroy(struct sock *sk) · 177 unmodified lines | ||
| 1227 | 1225 | l2tp_tunnel_delete(tunnel); |
| 1228 | 1226 | } |
| 1229 | 1227 | |
| 1228 | +static 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 | 1237 | /* Workqueue tunnel deletion function */ |
| 1231 | 1238 | static 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 | 1241 | del_work); |
| 1235 | 1242 | struct sock *sk = tunnel->sock; |
| 1236 | 1243 | struct socket *sock = sk->sk_socket; |
| 1237 | − struct l2tp_net *pn; | |
| 1238 | 1244 | |
| 1239 | 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 */ | |
| 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 | + l2tp_tunnel_remove(tunnel->l2tp_net, tunnel); | |
| 1257 | 1258 | /* drop initial ref */ |
| 1258 | 1259 | l2tp_tunnel_dec_refcount(tunnel); |
| 1259 | 1260 | |
| @@ -1384,8 +1385,6 @@ out: · 124 unmodified lines | ||
| 1384 | 1385 | return err; |
| 1385 | 1386 | } |
| 1386 | 1387 | |
| 1387 | −static struct lock_class_key l2tp_socket_class; | |
| 1388 | − | |
| 1389 | 1388 | int l2tp_tunnel_create(int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, |
| 1390 | 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 | ||
| 1455 | 1454 | int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, |
| 1456 | 1455 | struct l2tp_tunnel_cfg *cfg) |
| 1457 | 1456 | { |
| 1458 | − struct l2tp_tunnel *tunnel_walk; | |
| 1459 | − struct l2tp_net *pn; | |
| 1457 | + struct l2tp_net *pn = l2tp_pernet(net); | |
| 1458 | + u32 tunnel_id = tunnel->tunnel_id; | |
| 1460 | 1459 | struct socket *sock; |
| 1461 | 1460 | struct sock *sk; |
| 1462 | 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 | 1470 | if (tunnel->fd < 0) { |
| 1465 | 1471 | ret = l2tp_tunnel_sock_create(net, tunnel->tunnel_id, |
| 1466 | 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 | 1482 | sk = sock->sk; |
| 1483 | + lock_sock(sk); | |
| 1477 | 1484 | write_lock_bh(&sk->sk_callback_lock); |
| 1478 | 1485 | ret = l2tp_validate_socket(sk, net, tunnel->encap); |
| 1479 | 1486 | if (ret < 0) |
| @@ -1481,24 +1488,6 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 1 unmodified line | ||
| 1481 | 1488 | rcu_assign_sk_user_data(sk, tunnel); |
| 1482 | 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 | 1491 | if (tunnel->encap == L2TP_ENCAPTYPE_UDP) { |
| 1503 | 1492 | struct udp_tunnel_sock_cfg udp_cfg = { |
| 1504 | 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 | 1502 | tunnel->old_sk_destruct = sk->sk_destruct; |
| 1514 | 1503 | sk->sk_destruct = &l2tp_tunnel_destruct; |
| 1515 | − lockdep_set_class_and_name(&sk->sk_lock.slock, &l2tp_socket_class, | |
| 1516 | − "l2tp_sock"); | |
| 1517 | 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 | 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 | 1520 | return 0; |
| 1525 | 1521 | |
| 1526 | −err_sock: | |
| 1527 | − write_lock_bh(&sk->sk_callback_lock); | |
| 1528 | − rcu_assign_sk_user_data(sk, NULL); | |
| 1529 | 1522 | err_inval_sock: |
| 1530 | 1523 | write_unlock_bh(&sk->sk_callback_lock); |
| 1524 | + release_sock(sk); | |
| 1531 | 1525 | |
| 1532 | 1526 | if (tunnel->fd < 0) |
| 1533 | 1527 | sock_release(sock); |
| 1534 | 1528 | else |
| 1535 | 1529 | sockfd_put(sock); |
| 1536 | 1530 | err: |
| 1531 | + l2tp_tunnel_remove(net, tunnel); | |
| 1537 | 1532 | return ret; |
| 1538 | 1533 | } |
| 1539 | 1534 | EXPORT_SYMBOL_GPL(l2tp_tunnel_register); |
| @@ -1647,8 +1642,8 @@ static __net_init int l2tp_init_net(struct net *net) · 107 unmodified lines | ||
| 1647 | 1642 | struct l2tp_net *pn = net_generic(net, l2tp_net_id); |
| 1648 | 1643 | int hash; |
| 1649 | 1644 | |
| 1650 | − INIT_LIST_HEAD(&pn->l2tp_tunnel_list); | |
| 1651 | − spin_lock_init(&pn->l2tp_tunnel_list_lock); | |
| 1645 | + idr_init(&pn->l2tp_tunnel_idr); | |
| 1646 | + spin_lock_init(&pn->l2tp_tunnel_idr_lock); | |
| 1652 | 1647 | |
| 1653 | 1648 | for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) |
| 1654 | 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 | 1658 | struct l2tp_net *pn = l2tp_pernet(net); |
| 1664 | 1659 | struct l2tp_tunnel *tunnel = NULL; |
| 1660 | + unsigned long tunnel_id, tmp; | |
| 1665 | 1661 | int hash; |
| 1666 | 1662 | |
| 1667 | 1663 | rcu_read_lock_bh(); |
| 1668 | − list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { | |
| 1669 | − l2tp_tunnel_delete(tunnel); | |
| 1664 | + idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) { | |
| 1665 | + if (tunnel) | |
| 1666 | + l2tp_tunnel_delete(tunnel); | |
| 1670 | 1667 | } |
| 1671 | 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 | 1674 | for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) |
| 1678 | 1675 | WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash])); |
| 1676 | + idr_destroy(&pn->l2tp_tunnel_idr); | |
| 1679 | 1677 | } |
| 1680 | 1678 | |
| 1681 | 1679 | static struct pernet_operations l2tp_net_ops = { |
| @@ -491,7 +491,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 490 unmodified lines | ||
| 491 | 491 | { |
| 492 | 492 | struct tid_ampdu_tx *tid_tx; |
| 493 | 493 | struct ieee80211_local *local = sta->local; |
| 494 | − struct ieee80211_sub_if_data *sdata = sta->sdata; | |
| 494 | + struct ieee80211_sub_if_data *sdata; | |
| 495 | 495 | struct ieee80211_ampdu_params params = { |
| 496 | 496 | .sta = &sta->sta, |
| 497 | 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 | 512 | clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); |
| 513 | 513 | |
| 514 | − ieee80211_agg_stop_txq(sta, tid); | |
| 515 | − | |
| 516 | 514 | /* |
| 517 | 515 | * Make sure no packets are being processed. This ensures that |
| 518 | 516 | * 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 | 520 | synchronize_net(); |
| 523 | 521 | |
| 522 | + sdata = sta->sdata; | |
| 524 | 523 | params.ssn = sta->tid_seq[tid] >> 4; |
| 525 | 524 | ret = drv_ampdu_action(local, sdata, ¶ms); |
| 526 | 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 | 534 | set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state); |
| 536 | 535 | } else if (ret) { |
| 536 | + if (!sdata) | |
| 537 | + return; | |
| 538 | + | |
| 537 | 539 | ht_dbg(sdata, |
| 538 | 540 | "BA request denied - HW unavailable for %pM tid %d\n", |
| 539 | 541 | sta->sta.addr, tid); |
| @@ -147,6 +147,7 @@ static int ieee80211_set_ap_mbssid_options(struct ieee80211_sub_if_data *sdata, · 146 unmodified lines | ||
| 147 | 147 | link_conf->bssid_index = 0; |
| 148 | 148 | link_conf->nontransmitted = false; |
| 149 | 149 | link_conf->ema_ap = false; |
| 150 | + link_conf->bssid_indicator = 0; | |
| 150 | 151 | |
| 151 | 152 | if (sdata->vif.type != NL80211_IFTYPE_AP || !params.tx_wdev) |
| 152 | 153 | return -EINVAL; |
| @@ -1511,6 +1512,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, · 1358 unmodified lines | ||
| 1511 | 1512 | kfree(link_conf->ftmr_params); |
| 1512 | 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 | 1521 | __sta_info_flush(sdata, true); |
| 1515 | 1522 | ieee80211_free_keys(sdata, true); |
| 1516 | 1523 | |
| @@ -167,7 +167,7 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf, · 166 unmodified lines | ||
| 167 | 167 | continue; |
| 168 | 168 | txqi = to_txq_info(sta->sta.txq[i]); |
| 169 | 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 | 171 | txqi->txq.tid, |
| 172 | 172 | txqi->txq.ac, |
| 173 | 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 | 182 | txqi->flags, |
| 183 | 183 | test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ? "STOP" : "RUN", |
| 184 | 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 | 189 | rcu_read_unlock(); |
| @@ -392,6 +392,9 @@ int drv_ampdu_action(struct ieee80211_local *local, · 391 unmodified lines | ||
| 392 | 392 | |
| 393 | 393 | might_sleep(); |
| 394 | 394 | |
| 395 | + if (!sdata) | |
| 396 | + return -EIO; | |
| 397 | + | |
| 395 | 398 | sdata = get_bss_sdata(sdata); |
| 396 | 399 | if (!check_sdata_in_driver(sdata)) |
| 397 | 400 | return -EIO; |
| @@ -1199,7 +1199,7 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, · 1198 unmodified lines | ||
| 1199 | 1199 | |
| 1200 | 1200 | /* In reconfig don't transmit now, but mark for waking later */ |
| 1201 | 1201 | if (local->in_reconfig) { |
| 1202 | − set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags); | |
| 1202 | + set_bit(IEEE80211_TXQ_DIRTY, &txq->flags); | |
| 1203 | 1203 | return; |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| @@ -391,6 +391,37 @@ void ieee80211_ba_session_work(struct work_struct *work) · 390 unmodified lines | ||
| 391 | 391 | |
| 392 | 392 | tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; |
| 393 | 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 | 426 | * Assign it over to the normal tid_tx array |
| 396 | 427 | * where it "goes live". |
| @@ -838,7 +838,7 @@ enum txq_info_flags { · 837 unmodified lines | ||
| 838 | 838 | IEEE80211_TXQ_STOP, |
| 839 | 839 | IEEE80211_TXQ_AMPDU, |
| 840 | 840 | IEEE80211_TXQ_NO_AMSDU, |
| 841 | − IEEE80211_TXQ_STOP_NETIF_TX, | |
| 841 | + IEEE80211_TXQ_DIRTY, | |
| 842 | 842 | }; |
| 843 | 843 | |
| 844 | 844 | /** |
| @@ -364,7 +364,9 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, · 363 unmodified lines | ||
| 364 | 364 | |
| 365 | 365 | /* No support for VLAN with MLO yet */ |
| 366 | 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 | 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 | 2198 | ret = cfg80211_register_netdevice(ndev); |
| 2197 | 2199 | if (ret) { |
| 2198 | − ieee80211_if_free(ndev); | |
| 2199 | 2200 | free_netdev(ndev); |
| 2200 | 2201 | return ret; |
| 2201 | 2202 | } |
| @@ -4049,6 +4049,58 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx) · 4048 unmodified lines | ||
| 4049 | 4049 | #undef CALL_RXH |
| 4050 | 4050 | } |
| 4051 | 4051 | |
| 4052 | +static bool | |
| 4053 | +ieee80211_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 | + | |
| 4061 | +static 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 | + | |
| 4078 | +static 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 | 4105 | * This function makes calls into the RX path, therefore |
| 4054 | 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 | 4110 | struct sk_buff_head frames; |
| 4059 | 4111 | struct ieee80211_rx_data rx = { |
| 4060 | − .sta = sta, | |
| 4061 | − .sdata = sta->sdata, | |
| 4062 | − .local = sta->local, | |
| 4063 | 4112 | /* This is OK -- must be QoS data frame */ |
| 4064 | 4113 | .security_idx = tid, |
| 4065 | 4114 | .seqno_idx = tid, |
| 4066 | − .link_id = -1, | |
| 4067 | 4115 | }; |
| 4068 | 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 | 4126 | tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); |
| 4072 | 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 | 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 | 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 | 4156 | /* This is OK -- must be QoS data frame */ |
| 4106 | 4157 | .security_idx = tid, |
| 4107 | 4158 | .seqno_idx = tid, |
| 4108 | − .link_id = -1, | |
| 4109 | 4159 | }; |
| 4110 | 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 | 4167 | sta = container_of(pubsta, struct sta_info, sta); |
| 4118 | 4168 | |
| 4119 | − rx.sta = sta; | |
| 4120 | − rx.sdata = sta->sdata; | |
| 4121 | − rx.link = &rx.sdata->deflink; | |
| 4122 | − rx.local = sta->local; | |
| 4169 | + if (!ieee80211_rx_data_set_sta(&rx, pubsta, -1)) | |
| 4170 | + return; | |
| 4123 | 4171 | |
| 4124 | 4172 | rcu_read_lock(); |
| 4125 | 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 | 4554 | mutex_unlock(&local->sta_mtx); |
| 4507 | 4555 | } |
| 4508 | 4556 | |
| 4509 | −static bool | |
| 4510 | −ieee80211_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 | − | |
| 4518 | 4557 | static void ieee80211_rx_8023(struct ieee80211_rx_data *rx, |
| 4519 | 4558 | struct ieee80211_fast_rx *fast_rx, |
| 4520 | 4559 | int orig_len) |
| @@ -4625,7 +4664,6 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 104 unmodified lines | ||
| 4625 | 4664 | struct sk_buff *skb = rx->skb; |
| 4626 | 4665 | struct ieee80211_hdr *hdr = (void *)skb->data; |
| 4627 | 4666 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
| 4628 | − struct sta_info *sta = rx->sta; | |
| 4629 | 4667 | int orig_len = skb->len; |
| 4630 | 4668 | int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
| 4631 | 4669 | int snap_offs = hdrlen; |
| @@ -4637,7 +4675,6 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 5 unmodified lines | ||
| 4637 | 4675 | u8 da[ETH_ALEN]; |
| 4638 | 4676 | u8 sa[ETH_ALEN]; |
| 4639 | 4677 | } addrs __aligned(2); |
| 4640 | − struct link_sta_info *link_sta; | |
| 4641 | 4678 | struct ieee80211_sta_rx_stats *stats; |
| 4642 | 4679 | |
| 4643 | 4680 | /* 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 | 4777 | drop: |
| 4741 | 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 | 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 | 4782 | else |
| 4754 | − stats = &link_sta->rx_stats; | |
| 4783 | + stats = &rx->link_sta->rx_stats; | |
| 4755 | 4784 | |
| 4756 | 4785 | stats->dropped++; |
| 4757 | 4786 | return true; |
| @@ -4769,8 +4798,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 11 unmodified lines | ||
| 4769 | 4798 | struct ieee80211_local *local = rx->local; |
| 4770 | 4799 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
| 4771 | 4800 | struct ieee80211_hdr *hdr = (void *)skb->data; |
| 4772 | − struct link_sta_info *link_sta = NULL; | |
| 4773 | − struct ieee80211_link_data *link; | |
| 4801 | + struct link_sta_info *link_sta = rx->link_sta; | |
| 4802 | + struct ieee80211_link_data *link = rx->link; | |
| 4774 | 4803 | |
| 4775 | 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 | 4821 | if (!ieee80211_accept_frame(rx)) |
| 4793 | 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 | 4824 | if (!consume) { |
| 4825 | 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 | 4839 | shwt = skb_hwtstamps(rx->skb); |
| 4840 | 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 | 4847 | /* translate to MLD addresses */ |
| 4845 | 4848 | if (ether_addr_equal(link->conf->addr, hdr->addr1)) |
| 4846 | 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 | 4873 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
| 4871 | 4874 | struct ieee80211_fast_rx *fast_rx; |
| 4872 | 4875 | struct ieee80211_rx_data rx; |
| 4876 | + int link_id = -1; | |
| 4873 | 4877 | |
| 4874 | 4878 | memset(&rx, 0, sizeof(rx)); |
| 4875 | 4879 | rx.skb = skb; |
| @@ -4886,12 +4890,8 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, · 10 unmodified lines | ||
| 4886 | 4890 | if (!pubsta) |
| 4887 | 4891 | goto drop; |
| 4888 | 4892 | |
| 4889 | − rx.sta = container_of(pubsta, struct sta_info, sta); | |
| 4890 | − rx.sdata = rx.sta->sdata; | |
| 4891 | − | |
| 4892 | − if (status->link_valid && | |
| 4893 | − !ieee80211_rx_is_valid_sta_link_id(pubsta, status->link_id)) | |
| 4894 | − goto drop; | |
| 4893 | + if (status->link_valid) | |
| 4894 | + link_id = status->link_id; | |
| 4895 | 4895 | |
| 4896 | 4896 | /* |
| 4897 | 4897 | * 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 | 4900 | * link_id is used only for stats purpose and updating the stats on |
| 4901 | 4901 | * the deflink is fine? |
| 4902 | 4902 | */ |
| 4903 | − if (status->link_valid) | |
| 4904 | − rx.link_id = status->link_id; | |
| 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 | − } | |
| 4903 | + if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id)) | |
| 4904 | + goto drop; | |
| 4916 | 4905 | |
| 4917 | 4906 | fast_rx = rcu_dereference(rx.sta->fast_rx); |
| 4918 | 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 | 4920 | struct link_sta_info *link_sta; |
| 4932 | 4921 | struct ieee80211_hdr *hdr = (void *)skb->data; |
| 4922 | + struct sta_info *sta; | |
| 4923 | + int link_id = -1; | |
| 4933 | 4924 | |
| 4934 | 4925 | /* |
| 4935 | 4926 | * 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 | 4931 | link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2); |
| 4941 | 4932 | if (link_sta) { |
| 4942 | − rx->sta = link_sta->sta; | |
| 4943 | − rx->link_id = link_sta->link_id; | |
| 4933 | + sta = link_sta->sta; | |
| 4934 | + link_id = link_sta->link_id; | |
| 4944 | 4935 | } else { |
| 4945 | 4936 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
| 4946 | 4937 | |
| 4947 | − rx->sta = sta_info_get_bss(rx->sdata, hdr->addr2); | |
| 4948 | − if (rx->sta) { | |
| 4949 | − if (status->link_valid && | |
| 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 | − } | |
| 4938 | + sta = sta_info_get_bss(rx->sdata, hdr->addr2); | |
| 4939 | + if (status->link_valid) | |
| 4940 | + link_id = status->link_id; | |
| 4958 | 4941 | } |
| 4959 | 4942 | |
| 4943 | + if (!ieee80211_rx_data_set_sta(rx, &sta->sta, link_id)) | |
| 4944 | + return false; | |
| 4945 | + | |
| 4960 | 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 | 5002 | if (ieee80211_is_data(fc)) { |
| 5017 | 5003 | struct sta_info *sta, *prev_sta; |
| 5018 | − u8 link_id = status->link_id; | |
| 5004 | + int link_id = -1; | |
| 5019 | 5005 | |
| 5020 | − if (pubsta) { | |
| 5021 | − rx.sta = container_of(pubsta, struct sta_info, sta); | |
| 5022 | − rx.sdata = rx.sta->sdata; | |
| 5006 | + if (status->link_valid) | |
| 5007 | + link_id = status->link_id; | |
| 5023 | 5008 | |
| 5024 | − if (status->link_valid && | |
| 5025 | − !ieee80211_rx_is_valid_sta_link_id(pubsta, link_id)) | |
| 5009 | + if (pubsta) { | |
| 5010 | + if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id)) | |
| 5026 | 5011 | goto out; |
| 5027 | 5012 | |
| 5028 | − if (status->link_valid) | |
| 5029 | − rx.link_id = status->link_id; | |
| 5030 | − | |
| 5031 | 5013 | /* |
| 5032 | 5014 | * In MLO connection, fetch the link_id using addr2 |
| 5033 | 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 | 5027 | if (!link_sta) |
| 5046 | 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 | 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 | 5043 | continue; |
| 5062 | 5044 | } |
| 5063 | 5045 | |
| 5064 | − if ((status->link_valid && | |
| 5065 | − !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta, | |
| 5066 | − link_id)) || | |
| 5067 | − (!status->link_valid && prev_sta->sta.mlo)) | |
| 5046 | + rx.sdata = prev_sta->sdata; | |
| 5047 | + if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta, | |
| 5048 | + link_id)) | |
| 5049 | + goto out; | |
| 5050 | + | |
| 5051 | + if (!status->link_valid && prev_sta->sta.mlo) | |
| 5068 | 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 | 5054 | ieee80211_prepare_and_rx_handle(&rx, skb, false); |
| 5074 | 5055 | |
| 5075 | 5056 | prev_sta = sta; |
| 5076 | 5057 | } |
| 5077 | 5058 | |
| 5078 | 5059 | if (prev_sta) { |
| 5079 | − if ((status->link_valid && | |
| 5080 | − !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta, | |
| 5081 | − link_id)) || | |
| 5082 | − (!status->link_valid && prev_sta->sta.mlo)) | |
| 5060 | + rx.sdata = prev_sta->sdata; | |
| 5061 | + if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta, | |
| 5062 | + link_id)) | |
| 5083 | 5063 | goto out; |
| 5084 | 5064 | |
| 5085 | − rx.link_id = status->link_valid ? link_id : -1; | |
| 5086 | − rx.sta = prev_sta; | |
| 5087 | − rx.sdata = prev_sta->sdata; | |
| 5065 | + if (!status->link_valid && prev_sta->sta.mlo) | |
| 5066 | + goto out; | |
| 5088 | 5067 | |
| 5089 | 5068 | if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) |
| 5090 | 5069 | return; |
| @@ -1129,7 +1129,6 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, · 1128 unmodified lines | ||
| 1129 | 1129 | struct sk_buff *purge_skb = NULL; |
| 1130 | 1130 | |
| 1131 | 1131 | if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { |
| 1132 | − info->flags |= IEEE80211_TX_CTL_AMPDU; | |
| 1133 | 1132 | reset_agg_timer = true; |
| 1134 | 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 | 1160 | if (!tid_tx) { |
| 1162 | 1161 | /* do nothing, let packet pass through */ |
| 1163 | 1162 | } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { |
| 1164 | − info->flags |= IEEE80211_TX_CTL_AMPDU; | |
| 1165 | 1163 | reset_agg_timer = true; |
| 1166 | 1164 | } else { |
| 1167 | 1165 | queued = true; |
| @@ -3677,8 +3675,7 @@ static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 2509 unmodified lines | ||
| 3677 | 3675 | info->band = fast_tx->band; |
| 3678 | 3676 | info->control.vif = &sdata->vif; |
| 3679 | 3677 | info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | |
| 3680 | − IEEE80211_TX_CTL_DONTFRAG | | |
| 3681 | − (ampdu ? IEEE80211_TX_CTL_AMPDU : 0); | |
| 3678 | + IEEE80211_TX_CTL_DONTFRAG; | |
| 3682 | 3679 | info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT | |
| 3683 | 3680 | u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, |
| 3684 | 3681 | IEEE80211_TX_CTRL_MLO_LINK); |
| @@ -3783,6 +3780,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 98 unmodified lines | ||
| 3783 | 3780 | struct ieee80211_tx_data tx; |
| 3784 | 3781 | ieee80211_tx_result r; |
| 3785 | 3782 | struct ieee80211_vif *vif = txq->vif; |
| 3783 | + int q = vif->hw_queue[txq->ac]; | |
| 3784 | + bool q_stopped; | |
| 3786 | 3785 | |
| 3787 | 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 | 3789 | return NULL; |
| 3791 | 3790 | |
| 3792 | 3791 | begin: |
| 3793 | − spin_lock_bh(&fq->lock); | |
| 3794 | − | |
| 3795 | − if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) || | |
| 3796 | − test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) | |
| 3797 | − goto out; | |
| 3792 | + spin_lock(&local->queue_stop_reason_lock); | |
| 3793 | + q_stopped = local->queue_stop_reasons[q]; | |
| 3794 | + spin_unlock(&local->queue_stop_reason_lock); | |
| 3798 | 3795 | |
| 3799 | − if (vif->txqs_stopped[txq->ac]) { | |
| 3800 | − set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); | |
| 3801 | − goto out; | |
| 3796 | + if (unlikely(q_stopped)) { | |
| 3797 | + /* mark for waking later */ | |
| 3798 | + set_bit(IEEE80211_TXQ_DIRTY, &txqi->flags); | |
| 3799 | + return NULL; | |
| 3802 | 3800 | } |
| 3803 | 3801 | |
| 3802 | + spin_lock_bh(&fq->lock); | |
| 3803 | + | |
| 3804 | 3804 | /* Make sure fragments stay together. */ |
| 3805 | 3805 | skb = __skb_dequeue(&txqi->frags); |
| 3806 | 3806 | if (unlikely(skb)) { |
| @@ -3810,6 +3810,9 @@ begin: · 3 unmodified lines | ||
| 3810 | 3810 | IEEE80211_SKB_CB(skb)->control.flags &= |
| 3811 | 3811 | ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING; |
| 3812 | 3812 | } else { |
| 3813 | + if (unlikely(test_bit(IEEE80211_TXQ_STOP, &txqi->flags))) | |
| 3814 | + goto out; | |
| 3815 | + | |
| 3813 | 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 | 3865 | if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags)) |
| 3863 | − info->flags |= IEEE80211_TX_CTL_AMPDU; | |
| 3864 | − else | |
| 3865 | − info->flags &= ~IEEE80211_TX_CTL_AMPDU; | |
| 3866 | + info->flags |= (IEEE80211_TX_CTL_AMPDU | | |
| 3867 | + IEEE80211_TX_CTL_DONTFRAG); | |
| 3866 | 3868 | |
| 3867 | 3869 | if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { |
| 3868 | 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 | 4599 | info = IEEE80211_SKB_CB(skb); |
| 4598 | 4600 | memset(info, 0, sizeof(*info)); |
| 4599 | − if (tid_tx) | |
| 4600 | − info->flags |= IEEE80211_TX_CTL_AMPDU; | |
| 4601 | 4601 | |
| 4602 | 4602 | info->hw_queue = sdata->vif.hw_queue[queue]; |
| 4603 | 4603 | |
| @@ -292,22 +292,12 @@ static void wake_tx_push_queue(struct ieee80211_local *local, · 291 unmodified lines | ||
| 292 | 292 | struct ieee80211_sub_if_data *sdata, |
| 293 | 293 | struct ieee80211_txq *queue) |
| 294 | 294 | { |
| 295 | − int q = sdata->vif.hw_queue[queue->ac]; | |
| 296 | 295 | struct ieee80211_tx_control control = { |
| 297 | 296 | .sta = queue->sta, |
| 298 | 297 | }; |
| 299 | 298 | struct sk_buff *skb; |
| 300 | − unsigned long flags; | |
| 301 | − bool q_stopped; | |
| 302 | 299 | |
| 303 | 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 | 301 | skb = ieee80211_tx_dequeue(&local->hw, queue); |
| 312 | 302 | if (!skb) |
| 313 | 303 | break; |
| @@ -347,8 +337,6 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 33 unmodified lines | ||
| 347 | 337 | local_bh_disable(); |
| 348 | 338 | spin_lock(&fq->lock); |
| 349 | 339 | |
| 350 | − sdata->vif.txqs_stopped[ac] = false; | |
| 351 | − | |
| 352 | 340 | if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) |
| 353 | 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 | 358 | if (ac != txq->ac) |
| 371 | 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 | 362 | &txqi->flags)) |
| 375 | 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 | 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 | 377 | (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) |
| 390 | 378 | goto out; |
| 391 | 379 | |
| @@ -517,8 +505,6 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, · 125 unmodified lines | ||
| 517 | 505 | bool refcounted) |
| 518 | 506 | { |
| 519 | 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 | 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 | 516 | else |
| 531 | 517 | local->q_stop_reasons[queue][reason]++; |
| 532 | 518 | |
| 533 | − if (__test_and_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(); | |
| 519 | + set_bit(reason, &local->queue_stop_reasons[queue]); | |
| 556 | 520 | } |
| 557 | 521 | |
| 558 | 522 | void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, |
| @@ -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 | + */ | |
| 426 | +bool 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 | + | |
| 423 | 448 | void mptcp_pm_data_reset(struct mptcp_sock *msk) |
| 424 | 449 | { |
| 425 | 450 | u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk)); |
| @@ -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 | 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 | 304 | lock_sock(sk); |
| 298 | 305 | |
| 299 | 306 | err = __mptcp_subflow_connect(sk, &addr_l, &addr_r); |
| @@ -98,7 +98,7 @@ static int __mptcp_socket_create(struct mptcp_sock *msk) · 97 unmodified lines | ||
| 98 | 98 | struct socket *ssock; |
| 99 | 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 | 102 | if (err) |
| 103 | 103 | return err; |
| 104 | 104 | |
| @@ -641,7 +641,8 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a, · 640 unmodified lines | ||
| 641 | 641 | /* called with sk socket lock held */ |
| 642 | 642 | int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, |
| 643 | 643 | const struct mptcp_addr_info *remote); |
| 644 | −int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock); | |
| 644 | +int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, | |
| 645 | + struct socket **new_sock); | |
| 645 | 646 | void mptcp_info2sockaddr(const struct mptcp_addr_info *info, |
| 646 | 647 | struct sockaddr_storage *addr, |
| 647 | 648 | unsigned short family); |
| @@ -776,6 +777,9 @@ int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info, · 128 unmodified lines | ||
| 776 | 777 | int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info, |
| 777 | 778 | bool require_family, |
| 778 | 779 | struct mptcp_pm_addr_entry *entry); |
| 780 | +bool mptcp_pm_addr_families_match(const struct sock *sk, | |
| 781 | + const struct mptcp_addr_info *loc, | |
| 782 | + const struct mptcp_addr_info *rem); | |
| 779 | 783 | void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk); |
| 780 | 784 | void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk); |
| 781 | 785 | void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int server_side); |
| @@ -1547,7 +1547,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, · 1546 unmodified lines | ||
| 1547 | 1547 | if (!mptcp_is_fully_established(sk)) |
| 1548 | 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 | 1551 | if (err) |
| 1552 | 1552 | goto err_out; |
| 1553 | 1553 | |
| @@ -1660,7 +1660,9 @@ static void mptcp_subflow_ops_undo_override(struct sock *ssk) · 106 unmodified lines | ||
| 1660 | 1660 | #endif |
| 1661 | 1661 | ssk->sk_prot = &tcp_prot; |
| 1662 | 1662 | } |
| 1663 | −int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock) | |
| 1663 | + | |
| 1664 | +int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, | |
| 1665 | + struct socket **new_sock) | |
| 1664 | 1666 | { |
| 1665 | 1667 | struct mptcp_subflow_context *subflow; |
| 1666 | 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 | 1675 | if (unlikely(!sk->sk_socket)) |
| 1674 | 1676 | return -EINVAL; |
| 1675 | 1677 | |
| 1676 | − err = sock_create_kern(net, sk->sk_family, SOCK_STREAM, IPPROTO_TCP, | |
| 1677 | − &sf); | |
| 1678 | + err = sock_create_kern(net, family, SOCK_STREAM, IPPROTO_TCP, &sf); | |
| 1678 | 1679 | if (err) |
| 1679 | 1680 | return err; |
| 1680 | 1681 | |
| @@ -308,8 +308,8 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[], · 307 unmodified lines | ||
| 308 | 308 | return -IPSET_ERR_BITMAP_RANGE; |
| 309 | 309 | |
| 310 | 310 | pr_debug("mask_bits %u, netmask %u\n", mask_bits, netmask); |
| 311 | − hosts = 2 << (32 - netmask - 1); | |
| 312 | − elements = 2 << (netmask - mask_bits - 1); | |
| 311 | + hosts = 2U << (32 - netmask - 1); | |
| 312 | + elements = 2UL << (netmask - mask_bits - 1); | |
| 313 | 313 | } |
| 314 | 314 | if (elements > IPSET_BITMAP_MAX_RANGE + 1) |
| 315 | 315 | return -IPSET_ERR_BITMAP_RANGE_SIZE; |
| @@ -1068,6 +1068,13 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 1067 unmodified lines | ||
| 1068 | 1068 | ct->proto.tcp.last_flags |= |
| 1069 | 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 | 1078 | spin_unlock_bh(&ct->lock); |
| 1072 | 1079 | nf_ct_l4proto_log_invalid(skb, ct, state, |
| 1073 | 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 | 1200 | * segments we ignored. */ |
| 1194 | 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 | 1211 | break; |
| 1197 | 1212 | default: |
| 1198 | 1213 | /* Keep compilers happy. */ |
| @@ -63,7 +63,7 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len) · 62 unmodified lines | ||
| 63 | 63 | return false; |
| 64 | 64 | |
| 65 | 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 | 68 | memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen); |
| 69 | 69 | |
| @@ -157,6 +157,7 @@ static void local_cleanup(struct nfc_llcp_local *local) · 156 unmodified lines | ||
| 157 | 157 | cancel_work_sync(&local->rx_work); |
| 158 | 158 | cancel_work_sync(&local->timeout_work); |
| 159 | 159 | kfree_skb(local->rx_pending); |
| 160 | + local->rx_pending = NULL; | |
| 160 | 161 | del_timer_sync(&local->sdreq_timer); |
| 161 | 162 | cancel_work_sync(&local->sdreq_timeout_work); |
| 162 | 163 | nfc_llcp_free_sdp_tlv_list(&local->pending_sdreqs); |
| @@ -294,7 +294,7 @@ static void rxrpc_put_call_slot(struct rxrpc_call *call) · 293 unmodified lines | ||
| 294 | 294 | static int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp) |
| 295 | 295 | { |
| 296 | 296 | struct rxrpc_local *local = call->local; |
| 297 | − int ret = 0; | |
| 297 | + int ret = -ENOMEM; | |
| 298 | 298 | |
| 299 | 299 | _enter("{%d,%lx},", call->debug_id, call->user_call_ID); |
| 300 | 300 | |
| @@ -377,6 +377,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch) · 376 unmodified lines | ||
| 377 | 377 | /* Even if driver returns failure adjust the stats - in case offload |
| 378 | 378 | * ended but driver still wants to adjust the values. |
| 379 | 379 | */ |
| 380 | + sch_tree_lock(sch); | |
| 380 | 381 | for (i = 0; i < MAX_DPs; i++) { |
| 381 | 382 | if (!table->tab[i]) |
| 382 | 383 | continue; |
| @@ -393,6 +394,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch) · 10 unmodified lines | ||
| 393 | 394 | sch->qstats.overlimits += hw_stats->stats.qstats[i].overlimits; |
| 394 | 395 | } |
| 395 | 396 | _bstats_update(&sch->bstats, bytes, packets); |
| 397 | + sch_tree_unlock(sch); | |
| 396 | 398 | |
| 397 | 399 | kfree(hw_stats); |
| 398 | 400 | return ret; |
| @@ -1549,7 +1549,7 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, · 1548 unmodified lines | ||
| 1549 | 1549 | struct tc_htb_qopt_offload offload_opt; |
| 1550 | 1550 | struct netdev_queue *dev_queue; |
| 1551 | 1551 | struct Qdisc *q = cl->leaf.q; |
| 1552 | − struct Qdisc *old = NULL; | |
| 1552 | + struct Qdisc *old; | |
| 1553 | 1553 | int err; |
| 1554 | 1554 | |
| 1555 | 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 | 1558 | WARN_ON(!q); |
| 1559 | 1559 | dev_queue = htb_offload_get_queue(cl); |
| 1560 | − old = htb_graft_helper(dev_queue, NULL); | |
| 1561 | − if (destroying) | |
| 1562 | − /* Before HTB is destroyed, the kernel grafts noop_qdisc to | |
| 1563 | − * all queues. | |
| 1560 | + /* When destroying, caller qdisc_graft grafts the new qdisc and invokes | |
| 1561 | + * qdisc_put for the qdisc being destroyed. htb_destroy_class_offload | |
| 1562 | + * does not need to graft or qdisc_put the qdisc being destroyed. | |
| 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 | 1569 | WARN_ON(old != q); |
| 1570 | + } | |
| 1568 | 1571 | |
| 1569 | 1572 | if (cl->parent) { |
| 1570 | 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 | 1585 | err = htb_offload(qdisc_dev(sch), &offload_opt); |
| 1583 | 1586 | |
| 1584 | − if (!err || destroying) | |
| 1585 | − qdisc_put(old); | |
| 1586 | − else | |
| 1587 | − htb_graft_helper(dev_queue, old); | |
| 1587 | + if (!destroying) { | |
| 1588 | + if (!err) | |
| 1589 | + qdisc_put(old); | |
| 1590 | + else | |
| 1591 | + htb_graft_helper(dev_queue, old); | |
| 1592 | + } | |
| 1588 | 1593 | |
| 1589 | 1594 | if (last_child) |
| 1590 | 1595 | return err; |
| @@ -1700,6 +1700,8 @@ static void taprio_reset(struct Qdisc *sch) · 1699 unmodified lines | ||
| 1700 | 1700 | int i; |
| 1701 | 1701 | |
| 1702 | 1702 | hrtimer_cancel(&q->advance_timer); |
| 1703 | + qdisc_synchronize(sch); | |
| 1704 | + | |
| 1703 | 1705 | if (q->qdiscs) { |
| 1704 | 1706 | for (i = 0; i < dev->num_tx_queues; i++) |
| 1705 | 1707 | if (q->qdiscs[i]) |
| @@ -1720,6 +1722,7 @@ static void taprio_destroy(struct Qdisc *sch) · 14 unmodified lines | ||
| 1720 | 1722 | * happens in qdisc_create(), after taprio_init() has been called. |
| 1721 | 1723 | */ |
| 1722 | 1724 | hrtimer_cancel(&q->advance_timer); |
| 1725 | + qdisc_synchronize(sch); | |
| 1723 | 1726 | |
| 1724 | 1727 | taprio_disable_offload(dev, q, NULL); |
| 1725 | 1728 | |
| @@ -752,6 +752,52 @@ test_subflows() · 751 unmodified lines | ||
| 752 | 752 | "$server4_token" > /dev/null 2>&1 |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | +test_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 | + | |
| 755 | 801 | test_prio() |
| 756 | 802 | { |
| 757 | 803 | local count |
| @@ -861,6 +907,7 @@ make_connection "v6" · 103 unmodified lines | ||
| 861 | 907 | test_announce |
| 862 | 908 | test_remove |
| 863 | 909 | test_subflows |
| 910 | +test_subflows_v4_v6_mix | |
| 864 | 911 | test_prio |
| 865 | 912 | test_listener |
| 866 | 913 | |
| @@ -215,7 +215,7 @@ static char *recv_frame(const struct ring_state *ring, char *frame) · 214 unmodified lines | ||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /* A single TPACKET_V3 block can hold multiple frames */ |
| 218 | −static void recv_block(struct ring_state *ring) | |
| 218 | +static bool recv_block(struct ring_state *ring) | |
| 219 | 219 | { |
| 220 | 220 | struct tpacket_block_desc *block; |
| 221 | 221 | char *frame; |
| @@ -223,7 +223,7 @@ static void recv_block(struct ring_state *ring) · 1 unmodified line | ||
| 223 | 223 | |
| 224 | 224 | block = (void *)(ring->mmap + ring->idx * ring_block_sz); |
| 225 | 225 | if (!(block->hdr.bh1.block_status & TP_STATUS_USER)) |
| 226 | − return; | |
| 226 | + return false; | |
| 227 | 227 | |
| 228 | 228 | frame = (char *)block; |
| 229 | 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 | 236 | block->hdr.bh1.block_status = TP_STATUS_KERNEL; |
| 237 | 237 | ring->idx = (ring->idx + 1) % ring_block_nr; |
| 238 | + | |
| 239 | + return true; | |
| 238 | 240 | } |
| 239 | 241 | |
| 240 | 242 | /* simple test: sleep once unconditionally and then process all rings */ |
| @@ -245,7 +247,7 @@ static void process_rings(void) · 4 unmodified lines | ||
| 245 | 247 | usleep(1000 * cfg_timeout_msec); |
| 246 | 248 | |
| 247 | 249 | for (i = 0; i < num_cpus; i++) |
| 248 | − recv_block(&rings[i]); | |
| 250 | + do {} while (recv_block(&rings[i])); | |
| 249 | 251 | |
| 250 | 252 | fprintf(stderr, "count: pass=%u nohash=%u fail=%u\n", |
| 251 | 253 | frames_received - frames_nohash - frames_error, |
| @@ -257,12 +259,12 @@ static char *setup_ring(int fd) · 5 unmodified lines | ||
| 257 | 259 | struct tpacket_req3 req3 = {0}; |
| 258 | 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 | 263 | req3.tp_feature_req_word = TP_FT_REQ_FILL_RXHASH; |
| 262 | 264 | |
| 263 | 265 | req3.tp_frame_size = 2048; |
| 264 | 266 | req3.tp_frame_nr = 1 << 10; |
| 265 | − req3.tp_block_nr = 2; | |
| 267 | + req3.tp_block_nr = 16; | |
| 266 | 268 | |
| 267 | 269 | req3.tp_block_size = req3.tp_frame_size * req3.tp_frame_nr; |
| 268 | 270 | req3.tp_block_size /= req3.tp_block_nr; |
| @@ -10,12 +10,20 @@ · 9 unmodified lines | ||
| 10 | 10 | ksft_skip=4 |
| 11 | 11 | |
| 12 | 12 | testns=testns-$(mktemp -u "XXXXXXXX") |
| 13 | +tmp="" | |
| 13 | 14 | |
| 14 | 15 | tables="foo bar baz quux" |
| 15 | 16 | global_ret=0 |
| 16 | 17 | eret=0 |
| 17 | 18 | lret=0 |
| 18 | 19 | |
| 20 | +cleanup() { | |
| 21 | + ip netns pids "$testns" | xargs kill 2>/dev/null | |
| 22 | + ip netns del "$testns" | |
| 23 | + | |
| 24 | + rm -f "$tmp" | |
| 25 | +} | |
| 26 | + | |
| 19 | 27 | check_result() |
| 20 | 28 | { |
| 21 | 29 | local r=$1 |
| @@ -43,6 +51,7 @@ if [ $? -ne 0 ];then · 21 unmodified lines | ||
| 43 | 51 | exit $ksft_skip |
| 44 | 52 | fi |
| 45 | 53 | |
| 54 | +trap cleanup EXIT | |
| 46 | 55 | tmp=$(mktemp) |
| 47 | 56 | |
| 48 | 57 | for table in $tables; do |
| @@ -139,11 +148,4 @@ done · 90 unmodified lines | ||
| 139 | 148 | |
| 140 | 149 | check_result $lret "add/delete with nftrace enabled" |
| 141 | 150 | |
| 142 | −pkill -9 ping | |
| 143 | − | |
| 144 | −wait | |
| 145 | − | |
| 146 | −rm -f "$tmp" | |
| 147 | −ip netns del "$testns" | |
| 148 | − | |
| 149 | 151 | exit $global_ret |
| @@ -0,0 +1 @@ | ||
| 1 | +timeout=120 | |