Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'net-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
"Including fixes from Bluetooth.

Current release - fix to a fix:

- usb: asix_devices: fix PHY address mask in MDIO bus initialization

Current release - regressions:

- Bluetooth: fixes for the split between BIS_LINK and PA_LINK

- Revert "net: cadence: macb: sama7g5_emac: Remove USARIO CLKEN
flag", breaks compatibility with some existing device tree blobs

- dsa: b53: fix reserved register access in b53_fdb_dump()

Current release - new code bugs:

- sched: dualpi2: run probability update timer in BH to avoid
deadlock

- eth: libwx: fix the size in RSS hash key population

- pse-pd: pd692x0: improve power budget error paths and handling

Previous releases - regressions:

- tls: fix handling of zero-length records on the rx_list

- hsr: reject HSR frame if skb can't hold tag

- bonding: fix negotiation flapping in 802.3ad passive mode

Previous releases - always broken:

- gso: forbid IPv6 TSO with extensions on devices with only IPV6_CSUM

- sched: make cake_enqueue return NET_XMIT_CN when past buffer_limit,
avoid packet drops with low buffer_limit, remove unnecessary WARN()

- sched: fix backlog accounting after modifying config of a qdisc in
the middle of the hierarchy

- mptcp: improve handling of skb extension allocation failures

- eth: mlx5:
- fixes for the "HW Steering" flow management method
- fixes for QoS and device buffer management"

* tag 'net-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (81 commits)
netfilter: nf_reject: don't leak dst refcount for loopback packets
net/mlx5e: Preserve shared buffer capacity during headroom updates
net/mlx5e: Query FW for buffer ownership
net/mlx5: Restore missing scheduling node cleanup on vport enable failure
net/mlx5: Fix QoS reference leak in vport enable error path
net/mlx5: Destroy vport QoS element when no configuration remains
net/mlx5e: Preserve tc-bw during parent changes
net/mlx5: Remove default QoS group and attach vports directly to root TSAR
net/mlx5: Base ECVF devlink port attrs from 0
net: pse-pd: pd692x0: Skip power budget configuration when undefined
net: pse-pd: pd692x0: Fix power budget leak in manager setup error path
Octeontx2-af: Skip overlap check for SPI field
selftests: tls: add tests for zero-length records
tls: fix handling of zero-length records on the rx_list
net: airoha: ppe: Do not invalid PPE entries in case of SW hash collision
selftests: bonding: add test for passive LACP mode
bonding: send LACPDUs periodically in passive mode after receiving partner's LACPDU
bonding: update LACP activity flag after setting lacp_active
Revert "net: cadence: macb: sama7g5_emac: Remove USARIO CLKEN flag"
ipv6: sr: Fix MAC comparison to be constant-time
...

