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

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

Pull networking fixes from Paolo Abeni:
"Including fixes from bpf and netfilter.

Current release - regressions:

- gro: initialize network_offset in network layer

- tcp: reduce accepted window in NEW_SYN_RECV state

Current release - new code bugs:

- eth: mlx5e: do not use ptp structure for tx ts stats when not
initialized

- eth: ice: check for unregistering correct number of devlink params

Previous releases - regressions:

- bpf: Allow delete from sockmap/sockhash only if update is allowed

- sched: taprio: extend minimum interval restriction to entire cycle
too

- netfilter: ipset: add list flush to cancel_gc

- ipv4: fix address dump when IPv4 is disabled on an interface

- sock_map: avoid race between sock_map_close and sk_psock_put

- eth: mlx5: use mlx5_ipsec_rx_status_destroy to correctly delete
status rules

Previous releases - always broken:

- core: fix __dst_negative_advice() race

- bpf:
- fix multi-uprobe PID filtering logic
- fix pkt_type override upon netkit pass verdict

- netfilter: tproxy: bail out if IP has been disabled on the device

- af_unix: annotate data-race around unix_sk(sk)->addr

- eth: mlx5e: fix UDP GSO for encapsulated packets

- eth: idpf: don't enable NAPI and interrupts prior to allocating Rx
buffers

- eth: i40e: fully suspend and resume IO operations in EEH case

- eth: octeontx2-pf: free send queue buffers incase of leaf to inner

- eth: ipvlan: dont Use skb->sk in ipvlan_process_v{4,6}_outbound"

* tag 'net-6.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (69 commits)
netdev: add qstat for csum complete
ipvlan: Dont Use skb->sk in ipvlan_process_v{4,6}_outbound
net: ena: Fix redundant device NUMA node override
ice: check for unregistering correct number of devlink params
ice: fix 200G PHY types to link speed mapping
i40e: Fully suspend and resume IO operations in EEH case
i40e: factoring out i40e_suspend/i40e_resume
e1000e: move force SMBUS near the end of enable_ulp function
net: dsa: microchip: fix RGMII error in KSZ DSA driver
ipv4: correctly iterate over the target netns in inet_dump_ifaddr()
net: fix __dst_negative_advice() race
nfc/nci: Add the inconsistency check between the input data length and count
MAINTAINERS: dwmac: starfive: update Maintainer
net/sched: taprio: extend minimum interval restriction to entire cycle too
net/sched: taprio: make q->picos_per_byte available to fill_sched_entry()
netfilter: nft_fib: allow from forward/input without iif selector
netfilter: tproxy: bail out if IP has been disabled on the device
netfilter: nft_payload: skbuff vlan metadata mangle support
net: ti: icssg-prueth: Fix start counter for ft1 filter
sock_map: avoid race between sock_map_close and sk_psock_put
...

+1179 -381
+9 -2
Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml
··· 24 24 25 25 managers: 26 26 type: object 27 + additionalProperties: false 27 28 description: 28 29 List of the PD69208T4/PD69204T4/PD69208M PSE managers. Each manager 29 30 have 4 or 8 physical ports according to the chip version. No need to ··· 48 47 - "#size-cells" 49 48 50 49 patternProperties: 51 - "^manager@0[0-9a-b]$": 50 + "^manager@[0-9a-b]$": 52 51 type: object 52 + additionalProperties: false 53 53 description: 54 54 PD69208T4/PD69204T4/PD69208M PSE manager exposing 4 or 8 physical 55 55 ports. ··· 71 69 patternProperties: 72 70 '^port@[0-7]$': 73 71 type: object 72 + additionalProperties: false 73 + 74 + properties: 75 + reg: 76 + maxItems: 1 77 + 74 78 required: 75 79 - reg 76 - additionalProperties: false 77 80 78 81 required: 79 82 - reg
+18
Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
··· 29 29 of the ports conversion matrix that establishes relationship between 30 30 the logical ports and the physical channels. 31 31 type: object 32 + additionalProperties: false 33 + 34 + properties: 35 + "#address-cells": 36 + const: 1 37 + 38 + "#size-cells": 39 + const: 0 32 40 33 41 patternProperties: 34 42 '^channel@[0-7]$': 35 43 type: object 44 + additionalProperties: false 45 + 46 + properties: 47 + reg: 48 + maxItems: 1 49 + 36 50 required: 37 51 - reg 52 + 53 + required: 54 + - "#address-cells" 55 + - "#size-cells" 38 56 39 57 unevaluatedProperties: false 40 58
+4
Documentation/netlink/specs/netdev.yaml
··· 350 350 buffer space, host descriptors etc. 351 351 type: uint 352 352 - 353 + name: rx-csum-complete 354 + doc: Number of packets that were marked as CHECKSUM_COMPLETE. 355 + type: uint 356 + - 353 357 name: rx-csum-unnecessary 354 358 doc: Number of packets that were marked as CHECKSUM_UNNECESSARY. 355 359 type: uint
+1 -1
Documentation/process/maintainer-netdev.rst
··· 227 227 The amount of mooing will depend on packet rate so should match 228 228 the diurnal cycle quite well. 229 229 230 - Signed-of-by: Joe Defarmer <joe@barn.org> 230 + Signed-off-by: Joe Defarmer <joe@barn.org> 231 231 --- 232 232 v3: 233 233 - add a note about time-of-day mooing fluctuation to the commit message
+2 -1
MAINTAINERS
··· 3854 3854 M: Daniel Borkmann <daniel@iogearbox.net> 3855 3855 M: Alexei Starovoitov <ast@kernel.org> 3856 3856 M: Puranjay Mohan <puranjay@kernel.org> 3857 + R: Xu Kuohai <xukuohai@huaweicloud.com> 3857 3858 L: bpf@vger.kernel.org 3858 3859 S: Supported 3859 3860 F: arch/arm64/net/ ··· 21317 21316 21318 21317 STARFIVE DWMAC GLUE LAYER 21319 21318 M: Emil Renner Berthing <kernel@esmil.dk> 21320 - M: Samin Guo <samin.guo@starfivetech.com> 21319 + M: Minda Chen <minda.chen@starfivetech.com> 21321 21320 S: Maintained 21322 21321 F: Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml 21323 21322 F: drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
+1 -1
arch/arc/net/bpf_jit.h
··· 39 39 40 40 /************** Functions that the back-end must provide **************/ 41 41 /* Extension for 32-bit operations. */ 42 - inline u8 zext(u8 *buf, u8 rd); 42 + u8 zext(u8 *buf, u8 rd); 43 43 /***** Moves *****/ 44 44 u8 mov_r32(u8 *buf, u8 rd, u8 rs, u8 sign_ext); 45 45 u8 mov_r32_i32(u8 *buf, u8 reg, s32 imm);
+6 -4
arch/arc/net/bpf_jit_arcv2.c
··· 62 62 * If/when we decide to add ARCv2 instructions that do use register pairs, 63 63 * the mapping, hopefully, doesn't need to be revisited. 64 64 */ 65 - const u8 bpf2arc[][2] = { 65 + static const u8 bpf2arc[][2] = { 66 66 /* Return value from in-kernel function, and exit value from eBPF */ 67 67 [BPF_REG_0] = {ARC_R_8, ARC_R_9}, 68 68 /* Arguments from eBPF program to in-kernel function */ ··· 1302 1302 1303 1303 /************* Packers (Deal with BPF_REGs) **************/ 1304 1304 1305 - inline u8 zext(u8 *buf, u8 rd) 1305 + u8 zext(u8 *buf, u8 rd) 1306 1306 { 1307 1307 if (rd != BPF_REG_FP) 1308 1308 return arc_movi_r(buf, REG_HI(rd), 0); ··· 2235 2235 break; 2236 2236 default: 2237 2237 /* The caller must have handled this. */ 2238 + break; 2238 2239 } 2239 2240 } else { 2240 2241 /* ··· 2254 2253 break; 2255 2254 default: 2256 2255 /* The caller must have handled this. */ 2256 + break; 2257 2257 } 2258 2258 } 2259 2259 ··· 2519 2517 #define JCC64_NR_OF_JMPS 3 /* Number of jumps in jcc64 template. */ 2520 2518 #define JCC64_INSNS_TO_END 3 /* Number of insn. inclusive the 2nd jmp to end. */ 2521 2519 #define JCC64_SKIP_JMP 1 /* Index of the "skip" jump to "end". */ 2522 - const struct { 2520 + static const struct { 2523 2521 /* 2524 2522 * "jit_off" is common between all "jmp[]" and is coupled with 2525 2523 * "cond" of each "jmp[]" instance. e.g.: ··· 2885 2883 * The "ARC_CC_SET" becomes "CC_unequal" because of the "tst" 2886 2884 * instruction that precedes the conditional branch. 2887 2885 */ 2888 - const u8 arcv2_32_jmps[ARC_CC_LAST] = { 2886 + static const u8 arcv2_32_jmps[ARC_CC_LAST] = { 2889 2887 [ARC_CC_UGT] = CC_great_u, 2890 2888 [ARC_CC_UGE] = CC_great_eq_u, 2891 2889 [ARC_CC_ULT] = CC_less_u,
+11 -11
arch/arc/net/bpf_jit_core.c
··· 159 159 /* Initialise the context so there's no garbage. */ 160 160 static int jit_ctx_init(struct jit_context *ctx, struct bpf_prog *prog) 161 161 { 162 - memset(ctx, 0, sizeof(ctx)); 162 + memset(ctx, 0, sizeof(*ctx)); 163 163 164 164 ctx->orig_prog = prog; 165 165 ··· 167 167 ctx->prog = bpf_jit_blind_constants(prog); 168 168 if (IS_ERR(ctx->prog)) 169 169 return PTR_ERR(ctx->prog); 170 - ctx->blinded = (ctx->prog == ctx->orig_prog ? false : true); 170 + ctx->blinded = (ctx->prog != ctx->orig_prog); 171 171 172 172 /* If the verifier doesn't zero-extend, then we have to do it. */ 173 173 ctx->do_zext = !ctx->prog->aux->verifier_zext; ··· 1182 1182 } 1183 1183 1184 1184 /* 1185 - * All the "handle_*()" functions have been called before by the 1186 - * "jit_prepare()". If there was an error, we would know by now. 1187 - * Therefore, no extra error checking at this point, other than 1188 - * a sanity check at the end that expects the calculated length 1189 - * (jit.len) to be equal to the length of generated instructions 1190 - * (jit.index). 1185 + * jit_compile() is the real compilation phase. jit_prepare() is 1186 + * invoked before jit_compile() as a dry-run to make sure everything 1187 + * will go OK and allocate the necessary memory. 1188 + * 1189 + * In the end, jit_compile() checks if it has produced the same number 1190 + * of instructions as jit_prepare() would. 1191 1191 */ 1192 1192 static int jit_compile(struct jit_context *ctx) 1193 1193 { ··· 1407 1407 1408 1408 /* 1409 1409 * This function may be invoked twice for the same stream of BPF 1410 - * instructions. The "extra pass" happens, when there are "call"s 1411 - * involved that their addresses are not known during the first 1412 - * invocation. 1410 + * instructions. The "extra pass" happens, when there are 1411 + * (re)locations involved that their addresses are not known 1412 + * during the first run. 1413 1413 */ 1414 1414 struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) 1415 1415 {
+1 -1
drivers/net/dsa/microchip/ksz_common.c
··· 3142 3142 else 3143 3143 interface = PHY_INTERFACE_MODE_MII; 3144 3144 } else if (val == bitval[P_RMII_SEL]) { 3145 - interface = PHY_INTERFACE_MODE_RGMII; 3145 + interface = PHY_INTERFACE_MODE_RMII; 3146 3146 } else { 3147 3147 interface = PHY_INTERFACE_MODE_RGMII; 3148 3148 if (data8 & P_RGMII_ID_EG_ENABLE)
-11
drivers/net/ethernet/amazon/ena/ena_com.c
··· 312 312 struct ena_com_io_sq *io_sq) 313 313 { 314 314 size_t size; 315 - int dev_node = 0; 316 315 317 316 memset(&io_sq->desc_addr, 0x0, sizeof(io_sq->desc_addr)); 318 317 ··· 324 325 size = io_sq->desc_entry_size * io_sq->q_depth; 325 326 326 327 if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST) { 327 - dev_node = dev_to_node(ena_dev->dmadev); 328 - set_dev_node(ena_dev->dmadev, ctx->numa_node); 329 328 io_sq->desc_addr.virt_addr = 330 329 dma_alloc_coherent(ena_dev->dmadev, size, &io_sq->desc_addr.phys_addr, 331 330 GFP_KERNEL); 332 - set_dev_node(ena_dev->dmadev, dev_node); 333 331 if (!io_sq->desc_addr.virt_addr) { 334 332 io_sq->desc_addr.virt_addr = 335 333 dma_alloc_coherent(ena_dev->dmadev, size, ··· 350 354 size = (size_t)io_sq->bounce_buf_ctrl.buffer_size * 351 355 io_sq->bounce_buf_ctrl.buffers_num; 352 356 353 - dev_node = dev_to_node(ena_dev->dmadev); 354 - set_dev_node(ena_dev->dmadev, ctx->numa_node); 355 357 io_sq->bounce_buf_ctrl.base_buffer = devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); 356 - set_dev_node(ena_dev->dmadev, dev_node); 357 358 if (!io_sq->bounce_buf_ctrl.base_buffer) 358 359 io_sq->bounce_buf_ctrl.base_buffer = 359 360 devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); ··· 390 397 struct ena_com_io_cq *io_cq) 391 398 { 392 399 size_t size; 393 - int prev_node = 0; 394 400 395 401 memset(&io_cq->cdesc_addr, 0x0, sizeof(io_cq->cdesc_addr)); 396 402 ··· 401 409 402 410 size = io_cq->cdesc_entry_size_in_bytes * io_cq->q_depth; 403 411 404 - prev_node = dev_to_node(ena_dev->dmadev); 405 - set_dev_node(ena_dev->dmadev, ctx->numa_node); 406 412 io_cq->cdesc_addr.virt_addr = 407 413 dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr, GFP_KERNEL); 408 - set_dev_node(ena_dev->dmadev, prev_node); 409 414 if (!io_cq->cdesc_addr.virt_addr) { 410 415 io_cq->cdesc_addr.virt_addr = 411 416 dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr,
+12
drivers/net/ethernet/cisco/enic/enic_main.c
··· 1117 1117 pp->request = nla_get_u8(port[IFLA_PORT_REQUEST]); 1118 1118 1119 1119 if (port[IFLA_PORT_PROFILE]) { 1120 + if (nla_len(port[IFLA_PORT_PROFILE]) != PORT_PROFILE_MAX) { 1121 + memcpy(pp, &prev_pp, sizeof(*pp)); 1122 + return -EINVAL; 1123 + } 1120 1124 pp->set |= ENIC_SET_NAME; 1121 1125 memcpy(pp->name, nla_data(port[IFLA_PORT_PROFILE]), 1122 1126 PORT_PROFILE_MAX); 1123 1127 } 1124 1128 1125 1129 if (port[IFLA_PORT_INSTANCE_UUID]) { 1130 + if (nla_len(port[IFLA_PORT_INSTANCE_UUID]) != PORT_UUID_MAX) { 1131 + memcpy(pp, &prev_pp, sizeof(*pp)); 1132 + return -EINVAL; 1133 + } 1126 1134 pp->set |= ENIC_SET_INSTANCE; 1127 1135 memcpy(pp->instance_uuid, 1128 1136 nla_data(port[IFLA_PORT_INSTANCE_UUID]), PORT_UUID_MAX); 1129 1137 } 1130 1138 1131 1139 if (port[IFLA_PORT_HOST_UUID]) { 1140 + if (nla_len(port[IFLA_PORT_HOST_UUID]) != PORT_UUID_MAX) { 1141 + memcpy(pp, &prev_pp, sizeof(*pp)); 1142 + return -EINVAL; 1143 + } 1132 1144 pp->set |= ENIC_SET_HOST; 1133 1145 memcpy(pp->host_uuid, 1134 1146 nla_data(port[IFLA_PORT_HOST_UUID]), PORT_UUID_MAX);
+10
drivers/net/ethernet/freescale/fec_main.c
··· 4130 4130 return ret; 4131 4131 } 4132 4132 4133 + static void fec_enet_deinit(struct net_device *ndev) 4134 + { 4135 + struct fec_enet_private *fep = netdev_priv(ndev); 4136 + 4137 + netif_napi_del(&fep->napi); 4138 + fec_enet_free_queue(ndev); 4139 + } 4140 + 4133 4141 #ifdef CONFIG_OF 4134 4142 static int fec_reset_phy(struct platform_device *pdev) 4135 4143 { ··· 4532 4524 fec_enet_mii_remove(fep); 4533 4525 failed_mii_init: 4534 4526 failed_irq: 4527 + fec_enet_deinit(ndev); 4535 4528 failed_init: 4536 4529 fec_ptp_stop(pdev); 4537 4530 failed_reset: ··· 4596 4587 pm_runtime_put_noidle(&pdev->dev); 4597 4588 pm_runtime_disable(&pdev->dev); 4598 4589 4590 + fec_enet_deinit(ndev); 4599 4591 free_netdev(ndev); 4600 4592 } 4601 4593
+22
drivers/net/ethernet/intel/e1000e/ich8lan.c
··· 1225 1225 } 1226 1226 1227 1227 release: 1228 + /* Switching PHY interface always returns MDI error 1229 + * so disable retry mechanism to avoid wasting time 1230 + */ 1231 + e1000e_disable_phy_retry(hw); 1232 + 1233 + /* Force SMBus mode in PHY */ 1234 + ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg); 1235 + if (ret_val) { 1236 + e1000e_enable_phy_retry(hw); 1237 + hw->phy.ops.release(hw); 1238 + goto out; 1239 + } 1240 + phy_reg |= CV_SMB_CTRL_FORCE_SMBUS; 1241 + e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg); 1242 + 1243 + e1000e_enable_phy_retry(hw); 1244 + 1245 + /* Force SMBus mode in MAC */ 1246 + mac_reg = er32(CTRL_EXT); 1247 + mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS; 1248 + ew32(CTRL_EXT, mac_reg); 1249 + 1228 1250 hw->phy.ops.release(hw); 1229 1251 out: 1230 1252 if (ret_val)
-18
drivers/net/ethernet/intel/e1000e/netdev.c
··· 6623 6623 struct e1000_hw *hw = &adapter->hw; 6624 6624 u32 ctrl, ctrl_ext, rctl, status, wufc; 6625 6625 int retval = 0; 6626 - u16 smb_ctrl; 6627 6626 6628 6627 /* Runtime suspend should only enable wakeup for link changes */ 6629 6628 if (runtime) ··· 6696 6697 if (retval) 6697 6698 return retval; 6698 6699 } 6699 - 6700 - /* Force SMBUS to allow WOL */ 6701 - /* Switching PHY interface always returns MDI error 6702 - * so disable retry mechanism to avoid wasting time 6703 - */ 6704 - e1000e_disable_phy_retry(hw); 6705 - 6706 - e1e_rphy(hw, CV_SMB_CTRL, &smb_ctrl); 6707 - smb_ctrl |= CV_SMB_CTRL_FORCE_SMBUS; 6708 - e1e_wphy(hw, CV_SMB_CTRL, smb_ctrl); 6709 - 6710 - e1000e_enable_phy_retry(hw); 6711 - 6712 - /* Force SMBus mode in MAC */ 6713 - ctrl_ext = er32(CTRL_EXT); 6714 - ctrl_ext |= E1000_CTRL_EXT_FORCE_SMBUS; 6715 - ew32(CTRL_EXT, ctrl_ext); 6716 6700 } 6717 6701 6718 6702 /* Ensure that the appropriate bits are set in LPI_CTRL
+141 -117
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 11171 11171 ret = i40e_reset(pf); 11172 11172 if (!ret) 11173 11173 i40e_rebuild(pf, reinit, lock_acquired); 11174 + else 11175 + dev_err(&pf->pdev->dev, "%s: i40e_reset() FAILED", __func__); 11174 11176 } 11175 11177 11176 11178 /** ··· 16337 16335 } 16338 16336 16339 16337 /** 16338 + * i40e_enable_mc_magic_wake - enable multicast magic packet wake up 16339 + * using the mac_address_write admin q function 16340 + * @pf: pointer to i40e_pf struct 16341 + **/ 16342 + static void i40e_enable_mc_magic_wake(struct i40e_pf *pf) 16343 + { 16344 + struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); 16345 + struct i40e_hw *hw = &pf->hw; 16346 + u8 mac_addr[6]; 16347 + u16 flags = 0; 16348 + int ret; 16349 + 16350 + /* Get current MAC address in case it's an LAA */ 16351 + if (main_vsi && main_vsi->netdev) { 16352 + ether_addr_copy(mac_addr, main_vsi->netdev->dev_addr); 16353 + } else { 16354 + dev_err(&pf->pdev->dev, 16355 + "Failed to retrieve MAC address; using default\n"); 16356 + ether_addr_copy(mac_addr, hw->mac.addr); 16357 + } 16358 + 16359 + /* The FW expects the mac address write cmd to first be called with 16360 + * one of these flags before calling it again with the multicast 16361 + * enable flags. 16362 + */ 16363 + flags = I40E_AQC_WRITE_TYPE_LAA_WOL; 16364 + 16365 + if (hw->func_caps.flex10_enable && hw->partition_id != 1) 16366 + flags = I40E_AQC_WRITE_TYPE_LAA_ONLY; 16367 + 16368 + ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16369 + if (ret) { 16370 + dev_err(&pf->pdev->dev, 16371 + "Failed to update MAC address registers; cannot enable Multicast Magic packet wake up"); 16372 + return; 16373 + } 16374 + 16375 + flags = I40E_AQC_MC_MAG_EN 16376 + | I40E_AQC_WOL_PRESERVE_ON_PFR 16377 + | I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG; 16378 + ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16379 + if (ret) 16380 + dev_err(&pf->pdev->dev, 16381 + "Failed to enable Multicast Magic Packet wake up\n"); 16382 + } 16383 + 16384 + /** 16385 + * i40e_io_suspend - suspend all IO operations 16386 + * @pf: pointer to i40e_pf struct 16387 + * 16388 + **/ 16389 + static int i40e_io_suspend(struct i40e_pf *pf) 16390 + { 16391 + struct i40e_hw *hw = &pf->hw; 16392 + 16393 + set_bit(__I40E_DOWN, pf->state); 16394 + 16395 + /* Ensure service task will not be running */ 16396 + del_timer_sync(&pf->service_timer); 16397 + cancel_work_sync(&pf->service_task); 16398 + 16399 + /* Client close must be called explicitly here because the timer 16400 + * has been stopped. 16401 + */ 16402 + i40e_notify_client_of_netdev_close(pf, false); 16403 + 16404 + if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && 16405 + pf->wol_en) 16406 + i40e_enable_mc_magic_wake(pf); 16407 + 16408 + /* Since we're going to destroy queues during the 16409 + * i40e_clear_interrupt_scheme() we should hold the RTNL lock for this 16410 + * whole section 16411 + */ 16412 + rtnl_lock(); 16413 + 16414 + i40e_prep_for_reset(pf); 16415 + 16416 + wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); 16417 + wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); 16418 + 16419 + /* Clear the interrupt scheme and release our IRQs so that the system 16420 + * can safely hibernate even when there are a large number of CPUs. 16421 + * Otherwise hibernation might fail when mapping all the vectors back 16422 + * to CPU0. 16423 + */ 16424 + i40e_clear_interrupt_scheme(pf); 16425 + 16426 + rtnl_unlock(); 16427 + 16428 + return 0; 16429 + } 16430 + 16431 + /** 16432 + * i40e_io_resume - resume IO operations 16433 + * @pf: pointer to i40e_pf struct 16434 + * 16435 + **/ 16436 + static int i40e_io_resume(struct i40e_pf *pf) 16437 + { 16438 + struct device *dev = &pf->pdev->dev; 16439 + int err; 16440 + 16441 + /* We need to hold the RTNL lock prior to restoring interrupt schemes, 16442 + * since we're going to be restoring queues 16443 + */ 16444 + rtnl_lock(); 16445 + 16446 + /* We cleared the interrupt scheme when we suspended, so we need to 16447 + * restore it now to resume device functionality. 16448 + */ 16449 + err = i40e_restore_interrupt_scheme(pf); 16450 + if (err) { 16451 + dev_err(dev, "Cannot restore interrupt scheme: %d\n", 16452 + err); 16453 + } 16454 + 16455 + clear_bit(__I40E_DOWN, pf->state); 16456 + i40e_reset_and_rebuild(pf, false, true); 16457 + 16458 + rtnl_unlock(); 16459 + 16460 + /* Clear suspended state last after everything is recovered */ 16461 + clear_bit(__I40E_SUSPENDED, pf->state); 16462 + 16463 + /* Restart the service task */ 16464 + mod_timer(&pf->service_timer, 16465 + round_jiffies(jiffies + pf->service_timer_period)); 16466 + 16467 + return 0; 16468 + } 16469 + 16470 + /** 16340 16471 * i40e_pci_error_detected - warning that something funky happened in PCI land 16341 16472 * @pdev: PCI device information struct 16342 16473 * @error: the type of PCI error ··· 16493 16358 16494 16359 /* shutdown all operations */ 16495 16360 if (!test_bit(__I40E_SUSPENDED, pf->state)) 16496 - i40e_prep_for_reset(pf); 16361 + i40e_io_suspend(pf); 16497 16362 16498 16363 /* Request a slot reset */ 16499 16364 return PCI_ERS_RESULT_NEED_RESET; ··· 16515 16380 u32 reg; 16516 16381 16517 16382 dev_dbg(&pdev->dev, "%s\n", __func__); 16518 - if (pci_enable_device_mem(pdev)) { 16383 + /* enable I/O and memory of the device */ 16384 + if (pci_enable_device(pdev)) { 16519 16385 dev_info(&pdev->dev, 16520 16386 "Cannot re-enable PCI device after reset.\n"); 16521 16387 result = PCI_ERS_RESULT_DISCONNECT; ··· 16579 16443 if (test_bit(__I40E_SUSPENDED, pf->state)) 16580 16444 return; 16581 16445 16582 - i40e_handle_reset_warning(pf, false); 16583 - } 16584 - 16585 - /** 16586 - * i40e_enable_mc_magic_wake - enable multicast magic packet wake up 16587 - * using the mac_address_write admin q function 16588 - * @pf: pointer to i40e_pf struct 16589 - **/ 16590 - static void i40e_enable_mc_magic_wake(struct i40e_pf *pf) 16591 - { 16592 - struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); 16593 - struct i40e_hw *hw = &pf->hw; 16594 - u8 mac_addr[6]; 16595 - u16 flags = 0; 16596 - int ret; 16597 - 16598 - /* Get current MAC address in case it's an LAA */ 16599 - if (main_vsi && main_vsi->netdev) { 16600 - ether_addr_copy(mac_addr, main_vsi->netdev->dev_addr); 16601 - } else { 16602 - dev_err(&pf->pdev->dev, 16603 - "Failed to retrieve MAC address; using default\n"); 16604 - ether_addr_copy(mac_addr, hw->mac.addr); 16605 - } 16606 - 16607 - /* The FW expects the mac address write cmd to first be called with 16608 - * one of these flags before calling it again with the multicast 16609 - * enable flags. 16610 - */ 16611 - flags = I40E_AQC_WRITE_TYPE_LAA_WOL; 16612 - 16613 - if (hw->func_caps.flex10_enable && hw->partition_id != 1) 16614 - flags = I40E_AQC_WRITE_TYPE_LAA_ONLY; 16615 - 16616 - ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16617 - if (ret) { 16618 - dev_err(&pf->pdev->dev, 16619 - "Failed to update MAC address registers; cannot enable Multicast Magic packet wake up"); 16620 - return; 16621 - } 16622 - 16623 - flags = I40E_AQC_MC_MAG_EN 16624 - | I40E_AQC_WOL_PRESERVE_ON_PFR 16625 - | I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG; 16626 - ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16627 - if (ret) 16628 - dev_err(&pf->pdev->dev, 16629 - "Failed to enable Multicast Magic Packet wake up\n"); 16446 + i40e_io_resume(pf); 16630 16447 } 16631 16448 16632 16449 /** ··· 16641 16552 static int i40e_suspend(struct device *dev) 16642 16553 { 16643 16554 struct i40e_pf *pf = dev_get_drvdata(dev); 16644 - struct i40e_hw *hw = &pf->hw; 16645 16555 16646 16556 /* If we're already suspended, then there is nothing to do */ 16647 16557 if (test_and_set_bit(__I40E_SUSPENDED, pf->state)) 16648 16558 return 0; 16649 - 16650 - set_bit(__I40E_DOWN, pf->state); 16651 - 16652 - /* Ensure service task will not be running */ 16653 - del_timer_sync(&pf->service_timer); 16654 - cancel_work_sync(&pf->service_task); 16655 - 16656 - /* Client close must be called explicitly here because the timer 16657 - * has been stopped. 16658 - */ 16659 - i40e_notify_client_of_netdev_close(pf, false); 16660 - 16661 - if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && 16662 - pf->wol_en) 16663 - i40e_enable_mc_magic_wake(pf); 16664 - 16665 - /* Since we're going to destroy queues during the 16666 - * i40e_clear_interrupt_scheme() we should hold the RTNL lock for this 16667 - * whole section 16668 - */ 16669 - rtnl_lock(); 16670 - 16671 - i40e_prep_for_reset(pf); 16672 - 16673 - wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); 16674 - wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); 16675 - 16676 - /* Clear the interrupt scheme and release our IRQs so that the system 16677 - * can safely hibernate even when there are a large number of CPUs. 16678 - * Otherwise hibernation might fail when mapping all the vectors back 16679 - * to CPU0. 16680 - */ 16681 - i40e_clear_interrupt_scheme(pf); 16682 - 16683 - rtnl_unlock(); 16684 - 16685 - return 0; 16559 + return i40e_io_suspend(pf); 16686 16560 } 16687 16561 16688 16562 /** ··· 16655 16603 static int i40e_resume(struct device *dev) 16656 16604 { 16657 16605 struct i40e_pf *pf = dev_get_drvdata(dev); 16658 - int err; 16659 16606 16660 16607 /* If we're not suspended, then there is nothing to do */ 16661 16608 if (!test_bit(__I40E_SUSPENDED, pf->state)) 16662 16609 return 0; 16663 - 16664 - /* We need to hold the RTNL lock prior to restoring interrupt schemes, 16665 - * since we're going to be restoring queues 16666 - */ 16667 - rtnl_lock(); 16668 - 16669 - /* We cleared the interrupt scheme when we suspended, so we need to 16670 - * restore it now to resume device functionality. 16671 - */ 16672 - err = i40e_restore_interrupt_scheme(pf); 16673 - if (err) { 16674 - dev_err(dev, "Cannot restore interrupt scheme: %d\n", 16675 - err); 16676 - } 16677 - 16678 - clear_bit(__I40E_DOWN, pf->state); 16679 - i40e_reset_and_rebuild(pf, false, true); 16680 - 16681 - rtnl_unlock(); 16682 - 16683 - /* Clear suspended state last after everything is recovered */ 16684 - clear_bit(__I40E_SUSPENDED, pf->state); 16685 - 16686 - /* Restart the service task */ 16687 - mod_timer(&pf->service_timer, 16688 - round_jiffies(jiffies + pf->service_timer_period)); 16689 - 16690 - return 0; 16610 + return i40e_io_resume(pf); 16691 16611 } 16692 16612 16693 16613 static const struct pci_error_handlers i40e_err_handler = {
+22 -9
drivers/net/ethernet/intel/ice/devlink/devlink.c
··· 1388 1388 ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS, 1389 1389 }; 1390 1390 1391 - static const struct devlink_param ice_devlink_params[] = { 1391 + static const struct devlink_param ice_dvl_rdma_params[] = { 1392 1392 DEVLINK_PARAM_GENERIC(ENABLE_ROCE, BIT(DEVLINK_PARAM_CMODE_RUNTIME), 1393 1393 ice_devlink_enable_roce_get, 1394 1394 ice_devlink_enable_roce_set, ··· 1397 1397 ice_devlink_enable_iw_get, 1398 1398 ice_devlink_enable_iw_set, 1399 1399 ice_devlink_enable_iw_validate), 1400 + }; 1401 + 1402 + static const struct devlink_param ice_dvl_sched_params[] = { 1400 1403 DEVLINK_PARAM_DRIVER(ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS, 1401 1404 "tx_scheduling_layers", 1402 1405 DEVLINK_PARAM_TYPE_U8, ··· 1467 1464 { 1468 1465 struct devlink *devlink = priv_to_devlink(pf); 1469 1466 struct ice_hw *hw = &pf->hw; 1470 - size_t params_size; 1467 + int status; 1471 1468 1472 - params_size = ARRAY_SIZE(ice_devlink_params); 1469 + status = devl_params_register(devlink, ice_dvl_rdma_params, 1470 + ARRAY_SIZE(ice_dvl_rdma_params)); 1471 + if (status) 1472 + return status; 1473 1473 1474 - if (!hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) 1475 - params_size--; 1474 + if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) 1475 + status = devl_params_register(devlink, ice_dvl_sched_params, 1476 + ARRAY_SIZE(ice_dvl_sched_params)); 1476 1477 1477 - return devl_params_register(devlink, ice_devlink_params, 1478 - params_size); 1478 + return status; 1479 1479 } 1480 1480 1481 1481 void ice_devlink_unregister_params(struct ice_pf *pf) 1482 1482 { 1483 - devl_params_unregister(priv_to_devlink(pf), ice_devlink_params, 1484 - ARRAY_SIZE(ice_devlink_params)); 1483 + struct devlink *devlink = priv_to_devlink(pf); 1484 + struct ice_hw *hw = &pf->hw; 1485 + 1486 + devl_params_unregister(devlink, ice_dvl_rdma_params, 1487 + ARRAY_SIZE(ice_dvl_rdma_params)); 1488 + 1489 + if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) 1490 + devl_params_unregister(devlink, ice_dvl_sched_params, 1491 + ARRAY_SIZE(ice_dvl_sched_params)); 1485 1492 } 1486 1493 1487 1494 #define ICE_DEVLINK_READ_BLK_SIZE (1024 * 1024)
+10
drivers/net/ethernet/intel/ice/ice_common.c
··· 3148 3148 case ICE_PHY_TYPE_HIGH_100G_AUI2: 3149 3149 speed_phy_type_high = ICE_AQ_LINK_SPEED_100GB; 3150 3150 break; 3151 + case ICE_PHY_TYPE_HIGH_200G_CR4_PAM4: 3152 + case ICE_PHY_TYPE_HIGH_200G_SR4: 3153 + case ICE_PHY_TYPE_HIGH_200G_FR4: 3154 + case ICE_PHY_TYPE_HIGH_200G_LR4: 3155 + case ICE_PHY_TYPE_HIGH_200G_DR4: 3156 + case ICE_PHY_TYPE_HIGH_200G_KR4_PAM4: 3157 + case ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC: 3158 + case ICE_PHY_TYPE_HIGH_200G_AUI4: 3159 + speed_phy_type_high = ICE_AQ_LINK_SPEED_200GB; 3160 + break; 3151 3161 default: 3152 3162 speed_phy_type_high = ICE_AQ_LINK_SPEED_UNKNOWN; 3153 3163 break;
+6 -5
drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
··· 45 45 return -EINVAL; 46 46 47 47 err = ice_fltr_add_vlan(vsi, vlan); 48 - if (err && err != -EEXIST) { 48 + if (!err) 49 + vsi->num_vlan++; 50 + else if (err == -EEXIST) 51 + err = 0; 52 + else 49 53 dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %i, status %d\n", 50 54 vlan->vid, vsi->vsi_num, err); 51 - return err; 52 - } 53 55 54 - vsi->num_vlan++; 55 - return 0; 56 + return err; 56 57 } 57 58 58 59 /**
+1
drivers/net/ethernet/intel/idpf/idpf_lib.c
··· 1394 1394 } 1395 1395 1396 1396 idpf_rx_init_buf_tail(vport); 1397 + idpf_vport_intr_ena(vport); 1397 1398 1398 1399 err = idpf_send_config_queues_msg(vport); 1399 1400 if (err) {
+7 -5
drivers/net/ethernet/intel/idpf/idpf_txrx.c
··· 3746 3746 */ 3747 3747 void idpf_vport_intr_deinit(struct idpf_vport *vport) 3748 3748 { 3749 + idpf_vport_intr_dis_irq_all(vport); 3749 3750 idpf_vport_intr_napi_dis_all(vport); 3750 3751 idpf_vport_intr_napi_del_all(vport); 3751 - idpf_vport_intr_dis_irq_all(vport); 3752 3752 idpf_vport_intr_rel_irq(vport); 3753 3753 } 3754 3754 ··· 4179 4179 4180 4180 idpf_vport_intr_map_vector_to_qs(vport); 4181 4181 idpf_vport_intr_napi_add_all(vport); 4182 - idpf_vport_intr_napi_ena_all(vport); 4183 4182 4184 4183 err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport); 4185 4184 if (err) ··· 4192 4193 if (err) 4193 4194 goto unroll_vectors_alloc; 4194 4195 4195 - idpf_vport_intr_ena_irq_all(vport); 4196 - 4197 4196 return 0; 4198 4197 4199 4198 unroll_vectors_alloc: 4200 - idpf_vport_intr_napi_dis_all(vport); 4201 4199 idpf_vport_intr_napi_del_all(vport); 4202 4200 4203 4201 return err; 4202 + } 4203 + 4204 + void idpf_vport_intr_ena(struct idpf_vport *vport) 4205 + { 4206 + idpf_vport_intr_napi_ena_all(vport); 4207 + idpf_vport_intr_ena_irq_all(vport); 4204 4208 } 4205 4209 4206 4210 /**
+1
drivers/net/ethernet/intel/idpf/idpf_txrx.h
··· 990 990 void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector); 991 991 void idpf_vport_intr_deinit(struct idpf_vport *vport); 992 992 int idpf_vport_intr_init(struct idpf_vport *vport); 993 + void idpf_vport_intr_ena(struct idpf_vport *vport); 993 994 enum pkt_hash_types idpf_ptype_to_htype(const struct idpf_rx_ptype_decoded *decoded); 994 995 int idpf_config_rss(struct idpf_vport *vport); 995 996 int idpf_init_rss(struct idpf_vport *vport);
+4
drivers/net/ethernet/marvell/octeontx2/nic/qos.c
··· 1422 1422 otx2_qos_read_txschq_cfg(pfvf, node, old_cfg); 1423 1423 1424 1424 /* delete the txschq nodes allocated for this node */ 1425 + otx2_qos_disable_sq(pfvf, qid); 1426 + otx2_qos_free_hw_node_schq(pfvf, node); 1425 1427 otx2_qos_free_sw_node_schq(pfvf, node); 1428 + pfvf->qos.qid_to_sqmap[qid] = OTX2_QOS_INVALID_SQ; 1426 1429 1427 1430 /* mark this node as htb inner node */ 1428 1431 WRITE_ONCE(node->qid, OTX2_QOS_QID_INNER); ··· 1635 1632 dwrr_del_node = true; 1636 1633 1637 1634 /* destroy the leaf node */ 1635 + otx2_qos_disable_sq(pfvf, qid); 1638 1636 otx2_qos_destroy_node(pfvf, node); 1639 1637 pfvf->qos.qid_to_sqmap[qid] = OTX2_QOS_INVALID_SQ; 1640 1638
+7 -1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
··· 102 102 mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb) 103 103 { 104 104 int payload_len = skb_shinfo(skb)->gso_size + sizeof(struct udphdr); 105 + struct udphdr *udphdr; 105 106 106 - udp_hdr(skb)->len = htons(payload_len); 107 + if (skb->encapsulation) 108 + udphdr = (struct udphdr *)skb_inner_transport_header(skb); 109 + else 110 + udphdr = udp_hdr(skb); 111 + 112 + udphdr->len = htons(payload_len); 107 113 } 108 114 109 115 struct mlx5e_accel_tx_state {
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
··· 750 750 err_fs_ft: 751 751 if (rx->allow_tunnel_mode) 752 752 mlx5_eswitch_unblock_encap(mdev); 753 - mlx5_del_flow_rules(rx->status.rule); 754 - mlx5_modify_header_dealloc(mdev, rx->status.modify_hdr); 753 + mlx5_ipsec_rx_status_destroy(ipsec, rx); 755 754 err_add: 756 755 mlx5_destroy_flow_table(rx->ft.status); 757 756 err_fs_ft_status:
+5 -12
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
··· 97 97 if (!x || !x->xso.offload_handle) 98 98 goto out_disable; 99 99 100 - if (xo->inner_ipproto) { 101 - /* Cannot support tunnel packet over IPsec tunnel mode 102 - * because we cannot offload three IP header csum 103 - */ 104 - if (x->props.mode == XFRM_MODE_TUNNEL) 105 - goto out_disable; 106 - 107 - /* Only support UDP or TCP L4 checksum */ 108 - if (xo->inner_ipproto != IPPROTO_UDP && 109 - xo->inner_ipproto != IPPROTO_TCP) 110 - goto out_disable; 111 - } 100 + /* Only support UDP or TCP L4 checksum */ 101 + if (xo->inner_ipproto && 102 + xo->inner_ipproto != IPPROTO_UDP && 103 + xo->inner_ipproto != IPPROTO_TCP) 104 + goto out_disable; 112 105 113 106 return features; 114 107
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 3886 3886 mlx5e_fold_sw_stats64(priv, stats); 3887 3887 } 3888 3888 3889 - stats->rx_dropped = priv->stats.qcnt.rx_out_of_buffer; 3889 + stats->rx_missed_errors = priv->stats.qcnt.rx_out_of_buffer; 3890 3890 3891 3891 stats->rx_length_errors = 3892 3892 PPORT_802_3_GET(pstats, a_in_range_length_errors) +
+4
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 1186 1186 ts_stats->err = 0; 1187 1187 ts_stats->lost = 0; 1188 1188 1189 + if (!ptp) 1190 + goto out; 1191 + 1189 1192 /* Aggregate stats across all TCs */ 1190 1193 for (i = 0; i < ptp->num_tc; i++) { 1191 1194 struct mlx5e_ptp_cq_stats *stats = ··· 1217 1214 } 1218 1215 } 1219 1216 1217 + out: 1220 1218 mutex_unlock(&priv->state_lock); 1221 1219 } 1222 1220
+5 -1
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
··· 153 153 154 154 *hopbyhop = 0; 155 155 if (skb->encapsulation) { 156 - ihs = skb_inner_tcp_all_headers(skb); 156 + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) 157 + ihs = skb_inner_transport_offset(skb) + 158 + sizeof(struct udphdr); 159 + else 160 + ihs = skb_inner_tcp_all_headers(skb); 157 161 stats->tso_inner_packets++; 158 162 stats->tso_inner_bytes += skb->len - ihs; 159 163 } else {
+10 -2
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
··· 719 719 struct mlx5_core_dev *dev; 720 720 u8 mode; 721 721 #endif 722 + bool roce_support; 722 723 int i; 723 724 724 725 for (i = 0; i < ldev->ports; i++) ··· 744 743 if (mlx5_sriov_is_enabled(ldev->pf[i].dev)) 745 744 return false; 746 745 #endif 746 + roce_support = mlx5_get_roce_state(ldev->pf[MLX5_LAG_P1].dev); 747 + for (i = 1; i < ldev->ports; i++) 748 + if (mlx5_get_roce_state(ldev->pf[i].dev) != roce_support) 749 + return false; 750 + 747 751 return true; 748 752 } 749 753 ··· 916 910 } else if (roce_lag) { 917 911 dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV; 918 912 mlx5_rescan_drivers_locked(dev0); 919 - for (i = 1; i < ldev->ports; i++) 920 - mlx5_nic_vport_enable_roce(ldev->pf[i].dev); 913 + for (i = 1; i < ldev->ports; i++) { 914 + if (mlx5_get_roce_state(ldev->pf[i].dev)) 915 + mlx5_nic_vport_enable_roce(ldev->pf[i].dev); 916 + } 921 917 } else if (shared_fdb) { 922 918 int i; 923 919
+8 -4
drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c
··· 100 100 101 101 static bool mlx5_sd_is_supported(struct mlx5_core_dev *dev, u8 host_buses) 102 102 { 103 - /* Feature is currently implemented for PFs only */ 104 - if (!mlx5_core_is_pf(dev)) 105 - return false; 106 - 107 103 /* Honor the SW implementation limit */ 108 104 if (host_buses > MLX5_SD_MAX_GROUP_SZ) 109 105 return false; ··· 157 161 u32 group_id; 158 162 bool sdm; 159 163 int err; 164 + 165 + /* Feature is currently implemented for PFs only */ 166 + if (!mlx5_core_is_pf(dev)) 167 + return 0; 168 + 169 + /* Block on embedded CPU PFs */ 170 + if (mlx5_core_is_ecpf(dev)) 171 + return 0; 160 172 161 173 if (!MLX5_CAP_MCAM_REG(dev, mpir)) 162 174 return 0;
+1 -1
drivers/net/ethernet/ti/icssg/icssg_classifier.c
··· 455 455 { 456 456 const u8 mask_addr[] = { 0, 0, 0, 0, 0, 0, }; 457 457 458 - rx_class_ft1_set_start_len(miig_rt, slice, 0, 6); 458 + rx_class_ft1_set_start_len(miig_rt, slice, ETH_ALEN, ETH_ALEN); 459 459 rx_class_ft1_set_da(miig_rt, slice, 0, mac_addr); 460 460 rx_class_ft1_set_da_mask(miig_rt, slice, 0, mask_addr); 461 461 rx_class_ft1_cfg_set_type(miig_rt, slice, 0, FT1_CFG_TYPE_EQ);
+2 -2
drivers/net/ipvlan/ipvlan_core.c
··· 439 439 440 440 memset(IPCB(skb), 0, sizeof(*IPCB(skb))); 441 441 442 - err = ip_local_out(net, skb->sk, skb); 442 + err = ip_local_out(net, NULL, skb); 443 443 if (unlikely(net_xmit_eval(err))) 444 444 DEV_STATS_INC(dev, tx_errors); 445 445 else ··· 494 494 495 495 memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); 496 496 497 - err = ip6_local_out(dev_net(dev), skb->sk, skb); 497 + err = ip6_local_out(dev_net(dev), NULL, skb); 498 498 if (unlikely(net_xmit_eval(err))) 499 499 DEV_STATS_INC(dev, tx_errors); 500 500 else
+24 -6
drivers/net/netkit.c
··· 55 55 skb_scrub_packet(skb, xnet); 56 56 skb->priority = 0; 57 57 nf_skip_egress(skb, true); 58 + skb_reset_mac_header(skb); 58 59 } 59 60 60 61 static struct netkit *netkit_priv(const struct net_device *dev) ··· 79 78 skb_orphan_frags(skb, GFP_ATOMIC))) 80 79 goto drop; 81 80 netkit_prep_forward(skb, !net_eq(dev_net(dev), dev_net(peer))); 81 + eth_skb_pkt_type(skb, peer); 82 82 skb->dev = peer; 83 83 entry = rcu_dereference(nk->active); 84 84 if (entry) ··· 87 85 switch (ret) { 88 86 case NETKIT_NEXT: 89 87 case NETKIT_PASS: 90 - skb->protocol = eth_type_trans(skb, skb->dev); 88 + eth_skb_pull_mac(skb); 91 89 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); 92 90 if (likely(__netif_rx(skb) == NET_RX_SUCCESS)) { 93 91 dev_sw_netstats_tx_add(dev, 1, len); ··· 157 155 /* Nothing to do, we receive whatever gets pushed to us! */ 158 156 } 159 157 158 + static int netkit_set_macaddr(struct net_device *dev, void *sa) 159 + { 160 + struct netkit *nk = netkit_priv(dev); 161 + 162 + if (nk->mode != NETKIT_L2) 163 + return -EOPNOTSUPP; 164 + 165 + return eth_mac_addr(dev, sa); 166 + } 167 + 160 168 static void netkit_set_headroom(struct net_device *dev, int headroom) 161 169 { 162 170 struct netkit *nk = netkit_priv(dev), *nk2; ··· 210 198 .ndo_start_xmit = netkit_xmit, 211 199 .ndo_set_rx_mode = netkit_set_multicast, 212 200 .ndo_set_rx_headroom = netkit_set_headroom, 201 + .ndo_set_mac_address = netkit_set_macaddr, 213 202 .ndo_get_iflink = netkit_get_iflink, 214 203 .ndo_get_peer_dev = netkit_peer_dev, 215 204 .ndo_get_stats64 = netkit_get_stats, ··· 313 300 314 301 if (!attr) 315 302 return 0; 316 - NL_SET_ERR_MSG_ATTR(extack, attr, 317 - "Setting Ethernet address is not supported"); 318 - return -EOPNOTSUPP; 303 + if (nla_len(attr) != ETH_ALEN) 304 + return -EINVAL; 305 + if (!is_valid_ether_addr(nla_data(attr))) 306 + return -EADDRNOTAVAIL; 307 + return 0; 319 308 } 320 309 321 310 static struct rtnl_link_ops netkit_link_ops; ··· 380 365 strscpy(ifname, "nk%d", IFNAMSIZ); 381 366 ifname_assign_type = NET_NAME_ENUM; 382 367 } 368 + if (mode != NETKIT_L2 && 369 + (tb[IFLA_ADDRESS] || tbp[IFLA_ADDRESS])) 370 + return -EOPNOTSUPP; 383 371 384 372 net = rtnl_link_get_net(src_net, tbp); 385 373 if (IS_ERR(net)) ··· 397 379 398 380 netif_inherit_tso_max(peer, dev); 399 381 400 - if (mode == NETKIT_L2) 382 + if (mode == NETKIT_L2 && !(ifmp && tbp[IFLA_ADDRESS])) 401 383 eth_hw_addr_random(peer); 402 384 if (ifmp && dev->ifindex) 403 385 peer->ifindex = ifmp->ifi_index; ··· 420 402 if (err < 0) 421 403 goto err_configure_peer; 422 404 423 - if (mode == NETKIT_L2) 405 + if (mode == NETKIT_L2 && !tb[IFLA_ADDRESS]) 424 406 eth_hw_addr_random(dev); 425 407 if (tb[IFLA_IFNAME]) 426 408 nla_strscpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
+10 -1
drivers/net/phy/micrel.c
··· 4029 4029 4030 4030 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 4031 4031 err = phy_read(phydev, LAN8814_INTS); 4032 - if (err) 4032 + if (err < 0) 4033 4033 return err; 4034 4034 4035 4035 /* Enable / disable interrupts. It is OK to enable PTP interrupt ··· 4045 4045 return err; 4046 4046 4047 4047 err = phy_read(phydev, LAN8814_INTS); 4048 + if (err < 0) 4049 + return err; 4050 + 4051 + /* Getting a positive value doesn't mean that is an error, it 4052 + * just indicates what was the status. Therefore make sure to 4053 + * clear the value and say that there is no error. 4054 + */ 4055 + err = 0; 4048 4056 } 4049 4057 4050 4058 return err; ··· 5335 5327 /* PHY_BASIC_FEATURES */ 5336 5328 .probe = kszphy_probe, 5337 5329 .config_init = ksz8061_config_init, 5330 + .soft_reset = genphy_soft_reset, 5338 5331 .config_intr = kszphy_config_intr, 5339 5332 .handle_interrupt = kszphy_handle_interrupt, 5340 5333 .suspend = kszphy_suspend,
+7 -4
drivers/net/usb/smsc95xx.c
··· 879 879 static int smsc95xx_reset(struct usbnet *dev) 880 880 { 881 881 struct smsc95xx_priv *pdata = dev->driver_priv; 882 - u32 read_buf, write_buf, burst_cap; 882 + u32 read_buf, burst_cap; 883 883 int ret = 0, timeout; 884 884 885 885 netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n"); ··· 1003 1003 return ret; 1004 1004 netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf); 1005 1005 1006 + ret = smsc95xx_read_reg(dev, LED_GPIO_CFG, &read_buf); 1007 + if (ret < 0) 1008 + return ret; 1006 1009 /* Configure GPIO pins as LED outputs */ 1007 - write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED | 1008 - LED_GPIO_CFG_FDX_LED; 1009 - ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf); 1010 + read_buf |= LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED | 1011 + LED_GPIO_CFG_FDX_LED; 1012 + ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, read_buf); 1010 1013 if (ret < 0) 1011 1014 return ret; 1012 1015
+4
drivers/nfc/virtual_ncidev.c
··· 125 125 kfree_skb(skb); 126 126 return -EFAULT; 127 127 } 128 + if (strnlen(skb->data, count) != count) { 129 + kfree_skb(skb); 130 + return -EINVAL; 131 + } 128 132 129 133 nci_recv_frame(vdev->ndev, skb); 130 134 return count;
+8
include/linux/etherdevice.h
··· 636 636 } 637 637 } 638 638 639 + static inline struct ethhdr *eth_skb_pull_mac(struct sk_buff *skb) 640 + { 641 + struct ethhdr *eth = (struct ethhdr *)skb->data; 642 + 643 + skb_pull_inline(skb, ETH_HLEN); 644 + return eth; 645 + } 646 + 639 647 /** 640 648 * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame 641 649 * @skb: Buffer to pad
+2 -2
include/linux/mlx5/mlx5_ifc.h
··· 10308 10308 u8 mfrl[0x1]; 10309 10309 u8 regs_39_to_32[0x8]; 10310 10310 10311 - u8 regs_31_to_10[0x16]; 10311 + u8 regs_31_to_11[0x15]; 10312 10312 u8 mtmp[0x1]; 10313 - u8 regs_8_to_0[0x9]; 10313 + u8 regs_9_to_0[0xa]; 10314 10314 }; 10315 10315 10316 10316 struct mlx5_ifc_mcam_access_reg_bits1 {
+1 -1
include/net/dst_ops.h
··· 24 24 void (*destroy)(struct dst_entry *); 25 25 void (*ifdown)(struct dst_entry *, 26 26 struct net_device *dev); 27 - struct dst_entry * (*negative_advice)(struct dst_entry *); 27 + void (*negative_advice)(struct sock *sk, struct dst_entry *); 28 28 void (*link_failure)(struct sk_buff *); 29 29 void (*update_pmtu)(struct dst_entry *dst, struct sock *sk, 30 30 struct sk_buff *skb, u32 mtu,
+3 -2
include/net/page_pool/types.h
··· 45 45 46 46 /** 47 47 * struct page_pool_params - page pool parameters 48 + * @fast: params accessed frequently on hotpath 48 49 * @order: 2^order pages on allocation 49 50 * @pool_size: size of the ptr_ring 50 51 * @nid: NUMA node id to allocate from pages from 51 52 * @dev: device, for DMA pre-mapping purposes 52 - * @netdev: netdev this pool will serve (leave as NULL if none or multiple) 53 53 * @napi: NAPI which is the sole consumer of pages, otherwise NULL 54 54 * @dma_dir: DMA mapping direction 55 55 * @max_len: max DMA sync memory size for PP_FLAG_DMA_SYNC_DEV 56 56 * @offset: DMA sync address offset for PP_FLAG_DMA_SYNC_DEV 57 - * @netdev: corresponding &net_device for Netlink introspection 57 + * @slow: params with slowpath access only (initialization and Netlink) 58 + * @netdev: netdev this pool will serve (leave as NULL if none or multiple) 58 59 * @flags: PP_FLAG_DMA_MAP, PP_FLAG_DMA_SYNC_DEV, PP_FLAG_SYSTEM_POOL 59 60 */ 60 61 struct page_pool_params {
+12
include/net/request_sock.h
··· 285 285 return atomic_read(&queue->young); 286 286 } 287 287 288 + /* RFC 7323 2.3 Using the Window Scale Option 289 + * The window field (SEG.WND) of every outgoing segment, with the 290 + * exception of <SYN> segments, MUST be right-shifted by 291 + * Rcv.Wind.Shift bits. 292 + * 293 + * This means the SEG.WND carried in SYNACK can not exceed 65535. 294 + * We use this property to harden TCP stack while in NEW_SYN_RECV state. 295 + */ 296 + static inline u32 tcp_synack_window(const struct request_sock *req) 297 + { 298 + return min(req->rsk_rcv_wnd, 65535U); 299 + } 288 300 #endif /* _REQUEST_SOCK_H */
+3 -10
include/net/sock.h
··· 2063 2063 2064 2064 static inline void __dst_negative_advice(struct sock *sk) 2065 2065 { 2066 - struct dst_entry *ndst, *dst = __sk_dst_get(sk); 2066 + struct dst_entry *dst = __sk_dst_get(sk); 2067 2067 2068 - if (dst && dst->ops->negative_advice) { 2069 - ndst = dst->ops->negative_advice(dst); 2070 - 2071 - if (ndst != dst) { 2072 - rcu_assign_pointer(sk->sk_dst_cache, ndst); 2073 - sk_tx_queue_clear(sk); 2074 - WRITE_ONCE(sk->sk_dst_pending_confirm, 0); 2075 - } 2076 - } 2068 + if (dst && dst->ops->negative_advice) 2069 + dst->ops->negative_advice(sk, dst); 2077 2070 } 2078 2071 2079 2072 static inline void dst_negative_advice(struct sock *sk)
+1 -2
include/uapi/linux/cn_proc.h
··· 69 69 70 70 static inline enum proc_cn_event valid_event(enum proc_cn_event ev_type) 71 71 { 72 - ev_type &= PROC_EVENT_ALL; 73 - return ev_type; 72 + return (enum proc_cn_event)(ev_type & PROC_EVENT_ALL); 74 73 } 75 74 76 75 /*
+1
include/uapi/linux/netdev.h
··· 148 148 NETDEV_A_QSTATS_RX_ALLOC_FAIL, 149 149 NETDEV_A_QSTATS_RX_HW_DROPS, 150 150 NETDEV_A_QSTATS_RX_HW_DROP_OVERRUNS, 151 + NETDEV_A_QSTATS_RX_CSUM_COMPLETE, 151 152 NETDEV_A_QSTATS_RX_CSUM_UNNECESSARY, 152 153 NETDEV_A_QSTATS_RX_CSUM_NONE, 153 154 NETDEV_A_QSTATS_RX_CSUM_BAD,
+7 -3
kernel/bpf/verifier.c
··· 8882 8882 enum bpf_attach_type eatype = env->prog->expected_attach_type; 8883 8883 enum bpf_prog_type type = resolve_prog_type(env->prog); 8884 8884 8885 - if (func_id != BPF_FUNC_map_update_elem) 8885 + if (func_id != BPF_FUNC_map_update_elem && 8886 + func_id != BPF_FUNC_map_delete_elem) 8886 8887 return false; 8887 8888 8888 8889 /* It's not possible to get access to a locked struct sock in these ··· 8892 8891 switch (type) { 8893 8892 case BPF_PROG_TYPE_TRACING: 8894 8893 if (eatype == BPF_TRACE_ITER) 8894 + return true; 8895 + break; 8896 + case BPF_PROG_TYPE_SOCK_OPS: 8897 + /* map_update allowed only via dedicated helpers with event type checks */ 8898 + if (func_id == BPF_FUNC_map_delete_elem) 8895 8899 return true; 8896 8900 break; 8897 8901 case BPF_PROG_TYPE_SOCKET_FILTER: ··· 8994 8988 case BPF_MAP_TYPE_SOCKMAP: 8995 8989 if (func_id != BPF_FUNC_sk_redirect_map && 8996 8990 func_id != BPF_FUNC_sock_map_update && 8997 - func_id != BPF_FUNC_map_delete_elem && 8998 8991 func_id != BPF_FUNC_msg_redirect_map && 8999 8992 func_id != BPF_FUNC_sk_select_reuseport && 9000 8993 func_id != BPF_FUNC_map_lookup_elem && ··· 9003 8998 case BPF_MAP_TYPE_SOCKHASH: 9004 8999 if (func_id != BPF_FUNC_sk_redirect_hash && 9005 9000 func_id != BPF_FUNC_sock_hash_update && 9006 - func_id != BPF_FUNC_map_delete_elem && 9007 9001 func_id != BPF_FUNC_msg_redirect_hash && 9008 9002 func_id != BPF_FUNC_sk_select_reuseport && 9009 9003 func_id != BPF_FUNC_map_lookup_elem &&
+4 -6
kernel/trace/bpf_trace.c
··· 3295 3295 struct bpf_run_ctx *old_run_ctx; 3296 3296 int err = 0; 3297 3297 3298 - if (link->task && current != link->task) 3298 + if (link->task && current->mm != link->task->mm) 3299 3299 return 0; 3300 3300 3301 3301 if (sleepable) ··· 3396 3396 upath = u64_to_user_ptr(attr->link_create.uprobe_multi.path); 3397 3397 uoffsets = u64_to_user_ptr(attr->link_create.uprobe_multi.offsets); 3398 3398 cnt = attr->link_create.uprobe_multi.cnt; 3399 + pid = attr->link_create.uprobe_multi.pid; 3399 3400 3400 - if (!upath || !uoffsets || !cnt) 3401 + if (!upath || !uoffsets || !cnt || pid < 0) 3401 3402 return -EINVAL; 3402 3403 if (cnt > MAX_UPROBE_MULTI_CNT) 3403 3404 return -E2BIG; ··· 3422 3421 goto error_path_put; 3423 3422 } 3424 3423 3425 - pid = attr->link_create.uprobe_multi.pid; 3426 3424 if (pid) { 3427 - rcu_read_lock(); 3428 - task = get_pid_task(find_vpid(pid), PIDTYPE_PID); 3429 - rcu_read_unlock(); 3425 + task = get_pid_task(find_vpid(pid), PIDTYPE_TGID); 3430 3426 if (!task) { 3431 3427 err = -ESRCH; 3432 3428 goto error_path_put;
+10 -12
net/core/sock_map.c
··· 423 423 struct sock *sk; 424 424 int err = 0; 425 425 426 - if (irqs_disabled()) 427 - return -EOPNOTSUPP; /* locks here are hardirq-unsafe */ 428 - 429 426 spin_lock_bh(&stab->lock); 430 427 sk = *psk; 431 428 if (!sk_test || sk_test == sk) ··· 944 947 struct bpf_shtab_bucket *bucket; 945 948 struct bpf_shtab_elem *elem; 946 949 int ret = -ENOENT; 947 - 948 - if (irqs_disabled()) 949 - return -EOPNOTSUPP; /* locks here are hardirq-unsafe */ 950 950 951 951 hash = sock_hash_bucket_hash(key, key_size); 952 952 bucket = sock_hash_select_bucket(htab, hash); ··· 1674 1680 1675 1681 lock_sock(sk); 1676 1682 rcu_read_lock(); 1677 - psock = sk_psock_get(sk); 1678 - if (unlikely(!psock)) { 1679 - rcu_read_unlock(); 1680 - release_sock(sk); 1681 - saved_close = READ_ONCE(sk->sk_prot)->close; 1682 - } else { 1683 + psock = sk_psock(sk); 1684 + if (likely(psock)) { 1683 1685 saved_close = psock->saved_close; 1684 1686 sock_map_remove_links(sk, psock); 1687 + psock = sk_psock_get(sk); 1688 + if (unlikely(!psock)) 1689 + goto no_psock; 1685 1690 rcu_read_unlock(); 1686 1691 sk_psock_stop(psock); 1687 1692 release_sock(sk); 1688 1693 cancel_delayed_work_sync(&psock->work); 1689 1694 sk_psock_put(sk, psock); 1695 + } else { 1696 + saved_close = READ_ONCE(sk->sk_prot)->close; 1697 + no_psock: 1698 + rcu_read_unlock(); 1699 + release_sock(sk); 1690 1700 } 1691 1701 1692 1702 /* Make sure we do not recurse. This is a bug.
+1 -3
net/ethernet/eth.c
··· 161 161 skb->dev = dev; 162 162 skb_reset_mac_header(skb); 163 163 164 - eth = (struct ethhdr *)skb->data; 165 - skb_pull_inline(skb, ETH_HLEN); 166 - 164 + eth = eth_skb_pull_mac(skb); 167 165 eth_skb_pkt_type(skb, dev); 168 166 169 167 /*
+1 -1
net/ipv4/af_inet.c
··· 1532 1532 } 1533 1533 1534 1534 NAPI_GRO_CB(skb)->flush |= flush; 1535 - NAPI_GRO_CB(skb)->inner_network_offset = off; 1535 + NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark] = off; 1536 1536 1537 1537 /* Note : No need to call skb_gro_postpull_rcsum() here, 1538 1538 * as we already checked checksum over ipv4 header was 0
+4 -3
net/ipv4/devinet.c
··· 1887 1887 goto done; 1888 1888 1889 1889 if (fillargs.ifindex) { 1890 - err = -ENODEV; 1891 1890 dev = dev_get_by_index_rcu(tgt_net, fillargs.ifindex); 1892 - if (!dev) 1891 + if (!dev) { 1892 + err = -ENODEV; 1893 1893 goto done; 1894 + } 1894 1895 in_dev = __in_dev_get_rcu(dev); 1895 1896 if (!in_dev) 1896 1897 goto done; ··· 1903 1902 1904 1903 cb->seq = inet_base_seq(tgt_net); 1905 1904 1906 - for_each_netdev_dump(net, dev, ctx->ifindex) { 1905 + for_each_netdev_dump(tgt_net, dev, ctx->ifindex) { 1907 1906 in_dev = __in_dev_get_rcu(dev); 1908 1907 if (!in_dev) 1909 1908 continue;
+2
net/ipv4/netfilter/nf_tproxy_ipv4.c
··· 58 58 59 59 laddr = 0; 60 60 indev = __in_dev_get_rcu(skb->dev); 61 + if (!indev) 62 + return daddr; 61 63 62 64 in_dev_for_each_ifa_rcu(ifa, indev) { 63 65 if (ifa->ifa_flags & IFA_F_SECONDARY)
+8 -14
net/ipv4/route.c
··· 129 129 static unsigned int ipv4_default_advmss(const struct dst_entry *dst); 130 130 INDIRECT_CALLABLE_SCOPE 131 131 unsigned int ipv4_mtu(const struct dst_entry *dst); 132 - static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); 132 + static void ipv4_negative_advice(struct sock *sk, 133 + struct dst_entry *dst); 133 134 static void ipv4_link_failure(struct sk_buff *skb); 134 135 static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, 135 136 struct sk_buff *skb, u32 mtu, ··· 826 825 __ip_do_redirect(rt, skb, &fl4, true); 827 826 } 828 827 829 - static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) 828 + static void ipv4_negative_advice(struct sock *sk, 829 + struct dst_entry *dst) 830 830 { 831 831 struct rtable *rt = dst_rtable(dst); 832 - struct dst_entry *ret = dst; 833 832 834 - if (rt) { 835 - if (dst->obsolete > 0) { 836 - ip_rt_put(rt); 837 - ret = NULL; 838 - } else if ((rt->rt_flags & RTCF_REDIRECTED) || 839 - rt->dst.expires) { 840 - ip_rt_put(rt); 841 - ret = NULL; 842 - } 843 - } 844 - return ret; 833 + if ((dst->obsolete > 0) || 834 + (rt->rt_flags & RTCF_REDIRECTED) || 835 + rt->dst.expires) 836 + sk_dst_reset(sk); 845 837 } 846 838 847 839 /*
+1 -6
net/ipv4/tcp_ipv4.c
··· 1144 1144 #endif 1145 1145 } 1146 1146 1147 - /* RFC 7323 2.3 1148 - * The window field (SEG.WND) of every outgoing segment, with the 1149 - * exception of <SYN> segments, MUST be right-shifted by 1150 - * Rcv.Wind.Shift bits: 1151 - */ 1152 1147 tcp_v4_send_ack(sk, skb, seq, 1153 1148 tcp_rsk(req)->rcv_nxt, 1154 - req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, 1149 + tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale, 1155 1150 tcp_rsk_tsval(tcp_rsk(req)), 1156 1151 READ_ONCE(req->ts_recent), 1157 1152 0, &key,
+5 -2
net/ipv4/tcp_minisocks.c
··· 783 783 784 784 /* RFC793: "first check sequence number". */ 785 785 786 - if (paws_reject || !tcp_in_window(TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq, 787 - tcp_rsk(req)->rcv_nxt, tcp_rsk(req)->rcv_nxt + req->rsk_rcv_wnd)) { 786 + if (paws_reject || !tcp_in_window(TCP_SKB_CB(skb)->seq, 787 + TCP_SKB_CB(skb)->end_seq, 788 + tcp_rsk(req)->rcv_nxt, 789 + tcp_rsk(req)->rcv_nxt + 790 + tcp_synack_window(req))) { 788 791 /* Out of window: send ACK and drop. */ 789 792 if (!(flg & TCP_FLAG_RST) && 790 793 !tcp_oow_rate_limited(sock_net(sk), skb,
+1 -1
net/ipv6/ip6_offload.c
··· 236 236 if (unlikely(!iph)) 237 237 goto out; 238 238 239 - NAPI_GRO_CB(skb)->inner_network_offset = off; 239 + NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark] = off; 240 240 241 241 flush += ntohs(iph->payload_len) != skb->len - hlen; 242 242
+15 -14
net/ipv6/route.c
··· 87 87 static unsigned int ip6_default_advmss(const struct dst_entry *dst); 88 88 INDIRECT_CALLABLE_SCOPE 89 89 unsigned int ip6_mtu(const struct dst_entry *dst); 90 - static struct dst_entry *ip6_negative_advice(struct dst_entry *); 90 + static void ip6_negative_advice(struct sock *sk, 91 + struct dst_entry *dst); 91 92 static void ip6_dst_destroy(struct dst_entry *); 92 93 static void ip6_dst_ifdown(struct dst_entry *, 93 94 struct net_device *dev); ··· 2771 2770 } 2772 2771 EXPORT_INDIRECT_CALLABLE(ip6_dst_check); 2773 2772 2774 - static struct dst_entry *ip6_negative_advice(struct dst_entry *dst) 2773 + static void ip6_negative_advice(struct sock *sk, 2774 + struct dst_entry *dst) 2775 2775 { 2776 2776 struct rt6_info *rt = dst_rt6_info(dst); 2777 2777 2778 - if (rt) { 2779 - if (rt->rt6i_flags & RTF_CACHE) { 2780 - rcu_read_lock(); 2781 - if (rt6_check_expired(rt)) { 2782 - rt6_remove_exception_rt(rt); 2783 - dst = NULL; 2784 - } 2785 - rcu_read_unlock(); 2786 - } else { 2787 - dst_release(dst); 2788 - dst = NULL; 2778 + if (rt->rt6i_flags & RTF_CACHE) { 2779 + rcu_read_lock(); 2780 + if (rt6_check_expired(rt)) { 2781 + /* counteract the dst_release() in sk_dst_reset() */ 2782 + dst_hold(dst); 2783 + sk_dst_reset(sk); 2784 + 2785 + rt6_remove_exception_rt(rt); 2789 2786 } 2787 + rcu_read_unlock(); 2788 + return; 2790 2789 } 2791 - return dst; 2790 + sk_dst_reset(sk); 2792 2791 } 2793 2792 2794 2793 static void ip6_link_failure(struct sk_buff *skb)
+1 -6
net/ipv6/tcp_ipv6.c
··· 1272 1272 /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV 1273 1273 * sk->sk_state == TCP_SYN_RECV -> for Fast Open. 1274 1274 */ 1275 - /* RFC 7323 2.3 1276 - * The window field (SEG.WND) of every outgoing segment, with the 1277 - * exception of <SYN> segments, MUST be right-shifted by 1278 - * Rcv.Wind.Shift bits: 1279 - */ 1280 1275 tcp_v6_send_ack(sk, skb, (sk->sk_state == TCP_LISTEN) ? 1281 1276 tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, 1282 1277 tcp_rsk(req)->rcv_nxt, 1283 - req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, 1278 + tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale, 1284 1279 tcp_rsk_tsval(tcp_rsk(req)), 1285 1280 READ_ONCE(req->ts_recent), sk->sk_bound_dev_if, 1286 1281 &key, ipv6_get_dsfield(ipv6_hdr(skb)), 0,
+3
net/netfilter/ipset/ip_set_list_set.c
··· 549 549 550 550 if (SET_WITH_TIMEOUT(set)) 551 551 timer_shutdown_sync(&map->gc); 552 + 553 + /* Flush list to drop references to other ipsets */ 554 + list_set_flush(set); 552 555 } 553 556 554 557 static const struct ip_set_type_variant set_variant = {
+3 -5
net/netfilter/nft_fib.c
··· 35 35 switch (priv->result) { 36 36 case NFT_FIB_RESULT_OIF: 37 37 case NFT_FIB_RESULT_OIFNAME: 38 - hooks = (1 << NF_INET_PRE_ROUTING); 39 - if (priv->flags & NFTA_FIB_F_IIF) { 40 - hooks |= (1 << NF_INET_LOCAL_IN) | 41 - (1 << NF_INET_FORWARD); 42 - } 38 + hooks = (1 << NF_INET_PRE_ROUTING) | 39 + (1 << NF_INET_LOCAL_IN) | 40 + (1 << NF_INET_FORWARD); 43 41 break; 44 42 case NFT_FIB_RESULT_ADDRTYPE: 45 43 if (priv->flags & NFTA_FIB_F_IIF)
+72 -23
net/netfilter/nft_payload.c
··· 45 45 int mac_off = skb_mac_header(skb) - skb->data; 46 46 u8 *vlanh, *dst_u8 = (u8 *) d; 47 47 struct vlan_ethhdr veth; 48 - u8 vlan_hlen = 0; 49 - 50 - if ((skb->protocol == htons(ETH_P_8021AD) || 51 - skb->protocol == htons(ETH_P_8021Q)) && 52 - offset >= VLAN_ETH_HLEN && offset < VLAN_ETH_HLEN + VLAN_HLEN) 53 - vlan_hlen += VLAN_HLEN; 54 48 55 49 vlanh = (u8 *) &veth; 56 - if (offset < VLAN_ETH_HLEN + vlan_hlen) { 50 + if (offset < VLAN_ETH_HLEN) { 57 51 u8 ethlen = len; 58 52 59 - if (vlan_hlen && 60 - skb_copy_bits(skb, mac_off, &veth, VLAN_ETH_HLEN) < 0) 61 - return false; 62 - else if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth)) 53 + if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth)) 63 54 return false; 64 55 65 - if (offset + len > VLAN_ETH_HLEN + vlan_hlen) 66 - ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen; 56 + if (offset + len > VLAN_ETH_HLEN) 57 + ethlen -= offset + len - VLAN_ETH_HLEN; 67 58 68 - memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen); 59 + memcpy(dst_u8, vlanh + offset, ethlen); 69 60 70 61 len -= ethlen; 71 62 if (len == 0) 72 63 return true; 73 64 74 65 dst_u8 += ethlen; 75 - offset = ETH_HLEN + vlan_hlen; 66 + offset = ETH_HLEN; 76 67 } else { 77 - offset -= VLAN_HLEN + vlan_hlen; 68 + offset -= VLAN_HLEN; 78 69 } 79 70 80 71 return skb_copy_bits(skb, offset + mac_off, dst_u8, len) == 0; ··· 145 154 return pkt->inneroff; 146 155 } 147 156 148 - static bool nft_payload_need_vlan_copy(const struct nft_payload *priv) 157 + static bool nft_payload_need_vlan_adjust(u32 offset, u32 len) 149 158 { 150 - unsigned int len = priv->offset + priv->len; 159 + unsigned int boundary = offset + len; 151 160 152 161 /* data past ether src/dst requested, copy needed */ 153 - if (len > offsetof(struct ethhdr, h_proto)) 162 + if (boundary > offsetof(struct ethhdr, h_proto)) 154 163 return true; 155 164 156 165 return false; ··· 174 183 goto err; 175 184 176 185 if (skb_vlan_tag_present(skb) && 177 - nft_payload_need_vlan_copy(priv)) { 186 + nft_payload_need_vlan_adjust(priv->offset, priv->len)) { 178 187 if (!nft_payload_copy_vlan(dest, skb, 179 188 priv->offset, priv->len)) 180 189 goto err; ··· 801 810 u8 csum_flags; 802 811 }; 803 812 813 + /* This is not struct vlan_hdr. */ 814 + struct nft_payload_vlan_hdr { 815 + __be16 h_vlan_proto; 816 + __be16 h_vlan_TCI; 817 + }; 818 + 819 + static bool 820 + nft_payload_set_vlan(const u32 *src, struct sk_buff *skb, u8 offset, u8 len, 821 + int *vlan_hlen) 822 + { 823 + struct nft_payload_vlan_hdr *vlanh; 824 + __be16 vlan_proto; 825 + u16 vlan_tci; 826 + 827 + if (offset >= offsetof(struct vlan_ethhdr, h_vlan_encapsulated_proto)) { 828 + *vlan_hlen = VLAN_HLEN; 829 + return true; 830 + } 831 + 832 + switch (offset) { 833 + case offsetof(struct vlan_ethhdr, h_vlan_proto): 834 + if (len == 2) { 835 + vlan_proto = nft_reg_load_be16(src); 836 + skb->vlan_proto = vlan_proto; 837 + } else if (len == 4) { 838 + vlanh = (struct nft_payload_vlan_hdr *)src; 839 + __vlan_hwaccel_put_tag(skb, vlanh->h_vlan_proto, 840 + ntohs(vlanh->h_vlan_TCI)); 841 + } else { 842 + return false; 843 + } 844 + break; 845 + case offsetof(struct vlan_ethhdr, h_vlan_TCI): 846 + if (len != 2) 847 + return false; 848 + 849 + vlan_tci = ntohs(nft_reg_load_be16(src)); 850 + skb->vlan_tci = vlan_tci; 851 + break; 852 + default: 853 + return false; 854 + } 855 + 856 + return true; 857 + } 858 + 804 859 static void nft_payload_set_eval(const struct nft_expr *expr, 805 860 struct nft_regs *regs, 806 861 const struct nft_pktinfo *pkt) 807 862 { 808 863 const struct nft_payload_set *priv = nft_expr_priv(expr); 809 - struct sk_buff *skb = pkt->skb; 810 864 const u32 *src = &regs->data[priv->sreg]; 811 - int offset, csum_offset; 865 + int offset, csum_offset, vlan_hlen = 0; 866 + struct sk_buff *skb = pkt->skb; 812 867 __wsum fsum, tsum; 813 868 814 869 switch (priv->base) { 815 870 case NFT_PAYLOAD_LL_HEADER: 816 871 if (!skb_mac_header_was_set(skb)) 817 872 goto err; 818 - offset = skb_mac_header(skb) - skb->data; 873 + 874 + if (skb_vlan_tag_present(skb) && 875 + nft_payload_need_vlan_adjust(priv->offset, priv->len)) { 876 + if (!nft_payload_set_vlan(src, skb, 877 + priv->offset, priv->len, 878 + &vlan_hlen)) 879 + goto err; 880 + 881 + if (!vlan_hlen) 882 + return; 883 + } 884 + 885 + offset = skb_mac_header(skb) - skb->data - vlan_hlen; 819 886 break; 820 887 case NFT_PAYLOAD_NETWORK_HEADER: 821 888 offset = skb_network_offset(skb);
+8 -6
net/sched/sch_taprio.c
··· 1151 1151 list_for_each_entry(entry, &new->entries, list) 1152 1152 cycle = ktime_add_ns(cycle, entry->interval); 1153 1153 1154 - if (!cycle) { 1155 - NL_SET_ERR_MSG(extack, "'cycle_time' can never be 0"); 1156 - return -EINVAL; 1157 - } 1158 - 1159 1154 if (cycle < 0 || cycle > INT_MAX) { 1160 1155 NL_SET_ERR_MSG(extack, "'cycle_time' is too big"); 1161 1156 return -EINVAL; 1162 1157 } 1163 1158 1164 1159 new->cycle_time = cycle; 1160 + } 1161 + 1162 + if (new->cycle_time < new->num_entries * length_to_duration(q, ETH_ZLEN)) { 1163 + NL_SET_ERR_MSG(extack, "'cycle_time' is too small"); 1164 + return -EINVAL; 1165 1165 } 1166 1166 1167 1167 taprio_calculate_gate_durations(q, new); ··· 1848 1848 } 1849 1849 q->flags = taprio_flags; 1850 1850 1851 + /* Needed for length_to_duration() during netlink attribute parsing */ 1852 + taprio_set_picos_per_byte(dev, q); 1853 + 1851 1854 err = taprio_parse_mqprio_opt(dev, mqprio, extack, q->flags); 1852 1855 if (err < 0) 1853 1856 return err; ··· 1910 1907 if (err < 0) 1911 1908 goto free_sched; 1912 1909 1913 - taprio_set_picos_per_byte(dev, q); 1914 1910 taprio_update_queue_max_sdu(q, new_admin, stab); 1915 1911 1916 1912 if (FULL_OFFLOAD_IS_ENABLED(q->flags))
+12 -7
net/unix/af_unix.c
··· 731 731 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) 732 732 goto out; /* Only stream/seqpacket sockets accept */ 733 733 err = -EINVAL; 734 - if (!u->addr) 734 + if (!READ_ONCE(u->addr)) 735 735 goto out; /* No listens on an unbound socket */ 736 736 unix_state_lock(sk); 737 737 if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN) ··· 1131 1131 1132 1132 static int unix_autobind(struct sock *sk) 1133 1133 { 1134 - unsigned int new_hash, old_hash = sk->sk_hash; 1135 1134 struct unix_sock *u = unix_sk(sk); 1135 + unsigned int new_hash, old_hash; 1136 1136 struct net *net = sock_net(sk); 1137 1137 struct unix_address *addr; 1138 1138 u32 lastnum, ordernum; ··· 1155 1155 addr->name->sun_family = AF_UNIX; 1156 1156 refcount_set(&addr->refcnt, 1); 1157 1157 1158 + old_hash = sk->sk_hash; 1158 1159 ordernum = get_random_u32(); 1159 1160 lastnum = ordernum & 0xFFFFF; 1160 1161 retry: ··· 1196 1195 { 1197 1196 umode_t mode = S_IFSOCK | 1198 1197 (SOCK_INODE(sk->sk_socket)->i_mode & ~current_umask()); 1199 - unsigned int new_hash, old_hash = sk->sk_hash; 1200 1198 struct unix_sock *u = unix_sk(sk); 1199 + unsigned int new_hash, old_hash; 1201 1200 struct net *net = sock_net(sk); 1202 1201 struct mnt_idmap *idmap; 1203 1202 struct unix_address *addr; ··· 1235 1234 if (u->addr) 1236 1235 goto out_unlock; 1237 1236 1237 + old_hash = sk->sk_hash; 1238 1238 new_hash = unix_bsd_hash(d_backing_inode(dentry)); 1239 1239 unix_table_double_lock(net, old_hash, new_hash); 1240 1240 u->path.mnt = mntget(parent.mnt); ··· 1263 1261 static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr, 1264 1262 int addr_len) 1265 1263 { 1266 - unsigned int new_hash, old_hash = sk->sk_hash; 1267 1264 struct unix_sock *u = unix_sk(sk); 1265 + unsigned int new_hash, old_hash; 1268 1266 struct net *net = sock_net(sk); 1269 1267 struct unix_address *addr; 1270 1268 int err; ··· 1282 1280 goto out_mutex; 1283 1281 } 1284 1282 1283 + old_hash = sk->sk_hash; 1285 1284 new_hash = unix_abstract_hash(addr->name, addr->len, sk->sk_type); 1286 1285 unix_table_double_lock(net, old_hash, new_hash); 1287 1286 ··· 1372 1369 1373 1370 if ((test_bit(SOCK_PASSCRED, &sock->flags) || 1374 1371 test_bit(SOCK_PASSPIDFD, &sock->flags)) && 1375 - !unix_sk(sk)->addr) { 1372 + !READ_ONCE(unix_sk(sk)->addr)) { 1376 1373 err = unix_autobind(sk); 1377 1374 if (err) 1378 1375 goto out; ··· 1484 1481 goto out; 1485 1482 1486 1483 if ((test_bit(SOCK_PASSCRED, &sock->flags) || 1487 - test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) { 1484 + test_bit(SOCK_PASSPIDFD, &sock->flags)) && 1485 + !READ_ONCE(u->addr)) { 1488 1486 err = unix_autobind(sk); 1489 1487 if (err) 1490 1488 goto out; ··· 1954 1950 } 1955 1951 1956 1952 if ((test_bit(SOCK_PASSCRED, &sock->flags) || 1957 - test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) { 1953 + test_bit(SOCK_PASSPIDFD, &sock->flags)) && 1954 + !READ_ONCE(u->addr)) { 1958 1955 err = unix_autobind(sk); 1959 1956 if (err) 1960 1957 goto out;
+3 -8
net/xfrm/xfrm_policy.c
··· 3910 3910 /* Impossible. Such dst must be popped before reaches point of failure. */ 3911 3911 } 3912 3912 3913 - static struct dst_entry *xfrm_negative_advice(struct dst_entry *dst) 3913 + static void xfrm_negative_advice(struct sock *sk, struct dst_entry *dst) 3914 3914 { 3915 - if (dst) { 3916 - if (dst->obsolete) { 3917 - dst_release(dst); 3918 - dst = NULL; 3919 - } 3920 - } 3921 - return dst; 3915 + if (dst->obsolete) 3916 + sk_dst_reset(sk); 3922 3917 } 3923 3918 3924 3919 static void xfrm_init_pmtu(struct xfrm_dst **bundle, int nr)
+1 -1
tools/bpf/resolve_btfids/main.c
··· 728 728 729 729 static int symbols_patch(struct object *obj) 730 730 { 731 - int err; 731 + off_t err; 732 732 733 733 if (__symbols_patch(obj, &obj->structs) || 734 734 __symbols_patch(obj, &obj->unions) ||
+1
tools/include/uapi/linux/netdev.h
··· 148 148 NETDEV_A_QSTATS_RX_ALLOC_FAIL, 149 149 NETDEV_A_QSTATS_RX_HW_DROPS, 150 150 NETDEV_A_QSTATS_RX_HW_DROP_OVERRUNS, 151 + NETDEV_A_QSTATS_RX_CSUM_COMPLETE, 151 152 NETDEV_A_QSTATS_RX_CSUM_UNNECESSARY, 152 153 NETDEV_A_QSTATS_RX_CSUM_NONE, 153 154 NETDEV_A_QSTATS_RX_CSUM_BAD,
+30 -1
tools/lib/bpf/features.c
··· 392 392 link_fd = bpf_link_create(prog_fd, -1, BPF_TRACE_UPROBE_MULTI, &link_opts); 393 393 err = -errno; /* close() can clobber errno */ 394 394 395 + if (link_fd >= 0 || err != -EBADF) { 396 + close(link_fd); 397 + close(prog_fd); 398 + return 0; 399 + } 400 + 401 + /* Initial multi-uprobe support in kernel didn't handle PID filtering 402 + * correctly (it was doing thread filtering, not process filtering). 403 + * So now we'll detect if PID filtering logic was fixed, and, if not, 404 + * we'll pretend multi-uprobes are not supported, if not. 405 + * Multi-uprobes are used in USDT attachment logic, and we need to be 406 + * conservative here, because multi-uprobe selection happens early at 407 + * load time, while the use of PID filtering is known late at 408 + * attachment time, at which point it's too late to undo multi-uprobe 409 + * selection. 410 + * 411 + * Creating uprobe with pid == -1 for (invalid) '/' binary will fail 412 + * early with -EINVAL on kernels with fixed PID filtering logic; 413 + * otherwise -ESRCH would be returned if passed correct binary path 414 + * (but we'll just get -BADF, of course). 415 + */ 416 + link_opts.uprobe_multi.pid = -1; /* invalid PID */ 417 + link_opts.uprobe_multi.path = "/"; /* invalid path */ 418 + link_opts.uprobe_multi.offsets = &offset; 419 + link_opts.uprobe_multi.cnt = 1; 420 + 421 + link_fd = bpf_link_create(prog_fd, -1, BPF_TRACE_UPROBE_MULTI, &link_opts); 422 + err = -errno; /* close() can clobber errno */ 423 + 395 424 if (link_fd >= 0) 396 425 close(link_fd); 397 426 close(prog_fd); 398 427 399 - return link_fd < 0 && err == -EBADF; 428 + return link_fd < 0 && err == -EINVAL; 400 429 } 401 430 402 431 static int probe_kern_bpf_cookie(int token_fd)
+94
tools/testing/selftests/bpf/prog_tests/tc_netkit.c
··· 73 73 "up primary"); 74 74 ASSERT_OK(system("ip addr add dev " netkit_name " 10.0.0.1/24"), 75 75 "addr primary"); 76 + 77 + if (mode == NETKIT_L3) { 78 + ASSERT_EQ(system("ip link set dev " netkit_name 79 + " addr ee:ff:bb:cc:aa:dd 2> /dev/null"), 512, 80 + "set hwaddress"); 81 + } else { 82 + ASSERT_OK(system("ip link set dev " netkit_name 83 + " addr ee:ff:bb:cc:aa:dd"), 84 + "set hwaddress"); 85 + } 76 86 if (same_netns) { 77 87 ASSERT_OK(system("ip link set dev " netkit_peer " up"), 78 88 "up peer"); ··· 97 87 netkit_peer " 10.0.0.2/24"), "addr peer"); 98 88 } 99 89 return err; 90 + } 91 + 92 + static void move_netkit(void) 93 + { 94 + ASSERT_OK(system("ip link set " netkit_peer " netns foo"), 95 + "move peer"); 96 + ASSERT_OK(system("ip netns exec foo ip link set dev " 97 + netkit_peer " up"), "up peer"); 98 + ASSERT_OK(system("ip netns exec foo ip addr add dev " 99 + netkit_peer " 10.0.0.2/24"), "addr peer"); 100 100 } 101 101 102 102 static void destroy_netkit(void) ··· 704 684 { 705 685 serial_test_tc_netkit_neigh_links_target(NETKIT_L2, BPF_NETKIT_PRIMARY); 706 686 serial_test_tc_netkit_neigh_links_target(NETKIT_L3, BPF_NETKIT_PRIMARY); 687 + } 688 + 689 + static void serial_test_tc_netkit_pkt_type_mode(int mode) 690 + { 691 + LIBBPF_OPTS(bpf_netkit_opts, optl_nk); 692 + LIBBPF_OPTS(bpf_tcx_opts, optl_tcx); 693 + int err, ifindex, ifindex2; 694 + struct test_tc_link *skel; 695 + struct bpf_link *link; 696 + 697 + err = create_netkit(mode, NETKIT_PASS, NETKIT_PASS, 698 + &ifindex, true); 699 + if (err) 700 + return; 701 + 702 + ifindex2 = if_nametoindex(netkit_peer); 703 + ASSERT_NEQ(ifindex, ifindex2, "ifindex_1_2"); 704 + 705 + skel = test_tc_link__open(); 706 + if (!ASSERT_OK_PTR(skel, "skel_open")) 707 + goto cleanup; 708 + 709 + ASSERT_EQ(bpf_program__set_expected_attach_type(skel->progs.tc1, 710 + BPF_NETKIT_PRIMARY), 0, "tc1_attach_type"); 711 + ASSERT_EQ(bpf_program__set_expected_attach_type(skel->progs.tc7, 712 + BPF_TCX_INGRESS), 0, "tc7_attach_type"); 713 + 714 + err = test_tc_link__load(skel); 715 + if (!ASSERT_OK(err, "skel_load")) 716 + goto cleanup; 717 + 718 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 0); 719 + assert_mprog_count_ifindex(ifindex2, BPF_TCX_INGRESS, 0); 720 + 721 + link = bpf_program__attach_netkit(skel->progs.tc1, ifindex, &optl_nk); 722 + if (!ASSERT_OK_PTR(link, "link_attach")) 723 + goto cleanup; 724 + 725 + skel->links.tc1 = link; 726 + 727 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 1); 728 + assert_mprog_count_ifindex(ifindex2, BPF_TCX_INGRESS, 0); 729 + 730 + link = bpf_program__attach_tcx(skel->progs.tc7, ifindex2, &optl_tcx); 731 + if (!ASSERT_OK_PTR(link, "link_attach")) 732 + goto cleanup; 733 + 734 + skel->links.tc7 = link; 735 + 736 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 1); 737 + assert_mprog_count_ifindex(ifindex2, BPF_TCX_INGRESS, 1); 738 + 739 + move_netkit(); 740 + 741 + tc_skel_reset_all_seen(skel); 742 + skel->bss->set_type = true; 743 + ASSERT_EQ(send_icmp(), 0, "icmp_pkt"); 744 + 745 + ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 746 + ASSERT_EQ(skel->bss->seen_tc7, true, "seen_tc7"); 747 + 748 + ASSERT_EQ(skel->bss->seen_host, true, "seen_host"); 749 + ASSERT_EQ(skel->bss->seen_mcast, true, "seen_mcast"); 750 + cleanup: 751 + test_tc_link__destroy(skel); 752 + 753 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 0); 754 + destroy_netkit(); 755 + } 756 + 757 + void serial_test_tc_netkit_pkt_type(void) 758 + { 759 + serial_test_tc_netkit_pkt_type_mode(NETKIT_L2); 760 + serial_test_tc_netkit_pkt_type_mode(NETKIT_L3); 707 761 }
+126 -8
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 3 #include <unistd.h> 4 + #include <pthread.h> 4 5 #include <test_progs.h> 5 6 #include "uprobe_multi.skel.h" 6 7 #include "uprobe_multi_bench.skel.h" 7 8 #include "uprobe_multi_usdt.skel.h" 8 9 #include "bpf/libbpf_internal.h" 9 10 #include "testing_helpers.h" 11 + #include "../sdt.h" 10 12 11 13 static char test_data[] = "test_data"; 12 14 ··· 27 25 asm volatile (""); 28 26 } 29 27 28 + noinline void usdt_trigger(void) 29 + { 30 + STAP_PROBE(test, pid_filter_usdt); 31 + } 32 + 30 33 struct child { 31 34 int go[2]; 35 + int c2p[2]; /* child -> parent channel */ 32 36 int pid; 37 + int tid; 38 + pthread_t thread; 33 39 }; 34 40 35 41 static void release_child(struct child *child) ··· 48 38 return; 49 39 close(child->go[1]); 50 40 close(child->go[0]); 41 + if (child->thread) 42 + pthread_join(child->thread, NULL); 43 + close(child->c2p[0]); 44 + close(child->c2p[1]); 51 45 if (child->pid > 0) 52 46 waitpid(child->pid, &child_status, 0); 53 47 } ··· 77 63 if (pipe(child.go)) 78 64 return NULL; 79 65 80 - child.pid = fork(); 66 + child.pid = child.tid = fork(); 81 67 if (child.pid < 0) { 82 68 release_child(&child); 83 69 errno = EINVAL; ··· 96 82 uprobe_multi_func_1(); 97 83 uprobe_multi_func_2(); 98 84 uprobe_multi_func_3(); 85 + usdt_trigger(); 99 86 100 87 exit(errno); 101 88 } 89 + 90 + return &child; 91 + } 92 + 93 + static void *child_thread(void *ctx) 94 + { 95 + struct child *child = ctx; 96 + int c = 0, err; 97 + 98 + child->tid = syscall(SYS_gettid); 99 + 100 + /* let parent know we are ready */ 101 + err = write(child->c2p[1], &c, 1); 102 + if (err != 1) 103 + pthread_exit(&err); 104 + 105 + /* wait for parent's kick */ 106 + err = read(child->go[0], &c, 1); 107 + if (err != 1) 108 + pthread_exit(&err); 109 + 110 + uprobe_multi_func_1(); 111 + uprobe_multi_func_2(); 112 + uprobe_multi_func_3(); 113 + usdt_trigger(); 114 + 115 + err = 0; 116 + pthread_exit(&err); 117 + } 118 + 119 + static struct child *spawn_thread(void) 120 + { 121 + static struct child child; 122 + int c, err; 123 + 124 + /* pipe to notify child to execute the trigger functions */ 125 + if (pipe(child.go)) 126 + return NULL; 127 + /* pipe to notify parent that child thread is ready */ 128 + if (pipe(child.c2p)) { 129 + close(child.go[0]); 130 + close(child.go[1]); 131 + return NULL; 132 + } 133 + 134 + child.pid = getpid(); 135 + 136 + err = pthread_create(&child.thread, NULL, child_thread, &child); 137 + if (err) { 138 + err = -errno; 139 + close(child.go[0]); 140 + close(child.go[1]); 141 + close(child.c2p[0]); 142 + close(child.c2p[1]); 143 + errno = -err; 144 + return NULL; 145 + } 146 + 147 + err = read(child.c2p[0], &c, 1); 148 + if (!ASSERT_EQ(err, 1, "child_thread_ready")) 149 + return NULL; 102 150 103 151 return &child; 104 152 } ··· 179 103 * passed at the probe attach. 180 104 */ 181 105 skel->bss->pid = child ? 0 : getpid(); 106 + skel->bss->expect_pid = child ? child->pid : 0; 107 + 108 + /* trigger all probes, if we are testing child *process*, just to make 109 + * sure that PID filtering doesn't let through activations from wrong 110 + * PIDs; when we test child *thread*, we don't want to do this to 111 + * avoid double counting number of triggering events 112 + */ 113 + if (!child || !child->thread) { 114 + uprobe_multi_func_1(); 115 + uprobe_multi_func_2(); 116 + uprobe_multi_func_3(); 117 + usdt_trigger(); 118 + } 182 119 183 120 if (child) 184 121 kick_child(child); 185 - 186 - /* trigger all probes */ 187 - uprobe_multi_func_1(); 188 - uprobe_multi_func_2(); 189 - uprobe_multi_func_3(); 190 122 191 123 /* 192 124 * There are 2 entry and 2 exit probe called for each uprobe_multi_func_[123] ··· 210 126 211 127 ASSERT_EQ(skel->bss->uprobe_multi_sleep_result, 6, "uprobe_multi_sleep_result"); 212 128 213 - if (child) 129 + ASSERT_FALSE(skel->bss->bad_pid_seen, "bad_pid_seen"); 130 + 131 + if (child) { 214 132 ASSERT_EQ(skel->bss->child_pid, child->pid, "uprobe_multi_child_pid"); 133 + ASSERT_EQ(skel->bss->child_tid, child->tid, "uprobe_multi_child_tid"); 134 + } 215 135 } 216 136 217 137 static void test_skel_api(void) ··· 278 190 if (!ASSERT_OK_PTR(skel->links.uprobe_extra, "bpf_program__attach_uprobe_multi")) 279 191 goto cleanup; 280 192 193 + /* Attach (uprobe-backed) USDTs */ 194 + skel->links.usdt_pid = bpf_program__attach_usdt(skel->progs.usdt_pid, pid, binary, 195 + "test", "pid_filter_usdt", NULL); 196 + if (!ASSERT_OK_PTR(skel->links.usdt_pid, "attach_usdt_pid")) 197 + goto cleanup; 198 + 199 + skel->links.usdt_extra = bpf_program__attach_usdt(skel->progs.usdt_extra, -1, binary, 200 + "test", "pid_filter_usdt", NULL); 201 + if (!ASSERT_OK_PTR(skel->links.usdt_extra, "attach_usdt_extra")) 202 + goto cleanup; 203 + 281 204 uprobe_multi_test_run(skel, child); 282 205 206 + ASSERT_FALSE(skel->bss->bad_pid_seen_usdt, "bad_pid_seen_usdt"); 207 + if (child) { 208 + ASSERT_EQ(skel->bss->child_pid_usdt, child->pid, "usdt_multi_child_pid"); 209 + ASSERT_EQ(skel->bss->child_tid_usdt, child->tid, "usdt_multi_child_tid"); 210 + } 283 211 cleanup: 284 212 uprobe_multi__destroy(skel); 285 213 } ··· 311 207 /* pid filter */ 312 208 child = spawn_child(); 313 209 if (!ASSERT_OK_PTR(child, "spawn_child")) 210 + return; 211 + 212 + __test_attach_api(binary, pattern, opts, child); 213 + 214 + /* pid filter (thread) */ 215 + child = spawn_thread(); 216 + if (!ASSERT_OK_PTR(child, "spawn_thread")) 314 217 return; 315 218 316 219 __test_attach_api(binary, pattern, opts, child); ··· 508 397 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); 509 398 if (!ASSERT_ERR(link_fd, "link_fd")) 510 399 goto cleanup; 511 - ASSERT_EQ(link_fd, -ESRCH, "pid_is_wrong"); 400 + ASSERT_EQ(link_fd, -EINVAL, "pid_is_wrong"); 512 401 513 402 cleanup: 514 403 if (link_fd >= 0) ··· 603 492 /* pid filter */ 604 493 child = spawn_child(); 605 494 if (!ASSERT_OK_PTR(child, "spawn_child")) 495 + return; 496 + 497 + __test_link_api(child); 498 + 499 + /* pid filter (thread) */ 500 + child = spawn_thread(); 501 + if (!ASSERT_OK_PTR(child, "spawn_thread")) 606 502 return; 607 503 608 504 __test_link_api(child);
+2
tools/testing/selftests/bpf/prog_tests/verifier.c
··· 67 67 #include "verifier_search_pruning.skel.h" 68 68 #include "verifier_sock.skel.h" 69 69 #include "verifier_sock_addr.skel.h" 70 + #include "verifier_sockmap_mutate.skel.h" 70 71 #include "verifier_spill_fill.skel.h" 71 72 #include "verifier_spin_lock.skel.h" 72 73 #include "verifier_stack_ptr.skel.h" ··· 184 183 void test_verifier_search_pruning(void) { RUN(verifier_search_pruning); } 185 184 void test_verifier_sock(void) { RUN(verifier_sock); } 186 185 void test_verifier_sock_addr(void) { RUN(verifier_sock_addr); } 186 + void test_verifier_sockmap_mutate(void) { RUN(verifier_sockmap_mutate); } 187 187 void test_verifier_spill_fill(void) { RUN(verifier_spill_fill); } 188 188 void test_verifier_spin_lock(void) { RUN(verifier_spin_lock); } 189 189 void test_verifier_stack_ptr(void) { RUN(verifier_stack_ptr); }
+34 -1
tools/testing/selftests/bpf/progs/test_tc_link.c
··· 4 4 5 5 #include <linux/bpf.h> 6 6 #include <linux/if_ether.h> 7 - 7 + #include <linux/stddef.h> 8 + #include <linux/if_packet.h> 8 9 #include <bpf/bpf_endian.h> 9 10 #include <bpf/bpf_helpers.h> 10 11 ··· 17 16 bool seen_tc4; 18 17 bool seen_tc5; 19 18 bool seen_tc6; 19 + bool seen_tc7; 20 + 21 + bool set_type; 22 + 20 23 bool seen_eth; 24 + bool seen_host; 25 + bool seen_mcast; 21 26 22 27 SEC("tc/ingress") 23 28 int tc1(struct __sk_buff *skb) ··· 35 28 if (bpf_skb_load_bytes(skb, 0, &eth, sizeof(eth))) 36 29 goto out; 37 30 seen_eth = eth.h_proto == bpf_htons(ETH_P_IP); 31 + seen_host = skb->pkt_type == PACKET_HOST; 32 + if (seen_host && set_type) { 33 + eth.h_dest[0] = 4; 34 + if (bpf_skb_store_bytes(skb, 0, &eth, sizeof(eth), 0)) 35 + goto fail; 36 + bpf_skb_change_type(skb, PACKET_MULTICAST); 37 + } 38 38 out: 39 39 seen_tc1 = true; 40 + fail: 40 41 return TCX_NEXT; 41 42 } 42 43 ··· 80 65 int tc6(struct __sk_buff *skb) 81 66 { 82 67 seen_tc6 = true; 68 + return TCX_PASS; 69 + } 70 + 71 + SEC("tc/ingress") 72 + int tc7(struct __sk_buff *skb) 73 + { 74 + struct ethhdr eth = {}; 75 + 76 + if (skb->protocol != __bpf_constant_htons(ETH_P_IP)) 77 + goto out; 78 + if (bpf_skb_load_bytes(skb, 0, &eth, sizeof(eth))) 79 + goto out; 80 + if (eth.h_dest[0] == 4 && set_type) { 81 + seen_mcast = skb->pkt_type == PACKET_MULTICAST; 82 + bpf_skb_change_type(skb, PACKET_HOST); 83 + } 84 + out: 85 + seen_tc7 = true; 83 86 return TCX_PASS; 84 87 }
+46 -4
tools/testing/selftests/bpf/progs/uprobe_multi.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/bpf.h> 2 + #include "vmlinux.h" 3 3 #include <bpf/bpf_helpers.h> 4 4 #include <bpf/bpf_tracing.h> 5 - #include <stdbool.h> 5 + #include <bpf/usdt.bpf.h> 6 6 7 7 char _license[] SEC("license") = "GPL"; 8 8 ··· 22 22 23 23 int pid = 0; 24 24 int child_pid = 0; 25 + int child_tid = 0; 26 + int child_pid_usdt = 0; 27 + int child_tid_usdt = 0; 28 + 29 + int expect_pid = 0; 30 + bool bad_pid_seen = false; 31 + bool bad_pid_seen_usdt = false; 25 32 26 33 bool test_cookie = false; 27 34 void *user_ptr = 0; ··· 43 36 44 37 static void uprobe_multi_check(void *ctx, bool is_return, bool is_sleep) 45 38 { 46 - child_pid = bpf_get_current_pid_tgid() >> 32; 39 + __u64 cur_pid_tgid = bpf_get_current_pid_tgid(); 40 + __u32 cur_pid; 47 41 48 - if (pid && child_pid != pid) 42 + cur_pid = cur_pid_tgid >> 32; 43 + if (pid && cur_pid != pid) 49 44 return; 45 + 46 + if (expect_pid && cur_pid != expect_pid) 47 + bad_pid_seen = true; 48 + 49 + child_pid = cur_pid_tgid >> 32; 50 + child_tid = (__u32)cur_pid_tgid; 50 51 51 52 __u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0; 52 53 __u64 addr = bpf_get_func_ip(ctx); ··· 112 97 SEC("uprobe.multi//proc/self/exe:uprobe_multi_func_*") 113 98 int uprobe_extra(struct pt_regs *ctx) 114 99 { 100 + /* we need this one just to mix PID-filtered and global uprobes */ 101 + return 0; 102 + } 103 + 104 + SEC("usdt") 105 + int usdt_pid(struct pt_regs *ctx) 106 + { 107 + __u64 cur_pid_tgid = bpf_get_current_pid_tgid(); 108 + __u32 cur_pid; 109 + 110 + cur_pid = cur_pid_tgid >> 32; 111 + if (pid && cur_pid != pid) 112 + return 0; 113 + 114 + if (expect_pid && cur_pid != expect_pid) 115 + bad_pid_seen_usdt = true; 116 + 117 + child_pid_usdt = cur_pid_tgid >> 32; 118 + child_tid_usdt = (__u32)cur_pid_tgid; 119 + 120 + return 0; 121 + } 122 + 123 + SEC("usdt") 124 + int usdt_extra(struct pt_regs *ctx) 125 + { 126 + /* we need this one just to mix PID-filtered and global USDT probes */ 115 127 return 0; 116 128 }
+187
tools/testing/selftests/bpf/progs/verifier_sockmap_mutate.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/bpf.h> 4 + #include <bpf/bpf_helpers.h> 5 + #include <bpf/bpf_tracing.h> 6 + 7 + #include "bpf_misc.h" 8 + 9 + #define __always_unused __attribute__((unused)) 10 + 11 + char _license[] SEC("license") = "GPL"; 12 + 13 + struct sock { 14 + } __attribute__((preserve_access_index)); 15 + 16 + struct bpf_iter__sockmap { 17 + union { 18 + struct sock *sk; 19 + }; 20 + } __attribute__((preserve_access_index)); 21 + 22 + struct { 23 + __uint(type, BPF_MAP_TYPE_SOCKHASH); 24 + __uint(max_entries, 1); 25 + __type(key, int); 26 + __type(value, int); 27 + } sockhash SEC(".maps"); 28 + 29 + struct { 30 + __uint(type, BPF_MAP_TYPE_SOCKMAP); 31 + __uint(max_entries, 1); 32 + __type(key, int); 33 + __type(value, int); 34 + } sockmap SEC(".maps"); 35 + 36 + enum { CG_OK = 1 }; 37 + 38 + int zero = 0; 39 + 40 + static __always_inline void test_sockmap_delete(void) 41 + { 42 + bpf_map_delete_elem(&sockmap, &zero); 43 + bpf_map_delete_elem(&sockhash, &zero); 44 + } 45 + 46 + static __always_inline void test_sockmap_update(void *sk) 47 + { 48 + if (sk) { 49 + bpf_map_update_elem(&sockmap, &zero, sk, BPF_ANY); 50 + bpf_map_update_elem(&sockhash, &zero, sk, BPF_ANY); 51 + } 52 + } 53 + 54 + static __always_inline void test_sockmap_lookup_and_update(void) 55 + { 56 + struct bpf_sock *sk = bpf_map_lookup_elem(&sockmap, &zero); 57 + 58 + if (sk) { 59 + test_sockmap_update(sk); 60 + bpf_sk_release(sk); 61 + } 62 + } 63 + 64 + static __always_inline void test_sockmap_mutate(void *sk) 65 + { 66 + test_sockmap_delete(); 67 + test_sockmap_update(sk); 68 + } 69 + 70 + static __always_inline void test_sockmap_lookup_and_mutate(void) 71 + { 72 + test_sockmap_delete(); 73 + test_sockmap_lookup_and_update(); 74 + } 75 + 76 + SEC("action") 77 + __success 78 + int test_sched_act(struct __sk_buff *skb) 79 + { 80 + test_sockmap_mutate(skb->sk); 81 + return 0; 82 + } 83 + 84 + SEC("classifier") 85 + __success 86 + int test_sched_cls(struct __sk_buff *skb) 87 + { 88 + test_sockmap_mutate(skb->sk); 89 + return 0; 90 + } 91 + 92 + SEC("flow_dissector") 93 + __success 94 + int test_flow_dissector_delete(struct __sk_buff *skb __always_unused) 95 + { 96 + test_sockmap_delete(); 97 + return 0; 98 + } 99 + 100 + SEC("flow_dissector") 101 + __failure __msg("program of this type cannot use helper bpf_sk_release") 102 + int test_flow_dissector_update(struct __sk_buff *skb __always_unused) 103 + { 104 + test_sockmap_lookup_and_update(); /* no access to skb->sk */ 105 + return 0; 106 + } 107 + 108 + SEC("iter/sockmap") 109 + __success 110 + int test_trace_iter(struct bpf_iter__sockmap *ctx) 111 + { 112 + test_sockmap_mutate(ctx->sk); 113 + return 0; 114 + } 115 + 116 + SEC("raw_tp/kfree") 117 + __failure __msg("cannot update sockmap in this context") 118 + int test_raw_tp_delete(const void *ctx __always_unused) 119 + { 120 + test_sockmap_delete(); 121 + return 0; 122 + } 123 + 124 + SEC("raw_tp/kfree") 125 + __failure __msg("cannot update sockmap in this context") 126 + int test_raw_tp_update(const void *ctx __always_unused) 127 + { 128 + test_sockmap_lookup_and_update(); 129 + return 0; 130 + } 131 + 132 + SEC("sk_lookup") 133 + __success 134 + int test_sk_lookup(struct bpf_sk_lookup *ctx) 135 + { 136 + test_sockmap_mutate(ctx->sk); 137 + return 0; 138 + } 139 + 140 + SEC("sk_reuseport") 141 + __success 142 + int test_sk_reuseport(struct sk_reuseport_md *ctx) 143 + { 144 + test_sockmap_mutate(ctx->sk); 145 + return 0; 146 + } 147 + 148 + SEC("socket") 149 + __success 150 + int test_socket_filter(struct __sk_buff *skb) 151 + { 152 + test_sockmap_mutate(skb->sk); 153 + return 0; 154 + } 155 + 156 + SEC("sockops") 157 + __success 158 + int test_sockops_delete(struct bpf_sock_ops *ctx __always_unused) 159 + { 160 + test_sockmap_delete(); 161 + return CG_OK; 162 + } 163 + 164 + SEC("sockops") 165 + __failure __msg("cannot update sockmap in this context") 166 + int test_sockops_update(struct bpf_sock_ops *ctx) 167 + { 168 + test_sockmap_update(ctx->sk); 169 + return CG_OK; 170 + } 171 + 172 + SEC("sockops") 173 + __success 174 + int test_sockops_update_dedicated(struct bpf_sock_ops *ctx) 175 + { 176 + bpf_sock_map_update(ctx, &sockmap, &zero, BPF_ANY); 177 + bpf_sock_hash_update(ctx, &sockhash, &zero, BPF_ANY); 178 + return CG_OK; 179 + } 180 + 181 + SEC("xdp") 182 + __success 183 + int test_xdp(struct xdp_md *ctx __always_unused) 184 + { 185 + test_sockmap_lookup_and_mutate(); 186 + return XDP_PASS; 187 + }
+2
tools/testing/selftests/net/hsr/hsr_ping.sh
··· 174 174 setup_hsr_interfaces 0 175 175 do_complete_ping_test 176 176 177 + setup_ns ns1 ns2 ns3 178 + 177 179 setup_hsr_interfaces 1 178 180 do_complete_ping_test 179 181
+9 -1
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 261 261 262 262 TEST_NAME="${1}" 263 263 264 + MPTCP_LIB_SUBTEST_FLAKY=0 # reset if modified 265 + 264 266 if skip_test; then 265 267 MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) 266 268 last_test_ignored=1 ··· 450 448 # $1: err msg 451 449 fail_test() 452 450 { 453 - ret=${KSFT_FAIL} 451 + if ! mptcp_lib_subtest_is_flaky; then 452 + ret=${KSFT_FAIL} 453 + fi 454 454 455 455 if [ ${#} -gt 0 ]; then 456 456 print_fail "${@}" ··· 3073 3069 fastclose_tests() 3074 3070 { 3075 3071 if reset_check_counter "fastclose test" "MPTcpExtMPFastcloseTx"; then 3072 + MPTCP_LIB_SUBTEST_FLAKY=1 3076 3073 test_linkfail=1024 fastclose=client \ 3077 3074 run_tests $ns1 $ns2 10.0.1.1 3078 3075 chk_join_nr 0 0 0 ··· 3082 3077 fi 3083 3078 3084 3079 if reset_check_counter "fastclose server test" "MPTcpExtMPFastcloseRx"; then 3080 + MPTCP_LIB_SUBTEST_FLAKY=1 3085 3081 test_linkfail=1024 fastclose=server \ 3086 3082 run_tests $ns1 $ns2 10.0.1.1 3087 3083 chk_join_nr 0 0 0 0 0 0 1 ··· 3101 3095 { 3102 3096 # single subflow 3103 3097 if reset_with_fail "Infinite map" 1; then 3098 + MPTCP_LIB_SUBTEST_FLAKY=1 3104 3099 test_linkfail=128 \ 3105 3100 run_tests $ns1 $ns2 10.0.1.1 3106 3101 chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)" ··· 3110 3103 3111 3104 # multiple subflows 3112 3105 if reset_with_fail "MP_FAIL MP_RST" 2; then 3106 + MPTCP_LIB_SUBTEST_FLAKY=1 3113 3107 tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5ms 3114 3108 pm_nl_set_limits $ns1 0 1 3115 3109 pm_nl_set_limits $ns2 0 1
+28 -2
tools/testing/selftests/net/mptcp/mptcp_lib.sh
··· 21 21 22 22 MPTCP_LIB_SUBTESTS=() 23 23 MPTCP_LIB_SUBTESTS_DUPLICATED=0 24 + MPTCP_LIB_SUBTEST_FLAKY=0 24 25 MPTCP_LIB_TEST_COUNTER=0 25 26 MPTCP_LIB_TEST_FORMAT="%02u %-50s" 26 27 MPTCP_LIB_IP_MPTCP=0 ··· 41 40 readonly MPTCP_LIB_COLOR_BLUE= 42 41 readonly MPTCP_LIB_COLOR_RESET= 43 42 fi 43 + 44 + # SELFTESTS_MPTCP_LIB_OVERRIDE_FLAKY env var can be set not to ignore errors 45 + # from subtests marked as flaky 46 + mptcp_lib_override_flaky() { 47 + [ "${SELFTESTS_MPTCP_LIB_OVERRIDE_FLAKY:-}" = 1 ] 48 + } 49 + 50 + mptcp_lib_subtest_is_flaky() { 51 + [ "${MPTCP_LIB_SUBTEST_FLAKY}" = 1 ] && ! mptcp_lib_override_flaky 52 + } 44 53 45 54 # $1: color, $2: text 46 55 mptcp_lib_print_color() { ··· 83 72 } 84 73 85 74 mptcp_lib_pr_fail() { 86 - mptcp_lib_print_err "[FAIL]${1:+ ${*}}" 75 + local title cmt 76 + 77 + if mptcp_lib_subtest_is_flaky; then 78 + title="IGNO" 79 + cmt=" (flaky)" 80 + else 81 + title="FAIL" 82 + fi 83 + 84 + mptcp_lib_print_err "[${title}]${cmt}${1:+ ${*}}" 87 85 } 88 86 89 87 mptcp_lib_pr_info() { ··· 228 208 229 209 # $1: test name 230 210 mptcp_lib_result_fail() { 231 - __mptcp_lib_result_add "not ok" "${1}" 211 + if mptcp_lib_subtest_is_flaky; then 212 + # It might sound better to use 'not ok # TODO' or 'ok # SKIP', 213 + # but some CIs don't understand 'TODO' and treat SKIP as errors. 214 + __mptcp_lib_result_add "ok" "${1} # IGNORE Flaky" 215 + else 216 + __mptcp_lib_result_add "not ok" "${1}" 217 + fi 232 218 } 233 219 234 220 # $1: test name
+3 -3
tools/testing/selftests/net/mptcp/simult_flows.sh
··· 244 244 do_transfer $small $large $time 245 245 lret=$? 246 246 mptcp_lib_result_code "${lret}" "${msg}" 247 - if [ $lret -ne 0 ]; then 247 + if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then 248 248 ret=$lret 249 249 [ $bail -eq 0 ] || exit $ret 250 250 fi ··· 254 254 do_transfer $large $small $time 255 255 lret=$? 256 256 mptcp_lib_result_code "${lret}" "${msg}" 257 - if [ $lret -ne 0 ]; then 257 + if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then 258 258 ret=$lret 259 259 [ $bail -eq 0 ] || exit $ret 260 260 fi ··· 290 290 run_test 10 10 1 25 "balanced bwidth with unbalanced delay" 291 291 292 292 # we still need some additional infrastructure to pass the following test-cases 293 - run_test 10 3 0 0 "unbalanced bwidth" 293 + MPTCP_LIB_SUBTEST_FLAKY=1 run_test 10 3 0 0 "unbalanced bwidth" 294 294 run_test 10 3 1 25 "unbalanced bwidth with unbalanced delay" 295 295 run_test 10 3 25 1 "unbalanced bwidth with opposed, unbalanced delay" 296 296
+44
tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
··· 133 133 ] 134 134 }, 135 135 { 136 + "id": "6f62", 137 + "name": "Add taprio Qdisc with too short interval", 138 + "category": [ 139 + "qdisc", 140 + "taprio" 141 + ], 142 + "plugins": { 143 + "requires": "nsPlugin" 144 + }, 145 + "setup": [ 146 + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device" 147 + ], 148 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 300 sched-entry S 02 1700 clockid CLOCK_TAI", 149 + "expExitCode": "2", 150 + "verifyCmd": "$TC qdisc show dev $ETH", 151 + "matchPattern": "qdisc taprio 1: root refcnt", 152 + "matchCount": "0", 153 + "teardown": [ 154 + "echo \"1\" > /sys/bus/netdevsim/del_device" 155 + ] 156 + }, 157 + { 158 + "id": "831f", 159 + "name": "Add taprio Qdisc with too short cycle-time", 160 + "category": [ 161 + "qdisc", 162 + "taprio" 163 + ], 164 + "plugins": { 165 + "requires": "nsPlugin" 166 + }, 167 + "setup": [ 168 + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device" 169 + ], 170 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 200000 sched-entry S 02 200000 cycle-time 100 clockid CLOCK_TAI", 171 + "expExitCode": "2", 172 + "verifyCmd": "$TC qdisc show dev $ETH", 173 + "matchPattern": "qdisc taprio 1: root refcnt", 174 + "matchCount": "0", 175 + "teardown": [ 176 + "echo \"1\" > /sys/bus/netdevsim/del_device" 177 + ] 178 + }, 179 + { 136 180 "id": "3e1e", 137 181 "name": "Add taprio Qdisc with an invalid cycle-time", 138 182 "category": [