+1434 -397
+2
Documentation/networking/mptcp-sysctl.rst
··· 12 12 resent to an MPTCP peer that has not acknowledged a previous 13 13 ADD_ADDR message. 14 14 15 + Do not retransmit if set to 0. 16 + 15 17 The default value matches TCP_RTO_MAX. This is a per-namespace 16 18 sysctl. 17 19
+1 -1
MAINTAINERS
··· 22174 22174 22175 22175 S390 NETWORK DRIVERS 22176 22176 M: Alexandra Winter <wintera@linux.ibm.com> 22177 - M: Thorsten Winkler <twinkler@linux.ibm.com> 22177 + R: Aswin Karuvally <aswin@linux.ibm.com> 22178 22178 L: linux-s390@vger.kernel.org 22179 22179 L: netdev@vger.kernel.org 22180 22180 S: Supported
+1 -6
drivers/bluetooth/btmtk.c
··· 642 642 * WMT command. 643 643 */ 644 644 err = wait_on_bit_timeout(&data->flags, BTMTK_TX_WAIT_VND_EVT, 645 - TASK_INTERRUPTIBLE, HCI_INIT_TIMEOUT); 646 - if (err == -EINTR) { 647 - bt_dev_err(hdev, "Execution of wmt command interrupted"); 648 - clear_bit(BTMTK_TX_WAIT_VND_EVT, &data->flags); 649 - goto err_free_wc; 650 - } 645 + TASK_UNINTERRUPTIBLE, HCI_INIT_TIMEOUT); 651 646 652 647 if (err) { 653 648 bt_dev_err(hdev, "Execution of wmt command timed out");
+4 -4
drivers/bluetooth/btnxpuart.c
··· 543 543 } 544 544 545 545 if (psdata->wakeup_source) { 546 - ret = devm_request_irq(&serdev->dev, psdata->irq_handler, 547 - ps_host_wakeup_irq_handler, 548 - IRQF_ONESHOT | IRQF_TRIGGER_FALLING, 549 - dev_name(&serdev->dev), nxpdev); 546 + ret = devm_request_threaded_irq(&serdev->dev, psdata->irq_handler, 547 + NULL, ps_host_wakeup_irq_handler, 548 + IRQF_ONESHOT, 549 + dev_name(&serdev->dev), nxpdev); 550 550 if (ret) 551 551 bt_dev_info(hdev, "error setting wakeup IRQ handler, ignoring\n"); 552 552 disable_irq(psdata->irq_handler);
+49 -18
drivers/net/bonding/bond_3ad.c
··· 95 95 static void ad_mux_machine(struct port *port, bool *update_slave_arr); 96 96 static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port); 97 97 static void ad_tx_machine(struct port *port); 98 - static void ad_periodic_machine(struct port *port, struct bond_params *bond_params); 98 + static void ad_periodic_machine(struct port *port); 99 99 static void ad_port_selection_logic(struct port *port, bool *update_slave_arr); 100 100 static void ad_agg_selection_logic(struct aggregator *aggregator, 101 101 bool *update_slave_arr); 102 102 static void ad_clear_agg(struct aggregator *aggregator); 103 103 static void ad_initialize_agg(struct aggregator *aggregator); 104 - static void ad_initialize_port(struct port *port, int lacp_fast); 104 + static void ad_initialize_port(struct port *port, const struct bond_params *bond_params); 105 105 static void ad_enable_collecting(struct port *port); 106 106 static void ad_disable_distributing(struct port *port, 107 107 bool *update_slave_arr); ··· 1307 1307 * case of EXPIRED even if LINK_DOWN didn't arrive for 1308 1308 * the port. 1309 1309 */ 1310 - port->partner_oper.port_state &= ~LACP_STATE_SYNCHRONIZATION; 1311 1310 port->sm_vars &= ~AD_PORT_MATCHED; 1311 + /* Based on IEEE 8021AX-2014, Figure 6-18 - Receive 1312 + * machine state diagram, the statue should be 1313 + * Partner_Oper_Port_State.Synchronization = FALSE; 1314 + * Partner_Oper_Port_State.LACP_Timeout = Short Timeout; 1315 + * start current_while_timer(Short Timeout); 1316 + * Actor_Oper_Port_State.Expired = TRUE; 1317 + */ 1318 + port->partner_oper.port_state &= ~LACP_STATE_SYNCHRONIZATION; 1312 1319 port->partner_oper.port_state |= LACP_STATE_LACP_TIMEOUT; 1313 - port->partner_oper.port_state |= LACP_STATE_LACP_ACTIVITY; 1314 1320 port->sm_rx_timer_counter = __ad_timer_to_ticks(AD_CURRENT_WHILE_TIMER, (u16)(AD_SHORT_TIMEOUT)); 1315 1321 port->actor_oper_port_state |= LACP_STATE_EXPIRED; 1316 1322 port->sm_vars |= AD_PORT_CHURNED; ··· 1423 1417 /** 1424 1418 * ad_periodic_machine - handle a port's periodic state machine 1425 1419 * @port: the port we're looking at 1426 - * @bond_params: bond parameters we will use 1427 1420 * 1428 1421 * Turn ntt flag on priodically to perform periodic transmission of lacpdu's. 1429 1422 */ 1430 - static void ad_periodic_machine(struct port *port, struct bond_params *bond_params) 1423 + static void ad_periodic_machine(struct port *port) 1431 1424 { 1432 1425 periodic_states_t last_state; 1433 1426 ··· 1435 1430 1436 1431 /* check if port was reinitialized */ 1437 1432 if (((port->sm_vars & AD_PORT_BEGIN) || !(port->sm_vars & AD_PORT_LACP_ENABLED) || !port->is_enabled) || 1438 - (!(port->actor_oper_port_state & LACP_STATE_LACP_ACTIVITY) && !(port->partner_oper.port_state & LACP_STATE_LACP_ACTIVITY)) || 1439 - !bond_params->lacp_active) { 1433 + (!(port->actor_oper_port_state & LACP_STATE_LACP_ACTIVITY) && !(port->partner_oper.port_state & LACP_STATE_LACP_ACTIVITY))) { 1440 1434 port->sm_periodic_state = AD_NO_PERIODIC; 1441 1435 } 1442 1436 /* check if state machine should change state */ ··· 1959 1955 /** 1960 1956 * ad_initialize_port - initialize a given port's parameters 1961 1957 * @port: the port we're looking at 1962 - * @lacp_fast: boolean. whether fast periodic should be used 1958 + * @bond_params: bond parameters we will use 1963 1959 */ 1964 - static void ad_initialize_port(struct port *port, int lacp_fast) 1960 + static void ad_initialize_port(struct port *port, const struct bond_params *bond_params) 1965 1961 { 1966 1962 static const struct port_params tmpl = { 1967 1963 .system_priority = 0xffff, 1968 1964 .key = 1, 1969 1965 .port_number = 1, 1970 1966 .port_priority = 0xff, 1971 - .port_state = 1, 1967 + .port_state = 0, 1972 1968 }; 1973 1969 static const struct lacpdu lacpdu = { 1974 1970 .subtype = 0x01, ··· 1986 1982 port->actor_port_priority = 0xff; 1987 1983 port->actor_port_aggregator_identifier = 0; 1988 1984 port->ntt = false; 1989 - port->actor_admin_port_state = LACP_STATE_AGGREGATION | 1990 - LACP_STATE_LACP_ACTIVITY; 1991 - port->actor_oper_port_state = LACP_STATE_AGGREGATION | 1992 - LACP_STATE_LACP_ACTIVITY; 1985 + port->actor_admin_port_state = LACP_STATE_AGGREGATION; 1986 + port->actor_oper_port_state = LACP_STATE_AGGREGATION; 1987 + if (bond_params->lacp_active) { 1988 + port->actor_admin_port_state |= LACP_STATE_LACP_ACTIVITY; 1989 + port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY; 1990 + } 1993 1991 1994 - if (lacp_fast) 1992 + if (bond_params->lacp_fast) 1995 1993 port->actor_oper_port_state |= LACP_STATE_LACP_TIMEOUT; 1996 1994 1997 1995 memcpy(&port->partner_admin, &tmpl, sizeof(tmpl)); ··· 2207 2201 /* port initialization */ 2208 2202 port = &(SLAVE_AD_INFO(slave)->port); 2209 2203 2210 - ad_initialize_port(port, bond->params.lacp_fast); 2204 + ad_initialize_port(port, &bond->params); 2211 2205 2212 2206 port->slave = slave; 2213 2207 port->actor_port_number = SLAVE_AD_INFO(slave)->id; ··· 2519 2513 } 2520 2514 2521 2515 ad_rx_machine(NULL, port); 2522 - ad_periodic_machine(port, &bond->params); 2516 + ad_periodic_machine(port); 2523 2517 ad_port_selection_logic(port, &update_slave_arr); 2524 2518 ad_mux_machine(port, &update_slave_arr); 2525 2519 ad_tx_machine(port); ··· 2885 2879 port->actor_oper_port_state |= LACP_STATE_LACP_TIMEOUT; 2886 2880 else 2887 2881 port->actor_oper_port_state &= ~LACP_STATE_LACP_TIMEOUT; 2882 + } 2883 + spin_unlock_bh(&bond->mode_lock); 2884 + } 2885 + 2886 + /** 2887 + * bond_3ad_update_lacp_active - change the lacp active 2888 + * @bond: bonding struct 2889 + * 2890 + * Update actor_oper_port_state when lacp_active is modified. 2891 + */ 2892 + void bond_3ad_update_lacp_active(struct bonding *bond) 2893 + { 2894 + struct port *port = NULL; 2895 + struct list_head *iter; 2896 + struct slave *slave; 2897 + int lacp_active; 2898 + 2899 + lacp_active = bond->params.lacp_active; 2900 + spin_lock_bh(&bond->mode_lock); 2901 + bond_for_each_slave(bond, slave, iter) { 2902 + port = &(SLAVE_AD_INFO(slave)->port); 2903 + if (lacp_active) 2904 + port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY; 2905 + else 2906 + port->actor_oper_port_state &= ~LACP_STATE_LACP_ACTIVITY; 2888 2907 } 2889 2908 spin_unlock_bh(&bond->mode_lock); 2890 2909 }
+1
drivers/net/bonding/bond_options.c
··· 1660 1660 netdev_dbg(bond->dev, "Setting LACP active to %s (%llu)\n", 1661 1661 newval->string, newval->value); 1662 1662 bond->params.lacp_active = newval->value; 1663 + bond_3ad_update_lacp_active(bond); 1663 1664 1664 1665 return 0; 1665 1666 }
+1 -1
drivers/net/dsa/b53/b53_common.c
··· 2078 2078 2079 2079 /* Start search operation */ 2080 2080 reg = ARL_SRCH_STDN; 2081 - b53_write8(priv, offset, B53_ARL_SRCH_CTL, reg); 2081 + b53_write8(priv, B53_ARLIO_PAGE, offset, reg); 2082 2082 2083 2083 do { 2084 2084 ret = b53_arl_search_wait(priv);
+6
drivers/net/dsa/microchip/ksz_common.c
··· 2457 2457 dev->dev_ops->cfg_port_member(dev, i, val | cpu_port); 2458 2458 } 2459 2459 2460 + /* HSR ports are setup once so need to use the assigned membership 2461 + * when the port is enabled. 2462 + */ 2463 + if (!port_member && p->stp_state == BR_STATE_FORWARDING && 2464 + (dev->hsr_ports & BIT(port))) 2465 + port_member = dev->hsr_ports; 2460 2466 dev->dev_ops->cfg_port_member(dev, port, port_member | cpu_port); 2461 2467 } 2462 2468
+1 -3
drivers/net/ethernet/airoha/airoha_ppe.c
··· 736 736 continue; 737 737 } 738 738 739 - if (commit_done || !airoha_ppe_foe_compare_entry(e, hwe)) { 740 - e->hash = 0xffff; 739 + if (!airoha_ppe_foe_compare_entry(e, hwe)) 741 740 continue; 742 - } 743 741 744 742 airoha_ppe_foe_commit_entry(ppe, &e->data, hash); 745 743 commit_done = true;
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 5332 5332 { 5333 5333 int i; 5334 5334 5335 - netdev_assert_locked(bp->dev); 5335 + netdev_assert_locked_or_invisible(bp->dev); 5336 5336 5337 5337 /* Under netdev instance lock and all our NAPIs have been disabled. 5338 5338 * It's safe to delete the hash table.
+2 -1
drivers/net/ethernet/cadence/macb_main.c
··· 5113 5113 5114 5114 static const struct macb_config sama7g5_emac_config = { 5115 5115 .caps = MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | 5116 - MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP, 5116 + MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_MIIONRGMII | 5117 + MACB_CAPS_GEM_HAS_PTP, 5117 5118 .dma_burst_length = 16, 5118 5119 .clk_init = macb_clk_init, 5119 5120 .init = macb_init,
+2
drivers/net/ethernet/google/gve/gve_main.c
··· 2870 2870 struct gve_priv *priv = netdev_priv(netdev); 2871 2871 bool was_up = netif_running(priv->dev); 2872 2872 2873 + netif_device_detach(netdev); 2874 + 2873 2875 rtnl_lock(); 2874 2876 netdev_lock(netdev); 2875 2877 if (was_up && gve_close(priv->dev)) {
+7 -7
drivers/net/ethernet/intel/igc/igc_main.c
··· 7149 7149 adapter->port_num = hw->bus.func; 7150 7150 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); 7151 7151 7152 + /* PCI config space info */ 7153 + hw->vendor_id = pdev->vendor; 7154 + hw->device_id = pdev->device; 7155 + hw->revision_id = pdev->revision; 7156 + hw->subsystem_vendor_id = pdev->subsystem_vendor; 7157 + hw->subsystem_device_id = pdev->subsystem_device; 7158 + 7152 7159 /* Disable ASPM L1.2 on I226 devices to avoid packet loss */ 7153 7160 if (igc_is_device_id_i226(hw)) 7154 7161 pci_disable_link_state(pdev, PCIE_LINK_STATE_L1_2); ··· 7181 7174 7182 7175 netdev->mem_start = pci_resource_start(pdev, 0); 7183 7176 netdev->mem_end = pci_resource_end(pdev, 0); 7184 - 7185 - /* PCI config space info */ 7186 - hw->vendor_id = pdev->vendor; 7187 - hw->device_id = pdev->device; 7188 - hw->revision_id = pdev->revision; 7189 - hw->subsystem_vendor_id = pdev->subsystem_vendor; 7190 - hw->subsystem_device_id = pdev->subsystem_device; 7191 7177 7192 7178 /* Copy the default MAC and PHY function pointers */ 7193 7179 memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops));
+11 -23
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 968 968 for (i = 0; i < adapter->num_tx_queues; i++) 969 969 clear_bit(__IXGBE_HANG_CHECK_ARMED, 970 970 &adapter->tx_ring[i]->state); 971 - 972 - for (i = 0; i < adapter->num_xdp_queues; i++) 973 - clear_bit(__IXGBE_HANG_CHECK_ARMED, 974 - &adapter->xdp_ring[i]->state); 975 971 } 976 972 977 973 static void ixgbe_update_xoff_received(struct ixgbe_adapter *adapter) ··· 1210 1214 struct ixgbe_adapter *adapter = netdev_priv(tx_ring->netdev); 1211 1215 struct ixgbe_hw *hw = &adapter->hw; 1212 1216 1213 - e_err(drv, "Detected Tx Unit Hang%s\n" 1217 + e_err(drv, "Detected Tx Unit Hang\n" 1214 1218 " Tx Queue <%d>\n" 1215 1219 " TDH, TDT <%x>, <%x>\n" 1216 1220 " next_to_use <%x>\n" ··· 1218 1222 "tx_buffer_info[next_to_clean]\n" 1219 1223 " time_stamp <%lx>\n" 1220 1224 " jiffies <%lx>\n", 1221 - ring_is_xdp(tx_ring) ? " (XDP)" : "", 1222 1225 tx_ring->queue_index, 1223 1226 IXGBE_READ_REG(hw, IXGBE_TDH(tx_ring->reg_idx)), 1224 1227 IXGBE_READ_REG(hw, IXGBE_TDT(tx_ring->reg_idx)), 1225 1228 tx_ring->next_to_use, next, 1226 1229 tx_ring->tx_buffer_info[next].time_stamp, jiffies); 1227 1230 1228 - if (!ring_is_xdp(tx_ring)) 1229 - netif_stop_subqueue(tx_ring->netdev, 1230 - tx_ring->queue_index); 1231 + netif_stop_subqueue(tx_ring->netdev, 1232 + tx_ring->queue_index); 1231 1233 } 1232 1234 1233 1235 /** ··· 1445 1451 total_bytes); 1446 1452 adapter->tx_ipsec += total_ipsec; 1447 1453 1454 + if (ring_is_xdp(tx_ring)) 1455 + return !!budget; 1456 + 1448 1457 if (check_for_tx_hang(tx_ring) && ixgbe_check_tx_hang(tx_ring)) { 1449 1458 if (adapter->hw.mac.type == ixgbe_mac_e610) 1450 1459 ixgbe_handle_mdd_event(adapter, tx_ring); ··· 1464 1467 /* the adapter is about to reset, no point in enabling stuff */ 1465 1468 return true; 1466 1469 } 1467 - 1468 - if (ring_is_xdp(tx_ring)) 1469 - return !!budget; 1470 1470 1471 1471 #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) 1472 1472 txq = netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index); ··· 7968 7974 return; 7969 7975 7970 7976 /* Force detection of hung controller */ 7971 - if (netif_carrier_ok(adapter->netdev)) { 7977 + if (netif_carrier_ok(adapter->netdev)) 7972 7978 for (i = 0; i < adapter->num_tx_queues; i++) 7973 7979 set_check_for_tx_hang(adapter->tx_ring[i]); 7974 - for (i = 0; i < adapter->num_xdp_queues; i++) 7975 - set_check_for_tx_hang(adapter->xdp_ring[i]); 7976 - } 7977 7980 7978 7981 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { 7979 7982 /* ··· 8187 8196 struct ixgbe_ring *tx_ring = adapter->tx_ring[i]; 8188 8197 8189 8198 if (tx_ring->next_to_use != tx_ring->next_to_clean) 8190 - return true; 8191 - } 8192 - 8193 - for (i = 0; i < adapter->num_xdp_queues; i++) { 8194 - struct ixgbe_ring *ring = adapter->xdp_ring[i]; 8195 - 8196 - if (ring->next_to_use != ring->next_to_clean) 8197 8199 return true; 8198 8200 } 8199 8201 ··· 10987 11003 int i; 10988 11004 10989 11005 if (unlikely(test_bit(__IXGBE_DOWN, &adapter->state))) 11006 + return -ENETDOWN; 11007 + 11008 + if (!netif_carrier_ok(adapter->netdev) || 11009 + !netif_running(adapter->netdev)) 10990 11010 return -ENETDOWN; 10991 11011 10992 11012 if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
+3 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
··· 398 398 dma_addr_t dma; 399 399 u32 cmd_type; 400 400 401 - while (budget-- > 0) { 401 + while (likely(budget)) { 402 402 if (unlikely(!ixgbe_desc_unused(xdp_ring))) { 403 403 work_done = false; 404 404 break; ··· 433 433 xdp_ring->next_to_use++; 434 434 if (xdp_ring->next_to_use == xdp_ring->count) 435 435 xdp_ring->next_to_use = 0; 436 + 437 + budget--; 436 438 } 437 439 438 440 if (tx_desc) {
+2 -2
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
··· 606 606 if (!npc_check_field(rvu, blkaddr, NPC_LB, intf)) 607 607 *features &= ~BIT_ULL(NPC_OUTER_VID); 608 608 609 - /* Set SPI flag only if AH/ESP and IPSEC_SPI are in the key */ 610 - if (npc_check_field(rvu, blkaddr, NPC_IPSEC_SPI, intf) && 609 + /* Allow extracting SPI field from AH and ESP headers at same offset */ 610 + if (npc_is_field_present(rvu, NPC_IPSEC_SPI, intf) && 611 611 (*features & (BIT_ULL(NPC_IPPROTO_ESP) | BIT_ULL(NPC_IPPROTO_AH)))) 612 612 *features |= BIT_ULL(NPC_IPSEC_SPI); 613 613
+2
drivers/net/ethernet/mediatek/mtk_ppe_offload.c
··· 101 101 if (!IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED)) 102 102 return -1; 103 103 104 + rcu_read_lock(); 104 105 err = dev_fill_forward_path(dev, addr, &stack); 106 + rcu_read_unlock(); 105 107 if (err) 106 108 return err; 107 109
-1
drivers/net/ethernet/mellanox/mlx5/core/en/dcbnl.h
··· 26 26 u8 cap; 27 27 28 28 /* Buffer configuration */ 29 - bool manual_buffer; 30 29 u32 cable_len; 31 30 u32 xoff; 32 31 u16 port_buff_cell_sz;
+8 -10
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
··· 272 272 /* Total shared buffer size is split in a ratio of 3:1 between 273 273 * lossy and lossless pools respectively. 274 274 */ 275 - lossy_epool_size = (shared_buffer_size / 4) * 3; 276 275 lossless_ipool_size = shared_buffer_size / 4; 276 + lossy_epool_size = shared_buffer_size - lossless_ipool_size; 277 277 278 278 mlx5e_port_set_sbpr(mdev, 0, MLX5_EGRESS_DIR, MLX5_LOSSY_POOL, 0, 279 279 lossy_epool_size); ··· 288 288 u16 port_buff_cell_sz = priv->dcbx.port_buff_cell_sz; 289 289 struct mlx5_core_dev *mdev = priv->mdev; 290 290 int sz = MLX5_ST_SZ_BYTES(pbmc_reg); 291 - u32 new_headroom_size = 0; 292 - u32 current_headroom_size; 291 + u32 current_headroom_cells = 0; 292 + u32 new_headroom_cells = 0; 293 293 void *in; 294 294 int err; 295 295 int i; 296 - 297 - current_headroom_size = port_buffer->headroom_size; 298 296 299 297 in = kzalloc(sz, GFP_KERNEL); 300 298 if (!in) ··· 304 306 305 307 for (i = 0; i < MLX5E_MAX_NETWORK_BUFFER; i++) { 306 308 void *buffer = MLX5_ADDR_OF(pbmc_reg, in, buffer[i]); 309 + current_headroom_cells += MLX5_GET(bufferx_reg, buffer, size); 310 + 307 311 u64 size = port_buffer->buffer[i].size; 308 312 u64 xoff = port_buffer->buffer[i].xoff; 309 313 u64 xon = port_buffer->buffer[i].xon; 310 314 311 - new_headroom_size += size; 312 315 do_div(size, port_buff_cell_sz); 316 + new_headroom_cells += size; 313 317 do_div(xoff, port_buff_cell_sz); 314 318 do_div(xon, port_buff_cell_sz); 315 319 MLX5_SET(bufferx_reg, buffer, size, size); ··· 320 320 MLX5_SET(bufferx_reg, buffer, xon_threshold, xon); 321 321 } 322 322 323 - new_headroom_size /= port_buff_cell_sz; 324 - current_headroom_size /= port_buff_cell_sz; 325 - err = port_update_shared_buffer(priv->mdev, current_headroom_size, 326 - new_headroom_size); 323 + err = port_update_shared_buffer(priv->mdev, current_headroom_cells, 324 + new_headroom_cells); 327 325 if (err) 328 326 goto out; 329 327
+2
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_hmfs.c
··· 173 173 174 174 memset(rule_actions, 0, NUM_CT_HMFS_RULES * sizeof(*rule_actions)); 175 175 rule_actions[0].action = mlx5_fc_get_hws_action(fs_hmfs->ctx, attr->counter); 176 + rule_actions[0].counter.offset = 177 + attr->counter->id - attr->counter->bulk->base_id; 176 178 /* Modify header is special, it may require extra arguments outside the action itself. */ 177 179 if (mh_action->mh_data) { 178 180 rule_actions[1].modify_header.offset = mh_action->mh_data->offset;
+9 -3
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
··· 362 362 static int mlx5e_dcbnl_ieee_setpfc(struct net_device *dev, 363 363 struct ieee_pfc *pfc) 364 364 { 365 + u8 buffer_ownership = MLX5_BUF_OWNERSHIP_UNKNOWN; 365 366 struct mlx5e_priv *priv = netdev_priv(dev); 366 367 struct mlx5_core_dev *mdev = priv->mdev; 367 368 u32 old_cable_len = priv->dcbx.cable_len; ··· 390 389 391 390 if (MLX5_BUFFER_SUPPORTED(mdev)) { 392 391 pfc_new.pfc_en = (changed & MLX5E_PORT_BUFFER_PFC) ? pfc->pfc_en : curr_pfc_en; 393 - if (priv->dcbx.manual_buffer) 392 + ret = mlx5_query_port_buffer_ownership(mdev, 393 + &buffer_ownership); 394 + if (ret) 395 + netdev_err(dev, 396 + "%s, Failed to get buffer ownership: %d\n", 397 + __func__, ret); 398 + 399 + if (buffer_ownership == MLX5_BUF_OWNERSHIP_SW_OWNED) 394 400 ret = mlx5e_port_manual_buffer_config(priv, changed, 395 401 dev->mtu, &pfc_new, 396 402 NULL, NULL); ··· 990 982 if (!changed) 991 983 return 0; 992 984 993 - priv->dcbx.manual_buffer = true; 994 985 err = mlx5e_port_manual_buffer_config(priv, changed, dev->mtu, NULL, 995 986 buffer_size, prio2buffer); 996 987 return err; ··· 1259 1252 priv->dcbx.cap |= DCB_CAP_DCBX_HOST; 1260 1253 1261 1254 priv->dcbx.port_buff_cell_sz = mlx5e_query_port_buffers_cell_size(priv); 1262 - priv->dcbx.manual_buffer = false; 1263 1255 priv->dcbx.cable_len = MLX5E_DEFAULT_CABLE_LEN; 1264 1256 1265 1257 mlx5e_ets_init(priv);
+98 -85
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
··· 102 102 u8 level; 103 103 /* Valid only when this node represents a traffic class. */ 104 104 u8 tc; 105 + /* Valid only for a TC arbiter node or vport TC arbiter. */ 106 + u32 tc_bw[DEVLINK_RATE_TCS_MAX]; 105 107 }; 106 108 107 109 static void esw_qos_node_attach_to_parent(struct mlx5_esw_sched_node *node) ··· 464 462 esw_qos_vport_create_sched_element(struct mlx5_esw_sched_node *vport_node, 465 463 struct netlink_ext_ack *extack) 466 464 { 465 + struct mlx5_esw_sched_node *parent = vport_node->parent; 467 466 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; 468 467 struct mlx5_core_dev *dev = vport_node->esw->dev; 469 468 void *attr; ··· 480 477 attr = MLX5_ADDR_OF(scheduling_context, sched_ctx, element_attributes); 481 478 MLX5_SET(vport_element, attr, vport_number, vport_node->vport->vport); 482 479 MLX5_SET(scheduling_context, sched_ctx, parent_element_id, 483 - vport_node->parent->ix); 480 + parent ? parent->ix : vport_node->esw->qos.root_tsar_ix); 484 481 MLX5_SET(scheduling_context, sched_ctx, max_average_bw, 485 482 vport_node->max_rate); 486 483 ··· 611 608 esw_qos_tc_arbiter_get_bw_shares(struct mlx5_esw_sched_node *tc_arbiter_node, 612 609 u32 *tc_bw) 613 610 { 614 - struct mlx5_esw_sched_node *vports_tc_node; 615 - 616 - list_for_each_entry(vports_tc_node, &tc_arbiter_node->children, entry) 617 - tc_bw[vports_tc_node->tc] = vports_tc_node->bw_share; 611 + memcpy(tc_bw, tc_arbiter_node->tc_bw, sizeof(tc_arbiter_node->tc_bw)); 618 612 } 619 613 620 614 static void ··· 628 628 u8 tc = vports_tc_node->tc; 629 629 u32 bw_share; 630 630 631 + tc_arbiter_node->tc_bw[tc] = tc_bw[tc]; 631 632 bw_share = tc_bw[tc] * fw_max_bw_share; 632 633 bw_share = esw_qos_calc_bw_share(bw_share, divider, 633 634 fw_max_bw_share); ··· 787 786 return err; 788 787 } 789 788 790 - if (MLX5_CAP_QOS(dev, log_esw_max_sched_depth)) { 791 - esw->qos.node0 = __esw_qos_create_vports_sched_node(esw, NULL, extack); 792 - } else { 793 - /* The eswitch doesn't support scheduling nodes. 794 - * Create a software-only node0 using the root TSAR to attach vport QoS to. 795 - */ 796 - if (!__esw_qos_alloc_node(esw, 797 - esw->qos.root_tsar_ix, 798 - SCHED_NODE_TYPE_VPORTS_TSAR, 799 - NULL)) 800 - esw->qos.node0 = ERR_PTR(-ENOMEM); 801 - else 802 - list_add_tail(&esw->qos.node0->entry, 803 - &esw->qos.domain->nodes); 804 - } 805 - if (IS_ERR(esw->qos.node0)) { 806 - err = PTR_ERR(esw->qos.node0); 807 - esw_warn(dev, "E-Switch create rate node 0 failed (%d)\n", err); 808 - goto err_node0; 809 - } 810 789 refcount_set(&esw->qos.refcnt, 1); 811 790 812 791 return 0; 813 - 814 - err_node0: 815 - if (mlx5_destroy_scheduling_element_cmd(esw->dev, SCHEDULING_HIERARCHY_E_SWITCH, 816 - esw->qos.root_tsar_ix)) 817 - esw_warn(esw->dev, "E-Switch destroy root TSAR failed.\n"); 818 - 819 - return err; 820 792 } 821 793 822 794 static void esw_qos_destroy(struct mlx5_eswitch *esw) 823 795 { 824 796 int err; 825 - 826 - if (esw->qos.node0->ix != esw->qos.root_tsar_ix) 827 - __esw_qos_destroy_node(esw->qos.node0, NULL); 828 - else 829 - __esw_qos_free_node(esw->qos.node0); 830 - esw->qos.node0 = NULL; 831 797 832 798 err = mlx5_destroy_scheduling_element_cmd(esw->dev, 833 799 SCHEDULING_HIERARCHY_E_SWITCH, ··· 958 990 struct netlink_ext_ack *extack) 959 991 { 960 992 struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; 961 - int err, new_level, max_level; 993 + struct mlx5_esw_sched_node *parent = vport_node->parent; 994 + int err; 962 995 963 996 if (type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) { 997 + int new_level, max_level; 998 + 964 999 /* Increase the parent's level by 2 to account for both the 965 1000 * TC arbiter and the vports TC scheduling element. 966 1001 */ 967 - new_level = vport_node->parent->level + 2; 1002 + new_level = (parent ? parent->level : 2) + 2; 968 1003 max_level = 1 << MLX5_CAP_QOS(vport_node->esw->dev, 969 1004 log_esw_max_sched_depth); 970 1005 if (new_level > max_level) { ··· 1004 1033 err_sched_nodes: 1005 1034 if (type == SCHED_NODE_TYPE_RATE_LIMITER) { 1006 1035 esw_qos_node_destroy_sched_element(vport_node, NULL); 1007 - list_add_tail(&vport_node->entry, 1008 - &vport_node->parent->children); 1009 - vport_node->level = vport_node->parent->level + 1; 1036 + esw_qos_node_attach_to_parent(vport_node); 1010 1037 } else { 1011 1038 esw_qos_tc_arbiter_scheduling_teardown(vport_node, NULL); 1012 1039 } ··· 1052 1083 static void esw_qos_vport_disable(struct mlx5_vport *vport, struct netlink_ext_ack *extack) 1053 1084 { 1054 1085 struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; 1055 - struct mlx5_esw_sched_node *parent = vport_node->parent; 1056 1086 enum sched_node_type curr_type = vport_node->type; 1057 1087 1058 1088 if (curr_type == SCHED_NODE_TYPE_VPORT) ··· 1060 1092 esw_qos_vport_tc_disable(vport, extack); 1061 1093 1062 1094 vport_node->bw_share = 0; 1095 + memset(vport_node->tc_bw, 0, sizeof(vport_node->tc_bw)); 1063 1096 list_del_init(&vport_node->entry); 1064 - esw_qos_normalize_min_rate(parent->esw, parent, extack); 1097 + esw_qos_normalize_min_rate(vport_node->esw, vport_node->parent, extack); 1065 1098 1066 1099 trace_mlx5_esw_vport_qos_destroy(vport_node->esw->dev, vport); 1067 1100 } ··· 1072 1103 struct mlx5_esw_sched_node *parent, 1073 1104 struct netlink_ext_ack *extack) 1074 1105 { 1106 + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; 1075 1107 int err; 1076 1108 1077 1109 esw_assert_qos_lock_held(vport->dev->priv.eswitch); 1078 1110 1079 - esw_qos_node_set_parent(vport->qos.sched_node, parent); 1080 - if (type == SCHED_NODE_TYPE_VPORT) { 1081 - err = esw_qos_vport_create_sched_element(vport->qos.sched_node, 1082 - extack); 1083 - } else { 1111 + esw_qos_node_set_parent(vport_node, parent); 1112 + if (type == SCHED_NODE_TYPE_VPORT) 1113 + err = esw_qos_vport_create_sched_element(vport_node, extack); 1114 + else 1084 1115 err = esw_qos_vport_tc_enable(vport, type, extack); 1085 - } 1086 1116 if (err) 1087 1117 return err; 1088 1118 1089 - vport->qos.sched_node->type = type; 1090 - esw_qos_normalize_min_rate(parent->esw, parent, extack); 1091 - trace_mlx5_esw_vport_qos_create(vport->dev, vport, 1092 - vport->qos.sched_node->max_rate, 1093 - vport->qos.sched_node->bw_share); 1119 + vport_node->type = type; 1120 + esw_qos_normalize_min_rate(vport_node->esw, parent, extack); 1121 + trace_mlx5_esw_vport_qos_create(vport->dev, vport, vport_node->max_rate, 1122 + vport_node->bw_share); 1094 1123 1095 1124 return 0; 1096 1125 } ··· 1099 1132 { 1100 1133 struct mlx5_eswitch *esw = vport->dev->priv.eswitch; 1101 1134 struct mlx5_esw_sched_node *sched_node; 1135 + struct mlx5_eswitch *parent_esw; 1102 1136 int err; 1103 1137 1104 1138 esw_assert_qos_lock_held(esw); ··· 1107 1139 if (err) 1108 1140 return err; 1109 1141 1110 - parent = parent ?: esw->qos.node0; 1111 - sched_node = __esw_qos_alloc_node(parent->esw, 0, type, parent); 1112 - if (!sched_node) 1142 + parent_esw = parent ? parent->esw : esw; 1143 + sched_node = __esw_qos_alloc_node(parent_esw, 0, type, parent); 1144 + if (!sched_node) { 1145 + esw_qos_put(esw); 1113 1146 return -ENOMEM; 1147 + } 1148 + if (!parent) 1149 + list_add_tail(&sched_node->entry, &esw->qos.domain->nodes); 1114 1150 1115 1151 sched_node->max_rate = max_rate; 1116 1152 sched_node->min_rate = min_rate; ··· 1122 1150 vport->qos.sched_node = sched_node; 1123 1151 err = esw_qos_vport_enable(vport, type, parent, extack); 1124 1152 if (err) { 1153 + __esw_qos_free_node(sched_node); 1125 1154 esw_qos_put(esw); 1126 1155 vport->qos.sched_node = NULL; 1127 1156 } 1128 1157 1129 1158 return err; 1159 + } 1160 + 1161 + static void mlx5_esw_qos_vport_disable_locked(struct mlx5_vport *vport) 1162 + { 1163 + struct mlx5_eswitch *esw = vport->dev->priv.eswitch; 1164 + 1165 + esw_assert_qos_lock_held(esw); 1166 + if (!vport->qos.sched_node) 1167 + return; 1168 + 1169 + esw_qos_vport_disable(vport, NULL); 1170 + mlx5_esw_qos_vport_qos_free(vport); 1171 + esw_qos_put(esw); 1130 1172 } 1131 1173 1132 1174 void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport) ··· 1154 1168 goto unlock; 1155 1169 1156 1170 parent = vport->qos.sched_node->parent; 1157 - WARN(parent != esw->qos.node0, "Disabling QoS on port before detaching it from node"); 1171 + WARN(parent, "Disabling QoS on port before detaching it from node"); 1158 1172 1159 - esw_qos_vport_disable(vport, NULL); 1160 - mlx5_esw_qos_vport_qos_free(vport); 1161 - esw_qos_put(esw); 1173 + mlx5_esw_qos_vport_disable_locked(vport); 1162 1174 unlock: 1163 1175 esw_qos_unlock(esw); 1164 1176 } ··· 1246 1262 struct mlx5_esw_sched_node *parent, 1247 1263 struct netlink_ext_ack *extack) 1248 1264 { 1249 - struct mlx5_esw_sched_node *curr_parent = vport->qos.sched_node->parent; 1250 - enum sched_node_type curr_type = vport->qos.sched_node->type; 1265 + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; 1266 + struct mlx5_esw_sched_node *curr_parent = vport_node->parent; 1267 + enum sched_node_type curr_type = vport_node->type; 1251 1268 u32 curr_tc_bw[DEVLINK_RATE_TCS_MAX] = {0}; 1252 1269 int err; 1253 1270 1254 1271 esw_assert_qos_lock_held(vport->dev->priv.eswitch); 1255 - parent = parent ?: curr_parent; 1256 1272 if (curr_type == type && curr_parent == parent) 1257 1273 return 0; 1258 1274 ··· 1260 1276 if (err) 1261 1277 return err; 1262 1278 1263 - if (curr_type == SCHED_NODE_TYPE_TC_ARBITER_TSAR && curr_type == type) { 1264 - esw_qos_tc_arbiter_get_bw_shares(vport->qos.sched_node, 1265 - curr_tc_bw); 1266 - } 1279 + if (curr_type == SCHED_NODE_TYPE_TC_ARBITER_TSAR && curr_type == type) 1280 + esw_qos_tc_arbiter_get_bw_shares(vport_node, curr_tc_bw); 1267 1281 1268 1282 esw_qos_vport_disable(vport, extack); 1269 1283 ··· 1272 1290 } 1273 1291 1274 1292 if (curr_type == SCHED_NODE_TYPE_TC_ARBITER_TSAR && curr_type == type) { 1275 - esw_qos_set_tc_arbiter_bw_shares(vport->qos.sched_node, 1276 - curr_tc_bw, extack); 1293 + esw_qos_set_tc_arbiter_bw_shares(vport_node, curr_tc_bw, 1294 + extack); 1277 1295 } 1278 1296 1279 1297 return err; ··· 1288 1306 1289 1307 esw_assert_qos_lock_held(esw); 1290 1308 curr_parent = vport->qos.sched_node->parent; 1291 - parent = parent ?: esw->qos.node0; 1292 1309 if (curr_parent == parent) 1293 1310 return 0; 1294 1311 1295 1312 /* Set vport QoS type based on parent node type if different from 1296 1313 * default QoS; otherwise, use the vport's current QoS type. 1297 1314 */ 1298 - if (parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) 1315 + if (parent && parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) 1299 1316 type = SCHED_NODE_TYPE_RATE_LIMITER; 1300 - else if (curr_parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) 1317 + else if (curr_parent && 1318 + curr_parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) 1301 1319 type = SCHED_NODE_TYPE_VPORT; 1302 1320 else 1303 1321 type = vport->qos.sched_node->type; ··· 1636 1654 static bool esw_qos_vport_validate_unsupported_tc_bw(struct mlx5_vport *vport, 1637 1655 u32 *tc_bw) 1638 1656 { 1639 - struct mlx5_eswitch *esw = vport->qos.sched_node ? 1640 - vport->qos.sched_node->parent->esw : 1641 - vport->dev->priv.eswitch; 1657 + struct mlx5_esw_sched_node *node = vport->qos.sched_node; 1658 + struct mlx5_eswitch *esw = vport->dev->priv.eswitch; 1659 + 1660 + esw = (node && node->parent) ? node->parent->esw : esw; 1642 1661 1643 1662 return esw_qos_validate_unsupported_tc_bw(esw, tc_bw); 1644 1663 } ··· 1654 1671 } 1655 1672 1656 1673 return true; 1674 + } 1675 + 1676 + static void esw_vport_qos_prune_empty(struct mlx5_vport *vport) 1677 + { 1678 + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; 1679 + 1680 + esw_assert_qos_lock_held(vport->dev->priv.eswitch); 1681 + if (!vport_node) 1682 + return; 1683 + 1684 + if (vport_node->parent || vport_node->max_rate || 1685 + vport_node->min_rate || !esw_qos_tc_bw_disabled(vport_node->tc_bw)) 1686 + return; 1687 + 1688 + mlx5_esw_qos_vport_disable_locked(vport); 1657 1689 } 1658 1690 1659 1691 int mlx5_esw_qos_init(struct mlx5_eswitch *esw) ··· 1704 1706 1705 1707 esw_qos_lock(esw); 1706 1708 err = mlx5_esw_qos_set_vport_min_rate(vport, tx_share, extack); 1709 + if (err) 1710 + goto out; 1711 + esw_vport_qos_prune_empty(vport); 1712 + out: 1707 1713 esw_qos_unlock(esw); 1708 1714 return err; 1709 1715 } ··· 1729 1727 1730 1728 esw_qos_lock(esw); 1731 1729 err = mlx5_esw_qos_set_vport_max_rate(vport, tx_max, extack); 1730 + if (err) 1731 + goto out; 1732 + esw_vport_qos_prune_empty(vport); 1733 + out: 1732 1734 esw_qos_unlock(esw); 1733 1735 return err; 1734 1736 } ··· 1769 1763 if (disable) { 1770 1764 if (vport_node->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) 1771 1765 err = esw_qos_vport_update(vport, SCHED_NODE_TYPE_VPORT, 1772 - NULL, extack); 1766 + vport_node->parent, extack); 1767 + esw_vport_qos_prune_empty(vport); 1773 1768 goto unlock; 1774 1769 } 1775 1770 ··· 1782 1775 } else { 1783 1776 err = esw_qos_vport_update(vport, 1784 1777 SCHED_NODE_TYPE_TC_ARBITER_TSAR, 1785 - NULL, extack); 1778 + vport_node->parent, extack); 1786 1779 } 1787 1780 if (!err) 1788 1781 esw_qos_set_tc_arbiter_bw_shares(vport_node, tc_bw, extack); ··· 1931 1924 void *priv, void *parent_priv, 1932 1925 struct netlink_ext_ack *extack) 1933 1926 { 1934 - struct mlx5_esw_sched_node *node; 1927 + struct mlx5_esw_sched_node *node = parent ? parent_priv : NULL; 1935 1928 struct mlx5_vport *vport = priv; 1929 + int err; 1936 1930 1937 - if (!parent) 1938 - return mlx5_esw_qos_vport_update_parent(vport, NULL, extack); 1931 + err = mlx5_esw_qos_vport_update_parent(vport, node, extack); 1932 + if (!err) { 1933 + struct mlx5_eswitch *esw = vport->dev->priv.eswitch; 1939 1934 1940 - node = parent_priv; 1941 - return mlx5_esw_qos_vport_update_parent(vport, node, extack); 1935 + esw_qos_lock(esw); 1936 + esw_vport_qos_prune_empty(vport); 1937 + esw_qos_unlock(esw); 1938 + } 1939 + 1940 + return err; 1942 1941 } 1943 1942 1944 1943 static bool esw_qos_is_node_empty(struct mlx5_esw_sched_node *node)
-5
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 373 373 refcount_t refcnt; 374 374 u32 root_tsar_ix; 375 375 struct mlx5_qos_domain *domain; 376 - /* Contains all vports with QoS enabled but no explicit node. 377 - * Cannot be NULL if QoS is enabled, but may be a fake node 378 - * referencing the root TSAR if the esw doesn't support nodes. 379 - */ 380 - struct mlx5_esw_sched_node *node0; 381 376 } qos; 382 377 383 378 struct mlx5_esw_bridge_offloads *br_offloads;
+2
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
··· 367 367 int mlx5_set_port_dcbx_param(struct mlx5_core_dev *mdev, u32 *in); 368 368 int mlx5_set_trust_state(struct mlx5_core_dev *mdev, u8 trust_state); 369 369 int mlx5_query_trust_state(struct mlx5_core_dev *mdev, u8 *trust_state); 370 + int mlx5_query_port_buffer_ownership(struct mlx5_core_dev *mdev, 371 + u8 *buffer_ownership); 370 372 int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, u8 dscp, u8 prio); 371 373 int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio); 372 374
+20
drivers/net/ethernet/mellanox/mlx5/core/port.c
··· 968 968 return err; 969 969 } 970 970 971 + int mlx5_query_port_buffer_ownership(struct mlx5_core_dev *mdev, 972 + u8 *buffer_ownership) 973 + { 974 + u32 out[MLX5_ST_SZ_DW(pfcc_reg)] = {}; 975 + int err; 976 + 977 + if (!MLX5_CAP_PCAM_FEATURE(mdev, buffer_ownership)) { 978 + *buffer_ownership = MLX5_BUF_OWNERSHIP_UNKNOWN; 979 + return 0; 980 + } 981 + 982 + err = mlx5_query_pfcc_reg(mdev, out, sizeof(out)); 983 + if (err) 984 + return err; 985 + 986 + *buffer_ownership = MLX5_GET(pfcc_reg, out, buf_ownership); 987 + 988 + return 0; 989 + } 990 + 971 991 int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, u8 dscp, u8 prio) 972 992 { 973 993 int sz = MLX5_ST_SZ_BYTES(qpdpm_reg);
+62 -19
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
··· 74 74 static int 75 75 hws_bwc_matcher_move_all_simple(struct mlx5hws_bwc_matcher *bwc_matcher) 76 76 { 77 - bool move_error = false, poll_error = false, drain_error = false; 78 77 struct mlx5hws_context *ctx = bwc_matcher->matcher->tbl->ctx; 79 78 struct mlx5hws_matcher *matcher = bwc_matcher->matcher; 79 + int drain_error = 0, move_error = 0, poll_error = 0; 80 80 u16 bwc_queues = mlx5hws_bwc_queues(ctx); 81 81 struct mlx5hws_rule_attr rule_attr; 82 82 struct mlx5hws_bwc_rule *bwc_rule; ··· 84 84 struct list_head *rules_list; 85 85 u32 pending_rules; 86 86 int i, ret = 0; 87 + bool drain; 87 88 88 89 mlx5hws_bwc_rule_fill_attr(bwc_matcher, 0, 0, &rule_attr); 89 90 ··· 100 99 ret = mlx5hws_matcher_resize_rule_move(matcher, 101 100 bwc_rule->rule, 102 101 &rule_attr); 103 - if (unlikely(ret && !move_error)) { 104 - mlx5hws_err(ctx, 105 - "Moving BWC rule: move failed (%d), attempting to move rest of the rules\n", 106 - ret); 107 - move_error = true; 102 + if (unlikely(ret)) { 103 + if (!move_error) { 104 + mlx5hws_err(ctx, 105 + "Moving BWC rule: move failed (%d), attempting to move rest of the rules\n", 106 + ret); 107 + move_error = ret; 108 + } 109 + /* Rule wasn't queued, no need to poll */ 110 + continue; 108 111 } 109 112 110 113 pending_rules++; 114 + drain = pending_rules >= 115 + hws_bwc_get_burst_th(ctx, rule_attr.queue_id); 111 116 ret = mlx5hws_bwc_queue_poll(ctx, 112 117 rule_attr.queue_id, 113 118 &pending_rules, 114 - false); 115 - if (unlikely(ret && !poll_error)) { 116 - mlx5hws_err(ctx, 117 - "Moving BWC rule: poll failed (%d), attempting to move rest of the rules\n", 118 - ret); 119 - poll_error = true; 119 + drain); 120 + if (unlikely(ret)) { 121 + if (ret == -ETIMEDOUT) { 122 + mlx5hws_err(ctx, 123 + "Moving BWC rule: timeout polling for completions (%d), aborting rehash\n", 124 + ret); 125 + return ret; 126 + } 127 + if (!poll_error) { 128 + mlx5hws_err(ctx, 129 + "Moving BWC rule: polling for completions failed (%d), attempting to move rest of the rules\n", 130 + ret); 131 + poll_error = ret; 132 + } 120 133 } 121 134 } 122 135 ··· 141 126 rule_attr.queue_id, 142 127 &pending_rules, 143 128 true); 144 - if (unlikely(ret && !drain_error)) { 145 - mlx5hws_err(ctx, 146 - "Moving BWC rule: drain failed (%d), attempting to move rest of the rules\n", 147 - ret); 148 - drain_error = true; 129 + if (unlikely(ret)) { 130 + if (ret == -ETIMEDOUT) { 131 + mlx5hws_err(ctx, 132 + "Moving bwc rule: timeout draining completions (%d), aborting rehash\n", 133 + ret); 134 + return ret; 135 + } 136 + if (!drain_error) { 137 + mlx5hws_err(ctx, 138 + "Moving bwc rule: drain failed (%d), attempting to move rest of the rules\n", 139 + ret); 140 + drain_error = ret; 141 + } 149 142 } 150 143 } 151 144 } 152 145 153 - if (move_error || poll_error || drain_error) 154 - ret = -EINVAL; 146 + /* Return the first error that happened */ 147 + if (unlikely(move_error)) 148 + return move_error; 149 + if (unlikely(poll_error)) 150 + return poll_error; 151 + if (unlikely(drain_error)) 152 + return drain_error; 155 153 156 154 return ret; 157 155 } ··· 1061 1033 hws_bwc_rule_list_add(bwc_rule, bwc_queue_idx); 1062 1034 mutex_unlock(queue_lock); 1063 1035 return 0; /* rule inserted successfully */ 1036 + } 1037 + 1038 + /* Rule insertion could fail due to queue being full, timeout, or 1039 + * matcher in resize. In such cases, no point in trying to rehash. 1040 + */ 1041 + if (ret == -EBUSY || ret == -ETIMEDOUT || ret == -EAGAIN) { 1042 + mutex_unlock(queue_lock); 1043 + mlx5hws_err(ctx, 1044 + "BWC rule insertion failed - %s (%d)\n", 1045 + ret == -EBUSY ? "queue is full" : 1046 + ret == -ETIMEDOUT ? "timeout" : 1047 + ret == -EAGAIN ? "matcher in resize" : "N/A", 1048 + ret); 1049 + hws_bwc_rule_cnt_dec(bwc_rule); 1050 + return ret; 1064 1051 } 1065 1052 1066 1053 /* At this point the rule wasn't added.
+28 -13
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc_complex.c
··· 1328 1328 { 1329 1329 struct mlx5hws_context *ctx = bwc_matcher->matcher->tbl->ctx; 1330 1330 struct mlx5hws_matcher *matcher = bwc_matcher->matcher; 1331 - bool move_error = false, poll_error = false; 1332 1331 u16 bwc_queues = mlx5hws_bwc_queues(ctx); 1333 1332 struct mlx5hws_bwc_rule *tmp_bwc_rule; 1334 1333 struct mlx5hws_rule_attr rule_attr; 1335 1334 struct mlx5hws_table *isolated_tbl; 1335 + int move_error = 0, poll_error = 0; 1336 1336 struct mlx5hws_rule *tmp_rule; 1337 1337 struct list_head *rules_list; 1338 1338 u32 expected_completions = 1; ··· 1391 1391 ret = mlx5hws_matcher_resize_rule_move(matcher, 1392 1392 tmp_rule, 1393 1393 &rule_attr); 1394 - if (unlikely(ret && !move_error)) { 1395 - mlx5hws_err(ctx, 1396 - "Moving complex BWC rule failed (%d), attempting to move rest of the rules\n", 1397 - ret); 1398 - move_error = true; 1394 + if (unlikely(ret)) { 1395 + if (!move_error) { 1396 + mlx5hws_err(ctx, 1397 + "Moving complex BWC rule: move failed (%d), attempting to move rest of the rules\n", 1398 + ret); 1399 + move_error = ret; 1400 + } 1401 + /* Rule wasn't queued, no need to poll */ 1402 + continue; 1399 1403 } 1400 1404 1401 1405 expected_completions = 1; ··· 1407 1403 rule_attr.queue_id, 1408 1404 &expected_completions, 1409 1405 true); 1410 - if (unlikely(ret && !poll_error)) { 1411 - mlx5hws_err(ctx, 1412 - "Moving complex BWC rule: poll failed (%d), attempting to move rest of the rules\n", 1413 - ret); 1414 - poll_error = true; 1406 + if (unlikely(ret)) { 1407 + if (ret == -ETIMEDOUT) { 1408 + mlx5hws_err(ctx, 1409 + "Moving complex BWC rule: timeout polling for completions (%d), aborting rehash\n", 1410 + ret); 1411 + return ret; 1412 + } 1413 + if (!poll_error) { 1414 + mlx5hws_err(ctx, 1415 + "Moving complex BWC rule: polling for completions failed (%d), attempting to move rest of the rules\n", 1416 + ret); 1417 + poll_error = ret; 1418 + } 1415 1419 } 1416 1420 1417 1421 /* Done moving the rule to the new matcher, ··· 1434 1422 } 1435 1423 } 1436 1424 1437 - if (move_error || poll_error) 1438 - ret = -EINVAL; 1425 + /* Return the first error that happened */ 1426 + if (unlikely(move_error)) 1427 + return move_error; 1428 + if (unlikely(poll_error)) 1429 + return poll_error; 1439 1430 1440 1431 return ret; 1441 1432 }
+1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.c
··· 55 55 56 56 MLX5_SET(create_flow_table_in, in, opcode, MLX5_CMD_OP_CREATE_FLOW_TABLE); 57 57 MLX5_SET(create_flow_table_in, in, table_type, ft_attr->type); 58 + MLX5_SET(create_flow_table_in, in, uid, ft_attr->uid); 58 59 59 60 ft_ctx = MLX5_ADDR_OF(create_flow_table_in, in, flow_table_context); 60 61 MLX5_SET(flow_table_context, ft_ctx, level, ft_attr->level);
+1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.h
··· 36 36 struct mlx5hws_cmd_ft_create_attr { 37 37 u8 type; 38 38 u8 level; 39 + u16 uid; 39 40 bool rtc_valid; 40 41 bool decap_en; 41 42 bool reformat_en;
+1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
··· 267 267 268 268 tbl_attr.type = MLX5HWS_TABLE_TYPE_FDB; 269 269 tbl_attr.level = ft_attr->level; 270 + tbl_attr.uid = ft_attr->uid; 270 271 tbl = mlx5hws_table_create(ctx, &tbl_attr); 271 272 if (!tbl) { 272 273 mlx5_core_err(ns->dev, "Failed creating hws flow_table\n");
+4 -1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c
··· 85 85 86 86 ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, 87 87 tbl, 88 + 0, 88 89 &matcher->end_ft_id); 89 90 if (ret) { 90 91 mlx5hws_err(tbl->ctx, "Isolated matcher: failed to create end flow table\n"); ··· 113 112 if (mlx5hws_matcher_is_isolated(matcher)) 114 113 ret = hws_matcher_create_end_ft_isolated(matcher); 115 114 else 116 - ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, tbl, 115 + ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, 116 + tbl, 117 + 0, 117 118 &matcher->end_ft_id); 118 119 119 120 if (ret) {
+1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h
··· 75 75 struct mlx5hws_table_attr { 76 76 enum mlx5hws_table_type type; 77 77 u32 level; 78 + u16 uid; 78 79 }; 79 80 80 81 enum mlx5hws_matcher_flow_src {
-1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/send.c
··· 964 964 return -ENOMEM; 965 965 966 966 MLX5_SET(cqc, cqc_data, uar_page, mdev->priv.uar->index); 967 - MLX5_SET(cqc, cqc_data, cqe_sz, queue->num_entries); 968 967 MLX5_SET(cqc, cqc_data, log_cq_size, ilog2(queue->num_entries)); 969 968 970 969 err = hws_send_ring_alloc_cq(mdev, numa_node, queue, cqc_data, cq);
+10 -3
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c
··· 9 9 } 10 10 11 11 static void hws_table_init_next_ft_attr(struct mlx5hws_table *tbl, 12 + u16 uid, 12 13 struct mlx5hws_cmd_ft_create_attr *ft_attr) 13 14 { 14 15 ft_attr->type = tbl->fw_ft_type; ··· 17 16 ft_attr->level = tbl->ctx->caps->fdb_ft.max_level - 1; 18 17 else 19 18 ft_attr->level = tbl->ctx->caps->nic_ft.max_level - 1; 19 + 20 20 ft_attr->rtc_valid = true; 21 + ft_attr->uid = uid; 21 22 } 22 23 23 24 static void hws_table_set_cap_attr(struct mlx5hws_table *tbl, ··· 122 119 123 120 int mlx5hws_table_create_default_ft(struct mlx5_core_dev *mdev, 124 121 struct mlx5hws_table *tbl, 125 - u32 *ft_id) 122 + u16 uid, u32 *ft_id) 126 123 { 127 124 struct mlx5hws_cmd_ft_create_attr ft_attr = {0}; 128 125 int ret; 129 126 130 - hws_table_init_next_ft_attr(tbl, &ft_attr); 127 + hws_table_init_next_ft_attr(tbl, uid, &ft_attr); 131 128 hws_table_set_cap_attr(tbl, &ft_attr); 132 129 133 130 ret = mlx5hws_cmd_flow_table_create(mdev, &ft_attr, ft_id); ··· 192 189 } 193 190 194 191 mutex_lock(&ctx->ctrl_lock); 195 - ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, tbl, &tbl->ft_id); 192 + ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, 193 + tbl, 194 + tbl->uid, 195 + &tbl->ft_id); 196 196 if (ret) { 197 197 mlx5hws_err(tbl->ctx, "Failed to create flow table object\n"); 198 198 mutex_unlock(&ctx->ctrl_lock); ··· 245 239 tbl->ctx = ctx; 246 240 tbl->type = attr->type; 247 241 tbl->level = attr->level; 242 + tbl->uid = attr->uid; 248 243 249 244 ret = hws_table_init(tbl); 250 245 if (ret) {
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.h
··· 18 18 enum mlx5hws_table_type type; 19 19 u32 fw_ft_type; 20 20 u32 level; 21 + u16 uid; 21 22 struct list_head matchers_list; 22 23 struct list_head tbl_list_node; 23 24 struct mlx5hws_default_miss default_miss; ··· 48 47 49 48 int mlx5hws_table_create_default_ft(struct mlx5_core_dev *mdev, 50 49 struct mlx5hws_table *tbl, 51 - u32 *ft_id); 50 + u16 uid, u32 *ft_id); 52 51 53 52 void mlx5hws_table_destroy_default_ft(struct mlx5hws_table *tbl, 54 53 u32 ft_id);
+2
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 2375 2375 ROUTER_EXP, false), 2376 2376 MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_DIP_LINK_LOCAL, FORWARD, 2377 2377 ROUTER_EXP, false), 2378 + MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_SIP_LINK_LOCAL, FORWARD, 2379 + ROUTER_EXP, false), 2378 2380 /* Multicast Router Traps */ 2379 2381 MLXSW_SP_RXL_MARK(ACL1, TRAP_TO_CPU, MULTICAST, false), 2380 2382 MLXSW_SP_RXL_L3_MARK(ACL2, TRAP_TO_CPU, MULTICAST, false),
+1
drivers/net/ethernet/mellanox/mlxsw/trap.h
··· 94 94 MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_SIP_BC = 0x16A, 95 95 MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_DIP_LOCAL_NET = 0x16B, 96 96 MLXSW_TRAP_ID_DISCARD_ING_ROUTER_DIP_LINK_LOCAL = 0x16C, 97 + MLXSW_TRAP_ID_DISCARD_ING_ROUTER_SIP_LINK_LOCAL = 0x16D, 97 98 MLXSW_TRAP_ID_DISCARD_ROUTER_IRIF_EN = 0x178, 98 99 MLXSW_TRAP_ID_DISCARD_ROUTER_ERIF_EN = 0x179, 99 100 MLXSW_TRAP_ID_DISCARD_ROUTER_LPM4 = 0x17B,
+21
drivers/net/ethernet/microchip/lan865x/lan865x.c
··· 32 32 /* MAC Specific Addr 1 Top Reg */ 33 33 #define LAN865X_REG_MAC_H_SADDR1 0x00010023 34 34 35 + /* MAC TSU Timer Increment Register */ 36 + #define LAN865X_REG_MAC_TSU_TIMER_INCR 0x00010077 37 + #define MAC_TSU_TIMER_INCR_COUNT_NANOSECONDS 0x0028 38 + 35 39 struct lan865x_priv { 36 40 struct work_struct multicast_work; 37 41 struct net_device *netdev; ··· 315 311 316 312 phy_start(netdev->phydev); 317 313 314 + netif_start_queue(netdev); 315 + 318 316 return 0; 319 317 } 320 318 ··· 348 342 if (!priv->tc6) { 349 343 ret = -ENODEV; 350 344 goto free_netdev; 345 + } 346 + 347 + /* LAN865x Rev.B0/B1 configuration parameters from AN1760 348 + * As per the Configuration Application Note AN1760 published in the 349 + * link, https://www.microchip.com/en-us/application-notes/an1760 350 + * Revision F (DS60001760G - June 2024), configure the MAC to set time 351 + * stamping at the end of the Start of Frame Delimiter (SFD) and set the 352 + * Timer Increment reg to 40 ns to be used as a 25 MHz internal clock. 353 + */ 354 + ret = oa_tc6_write_register(priv->tc6, LAN865X_REG_MAC_TSU_TIMER_INCR, 355 + MAC_TSU_TIMER_INCR_COUNT_NANOSECONDS); 356 + if (ret) { 357 + dev_err(&spi->dev, "Failed to config TSU Timer Incr reg: %d\n", 358 + ret); 359 + goto oa_tc6_exit; 351 360 } 352 361 353 362 /* As per the point s3 in the below errata, SPI receive Ethernet frame
+1 -1
drivers/net/ethernet/realtek/rtase/rtase.h
··· 241 241 #define RTASE_RX_RES BIT(20) 242 242 #define RTASE_RX_RUNT BIT(19) 243 243 #define RTASE_RX_RWT BIT(18) 244 - #define RTASE_RX_CRC BIT(16) 244 + #define RTASE_RX_CRC BIT(17) 245 245 #define RTASE_RX_V6F BIT(31) 246 246 #define RTASE_RX_V4F BIT(30) 247 247 #define RTASE_RX_UDPT BIT(29)
+8 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
··· 152 152 static int thead_dwmac_enable_clk(struct plat_stmmacenet_data *plat) 153 153 { 154 154 struct thead_dwmac *dwmac = plat->bsp_priv; 155 - u32 reg; 155 + u32 reg, div; 156 156 157 157 switch (plat->mac_interface) { 158 158 case PHY_INTERFACE_MODE_MII: ··· 164 164 case PHY_INTERFACE_MODE_RGMII_RXID: 165 165 case PHY_INTERFACE_MODE_RGMII_TXID: 166 166 /* use pll */ 167 + div = clk_get_rate(plat->stmmac_clk) / rgmii_clock(SPEED_1000); 168 + reg = FIELD_PREP(GMAC_PLLCLK_DIV_EN, 1) | 169 + FIELD_PREP(GMAC_PLLCLK_DIV_NUM, div); 170 + 171 + writel(0, dwmac->apb_base + GMAC_PLLCLK_DIV); 172 + writel(reg, dwmac->apb_base + GMAC_PLLCLK_DIV); 173 + 167 174 writel(GMAC_GTXCLK_SEL_PLL, dwmac->apb_base + GMAC_GTXCLK_SEL); 168 175 reg = GMAC_TX_CLK_EN | GMAC_TX_CLK_N_EN | GMAC_TX_CLK_OUT_EN | 169 176 GMAC_RX_CLK_EN | GMAC_RX_CLK_N_EN;
+41 -31
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 203 203 } 204 204 } 205 205 206 + static void icssg_enable_fw_offload(struct prueth *prueth) 207 + { 208 + struct prueth_emac *emac; 209 + int mac; 210 + 211 + for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { 212 + emac = prueth->emac[mac]; 213 + if (prueth->is_hsr_offload_mode) { 214 + if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) 215 + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); 216 + else 217 + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); 218 + } 219 + 220 + if (prueth->is_switch_mode || prueth->is_hsr_offload_mode) { 221 + if (netif_running(emac->ndev)) { 222 + icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, 223 + ICSSG_FDB_ENTRY_P0_MEMBERSHIP | 224 + ICSSG_FDB_ENTRY_P1_MEMBERSHIP | 225 + ICSSG_FDB_ENTRY_P2_MEMBERSHIP | 226 + ICSSG_FDB_ENTRY_BLOCK, 227 + true); 228 + icssg_vtbl_modify(emac, emac->port_vlan | DEFAULT_VID, 229 + BIT(emac->port_id) | DEFAULT_PORT_MASK, 230 + BIT(emac->port_id) | DEFAULT_UNTAG_MASK, 231 + true); 232 + if (prueth->is_hsr_offload_mode) 233 + icssg_vtbl_modify(emac, DEFAULT_VID, 234 + DEFAULT_PORT_MASK, 235 + DEFAULT_UNTAG_MASK, true); 236 + icssg_set_pvid(prueth, emac->port_vlan, emac->port_id); 237 + if (prueth->is_switch_mode) 238 + icssg_set_port_state(emac, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE); 239 + } 240 + } 241 + } 242 + } 243 + 206 244 static int prueth_emac_common_start(struct prueth *prueth) 207 245 { 208 246 struct prueth_emac *emac; ··· 791 753 ret = prueth_emac_common_start(prueth); 792 754 if (ret) 793 755 goto free_rx_irq; 756 + icssg_enable_fw_offload(prueth); 794 757 } 795 758 796 759 flow_cfg = emac->dram.va + ICSSG_CONFIG_OFFSET + PSI_L_REGULAR_FLOW_ID_BASE_OFFSET; ··· 1399 1360 1400 1361 static void icssg_change_mode(struct prueth *prueth) 1401 1362 { 1402 - struct prueth_emac *emac; 1403 - int mac, ret; 1363 + int ret; 1404 1364 1405 1365 ret = prueth_emac_restart(prueth); 1406 1366 if (ret) { ··· 1407 1369 return; 1408 1370 } 1409 1371 1410 - for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { 1411 - emac = prueth->emac[mac]; 1412 - if (prueth->is_hsr_offload_mode) { 1413 - if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) 1414 - icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); 1415 - else 1416 - icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); 1417 - } 1418 - 1419 - if (netif_running(emac->ndev)) { 1420 - icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, 1421 - ICSSG_FDB_ENTRY_P0_MEMBERSHIP | 1422 - ICSSG_FDB_ENTRY_P1_MEMBERSHIP | 1423 - ICSSG_FDB_ENTRY_P2_MEMBERSHIP | 1424 - ICSSG_FDB_ENTRY_BLOCK, 1425 - true); 1426 - icssg_vtbl_modify(emac, emac->port_vlan | DEFAULT_VID, 1427 - BIT(emac->port_id) | DEFAULT_PORT_MASK, 1428 - BIT(emac->port_id) | DEFAULT_UNTAG_MASK, 1429 - true); 1430 - if (prueth->is_hsr_offload_mode) 1431 - icssg_vtbl_modify(emac, DEFAULT_VID, 1432 - DEFAULT_PORT_MASK, 1433 - DEFAULT_UNTAG_MASK, true); 1434 - icssg_set_pvid(prueth, emac->port_vlan, emac->port_id); 1435 - if (prueth->is_switch_mode) 1436 - icssg_set_port_state(emac, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE); 1437 - } 1438 - } 1372 + icssg_enable_fw_offload(prueth); 1439 1373 } 1440 1374 1441 1375 static int prueth_netdevice_port_link(struct net_device *ndev,
+1 -1
drivers/net/ethernet/wangxun/libwx/wx_vf_lib.c
··· 192 192 u8 i, j; 193 193 194 194 /* Fill out hash function seeds */ 195 - netdev_rss_key_fill(wx->rss_key, sizeof(wx->rss_key)); 195 + netdev_rss_key_fill(wx->rss_key, WX_RSS_KEY_SIZE); 196 196 for (i = 0; i < WX_RSS_KEY_SIZE / 4; i++) 197 197 wr32(wx, WX_VXRSSRK(i), wx->rss_key[i]); 198 198
+6 -2
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
··· 1160 1160 struct axienet_local *lp = data; 1161 1161 struct sk_buff *skb; 1162 1162 u32 *app_metadata; 1163 + int i; 1163 1164 1164 1165 skbuf_dma = axienet_get_rx_desc(lp, lp->rx_ring_tail++); 1165 1166 skb = skbuf_dma->skb; ··· 1179 1178 u64_stats_add(&lp->rx_packets, 1); 1180 1179 u64_stats_add(&lp->rx_bytes, rx_len); 1181 1180 u64_stats_update_end(&lp->rx_stat_sync); 1182 - axienet_rx_submit_desc(lp->ndev); 1181 + 1182 + for (i = 0; i < CIRC_SPACE(lp->rx_ring_head, lp->rx_ring_tail, 1183 + RX_BUF_NUM_DEFAULT); i++) 1184 + axienet_rx_submit_desc(lp->ndev); 1183 1185 dma_async_issue_pending(lp->rx_chan); 1184 1186 } 1185 1187 ··· 1461 1457 if (!skbuf_dma) 1462 1458 return; 1463 1459 1464 - lp->rx_ring_head++; 1465 1460 skb = netdev_alloc_skb(ndev, lp->max_frm_size); 1466 1461 if (!skb) 1467 1462 return; ··· 1485 1482 skbuf_dma->desc = dma_rx_desc; 1486 1483 dma_rx_desc->callback_param = lp; 1487 1484 dma_rx_desc->callback_result = axienet_dma_rx_cb; 1485 + lp->rx_ring_head++; 1488 1486 dmaengine_submit(dma_rx_desc); 1489 1487 1490 1488 return;
+12
drivers/net/phy/mscc/mscc.h
··· 362 362 u16 mask; 363 363 }; 364 364 365 + struct vsc8531_skb_cb { 366 + u32 ns; 367 + }; 368 + 369 + #define VSC8531_SKB_CB(skb) \ 370 + ((struct vsc8531_skb_cb *)((skb)->cb)) 371 + 365 372 struct vsc8531_private { 366 373 int rate_magic; 367 374 u16 supp_led_modes; ··· 417 410 */ 418 411 struct mutex ts_lock; 419 412 struct mutex phc_lock; 413 + 414 + /* list of skbs that were received and need timestamp information but it 415 + * didn't received it yet 416 + */ 417 + struct sk_buff_head rx_skbs_list; 420 418 }; 421 419 422 420 /* Shared structure between the PHYs of the same package.
+12
drivers/net/phy/mscc/mscc_main.c
··· 2335 2335 return vsc85xx_dt_led_modes_get(phydev, default_mode); 2336 2336 } 2337 2337 2338 + static void vsc85xx_remove(struct phy_device *phydev) 2339 + { 2340 + struct vsc8531_private *priv = phydev->priv; 2341 + 2342 + skb_queue_purge(&priv->rx_skbs_list); 2343 + } 2344 + 2338 2345 /* Microsemi VSC85xx PHYs */ 2339 2346 static struct phy_driver vsc85xx_driver[] = { 2340 2347 { ··· 2596 2589 .config_intr = &vsc85xx_config_intr, 2597 2590 .suspend = &genphy_suspend, 2598 2591 .resume = &genphy_resume, 2592 + .remove = &vsc85xx_remove, 2599 2593 .probe = &vsc8574_probe, 2600 2594 .set_wol = &vsc85xx_wol_set, 2601 2595 .get_wol = &vsc85xx_wol_get, ··· 2622 2614 .config_intr = &vsc85xx_config_intr, 2623 2615 .suspend = &genphy_suspend, 2624 2616 .resume = &genphy_resume, 2617 + .remove = &vsc85xx_remove, 2625 2618 .probe = &vsc8574_probe, 2626 2619 .set_wol = &vsc85xx_wol_set, 2627 2620 .get_wol = &vsc85xx_wol_get, ··· 2648 2639 .config_intr = &vsc85xx_config_intr, 2649 2640 .suspend = &genphy_suspend, 2650 2641 .resume = &genphy_resume, 2642 + .remove = &vsc85xx_remove, 2651 2643 .probe = &vsc8584_probe, 2652 2644 .get_tunable = &vsc85xx_get_tunable, 2653 2645 .set_tunable = &vsc85xx_set_tunable, ··· 2672 2662 .config_intr = &vsc85xx_config_intr, 2673 2663 .suspend = &genphy_suspend, 2674 2664 .resume = &genphy_resume, 2665 + .remove = &vsc85xx_remove, 2675 2666 .probe = &vsc8584_probe, 2676 2667 .get_tunable = &vsc85xx_get_tunable, 2677 2668 .set_tunable = &vsc85xx_set_tunable, ··· 2696 2685 .config_intr = &vsc85xx_config_intr, 2697 2686 .suspend = &genphy_suspend, 2698 2687 .resume = &genphy_resume, 2688 + .remove = &vsc85xx_remove, 2699 2689 .probe = &vsc8584_probe, 2700 2690 .get_tunable = &vsc85xx_get_tunable, 2701 2691 .set_tunable = &vsc85xx_set_tunable,
+37 -12
drivers/net/phy/mscc/mscc_ptp.c
··· 1194 1194 { 1195 1195 struct vsc8531_private *vsc8531 = 1196 1196 container_of(mii_ts, struct vsc8531_private, mii_ts); 1197 - struct skb_shared_hwtstamps *shhwtstamps = NULL; 1198 1197 struct vsc85xx_ptphdr *ptphdr; 1199 - struct timespec64 ts; 1200 1198 unsigned long ns; 1201 1199 1202 1200 if (!vsc8531->ptp->configured) ··· 1204 1206 type == PTP_CLASS_NONE) 1205 1207 return false; 1206 1208 1207 - vsc85xx_gettime(&vsc8531->ptp->caps, &ts); 1208 - 1209 1209 ptphdr = get_ptp_header_rx(skb, vsc8531->ptp->rx_filter); 1210 1210 if (!ptphdr) 1211 1211 return false; 1212 1212 1213 - shhwtstamps = skb_hwtstamps(skb); 1214 - memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps)); 1215 - 1216 1213 ns = ntohl(ptphdr->rsrvd2); 1217 1214 1218 - /* nsec is in reserved field */ 1219 - if (ts.tv_nsec < ns) 1220 - ts.tv_sec--; 1215 + VSC8531_SKB_CB(skb)->ns = ns; 1216 + skb_queue_tail(&vsc8531->rx_skbs_list, skb); 1221 1217 1222 - shhwtstamps->hwtstamp = ktime_set(ts.tv_sec, ns); 1223 - netif_rx(skb); 1218 + ptp_schedule_worker(vsc8531->ptp->ptp_clock, 0); 1224 1219 1225 1220 return true; 1221 + } 1222 + 1223 + static long vsc85xx_do_aux_work(struct ptp_clock_info *info) 1224 + { 1225 + struct vsc85xx_ptp *ptp = container_of(info, struct vsc85xx_ptp, caps); 1226 + struct skb_shared_hwtstamps *shhwtstamps = NULL; 1227 + struct phy_device *phydev = ptp->phydev; 1228 + struct vsc8531_private *priv = phydev->priv; 1229 + struct sk_buff_head received; 1230 + struct sk_buff *rx_skb; 1231 + struct timespec64 ts; 1232 + unsigned long flags; 1233 + 1234 + __skb_queue_head_init(&received); 1235 + spin_lock_irqsave(&priv->rx_skbs_list.lock, flags); 1236 + skb_queue_splice_tail_init(&priv->rx_skbs_list, &received); 1237 + spin_unlock_irqrestore(&priv->rx_skbs_list.lock, flags); 1238 + 1239 + vsc85xx_gettime(info, &ts); 1240 + while ((rx_skb = __skb_dequeue(&received)) != NULL) { 1241 + shhwtstamps = skb_hwtstamps(rx_skb); 1242 + memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps)); 1243 + 1244 + if (ts.tv_nsec < VSC8531_SKB_CB(rx_skb)->ns) 1245 + ts.tv_sec--; 1246 + 1247 + shhwtstamps->hwtstamp = ktime_set(ts.tv_sec, 1248 + VSC8531_SKB_CB(rx_skb)->ns); 1249 + netif_rx(rx_skb); 1250 + } 1251 + 1252 + return -1; 1226 1253 } 1227 1254 1228 1255 static const struct ptp_clock_info vsc85xx_clk_caps = { ··· 1263 1240 .adjfine = &vsc85xx_adjfine, 1264 1241 .gettime64 = &vsc85xx_gettime, 1265 1242 .settime64 = &vsc85xx_settime, 1243 + .do_aux_work = &vsc85xx_do_aux_work, 1266 1244 }; 1267 1245 1268 1246 static struct vsc8531_private *vsc8584_base_priv(struct phy_device *phydev) ··· 1591 1567 1592 1568 mutex_init(&vsc8531->phc_lock); 1593 1569 mutex_init(&vsc8531->ts_lock); 1570 + skb_queue_head_init(&vsc8531->rx_skbs_list); 1594 1571 1595 1572 /* Retrieve the shared load/save GPIO. Request it as non exclusive as 1596 1573 * the same GPIO can be requested by all the PHYs of the same package.
+11 -6
drivers/net/ppp/ppp_generic.c
··· 33 33 #include <linux/ppp_channel.h> 34 34 #include <linux/ppp-comp.h> 35 35 #include <linux/skbuff.h> 36 + #include <linux/rculist.h> 36 37 #include <linux/rtnetlink.h> 37 38 #include <linux/if_arp.h> 38 39 #include <linux/ip.h> ··· 1599 1598 if (ppp->flags & SC_MULTILINK) 1600 1599 return -EOPNOTSUPP; 1601 1600 1602 - if (list_empty(&ppp->channels)) 1601 + pch = list_first_or_null_rcu(&ppp->channels, struct channel, clist); 1602 + if (!pch) 1603 1603 return -ENODEV; 1604 1604 1605 - pch = list_first_entry(&ppp->channels, struct channel, clist); 1606 - chan = pch->chan; 1605 + chan = READ_ONCE(pch->chan); 1606 + if (!chan) 1607 + return -ENODEV; 1608 + 1607 1609 if (!chan->ops->fill_forward_path) 1608 1610 return -EOPNOTSUPP; 1609 1611 ··· 2998 2994 */ 2999 2995 down_write(&pch->chan_sem); 3000 2996 spin_lock_bh(&pch->downl); 3001 - pch->chan = NULL; 2997 + WRITE_ONCE(pch->chan, NULL); 3002 2998 spin_unlock_bh(&pch->downl); 3003 2999 up_write(&pch->chan_sem); 3004 3000 ppp_disconnect_channel(pch); ··· 3519 3515 hdrlen = pch->file.hdrlen + 2; /* for protocol bytes */ 3520 3516 if (hdrlen > ppp->dev->hard_header_len) 3521 3517 ppp->dev->hard_header_len = hdrlen; 3522 - list_add_tail(&pch->clist, &ppp->channels); 3518 + list_add_tail_rcu(&pch->clist, &ppp->channels); 3523 3519 ++ppp->n_channels; 3524 3520 pch->ppp = ppp; 3525 3521 refcount_inc(&ppp->file.refcnt); ··· 3549 3545 if (ppp) { 3550 3546 /* remove it from the ppp unit's list */ 3551 3547 ppp_lock(ppp); 3552 - list_del(&pch->clist); 3548 + list_del_rcu(&pch->clist); 3553 3549 if (--ppp->n_channels == 0) 3554 3550 wake_up_interruptible(&ppp->file.rwait); 3555 3551 ppp_unlock(ppp); 3552 + synchronize_net(); 3556 3553 if (refcount_dec_and_test(&ppp->file.refcnt)) 3557 3554 ppp_destroy_interface(ppp); 3558 3555 err = 0;
+48 -15
drivers/net/pse-pd/pd692x0.c
··· 1041 1041 int pw_budget; 1042 1042 1043 1043 pw_budget = regulator_get_unclaimed_power_budget(supply); 1044 + if (!pw_budget) 1045 + /* Do nothing if no power budget */ 1046 + continue; 1047 + 1044 1048 /* Max power budget per manager */ 1045 1049 if (pw_budget > 6000000) 1046 1050 pw_budget = 6000000; ··· 1166 1162 return 0; 1167 1163 } 1168 1164 1165 + static void pd692x0_of_put_managers(struct pd692x0_priv *priv, 1166 + struct pd692x0_manager *manager, 1167 + int nmanagers) 1168 + { 1169 + int i, j; 1170 + 1171 + for (i = 0; i < nmanagers; i++) { 1172 + for (j = 0; j < manager[i].nports; j++) 1173 + of_node_put(manager[i].port_node[j]); 1174 + of_node_put(manager[i].node); 1175 + } 1176 + } 1177 + 1178 + static void pd692x0_managers_free_pw_budget(struct pd692x0_priv *priv) 1179 + { 1180 + int i; 1181 + 1182 + for (i = 0; i < PD692X0_MAX_MANAGERS; i++) { 1183 + struct regulator *supply; 1184 + 1185 + if (!priv->manager_reg[i] || !priv->manager_pw_budget[i]) 1186 + continue; 1187 + 1188 + supply = priv->manager_reg[i]->supply; 1189 + if (!supply) 1190 + continue; 1191 + 1192 + regulator_free_power_budget(supply, 1193 + priv->manager_pw_budget[i]); 1194 + } 1195 + } 1196 + 1169 1197 static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev) 1170 1198 { 1171 1199 struct pd692x0_manager *manager __free(kfree) = NULL; 1172 1200 struct pd692x0_priv *priv = to_pd692x0_priv(pcdev); 1173 1201 struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS]; 1174 - int ret, i, j, nmanagers; 1202 + int ret, nmanagers; 1175 1203 1176 1204 /* Should we flash the port matrix */ 1177 1205 if (priv->fw_state != PD692X0_FW_OK && ··· 1221 1185 nmanagers = ret; 1222 1186 ret = pd692x0_register_managers_regulator(priv, manager, nmanagers); 1223 1187 if (ret) 1224 - goto out; 1188 + goto err_of_managers; 1225 1189 1226 1190 ret = pd692x0_configure_managers(priv, nmanagers); 1227 1191 if (ret) 1228 - goto out; 1192 + goto err_of_managers; 1229 1193 1230 1194 ret = pd692x0_set_ports_matrix(priv, manager, nmanagers, port_matrix); 1231 1195 if (ret) 1232 - goto out; 1196 + goto err_managers_req_pw; 1233 1197 1234 1198 ret = pd692x0_write_ports_matrix(priv, port_matrix); 1235 1199 if (ret) 1236 - goto out; 1200 + goto err_managers_req_pw; 1237 1201 1238 - out: 1239 - for (i = 0; i < nmanagers; i++) { 1240 - struct regulator *supply = priv->manager_reg[i]->supply; 1202 + pd692x0_of_put_managers(priv, manager, nmanagers); 1203 + return 0; 1241 1204 1242 - regulator_free_power_budget(supply, 1243 - priv->manager_pw_budget[i]); 1244 - 1245 - for (j = 0; j < manager[i].nports; j++) 1246 - of_node_put(manager[i].port_node[j]); 1247 - of_node_put(manager[i].node); 1248 - } 1205 + err_managers_req_pw: 1206 + pd692x0_managers_free_pw_budget(priv); 1207 + err_of_managers: 1208 + pd692x0_of_put_managers(priv, manager, nmanagers); 1249 1209 return ret; 1250 1210 } 1251 1211 ··· 1780 1748 { 1781 1749 struct pd692x0_priv *priv = i2c_get_clientdata(client); 1782 1750 1751 + pd692x0_managers_free_pw_budget(priv); 1783 1752 firmware_upload_unregister(priv->fwl); 1784 1753 } 1785 1754
+1 -1
drivers/net/usb/asix_devices.c
··· 676 676 priv->mdio->read = &asix_mdio_bus_read; 677 677 priv->mdio->write = &asix_mdio_bus_write; 678 678 priv->mdio->name = "Asix MDIO Bus"; 679 - priv->mdio->phy_mask = ~(BIT(priv->phy_addr) | BIT(AX_EMBD_PHY_ADDR)); 679 + priv->mdio->phy_mask = ~(BIT(priv->phy_addr & 0x1f) | BIT(AX_EMBD_PHY_ADDR)); 680 680 /* mii bus name is usb-<usb bus number>-<usb device number> */ 681 681 snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", 682 682 dev->udev->bus->busnum, dev->udev->devnum);
+7
drivers/net/usb/cdc_ncm.c
··· 2087 2087 .driver_info = (unsigned long)&wwan_info, 2088 2088 }, 2089 2089 2090 + /* Intel modem (label from OEM reads Fibocom L850-GL) */ 2091 + { USB_DEVICE_AND_INTERFACE_INFO(0x8087, 0x095a, 2092 + USB_CLASS_COMM, 2093 + USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), 2094 + .driver_info = (unsigned long)&wwan_info, 2095 + }, 2096 + 2090 2097 /* DisplayLink docking stations */ 2091 2098 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 2092 2099 | USB_DEVICE_ID_MATCH_VENDOR,
+2 -2
include/net/bluetooth/bluetooth.h
··· 647 647 #if IS_ENABLED(CONFIG_BT_LE) 648 648 int iso_init(void); 649 649 int iso_exit(void); 650 - bool iso_enabled(void); 650 + bool iso_inited(void); 651 651 #else 652 652 static inline int iso_init(void) 653 653 { ··· 659 659 return 0; 660 660 } 661 661 662 - static inline bool iso_enabled(void) 662 + static inline bool iso_inited(void) 663 663 { 664 664 return false; 665 665 }
+38 -6
include/net/bluetooth/hci_core.h
··· 129 129 struct list_head list; 130 130 unsigned int acl_num; 131 131 unsigned int sco_num; 132 - unsigned int iso_num; 132 + unsigned int cis_num; 133 + unsigned int bis_num; 134 + unsigned int pa_num; 133 135 unsigned int le_num; 134 136 unsigned int le_num_peripheral; 135 137 }; ··· 1016 1014 h->sco_num++; 1017 1015 break; 1018 1016 case CIS_LINK: 1017 + h->cis_num++; 1018 + break; 1019 1019 case BIS_LINK: 1020 + h->bis_num++; 1021 + break; 1020 1022 case PA_LINK: 1021 - h->iso_num++; 1023 + h->pa_num++; 1022 1024 break; 1023 1025 } 1024 1026 } ··· 1048 1042 h->sco_num--; 1049 1043 break; 1050 1044 case CIS_LINK: 1045 + h->cis_num--; 1046 + break; 1051 1047 case BIS_LINK: 1048 + h->bis_num--; 1049 + break; 1052 1050 case PA_LINK: 1053 - h->iso_num--; 1051 + h->pa_num--; 1054 1052 break; 1055 1053 } 1056 1054 } ··· 1071 1061 case ESCO_LINK: 1072 1062 return h->sco_num; 1073 1063 case CIS_LINK: 1064 + return h->cis_num; 1074 1065 case BIS_LINK: 1066 + return h->bis_num; 1075 1067 case PA_LINK: 1076 - return h->iso_num; 1068 + return h->pa_num; 1077 1069 default: 1078 1070 return 0; 1079 1071 } ··· 1085 1073 { 1086 1074 struct hci_conn_hash *c = &hdev->conn_hash; 1087 1075 1088 - return c->acl_num + c->sco_num + c->le_num + c->iso_num; 1076 + return c->acl_num + c->sco_num + c->le_num + c->cis_num + c->bis_num + 1077 + c->pa_num; 1078 + } 1079 + 1080 + static inline unsigned int hci_iso_count(struct hci_dev *hdev) 1081 + { 1082 + struct hci_conn_hash *c = &hdev->conn_hash; 1083 + 1084 + return c->cis_num + c->bis_num; 1089 1085 } 1090 1086 1091 1087 static inline bool hci_conn_valid(struct hci_dev *hdev, struct hci_conn *conn) ··· 1935 1915 !hci_dev_test_flag(dev, HCI_RPA_EXPIRED)) 1936 1916 #define adv_rpa_valid(adv) (bacmp(&adv->random_addr, BDADDR_ANY) && \ 1937 1917 !adv->rpa_expired) 1918 + #define le_enabled(dev) (lmp_le_capable(dev) && \ 1919 + hci_dev_test_flag(dev, HCI_LE_ENABLED)) 1938 1920 1939 1921 #define scan_1m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_1M) || \ 1940 1922 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_1M)) ··· 1954 1932 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED)) 1955 1933 1956 1934 #define ll_privacy_capable(dev) ((dev)->le_features[0] & HCI_LE_LL_PRIVACY) 1935 + #define ll_privacy_enabled(dev) (le_enabled(dev) && ll_privacy_capable(dev)) 1957 1936 1958 1937 #define privacy_mode_capable(dev) (ll_privacy_capable(dev) && \ 1959 1938 ((dev)->commands[39] & 0x04)) ··· 2004 1981 2005 1982 /* CIS Master/Slave and BIS support */ 2006 1983 #define iso_capable(dev) (cis_capable(dev) || bis_capable(dev)) 1984 + #define iso_enabled(dev) (le_enabled(dev) && iso_capable(dev)) 2007 1985 #define cis_capable(dev) \ 2008 1986 (cis_central_capable(dev) || cis_peripheral_capable(dev)) 1987 + #define cis_enabled(dev) (le_enabled(dev) && cis_capable(dev)) 2009 1988 #define cis_central_capable(dev) \ 2010 1989 ((dev)->le_features[3] & HCI_LE_CIS_CENTRAL) 1990 + #define cis_central_enabled(dev) \ 1991 + (le_enabled(dev) && cis_central_capable(dev)) 2011 1992 #define cis_peripheral_capable(dev) \ 2012 1993 ((dev)->le_features[3] & HCI_LE_CIS_PERIPHERAL) 1994 + #define cis_peripheral_enabled(dev) \ 1995 + (le_enabled(dev) && cis_peripheral_capable(dev)) 2013 1996 #define bis_capable(dev) ((dev)->le_features[3] & HCI_LE_ISO_BROADCASTER) 2014 - #define sync_recv_capable(dev) ((dev)->le_features[3] & HCI_LE_ISO_SYNC_RECEIVER) 1997 + #define bis_enabled(dev) (le_enabled(dev) && bis_capable(dev)) 1998 + #define sync_recv_capable(dev) \ 1999 + ((dev)->le_features[3] & HCI_LE_ISO_SYNC_RECEIVER) 2000 + #define sync_recv_enabled(dev) (le_enabled(dev) && sync_recv_capable(dev)) 2015 2001 2016 2002 #define mws_transport_config_capable(dev) (((dev)->commands[30] & 0x08) && \ 2017 2003 (!hci_test_quirk((dev), HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG)))
+1
include/net/bond_3ad.h
··· 307 307 struct slave *slave); 308 308 int bond_3ad_set_carrier(struct bonding *bond); 309 309 void bond_3ad_update_lacp_rate(struct bonding *bond); 310 + void bond_3ad_update_lacp_active(struct bonding *bond); 310 311 void bond_3ad_update_ad_actor_settings(struct bonding *bond); 311 312 int bond_3ad_stats_fill(struct sk_buff *skb, struct bond_3ad_stats *stats); 312 313 size_t bond_3ad_stats_size(void);
+8 -3
include/net/sch_generic.h
··· 1038 1038 skb = __skb_dequeue(&sch->gso_skb); 1039 1039 if (skb) { 1040 1040 sch->q.qlen--; 1041 + qdisc_qstats_backlog_dec(sch, skb); 1041 1042 return skb; 1042 1043 } 1043 - if (direct) 1044 - return __qdisc_dequeue_head(&sch->q); 1045 - else 1044 + if (direct) { 1045 + skb = __qdisc_dequeue_head(&sch->q); 1046 + if (skb) 1047 + qdisc_qstats_backlog_dec(sch, skb); 1048 + return skb; 1049 + } else { 1046 1050 return sch->dequeue(sch); 1051 + } 1047 1052 } 1048 1053 1049 1054 static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
+14 -3
net/bluetooth/hci_conn.c
··· 339 339 case BT_CODEC_TRANSPARENT: 340 340 if (!find_next_esco_param(conn, esco_param_msbc, 341 341 ARRAY_SIZE(esco_param_msbc))) 342 - return false; 342 + return -EINVAL; 343 + 343 344 param = &esco_param_msbc[conn->attempt - 1]; 344 345 cp.tx_coding_format.id = 0x03; 345 346 cp.rx_coding_format.id = 0x03; ··· 831 830 /* Check if ISO connection is a BIS and terminate advertising 832 831 * set and BIG if there are no other connections using it. 833 832 */ 834 - bis = hci_conn_hash_lookup_big(hdev, conn->iso_qos.bcast.big); 833 + bis = hci_conn_hash_lookup_big_state(hdev, 834 + conn->iso_qos.bcast.big, 835 + BT_CONNECTED, 836 + HCI_ROLE_MASTER); 837 + if (bis) 838 + return; 839 + 840 + bis = hci_conn_hash_lookup_big_state(hdev, 841 + conn->iso_qos.bcast.big, 842 + BT_CONNECT, 843 + HCI_ROLE_MASTER); 835 844 if (bis) 836 845 return; 837 846 ··· 2260 2249 * the start periodic advertising and create BIG commands have 2261 2250 * been queued 2262 2251 */ 2263 - hci_conn_hash_list_state(hdev, bis_mark_per_adv, PA_LINK, 2252 + hci_conn_hash_list_state(hdev, bis_mark_per_adv, BIS_LINK, 2264 2253 BT_BOUND, &data); 2265 2254 2266 2255 /* Queue start periodic advertising and create BIG */
+10 -5
net/bluetooth/hci_event.c
··· 6745 6745 qos->ucast.out.latency = 6746 6746 DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), 6747 6747 1000); 6748 - qos->ucast.in.sdu = le16_to_cpu(ev->c_mtu); 6749 - qos->ucast.out.sdu = le16_to_cpu(ev->p_mtu); 6748 + qos->ucast.in.sdu = ev->c_bn ? le16_to_cpu(ev->c_mtu) : 0; 6749 + qos->ucast.out.sdu = ev->p_bn ? le16_to_cpu(ev->p_mtu) : 0; 6750 6750 qos->ucast.in.phy = ev->c_phy; 6751 6751 qos->ucast.out.phy = ev->p_phy; 6752 6752 break; ··· 6760 6760 qos->ucast.in.latency = 6761 6761 DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), 6762 6762 1000); 6763 - qos->ucast.out.sdu = le16_to_cpu(ev->c_mtu); 6764 - qos->ucast.in.sdu = le16_to_cpu(ev->p_mtu); 6763 + qos->ucast.out.sdu = ev->c_bn ? le16_to_cpu(ev->c_mtu) : 0; 6764 + qos->ucast.in.sdu = ev->p_bn ? le16_to_cpu(ev->p_mtu) : 0; 6765 6765 qos->ucast.out.phy = ev->c_phy; 6766 6766 qos->ucast.in.phy = ev->p_phy; 6767 6767 break; ··· 6957 6957 continue; 6958 6958 } 6959 6959 6960 - if (ev->status != 0x42) 6960 + if (ev->status != 0x42) { 6961 6961 /* Mark PA sync as established */ 6962 6962 set_bit(HCI_CONN_PA_SYNC, &bis->flags); 6963 + /* Reset cleanup callback of PA Sync so it doesn't 6964 + * terminate the sync when deleting the connection. 6965 + */ 6966 + conn->cleanup = NULL; 6967 + } 6963 6968 6964 6969 bis->sync_handle = conn->sync_handle; 6965 6970 bis->iso_qos.bcast.big = ev->handle;
+16 -9
net/bluetooth/hci_sync.c
··· 3344 3344 * advertising data. This also applies to the case 3345 3345 * where BR/EDR was toggled during the AUTO_OFF phase. 3346 3346 */ 3347 - if (hci_dev_test_flag(hdev, HCI_ADVERTISING) || 3347 + if (hci_dev_test_flag(hdev, HCI_ADVERTISING) && 3348 3348 list_empty(&hdev->adv_instances)) { 3349 3349 if (ext_adv_capable(hdev)) { 3350 3350 err = hci_setup_ext_adv_instance_sync(hdev, 0x00); ··· 4531 4531 { 4532 4532 struct hci_cp_le_set_host_feature cp; 4533 4533 4534 - if (!cis_capable(hdev)) 4534 + if (!iso_capable(hdev)) 4535 4535 return 0; 4536 4536 4537 4537 memset(&cp, 0, sizeof(cp)); 4538 4538 4539 4539 /* Connected Isochronous Channels (Host Support) */ 4540 4540 cp.bit_number = 32; 4541 - cp.bit_value = 1; 4541 + cp.bit_value = iso_enabled(hdev) ? 0x01 : 0x00; 4542 4542 4543 4543 return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_HOST_FEATURE, 4544 4544 sizeof(cp), &cp, HCI_CMD_TIMEOUT); ··· 6985 6985 6986 6986 hci_dev_lock(hdev); 6987 6987 6988 - hci_dev_clear_flag(hdev, HCI_PA_SYNC); 6989 - 6990 6988 if (!hci_conn_valid(hdev, conn)) 6991 6989 clear_bit(HCI_CONN_CREATE_PA_SYNC, &conn->flags); 6992 6990 ··· 7045 7047 /* SID has not been set listen for HCI_EV_LE_EXT_ADV_REPORT to update 7046 7048 * it. 7047 7049 */ 7048 - if (conn->sid == HCI_SID_INVALID) 7049 - __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL, 7050 - HCI_EV_LE_EXT_ADV_REPORT, 7051 - conn->conn_timeout, NULL); 7050 + if (conn->sid == HCI_SID_INVALID) { 7051 + err = __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL, 7052 + HCI_EV_LE_EXT_ADV_REPORT, 7053 + conn->conn_timeout, NULL); 7054 + if (err == -ETIMEDOUT) 7055 + goto done; 7056 + } 7052 7057 7053 7058 memset(&cp, 0, sizeof(cp)); 7054 7059 cp.options = qos->bcast.options; ··· 7080 7079 if (err == -ETIMEDOUT) 7081 7080 __hci_cmd_sync_status(hdev, HCI_OP_LE_PA_CREATE_SYNC_CANCEL, 7082 7081 0, NULL, HCI_CMD_TIMEOUT); 7082 + 7083 + done: 7084 + hci_dev_clear_flag(hdev, HCI_PA_SYNC); 7085 + 7086 + /* Update passive scan since HCI_PA_SYNC flag has been cleared */ 7087 + hci_update_passive_scan_sync(hdev); 7083 7088 7084 7089 return err; 7085 7090 }
+8 -8
net/bluetooth/iso.c
··· 1347 1347 bacpy(&sa->iso_bdaddr, &iso_pi(sk)->dst); 1348 1348 sa->iso_bdaddr_type = iso_pi(sk)->dst_type; 1349 1349 1350 - if (hcon && hcon->type == BIS_LINK) { 1350 + if (hcon && (hcon->type == BIS_LINK || hcon->type == PA_LINK)) { 1351 1351 sa->iso_bc->bc_sid = iso_pi(sk)->bc_sid; 1352 1352 sa->iso_bc->bc_num_bis = iso_pi(sk)->bc_num_bis; 1353 1353 memcpy(sa->iso_bc->bc_bis, iso_pi(sk)->bc_bis, ··· 2483 2483 .create = iso_sock_create, 2484 2484 }; 2485 2485 2486 - static bool iso_inited; 2486 + static bool inited; 2487 2487 2488 - bool iso_enabled(void) 2488 + bool iso_inited(void) 2489 2489 { 2490 - return iso_inited; 2490 + return inited; 2491 2491 } 2492 2492 2493 2493 int iso_init(void) ··· 2496 2496 2497 2497 BUILD_BUG_ON(sizeof(struct sockaddr_iso) > sizeof(struct sockaddr)); 2498 2498 2499 - if (iso_inited) 2499 + if (inited) 2500 2500 return -EALREADY; 2501 2501 2502 2502 err = proto_register(&iso_proto, 0); ··· 2524 2524 iso_debugfs = debugfs_create_file("iso", 0444, bt_debugfs, 2525 2525 NULL, &iso_debugfs_fops); 2526 2526 2527 - iso_inited = true; 2527 + inited = true; 2528 2528 2529 2529 return 0; 2530 2530 ··· 2535 2535 2536 2536 int iso_exit(void) 2537 2537 { 2538 - if (!iso_inited) 2538 + if (!inited) 2539 2539 return -EALREADY; 2540 2540 2541 2541 bt_procfs_cleanup(&init_net, "iso"); ··· 2549 2549 2550 2550 proto_unregister(&iso_proto); 2551 2551 2552 - iso_inited = false; 2552 + inited = false; 2553 2553 2554 2554 return 0; 2555 2555 }
+6 -6
net/bluetooth/mgmt.c
··· 922 922 if (hci_dev_test_flag(hdev, HCI_WIDEBAND_SPEECH_ENABLED)) 923 923 settings |= MGMT_SETTING_WIDEBAND_SPEECH; 924 924 925 - if (cis_central_capable(hdev)) 925 + if (cis_central_enabled(hdev)) 926 926 settings |= MGMT_SETTING_CIS_CENTRAL; 927 927 928 - if (cis_peripheral_capable(hdev)) 928 + if (cis_peripheral_enabled(hdev)) 929 929 settings |= MGMT_SETTING_CIS_PERIPHERAL; 930 930 931 - if (bis_capable(hdev)) 931 + if (bis_enabled(hdev)) 932 932 settings |= MGMT_SETTING_ISO_BROADCASTER; 933 933 934 - if (sync_recv_capable(hdev)) 934 + if (sync_recv_enabled(hdev)) 935 935 settings |= MGMT_SETTING_ISO_SYNC_RECEIVER; 936 936 937 - if (ll_privacy_capable(hdev)) 937 + if (ll_privacy_enabled(hdev)) 938 938 settings |= MGMT_SETTING_LL_PRIVACY; 939 939 940 940 return settings; ··· 4513 4513 } 4514 4514 4515 4515 if (IS_ENABLED(CONFIG_BT_LE)) { 4516 - flags = iso_enabled() ? BIT(0) : 0; 4516 + flags = iso_inited() ? BIT(0) : 0; 4517 4517 memcpy(rp->features[idx].uuid, iso_socket_uuid, 16); 4518 4518 rp->features[idx].flags = cpu_to_le32(flags); 4519 4519 idx++;
+16
net/bridge/br_multicast.c
··· 4818 4818 intvl_jiffies = BR_MULTICAST_QUERY_INTVL_MIN; 4819 4819 } 4820 4820 4821 + if (intvl_jiffies > BR_MULTICAST_QUERY_INTVL_MAX) { 4822 + br_info(brmctx->br, 4823 + "trying to set multicast query interval above maximum, setting to %lu (%ums)\n", 4824 + jiffies_to_clock_t(BR_MULTICAST_QUERY_INTVL_MAX), 4825 + jiffies_to_msecs(BR_MULTICAST_QUERY_INTVL_MAX)); 4826 + intvl_jiffies = BR_MULTICAST_QUERY_INTVL_MAX; 4827 + } 4828 + 4821 4829 brmctx->multicast_query_interval = intvl_jiffies; 4822 4830 } 4823 4831 ··· 4840 4832 jiffies_to_clock_t(BR_MULTICAST_STARTUP_QUERY_INTVL_MIN), 4841 4833 jiffies_to_msecs(BR_MULTICAST_STARTUP_QUERY_INTVL_MIN)); 4842 4834 intvl_jiffies = BR_MULTICAST_STARTUP_QUERY_INTVL_MIN; 4835 + } 4836 + 4837 + if (intvl_jiffies > BR_MULTICAST_STARTUP_QUERY_INTVL_MAX) { 4838 + br_info(brmctx->br, 4839 + "trying to set multicast startup query interval above maximum, setting to %lu (%ums)\n", 4840 + jiffies_to_clock_t(BR_MULTICAST_STARTUP_QUERY_INTVL_MAX), 4841 + jiffies_to_msecs(BR_MULTICAST_STARTUP_QUERY_INTVL_MAX)); 4842 + intvl_jiffies = BR_MULTICAST_STARTUP_QUERY_INTVL_MAX; 4843 4843 } 4844 4844 4845 4845 brmctx->multicast_startup_query_interval = intvl_jiffies;
+2
net/bridge/br_private.h
··· 31 31 #define BR_MULTICAST_DEFAULT_HASH_MAX 4096 32 32 #define BR_MULTICAST_QUERY_INTVL_MIN msecs_to_jiffies(1000) 33 33 #define BR_MULTICAST_STARTUP_QUERY_INTVL_MIN BR_MULTICAST_QUERY_INTVL_MIN 34 + #define BR_MULTICAST_QUERY_INTVL_MAX msecs_to_jiffies(86400000) /* 24 hours */ 35 + #define BR_MULTICAST_STARTUP_QUERY_INTVL_MAX BR_MULTICAST_QUERY_INTVL_MAX 34 36 35 37 #define BR_HWDOM_MAX BITS_PER_LONG 36 38
+12
net/core/dev.c
··· 3779 3779 features &= ~NETIF_F_TSO_MANGLEID; 3780 3780 } 3781 3781 3782 + /* NETIF_F_IPV6_CSUM does not support IPv6 extension headers, 3783 + * so neither does TSO that depends on it. 3784 + */ 3785 + if (features & NETIF_F_IPV6_CSUM && 3786 + (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6 || 3787 + (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && 3788 + vlan_get_protocol(skb) == htons(ETH_P_IPV6))) && 3789 + skb_transport_header_was_set(skb) && 3790 + skb_network_header_len(skb) != sizeof(struct ipv6hdr) && 3791 + !ipv6_has_hopopt_jumbo(skb)) 3792 + features &= ~(NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_GSO_UDP_L4); 3793 + 3782 3794 return features; 3783 3795 } 3784 3796
+7 -1
net/hsr/hsr_slave.c
··· 63 63 skb_push(skb, ETH_HLEN); 64 64 skb_reset_mac_header(skb); 65 65 if ((!hsr->prot_version && protocol == htons(ETH_P_PRP)) || 66 - protocol == htons(ETH_P_HSR)) 66 + protocol == htons(ETH_P_HSR)) { 67 + if (!pskb_may_pull(skb, ETH_HLEN + HSR_HLEN)) { 68 + kfree_skb(skb); 69 + goto finish_consume; 70 + } 71 + 67 72 skb_set_network_header(skb, ETH_HLEN + HSR_HLEN); 73 + } 68 74 skb_reset_mac_len(skb); 69 75 70 76 /* Only the frames received over the interlink port will assign a
+2 -4
net/ipv4/netfilter/nf_reject_ipv4.c
··· 247 247 if (!oth) 248 248 return; 249 249 250 - if ((hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) && 251 - nf_reject_fill_skb_dst(oldskb) < 0) 250 + if (!skb_dst(oldskb) && nf_reject_fill_skb_dst(oldskb) < 0) 252 251 return; 253 252 254 253 if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) ··· 320 321 if (iph->frag_off & htons(IP_OFFSET)) 321 322 return; 322 323 323 - if ((hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) && 324 - nf_reject_fill_skb_dst(skb_in) < 0) 324 + if (!skb_dst(skb_in) && nf_reject_fill_skb_dst(skb_in) < 0) 325 325 return; 326 326 327 327 if (skb_csum_unnecessary(skb_in) ||
+2 -3
net/ipv6/netfilter/nf_reject_ipv6.c
··· 293 293 fl6.fl6_sport = otcph->dest; 294 294 fl6.fl6_dport = otcph->source; 295 295 296 - if (hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) { 296 + if (!skb_dst(oldskb)) { 297 297 nf_ip6_route(net, &dst, flowi6_to_flowi(&fl6), false); 298 298 if (!dst) 299 299 return; ··· 397 397 if (hooknum == NF_INET_LOCAL_OUT && skb_in->dev == NULL) 398 398 skb_in->dev = net->loopback_dev; 399 399 400 - if ((hooknum == NF_INET_PRE_ROUTING || hooknum == NF_INET_INGRESS) && 401 - nf_reject6_fill_skb_dst(skb_in) < 0) 400 + if (!skb_dst(skb_in) && nf_reject6_fill_skb_dst(skb_in) < 0) 402 401 return; 403 402 404 403 icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0);
+5 -1
net/ipv6/seg6_hmac.c
··· 35 35 #include <net/xfrm.h> 36 36 37 37 #include <crypto/hash.h> 38 + #include <crypto/utils.h> 38 39 #include <net/seg6.h> 39 40 #include <net/genetlink.h> 40 41 #include <net/seg6_hmac.h> ··· 281 280 if (seg6_hmac_compute(hinfo, srh, &ipv6_hdr(skb)->saddr, hmac_output)) 282 281 return false; 283 282 284 - if (memcmp(hmac_output, tlv->hmac, SEG6_HMAC_FIELD_LEN) != 0) 283 + if (crypto_memneq(hmac_output, tlv->hmac, SEG6_HMAC_FIELD_LEN)) 285 284 return false; 286 285 287 286 return true; ··· 304 303 { 305 304 struct seg6_pernet_data *sdata = seg6_pernet(net); 306 305 int err; 306 + 307 + if (!__hmac_get_algo(hinfo->alg_id)) 308 + return -EINVAL; 307 309 308 310 err = rhashtable_lookup_insert_fast(&sdata->hmac_infos, &hinfo->node, 309 311 rht_params);
+4 -2
net/mptcp/options.c
··· 1118 1118 return hmac == mp_opt->ahmac; 1119 1119 } 1120 1120 1121 - /* Return false if a subflow has been reset, else return true */ 1121 + /* Return false in case of error (or subflow has been reset), 1122 + * else return true. 1123 + */ 1122 1124 bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) 1123 1125 { 1124 1126 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); ··· 1224 1222 1225 1223 mpext = skb_ext_add(skb, SKB_EXT_MPTCP); 1226 1224 if (!mpext) 1227 - return true; 1225 + return false; 1228 1226 1229 1227 memset(mpext, 0, sizeof(*mpext)); 1230 1228
+12 -6
net/mptcp/pm.c
··· 274 274 add_timer); 275 275 struct mptcp_sock *msk = entry->sock; 276 276 struct sock *sk = (struct sock *)msk; 277 + unsigned int timeout; 277 278 278 279 pr_debug("msk=%p\n", msk); 279 280 ··· 292 291 goto out; 293 292 } 294 293 294 + timeout = mptcp_get_add_addr_timeout(sock_net(sk)); 295 + if (!timeout) 296 + goto out; 297 + 295 298 spin_lock_bh(&msk->pm.lock); 296 299 297 300 if (!mptcp_pm_should_add_signal_addr(msk)) { ··· 307 302 308 303 if (entry->retrans_times < ADD_ADDR_RETRANS_MAX) 309 304 sk_reset_timer(sk, timer, 310 - jiffies + mptcp_get_add_addr_timeout(sock_net(sk))); 305 + jiffies + timeout); 311 306 312 307 spin_unlock_bh(&msk->pm.lock); 313 308 ··· 349 344 struct mptcp_pm_add_entry *add_entry = NULL; 350 345 struct sock *sk = (struct sock *)msk; 351 346 struct net *net = sock_net(sk); 347 + unsigned int timeout; 352 348 353 349 lockdep_assert_held(&msk->pm.lock); 354 350 ··· 359 353 if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk))) 360 354 return false; 361 355 362 - sk_reset_timer(sk, &add_entry->add_timer, 363 - jiffies + mptcp_get_add_addr_timeout(net)); 364 - return true; 356 + goto reset_timer; 365 357 } 366 358 367 359 add_entry = kmalloc(sizeof(*add_entry), GFP_ATOMIC); ··· 373 369 add_entry->retrans_times = 0; 374 370 375 371 timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0); 376 - sk_reset_timer(sk, &add_entry->add_timer, 377 - jiffies + mptcp_get_add_addr_timeout(net)); 372 + reset_timer: 373 + timeout = mptcp_get_add_addr_timeout(net); 374 + if (timeout) 375 + sk_reset_timer(sk, &add_entry->add_timer, jiffies + timeout); 378 376 379 377 return true; 380 378 }
-1
net/mptcp/pm_kernel.c
··· 1085 1085 static void __reset_counters(struct pm_nl_pernet *pernet) 1086 1086 { 1087 1087 WRITE_ONCE(pernet->add_addr_signal_max, 0); 1088 - WRITE_ONCE(pernet->add_addr_accept_max, 0); 1089 1088 WRITE_ONCE(pernet->local_addr_max, 0); 1090 1089 pernet->addrs = 0; 1091 1090 }
+12 -2
net/sched/sch_cake.c
··· 1750 1750 ktime_t now = ktime_get(); 1751 1751 struct cake_tin_data *b; 1752 1752 struct cake_flow *flow; 1753 - u32 idx; 1753 + u32 idx, tin; 1754 1754 1755 1755 /* choose flow to insert into */ 1756 1756 idx = cake_classify(sch, &b, skb, q->flow_mode, &ret); ··· 1760 1760 __qdisc_drop(skb, to_free); 1761 1761 return ret; 1762 1762 } 1763 + tin = (u32)(b - q->tins); 1763 1764 idx--; 1764 1765 flow = &b->flows[idx]; 1765 1766 ··· 1928 1927 q->buffer_max_used = q->buffer_used; 1929 1928 1930 1929 if (q->buffer_used > q->buffer_limit) { 1930 + bool same_flow = false; 1931 1931 u32 dropped = 0; 1932 + u32 drop_id; 1932 1933 1933 1934 while (q->buffer_used > q->buffer_limit) { 1934 1935 dropped++; 1935 - cake_drop(sch, to_free); 1936 + drop_id = cake_drop(sch, to_free); 1937 + 1938 + if ((drop_id >> 16) == tin && 1939 + (drop_id & 0xFFFF) == idx) 1940 + same_flow = true; 1936 1941 } 1937 1942 b->drop_overlimit += dropped; 1943 + 1944 + if (same_flow) 1945 + return NET_XMIT_CN; 1938 1946 } 1939 1947 return NET_XMIT_SUCCESS; 1940 1948 }
+7 -5
net/sched/sch_codel.c
··· 101 101 static int codel_change(struct Qdisc *sch, struct nlattr *opt, 102 102 struct netlink_ext_ack *extack) 103 103 { 104 + unsigned int dropped_pkts = 0, dropped_bytes = 0; 104 105 struct codel_sched_data *q = qdisc_priv(sch); 105 106 struct nlattr *tb[TCA_CODEL_MAX + 1]; 106 - unsigned int qlen, dropped = 0; 107 107 int err; 108 108 109 109 err = nla_parse_nested_deprecated(tb, TCA_CODEL_MAX, opt, ··· 142 142 WRITE_ONCE(q->params.ecn, 143 143 !!nla_get_u32(tb[TCA_CODEL_ECN])); 144 144 145 - qlen = sch->q.qlen; 146 145 while (sch->q.qlen > sch->limit) { 147 146 struct sk_buff *skb = qdisc_dequeue_internal(sch, true); 148 147 149 - dropped += qdisc_pkt_len(skb); 150 - qdisc_qstats_backlog_dec(sch, skb); 148 + if (!skb) 149 + break; 150 + 151 + dropped_pkts++; 152 + dropped_bytes += qdisc_pkt_len(skb); 151 153 rtnl_qdisc_drop(skb, sch); 152 154 } 153 - qdisc_tree_reduce_backlog(sch, qlen - sch->q.qlen, dropped); 155 + qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes); 154 156 155 157 sch_tree_unlock(sch); 156 158 return 0;
+3 -2
net/sched/sch_dualpi2.c
··· 927 927 928 928 q->sch = sch; 929 929 dualpi2_reset_default(sch); 930 - hrtimer_setup(&q->pi2_timer, dualpi2_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED); 930 + hrtimer_setup(&q->pi2_timer, dualpi2_timer, CLOCK_MONOTONIC, 931 + HRTIMER_MODE_ABS_PINNED_SOFT); 931 932 932 933 if (opt && nla_len(opt)) { 933 934 err = dualpi2_change(sch, opt, extack); ··· 938 937 } 939 938 940 939 hrtimer_start(&q->pi2_timer, next_pi2_timeout(q), 941 - HRTIMER_MODE_ABS_PINNED); 940 + HRTIMER_MODE_ABS_PINNED_SOFT); 942 941 return 0; 943 942 } 944 943
+7 -5
net/sched/sch_fq.c
··· 1013 1013 static int fq_change(struct Qdisc *sch, struct nlattr *opt, 1014 1014 struct netlink_ext_ack *extack) 1015 1015 { 1016 + unsigned int dropped_pkts = 0, dropped_bytes = 0; 1016 1017 struct fq_sched_data *q = qdisc_priv(sch); 1017 1018 struct nlattr *tb[TCA_FQ_MAX + 1]; 1018 - int err, drop_count = 0; 1019 - unsigned drop_len = 0; 1020 1019 u32 fq_log; 1020 + int err; 1021 1021 1022 1022 err = nla_parse_nested_deprecated(tb, TCA_FQ_MAX, opt, fq_policy, 1023 1023 NULL); ··· 1135 1135 err = fq_resize(sch, fq_log); 1136 1136 sch_tree_lock(sch); 1137 1137 } 1138 + 1138 1139 while (sch->q.qlen > sch->limit) { 1139 1140 struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 1140 1141 1141 1142 if (!skb) 1142 1143 break; 1143 - drop_len += qdisc_pkt_len(skb); 1144 + 1145 + dropped_pkts++; 1146 + dropped_bytes += qdisc_pkt_len(skb); 1144 1147 rtnl_kfree_skbs(skb, skb); 1145 - drop_count++; 1146 1148 } 1147 - qdisc_tree_reduce_backlog(sch, drop_count, drop_len); 1149 + qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes); 1148 1150 1149 1151 sch_tree_unlock(sch); 1150 1152 return err;
+7 -5
net/sched/sch_fq_codel.c
··· 366 366 static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, 367 367 struct netlink_ext_ack *extack) 368 368 { 369 + unsigned int dropped_pkts = 0, dropped_bytes = 0; 369 370 struct fq_codel_sched_data *q = qdisc_priv(sch); 370 371 struct nlattr *tb[TCA_FQ_CODEL_MAX + 1]; 371 372 u32 quantum = 0; ··· 444 443 q->memory_usage > q->memory_limit) { 445 444 struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 446 445 447 - q->cstats.drop_len += qdisc_pkt_len(skb); 446 + if (!skb) 447 + break; 448 + 449 + dropped_pkts++; 450 + dropped_bytes += qdisc_pkt_len(skb); 448 451 rtnl_kfree_skbs(skb, skb); 449 - q->cstats.drop_count++; 450 452 } 451 - qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, q->cstats.drop_len); 452 - q->cstats.drop_count = 0; 453 - q->cstats.drop_len = 0; 453 + qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes); 454 454 455 455 sch_tree_unlock(sch); 456 456 return 0;
+7 -5
net/sched/sch_fq_pie.c
··· 287 287 static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt, 288 288 struct netlink_ext_ack *extack) 289 289 { 290 + unsigned int dropped_pkts = 0, dropped_bytes = 0; 290 291 struct fq_pie_sched_data *q = qdisc_priv(sch); 291 292 struct nlattr *tb[TCA_FQ_PIE_MAX + 1]; 292 - unsigned int len_dropped = 0; 293 - unsigned int num_dropped = 0; 294 293 int err; 295 294 296 295 err = nla_parse_nested(tb, TCA_FQ_PIE_MAX, opt, fq_pie_policy, extack); ··· 367 368 while (sch->q.qlen > sch->limit) { 368 369 struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 369 370 370 - len_dropped += qdisc_pkt_len(skb); 371 - num_dropped += 1; 371 + if (!skb) 372 + break; 373 + 374 + dropped_pkts++; 375 + dropped_bytes += qdisc_pkt_len(skb); 372 376 rtnl_kfree_skbs(skb, skb); 373 377 } 374 - qdisc_tree_reduce_backlog(sch, num_dropped, len_dropped); 378 + qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes); 375 379 376 380 sch_tree_unlock(sch); 377 381 return 0;
+7 -5
net/sched/sch_hhf.c
··· 508 508 static int hhf_change(struct Qdisc *sch, struct nlattr *opt, 509 509 struct netlink_ext_ack *extack) 510 510 { 511 + unsigned int dropped_pkts = 0, dropped_bytes = 0; 511 512 struct hhf_sched_data *q = qdisc_priv(sch); 512 513 struct nlattr *tb[TCA_HHF_MAX + 1]; 513 - unsigned int qlen, prev_backlog; 514 514 int err; 515 515 u64 non_hh_quantum; 516 516 u32 new_quantum = q->quantum; ··· 561 561 usecs_to_jiffies(us)); 562 562 } 563 563 564 - qlen = sch->q.qlen; 565 - prev_backlog = sch->qstats.backlog; 566 564 while (sch->q.qlen > sch->limit) { 567 565 struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 568 566 567 + if (!skb) 568 + break; 569 + 570 + dropped_pkts++; 571 + dropped_bytes += qdisc_pkt_len(skb); 569 572 rtnl_kfree_skbs(skb, skb); 570 573 } 571 - qdisc_tree_reduce_backlog(sch, qlen - sch->q.qlen, 572 - prev_backlog - sch->qstats.backlog); 574 + qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes); 573 575 574 576 sch_tree_unlock(sch); 575 577 return 0;
+1 -1
net/sched/sch_htb.c
··· 592 592 */ 593 593 static inline void htb_activate(struct htb_sched *q, struct htb_class *cl) 594 594 { 595 - WARN_ON(cl->level || !cl->leaf.q || !cl->leaf.q->q.qlen); 595 + WARN_ON(cl->level || !cl->leaf.q); 596 596 597 597 if (!cl->prio_activity) { 598 598 cl->prio_activity = 1 << cl->prio;
+7 -5
net/sched/sch_pie.c
··· 141 141 static int pie_change(struct Qdisc *sch, struct nlattr *opt, 142 142 struct netlink_ext_ack *extack) 143 143 { 144 + unsigned int dropped_pkts = 0, dropped_bytes = 0; 144 145 struct pie_sched_data *q = qdisc_priv(sch); 145 146 struct nlattr *tb[TCA_PIE_MAX + 1]; 146 - unsigned int qlen, dropped = 0; 147 147 int err; 148 148 149 149 err = nla_parse_nested_deprecated(tb, TCA_PIE_MAX, opt, pie_policy, ··· 193 193 nla_get_u32(tb[TCA_PIE_DQ_RATE_ESTIMATOR])); 194 194 195 195 /* Drop excess packets if new limit is lower */ 196 - qlen = sch->q.qlen; 197 196 while (sch->q.qlen > sch->limit) { 198 197 struct sk_buff *skb = qdisc_dequeue_internal(sch, true); 199 198 200 - dropped += qdisc_pkt_len(skb); 201 - qdisc_qstats_backlog_dec(sch, skb); 199 + if (!skb) 200 + break; 201 + 202 + dropped_pkts++; 203 + dropped_bytes += qdisc_pkt_len(skb); 202 204 rtnl_qdisc_drop(skb, sch); 203 205 } 204 - qdisc_tree_reduce_backlog(sch, qlen - sch->q.qlen, dropped); 206 + qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes); 205 207 206 208 sch_tree_unlock(sch); 207 209 return 0;
+2 -1
net/smc/af_smc.c
··· 2568 2568 goto out_decl; 2569 2569 } 2570 2570 2571 - smc_listen_out_connected(new_smc); 2572 2571 SMC_STAT_SERV_SUCC_INC(sock_net(newclcsock->sk), ini); 2572 + /* smc_listen_out() will release smcsk */ 2573 + smc_listen_out_connected(new_smc); 2573 2574 goto out_free; 2574 2575 2575 2576 out_unlock:
+6 -1
net/tls/tls_sw.c
··· 1808 1808 return tls_decrypt_sg(sk, NULL, sgout, &darg); 1809 1809 } 1810 1810 1811 + /* All records returned from a recvmsg() call must have the same type. 1812 + * 0 is not a valid content type. Use it as "no type reported, yet". 1813 + */ 1811 1814 static int tls_record_content_type(struct msghdr *msg, struct tls_msg *tlm, 1812 1815 u8 *control) 1813 1816 { ··· 2054 2051 if (err < 0) 2055 2052 goto end; 2056 2053 2054 + /* process_rx_list() will set @control if it processed any records */ 2057 2055 copied = err; 2058 - if (len <= copied || (copied && control != TLS_RECORD_TYPE_DATA) || rx_more) 2056 + if (len <= copied || rx_more || 2057 + (control && control != TLS_RECORD_TYPE_DATA)) 2059 2058 goto end; 2060 2059 2061 2060 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
+2 -1
tools/testing/selftests/drivers/net/bonding/Makefile
··· 10 10 mode-2-recovery-updelay.sh \ 11 11 bond_options.sh \ 12 12 bond-eth-type-change.sh \ 13 - bond_macvlan_ipvlan.sh 13 + bond_macvlan_ipvlan.sh \ 14 + bond_passive_lacp.sh 14 15 15 16 TEST_FILES := \ 16 17 lag_lib.sh \
+105
tools/testing/selftests/drivers/net/bonding/bond_passive_lacp.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Test if a bond interface works with lacp_active=off. 5 + 6 + # shellcheck disable=SC2034 7 + REQUIRE_MZ=no 8 + NUM_NETIFS=0 9 + lib_dir=$(dirname "$0") 10 + # shellcheck disable=SC1091 11 + source "$lib_dir"/../../../net/forwarding/lib.sh 12 + 13 + # shellcheck disable=SC2317 14 + check_port_state() 15 + { 16 + local netns=$1 17 + local port=$2 18 + local state=$3 19 + 20 + ip -n "${netns}" -d -j link show "$port" | \ 21 + jq -e ".[].linkinfo.info_slave_data.ad_actor_oper_port_state_str | index(\"${state}\") != null" > /dev/null 22 + } 23 + 24 + check_pkt_count() 25 + { 26 + RET=0 27 + local ns="$1" 28 + local iface="$2" 29 + 30 + # wait 65s, one per 30s 31 + slowwait_for_counter 65 2 tc_rule_handle_stats_get \ 32 + "dev ${iface} egress" 101 ".packets" "-n ${ns}" &> /dev/null 33 + } 34 + 35 + setup() { 36 + setup_ns c_ns s_ns 37 + 38 + # shellcheck disable=SC2154 39 + ip -n "${c_ns}" link add eth0 type veth peer name eth0 netns "${s_ns}" 40 + ip -n "${c_ns}" link add eth1 type veth peer name eth1 netns "${s_ns}" 41 + 42 + # Add tc filter to count the pkts 43 + tc -n "${c_ns}" qdisc add dev eth0 clsact 44 + tc -n "${c_ns}" filter add dev eth0 egress handle 101 protocol 0x8809 matchall action pass 45 + tc -n "${s_ns}" qdisc add dev eth1 clsact 46 + tc -n "${s_ns}" filter add dev eth1 egress handle 101 protocol 0x8809 matchall action pass 47 + 48 + ip -n "${s_ns}" link add bond0 type bond mode 802.3ad lacp_active on lacp_rate fast 49 + ip -n "${s_ns}" link set eth0 master bond0 50 + ip -n "${s_ns}" link set eth1 master bond0 51 + 52 + ip -n "${c_ns}" link add bond0 type bond mode 802.3ad lacp_active off lacp_rate fast 53 + ip -n "${c_ns}" link set eth0 master bond0 54 + ip -n "${c_ns}" link set eth1 master bond0 55 + 56 + } 57 + 58 + trap cleanup_all_ns EXIT 59 + setup 60 + 61 + # The bond will send 2 lacpdu pkts during init time, let's wait at least 2s 62 + # after interface up 63 + ip -n "${c_ns}" link set bond0 up 64 + sleep 2 65 + 66 + # 1. The passive side shouldn't send LACPDU. 67 + check_pkt_count "${c_ns}" "eth0" && RET=1 68 + log_test "802.3ad lacp_active off" "init port" 69 + 70 + ip -n "${s_ns}" link set bond0 up 71 + # 2. The passive side should not have the 'active' flag. 72 + RET=0 73 + slowwait 2 check_port_state "${c_ns}" "eth0" "active" && RET=1 74 + log_test "802.3ad lacp_active off" "port state active" 75 + 76 + # 3. The active side should have the 'active' flag. 77 + RET=0 78 + slowwait 2 check_port_state "${s_ns}" "eth0" "active" || RET=1 79 + log_test "802.3ad lacp_active on" "port state active" 80 + 81 + # 4. Make sure the connection is not expired. 82 + RET=0 83 + slowwait 5 check_port_state "${s_ns}" "eth0" "distributing" 84 + slowwait 10 check_port_state "${s_ns}" "eth0" "expired" && RET=1 85 + log_test "bond 802.3ad lacp_active off" "port connection" 86 + 87 + # After testing, disconnect one port on each side to check the state. 88 + ip -n "${s_ns}" link set eth0 nomaster 89 + ip -n "${s_ns}" link set eth0 up 90 + ip -n "${c_ns}" link set eth1 nomaster 91 + ip -n "${c_ns}" link set eth1 up 92 + # Due to Periodic Machine and Rx Machine state change, the bond will still 93 + # send lacpdu pkts in a few seconds. sleep at lease 5s to make sure 94 + # negotiation finished 95 + sleep 5 96 + 97 + # 5. The active side should keep sending LACPDU. 98 + check_pkt_count "${s_ns}" "eth1" || RET=1 99 + log_test "bond 802.3ad lacp_active on" "port pkt after disconnect" 100 + 101 + # 6. The passive side shouldn't send LACPDU anymore. 102 + check_pkt_count "${c_ns}" "eth0" && RET=1 103 + log_test "bond 802.3ad lacp_active off" "port pkt after disconnect" 104 + 105 + exit "$EXIT_STATUS"
+1
tools/testing/selftests/drivers/net/bonding/config
··· 6 6 CONFIG_IPVLAN=y 7 7 CONFIG_NET_ACT_GACT=y 8 8 CONFIG_NET_CLS_FLOWER=y 9 + CONFIG_NET_CLS_MATCHALL=m 9 10 CONFIG_NET_SCH_INGRESS=y 10 11 CONFIG_NLMON=y 11 12 CONFIG_VETH=y
+29
tools/testing/selftests/net/forwarding/router.sh
··· 18 18 # | 2001:db8:1::1/64 2001:db8:2::1/64 | 19 19 # | | 20 20 # +-----------------------------------------------------------------+ 21 + # 22 + #shellcheck disable=SC2034 # SC doesn't see our uses of global variables 21 23 22 24 ALL_TESTS=" 23 25 ping_ipv4 ··· 29 27 ipv4_sip_equal_dip 30 28 ipv6_sip_equal_dip 31 29 ipv4_dip_link_local 30 + ipv4_sip_link_local 32 31 " 33 32 34 33 NUM_NETIFS=4 ··· 331 328 ip route del 169.254.1.0/24 dev $rp2 332 329 ip neigh del 169.254.1.1 lladdr 00:11:22:33:44:55 dev $rp2 333 330 tc filter del dev $rp2 egress protocol ip pref 1 handle 101 flower 331 + } 332 + 333 + ipv4_sip_link_local() 334 + { 335 + local sip=169.254.1.1 336 + 337 + RET=0 338 + 339 + # Disable rpfilter to prevent packets to be dropped because of it. 340 + sysctl_set net.ipv4.conf.all.rp_filter 0 341 + sysctl_set net.ipv4.conf."$rp1".rp_filter 0 342 + 343 + tc filter add dev "$rp2" egress protocol ip pref 1 handle 101 \ 344 + flower src_ip "$sip" action pass 345 + 346 + $MZ "$h1" -t udp "sp=54321,dp=12345" -c 5 -d 1msec -b "$rp1mac" \ 347 + -A "$sip" -B 198.51.100.2 -q 348 + 349 + tc_check_packets "dev $rp2 egress" 101 5 350 + check_err $? "Packets were dropped" 351 + 352 + log_test "IPv4 source IP is link-local" 353 + 354 + tc filter del dev "$rp2" egress protocol ip pref 1 handle 101 flower 355 + sysctl_restore net.ipv4.conf."$rp1".rp_filter 356 + sysctl_restore net.ipv4.conf.all.rp_filter 334 357 } 335 358 336 359 trap cleanup EXIT
+3 -2
tools/testing/selftests/net/mptcp/mptcp_connect.c
··· 183 183 struct addrinfo *hints, 184 184 struct addrinfo **res) 185 185 { 186 - again: 187 - int err = getaddrinfo(node, service, hints, res); 186 + int err; 188 187 188 + again: 189 + err = getaddrinfo(node, service, hints, res); 189 190 if (err) { 190 191 const char *errstr; 191 192
+3 -2
tools/testing/selftests/net/mptcp/mptcp_inq.c
··· 75 75 struct addrinfo *hints, 76 76 struct addrinfo **res) 77 77 { 78 - again: 79 - int err = getaddrinfo(node, service, hints, res); 78 + int err; 80 79 80 + again: 81 + err = getaddrinfo(node, service, hints, res); 81 82 if (err) { 82 83 const char *errstr; 83 84
+1
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 3842 3842 # remove and re-add 3843 3843 if reset_with_events "delete re-add signal" && 3844 3844 mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 3845 + ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=0 3845 3846 pm_nl_set_limits $ns1 0 3 3846 3847 pm_nl_set_limits $ns2 3 3 3847 3848 pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
+3 -2
tools/testing/selftests/net/mptcp/mptcp_sockopt.c
··· 162 162 struct addrinfo *hints, 163 163 struct addrinfo **res) 164 164 { 165 - again: 166 - int err = getaddrinfo(node, service, hints, res); 165 + int err; 167 166 167 + again: 168 + err = getaddrinfo(node, service, hints, res); 168 169 if (err) { 169 170 const char *errstr; 170 171
+1
tools/testing/selftests/net/mptcp/pm_netlink.sh
··· 198 198 check "get_limits" "${default_limits}" "subflows above hard limit" 199 199 200 200 set_limits 8 8 201 + flush_endpoint ## to make sure it doesn't affect the limits 201 202 check "get_limits" "$(format_limits 8 8)" "set limits" 202 203 203 204 flush_endpoint
+300 -12
tools/testing/selftests/net/tls.c
··· 181 181 return sendmsg(fd, &msg, flags); 182 182 } 183 183 184 - static int tls_recv_cmsg(struct __test_metadata *_metadata, 185 - int fd, unsigned char record_type, 186 - void *data, size_t len, int flags) 184 + static int __tls_recv_cmsg(struct __test_metadata *_metadata, 185 + int fd, unsigned char *ctype, 186 + void *data, size_t len, int flags) 187 187 { 188 188 char cbuf[CMSG_SPACE(sizeof(char))]; 189 189 struct cmsghdr *cmsg; 190 - unsigned char ctype; 191 190 struct msghdr msg; 192 191 struct iovec vec; 193 192 int n; ··· 205 206 EXPECT_NE(cmsg, NULL); 206 207 EXPECT_EQ(cmsg->cmsg_level, SOL_TLS); 207 208 EXPECT_EQ(cmsg->cmsg_type, TLS_GET_RECORD_TYPE); 208 - ctype = *((unsigned char *)CMSG_DATA(cmsg)); 209 + if (ctype) 210 + *ctype = *((unsigned char *)CMSG_DATA(cmsg)); 211 + 212 + return n; 213 + } 214 + 215 + static int tls_recv_cmsg(struct __test_metadata *_metadata, 216 + int fd, unsigned char record_type, 217 + void *data, size_t len, int flags) 218 + { 219 + unsigned char ctype; 220 + int n; 221 + 222 + n = __tls_recv_cmsg(_metadata, fd, &ctype, data, len, flags); 209 223 EXPECT_EQ(ctype, record_type); 210 224 211 225 return n; ··· 2176 2164 } 2177 2165 } 2178 2166 2167 + struct raw_rec { 2168 + unsigned int plain_len; 2169 + unsigned char plain_data[100]; 2170 + unsigned int cipher_len; 2171 + unsigned char cipher_data[128]; 2172 + }; 2173 + 2174 + /* TLS 1.2, AES_CCM, data, seqno:0, plaintext: 'Hello world' */ 2175 + static const struct raw_rec id0_data_l11 = { 2176 + .plain_len = 11, 2177 + .plain_data = { 2178 + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 2179 + 0x72, 0x6c, 0x64, 2180 + }, 2181 + .cipher_len = 40, 2182 + .cipher_data = { 2183 + 0x17, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 2184 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xa2, 0x33, 2185 + 0xde, 0x8d, 0x94, 0xf0, 0x29, 0x6c, 0xb1, 0xaf, 2186 + 0x6a, 0x75, 0xb2, 0x93, 0xad, 0x45, 0xd5, 0xfd, 2187 + 0x03, 0x51, 0x57, 0x8f, 0xf9, 0xcc, 0x3b, 0x42, 2188 + }, 2189 + }; 2190 + 2191 + /* TLS 1.2, AES_CCM, ctrl, seqno:0, plaintext: '' */ 2192 + static const struct raw_rec id0_ctrl_l0 = { 2193 + .plain_len = 0, 2194 + .plain_data = { 2195 + }, 2196 + .cipher_len = 29, 2197 + .cipher_data = { 2198 + 0x16, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, 2199 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x38, 0x7b, 2200 + 0xa6, 0x1c, 0xdd, 0xa7, 0x19, 0x33, 0xab, 0xae, 2201 + 0x88, 0xe1, 0xd2, 0x08, 0x4f, 2202 + }, 2203 + }; 2204 + 2205 + /* TLS 1.2, AES_CCM, data, seqno:0, plaintext: '' */ 2206 + static const struct raw_rec id0_data_l0 = { 2207 + .plain_len = 0, 2208 + .plain_data = { 2209 + }, 2210 + .cipher_len = 29, 2211 + .cipher_data = { 2212 + 0x17, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, 2213 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x37, 0x90, 2214 + 0x70, 0x45, 0x89, 0xfb, 0x5c, 0xc7, 0x89, 0x03, 2215 + 0x68, 0x80, 0xd3, 0xd8, 0xcc, 2216 + }, 2217 + }; 2218 + 2219 + /* TLS 1.2, AES_CCM, data, seqno:1, plaintext: 'Hello world' */ 2220 + static const struct raw_rec id1_data_l11 = { 2221 + .plain_len = 11, 2222 + .plain_data = { 2223 + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 2224 + 0x72, 0x6c, 0x64, 2225 + }, 2226 + .cipher_len = 40, 2227 + .cipher_data = { 2228 + 0x17, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 2229 + 0x00, 0x00, 0x00, 0x00, 0x01, 0x3a, 0x1a, 0x9c, 2230 + 0xd0, 0xa8, 0x9a, 0xd6, 0x69, 0xd6, 0x1a, 0xe3, 2231 + 0xb5, 0x1f, 0x0d, 0x2c, 0xe2, 0x97, 0x46, 0xff, 2232 + 0x2b, 0xcc, 0x5a, 0xc4, 0xa3, 0xb9, 0xef, 0xba, 2233 + }, 2234 + }; 2235 + 2236 + /* TLS 1.2, AES_CCM, ctrl, seqno:1, plaintext: '' */ 2237 + static const struct raw_rec id1_ctrl_l0 = { 2238 + .plain_len = 0, 2239 + .plain_data = { 2240 + }, 2241 + .cipher_len = 29, 2242 + .cipher_data = { 2243 + 0x16, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, 2244 + 0x00, 0x00, 0x00, 0x00, 0x01, 0x3e, 0xf0, 0xfe, 2245 + 0xee, 0xd9, 0xe2, 0x5d, 0xc7, 0x11, 0x4c, 0xe6, 2246 + 0xb4, 0x7e, 0xef, 0x40, 0x2b, 2247 + }, 2248 + }; 2249 + 2250 + /* TLS 1.2, AES_CCM, data, seqno:1, plaintext: '' */ 2251 + static const struct raw_rec id1_data_l0 = { 2252 + .plain_len = 0, 2253 + .plain_data = { 2254 + }, 2255 + .cipher_len = 29, 2256 + .cipher_data = { 2257 + 0x17, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, 2258 + 0x00, 0x00, 0x00, 0x00, 0x01, 0xce, 0xfc, 0x86, 2259 + 0xc8, 0xf0, 0x55, 0xf9, 0x47, 0x3f, 0x74, 0xdc, 2260 + 0xc9, 0xbf, 0xfe, 0x5b, 0xb1, 2261 + }, 2262 + }; 2263 + 2264 + /* TLS 1.2, AES_CCM, ctrl, seqno:2, plaintext: 'Hello world' */ 2265 + static const struct raw_rec id2_ctrl_l11 = { 2266 + .plain_len = 11, 2267 + .plain_data = { 2268 + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 2269 + 0x72, 0x6c, 0x64, 2270 + }, 2271 + .cipher_len = 40, 2272 + .cipher_data = { 2273 + 0x16, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 2274 + 0x00, 0x00, 0x00, 0x00, 0x02, 0xe5, 0x3d, 0x19, 2275 + 0x3d, 0xca, 0xb8, 0x16, 0xb6, 0xff, 0x79, 0x87, 2276 + 0x2a, 0x04, 0x11, 0x3d, 0xf8, 0x64, 0x5f, 0x36, 2277 + 0x8b, 0xa8, 0xee, 0x4c, 0x6d, 0x62, 0xa5, 0x00, 2278 + }, 2279 + }; 2280 + 2281 + /* TLS 1.2, AES_CCM, data, seqno:2, plaintext: 'Hello world' */ 2282 + static const struct raw_rec id2_data_l11 = { 2283 + .plain_len = 11, 2284 + .plain_data = { 2285 + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 2286 + 0x72, 0x6c, 0x64, 2287 + }, 2288 + .cipher_len = 40, 2289 + .cipher_data = { 2290 + 0x17, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 2291 + 0x00, 0x00, 0x00, 0x00, 0x02, 0xe5, 0x3d, 0x19, 2292 + 0x3d, 0xca, 0xb8, 0x16, 0xb6, 0xff, 0x79, 0x87, 2293 + 0x8e, 0xa1, 0xd0, 0xcd, 0x33, 0xb5, 0x86, 0x2b, 2294 + 0x17, 0xf1, 0x52, 0x2a, 0x55, 0x62, 0x65, 0x11, 2295 + }, 2296 + }; 2297 + 2298 + /* TLS 1.2, AES_CCM, ctrl, seqno:2, plaintext: '' */ 2299 + static const struct raw_rec id2_ctrl_l0 = { 2300 + .plain_len = 0, 2301 + .plain_data = { 2302 + }, 2303 + .cipher_len = 29, 2304 + .cipher_data = { 2305 + 0x16, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, 2306 + 0x00, 0x00, 0x00, 0x00, 0x02, 0xdc, 0x5c, 0x0e, 2307 + 0x41, 0xdd, 0xba, 0xd3, 0xcc, 0xcf, 0x6d, 0xd9, 2308 + 0x06, 0xdb, 0x79, 0xe5, 0x5d, 2309 + }, 2310 + }; 2311 + 2312 + /* TLS 1.2, AES_CCM, data, seqno:2, plaintext: '' */ 2313 + static const struct raw_rec id2_data_l0 = { 2314 + .plain_len = 0, 2315 + .plain_data = { 2316 + }, 2317 + .cipher_len = 29, 2318 + .cipher_data = { 2319 + 0x17, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, 2320 + 0x00, 0x00, 0x00, 0x00, 0x02, 0xc3, 0xca, 0x26, 2321 + 0x22, 0xe4, 0x25, 0xfb, 0x5f, 0x6d, 0xbf, 0x83, 2322 + 0x30, 0x48, 0x69, 0x1a, 0x47, 2323 + }, 2324 + }; 2325 + 2326 + FIXTURE(zero_len) 2327 + { 2328 + int fd, cfd; 2329 + bool notls; 2330 + }; 2331 + 2332 + FIXTURE_VARIANT(zero_len) 2333 + { 2334 + const struct raw_rec *recs[4]; 2335 + ssize_t recv_ret[4]; 2336 + }; 2337 + 2338 + FIXTURE_VARIANT_ADD(zero_len, data_data_data) 2339 + { 2340 + .recs = { &id0_data_l11, &id1_data_l11, &id2_data_l11, }, 2341 + .recv_ret = { 33, -EAGAIN, }, 2342 + }; 2343 + 2344 + FIXTURE_VARIANT_ADD(zero_len, data_0ctrl_data) 2345 + { 2346 + .recs = { &id0_data_l11, &id1_ctrl_l0, &id2_data_l11, }, 2347 + .recv_ret = { 11, 0, 11, -EAGAIN, }, 2348 + }; 2349 + 2350 + FIXTURE_VARIANT_ADD(zero_len, 0data_0data_0data) 2351 + { 2352 + .recs = { &id0_data_l0, &id1_data_l0, &id2_data_l0, }, 2353 + .recv_ret = { -EAGAIN, }, 2354 + }; 2355 + 2356 + FIXTURE_VARIANT_ADD(zero_len, 0data_0data_ctrl) 2357 + { 2358 + .recs = { &id0_data_l0, &id1_data_l0, &id2_ctrl_l11, }, 2359 + .recv_ret = { 0, 11, -EAGAIN, }, 2360 + }; 2361 + 2362 + FIXTURE_VARIANT_ADD(zero_len, 0data_0data_0ctrl) 2363 + { 2364 + .recs = { &id0_data_l0, &id1_data_l0, &id2_ctrl_l0, }, 2365 + .recv_ret = { 0, 0, -EAGAIN, }, 2366 + }; 2367 + 2368 + FIXTURE_VARIANT_ADD(zero_len, 0ctrl_0ctrl_0ctrl) 2369 + { 2370 + .recs = { &id0_ctrl_l0, &id1_ctrl_l0, &id2_ctrl_l0, }, 2371 + .recv_ret = { 0, 0, 0, -EAGAIN, }, 2372 + }; 2373 + 2374 + FIXTURE_VARIANT_ADD(zero_len, 0data_0data_data) 2375 + { 2376 + .recs = { &id0_data_l0, &id1_data_l0, &id2_data_l11, }, 2377 + .recv_ret = { 11, -EAGAIN, }, 2378 + }; 2379 + 2380 + FIXTURE_VARIANT_ADD(zero_len, data_0data_0data) 2381 + { 2382 + .recs = { &id0_data_l11, &id1_data_l0, &id2_data_l0, }, 2383 + .recv_ret = { 11, -EAGAIN, }, 2384 + }; 2385 + 2386 + FIXTURE_SETUP(zero_len) 2387 + { 2388 + struct tls_crypto_info_keys tls12; 2389 + int ret; 2390 + 2391 + tls_crypto_info_init(TLS_1_2_VERSION, TLS_CIPHER_AES_CCM_128, 2392 + &tls12, 0); 2393 + 2394 + ulp_sock_pair(_metadata, &self->fd, &self->cfd, &self->notls); 2395 + if (self->notls) 2396 + return; 2397 + 2398 + /* Don't install keys on fd, we'll send raw records */ 2399 + ret = setsockopt(self->cfd, SOL_TLS, TLS_RX, &tls12, tls12.len); 2400 + ASSERT_EQ(ret, 0); 2401 + } 2402 + 2403 + FIXTURE_TEARDOWN(zero_len) 2404 + { 2405 + close(self->fd); 2406 + close(self->cfd); 2407 + } 2408 + 2409 + TEST_F(zero_len, test) 2410 + { 2411 + const struct raw_rec *const *rec; 2412 + unsigned char buf[128]; 2413 + int rec_off; 2414 + int i; 2415 + 2416 + for (i = 0; i < 4 && variant->recs[i]; i++) 2417 + EXPECT_EQ(send(self->fd, variant->recs[i]->cipher_data, 2418 + variant->recs[i]->cipher_len, 0), 2419 + variant->recs[i]->cipher_len); 2420 + 2421 + rec = &variant->recs[0]; 2422 + rec_off = 0; 2423 + for (i = 0; i < 4; i++) { 2424 + int j, ret; 2425 + 2426 + ret = variant->recv_ret[i] >= 0 ? variant->recv_ret[i] : -1; 2427 + EXPECT_EQ(__tls_recv_cmsg(_metadata, self->cfd, NULL, 2428 + buf, sizeof(buf), MSG_DONTWAIT), ret); 2429 + if (ret == -1) 2430 + EXPECT_EQ(errno, -variant->recv_ret[i]); 2431 + if (variant->recv_ret[i] == -EAGAIN) 2432 + break; 2433 + 2434 + for (j = 0; j < ret; j++) { 2435 + while (rec_off == (*rec)->plain_len) { 2436 + rec++; 2437 + rec_off = 0; 2438 + } 2439 + EXPECT_EQ(buf[j], (*rec)->plain_data[rec_off]); 2440 + rec_off++; 2441 + } 2442 + } 2443 + }; 2444 + 2179 2445 FIXTURE(tls_err) 2180 2446 { 2181 2447 int fd, cfd; ··· 3038 2748 pid = fork(); 3039 2749 ASSERT_GE(pid, 0); 3040 2750 if (!pid) { 3041 - EXPECT_EQ(recv(cfd, buf, sizeof(buf), MSG_WAITALL), 3042 - sizeof(buf)); 2751 + EXPECT_EQ(recv(cfd, buf, sizeof(buf) / 2, MSG_WAITALL), 2752 + sizeof(buf) / 2); 3043 2753 exit(!__test_passed(_metadata)); 3044 2754 } 3045 2755 3046 - usleep(2000); 2756 + usleep(10000); 3047 2757 ASSERT_EQ(setsockopt(fd, SOL_TLS, TLS_TX, &tls, tls.len), 0); 3048 2758 ASSERT_EQ(setsockopt(cfd, SOL_TLS, TLS_RX, &tls, tls.len), 0); 3049 2759 3050 2760 EXPECT_EQ(send(fd, buf, sizeof(buf), 0), sizeof(buf)); 3051 - usleep(2000); 2761 + EXPECT_EQ(wait(&status), pid); 2762 + EXPECT_EQ(status, 0); 3052 2763 EXPECT_EQ(recv(cfd, buf2, sizeof(buf2), MSG_DONTWAIT), -1); 3053 2764 /* Don't check errno, the error will be different depending 3054 2765 * on what random bytes TLS interpreted as the record length. ··· 3057 2766 3058 2767 close(fd); 3059 2768 close(cfd); 3060 - 3061 - EXPECT_EQ(wait(&status), pid); 3062 - EXPECT_EQ(status, 0); 3063 2769 } 3064 2770 3065 2771 static void __attribute__((constructor)) fips_check(void) {
+198
tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
··· 186 186 ] 187 187 }, 188 188 { 189 + "id": "34c0", 190 + "name": "Test TBF with HHF Backlog Accounting in gso_skb case against underflow", 191 + "category": [ 192 + "qdisc", 193 + "tbf", 194 + "hhf" 195 + ], 196 + "plugins": { 197 + "requires": [ 198 + "nsPlugin" 199 + ] 200 + }, 201 + "setup": [ 202 + "$IP link set dev $DUMMY up || true", 203 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 204 + "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms", 205 + "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 hhf limit 1000", 206 + [ 207 + "ping -I $DUMMY -c2 10.10.11.11", 208 + 1 209 + ], 210 + "$TC qdisc change dev $DUMMY handle 2: parent 1:1 hhf limit 1" 211 + ], 212 + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1", 213 + "expExitCode": "0", 214 + "verifyCmd": "$TC -s qdisc show dev $DUMMY", 215 + "matchPattern": "backlog 0b 0p", 216 + "matchCount": "1", 217 + "teardown": [ 218 + "$TC qdisc del dev $DUMMY handle 1: root" 219 + ] 220 + }, 221 + { 222 + "id": "fd68", 223 + "name": "Test TBF with CODEL Backlog Accounting in gso_skb case against underflow", 224 + "category": [ 225 + "qdisc", 226 + "tbf", 227 + "codel" 228 + ], 229 + "plugins": { 230 + "requires": [ 231 + "nsPlugin" 232 + ] 233 + }, 234 + "setup": [ 235 + "$IP link set dev $DUMMY up || true", 236 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 237 + "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms", 238 + "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 codel limit 1000", 239 + [ 240 + "ping -I $DUMMY -c2 10.10.11.11", 241 + 1 242 + ], 243 + "$TC qdisc change dev $DUMMY handle 2: parent 1:1 codel limit 1" 244 + ], 245 + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1", 246 + "expExitCode": "0", 247 + "verifyCmd": "$TC -s qdisc show dev $DUMMY", 248 + "matchPattern": "backlog 0b 0p", 249 + "matchCount": "1", 250 + "teardown": [ 251 + "$TC qdisc del dev $DUMMY handle 1: root" 252 + ] 253 + }, 254 + { 255 + "id": "514e", 256 + "name": "Test TBF with PIE Backlog Accounting in gso_skb case against underflow", 257 + "category": [ 258 + "qdisc", 259 + "tbf", 260 + "pie" 261 + ], 262 + "plugins": { 263 + "requires": [ 264 + "nsPlugin" 265 + ] 266 + }, 267 + "setup": [ 268 + "$IP link set dev $DUMMY up || true", 269 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 270 + "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms", 271 + "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 pie limit 1000", 272 + [ 273 + "ping -I $DUMMY -c2 10.10.11.11", 274 + 1 275 + ], 276 + "$TC qdisc change dev $DUMMY handle 2: parent 1:1 pie limit 1" 277 + ], 278 + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1", 279 + "expExitCode": "0", 280 + "verifyCmd": "$TC -s qdisc show dev $DUMMY", 281 + "matchPattern": "backlog 0b 0p", 282 + "matchCount": "1", 283 + "teardown": [ 284 + "$TC qdisc del dev $DUMMY handle 1: root" 285 + ] 286 + }, 287 + { 288 + "id": "6c97", 289 + "name": "Test TBF with FQ Backlog Accounting in gso_skb case against underflow", 290 + "category": [ 291 + "qdisc", 292 + "tbf", 293 + "fq" 294 + ], 295 + "plugins": { 296 + "requires": [ 297 + "nsPlugin" 298 + ] 299 + }, 300 + "setup": [ 301 + "$IP link set dev $DUMMY up || true", 302 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 303 + "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms", 304 + "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq limit 1000", 305 + [ 306 + "ping -I $DUMMY -c2 10.10.11.11", 307 + 1 308 + ], 309 + "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq limit 1" 310 + ], 311 + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1", 312 + "expExitCode": "0", 313 + "verifyCmd": "$TC -s qdisc show dev $DUMMY", 314 + "matchPattern": "backlog 0b 0p", 315 + "matchCount": "1", 316 + "teardown": [ 317 + "$TC qdisc del dev $DUMMY handle 1: root" 318 + ] 319 + }, 320 + { 321 + "id": "5d0b", 322 + "name": "Test TBF with FQ_CODEL Backlog Accounting in gso_skb case against underflow", 323 + "category": [ 324 + "qdisc", 325 + "tbf", 326 + "fq_codel" 327 + ], 328 + "plugins": { 329 + "requires": [ 330 + "nsPlugin" 331 + ] 332 + }, 333 + "setup": [ 334 + "$IP link set dev $DUMMY up || true", 335 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 336 + "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms", 337 + "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq_codel limit 1000", 338 + [ 339 + "ping -I $DUMMY -c2 10.10.11.11", 340 + 1 341 + ], 342 + "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq_codel limit 1" 343 + ], 344 + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1", 345 + "expExitCode": "0", 346 + "verifyCmd": "$TC -s qdisc show dev $DUMMY", 347 + "matchPattern": "backlog 0b 0p", 348 + "matchCount": "1", 349 + "teardown": [ 350 + "$TC qdisc del dev $DUMMY handle 1: root" 351 + ] 352 + }, 353 + { 354 + "id": "21c3", 355 + "name": "Test TBF with FQ_PIE Backlog Accounting in gso_skb case against underflow", 356 + "category": [ 357 + "qdisc", 358 + "tbf", 359 + "fq_pie" 360 + ], 361 + "plugins": { 362 + "requires": [ 363 + "nsPlugin" 364 + ] 365 + }, 366 + "setup": [ 367 + "$IP link set dev $DUMMY up || true", 368 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 369 + "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms", 370 + "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq_pie limit 1000", 371 + [ 372 + "ping -I $DUMMY -c2 10.10.11.11", 373 + 1 374 + ], 375 + "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq_pie limit 1" 376 + ], 377 + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1", 378 + "expExitCode": "0", 379 + "verifyCmd": "$TC -s qdisc show dev $DUMMY", 380 + "matchPattern": "backlog 0b 0p", 381 + "matchCount": "1", 382 + "teardown": [ 383 + "$TC qdisc del dev $DUMMY handle 1: root" 384 + ] 385 + }, 386 + { 189 387 "id": "a4bb", 190 388 "name": "Test FQ_CODEL with HTB parent - force packet drop with empty queue", 191 389 "category": [