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

Configure Feed

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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from David Miller:

1) Several nf_flow_table_offload fixes from Pablo Neira Ayuso,
including adding a missing ipv6 match description.

2) Several heap overflow fixes in mwifiex from qize wang and Ganapathi
Bhat.

3) Fix uninit value in bond_neigh_init(), from Eric Dumazet.

4) Fix non-ACPI probing of nxp-nci, from Stephan Gerhold.

5) Fix use after free in tipc_disc_rcv(), from Tuong Lien.

6) Enforce limit of 33 tail calls in mips and riscv JIT, from Paul
Chaignon.

7) Multicast MAC limit test is off by one in qede, from Manish Chopra.

8) Fix established socket lookup race when socket goes from
TCP_ESTABLISHED to TCP_LISTEN, because there lacks an intervening
RCU grace period. From Eric Dumazet.

9) Don't send empty SKBs from tcp_write_xmit(), also from Eric Dumazet.

10) Fix active backup transition after link failure in bonding, from
Mahesh Bandewar.

11) Avoid zero sized hash table in gtp driver, from Taehee Yoo.

12) Fix wrong interface passed to ->mac_link_up(), from Russell King.

13) Fix DSA egress flooding settings in b53, from Florian Fainelli.

14) Memory leak in gmac_setup_txqs(), from Navid Emamdoost.

15) Fix double free in dpaa2-ptp code, from Ioana Ciornei.

16) Reject invalid MTU values in stmmac, from Jose Abreu.

17) Fix refcount leak in error path of u32 classifier, from Davide
Caratti.

18) Fix regression causing iwlwifi firmware crashes on boot, from Anders
Kaseorg.

19) Fix inverted return value logic in llc2 code, from Chan Shu Tak.

20) Disable hardware GRO when XDP is attached to qede, frm Manish
Chopra.

21) Since we encode state in the low pointer bits, dst metrics must be
at least 4 byte aligned, which is not necessarily true on m68k. Add
annotations to fix this, from Geert Uytterhoeven.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (160 commits)
sfc: Include XDP packet headroom in buffer step size.
sfc: fix channel allocation with brute force
net: dst: Force 4-byte alignment of dst_metrics
selftests: pmtu: fix init mtu value in description
hv_netvsc: Fix unwanted rx_table reset
net: phy: ensure that phy IDs are correctly typed
mod_devicetable: fix PHY module format
qede: Disable hardware gro when xdp prog is installed
net: ena: fix issues in setting interrupt moderation params in ethtool
net: ena: fix default tx interrupt moderation interval
net/smc: unregister ib devices in reboot_event
net: stmmac: platform: Fix MDIO init for platforms without PHY
llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c)
net: hisilicon: Fix a BUG trigered by wrong bytes_compl
net: dsa: ksz: use common define for tag len
s390/qeth: don't return -ENOTSUPP to userspace
s390/qeth: fix promiscuous mode after reset
s390/qeth: handle error due to unsupported transport mode
cxgb4: fix refcount init for TC-MQPRIO offload
tc-testing: initial tdc selftests for cls_u32
...

+2158 -1025
+1
.mailmap
··· 266 266 Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com> 267 267 Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com> 268 268 Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com> 269 + Vivien Didelot <vivien.didelot@gmail.com> <vivien.didelot@savoirfairelinux.com> 269 270 Vlad Dogaru <ddvlad@gmail.com> <vlad.dogaru@intel.com> 270 271 Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com> 271 272 Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@parallels.com>
+2 -2
Documentation/devicetree/bindings/net/can/tcan4x5x.txt
··· 10 10 - #size-cells: 0 11 11 - spi-max-frequency: Maximum frequency of the SPI bus the chip can 12 12 operate at should be less than or equal to 18 MHz. 13 - - device-wake-gpios: Wake up GPIO to wake up the TCAN device. 14 13 - interrupt-parent: the phandle to the interrupt controller which provides 15 14 the interrupt. 16 15 - interrupts: interrupt specification for data-ready. ··· 22 23 reset. 23 24 - device-state-gpios: Input GPIO that indicates if the device is in 24 25 a sleep state or if the device is active. 26 + - device-wake-gpios: Wake up GPIO to wake up the TCAN device. 25 27 26 28 Example: 27 29 tcan4x5x: tcan4x5x@0 { ··· 36 36 interrupts = <14 GPIO_ACTIVE_LOW>; 37 37 device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; 38 38 device-wake-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; 39 - reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; 39 + reset-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; 40 40 };
+1 -1
Documentation/networking/j1939.rst
··· 339 339 .pgn = J1939_PGN_ADDRESS_CLAIMED, 340 340 .pgn_mask = J1939_PGN_PDU1_MAX, 341 341 }, { 342 - .pgn = J1939_PGN_ADDRESS_REQUEST, 342 + .pgn = J1939_PGN_REQUEST, 343 343 .pgn_mask = J1939_PGN_PDU1_MAX, 344 344 }, { 345 345 .pgn = J1939_PGN_ADDRESS_COMMANDED,
+17
MAINTAINERS
··· 10110 10110 F: drivers/media/radio/radio-maxiradio* 10111 10111 10112 10112 MCAN MMIO DEVICE DRIVER 10113 + M: Dan Murphy <dmurphy@ti.com> 10113 10114 M: Sriram Dash <sriram.dash@samsung.com> 10114 10115 L: linux-can@vger.kernel.org 10115 10116 S: Maintained ··· 13711 13710 S: Maintained 13712 13711 F: drivers/iommu/qcom_iommu.c 13713 13712 13713 + QUALCOMM RMNET DRIVER 13714 + M: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> 13715 + M: Sean Tranchetti <stranche@codeaurora.org> 13716 + L: netdev@vger.kernel.org 13717 + S: Maintained 13718 + F: drivers/net/ethernet/qualcomm/rmnet/ 13719 + F: Documentation/networking/device_drivers/qualcomm/rmnet.txt 13720 + F: include/linux/if_rmnet.h 13721 + 13714 13722 QUALCOMM TSENS THERMAL DRIVER 13715 13723 M: Amit Kucheria <amit.kucheria@linaro.org> 13716 13724 L: linux-pm@vger.kernel.org ··· 16542 16532 L: alsa-devel@alsa-project.org (moderated for non-subscribers) 16543 16533 S: Odd Fixes 16544 16534 F: sound/soc/codecs/tas571x* 16535 + 16536 + TI TCAN4X5X DEVICE DRIVER 16537 + M: Dan Murphy <dmurphy@ti.com> 16538 + L: linux-can@vger.kernel.org 16539 + S: Maintained 16540 + F: Documentation/devicetree/bindings/net/can/tcan4x5x.txt 16541 + F: drivers/net/can/m_can/tcan4x5x.c 16545 16542 16546 16543 TI TRF7970A NFC DRIVER 16547 16544 M: Mark Greer <mgreer@animalcreek.com>
+5 -4
arch/mips/net/ebpf_jit.c
··· 604 604 static int emit_bpf_tail_call(struct jit_ctx *ctx, int this_idx) 605 605 { 606 606 int off, b_off; 607 + int tcc_reg; 607 608 608 609 ctx->flags |= EBPF_SEEN_TC; 609 610 /* ··· 617 616 b_off = b_imm(this_idx + 1, ctx); 618 617 emit_instr(ctx, bne, MIPS_R_AT, MIPS_R_ZERO, b_off); 619 618 /* 620 - * if (--TCC < 0) 619 + * if (TCC-- < 0) 621 620 * goto out; 622 621 */ 623 622 /* Delay slot */ 624 - emit_instr(ctx, daddiu, MIPS_R_T5, 625 - (ctx->flags & EBPF_TCC_IN_V1) ? MIPS_R_V1 : MIPS_R_S4, -1); 623 + tcc_reg = (ctx->flags & EBPF_TCC_IN_V1) ? MIPS_R_V1 : MIPS_R_S4; 624 + emit_instr(ctx, daddiu, MIPS_R_T5, tcc_reg, -1); 626 625 b_off = b_imm(this_idx + 1, ctx); 627 - emit_instr(ctx, bltz, MIPS_R_T5, b_off); 626 + emit_instr(ctx, bltz, tcc_reg, b_off); 628 627 /* 629 628 * prog = array->ptrs[index]; 630 629 * if (prog == NULL)
+2 -2
arch/riscv/net/bpf_jit_comp.c
··· 631 631 return -1; 632 632 emit(rv_bgeu(RV_REG_A2, RV_REG_T1, off >> 1), ctx); 633 633 634 - /* if (--TCC < 0) 634 + /* if (TCC-- < 0) 635 635 * goto out; 636 636 */ 637 637 emit(rv_addi(RV_REG_T1, tcc, -1), ctx); 638 638 off = (tc_ninsn - (ctx->ninsns - start_insn)) << 2; 639 639 if (is_13b_check(off, insn)) 640 640 return -1; 641 - emit(rv_blt(RV_REG_T1, RV_REG_ZERO, off >> 1), ctx); 641 + emit(rv_blt(tcc, RV_REG_ZERO, off >> 1), ctx); 642 642 643 643 /* prog = array->ptrs[index]; 644 644 * if (!prog)
+21 -21
drivers/net/bonding/bond_main.c
··· 2272 2272 } else if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { 2273 2273 /* make it immediately active */ 2274 2274 bond_set_active_slave(slave); 2275 - } else if (slave != primary) { 2276 - /* prevent it from being the active one */ 2277 - bond_set_backup_slave(slave); 2278 2275 } 2279 2276 2280 2277 slave_info(bond->dev, slave->dev, "link status definitely up, %u Mbps %s duplex\n", ··· 3699 3702 const struct net_device_ops *slave_ops; 3700 3703 struct neigh_parms parms; 3701 3704 struct slave *slave; 3702 - int ret; 3705 + int ret = 0; 3703 3706 3704 - slave = bond_first_slave(bond); 3707 + rcu_read_lock(); 3708 + slave = bond_first_slave_rcu(bond); 3705 3709 if (!slave) 3706 - return 0; 3710 + goto out; 3707 3711 slave_ops = slave->dev->netdev_ops; 3708 3712 if (!slave_ops->ndo_neigh_setup) 3709 - return 0; 3713 + goto out; 3710 3714 3711 - parms.neigh_setup = NULL; 3712 - parms.neigh_cleanup = NULL; 3713 - ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); 3714 - if (ret) 3715 - return ret; 3716 - 3717 - /* Assign slave's neigh_cleanup to neighbour in case cleanup is called 3718 - * after the last slave has been detached. Assumes that all slaves 3719 - * utilize the same neigh_cleanup (true at this writing as only user 3720 - * is ipoib). 3715 + /* TODO: find another way [1] to implement this. 3716 + * Passing a zeroed structure is fragile, 3717 + * but at least we do not pass garbage. 3718 + * 3719 + * [1] One way would be that ndo_neigh_setup() never touch 3720 + * struct neigh_parms, but propagate the new neigh_setup() 3721 + * back to ___neigh_create() / neigh_parms_alloc() 3721 3722 */ 3722 - n->parms->neigh_cleanup = parms.neigh_cleanup; 3723 + memset(&parms, 0, sizeof(parms)); 3724 + ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); 3723 3725 3724 - if (!parms.neigh_setup) 3725 - return 0; 3726 + if (ret) 3727 + goto out; 3726 3728 3727 - return parms.neigh_setup(n); 3729 + if (parms.neigh_setup) 3730 + ret = parms.neigh_setup(n); 3731 + out: 3732 + rcu_read_unlock(); 3733 + return ret; 3728 3734 } 3729 3735 3730 3736 /* The bonding ndo_neigh_setup is called at init time beofre any
+36 -37
drivers/net/can/flexcan.c
··· 389 389 (&priv->regs->mb[bank][priv->mb_size * mb_index]); 390 390 } 391 391 392 + static int flexcan_low_power_enter_ack(struct flexcan_priv *priv) 393 + { 394 + struct flexcan_regs __iomem *regs = priv->regs; 395 + unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; 396 + 397 + while (timeout-- && !(priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 398 + udelay(10); 399 + 400 + if (!(priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 401 + return -ETIMEDOUT; 402 + 403 + return 0; 404 + } 405 + 406 + static int flexcan_low_power_exit_ack(struct flexcan_priv *priv) 407 + { 408 + struct flexcan_regs __iomem *regs = priv->regs; 409 + unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; 410 + 411 + while (timeout-- && (priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 412 + udelay(10); 413 + 414 + if (priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK) 415 + return -ETIMEDOUT; 416 + 417 + return 0; 418 + } 419 + 392 420 static void flexcan_enable_wakeup_irq(struct flexcan_priv *priv, bool enable) 393 421 { 394 422 struct flexcan_regs __iomem *regs = priv->regs; ··· 435 407 static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) 436 408 { 437 409 struct flexcan_regs __iomem *regs = priv->regs; 438 - unsigned int ackval; 439 410 u32 reg_mcr; 440 411 441 412 reg_mcr = priv->read(&regs->mcr); ··· 445 418 regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, 446 419 1 << priv->stm.req_bit, 1 << priv->stm.req_bit); 447 420 448 - /* get stop acknowledgment */ 449 - if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, 450 - ackval, ackval & (1 << priv->stm.ack_bit), 451 - 0, FLEXCAN_TIMEOUT_US)) 452 - return -ETIMEDOUT; 453 - 454 - return 0; 421 + return flexcan_low_power_enter_ack(priv); 455 422 } 456 423 457 424 static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv) 458 425 { 459 426 struct flexcan_regs __iomem *regs = priv->regs; 460 - unsigned int ackval; 461 427 u32 reg_mcr; 462 428 463 429 /* remove stop request */ 464 430 regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, 465 431 1 << priv->stm.req_bit, 0); 466 432 467 - /* get stop acknowledgment */ 468 - if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, 469 - ackval, !(ackval & (1 << priv->stm.ack_bit)), 470 - 0, FLEXCAN_TIMEOUT_US)) 471 - return -ETIMEDOUT; 472 433 473 434 reg_mcr = priv->read(&regs->mcr); 474 435 reg_mcr &= ~FLEXCAN_MCR_SLF_WAK; 475 436 priv->write(reg_mcr, &regs->mcr); 476 437 477 - return 0; 438 + return flexcan_low_power_exit_ack(priv); 478 439 } 479 440 480 441 static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv) ··· 521 506 static int flexcan_chip_enable(struct flexcan_priv *priv) 522 507 { 523 508 struct flexcan_regs __iomem *regs = priv->regs; 524 - unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; 525 509 u32 reg; 526 510 527 511 reg = priv->read(&regs->mcr); 528 512 reg &= ~FLEXCAN_MCR_MDIS; 529 513 priv->write(reg, &regs->mcr); 530 514 531 - while (timeout-- && (priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 532 - udelay(10); 533 - 534 - if (priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK) 535 - return -ETIMEDOUT; 536 - 537 - return 0; 515 + return flexcan_low_power_exit_ack(priv); 538 516 } 539 517 540 518 static int flexcan_chip_disable(struct flexcan_priv *priv) 541 519 { 542 520 struct flexcan_regs __iomem *regs = priv->regs; 543 - unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; 544 521 u32 reg; 545 522 546 523 reg = priv->read(&regs->mcr); 547 524 reg |= FLEXCAN_MCR_MDIS; 548 525 priv->write(reg, &regs->mcr); 549 526 550 - while (timeout-- && !(priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 551 - udelay(10); 552 - 553 - if (!(priv->read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 554 - return -ETIMEDOUT; 555 - 556 - return 0; 527 + return flexcan_low_power_enter_ack(priv); 557 528 } 558 529 559 530 static int flexcan_chip_freeze(struct flexcan_priv *priv) ··· 1723 1722 netif_start_queue(dev); 1724 1723 if (device_may_wakeup(device)) { 1725 1724 disable_irq_wake(dev->irq); 1725 + err = flexcan_exit_stop_mode(priv); 1726 + if (err) 1727 + return err; 1726 1728 } else { 1727 1729 err = pm_runtime_force_resume(device); 1728 1730 if (err) ··· 1771 1767 { 1772 1768 struct net_device *dev = dev_get_drvdata(device); 1773 1769 struct flexcan_priv *priv = netdev_priv(dev); 1774 - int err; 1775 1770 1776 - if (netif_running(dev) && device_may_wakeup(device)) { 1771 + if (netif_running(dev) && device_may_wakeup(device)) 1777 1772 flexcan_enable_wakeup_irq(priv, false); 1778 - err = flexcan_exit_stop_mode(priv); 1779 - if (err) 1780 - return err; 1781 - } 1782 1773 1783 1774 return 0; 1784 1775 }
+20 -6
drivers/net/can/m_can/tcan4x5x.c
··· 101 101 #define TCAN4X5X_MODE_STANDBY BIT(6) 102 102 #define TCAN4X5X_MODE_NORMAL BIT(7) 103 103 104 + #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30)) 105 + 104 106 #define TCAN4X5X_SW_RESET BIT(2) 105 107 106 108 #define TCAN4X5X_MCAN_CONFIGURED BIT(5) ··· 340 338 return ret; 341 339 } 342 340 341 + static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) 342 + { 343 + struct tcan4x5x_priv *tcan4x5x = cdev->device_data; 344 + 345 + return regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG, 346 + TCAN4X5X_DISABLE_WAKE_MSK, 0x00); 347 + } 348 + 343 349 static int tcan4x5x_parse_config(struct m_can_classdev *cdev) 344 350 { 345 351 struct tcan4x5x_priv *tcan4x5x = cdev->device_data; ··· 355 345 tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake", 356 346 GPIOD_OUT_HIGH); 357 347 if (IS_ERR(tcan4x5x->device_wake_gpio)) { 358 - dev_err(cdev->dev, "device-wake gpio not defined\n"); 359 - return -EINVAL; 348 + if (PTR_ERR(tcan4x5x->power) == -EPROBE_DEFER) 349 + return -EPROBE_DEFER; 350 + 351 + tcan4x5x_disable_wake(cdev); 360 352 } 361 353 362 354 tcan4x5x->reset_gpio = devm_gpiod_get_optional(cdev->dev, "reset", 363 355 GPIOD_OUT_LOW); 364 356 if (IS_ERR(tcan4x5x->reset_gpio)) 365 357 tcan4x5x->reset_gpio = NULL; 358 + 359 + usleep_range(700, 1000); 366 360 367 361 tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, 368 362 "device-state", ··· 442 428 443 429 spi_set_drvdata(spi, priv); 444 430 445 - ret = tcan4x5x_parse_config(mcan_class); 446 - if (ret) 447 - goto out_clk; 448 - 449 431 /* Configure the SPI bus */ 450 432 spi->bits_per_word = 32; 451 433 ret = spi_setup(spi); ··· 450 440 451 441 priv->regmap = devm_regmap_init(&spi->dev, &tcan4x5x_bus, 452 442 &spi->dev, &tcan4x5x_regmap); 443 + 444 + ret = tcan4x5x_parse_config(mcan_class); 445 + if (ret) 446 + goto out_clk; 453 447 454 448 tcan4x5x_power_enable(priv->power, 1); 455 449
+3 -3
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
··· 608 608 struct kvaser_cmd *cmd; 609 609 int err; 610 610 611 - cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); 611 + cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); 612 612 if (!cmd) 613 613 return -ENOMEM; 614 614 ··· 1140 1140 struct kvaser_cmd *cmd; 1141 1141 int rc; 1142 1142 1143 - cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); 1143 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 1144 1144 if (!cmd) 1145 1145 return -ENOMEM; 1146 1146 ··· 1206 1206 struct kvaser_cmd *cmd; 1207 1207 int rc; 1208 1208 1209 - cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); 1209 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 1210 1210 if (!cmd) 1211 1211 return -ENOMEM; 1212 1212
+7
drivers/net/can/xilinx_can.c
··· 60 60 XCAN_TXMSG_BASE_OFFSET = 0x0100, /* TX Message Space */ 61 61 XCAN_RXMSG_BASE_OFFSET = 0x1100, /* RX Message Space */ 62 62 XCAN_RXMSG_2_BASE_OFFSET = 0x2100, /* RX Message Space */ 63 + XCAN_AFR_2_MASK_OFFSET = 0x0A00, /* Acceptance Filter MASK */ 64 + XCAN_AFR_2_ID_OFFSET = 0x0A04, /* Acceptance Filter ID */ 63 65 }; 64 66 65 67 #define XCAN_FRAME_ID_OFFSET(frame_base) ((frame_base) + 0x00) ··· 1810 1808 devm_can_led_init(ndev); 1811 1809 1812 1810 pm_runtime_put(&pdev->dev); 1811 + 1812 + if (priv->devtype.flags & XCAN_FLAG_CANFD_2) { 1813 + priv->write_reg(priv, XCAN_AFR_2_ID_OFFSET, 0x00000000); 1814 + priv->write_reg(priv, XCAN_AFR_2_MASK_OFFSET, 0x00000000); 1815 + } 1813 1816 1814 1817 netdev_dbg(ndev, "reg_base=0x%p irq=%d clock=%d, tx buffers: actual %d, using %d\n", 1815 1818 priv->reg_base, ndev->irq, priv->can.clock.freq,
+16 -5
drivers/net/dsa/b53/b53_common.c
··· 347 347 * frames should be flooded or not. 348 348 */ 349 349 b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt); 350 - mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN; 350 + mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IPMC_FWD_EN; 351 351 b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt); 352 352 } 353 353 ··· 526 526 527 527 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; 528 528 529 + b53_br_egress_floods(ds, port, true, true); 530 + 529 531 if (dev->ops->irq_enable) 530 532 ret = dev->ops->irq_enable(dev, port); 531 533 if (ret) ··· 643 641 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), port_ctrl); 644 642 645 643 b53_brcm_hdr_setup(dev->ds, port); 644 + 645 + b53_br_egress_floods(dev->ds, port, true, true); 646 646 } 647 647 648 648 static void b53_enable_mib(struct b53_device *dev) ··· 1825 1821 struct b53_device *dev = ds->priv; 1826 1822 u16 uc, mc; 1827 1823 1828 - b53_read16(dev, B53_CTRL_PAGE, B53_UC_FWD_EN, &uc); 1824 + b53_read16(dev, B53_CTRL_PAGE, B53_UC_FLOOD_MASK, &uc); 1829 1825 if (unicast) 1830 1826 uc |= BIT(port); 1831 1827 else 1832 1828 uc &= ~BIT(port); 1833 - b53_write16(dev, B53_CTRL_PAGE, B53_UC_FWD_EN, uc); 1829 + b53_write16(dev, B53_CTRL_PAGE, B53_UC_FLOOD_MASK, uc); 1834 1830 1835 - b53_read16(dev, B53_CTRL_PAGE, B53_MC_FWD_EN, &mc); 1831 + b53_read16(dev, B53_CTRL_PAGE, B53_MC_FLOOD_MASK, &mc); 1836 1832 if (multicast) 1837 1833 mc |= BIT(port); 1838 1834 else 1839 1835 mc &= ~BIT(port); 1840 - b53_write16(dev, B53_CTRL_PAGE, B53_MC_FWD_EN, mc); 1836 + b53_write16(dev, B53_CTRL_PAGE, B53_MC_FLOOD_MASK, mc); 1837 + 1838 + b53_read16(dev, B53_CTRL_PAGE, B53_IPMC_FLOOD_MASK, &mc); 1839 + if (multicast) 1840 + mc |= BIT(port); 1841 + else 1842 + mc &= ~BIT(port); 1843 + b53_write16(dev, B53_CTRL_PAGE, B53_IPMC_FLOOD_MASK, mc); 1841 1844 1842 1845 return 0; 1843 1846
+1
drivers/net/dsa/ocelot/Kconfig
··· 2 2 config NET_DSA_MSCC_FELIX 3 3 tristate "Ocelot / Felix Ethernet switch support" 4 4 depends on NET_DSA && PCI 5 + depends on NET_VENDOR_MICROSEMI 5 6 select MSCC_OCELOT_SWITCH 6 7 select NET_DSA_TAG_OCELOT 7 8 help
+1 -1
drivers/net/ethernet/amazon/ena/ena_com.h
··· 72 72 /*****************************************************************************/ 73 73 /* ENA adaptive interrupt moderation settings */ 74 74 75 - #define ENA_INTR_INITIAL_TX_INTERVAL_USECS 196 75 + #define ENA_INTR_INITIAL_TX_INTERVAL_USECS 64 76 76 #define ENA_INTR_INITIAL_RX_INTERVAL_USECS 0 77 77 #define ENA_DEFAULT_INTR_DELAY_RESOLUTION 1 78 78
+10 -14
drivers/net/ethernet/amazon/ena/ena_ethtool.c
··· 315 315 ena_com_get_nonadaptive_moderation_interval_tx(ena_dev) * 316 316 ena_dev->intr_delay_resolution; 317 317 318 - if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) 319 - coalesce->rx_coalesce_usecs = 320 - ena_com_get_nonadaptive_moderation_interval_rx(ena_dev) 321 - * ena_dev->intr_delay_resolution; 318 + coalesce->rx_coalesce_usecs = 319 + ena_com_get_nonadaptive_moderation_interval_rx(ena_dev) 320 + * ena_dev->intr_delay_resolution; 322 321 323 322 coalesce->use_adaptive_rx_coalesce = 324 323 ena_com_get_adaptive_moderation_enabled(ena_dev); ··· 366 367 367 368 ena_update_tx_rings_intr_moderation(adapter); 368 369 369 - if (coalesce->use_adaptive_rx_coalesce) { 370 - if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) 371 - ena_com_enable_adaptive_moderation(ena_dev); 372 - return 0; 373 - } 374 - 375 370 rc = ena_com_update_nonadaptive_moderation_interval_rx(ena_dev, 376 371 coalesce->rx_coalesce_usecs); 377 372 if (rc) ··· 373 380 374 381 ena_update_rx_rings_intr_moderation(adapter); 375 382 376 - if (!coalesce->use_adaptive_rx_coalesce) { 377 - if (ena_com_get_adaptive_moderation_enabled(ena_dev)) 378 - ena_com_disable_adaptive_moderation(ena_dev); 379 - } 383 + if (coalesce->use_adaptive_rx_coalesce && 384 + !ena_com_get_adaptive_moderation_enabled(ena_dev)) 385 + ena_com_enable_adaptive_moderation(ena_dev); 386 + 387 + if (!coalesce->use_adaptive_rx_coalesce && 388 + ena_com_get_adaptive_moderation_enabled(ena_dev)) 389 + ena_com_disable_adaptive_moderation(ena_dev); 380 390 381 391 return 0; 382 392 }
+7 -3
drivers/net/ethernet/amazon/ena/ena_netdev.c
··· 1238 1238 struct ena_napi *ena_napi = container_of(napi, struct ena_napi, napi); 1239 1239 struct ena_ring *tx_ring, *rx_ring; 1240 1240 1241 - u32 tx_work_done; 1242 - u32 rx_work_done; 1241 + int tx_work_done; 1242 + int rx_work_done = 0; 1243 1243 int tx_budget; 1244 1244 int napi_comp_call = 0; 1245 1245 int ret; ··· 1256 1256 } 1257 1257 1258 1258 tx_work_done = ena_clean_tx_irq(tx_ring, tx_budget); 1259 - rx_work_done = ena_clean_rx_irq(rx_ring, napi, budget); 1259 + /* On netpoll the budget is zero and the handler should only clean the 1260 + * tx completions. 1261 + */ 1262 + if (likely(budget)) 1263 + rx_work_done = ena_clean_rx_irq(rx_ring, napi, budget); 1260 1264 1261 1265 /* If the device is about to reset or down, avoid unmask 1262 1266 * the interrupt and return 0 so NAPI won't reschedule
+2 -2
drivers/net/ethernet/atheros/ag71xx.c
··· 313 313 struct ag71xx_desc *stop_desc; 314 314 dma_addr_t stop_desc_dma; 315 315 316 - int phy_if_mode; 316 + phy_interface_t phy_if_mode; 317 317 318 318 struct delayed_work restart_work; 319 319 struct timer_list oom_timer; ··· 1744 1744 eth_random_addr(ndev->dev_addr); 1745 1745 } 1746 1746 1747 - err = of_get_phy_mode(np, ag->phy_if_mode); 1747 + err = of_get_phy_mode(np, &ag->phy_if_mode); 1748 1748 if (err) { 1749 1749 netif_err(ag, probe, ndev, "missing phy-mode property in DT\n"); 1750 1750 goto err_free;
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
··· 1109 1109 for (i = 0; i < E1H_FUNC_MAX / 2; i++) { 1110 1110 u32 func_config = 1111 1111 MF_CFG_RD(bp, 1112 - func_mf_config[BP_PORT(bp) + 2 * i]. 1112 + func_mf_config[BP_PATH(bp) + 2 * i]. 1113 1113 config); 1114 1114 func_num += 1115 1115 ((func_config & FUNC_MF_CFG_FUNC_HIDE) ? 0 : 1);
+10 -2
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 9976 9976 */ 9977 9977 static void bnx2x_parity_recover(struct bnx2x *bp) 9978 9978 { 9979 - bool global = false; 9980 9979 u32 error_recovered, error_unrecovered; 9981 - bool is_parity; 9980 + bool is_parity, global = false; 9981 + #ifdef CONFIG_BNX2X_SRIOV 9982 + int vf_idx; 9982 9983 9984 + for (vf_idx = 0; vf_idx < bp->requested_nr_virtfn; vf_idx++) { 9985 + struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); 9986 + 9987 + if (vf) 9988 + vf->state = VF_LOST; 9989 + } 9990 + #endif 9983 9991 DP(NETIF_MSG_HW, "Handling parity\n"); 9984 9992 while (1) { 9985 9993 switch (bp->recovery_state) {
+1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
··· 139 139 #define VF_ACQUIRED 1 /* VF acquired, but not initialized */ 140 140 #define VF_ENABLED 2 /* VF Enabled */ 141 141 #define VF_RESET 3 /* VF FLR'd, pending cleanup */ 142 + #define VF_LOST 4 /* Recovery while VFs are loaded */ 142 143 143 144 bool flr_clnup_stage; /* true during flr cleanup */ 144 145 bool malicious; /* true if FW indicated so, until FLR */
+12
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
··· 2107 2107 { 2108 2108 int i; 2109 2109 2110 + if (vf->state == VF_LOST) { 2111 + /* Just ack the FW and return if VFs are lost 2112 + * in case of parity error. VFs are supposed to be timedout 2113 + * on waiting for PF response. 2114 + */ 2115 + DP(BNX2X_MSG_IOV, 2116 + "VF 0x%x lost, not handling the request\n", vf->abs_vfid); 2117 + 2118 + storm_memset_vf_mbx_ack(bp, vf->abs_vfid); 2119 + return; 2120 + } 2121 + 2110 2122 /* check if tlv type is known */ 2111 2123 if (bnx2x_tlv_supported(mbx->first_tlv.tl.type)) { 2112 2124 /* Lock the per vf op mutex and note the locker's identity.
+43 -20
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 2001 2001 case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: { 2002 2002 u32 data1 = le32_to_cpu(cmpl->event_data1); 2003 2003 2004 + if (!bp->fw_health) 2005 + goto async_event_process_exit; 2006 + 2004 2007 bp->fw_reset_timestamp = jiffies; 2005 2008 bp->fw_reset_min_dsecs = cmpl->timestamp_lo; 2006 2009 if (!bp->fw_reset_min_dsecs) ··· 4424 4421 FUNC_DRV_RGTR_REQ_ENABLES_ASYNC_EVENT_FWD); 4425 4422 4426 4423 req.os_type = cpu_to_le16(FUNC_DRV_RGTR_REQ_OS_TYPE_LINUX); 4427 - flags = FUNC_DRV_RGTR_REQ_FLAGS_16BIT_VER_MODE | 4428 - FUNC_DRV_RGTR_REQ_FLAGS_HOT_RESET_SUPPORT; 4424 + flags = FUNC_DRV_RGTR_REQ_FLAGS_16BIT_VER_MODE; 4425 + if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET) 4426 + flags |= FUNC_DRV_RGTR_REQ_FLAGS_HOT_RESET_SUPPORT; 4429 4427 if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) 4430 4428 flags |= FUNC_DRV_RGTR_REQ_FLAGS_ERROR_RECOVERY_SUPPORT | 4431 4429 FUNC_DRV_RGTR_REQ_FLAGS_MASTER_SUPPORT; ··· 6190 6186 tmr = bnxt_usec_to_coal_tmr(bp, hw_coal->coal_ticks_irq); 6191 6187 val = clamp_t(u16, tmr, 1, 6192 6188 coal_cap->cmpl_aggr_dma_tmr_during_int_max); 6193 - req->cmpl_aggr_dma_tmr_during_int = cpu_to_le16(tmr); 6189 + req->cmpl_aggr_dma_tmr_during_int = cpu_to_le16(val); 6194 6190 req->enables |= 6195 6191 cpu_to_le16(BNXT_COAL_CMPL_AGGR_TMR_DURING_INT_ENABLE); 6196 6192 } ··· 7119 7115 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); 7120 7116 if (rc) 7121 7117 goto err_recovery_out; 7122 - if (!fw_health) { 7123 - fw_health = kzalloc(sizeof(*fw_health), GFP_KERNEL); 7124 - bp->fw_health = fw_health; 7125 - if (!fw_health) { 7126 - rc = -ENOMEM; 7127 - goto err_recovery_out; 7128 - } 7129 - } 7130 7118 fw_health->flags = le32_to_cpu(resp->flags); 7131 7119 if ((fw_health->flags & ERROR_RECOVERY_QCFG_RESP_FLAGS_CO_CPU) && 7132 7120 !(bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL)) { ··· 8792 8796 if (fw_reset) { 8793 8797 if (!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) 8794 8798 bnxt_ulp_stop(bp); 8799 + bnxt_free_ctx_mem(bp); 8800 + kfree(bp->ctx); 8801 + bp->ctx = NULL; 8795 8802 rc = bnxt_fw_init_one(bp); 8796 8803 if (rc) { 8797 8804 set_bit(BNXT_STATE_ABORT_ERR, &bp->state); ··· 9989 9990 struct bnxt_fw_health *fw_health = bp->fw_health; 9990 9991 u32 val; 9991 9992 9992 - if (!fw_health || !fw_health->enabled || 9993 - test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) 9993 + if (!fw_health->enabled || test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) 9994 9994 return; 9995 9995 9996 9996 if (fw_health->tmr_counter) { ··· 10480 10482 bp->stats_coal_ticks = BNXT_DEF_STATS_COAL_TICKS; 10481 10483 } 10482 10484 10485 + static void bnxt_alloc_fw_health(struct bnxt *bp) 10486 + { 10487 + if (bp->fw_health) 10488 + return; 10489 + 10490 + if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET) && 10491 + !(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY)) 10492 + return; 10493 + 10494 + bp->fw_health = kzalloc(sizeof(*bp->fw_health), GFP_KERNEL); 10495 + if (!bp->fw_health) { 10496 + netdev_warn(bp->dev, "Failed to allocate fw_health\n"); 10497 + bp->fw_cap &= ~BNXT_FW_CAP_HOT_RESET; 10498 + bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY; 10499 + } 10500 + } 10501 + 10483 10502 static int bnxt_fw_init_one_p1(struct bnxt *bp) 10484 10503 { 10485 10504 int rc; ··· 10543 10528 netdev_warn(bp->dev, "hwrm query adv flow mgnt failure rc: %d\n", 10544 10529 rc); 10545 10530 10531 + bnxt_alloc_fw_health(bp); 10546 10532 rc = bnxt_hwrm_error_recovery_qcfg(bp); 10547 10533 if (rc) 10548 10534 netdev_warn(bp->dev, "hwrm query error recovery failure rc: %d\n", ··· 10625 10609 rc = bnxt_approve_mac(bp, bp->dev->dev_addr, false); 10626 10610 if (rc) 10627 10611 return rc; 10612 + 10613 + /* In case fw capabilities have changed, destroy the unneeded 10614 + * reporters and create newly capable ones. 10615 + */ 10616 + bnxt_dl_fw_reporters_destroy(bp, false); 10617 + bnxt_dl_fw_reporters_create(bp); 10628 10618 bnxt_fw_init_one_p3(bp); 10629 10619 return 0; 10630 10620 } ··· 10773 10751 bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10); 10774 10752 return; 10775 10753 case BNXT_FW_RESET_STATE_ENABLE_DEV: 10776 - if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) && 10777 - bp->fw_health) { 10754 + if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) { 10778 10755 u32 val; 10779 10756 10780 10757 val = bnxt_fw_health_readl(bp, ··· 11417 11396 struct net_device *dev = pci_get_drvdata(pdev); 11418 11397 struct bnxt *bp = netdev_priv(dev); 11419 11398 11420 - if (BNXT_PF(bp)) { 11399 + if (BNXT_PF(bp)) 11421 11400 bnxt_sriov_disable(bp); 11422 - bnxt_dl_unregister(bp); 11423 - } 11424 11401 11402 + bnxt_dl_fw_reporters_destroy(bp, true); 11403 + bnxt_dl_unregister(bp); 11425 11404 pci_disable_pcie_error_reporting(pdev); 11426 11405 unregister_netdev(dev); 11427 11406 bnxt_shutdown_tc(bp); ··· 11436 11415 bnxt_dcb_free(bp); 11437 11416 kfree(bp->edev); 11438 11417 bp->edev = NULL; 11418 + kfree(bp->fw_health); 11419 + bp->fw_health = NULL; 11439 11420 bnxt_cleanup_pci(bp); 11440 11421 bnxt_free_ctx_mem(bp); 11441 11422 kfree(bp->ctx); ··· 11898 11875 if (rc) 11899 11876 goto init_err_cleanup_tc; 11900 11877 11901 - if (BNXT_PF(bp)) 11902 - bnxt_dl_register(bp); 11878 + bnxt_dl_register(bp); 11879 + bnxt_dl_fw_reporters_create(bp); 11903 11880 11904 11881 netdev_info(dev, "%s found at mem %lx, node addr %pM\n", 11905 11882 board_info[ent->driver_data].name,
+62 -31
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
··· 39 39 struct netlink_ext_ack *extack) 40 40 { 41 41 struct bnxt *bp = devlink_health_reporter_priv(reporter); 42 - struct bnxt_fw_health *health = bp->fw_health; 43 42 u32 val, health_status; 44 43 int rc; 45 44 46 - if (!health || test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) 45 + if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) 47 46 return 0; 48 47 49 48 val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG); ··· 125 126 .recover = bnxt_fw_fatal_recover, 126 127 }; 127 128 128 - static void bnxt_dl_fw_reporters_create(struct bnxt *bp) 129 + void bnxt_dl_fw_reporters_create(struct bnxt *bp) 129 130 { 130 131 struct bnxt_fw_health *health = bp->fw_health; 131 132 132 - if (!health) 133 + if (!bp->dl || !health) 133 134 return; 134 135 135 - health->fw_reporter = 136 - devlink_health_reporter_create(bp->dl, &bnxt_dl_fw_reporter_ops, 137 - 0, false, bp); 138 - if (IS_ERR(health->fw_reporter)) { 139 - netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n", 140 - PTR_ERR(health->fw_reporter)); 141 - health->fw_reporter = NULL; 142 - } 136 + if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET) || health->fw_reset_reporter) 137 + goto err_recovery; 143 138 144 139 health->fw_reset_reporter = 145 140 devlink_health_reporter_create(bp->dl, ··· 143 150 netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n", 144 151 PTR_ERR(health->fw_reset_reporter)); 145 152 health->fw_reset_reporter = NULL; 153 + bp->fw_cap &= ~BNXT_FW_CAP_HOT_RESET; 146 154 } 155 + 156 + err_recovery: 157 + if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY)) 158 + return; 159 + 160 + if (!health->fw_reporter) { 161 + health->fw_reporter = 162 + devlink_health_reporter_create(bp->dl, 163 + &bnxt_dl_fw_reporter_ops, 164 + 0, false, bp); 165 + if (IS_ERR(health->fw_reporter)) { 166 + netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n", 167 + PTR_ERR(health->fw_reporter)); 168 + health->fw_reporter = NULL; 169 + bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY; 170 + return; 171 + } 172 + } 173 + 174 + if (health->fw_fatal_reporter) 175 + return; 147 176 148 177 health->fw_fatal_reporter = 149 178 devlink_health_reporter_create(bp->dl, ··· 175 160 netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n", 176 161 PTR_ERR(health->fw_fatal_reporter)); 177 162 health->fw_fatal_reporter = NULL; 163 + bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY; 178 164 } 179 165 } 180 166 181 - static void bnxt_dl_fw_reporters_destroy(struct bnxt *bp) 167 + void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all) 182 168 { 183 169 struct bnxt_fw_health *health = bp->fw_health; 184 170 185 - if (!health) 171 + if (!bp->dl || !health) 186 172 return; 187 173 188 - if (health->fw_reporter) 189 - devlink_health_reporter_destroy(health->fw_reporter); 190 - 191 - if (health->fw_reset_reporter) 174 + if ((all || !(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) && 175 + health->fw_reset_reporter) { 192 176 devlink_health_reporter_destroy(health->fw_reset_reporter); 177 + health->fw_reset_reporter = NULL; 178 + } 193 179 194 - if (health->fw_fatal_reporter) 180 + if ((bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) && !all) 181 + return; 182 + 183 + if (health->fw_reporter) { 184 + devlink_health_reporter_destroy(health->fw_reporter); 185 + health->fw_reporter = NULL; 186 + } 187 + 188 + if (health->fw_fatal_reporter) { 195 189 devlink_health_reporter_destroy(health->fw_fatal_reporter); 190 + health->fw_fatal_reporter = NULL; 191 + } 196 192 } 197 193 198 194 void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event) 199 195 { 200 196 struct bnxt_fw_health *fw_health = bp->fw_health; 201 197 struct bnxt_fw_reporter_ctx fw_reporter_ctx; 202 - 203 - if (!fw_health) 204 - return; 205 198 206 199 fw_reporter_ctx.sp_event = event; 207 200 switch (event) { ··· 269 246 #endif /* CONFIG_BNXT_SRIOV */ 270 247 .flash_update = bnxt_dl_flash_update, 271 248 }; 249 + 250 + static const struct devlink_ops bnxt_vf_dl_ops; 272 251 273 252 enum bnxt_dl_param_id { 274 253 BNXT_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX, ··· 485 460 return -ENOTSUPP; 486 461 } 487 462 488 - dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl)); 463 + if (BNXT_PF(bp)) 464 + dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl)); 465 + else 466 + dl = devlink_alloc(&bnxt_vf_dl_ops, sizeof(struct bnxt_dl)); 489 467 if (!dl) { 490 468 netdev_warn(bp->dev, "devlink_alloc failed"); 491 469 return -ENOMEM; ··· 506 478 netdev_warn(bp->dev, "devlink_register failed. rc=%d", rc); 507 479 goto err_dl_free; 508 480 } 481 + 482 + if (!BNXT_PF(bp)) 483 + return 0; 509 484 510 485 rc = devlink_params_register(dl, bnxt_dl_params, 511 486 ARRAY_SIZE(bnxt_dl_params)); ··· 537 506 538 507 devlink_params_publish(dl); 539 508 540 - bnxt_dl_fw_reporters_create(bp); 541 - 542 509 return 0; 543 510 544 511 err_dl_port_unreg: ··· 559 530 if (!dl) 560 531 return; 561 532 562 - bnxt_dl_fw_reporters_destroy(bp); 563 - devlink_port_params_unregister(&bp->dl_port, bnxt_dl_port_params, 564 - ARRAY_SIZE(bnxt_dl_port_params)); 565 - devlink_port_unregister(&bp->dl_port); 566 - devlink_params_unregister(dl, bnxt_dl_params, 567 - ARRAY_SIZE(bnxt_dl_params)); 533 + if (BNXT_PF(bp)) { 534 + devlink_port_params_unregister(&bp->dl_port, 535 + bnxt_dl_port_params, 536 + ARRAY_SIZE(bnxt_dl_port_params)); 537 + devlink_port_unregister(&bp->dl_port); 538 + devlink_params_unregister(dl, bnxt_dl_params, 539 + ARRAY_SIZE(bnxt_dl_params)); 540 + } 568 541 devlink_unregister(dl); 569 542 devlink_free(dl); 570 543 }
+2
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
··· 58 58 59 59 void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event); 60 60 void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy); 61 + void bnxt_dl_fw_reporters_create(struct bnxt *bp); 62 + void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all); 61 63 int bnxt_dl_register(struct bnxt *bp); 62 64 void bnxt_dl_unregister(struct bnxt *bp); 63 65
+30 -8
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
··· 3071 3071 } 3072 3072 } 3073 3073 3074 - if (info->dest_buf) 3075 - memcpy(info->dest_buf + off, dma_buf, len); 3074 + if (info->dest_buf) { 3075 + if ((info->seg_start + off + len) <= 3076 + BNXT_COREDUMP_BUF_LEN(info->buf_len)) { 3077 + memcpy(info->dest_buf + off, dma_buf, len); 3078 + } else { 3079 + rc = -ENOBUFS; 3080 + break; 3081 + } 3082 + } 3076 3083 3077 3084 if (cmn_req->req_type == 3078 3085 cpu_to_le16(HWRM_DBG_COREDUMP_RETRIEVE)) ··· 3133 3126 3134 3127 static int bnxt_hwrm_dbg_coredump_retrieve(struct bnxt *bp, u16 component_id, 3135 3128 u16 segment_id, u32 *seg_len, 3136 - void *buf, u32 offset) 3129 + void *buf, u32 buf_len, u32 offset) 3137 3130 { 3138 3131 struct hwrm_dbg_coredump_retrieve_input req = {0}; 3139 3132 struct bnxt_hwrm_dbg_dma_info info = {NULL}; ··· 3148 3141 seq_no); 3149 3142 info.data_len_off = offsetof(struct hwrm_dbg_coredump_retrieve_output, 3150 3143 data_len); 3151 - if (buf) 3144 + if (buf) { 3152 3145 info.dest_buf = buf + offset; 3146 + info.buf_len = buf_len; 3147 + info.seg_start = offset; 3148 + } 3153 3149 3154 3150 rc = bnxt_hwrm_dbg_dma_data(bp, &req, sizeof(req), &info); 3155 3151 if (!rc) ··· 3242 3232 static int bnxt_get_coredump(struct bnxt *bp, void *buf, u32 *dump_len) 3243 3233 { 3244 3234 u32 ver_get_resp_len = sizeof(struct hwrm_ver_get_output); 3235 + u32 offset = 0, seg_hdr_len, seg_record_len, buf_len = 0; 3245 3236 struct coredump_segment_record *seg_record = NULL; 3246 - u32 offset = 0, seg_hdr_len, seg_record_len; 3247 3237 struct bnxt_coredump_segment_hdr seg_hdr; 3248 3238 struct bnxt_coredump coredump = {NULL}; 3249 3239 time64_t start_time; 3250 3240 u16 start_utc; 3251 3241 int rc = 0, i; 3242 + 3243 + if (buf) 3244 + buf_len = *dump_len; 3252 3245 3253 3246 start_time = ktime_get_real_seconds(); 3254 3247 start_utc = sys_tz.tz_minuteswest * 60; ··· 3285 3272 u32 duration = 0, seg_len = 0; 3286 3273 unsigned long start, end; 3287 3274 3275 + if (buf && ((offset + seg_hdr_len) > 3276 + BNXT_COREDUMP_BUF_LEN(buf_len))) { 3277 + rc = -ENOBUFS; 3278 + goto err; 3279 + } 3280 + 3288 3281 start = jiffies; 3289 3282 3290 3283 rc = bnxt_hwrm_dbg_coredump_initiate(bp, comp_id, seg_id); ··· 3303 3284 3304 3285 /* Write segment data into the buffer */ 3305 3286 rc = bnxt_hwrm_dbg_coredump_retrieve(bp, comp_id, seg_id, 3306 - &seg_len, buf, 3287 + &seg_len, buf, buf_len, 3307 3288 offset + seg_hdr_len); 3308 - if (rc) 3289 + if (rc && rc == -ENOBUFS) 3290 + goto err; 3291 + else if (rc) 3309 3292 netdev_err(bp->dev, 3310 3293 "Failed to retrieve coredump for seg = %d\n", 3311 3294 seg_record->segment_id); ··· 3337 3316 rc); 3338 3317 kfree(coredump.data); 3339 3318 *dump_len += sizeof(struct bnxt_coredump_record); 3340 - 3319 + if (rc == -ENOBUFS) 3320 + netdev_err(bp->dev, "Firmware returned large coredump buffer"); 3341 3321 return rc; 3342 3322 } 3343 3323
+4
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h
··· 31 31 u16 total_segs; 32 32 }; 33 33 34 + #define BNXT_COREDUMP_BUF_LEN(len) ((len) - sizeof(struct bnxt_coredump_record)) 35 + 34 36 struct bnxt_hwrm_dbg_dma_info { 35 37 void *dest_buf; 36 38 int dest_buf_size; ··· 40 38 u16 seq_off; 41 39 u16 data_len_off; 42 40 u16 segs; 41 + u32 seg_start; 42 + u32 buf_len; 43 43 }; 44 44 45 45 struct hwrm_dbg_cmn_input {
+6 -2
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
··· 113 113 { 114 114 struct net_device *dev = edev->net; 115 115 struct bnxt *bp = netdev_priv(dev); 116 + struct bnxt_hw_resc *hw_resc; 116 117 int max_idx, max_cp_rings; 117 118 int avail_msix, idx; 119 + int total_vecs; 118 120 int rc = 0; 119 121 120 122 ASSERT_RTNL(); ··· 144 142 } 145 143 edev->ulp_tbl[ulp_id].msix_base = idx; 146 144 edev->ulp_tbl[ulp_id].msix_requested = avail_msix; 147 - if (bp->total_irqs < (idx + avail_msix)) { 145 + hw_resc = &bp->hw_resc; 146 + total_vecs = idx + avail_msix; 147 + if (bp->total_irqs < total_vecs || 148 + (BNXT_NEW_RM(bp) && hw_resc->resv_irqs < total_vecs)) { 148 149 if (netif_running(dev)) { 149 150 bnxt_close_nic(bp, true, false); 150 151 rc = bnxt_open_nic(bp, true, false); ··· 161 156 } 162 157 163 158 if (BNXT_NEW_RM(bp)) { 164 - struct bnxt_hw_resc *hw_resc = &bp->hw_resc; 165 159 int resv_msix; 166 160 167 161 resv_msix = hw_resc->resv_irqs - bp->cp_nr_rings;
+23 -4
drivers/net/ethernet/cadence/macb_main.c
··· 664 664 return 0; 665 665 } 666 666 667 + static int macb_mdiobus_register(struct macb *bp) 668 + { 669 + struct device_node *child, *np = bp->pdev->dev.of_node; 670 + 671 + /* Only create the PHY from the device tree if at least one PHY is 672 + * described. Otherwise scan the entire MDIO bus. We do this to support 673 + * old device tree that did not follow the best practices and did not 674 + * describe their network PHYs. 675 + */ 676 + for_each_available_child_of_node(np, child) 677 + if (of_mdiobus_child_is_phy(child)) { 678 + /* The loop increments the child refcount, 679 + * decrement it before returning. 680 + */ 681 + of_node_put(child); 682 + 683 + return of_mdiobus_register(bp->mii_bus, np); 684 + } 685 + 686 + return mdiobus_register(bp->mii_bus); 687 + } 688 + 667 689 static int macb_mii_init(struct macb *bp) 668 690 { 669 - struct device_node *np; 670 691 int err = -ENXIO; 671 692 672 693 /* Enable management port */ ··· 709 688 710 689 dev_set_drvdata(&bp->dev->dev, bp->mii_bus); 711 690 712 - np = bp->pdev->dev.of_node; 713 - 714 - err = of_mdiobus_register(bp->mii_bus, np); 691 + err = macb_mdiobus_register(bp); 715 692 if (err) 716 693 goto err_out_free_mdiobus; 717 694
+4
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
··· 3048 3048 int tot_uld_entries = 0; 3049 3049 int i; 3050 3050 3051 + if (!is_uld(adap)) 3052 + goto lld_only; 3053 + 3051 3054 mutex_lock(&uld_mutex); 3052 3055 for (i = 0; i < CXGB4_TX_MAX; i++) 3053 3056 tot_uld_entries += sge_qinfo_uld_txq_entries(adap, i); ··· 3061 3058 } 3062 3059 mutex_unlock(&uld_mutex); 3063 3060 3061 + lld_only: 3064 3062 return DIV_ROUND_UP(adap->sge.ethqsets, 4) + 3065 3063 (adap->sge.eohw_txq ? DIV_ROUND_UP(adap->sge.eoqsets, 4) : 0) + 3066 3064 tot_uld_entries +
+8 -4
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c
··· 145 145 kfree(adap->sge.eohw_rxq); 146 146 return -ENOMEM; 147 147 } 148 + 149 + refcount_set(&adap->tc_mqprio->refcnt, 1); 150 + } else { 151 + refcount_inc(&adap->tc_mqprio->refcnt); 148 152 } 149 153 150 154 if (!(adap->flags & CXGB4_USING_MSIX)) ··· 209 205 cxgb4_enable_rx(adap, &eorxq->rspq); 210 206 } 211 207 212 - refcount_inc(&adap->tc_mqprio->refcnt); 213 208 return 0; 214 209 215 210 out_free_msix: ··· 237 234 t4_sge_free_ethofld_txq(adap, eotxq); 238 235 } 239 236 240 - kfree(adap->sge.eohw_txq); 241 - kfree(adap->sge.eohw_rxq); 242 - 237 + if (refcount_dec_and_test(&adap->tc_mqprio->refcnt)) { 238 + kfree(adap->sge.eohw_txq); 239 + kfree(adap->sge.eohw_rxq); 240 + } 243 241 return ret; 244 242 } 245 243
+2
drivers/net/ethernet/cortina/gemini.c
··· 576 576 577 577 if (port->txq_dma_base & ~DMA_Q_BASE_MASK) { 578 578 dev_warn(geth->dev, "TX queue base is not aligned\n"); 579 + dma_free_coherent(geth->dev, len * sizeof(*desc_ring), 580 + desc_ring, port->txq_dma_base); 579 581 kfree(skb_tab); 580 582 return -ENOMEM; 581 583 }
+8 -6
drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c
··· 160 160 irq = mc_dev->irqs[0]; 161 161 ptp_qoriq->irq = irq->msi_desc->irq; 162 162 163 - err = devm_request_threaded_irq(dev, ptp_qoriq->irq, NULL, 164 - dpaa2_ptp_irq_handler_thread, 165 - IRQF_NO_SUSPEND | IRQF_ONESHOT, 166 - dev_name(dev), ptp_qoriq); 163 + err = request_threaded_irq(ptp_qoriq->irq, NULL, 164 + dpaa2_ptp_irq_handler_thread, 165 + IRQF_NO_SUSPEND | IRQF_ONESHOT, 166 + dev_name(dev), ptp_qoriq); 167 167 if (err < 0) { 168 168 dev_err(dev, "devm_request_threaded_irq(): %d\n", err); 169 169 goto err_free_mc_irq; ··· 173 173 DPRTC_IRQ_INDEX, 1); 174 174 if (err < 0) { 175 175 dev_err(dev, "dprtc_set_irq_enable(): %d\n", err); 176 - goto err_free_mc_irq; 176 + goto err_free_threaded_irq; 177 177 } 178 178 179 179 err = ptp_qoriq_init(ptp_qoriq, base, &dpaa2_ptp_caps); 180 180 if (err) 181 - goto err_free_mc_irq; 181 + goto err_free_threaded_irq; 182 182 183 183 dpaa2_phc_index = ptp_qoriq->phc_index; 184 184 dev_set_drvdata(dev, ptp_qoriq); 185 185 186 186 return 0; 187 187 188 + err_free_threaded_irq: 189 + free_irq(ptp_qoriq->irq, ptp_qoriq); 188 190 err_free_mc_irq: 189 191 fsl_mc_free_irqs(mc_dev); 190 192 err_unmap:
+1 -1
drivers/net/ethernet/hisilicon/hip04_eth.c
··· 543 543 skb_tx_timestamp(skb); 544 544 545 545 hip04_set_xmit_desc(priv, phys); 546 - priv->tx_head = TX_NEXT(tx_head); 547 546 count++; 548 547 netdev_sent_queue(ndev, skb->len); 548 + priv->tx_head = TX_NEXT(tx_head); 549 549 550 550 stats->tx_bytes += skb->len; 551 551 stats->tx_packets++;
+1 -1
drivers/net/ethernet/ibm/ibmvnic.c
··· 184 184 netdev_err(netdev, "Device down!\n"); 185 185 return -ENODEV; 186 186 } 187 - if (retry--) 187 + if (!retry--) 188 188 break; 189 189 if (wait_for_completion_timeout(comp_done, div_timeout)) 190 190 return 0;
+1 -1
drivers/net/ethernet/intel/i40e/i40e.h
··· 1152 1152 1153 1153 static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi) 1154 1154 { 1155 - return !!vsi->xdp_prog; 1155 + return !!READ_ONCE(vsi->xdp_prog); 1156 1156 } 1157 1157 1158 1158 int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch);
+7 -3
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 6823 6823 for (i = 0; i < vsi->num_queue_pairs; i++) { 6824 6824 i40e_clean_tx_ring(vsi->tx_rings[i]); 6825 6825 if (i40e_enabled_xdp_vsi(vsi)) { 6826 - /* Make sure that in-progress ndo_xdp_xmit 6827 - * calls are completed. 6826 + /* Make sure that in-progress ndo_xdp_xmit and 6827 + * ndo_xsk_wakeup calls are completed. 6828 6828 */ 6829 6829 synchronize_rcu(); 6830 6830 i40e_clean_tx_ring(vsi->xdp_rings[i]); ··· 12546 12546 12547 12547 old_prog = xchg(&vsi->xdp_prog, prog); 12548 12548 12549 - if (need_reset) 12549 + if (need_reset) { 12550 + if (!prog) 12551 + /* Wait until ndo_xsk_wakeup completes. */ 12552 + synchronize_rcu(); 12550 12553 i40e_reset_and_rebuild(pf, true, true); 12554 + } 12551 12555 12552 12556 for (i = 0; i < vsi->num_queue_pairs; i++) 12553 12557 WRITE_ONCE(vsi->rx_rings[i]->xdp_prog, vsi->xdp_prog);
+4
drivers/net/ethernet/intel/i40e/i40e_xsk.c
··· 787 787 { 788 788 struct i40e_netdev_priv *np = netdev_priv(dev); 789 789 struct i40e_vsi *vsi = np->vsi; 790 + struct i40e_pf *pf = vsi->back; 790 791 struct i40e_ring *ring; 792 + 793 + if (test_bit(__I40E_CONFIG_BUSY, pf->state)) 794 + return -ENETDOWN; 791 795 792 796 if (test_bit(__I40E_VSI_DOWN, vsi->state)) 793 797 return -ENETDOWN;
+6 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 10261 10261 10262 10262 /* If transitioning XDP modes reconfigure rings */ 10263 10263 if (need_reset) { 10264 - int err = ixgbe_setup_tc(dev, adapter->hw_tcs); 10264 + int err; 10265 + 10266 + if (!prog) 10267 + /* Wait until ndo_xsk_wakeup completes. */ 10268 + synchronize_rcu(); 10269 + err = ixgbe_setup_tc(dev, adapter->hw_tcs); 10265 10270 10266 10271 if (err) { 10267 10272 rcu_assign_pointer(adapter->xdp_prog, old_prog);
+6 -2
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
··· 709 709 if (qid >= adapter->num_xdp_queues) 710 710 return -ENXIO; 711 711 712 - if (!adapter->xdp_ring[qid]->xsk_umem) 712 + ring = adapter->xdp_ring[qid]; 713 + 714 + if (test_bit(__IXGBE_TX_DISABLED, &ring->state)) 715 + return -ENETDOWN; 716 + 717 + if (!ring->xsk_umem) 713 718 return -ENXIO; 714 719 715 - ring = adapter->xdp_ring[qid]; 716 720 if (!napi_if_scheduled_mark_missed(&ring->q_vector->napi)) { 717 721 u64 eics = BIT_ULL(ring->q_vector->v_idx); 718 722
+1 -1
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 3680 3680 valid = true; 3681 3681 } 3682 3682 3683 - if (priv->hw_version == MVPP22 && port->link_irq && !port->phylink) { 3683 + if (priv->hw_version == MVPP22 && port->link_irq) { 3684 3684 err = request_irq(port->link_irq, mvpp2_link_status_isr, 0, 3685 3685 dev->name, port); 3686 3686 if (err) {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 760 760 MLX5E_STATE_OPENED, 761 761 MLX5E_STATE_DESTROYING, 762 762 MLX5E_STATE_XDP_TX_ENABLED, 763 - MLX5E_STATE_XDP_OPEN, 763 + MLX5E_STATE_XDP_ACTIVE, 764 764 }; 765 765 766 766 struct mlx5e_rqt {
+9 -13
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h
··· 75 75 static inline void mlx5e_xdp_tx_enable(struct mlx5e_priv *priv) 76 76 { 77 77 set_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); 78 + 79 + if (priv->channels.params.xdp_prog) 80 + set_bit(MLX5E_STATE_XDP_ACTIVE, &priv->state); 78 81 } 79 82 80 83 static inline void mlx5e_xdp_tx_disable(struct mlx5e_priv *priv) 81 84 { 85 + if (priv->channels.params.xdp_prog) 86 + clear_bit(MLX5E_STATE_XDP_ACTIVE, &priv->state); 87 + 82 88 clear_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); 83 - /* let other device's napi(s) see our new state */ 89 + /* Let other device's napi(s) and XSK wakeups see our new state. */ 84 90 synchronize_rcu(); 85 91 } 86 92 ··· 95 89 return test_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); 96 90 } 97 91 98 - static inline void mlx5e_xdp_set_open(struct mlx5e_priv *priv) 92 + static inline bool mlx5e_xdp_is_active(struct mlx5e_priv *priv) 99 93 { 100 - set_bit(MLX5E_STATE_XDP_OPEN, &priv->state); 101 - } 102 - 103 - static inline void mlx5e_xdp_set_closed(struct mlx5e_priv *priv) 104 - { 105 - clear_bit(MLX5E_STATE_XDP_OPEN, &priv->state); 106 - } 107 - 108 - static inline bool mlx5e_xdp_is_open(struct mlx5e_priv *priv) 109 - { 110 - return test_bit(MLX5E_STATE_XDP_OPEN, &priv->state); 94 + return test_bit(MLX5E_STATE_XDP_ACTIVE, &priv->state); 111 95 } 112 96 113 97 static inline void mlx5e_xmit_xdp_doorbell(struct mlx5e_xdpsq *sq)
+1
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
··· 144 144 { 145 145 clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state); 146 146 napi_synchronize(&c->napi); 147 + synchronize_rcu(); /* Sync with the XSK wakeup. */ 147 148 148 149 mlx5e_close_rq(&c->xskrq); 149 150 mlx5e_close_cq(&c->xskrq.cq);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c
··· 14 14 struct mlx5e_channel *c; 15 15 u16 ix; 16 16 17 - if (unlikely(!mlx5e_xdp_is_open(priv))) 17 + if (unlikely(!mlx5e_xdp_is_active(priv))) 18 18 return -ENETDOWN; 19 19 20 20 if (unlikely(!mlx5e_qid_get_ch_if_in_group(params, qid, MLX5E_RQ_GROUP_XSK, &ix)))
+1 -18
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 3000 3000 int mlx5e_open_locked(struct net_device *netdev) 3001 3001 { 3002 3002 struct mlx5e_priv *priv = netdev_priv(netdev); 3003 - bool is_xdp = priv->channels.params.xdp_prog; 3004 3003 int err; 3005 3004 3006 3005 set_bit(MLX5E_STATE_OPENED, &priv->state); 3007 - if (is_xdp) 3008 - mlx5e_xdp_set_open(priv); 3009 3006 3010 3007 err = mlx5e_open_channels(priv, &priv->channels); 3011 3008 if (err) ··· 3017 3020 return 0; 3018 3021 3019 3022 err_clear_state_opened_flag: 3020 - if (is_xdp) 3021 - mlx5e_xdp_set_closed(priv); 3022 3023 clear_bit(MLX5E_STATE_OPENED, &priv->state); 3023 3024 return err; 3024 3025 } ··· 3048 3053 if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) 3049 3054 return 0; 3050 3055 3051 - if (priv->channels.params.xdp_prog) 3052 - mlx5e_xdp_set_closed(priv); 3053 3056 clear_bit(MLX5E_STATE_OPENED, &priv->state); 3054 3057 3055 3058 netif_carrier_off(priv->netdev); ··· 4364 4371 return 0; 4365 4372 } 4366 4373 4367 - static int mlx5e_xdp_update_state(struct mlx5e_priv *priv) 4368 - { 4369 - if (priv->channels.params.xdp_prog) 4370 - mlx5e_xdp_set_open(priv); 4371 - else 4372 - mlx5e_xdp_set_closed(priv); 4373 - 4374 - return 0; 4375 - } 4376 - 4377 4374 static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) 4378 4375 { 4379 4376 struct mlx5e_priv *priv = netdev_priv(netdev); ··· 4398 4415 mlx5e_set_rq_type(priv->mdev, &new_channels.params); 4399 4416 old_prog = priv->channels.params.xdp_prog; 4400 4417 4401 - err = mlx5e_safe_switch_channels(priv, &new_channels, mlx5e_xdp_update_state); 4418 + err = mlx5e_safe_switch_channels(priv, &new_channels, NULL); 4402 4419 if (err) 4403 4420 goto unlock; 4404 4421 } else {
+6 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 5742 5742 if (mlxsw_sp_fib6_rt_should_ignore(rt)) 5743 5743 return; 5744 5744 5745 + /* Multipath routes are first added to the FIB trie and only then 5746 + * notified. If we vetoed the addition, we will get a delete 5747 + * notification for a route we do not have. Therefore, do not warn if 5748 + * route was not found. 5749 + */ 5745 5750 fib6_entry = mlxsw_sp_fib6_entry_lookup(mlxsw_sp, rt); 5746 - if (WARN_ON(!fib6_entry)) 5751 + if (!fib6_entry) 5747 5752 return; 5748 5753 5749 5754 /* If not all the nexthops are deleted, then only reduce the nexthop
+6 -6
drivers/net/ethernet/netronome/nfp/flower/metadata.c
··· 65 65 freed_stats_id = priv->stats_ring_size; 66 66 /* Check for unallocated entries first. */ 67 67 if (priv->stats_ids.init_unalloc > 0) { 68 - if (priv->active_mem_unit == priv->total_mem_units) { 69 - priv->stats_ids.init_unalloc--; 70 - priv->active_mem_unit = 0; 71 - } 72 - 73 68 *stats_context_id = 74 69 FIELD_PREP(NFP_FL_STAT_ID_STAT, 75 70 priv->stats_ids.init_unalloc - 1) | 76 71 FIELD_PREP(NFP_FL_STAT_ID_MU_NUM, 77 72 priv->active_mem_unit); 78 - priv->active_mem_unit++; 73 + 74 + if (++priv->active_mem_unit == priv->total_mem_units) { 75 + priv->stats_ids.init_unalloc--; 76 + priv->active_mem_unit = 0; 77 + } 78 + 79 79 return 0; 80 80 } 81 81
+1 -1
drivers/net/ethernet/qlogic/qede/qede_filter.c
··· 1230 1230 netif_addr_lock_bh(ndev); 1231 1231 1232 1232 mc_count = netdev_mc_count(ndev); 1233 - if (mc_count < 64) { 1233 + if (mc_count <= 64) { 1234 1234 netdev_for_each_mc_addr(ha, ndev) { 1235 1235 ether_addr_copy(temp, ha->addr); 1236 1236 temp += ETH_ALEN;
+2 -2
drivers/net/ethernet/qlogic/qede/qede_main.c
··· 1406 1406 rxq->rx_buf_seg_size = roundup_pow_of_two(size); 1407 1407 } else { 1408 1408 rxq->rx_buf_seg_size = PAGE_SIZE; 1409 + edev->ndev->features &= ~NETIF_F_GRO_HW; 1409 1410 } 1410 1411 1411 1412 /* Allocate the parallel driver ring for Rx buffers */ ··· 1451 1450 } 1452 1451 } 1453 1452 1453 + edev->gro_disable = !(edev->ndev->features & NETIF_F_GRO_HW); 1454 1454 if (!edev->gro_disable) 1455 1455 qede_set_tpa_param(rxq); 1456 1456 err: ··· 1704 1702 snprintf(fp->name, sizeof(fp->name), "%s-fp-%d", 1705 1703 edev->ndev->name, queue_id); 1706 1704 } 1707 - 1708 - edev->gro_disable = !(edev->ndev->features & NETIF_F_GRO_HW); 1709 1705 } 1710 1706 1711 1707 static int qede_set_real_num_queues(struct qede_dev *edev)
+4 -4
drivers/net/ethernet/qlogic/qla3xxx.c
··· 2756 2756 int err; 2757 2757 2758 2758 for (i = 0; i < qdev->num_large_buffers; i++) { 2759 + lrg_buf_cb = &qdev->lrg_buf[i]; 2760 + memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); 2761 + 2759 2762 skb = netdev_alloc_skb(qdev->ndev, 2760 2763 qdev->lrg_buffer_len); 2761 2764 if (unlikely(!skb)) { ··· 2769 2766 ql_free_large_buffers(qdev); 2770 2767 return -ENOMEM; 2771 2768 } else { 2772 - 2773 - lrg_buf_cb = &qdev->lrg_buf[i]; 2774 - memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); 2775 2769 lrg_buf_cb->index = i; 2776 - lrg_buf_cb->skb = skb; 2777 2770 /* 2778 2771 * We save some space to copy the ethhdr from first 2779 2772 * buffer ··· 2791 2792 return -ENOMEM; 2792 2793 } 2793 2794 2795 + lrg_buf_cb->skb = skb; 2794 2796 dma_unmap_addr_set(lrg_buf_cb, mapaddr, map); 2795 2797 dma_unmap_len_set(lrg_buf_cb, maplen, 2796 2798 qdev->lrg_buffer_len -
+18 -19
drivers/net/ethernet/sfc/efx.c
··· 1472 1472 n_xdp_tx = num_possible_cpus(); 1473 1473 n_xdp_ev = DIV_ROUND_UP(n_xdp_tx, EFX_TXQ_TYPES); 1474 1474 1475 + vec_count = pci_msix_vec_count(efx->pci_dev); 1476 + if (vec_count < 0) 1477 + return vec_count; 1478 + 1479 + max_channels = min_t(unsigned int, vec_count, max_channels); 1480 + 1475 1481 /* Check resources. 1476 1482 * We need a channel per event queue, plus a VI per tx queue. 1477 1483 * This may be more pessimistic than it needs to be. ··· 1499 1493 n_xdp_tx, n_xdp_ev); 1500 1494 } 1501 1495 1502 - n_channels = min(n_channels, max_channels); 1503 - 1504 - vec_count = pci_msix_vec_count(efx->pci_dev); 1505 - if (vec_count < 0) 1506 - return vec_count; 1507 1496 if (vec_count < n_channels) { 1508 1497 netif_err(efx, drv, efx->net_dev, 1509 1498 "WARNING: Insufficient MSI-X vectors available (%d < %u).\n", ··· 1508 1507 n_channels = vec_count; 1509 1508 } 1510 1509 1511 - efx->n_channels = n_channels; 1510 + n_channels = min(n_channels, max_channels); 1512 1511 1513 - /* Do not create the PTP TX queue(s) if PTP uses the MC directly. */ 1514 - if (extra_channels && !efx_ptp_use_mac_tx_timestamps(efx)) 1515 - n_channels--; 1512 + efx->n_channels = n_channels; 1516 1513 1517 1514 /* Ignore XDP tx channels when creating rx channels. */ 1518 1515 n_channels -= efx->n_xdp_channels; ··· 1530 1531 efx->n_rx_channels = n_channels; 1531 1532 } 1532 1533 1533 - if (efx->n_xdp_channels) 1534 - efx->xdp_channel_offset = efx->tx_channel_offset + 1535 - efx->n_tx_channels; 1536 - else 1537 - efx->xdp_channel_offset = efx->n_channels; 1534 + efx->n_rx_channels = min(efx->n_rx_channels, parallelism); 1535 + efx->n_tx_channels = min(efx->n_tx_channels, parallelism); 1536 + 1537 + efx->xdp_channel_offset = n_channels; 1538 1538 1539 1539 netif_dbg(efx, drv, efx->net_dev, 1540 1540 "Allocating %u RX channels\n", ··· 1548 1550 static int efx_probe_interrupts(struct efx_nic *efx) 1549 1551 { 1550 1552 unsigned int extra_channels = 0; 1553 + unsigned int rss_spread; 1551 1554 unsigned int i, j; 1552 1555 int rc; 1553 1556 ··· 1630 1631 for (i = 0; i < EFX_MAX_EXTRA_CHANNELS; i++) { 1631 1632 if (!efx->extra_channel_type[i]) 1632 1633 continue; 1633 - if (efx->interrupt_mode != EFX_INT_MODE_MSIX || 1634 - efx->n_channels <= extra_channels) { 1634 + if (j <= efx->tx_channel_offset + efx->n_tx_channels) { 1635 1635 efx->extra_channel_type[i]->handle_no_channel(efx); 1636 1636 } else { 1637 1637 --j; ··· 1641 1643 } 1642 1644 } 1643 1645 1646 + rss_spread = efx->n_rx_channels; 1644 1647 /* RSS might be usable on VFs even if it is disabled on the PF */ 1645 1648 #ifdef CONFIG_SFC_SRIOV 1646 1649 if (efx->type->sriov_wanted) { 1647 - efx->rss_spread = ((efx->n_rx_channels > 1 || 1650 + efx->rss_spread = ((rss_spread > 1 || 1648 1651 !efx->type->sriov_wanted(efx)) ? 1649 - efx->n_rx_channels : efx_vf_size(efx)); 1652 + rss_spread : efx_vf_size(efx)); 1650 1653 return 0; 1651 1654 } 1652 1655 #endif 1653 - efx->rss_spread = efx->n_rx_channels; 1656 + efx->rss_spread = rss_spread; 1654 1657 1655 1658 return 0; 1656 1659 }
+1 -3
drivers/net/ethernet/sfc/net_driver.h
··· 1533 1533 1534 1534 static inline bool efx_channel_has_tx_queues(struct efx_channel *channel) 1535 1535 { 1536 - return efx_channel_is_xdp_tx(channel) || 1537 - (channel->type && channel->type->want_txqs && 1538 - channel->type->want_txqs(channel)); 1536 + return true; 1539 1537 } 1540 1538 1541 1539 static inline struct efx_tx_queue *
+7 -7
drivers/net/ethernet/sfc/rx.c
··· 96 96 97 97 void efx_rx_config_page_split(struct efx_nic *efx) 98 98 { 99 - efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + efx->rx_ip_align, 99 + efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + efx->rx_ip_align + 100 + XDP_PACKET_HEADROOM, 100 101 EFX_RX_BUF_ALIGNMENT); 101 102 efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : 102 103 ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / 103 - (efx->rx_page_buf_step + XDP_PACKET_HEADROOM)); 104 + efx->rx_page_buf_step); 104 105 efx->rx_buffer_truesize = (PAGE_SIZE << efx->rx_buffer_order) / 105 106 efx->rx_bufs_per_page; 106 107 efx->rx_pages_per_batch = DIV_ROUND_UP(EFX_RX_PREFERRED_BATCH, ··· 191 190 page_offset = sizeof(struct efx_rx_page_state); 192 191 193 192 do { 194 - page_offset += XDP_PACKET_HEADROOM; 195 - dma_addr += XDP_PACKET_HEADROOM; 196 - 197 193 index = rx_queue->added_count & rx_queue->ptr_mask; 198 194 rx_buf = efx_rx_buffer(rx_queue, index); 199 - rx_buf->dma_addr = dma_addr + efx->rx_ip_align; 195 + rx_buf->dma_addr = dma_addr + efx->rx_ip_align + 196 + XDP_PACKET_HEADROOM; 200 197 rx_buf->page = page; 201 - rx_buf->page_offset = page_offset + efx->rx_ip_align; 198 + rx_buf->page_offset = page_offset + efx->rx_ip_align + 199 + XDP_PACKET_HEADROOM; 202 200 rx_buf->len = efx->rx_dma_len; 203 201 rx_buf->flags = 0; 204 202 ++rx_queue->added_count;
+2 -3
drivers/net/ethernet/stmicro/stmmac/common.h
··· 365 365 unsigned int arpoffsel; 366 366 }; 367 367 368 - /* GMAC TX FIFO is 8K, Rx FIFO is 16K */ 369 - #define BUF_SIZE_16KiB 16384 370 - /* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */ 368 + /* RX Buffer size must be multiple of 4/8/16 bytes */ 369 + #define BUF_SIZE_16KiB 16368 371 370 #define BUF_SIZE_8KiB 8188 372 371 #define BUF_SIZE_4KiB 4096 373 372 #define BUF_SIZE_2KiB 2048
+2
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
··· 343 343 #define XGMAC_DMA_CH_RX_CONTROL(x) (0x00003108 + (0x80 * (x))) 344 344 #define XGMAC_RxPBL GENMASK(21, 16) 345 345 #define XGMAC_RxPBL_SHIFT 16 346 + #define XGMAC_RBSZ GENMASK(14, 1) 347 + #define XGMAC_RBSZ_SHIFT 1 346 348 #define XGMAC_RXST BIT(0) 347 349 #define XGMAC_DMA_CH_TxDESC_HADDR(x) (0x00003110 + (0x80 * (x))) 348 350 #define XGMAC_DMA_CH_TxDESC_LADDR(x) (0x00003114 + (0x80 * (x)))
+2 -1
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
··· 482 482 u32 value; 483 483 484 484 value = readl(ioaddr + XGMAC_DMA_CH_RX_CONTROL(chan)); 485 - value |= bfsize << 1; 485 + value &= ~XGMAC_RBSZ; 486 + value |= bfsize << XGMAC_RBSZ_SHIFT; 486 487 writel(value, ioaddr + XGMAC_DMA_CH_RX_CONTROL(chan)); 487 488 } 488 489
+32 -21
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 46 46 #include "dwxgmac2.h" 47 47 #include "hwif.h" 48 48 49 - #define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES) 49 + #define STMMAC_ALIGN(x) ALIGN(ALIGN(x, SMP_CACHE_BYTES), 16) 50 50 #define TSO_MAX_BUFF_SIZE (SZ_16K - 1) 51 51 52 52 /* Module parameters */ ··· 1109 1109 { 1110 1110 int ret = bufsize; 1111 1111 1112 - if (mtu >= BUF_SIZE_4KiB) 1112 + if (mtu >= BUF_SIZE_8KiB) 1113 + ret = BUF_SIZE_16KiB; 1114 + else if (mtu >= BUF_SIZE_4KiB) 1113 1115 ret = BUF_SIZE_8KiB; 1114 1116 else if (mtu >= BUF_SIZE_2KiB) 1115 1117 ret = BUF_SIZE_4KiB; ··· 1295 1293 struct stmmac_priv *priv = netdev_priv(dev); 1296 1294 u32 rx_count = priv->plat->rx_queues_to_use; 1297 1295 int ret = -ENOMEM; 1298 - int bfsize = 0; 1299 1296 int queue; 1300 1297 int i; 1301 - 1302 - bfsize = stmmac_set_16kib_bfsize(priv, dev->mtu); 1303 - if (bfsize < 0) 1304 - bfsize = 0; 1305 - 1306 - if (bfsize < BUF_SIZE_16KiB) 1307 - bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); 1308 - 1309 - priv->dma_buf_sz = bfsize; 1310 1298 1311 1299 /* RX INITIALIZATION */ 1312 1300 netif_dbg(priv, probe, priv->dev, ··· 1338 1346 rx_q->dma_rx_phy, DMA_RX_SIZE, 0); 1339 1347 } 1340 1348 } 1341 - 1342 - buf_sz = bfsize; 1343 1349 1344 1350 return 0; 1345 1351 ··· 2648 2658 static int stmmac_open(struct net_device *dev) 2649 2659 { 2650 2660 struct stmmac_priv *priv = netdev_priv(dev); 2661 + int bfsize = 0; 2651 2662 u32 chan; 2652 2663 int ret; 2653 2664 ··· 2668 2677 memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); 2669 2678 priv->xstats.threshold = tc; 2670 2679 2671 - priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); 2680 + bfsize = stmmac_set_16kib_bfsize(priv, dev->mtu); 2681 + if (bfsize < 0) 2682 + bfsize = 0; 2683 + 2684 + if (bfsize < BUF_SIZE_16KiB) 2685 + bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); 2686 + 2687 + priv->dma_buf_sz = bfsize; 2688 + buf_sz = bfsize; 2689 + 2672 2690 priv->rx_copybreak = STMMAC_RX_COPYBREAK; 2673 2691 2674 2692 ret = alloc_dma_desc_resources(priv); ··· 3053 3053 tx_q->tx_count_frames = 0; 3054 3054 stmmac_set_tx_ic(priv, desc); 3055 3055 priv->xstats.tx_set_ic_bit++; 3056 - } else { 3057 - stmmac_tx_timer_arm(priv, queue); 3058 3056 } 3059 3057 3060 3058 /* We've used all descriptors we need for this skb, however, ··· 3123 3125 3124 3126 tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); 3125 3127 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); 3128 + stmmac_tx_timer_arm(priv, queue); 3126 3129 3127 3130 return NETDEV_TX_OK; 3128 3131 ··· 3275 3276 tx_q->tx_count_frames = 0; 3276 3277 stmmac_set_tx_ic(priv, desc); 3277 3278 priv->xstats.tx_set_ic_bit++; 3278 - } else { 3279 - stmmac_tx_timer_arm(priv, queue); 3280 3279 } 3281 3280 3282 3281 /* We've used all descriptors we need for this skb, however, ··· 3363 3366 3364 3367 tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); 3365 3368 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); 3369 + stmmac_tx_timer_arm(priv, queue); 3366 3370 3367 3371 return NETDEV_TX_OK; 3368 3372 ··· 3644 3646 * feature is always disabled and packets need to be 3645 3647 * stripped manually. 3646 3648 */ 3647 - if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00) || 3648 - unlikely(status != llc_snap)) { 3649 + if (likely(!(status & rx_not_ls)) && 3650 + (likely(priv->synopsys_id >= DWMAC_CORE_4_00) || 3651 + unlikely(status != llc_snap))) { 3649 3652 if (buf2_len) 3650 3653 buf2_len -= ETH_FCS_LEN; 3651 3654 else ··· 3828 3829 static int stmmac_change_mtu(struct net_device *dev, int new_mtu) 3829 3830 { 3830 3831 struct stmmac_priv *priv = netdev_priv(dev); 3832 + int txfifosz = priv->plat->tx_fifo_size; 3833 + 3834 + if (txfifosz == 0) 3835 + txfifosz = priv->dma_cap.tx_fifo_size; 3836 + 3837 + txfifosz /= priv->plat->tx_queues_to_use; 3831 3838 3832 3839 if (netif_running(dev)) { 3833 3840 netdev_err(priv->dev, "must be stopped to change its MTU\n"); 3834 3841 return -EBUSY; 3835 3842 } 3843 + 3844 + new_mtu = STMMAC_ALIGN(new_mtu); 3845 + 3846 + /* If condition true, FIFO is too small or MTU too large */ 3847 + if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) 3848 + return -EINVAL; 3836 3849 3837 3850 dev->mtu = new_mtu; 3838 3851
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 320 320 static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, 321 321 struct device_node *np, struct device *dev) 322 322 { 323 - bool mdio = true; 323 + bool mdio = false; 324 324 static const struct of_device_id need_mdio_ids[] = { 325 325 { .compatible = "snps,dwc-qos-ethernet-4.10" }, 326 326 {},
+4
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
··· 624 624 return -EOPNOTSUPP; 625 625 if (netdev_uc_count(priv->dev) >= priv->hw->unicast_filter_entries) 626 626 return -EOPNOTSUPP; 627 + if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) 628 + return -EOPNOTSUPP; 627 629 628 630 while (--tries) { 629 631 /* We only need to check the mc_addr for collisions */ ··· 667 665 int ret, tries = 256; 668 666 669 667 if (stmmac_filter_check(priv)) 668 + return -EOPNOTSUPP; 669 + if (netdev_uc_count(priv->dev) >= priv->hw->unicast_filter_entries) 670 670 return -EOPNOTSUPP; 671 671 if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) 672 672 return -EOPNOTSUPP;
+1
drivers/net/ethernet/ti/Kconfig
··· 63 63 tristate "TI CPSW Switch Support with switchdev" 64 64 depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST 65 65 depends on NET_SWITCHDEV 66 + select PAGE_POOL 66 67 select TI_DAVINCI_MDIO 67 68 select MFD_SYSCON 68 69 select REGMAP
+1
drivers/net/ethernet/ti/Makefile
··· 5 5 6 6 obj-$(CONFIG_TI_CPSW) += cpsw-common.o 7 7 obj-$(CONFIG_TI_DAVINCI_EMAC) += cpsw-common.o 8 + obj-$(CONFIG_TI_CPSW_SWITCHDEV) += cpsw-common.o 8 9 9 10 obj-$(CONFIG_TLAN) += tlan.o 10 11 obj-$(CONFIG_CPMAC) += cpmac.o
+2 -3
drivers/net/ethernet/ti/davinci_cpdma.c
··· 1018 1018 struct cpdma_chan *chan = si->chan; 1019 1019 struct cpdma_ctlr *ctlr = chan->ctlr; 1020 1020 int len = si->len; 1021 - int swlen = len; 1022 1021 struct cpdma_desc __iomem *desc; 1023 1022 dma_addr_t buffer; 1024 1023 u32 mode; ··· 1045 1046 if (si->data_dma) { 1046 1047 buffer = si->data_dma; 1047 1048 dma_sync_single_for_device(ctlr->dev, buffer, len, chan->dir); 1048 - swlen |= CPDMA_DMA_EXT_MAP; 1049 1049 } else { 1050 1050 buffer = dma_map_single(ctlr->dev, si->data_virt, len, chan->dir); 1051 1051 ret = dma_mapping_error(ctlr->dev, buffer); ··· 1063 1065 writel_relaxed(mode | len, &desc->hw_mode); 1064 1066 writel_relaxed((uintptr_t)si->token, &desc->sw_token); 1065 1067 writel_relaxed(buffer, &desc->sw_buffer); 1066 - writel_relaxed(swlen, &desc->sw_len); 1068 + writel_relaxed(si->data_dma ? len | CPDMA_DMA_EXT_MAP : len, 1069 + &desc->sw_len); 1067 1070 desc_read(desc, sw_len); 1068 1071 1069 1072 __cpdma_chan_submit(chan, desc);
+3
drivers/net/fjes/fjes_main.c
··· 166 166 /* create platform_device */ 167 167 plat_dev = platform_device_register_simple(DRV_NAME, 0, fjes_resource, 168 168 ARRAY_SIZE(fjes_resource)); 169 + if (IS_ERR(plat_dev)) 170 + return PTR_ERR(plat_dev); 171 + 169 172 device->driver_data = plat_dev; 170 173 171 174 return 0;
+63 -46
drivers/net/gtp.c
··· 38 38 struct hlist_node hlist_addr; 39 39 40 40 union { 41 - u64 tid; 42 41 struct { 43 42 u64 tid; 44 43 u16 flow; ··· 640 641 } 641 642 642 643 static int gtp_hashtable_new(struct gtp_dev *gtp, int hsize); 643 - static void gtp_hashtable_free(struct gtp_dev *gtp); 644 644 static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[]); 645 + 646 + static void gtp_destructor(struct net_device *dev) 647 + { 648 + struct gtp_dev *gtp = netdev_priv(dev); 649 + 650 + kfree(gtp->addr_hash); 651 + kfree(gtp->tid_hash); 652 + } 645 653 646 654 static int gtp_newlink(struct net *src_net, struct net_device *dev, 647 655 struct nlattr *tb[], struct nlattr *data[], ··· 667 661 if (err < 0) 668 662 return err; 669 663 670 - if (!data[IFLA_GTP_PDP_HASHSIZE]) 664 + if (!data[IFLA_GTP_PDP_HASHSIZE]) { 671 665 hashsize = 1024; 672 - else 666 + } else { 673 667 hashsize = nla_get_u32(data[IFLA_GTP_PDP_HASHSIZE]); 668 + if (!hashsize) 669 + hashsize = 1024; 670 + } 674 671 675 672 err = gtp_hashtable_new(gtp, hashsize); 676 673 if (err < 0) ··· 687 678 688 679 gn = net_generic(dev_net(dev), gtp_net_id); 689 680 list_add_rcu(&gtp->list, &gn->gtp_dev_list); 681 + dev->priv_destructor = gtp_destructor; 690 682 691 683 netdev_dbg(dev, "registered new GTP interface\n"); 692 684 693 685 return 0; 694 686 695 687 out_hashtable: 696 - gtp_hashtable_free(gtp); 688 + kfree(gtp->addr_hash); 689 + kfree(gtp->tid_hash); 697 690 out_encap: 698 691 gtp_encap_disable(gtp); 699 692 return err; ··· 704 693 static void gtp_dellink(struct net_device *dev, struct list_head *head) 705 694 { 706 695 struct gtp_dev *gtp = netdev_priv(dev); 696 + struct pdp_ctx *pctx; 697 + int i; 707 698 708 - gtp_hashtable_free(gtp); 699 + for (i = 0; i < gtp->hash_size; i++) 700 + hlist_for_each_entry_rcu(pctx, &gtp->tid_hash[i], hlist_tid) 701 + pdp_context_delete(pctx); 702 + 709 703 list_del_rcu(&gtp->list); 710 704 unregister_netdevice_queue(dev, head); 711 705 } ··· 786 770 err1: 787 771 kfree(gtp->addr_hash); 788 772 return -ENOMEM; 789 - } 790 - 791 - static void gtp_hashtable_free(struct gtp_dev *gtp) 792 - { 793 - struct pdp_ctx *pctx; 794 - int i; 795 - 796 - for (i = 0; i < gtp->hash_size; i++) 797 - hlist_for_each_entry_rcu(pctx, &gtp->tid_hash[i], hlist_tid) 798 - pdp_context_delete(pctx); 799 - 800 - synchronize_rcu(); 801 - kfree(gtp->addr_hash); 802 - kfree(gtp->tid_hash); 803 773 } 804 774 805 775 static struct sock *gtp_encap_enable_socket(int fd, int type, ··· 928 926 } 929 927 } 930 928 931 - static int ipv4_pdp_add(struct gtp_dev *gtp, struct sock *sk, 932 - struct genl_info *info) 929 + static int gtp_pdp_add(struct gtp_dev *gtp, struct sock *sk, 930 + struct genl_info *info) 933 931 { 932 + struct pdp_ctx *pctx, *pctx_tid = NULL; 934 933 struct net_device *dev = gtp->dev; 935 934 u32 hash_ms, hash_tid = 0; 936 - struct pdp_ctx *pctx; 935 + unsigned int version; 937 936 bool found = false; 938 937 __be32 ms_addr; 939 938 940 939 ms_addr = nla_get_be32(info->attrs[GTPA_MS_ADDRESS]); 941 940 hash_ms = ipv4_hashfn(ms_addr) % gtp->hash_size; 941 + version = nla_get_u32(info->attrs[GTPA_VERSION]); 942 942 943 - hlist_for_each_entry_rcu(pctx, &gtp->addr_hash[hash_ms], hlist_addr) { 944 - if (pctx->ms_addr_ip4.s_addr == ms_addr) { 945 - found = true; 946 - break; 947 - } 948 - } 943 + pctx = ipv4_pdp_find(gtp, ms_addr); 944 + if (pctx) 945 + found = true; 946 + if (version == GTP_V0) 947 + pctx_tid = gtp0_pdp_find(gtp, 948 + nla_get_u64(info->attrs[GTPA_TID])); 949 + else if (version == GTP_V1) 950 + pctx_tid = gtp1_pdp_find(gtp, 951 + nla_get_u32(info->attrs[GTPA_I_TEI])); 952 + if (pctx_tid) 953 + found = true; 949 954 950 955 if (found) { 951 956 if (info->nlhdr->nlmsg_flags & NLM_F_EXCL) 952 957 return -EEXIST; 953 958 if (info->nlhdr->nlmsg_flags & NLM_F_REPLACE) 954 959 return -EOPNOTSUPP; 960 + 961 + if (pctx && pctx_tid) 962 + return -EEXIST; 963 + if (!pctx) 964 + pctx = pctx_tid; 955 965 956 966 ipv4_pdp_fill(pctx, info); 957 967 ··· 1088 1074 goto out_unlock; 1089 1075 } 1090 1076 1091 - err = ipv4_pdp_add(gtp, sk, info); 1077 + err = gtp_pdp_add(gtp, sk, info); 1092 1078 1093 1079 out_unlock: 1094 1080 rcu_read_unlock(); ··· 1246 1232 struct netlink_callback *cb) 1247 1233 { 1248 1234 struct gtp_dev *last_gtp = (struct gtp_dev *)cb->args[2], *gtp; 1235 + int i, j, bucket = cb->args[0], skip = cb->args[1]; 1249 1236 struct net *net = sock_net(skb->sk); 1250 - struct gtp_net *gn = net_generic(net, gtp_net_id); 1251 - unsigned long tid = cb->args[1]; 1252 - int i, k = cb->args[0], ret; 1253 1237 struct pdp_ctx *pctx; 1238 + struct gtp_net *gn; 1239 + 1240 + gn = net_generic(net, gtp_net_id); 1254 1241 1255 1242 if (cb->args[4]) 1256 1243 return 0; 1257 1244 1245 + rcu_read_lock(); 1258 1246 list_for_each_entry_rcu(gtp, &gn->gtp_dev_list, list) { 1259 1247 if (last_gtp && last_gtp != gtp) 1260 1248 continue; 1261 1249 else 1262 1250 last_gtp = NULL; 1263 1251 1264 - for (i = k; i < gtp->hash_size; i++) { 1265 - hlist_for_each_entry_rcu(pctx, &gtp->tid_hash[i], hlist_tid) { 1266 - if (tid && tid != pctx->u.tid) 1267 - continue; 1268 - else 1269 - tid = 0; 1270 - 1271 - ret = gtp_genl_fill_info(skb, 1272 - NETLINK_CB(cb->skb).portid, 1273 - cb->nlh->nlmsg_seq, 1274 - cb->nlh->nlmsg_type, pctx); 1275 - if (ret < 0) { 1252 + for (i = bucket; i < gtp->hash_size; i++) { 1253 + j = 0; 1254 + hlist_for_each_entry_rcu(pctx, &gtp->tid_hash[i], 1255 + hlist_tid) { 1256 + if (j >= skip && 1257 + gtp_genl_fill_info(skb, 1258 + NETLINK_CB(cb->skb).portid, 1259 + cb->nlh->nlmsg_seq, 1260 + cb->nlh->nlmsg_type, pctx)) { 1276 1261 cb->args[0] = i; 1277 - cb->args[1] = pctx->u.tid; 1262 + cb->args[1] = j; 1278 1263 cb->args[2] = (unsigned long)gtp; 1279 1264 goto out; 1280 1265 } 1266 + j++; 1281 1267 } 1268 + skip = 0; 1282 1269 } 1270 + bucket = 0; 1283 1271 } 1284 1272 cb->args[4] = 1; 1285 1273 out: 1274 + rcu_read_unlock(); 1286 1275 return skb->len; 1287 1276 } 1288 1277
+2 -2
drivers/net/hamradio/6pack.c
··· 654 654 { 655 655 struct sixpack *sp; 656 656 657 - write_lock_bh(&disc_data_lock); 657 + write_lock_irq(&disc_data_lock); 658 658 sp = tty->disc_data; 659 659 tty->disc_data = NULL; 660 - write_unlock_bh(&disc_data_lock); 660 + write_unlock_irq(&disc_data_lock); 661 661 if (!sp) 662 662 return; 663 663
+2 -2
drivers/net/hamradio/mkiss.c
··· 773 773 { 774 774 struct mkiss *ax; 775 775 776 - write_lock_bh(&disc_data_lock); 776 + write_lock_irq(&disc_data_lock); 777 777 ax = tty->disc_data; 778 778 tty->disc_data = NULL; 779 - write_unlock_bh(&disc_data_lock); 779 + write_unlock_irq(&disc_data_lock); 780 780 781 781 if (!ax) 782 782 return;
+2 -1
drivers/net/hyperv/hyperv_net.h
··· 169 169 170 170 u8 hw_mac_adr[ETH_ALEN]; 171 171 u8 rss_key[NETVSC_HASH_KEYLEN]; 172 - u16 rx_table[ITAB_NUM]; 173 172 }; 174 173 175 174 ··· 938 939 u32 tx_checksum_mask; 939 940 940 941 u32 tx_table[VRSS_SEND_TAB_SIZE]; 942 + 943 + u16 rx_table[ITAB_NUM]; 941 944 942 945 /* Ethtool settings */ 943 946 u8 duplex;
+2 -2
drivers/net/hyperv/netvsc_drv.c
··· 1662 1662 rndis_dev = ndev->extension; 1663 1663 if (indir) { 1664 1664 for (i = 0; i < ITAB_NUM; i++) 1665 - indir[i] = rndis_dev->rx_table[i]; 1665 + indir[i] = ndc->rx_table[i]; 1666 1666 } 1667 1667 1668 1668 if (key) ··· 1692 1692 return -EINVAL; 1693 1693 1694 1694 for (i = 0; i < ITAB_NUM; i++) 1695 - rndis_dev->rx_table[i] = indir[i]; 1695 + ndc->rx_table[i] = indir[i]; 1696 1696 } 1697 1697 1698 1698 if (!key) {
+10 -6
drivers/net/hyperv/rndis_filter.c
··· 773 773 const u8 *rss_key, u16 flag) 774 774 { 775 775 struct net_device *ndev = rdev->ndev; 776 + struct net_device_context *ndc = netdev_priv(ndev); 776 777 struct rndis_request *request; 777 778 struct rndis_set_request *set; 778 779 struct rndis_set_complete *set_complete; ··· 813 812 /* Set indirection table entries */ 814 813 itab = (u32 *)(rssp + 1); 815 814 for (i = 0; i < ITAB_NUM; i++) 816 - itab[i] = rdev->rx_table[i]; 815 + itab[i] = ndc->rx_table[i]; 817 816 818 817 /* Set hask key values */ 819 818 keyp = (u8 *)((unsigned long)rssp + rssp->hashkey_offset); ··· 1172 1171 wait_event(nvdev->subchan_open, 1173 1172 atomic_read(&nvdev->open_chn) == nvdev->num_chn); 1174 1173 1174 + for (i = 0; i < VRSS_SEND_TAB_SIZE; i++) 1175 + ndev_ctx->tx_table[i] = i % nvdev->num_chn; 1176 + 1175 1177 /* ignore failures from setting rss parameters, still have channels */ 1176 1178 if (dev_info) 1177 1179 rndis_filter_set_rss_param(rdev, dev_info->rss_key); ··· 1183 1179 1184 1180 netif_set_real_num_tx_queues(ndev, nvdev->num_chn); 1185 1181 netif_set_real_num_rx_queues(ndev, nvdev->num_chn); 1186 - 1187 - for (i = 0; i < VRSS_SEND_TAB_SIZE; i++) 1188 - ndev_ctx->tx_table[i] = i % nvdev->num_chn; 1189 1182 1190 1183 return 0; 1191 1184 } ··· 1313 1312 struct netvsc_device_info *device_info) 1314 1313 { 1315 1314 struct net_device *net = hv_get_drvdata(dev); 1315 + struct net_device_context *ndc = netdev_priv(net); 1316 1316 struct netvsc_device *net_device; 1317 1317 struct rndis_device *rndis_device; 1318 1318 struct ndis_recv_scale_cap rsscap; ··· 1400 1398 /* We will use the given number of channels if available. */ 1401 1399 net_device->num_chn = min(net_device->max_chn, device_info->num_chn); 1402 1400 1403 - for (i = 0; i < ITAB_NUM; i++) 1404 - rndis_device->rx_table[i] = ethtool_rxfh_indir_default( 1401 + if (!netif_is_rxfh_configured(net)) { 1402 + for (i = 0; i < ITAB_NUM; i++) 1403 + ndc->rx_table[i] = ethtool_rxfh_indir_default( 1405 1404 i, net_device->num_chn); 1405 + } 1406 1406 1407 1407 atomic_set(&net_device->open_chn, 1); 1408 1408 vmbus_set_sc_create_callback(dev->channel, netvsc_sc_open);
+4 -4
drivers/net/phy/phy_device.c
··· 553 553 .pm = MDIO_BUS_PHY_PM_OPS, 554 554 }; 555 555 556 - static int phy_request_driver_module(struct phy_device *dev, int phy_id) 556 + static int phy_request_driver_module(struct phy_device *dev, u32 phy_id) 557 557 { 558 558 int ret; 559 559 ··· 565 565 * then modprobe isn't available. 566 566 */ 567 567 if (IS_ENABLED(CONFIG_MODULES) && ret < 0 && ret != -ENOENT) { 568 - phydev_err(dev, "error %d loading PHY driver module for ID 0x%08x\n", 569 - ret, phy_id); 568 + phydev_err(dev, "error %d loading PHY driver module for ID 0x%08lx\n", 569 + ret, (unsigned long)phy_id); 570 570 return ret; 571 571 } 572 572 573 573 return 0; 574 574 } 575 575 576 - struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 576 + struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, 577 577 bool is_c45, 578 578 struct phy_c45_device_ids *c45_ids) 579 579 {
+1 -2
drivers/net/phy/phylink.c
··· 442 442 443 443 pl->cur_interface = link_state.interface; 444 444 pl->ops->mac_link_up(pl->config, pl->link_an_mode, 445 - pl->phy_state.interface, 446 - pl->phydev); 445 + pl->cur_interface, pl->phydev); 447 446 448 447 if (ndev) 449 448 netif_carrier_on(ndev);
+2 -1
drivers/net/usb/lan78xx.c
··· 511 511 } 512 512 } else { 513 513 netdev_warn(dev->net, 514 - "Failed to read stat ret = 0x%x", ret); 514 + "Failed to read stat ret = %d", ret); 515 515 } 516 516 517 517 kfree(stats); ··· 1808 1808 dev->mdiobus->read = lan78xx_mdiobus_read; 1809 1809 dev->mdiobus->write = lan78xx_mdiobus_write; 1810 1810 dev->mdiobus->name = "lan78xx-mdiobus"; 1811 + dev->mdiobus->parent = &dev->udev->dev; 1811 1812 1812 1813 snprintf(dev->mdiobus->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", 1813 1814 dev->udev->bus->busnum, dev->udev->devnum);
+1
drivers/net/wireless/ath/ath10k/mac.c
··· 8958 8958 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); 8959 8959 wiphy_ext_feature_set(ar->hw->wiphy, 8960 8960 NL80211_EXT_FEATURE_SET_SCAN_DWELL); 8961 + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); 8961 8962 8962 8963 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || 8963 8964 test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map))
+1 -1
drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
··· 83 83 val = swahb32(val); 84 84 } 85 85 86 - __raw_writel(val, mem + reg); 86 + iowrite32(val, mem + reg); 87 87 usleep_range(100, 120); 88 88 } 89 89
+12 -12
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 1111 1111 1112 1112 /* same thing for QuZ... */ 1113 1113 if (iwl_trans->hw_rev == CSR_HW_REV_TYPE_QUZ) { 1114 - if (iwl_trans->cfg == &iwl_ax101_cfg_qu_hr) 1115 - iwl_trans->cfg = &iwl_ax101_cfg_quz_hr; 1116 - else if (iwl_trans->cfg == &iwl_ax201_cfg_qu_hr) 1117 - iwl_trans->cfg = &iwl_ax201_cfg_quz_hr; 1118 - else if (iwl_trans->cfg == &iwl9461_2ac_cfg_qu_b0_jf_b0) 1119 - iwl_trans->cfg = &iwl9461_2ac_cfg_quz_a0_jf_b0_soc; 1120 - else if (iwl_trans->cfg == &iwl9462_2ac_cfg_qu_b0_jf_b0) 1121 - iwl_trans->cfg = &iwl9462_2ac_cfg_quz_a0_jf_b0_soc; 1122 - else if (iwl_trans->cfg == &iwl9560_2ac_cfg_qu_b0_jf_b0) 1123 - iwl_trans->cfg = &iwl9560_2ac_cfg_quz_a0_jf_b0_soc; 1124 - else if (iwl_trans->cfg == &iwl9560_2ac_160_cfg_qu_b0_jf_b0) 1125 - iwl_trans->cfg = &iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc; 1114 + if (cfg == &iwl_ax101_cfg_qu_hr) 1115 + cfg = &iwl_ax101_cfg_quz_hr; 1116 + else if (cfg == &iwl_ax201_cfg_qu_hr) 1117 + cfg = &iwl_ax201_cfg_quz_hr; 1118 + else if (cfg == &iwl9461_2ac_cfg_qu_b0_jf_b0) 1119 + cfg = &iwl9461_2ac_cfg_quz_a0_jf_b0_soc; 1120 + else if (cfg == &iwl9462_2ac_cfg_qu_b0_jf_b0) 1121 + cfg = &iwl9462_2ac_cfg_quz_a0_jf_b0_soc; 1122 + else if (cfg == &iwl9560_2ac_cfg_qu_b0_jf_b0) 1123 + cfg = &iwl9560_2ac_cfg_quz_a0_jf_b0_soc; 1124 + else if (cfg == &iwl9560_2ac_160_cfg_qu_b0_jf_b0) 1125 + cfg = &iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc; 1126 1126 } 1127 1127 1128 1128 #endif
-25
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
··· 57 57 #include "internal.h" 58 58 #include "fw/dbg.h" 59 59 60 - static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans) 61 - { 62 - iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, 63 - HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); 64 - udelay(20); 65 - iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, 66 - HPM_HIPM_GEN_CFG_CR_PG_EN | 67 - HPM_HIPM_GEN_CFG_CR_SLP_EN); 68 - udelay(20); 69 - iwl_clear_bits_prph(trans, HPM_HIPM_GEN_CFG, 70 - HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); 71 - 72 - iwl_trans_sw_reset(trans); 73 - iwl_clear_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 74 - 75 - return 0; 76 - } 77 - 78 60 /* 79 61 * Start up NIC's basic functionality after it has been reset 80 62 * (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop()) ··· 91 109 CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); 92 110 93 111 iwl_pcie_apm_config(trans); 94 - 95 - if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 && 96 - trans->cfg->integrated) { 97 - ret = iwl_pcie_gen2_force_power_gating(trans); 98 - if (ret) 99 - return ret; 100 - } 101 112 102 113 ret = iwl_finish_nic_init(trans, trans->trans_cfg); 103 114 if (ret)
+30
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 1783 1783 return 0; 1784 1784 } 1785 1785 1786 + static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans) 1787 + { 1788 + int ret; 1789 + 1790 + ret = iwl_finish_nic_init(trans, trans->trans_cfg); 1791 + if (ret < 0) 1792 + return ret; 1793 + 1794 + iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, 1795 + HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); 1796 + udelay(20); 1797 + iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, 1798 + HPM_HIPM_GEN_CFG_CR_PG_EN | 1799 + HPM_HIPM_GEN_CFG_CR_SLP_EN); 1800 + udelay(20); 1801 + iwl_clear_bits_prph(trans, HPM_HIPM_GEN_CFG, 1802 + HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); 1803 + 1804 + iwl_trans_pcie_sw_reset(trans); 1805 + 1806 + return 0; 1807 + } 1808 + 1786 1809 static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans) 1787 1810 { 1788 1811 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); ··· 1824 1801 return err; 1825 1802 1826 1803 iwl_trans_pcie_sw_reset(trans); 1804 + 1805 + if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 && 1806 + trans->cfg->integrated) { 1807 + err = iwl_pcie_gen2_force_power_gating(trans); 1808 + if (err) 1809 + return err; 1810 + } 1827 1811 1828 1812 err = iwl_pcie_apm_init(trans); 1829 1813 if (err)
+11 -2
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
··· 229 229 "11D: skip setting domain info in FW\n"); 230 230 return 0; 231 231 } 232 + 233 + if (country_ie_len > 234 + (IEEE80211_COUNTRY_STRING_LEN + MWIFIEX_MAX_TRIPLET_802_11D)) { 235 + mwifiex_dbg(priv->adapter, ERROR, 236 + "11D: country_ie_len overflow!, deauth AP\n"); 237 + return -EINVAL; 238 + } 239 + 232 240 memcpy(priv->adapter->country_code, &country_ie[2], 2); 233 241 234 242 domain_info->country_code[0] = country_ie[2]; ··· 280 272 priv->scan_block = false; 281 273 282 274 if (bss) { 283 - if (adapter->region_code == 0x00) 284 - mwifiex_process_country_ie(priv, bss); 275 + if (adapter->region_code == 0x00 && 276 + mwifiex_process_country_ie(priv, bss)) 277 + return -EINVAL; 285 278 286 279 /* Allocate and fill new bss descriptor */ 287 280 bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
+64 -6
drivers/net/wireless/marvell/mwifiex/tdls.c
··· 953 953 954 954 switch (*pos) { 955 955 case WLAN_EID_SUPP_RATES: 956 + if (pos[1] > 32) 957 + return; 956 958 sta_ptr->tdls_cap.rates_len = pos[1]; 957 959 for (i = 0; i < pos[1]; i++) 958 960 sta_ptr->tdls_cap.rates[i] = pos[i + 2]; 959 961 break; 960 962 961 963 case WLAN_EID_EXT_SUPP_RATES: 964 + if (pos[1] > 32) 965 + return; 962 966 basic = sta_ptr->tdls_cap.rates_len; 967 + if (pos[1] > 32 - basic) 968 + return; 963 969 for (i = 0; i < pos[1]; i++) 964 970 sta_ptr->tdls_cap.rates[basic + i] = pos[i + 2]; 965 971 sta_ptr->tdls_cap.rates_len += pos[1]; 966 972 break; 967 973 case WLAN_EID_HT_CAPABILITY: 968 - memcpy((u8 *)&sta_ptr->tdls_cap.ht_capb, pos, 974 + if (pos > end - sizeof(struct ieee80211_ht_cap) - 2) 975 + return; 976 + if (pos[1] != sizeof(struct ieee80211_ht_cap)) 977 + return; 978 + /* copy the ie's value into ht_capb*/ 979 + memcpy((u8 *)&sta_ptr->tdls_cap.ht_capb, pos + 2, 969 980 sizeof(struct ieee80211_ht_cap)); 970 981 sta_ptr->is_11n_enabled = 1; 971 982 break; 972 983 case WLAN_EID_HT_OPERATION: 973 - memcpy(&sta_ptr->tdls_cap.ht_oper, pos, 984 + if (pos > end - 985 + sizeof(struct ieee80211_ht_operation) - 2) 986 + return; 987 + if (pos[1] != sizeof(struct ieee80211_ht_operation)) 988 + return; 989 + /* copy the ie's value into ht_oper*/ 990 + memcpy(&sta_ptr->tdls_cap.ht_oper, pos + 2, 974 991 sizeof(struct ieee80211_ht_operation)); 975 992 break; 976 993 case WLAN_EID_BSS_COEX_2040: 994 + if (pos > end - 3) 995 + return; 996 + if (pos[1] != 1) 997 + return; 977 998 sta_ptr->tdls_cap.coex_2040 = pos[2]; 978 999 break; 979 1000 case WLAN_EID_EXT_CAPABILITY: 1001 + if (pos > end - sizeof(struct ieee_types_header)) 1002 + return; 1003 + if (pos[1] < sizeof(struct ieee_types_header)) 1004 + return; 1005 + if (pos[1] > 8) 1006 + return; 980 1007 memcpy((u8 *)&sta_ptr->tdls_cap.extcap, pos, 981 1008 sizeof(struct ieee_types_header) + 982 1009 min_t(u8, pos[1], 8)); 983 1010 break; 984 1011 case WLAN_EID_RSN: 1012 + if (pos > end - sizeof(struct ieee_types_header)) 1013 + return; 1014 + if (pos[1] < sizeof(struct ieee_types_header)) 1015 + return; 1016 + if (pos[1] > IEEE_MAX_IE_SIZE - 1017 + sizeof(struct ieee_types_header)) 1018 + return; 985 1019 memcpy((u8 *)&sta_ptr->tdls_cap.rsn_ie, pos, 986 1020 sizeof(struct ieee_types_header) + 987 1021 min_t(u8, pos[1], IEEE_MAX_IE_SIZE - 988 1022 sizeof(struct ieee_types_header))); 989 1023 break; 990 1024 case WLAN_EID_QOS_CAPA: 1025 + if (pos > end - 3) 1026 + return; 1027 + if (pos[1] != 1) 1028 + return; 991 1029 sta_ptr->tdls_cap.qos_info = pos[2]; 992 1030 break; 993 1031 case WLAN_EID_VHT_OPERATION: 994 - if (priv->adapter->is_hw_11ac_capable) 995 - memcpy(&sta_ptr->tdls_cap.vhtoper, pos, 1032 + if (priv->adapter->is_hw_11ac_capable) { 1033 + if (pos > end - 1034 + sizeof(struct ieee80211_vht_operation) - 2) 1035 + return; 1036 + if (pos[1] != 1037 + sizeof(struct ieee80211_vht_operation)) 1038 + return; 1039 + /* copy the ie's value into vhtoper*/ 1040 + memcpy(&sta_ptr->tdls_cap.vhtoper, pos + 2, 996 1041 sizeof(struct ieee80211_vht_operation)); 1042 + } 997 1043 break; 998 1044 case WLAN_EID_VHT_CAPABILITY: 999 1045 if (priv->adapter->is_hw_11ac_capable) { 1000 - memcpy((u8 *)&sta_ptr->tdls_cap.vhtcap, pos, 1046 + if (pos > end - 1047 + sizeof(struct ieee80211_vht_cap) - 2) 1048 + return; 1049 + if (pos[1] != sizeof(struct ieee80211_vht_cap)) 1050 + return; 1051 + /* copy the ie's value into vhtcap*/ 1052 + memcpy((u8 *)&sta_ptr->tdls_cap.vhtcap, pos + 2, 1001 1053 sizeof(struct ieee80211_vht_cap)); 1002 1054 sta_ptr->is_11ac_enabled = 1; 1003 1055 } 1004 1056 break; 1005 1057 case WLAN_EID_AID: 1006 - if (priv->adapter->is_hw_11ac_capable) 1058 + if (priv->adapter->is_hw_11ac_capable) { 1059 + if (pos > end - 4) 1060 + return; 1061 + if (pos[1] != 2) 1062 + return; 1007 1063 sta_ptr->tdls_cap.aid = 1008 1064 get_unaligned_le16((pos + 2)); 1065 + } 1066 + break; 1009 1067 default: 1010 1068 break; 1011 1069 }
+4 -1
drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
··· 342 342 dev_info(dev->mt76.dev, "EEPROM ver:%02hhx fae:%02hhx\n", 343 343 version, fae); 344 344 345 - mt76x02_mac_setaddr(dev, dev->mt76.eeprom.data + MT_EE_MAC_ADDR); 345 + memcpy(dev->mt76.macaddr, (u8 *)dev->mt76.eeprom.data + MT_EE_MAC_ADDR, 346 + ETH_ALEN); 346 347 mt76_eeprom_override(&dev->mt76); 348 + mt76x02_mac_setaddr(dev, dev->mt76.macaddr); 349 + 347 350 mt76x0_set_chip_cap(dev); 348 351 mt76x0_set_freq_offset(dev); 349 352 mt76x0_set_temp_offset(dev);
+12 -12
drivers/net/xen-netback/interface.c
··· 628 628 629 629 static void xenvif_disconnect_queue(struct xenvif_queue *queue) 630 630 { 631 - if (queue->tx_irq) { 632 - unbind_from_irqhandler(queue->tx_irq, queue); 633 - if (queue->tx_irq == queue->rx_irq) 634 - queue->rx_irq = 0; 635 - queue->tx_irq = 0; 636 - } 637 - 638 - if (queue->rx_irq) { 639 - unbind_from_irqhandler(queue->rx_irq, queue); 640 - queue->rx_irq = 0; 641 - } 642 - 643 631 if (queue->task) { 644 632 kthread_stop(queue->task); 645 633 queue->task = NULL; ··· 641 653 if (queue->napi.poll) { 642 654 netif_napi_del(&queue->napi); 643 655 queue->napi.poll = NULL; 656 + } 657 + 658 + if (queue->tx_irq) { 659 + unbind_from_irqhandler(queue->tx_irq, queue); 660 + if (queue->tx_irq == queue->rx_irq) 661 + queue->rx_irq = 0; 662 + queue->tx_irq = 0; 663 + } 664 + 665 + if (queue->rx_irq) { 666 + unbind_from_irqhandler(queue->rx_irq, queue); 667 + queue->rx_irq = 0; 644 668 } 645 669 646 670 xenvif_unmap_frontend_data_rings(queue);
+1 -1
drivers/nfc/nxp-nci/i2c.c
··· 278 278 279 279 r = devm_acpi_dev_add_driver_gpios(dev, acpi_nxp_nci_gpios); 280 280 if (r) 281 - return r; 281 + dev_dbg(dev, "Unable to add GPIO mapping table\n"); 282 282 283 283 phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); 284 284 if (IS_ERR(phy->gpiod_en)) {
+4 -1
drivers/nfc/s3fwrn5/firmware.c
··· 507 507 struct s3fwrn5_info *info = nci_get_drvdata(ndev); 508 508 struct s3fwrn5_fw_info *fw_info = &info->fw_info; 509 509 510 - BUG_ON(fw_info->rsp); 510 + if (WARN_ON(fw_info->rsp)) { 511 + kfree_skb(skb); 512 + return -EINVAL; 513 + } 511 514 512 515 fw_info->rsp = skb; 513 516
+2 -1
drivers/of/of_mdio.c
··· 162 162 * A device which is not a phy is expected to have a compatible string 163 163 * indicating what sort of device it is. 164 164 */ 165 - static bool of_mdiobus_child_is_phy(struct device_node *child) 165 + bool of_mdiobus_child_is_phy(struct device_node *child) 166 166 { 167 167 u32 phy_id; 168 168 ··· 187 187 188 188 return false; 189 189 } 190 + EXPORT_SYMBOL(of_mdiobus_child_is_phy); 190 191 191 192 /** 192 193 * of_mdiobus_register - Register mii_bus and create PHYs from the device tree
+1 -1
drivers/ptp/Kconfig
··· 121 121 122 122 config PTP_1588_CLOCK_IDTCM 123 123 tristate "IDT CLOCKMATRIX as PTP clock" 124 - depends on PTP_1588_CLOCK 124 + depends on PTP_1588_CLOCK && I2C 125 125 default n 126 126 help 127 127 This driver adds support for using IDT CLOCKMATRIX(TM) as a PTP
+7 -7
drivers/s390/net/qeth_core_main.c
··· 655 655 unsigned char *buffer) 656 656 { 657 657 QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN); 658 - if ((buffer[2] & 0xc0) == 0xc0) { 658 + if ((buffer[2] & QETH_IDX_TERMINATE_MASK) == QETH_IDX_TERMINATE) { 659 659 QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with cause code %#04x\n", 660 660 buffer[4]); 661 661 QETH_CARD_TEXT(card, 2, "ckidxres"); 662 662 QETH_CARD_TEXT(card, 2, " idxterm"); 663 - QETH_CARD_TEXT_(card, 2, " rc%d", -EIO); 664 - if (buffer[4] == 0xf6) { 663 + QETH_CARD_TEXT_(card, 2, "rc%x", buffer[4]); 664 + if (buffer[4] == QETH_IDX_TERM_BAD_TRANSPORT || 665 + buffer[4] == QETH_IDX_TERM_BAD_TRANSPORT_VM) { 665 666 dev_err(&card->gdev->dev, 666 - "The qeth device is not configured " 667 - "for the OSI layer required by z/VM\n"); 668 - return -EPERM; 667 + "The device does not support the configured transport mode\n"); 668 + return -EPROTONOSUPPORT; 669 669 } 670 670 return -EIO; 671 671 } ··· 742 742 case 0: 743 743 break; 744 744 case -EIO: 745 - qeth_clear_ipacmd_list(card); 746 745 qeth_schedule_recovery(card); 747 746 /* fall through */ 748 747 default: 748 + qeth_clear_ipacmd_list(card); 749 749 goto out; 750 750 } 751 751
+5
drivers/s390/net/qeth_core_mpc.h
··· 899 899 #define QETH_IDX_ACT_ERR_AUTH 0x1E 900 900 #define QETH_IDX_ACT_ERR_AUTH_USER 0x20 901 901 902 + #define QETH_IDX_TERMINATE 0xc0 903 + #define QETH_IDX_TERMINATE_MASK 0xc0 904 + #define QETH_IDX_TERM_BAD_TRANSPORT 0x41 905 + #define QETH_IDX_TERM_BAD_TRANSPORT_VM 0xf6 906 + 902 907 #define PDU_ENCAPSULATION(buffer) \ 903 908 (buffer + *(buffer + (*(buffer + 0x0b)) + \ 904 909 *(buffer + *(buffer + 0x0b) + 0x11) + 0x07))
+1 -1
drivers/s390/net/qeth_core_sys.c
··· 207 207 card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; 208 208 } else if (sysfs_streq(buf, "prio_queueing_vlan")) { 209 209 if (IS_LAYER3(card)) { 210 - rc = -ENOTSUPP; 210 + rc = -EOPNOTSUPP; 211 211 goto out; 212 212 } 213 213 card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_VLAN;
+1
drivers/s390/net/qeth_l2_main.c
··· 295 295 296 296 flush_workqueue(card->event_wq); 297 297 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; 298 + card->info.promisc_mode = 0; 298 299 } 299 300 300 301 static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
+2 -1
drivers/s390/net/qeth_l2_sys.c
··· 262 262 return; 263 263 264 264 mutex_lock(&card->sbp_lock); 265 - if (card->options.sbp.role != QETH_SBP_ROLE_NONE) { 265 + if (!card->options.sbp.reflect_promisc && 266 + card->options.sbp.role != QETH_SBP_ROLE_NONE) { 266 267 /* Conditional to avoid spurious error messages */ 267 268 qeth_bridgeport_setrole(card, card->options.sbp.role); 268 269 /* Let the callback function refresh the stored role value. */
+1
drivers/s390/net/qeth_l3_main.c
··· 1314 1314 } 1315 1315 1316 1316 flush_workqueue(card->event_wq); 1317 + card->info.promisc_mode = 0; 1317 1318 } 1318 1319 1319 1320 static void qeth_l3_set_promisc_mode(struct qeth_card *card)
+4 -4
include/linux/bpf-cgroup.h
··· 157 157 struct cgroup *cgroup, 158 158 enum bpf_attach_type type); 159 159 void bpf_cgroup_storage_unlink(struct bpf_cgroup_storage *storage); 160 - int bpf_cgroup_storage_assign(struct bpf_prog *prog, struct bpf_map *map); 161 - void bpf_cgroup_storage_release(struct bpf_prog *prog, struct bpf_map *map); 160 + int bpf_cgroup_storage_assign(struct bpf_prog_aux *aux, struct bpf_map *map); 161 + void bpf_cgroup_storage_release(struct bpf_prog_aux *aux, struct bpf_map *map); 162 162 163 163 int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, void *value); 164 164 int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, ··· 360 360 361 361 static inline void bpf_cgroup_storage_set( 362 362 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE]) {} 363 - static inline int bpf_cgroup_storage_assign(struct bpf_prog *prog, 363 + static inline int bpf_cgroup_storage_assign(struct bpf_prog_aux *aux, 364 364 struct bpf_map *map) { return 0; } 365 - static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, 365 + static inline void bpf_cgroup_storage_release(struct bpf_prog_aux *aux, 366 366 struct bpf_map *map) {} 367 367 static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( 368 368 struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; }
+3
include/linux/bpf.h
··· 461 461 struct { 462 462 struct btf_func_model model; 463 463 void *addr; 464 + bool ftrace_managed; 464 465 } func; 465 466 /* list of BPF programs using this trampoline */ 466 467 struct hlist_head progs_hlist[BPF_TRAMP_MAX]; ··· 818 817 void bpf_prog_put(struct bpf_prog *prog); 819 818 int __bpf_prog_charge(struct user_struct *user, u32 pages); 820 819 void __bpf_prog_uncharge(struct user_struct *user, u32 pages); 820 + void __bpf_free_used_maps(struct bpf_prog_aux *aux, 821 + struct bpf_map **used_maps, u32 len); 821 822 822 823 void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); 823 824 void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);
+2 -2
include/linux/mod_devicetable.h
··· 587 587 #define MDIO_NAME_SIZE 32 588 588 #define MDIO_MODULE_PREFIX "mdio:" 589 589 590 - #define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" 590 + #define MDIO_ID_FMT "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u" 591 591 #define MDIO_ID_ARGS(_id) \ 592 - (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ 592 + ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ 593 593 ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ 594 594 ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ 595 595 ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
+1 -1
include/linux/netdevice.h
··· 1775 1775 * for hardware timestamping 1776 1776 * @sfp_bus: attached &struct sfp_bus structure. 1777 1777 * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock 1778 - spinlock 1778 + * spinlock 1779 1779 * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount 1780 1780 * @qdisc_xmit_lock_key: lockdep class annotating 1781 1781 * netdev_queue->_xmit_lock spinlock
+6
include/linux/of_mdio.h
··· 12 12 #include <linux/of.h> 13 13 14 14 #if IS_ENABLED(CONFIG_OF_MDIO) 15 + extern bool of_mdiobus_child_is_phy(struct device_node *child); 15 16 extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); 16 17 extern struct phy_device *of_phy_find_device(struct device_node *phy_np); 17 18 extern struct phy_device *of_phy_connect(struct net_device *dev, ··· 55 54 } 56 55 57 56 #else /* CONFIG_OF_MDIO */ 57 + static bool of_mdiobus_child_is_phy(struct device_node *child) 58 + { 59 + return false; 60 + } 61 + 58 62 static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 59 63 { 60 64 /*
+1 -1
include/linux/phy.h
··· 1000 1000 int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum, 1001 1001 u16 mask, u16 set); 1002 1002 1003 - struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 1003 + struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, 1004 1004 bool is_c45, 1005 1005 struct phy_c45_device_ids *c45_ids); 1006 1006 #if IS_ENABLED(CONFIG_PHYLIB)
+37
include/linux/rculist_nulls.h
··· 101 101 } 102 102 103 103 /** 104 + * hlist_nulls_add_tail_rcu 105 + * @n: the element to add to the hash list. 106 + * @h: the list to add to. 107 + * 108 + * Description: 109 + * Adds the specified element to the specified hlist_nulls, 110 + * while permitting racing traversals. 111 + * 112 + * The caller must take whatever precautions are necessary 113 + * (such as holding appropriate locks) to avoid racing 114 + * with another list-mutation primitive, such as hlist_nulls_add_head_rcu() 115 + * or hlist_nulls_del_rcu(), running on this same list. 116 + * However, it is perfectly legal to run concurrently with 117 + * the _rcu list-traversal primitives, such as 118 + * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency 119 + * problems on Alpha CPUs. Regardless of the type of CPU, the 120 + * list-traversal primitive must be guarded by rcu_read_lock(). 121 + */ 122 + static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n, 123 + struct hlist_nulls_head *h) 124 + { 125 + struct hlist_nulls_node *i, *last = NULL; 126 + 127 + /* Note: write side code, so rcu accessors are not needed. */ 128 + for (i = h->first; !is_a_nulls(i); i = i->next) 129 + last = i; 130 + 131 + if (last) { 132 + n->next = last->next; 133 + n->pprev = &last->next; 134 + rcu_assign_pointer(hlist_next_rcu(last), n); 135 + } else { 136 + hlist_nulls_add_head_rcu(n, h); 137 + } 138 + } 139 + 140 + /** 104 141 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type 105 142 * @tpos: the type * to use as a loop cursor. 106 143 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
+1 -1
include/net/dst.h
··· 82 82 struct dst_metrics { 83 83 u32 metrics[RTAX_MAX]; 84 84 refcount_t refcnt; 85 - }; 85 + } __aligned(4); /* Low pointer bits contain DST_METRICS_FLAGS */ 86 86 extern const struct dst_metrics dst_default_metrics; 87 87 88 88 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
+9 -3
include/net/inet_hashtables.h
··· 103 103 struct hlist_head chain; 104 104 }; 105 105 106 - /* 107 - * Sockets can be hashed in established or listening table 106 + /* Sockets can be hashed in established or listening table. 107 + * We must use different 'nulls' end-of-chain value for all hash buckets : 108 + * A socket might transition from ESTABLISH to LISTEN state without 109 + * RCU grace period. A lookup in ehash table needs to handle this case. 108 110 */ 111 + #define LISTENING_NULLS_BASE (1U << 29) 109 112 struct inet_listen_hashbucket { 110 113 spinlock_t lock; 111 114 unsigned int count; 112 - struct hlist_head head; 115 + union { 116 + struct hlist_head head; 117 + struct hlist_nulls_head nulls_head; 118 + }; 113 119 }; 114 120 115 121 /* This is for listening sockets, thus all sockets which possess wildcards. */
-1
include/net/neighbour.h
··· 72 72 struct net_device *dev; 73 73 struct list_head list; 74 74 int (*neigh_setup)(struct neighbour *); 75 - void (*neigh_cleanup)(struct neighbour *); 76 75 struct neigh_table *tbl; 77 76 78 77 void *sysctl_table;
+7 -2
include/net/sock.h
··· 722 722 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); 723 723 } 724 724 725 + static inline void __sk_nulls_add_node_tail_rcu(struct sock *sk, struct hlist_nulls_head *list) 726 + { 727 + hlist_nulls_add_tail_rcu(&sk->sk_nulls_node, list); 728 + } 729 + 725 730 static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 726 731 { 727 732 sock_hold(sk); ··· 2588 2583 */ 2589 2584 static inline void sk_pacing_shift_update(struct sock *sk, int val) 2590 2585 { 2591 - if (!sk || !sk_fullsock(sk) || sk->sk_pacing_shift == val) 2586 + if (!sk || !sk_fullsock(sk) || READ_ONCE(sk->sk_pacing_shift) == val) 2592 2587 return; 2593 - sk->sk_pacing_shift = val; 2588 + WRITE_ONCE(sk->sk_pacing_shift, val); 2594 2589 } 2595 2590 2596 2591 /* if a socket is bound to a device, check that the given device
+10 -1
include/net/tcp.h
··· 1766 1766 return skb_queue_is_last(&sk->sk_write_queue, skb); 1767 1767 } 1768 1768 1769 + /** 1770 + * tcp_write_queue_empty - test if any payload (or FIN) is available in write queue 1771 + * @sk: socket 1772 + * 1773 + * Since the write queue can have a temporary empty skb in it, 1774 + * we must not use "return skb_queue_empty(&sk->sk_write_queue)" 1775 + */ 1769 1776 static inline bool tcp_write_queue_empty(const struct sock *sk) 1770 1777 { 1771 - return skb_queue_empty(&sk->sk_write_queue); 1778 + const struct tcp_sock *tp = tcp_sk(sk); 1779 + 1780 + return tp->write_seq == tp->snd_nxt; 1772 1781 } 1773 1782 1774 1783 static inline bool tcp_rtx_queue_empty(const struct sock *sk)
+2 -1
include/net/x25.h
··· 62 62 X25_STATE_1, /* Awaiting Call Accepted */ 63 63 X25_STATE_2, /* Awaiting Clear Confirmation */ 64 64 X25_STATE_3, /* Data Transfer */ 65 - X25_STATE_4 /* Awaiting Reset Confirmation */ 65 + X25_STATE_4, /* Awaiting Reset Confirmation */ 66 + X25_STATE_5 /* Call Accepted / Call Connected pending */ 66 67 }; 67 68 68 69 enum {
+3 -3
include/uapi/linux/netfilter/xt_sctp.h
··· 41 41 #define SCTP_CHUNKMAP_SET(chunkmap, type) \ 42 42 do { \ 43 43 (chunkmap)[type / bytes(__u32)] |= \ 44 - 1 << (type % bytes(__u32)); \ 44 + 1u << (type % bytes(__u32)); \ 45 45 } while (0) 46 46 47 47 #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ 48 48 do { \ 49 49 (chunkmap)[type / bytes(__u32)] &= \ 50 - ~(1 << (type % bytes(__u32))); \ 50 + ~(1u << (type % bytes(__u32))); \ 51 51 } while (0) 52 52 53 53 #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ 54 54 ({ \ 55 55 ((chunkmap)[type / bytes (__u32)] & \ 56 - (1 << (type % bytes (__u32)))) ? 1: 0; \ 56 + (1u << (type % bytes (__u32)))) ? 1: 0; \ 57 57 }) 58 58 59 59 #define SCTP_CHUNKMAP_RESET(chunkmap) \
+5
include/uapi/linux/nl80211.h
··· 5517 5517 * with VLAN tagged frames and separate VLAN-specific netdevs added using 5518 5518 * vconfig similarly to the Ethernet case. 5519 5519 * 5520 + * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL) 5521 + * feature, which prevents bufferbloat by using the expected transmission 5522 + * time to limit the amount of data buffered in the hardware. 5523 + * 5520 5524 * @NUM_NL80211_EXT_FEATURES: number of extended features. 5521 5525 * @MAX_NL80211_EXT_FEATURES: highest extended feature index. 5522 5526 */ ··· 5567 5563 NL80211_EXT_FEATURE_STA_TX_PWR, 5568 5564 NL80211_EXT_FEATURE_SAE_OFFLOAD, 5569 5565 NL80211_EXT_FEATURE_VLAN_OFFLOAD, 5566 + NL80211_EXT_FEATURE_AQL, 5570 5567 5571 5568 /* add new features before the definition below */ 5572 5569 NUM_NL80211_EXT_FEATURES,
+1
kernel/bpf/btf.c
··· 3470 3470 [_id] = __ctx_convert##_id, 3471 3471 #include <linux/bpf_types.h> 3472 3472 #undef BPF_PROG_TYPE 3473 + 0, /* avoid empty array */ 3473 3474 }; 3474 3475 #undef BPF_MAP_TYPE 3475 3476
+17 -12
kernel/bpf/core.c
··· 2043 2043 for_each_cgroup_storage_type(stype) { 2044 2044 if (!aux->cgroup_storage[stype]) 2045 2045 continue; 2046 - bpf_cgroup_storage_release(aux->prog, 2047 - aux->cgroup_storage[stype]); 2046 + bpf_cgroup_storage_release(aux, aux->cgroup_storage[stype]); 2047 + } 2048 + } 2049 + 2050 + void __bpf_free_used_maps(struct bpf_prog_aux *aux, 2051 + struct bpf_map **used_maps, u32 len) 2052 + { 2053 + struct bpf_map *map; 2054 + u32 i; 2055 + 2056 + bpf_free_cgroup_storage(aux); 2057 + for (i = 0; i < len; i++) { 2058 + map = used_maps[i]; 2059 + if (map->ops->map_poke_untrack) 2060 + map->ops->map_poke_untrack(map, aux); 2061 + bpf_map_put(map); 2048 2062 } 2049 2063 } 2050 2064 2051 2065 static void bpf_free_used_maps(struct bpf_prog_aux *aux) 2052 2066 { 2053 - struct bpf_map *map; 2054 - int i; 2055 - 2056 - bpf_free_cgroup_storage(aux); 2057 - for (i = 0; i < aux->used_map_cnt; i++) { 2058 - map = aux->used_maps[i]; 2059 - if (map->ops->map_poke_untrack) 2060 - map->ops->map_poke_untrack(map, aux); 2061 - bpf_map_put(map); 2062 - } 2067 + __bpf_free_used_maps(aux, aux->used_maps, aux->used_map_cnt); 2063 2068 kfree(aux->used_maps); 2064 2069 } 2065 2070
+12 -12
kernel/bpf/local_storage.c
··· 20 20 struct bpf_map map; 21 21 22 22 spinlock_t lock; 23 - struct bpf_prog *prog; 23 + struct bpf_prog_aux *aux; 24 24 struct rb_root root; 25 25 struct list_head list; 26 26 }; ··· 420 420 .map_seq_show_elem = cgroup_storage_seq_show_elem, 421 421 }; 422 422 423 - int bpf_cgroup_storage_assign(struct bpf_prog *prog, struct bpf_map *_map) 423 + int bpf_cgroup_storage_assign(struct bpf_prog_aux *aux, struct bpf_map *_map) 424 424 { 425 425 enum bpf_cgroup_storage_type stype = cgroup_storage_type(_map); 426 426 struct bpf_cgroup_storage_map *map = map_to_storage(_map); ··· 428 428 429 429 spin_lock_bh(&map->lock); 430 430 431 - if (map->prog && map->prog != prog) 431 + if (map->aux && map->aux != aux) 432 432 goto unlock; 433 - if (prog->aux->cgroup_storage[stype] && 434 - prog->aux->cgroup_storage[stype] != _map) 433 + if (aux->cgroup_storage[stype] && 434 + aux->cgroup_storage[stype] != _map) 435 435 goto unlock; 436 436 437 - map->prog = prog; 438 - prog->aux->cgroup_storage[stype] = _map; 437 + map->aux = aux; 438 + aux->cgroup_storage[stype] = _map; 439 439 ret = 0; 440 440 unlock: 441 441 spin_unlock_bh(&map->lock); ··· 443 443 return ret; 444 444 } 445 445 446 - void bpf_cgroup_storage_release(struct bpf_prog *prog, struct bpf_map *_map) 446 + void bpf_cgroup_storage_release(struct bpf_prog_aux *aux, struct bpf_map *_map) 447 447 { 448 448 enum bpf_cgroup_storage_type stype = cgroup_storage_type(_map); 449 449 struct bpf_cgroup_storage_map *map = map_to_storage(_map); 450 450 451 451 spin_lock_bh(&map->lock); 452 - if (map->prog == prog) { 453 - WARN_ON(prog->aux->cgroup_storage[stype] != _map); 454 - map->prog = NULL; 455 - prog->aux->cgroup_storage[stype] = NULL; 452 + if (map->aux == aux) { 453 + WARN_ON(aux->cgroup_storage[stype] != _map); 454 + map->aux = NULL; 455 + aux->cgroup_storage[stype] = NULL; 456 456 } 457 457 spin_unlock_bh(&map->lock); 458 458 }
+58 -6
kernel/bpf/trampoline.c
··· 3 3 #include <linux/hash.h> 4 4 #include <linux/bpf.h> 5 5 #include <linux/filter.h> 6 + #include <linux/ftrace.h> 6 7 7 8 /* btf_vmlinux has ~22k attachable functions. 1k htab is enough. */ 8 9 #define TRAMPOLINE_HASH_BITS 10 ··· 60 59 return tr; 61 60 } 62 61 62 + static int is_ftrace_location(void *ip) 63 + { 64 + long addr; 65 + 66 + addr = ftrace_location((long)ip); 67 + if (!addr) 68 + return 0; 69 + if (WARN_ON_ONCE(addr != (long)ip)) 70 + return -EFAULT; 71 + return 1; 72 + } 73 + 74 + static int unregister_fentry(struct bpf_trampoline *tr, void *old_addr) 75 + { 76 + void *ip = tr->func.addr; 77 + int ret; 78 + 79 + if (tr->func.ftrace_managed) 80 + ret = unregister_ftrace_direct((long)ip, (long)old_addr); 81 + else 82 + ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, old_addr, NULL); 83 + return ret; 84 + } 85 + 86 + static int modify_fentry(struct bpf_trampoline *tr, void *old_addr, void *new_addr) 87 + { 88 + void *ip = tr->func.addr; 89 + int ret; 90 + 91 + if (tr->func.ftrace_managed) 92 + ret = modify_ftrace_direct((long)ip, (long)old_addr, (long)new_addr); 93 + else 94 + ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, old_addr, new_addr); 95 + return ret; 96 + } 97 + 98 + /* first time registering */ 99 + static int register_fentry(struct bpf_trampoline *tr, void *new_addr) 100 + { 101 + void *ip = tr->func.addr; 102 + int ret; 103 + 104 + ret = is_ftrace_location(ip); 105 + if (ret < 0) 106 + return ret; 107 + tr->func.ftrace_managed = ret; 108 + 109 + if (tr->func.ftrace_managed) 110 + ret = register_ftrace_direct((long)ip, (long)new_addr); 111 + else 112 + ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, NULL, new_addr); 113 + return ret; 114 + } 115 + 63 116 /* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 64 117 * bytes on x86. Pick a number to fit into PAGE_SIZE / 2 65 118 */ ··· 132 77 int err; 133 78 134 79 if (fentry_cnt + fexit_cnt == 0) { 135 - err = bpf_arch_text_poke(tr->func.addr, BPF_MOD_CALL, 136 - old_image, NULL); 80 + err = unregister_fentry(tr, old_image); 137 81 tr->selector = 0; 138 82 goto out; 139 83 } ··· 159 105 160 106 if (tr->selector) 161 107 /* progs already running at this address */ 162 - err = bpf_arch_text_poke(tr->func.addr, BPF_MOD_CALL, 163 - old_image, new_image); 108 + err = modify_fentry(tr, old_image, new_image); 164 109 else 165 110 /* first time registering */ 166 - err = bpf_arch_text_poke(tr->func.addr, BPF_MOD_CALL, NULL, 167 - new_image); 111 + err = register_fentry(tr, new_image); 168 112 if (err) 169 113 goto out; 170 114 tr->selector++;
+10 -14
kernel/bpf/verifier.c
··· 4134 4134 struct bpf_map *map = meta->map_ptr; 4135 4135 struct tnum range; 4136 4136 u64 val; 4137 + int err; 4137 4138 4138 4139 if (func_id != BPF_FUNC_tail_call) 4139 4140 return 0; ··· 4150 4149 bpf_map_key_store(aux, BPF_MAP_KEY_POISON); 4151 4150 return 0; 4152 4151 } 4152 + 4153 + err = mark_chain_precision(env, BPF_REG_3); 4154 + if (err) 4155 + return err; 4153 4156 4154 4157 val = reg->var_off.value; 4155 4158 if (bpf_map_key_unseen(aux)) ··· 8273 8268 env->used_maps[env->used_map_cnt++] = map; 8274 8269 8275 8270 if (bpf_map_is_cgroup_storage(map) && 8276 - bpf_cgroup_storage_assign(env->prog, map)) { 8271 + bpf_cgroup_storage_assign(env->prog->aux, map)) { 8277 8272 verbose(env, "only one cgroup storage of each type is allowed\n"); 8278 8273 fdput(f); 8279 8274 return -EBUSY; ··· 8303 8298 /* drop refcnt of maps used by the rejected program */ 8304 8299 static void release_maps(struct bpf_verifier_env *env) 8305 8300 { 8306 - enum bpf_cgroup_storage_type stype; 8307 - int i; 8308 - 8309 - for_each_cgroup_storage_type(stype) { 8310 - if (!env->prog->aux->cgroup_storage[stype]) 8311 - continue; 8312 - bpf_cgroup_storage_release(env->prog, 8313 - env->prog->aux->cgroup_storage[stype]); 8314 - } 8315 - 8316 - for (i = 0; i < env->used_map_cnt; i++) 8317 - bpf_map_put(env->used_maps[i]); 8301 + __bpf_free_used_maps(env->prog->aux, env->used_maps, 8302 + env->used_map_cnt); 8318 8303 } 8319 8304 8320 8305 /* convert pseudo BPF_LD_IMM64 into generic BPF_LD_IMM64 */ ··· 9277 9282 insn->code = BPF_JMP | BPF_TAIL_CALL; 9278 9283 9279 9284 aux = &env->insn_aux_data[i + delta]; 9280 - if (prog->jit_requested && !expect_blinding && 9285 + if (env->allow_ptr_leaks && !expect_blinding && 9286 + prog->jit_requested && 9281 9287 !bpf_map_key_poisoned(aux) && 9282 9288 !bpf_map_ptr_poisoned(aux) && 9283 9289 !bpf_map_ptr_unpriv(aux)) {
+3
net/bridge/br_netfilter_hooks.c
··· 662 662 nf_bridge_pull_encap_header(skb); 663 663 } 664 664 665 + if (unlikely(!pskb_may_pull(skb, sizeof(struct arphdr)))) 666 + return NF_DROP; 667 + 665 668 if (arp_hdr(skb)->ar_pln != 4) { 666 669 if (is_vlan_arp(skb, state->net)) 667 670 nf_bridge_push_encap_header(skb);
+7 -3
net/can/j1939/socket.c
··· 423 423 { 424 424 struct sockaddr_can *addr = (struct sockaddr_can *)uaddr; 425 425 struct j1939_sock *jsk = j1939_sk(sock->sk); 426 - struct j1939_priv *priv = jsk->priv; 427 - struct sock *sk = sock->sk; 428 - struct net *net = sock_net(sk); 426 + struct j1939_priv *priv; 427 + struct sock *sk; 428 + struct net *net; 429 429 int ret = 0; 430 430 431 431 ret = j1939_sk_sanity_check(addr, len); ··· 433 433 return ret; 434 434 435 435 lock_sock(sock->sk); 436 + 437 + priv = jsk->priv; 438 + sk = sock->sk; 439 + net = sock_net(sk); 436 440 437 441 /* Already bound to an interface? */ 438 442 if (jsk->state & J1939_SOCK_BOUND) {
+1
net/core/filter.c
··· 2055 2055 } 2056 2056 2057 2057 skb->dev = dev; 2058 + skb->tstamp = 0; 2058 2059 2059 2060 dev_xmit_recursion_inc(); 2060 2061 ret = dev_queue_xmit(skb);
-3
net/core/neighbour.c
··· 98 98 99 99 static void neigh_cleanup_and_release(struct neighbour *neigh) 100 100 { 101 - if (neigh->parms->neigh_cleanup) 102 - neigh->parms->neigh_cleanup(neigh); 103 - 104 101 trace_neigh_cleanup_and_release(neigh, 0); 105 102 __neigh_notify(neigh, RTM_DELNEIGH, 0, 0); 106 103 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
+5 -2
net/core/net-sysfs.c
··· 919 919 struct kobject *kobj = &queue->kobj; 920 920 int error = 0; 921 921 922 + /* Kobject_put later will trigger rx_queue_release call which 923 + * decreases dev refcount: Take that reference here 924 + */ 925 + dev_hold(queue->dev); 926 + 922 927 kobj->kset = dev->queues_kset; 923 928 error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL, 924 929 "rx-%u", index); 925 930 if (error) 926 931 goto err; 927 - 928 - dev_hold(queue->dev); 929 932 930 933 if (dev->sysfs_rx_queue_group) { 931 934 error = sysfs_create_group(kobj, dev->sysfs_rx_queue_group);
+1 -1
net/core/sock.c
··· 2916 2916 2917 2917 sk->sk_max_pacing_rate = ~0UL; 2918 2918 sk->sk_pacing_rate = ~0UL; 2919 - sk->sk_pacing_shift = 10; 2919 + WRITE_ONCE(sk->sk_pacing_shift, 10); 2920 2920 sk->sk_incoming_cpu = -1; 2921 2921 2922 2922 sk_rx_queue_clear(sk);
+2
net/core/sysctl_net_core.c
··· 288 288 return ret; 289 289 } 290 290 291 + # ifdef CONFIG_HAVE_EBPF_JIT 291 292 static int 292 293 proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, 293 294 void __user *buffer, size_t *lenp, ··· 299 298 300 299 return proc_dointvec_minmax(table, write, buffer, lenp, ppos); 301 300 } 301 + # endif /* CONFIG_HAVE_EBPF_JIT */ 302 302 303 303 static int 304 304 proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write,
+2 -1
net/dsa/dsa2.c
··· 124 124 return NULL; 125 125 } 126 126 127 - struct dsa_link *dsa_link_touch(struct dsa_port *dp, struct dsa_port *link_dp) 127 + static struct dsa_link *dsa_link_touch(struct dsa_port *dp, 128 + struct dsa_port *link_dp) 128 129 { 129 130 struct dsa_switch *ds = dp->ds; 130 131 struct dsa_switch_tree *dst;
+3 -5
net/dsa/tag_ksz.c
··· 84 84 * (eg, 0x00=port1, 0x02=port3, 0x06=port7) 85 85 */ 86 86 87 - #define KSZ8795_INGRESS_TAG_LEN 1 88 - 89 87 #define KSZ8795_TAIL_TAG_OVERRIDE BIT(6) 90 88 #define KSZ8795_TAIL_TAG_LOOKUP BIT(7) 91 89 ··· 94 96 u8 *tag; 95 97 u8 *addr; 96 98 97 - nskb = ksz_common_xmit(skb, dev, KSZ8795_INGRESS_TAG_LEN); 99 + nskb = ksz_common_xmit(skb, dev, KSZ_INGRESS_TAG_LEN); 98 100 if (!nskb) 99 101 return NULL; 100 102 101 103 /* Tag encoding */ 102 - tag = skb_put(nskb, KSZ8795_INGRESS_TAG_LEN); 104 + tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN); 103 105 addr = skb_mac_header(nskb); 104 106 105 107 *tag = 1 << dp->index; ··· 122 124 .proto = DSA_TAG_PROTO_KSZ8795, 123 125 .xmit = ksz8795_xmit, 124 126 .rcv = ksz8795_rcv, 125 - .overhead = KSZ8795_INGRESS_TAG_LEN, 127 + .overhead = KSZ_INGRESS_TAG_LEN, 126 128 }; 127 129 128 130 DSA_TAG_DRIVER(ksz8795_netdev_ops);
+2 -1
net/ipv4/inet_diag.c
··· 911 911 912 912 for (i = s_i; i < INET_LHTABLE_SIZE; i++) { 913 913 struct inet_listen_hashbucket *ilb; 914 + struct hlist_nulls_node *node; 914 915 915 916 num = 0; 916 917 ilb = &hashinfo->listening_hash[i]; 917 918 spin_lock(&ilb->lock); 918 - sk_for_each(sk, &ilb->head) { 919 + sk_nulls_for_each(sk, node, &ilb->nulls_head) { 919 920 struct inet_sock *inet = inet_sk(sk); 920 921 921 922 if (!net_eq(sock_net(sk), net))
+8 -8
net/ipv4/inet_hashtables.c
··· 516 516 struct inet_listen_hashbucket *ilb) 517 517 { 518 518 struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash; 519 + const struct hlist_nulls_node *node; 519 520 struct sock *sk2; 520 521 kuid_t uid = sock_i_uid(sk); 521 522 522 - sk_for_each_rcu(sk2, &ilb->head) { 523 + sk_nulls_for_each_rcu(sk2, node, &ilb->nulls_head) { 523 524 if (sk2 != sk && 524 525 sk2->sk_family == sk->sk_family && 525 526 ipv6_only_sock(sk2) == ipv6_only_sock(sk) && ··· 556 555 } 557 556 if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport && 558 557 sk->sk_family == AF_INET6) 559 - hlist_add_tail_rcu(&sk->sk_node, &ilb->head); 558 + __sk_nulls_add_node_tail_rcu(sk, &ilb->nulls_head); 560 559 else 561 - hlist_add_head_rcu(&sk->sk_node, &ilb->head); 560 + __sk_nulls_add_node_rcu(sk, &ilb->nulls_head); 562 561 inet_hash2(hashinfo, sk); 563 562 ilb->count++; 564 563 sock_set_flag(sk, SOCK_RCU_FREE); ··· 607 606 reuseport_detach_sock(sk); 608 607 if (ilb) { 609 608 inet_unhash2(hashinfo, sk); 610 - __sk_del_node_init(sk); 611 - ilb->count--; 612 - } else { 613 - __sk_nulls_del_node_init_rcu(sk); 609 + ilb->count--; 614 610 } 611 + __sk_nulls_del_node_init_rcu(sk); 615 612 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); 616 613 unlock: 617 614 spin_unlock_bh(lock); ··· 749 750 750 751 for (i = 0; i < INET_LHTABLE_SIZE; i++) { 751 752 spin_lock_init(&h->listening_hash[i].lock); 752 - INIT_HLIST_HEAD(&h->listening_hash[i].head); 753 + INIT_HLIST_NULLS_HEAD(&h->listening_hash[i].nulls_head, 754 + i + LISTENING_NULLS_BASE); 753 755 h->listening_hash[i].count = 0; 754 756 } 755 757
+2 -4
net/ipv4/tcp.c
··· 1087 1087 goto out; 1088 1088 out_err: 1089 1089 /* make sure we wake any epoll edge trigger waiter */ 1090 - if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 && 1091 - err == -EAGAIN)) { 1090 + if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) { 1092 1091 sk->sk_write_space(sk); 1093 1092 tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED); 1094 1093 } ··· 1418 1419 sock_zerocopy_put_abort(uarg, true); 1419 1420 err = sk_stream_error(sk, flags, err); 1420 1421 /* make sure we wake any epoll edge trigger waiter */ 1421 - if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 && 1422 - err == -EAGAIN)) { 1422 + if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) { 1423 1423 sk->sk_write_space(sk); 1424 1424 tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED); 1425 1425 }
+2 -1
net/ipv4/tcp_bbr.c
··· 306 306 /* Sort of tcp_tso_autosize() but ignoring 307 307 * driver provided sk_gso_max_size. 308 308 */ 309 - bytes = min_t(unsigned long, sk->sk_pacing_rate >> sk->sk_pacing_shift, 309 + bytes = min_t(unsigned long, 310 + sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift), 310 311 GSO_MAX_SIZE - 1 - MAX_TCP_HEADER); 311 312 segs = max_t(u32, bytes / tp->mss_cache, bbr_min_tso_segs(sk)); 312 313
+4 -3
net/ipv4/tcp_ipv4.c
··· 2147 2147 struct tcp_iter_state *st = seq->private; 2148 2148 struct net *net = seq_file_net(seq); 2149 2149 struct inet_listen_hashbucket *ilb; 2150 + struct hlist_nulls_node *node; 2150 2151 struct sock *sk = cur; 2151 2152 2152 2153 if (!sk) { 2153 2154 get_head: 2154 2155 ilb = &tcp_hashinfo.listening_hash[st->bucket]; 2155 2156 spin_lock(&ilb->lock); 2156 - sk = sk_head(&ilb->head); 2157 + sk = sk_nulls_head(&ilb->nulls_head); 2157 2158 st->offset = 0; 2158 2159 goto get_sk; 2159 2160 } ··· 2162 2161 ++st->num; 2163 2162 ++st->offset; 2164 2163 2165 - sk = sk_next(sk); 2164 + sk = sk_nulls_next(sk); 2166 2165 get_sk: 2167 - sk_for_each_from(sk) { 2166 + sk_nulls_for_each_from(sk, node) { 2168 2167 if (!net_eq(sock_net(sk), net)) 2169 2168 continue; 2170 2169 if (sk->sk_family == afinfo->family)
+13 -4
net/ipv4/tcp_output.c
··· 1725 1725 u32 bytes, segs; 1726 1726 1727 1727 bytes = min_t(unsigned long, 1728 - sk->sk_pacing_rate >> sk->sk_pacing_shift, 1728 + sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift), 1729 1729 sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); 1730 1730 1731 1731 /* Goal is to send at least one packet per ms, ··· 2260 2260 2261 2261 limit = max_t(unsigned long, 2262 2262 2 * skb->truesize, 2263 - sk->sk_pacing_rate >> sk->sk_pacing_shift); 2263 + sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift)); 2264 2264 if (sk->sk_pacing_status == SK_PACING_NONE) 2265 2265 limit = min_t(unsigned long, limit, 2266 2266 sock_net(sk)->ipv4.sysctl_tcp_limit_output_bytes); ··· 2436 2436 break; 2437 2437 2438 2438 if (tcp_small_queue_check(sk, skb, 0)) 2439 + break; 2440 + 2441 + /* Argh, we hit an empty skb(), presumably a thread 2442 + * is sleeping in sendmsg()/sk_stream_wait_memory(). 2443 + * We do not want to send a pure-ack packet and have 2444 + * a strange looking rtx queue with empty packet(s). 2445 + */ 2446 + if (TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq) 2439 2447 break; 2440 2448 2441 2449 if (unlikely(tcp_transmit_skb(sk, skb, 1, gfp))) ··· 3129 3121 */ 3130 3122 void tcp_send_fin(struct sock *sk) 3131 3123 { 3132 - struct sk_buff *skb, *tskb = tcp_write_queue_tail(sk); 3124 + struct sk_buff *skb, *tskb, *tail = tcp_write_queue_tail(sk); 3133 3125 struct tcp_sock *tp = tcp_sk(sk); 3134 3126 3135 3127 /* Optimization, tack on the FIN if we have one skb in write queue and ··· 3137 3129 * Note: in the latter case, FIN packet will be sent after a timeout, 3138 3130 * as TCP stack thinks it has already been transmitted. 3139 3131 */ 3132 + tskb = tail; 3140 3133 if (!tskb && tcp_under_memory_pressure(sk)) 3141 3134 tskb = skb_rb_last(&sk->tcp_rtx_queue); 3142 3135 ··· 3145 3136 TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN; 3146 3137 TCP_SKB_CB(tskb)->end_seq++; 3147 3138 tp->write_seq++; 3148 - if (tcp_write_queue_empty(sk)) { 3139 + if (!tail) { 3149 3140 /* This means tskb was already sent. 3150 3141 * Pretend we included the FIN on previous transmit. 3151 3142 * We need to set tp->snd_nxt to the value it would have
+4 -4
net/ipv6/addrconf.c
··· 5231 5231 return -EINVAL; 5232 5232 } 5233 5233 5234 + if (!netlink_strict_get_check(skb)) 5235 + return nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 5236 + ifa_ipv6_policy, extack); 5237 + 5234 5238 ifm = nlmsg_data(nlh); 5235 5239 if (ifm->ifa_prefixlen || ifm->ifa_flags || ifm->ifa_scope) { 5236 5240 NL_SET_ERR_MSG_MOD(extack, "Invalid values in header for get address request"); 5237 5241 return -EINVAL; 5238 5242 } 5239 - 5240 - if (!netlink_strict_get_check(skb)) 5241 - return nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 5242 - ifa_ipv6_policy, extack); 5243 5243 5244 5244 err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFA_MAX, 5245 5245 ifa_ipv6_policy, extack);
+2 -2
net/llc/llc_station.c
··· 32 32 return LLC_PDU_IS_CMD(pdu) && /* command PDU */ 33 33 LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ 34 34 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID && 35 - !pdu->dsap ? 0 : 1; /* NULL DSAP value */ 35 + !pdu->dsap; /* NULL DSAP value */ 36 36 } 37 37 38 38 static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb) ··· 42 42 return LLC_PDU_IS_CMD(pdu) && /* command PDU */ 43 43 LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ 44 44 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST && 45 - !pdu->dsap ? 0 : 1; /* NULL DSAP */ 45 + !pdu->dsap; /* NULL DSAP */ 46 46 } 47 47 48 48 static int llc_station_ac_send_xid_r(struct sk_buff *skb)
+1 -1
net/mac80211/airtime.c
··· 442 442 return 0; 443 443 444 444 sband = hw->wiphy->bands[status->band]; 445 - if (!sband || status->rate_idx > sband->n_bitrates) 445 + if (!sband || status->rate_idx >= sband->n_bitrates) 446 446 return 0; 447 447 448 448 rate = &sband->bitrates[status->rate_idx];
+71 -31
net/mac80211/debugfs_sta.c
··· 201 201 char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; 202 202 u64 rx_airtime = 0, tx_airtime = 0; 203 203 s64 deficit[IEEE80211_NUM_ACS]; 204 - u32 q_depth[IEEE80211_NUM_ACS]; 205 - u32 q_limit_l[IEEE80211_NUM_ACS], q_limit_h[IEEE80211_NUM_ACS]; 206 204 ssize_t rv; 207 205 int ac; 208 206 ··· 212 214 rx_airtime += sta->airtime[ac].rx_airtime; 213 215 tx_airtime += sta->airtime[ac].tx_airtime; 214 216 deficit[ac] = sta->airtime[ac].deficit; 215 - q_limit_l[ac] = sta->airtime[ac].aql_limit_low; 216 - q_limit_h[ac] = sta->airtime[ac].aql_limit_high; 217 217 spin_unlock_bh(&local->active_txq_lock[ac]); 218 - q_depth[ac] = atomic_read(&sta->airtime[ac].aql_tx_pending); 219 218 } 220 219 221 220 p += scnprintf(p, bufsz + buf - p, 222 221 "RX: %llu us\nTX: %llu us\nWeight: %u\n" 223 - "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n" 224 - "Q depth: VO: %u us VI: %u us BE: %u us BK: %u us\n" 225 - "Q limit[low/high]: VO: %u/%u VI: %u/%u BE: %u/%u BK: %u/%u\n", 222 + "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", 226 223 rx_airtime, tx_airtime, sta->airtime_weight, 227 - deficit[0], deficit[1], deficit[2], deficit[3], 228 - q_depth[0], q_depth[1], q_depth[2], q_depth[3], 229 - q_limit_l[0], q_limit_h[0], q_limit_l[1], q_limit_h[1], 230 - q_limit_l[2], q_limit_h[2], q_limit_l[3], q_limit_h[3]), 224 + deficit[0], deficit[1], deficit[2], deficit[3]); 231 225 232 226 rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 233 227 kfree(buf); ··· 231 241 { 232 242 struct sta_info *sta = file->private_data; 233 243 struct ieee80211_local *local = sta->sdata->local; 234 - u32 ac, q_limit_l, q_limit_h; 235 - char _buf[100] = {}, *buf = _buf; 236 - 237 - if (count > sizeof(_buf)) 238 - return -EINVAL; 239 - 240 - if (copy_from_user(buf, userbuf, count)) 241 - return -EFAULT; 242 - 243 - buf[sizeof(_buf) - 1] = '\0'; 244 - if (sscanf(buf, "queue limit %u %u %u", &ac, &q_limit_l, &q_limit_h) 245 - != 3) 246 - return -EINVAL; 247 - 248 - if (ac >= IEEE80211_NUM_ACS) 249 - return -EINVAL; 250 - 251 - sta->airtime[ac].aql_limit_low = q_limit_l; 252 - sta->airtime[ac].aql_limit_high = q_limit_h; 244 + int ac; 253 245 254 246 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 255 247 spin_lock_bh(&local->active_txq_lock[ac]); ··· 244 272 return count; 245 273 } 246 274 STA_OPS_RW(airtime); 275 + 276 + static ssize_t sta_aql_read(struct file *file, char __user *userbuf, 277 + size_t count, loff_t *ppos) 278 + { 279 + struct sta_info *sta = file->private_data; 280 + struct ieee80211_local *local = sta->sdata->local; 281 + size_t bufsz = 400; 282 + char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; 283 + u32 q_depth[IEEE80211_NUM_ACS]; 284 + u32 q_limit_l[IEEE80211_NUM_ACS], q_limit_h[IEEE80211_NUM_ACS]; 285 + ssize_t rv; 286 + int ac; 287 + 288 + if (!buf) 289 + return -ENOMEM; 290 + 291 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 292 + spin_lock_bh(&local->active_txq_lock[ac]); 293 + q_limit_l[ac] = sta->airtime[ac].aql_limit_low; 294 + q_limit_h[ac] = sta->airtime[ac].aql_limit_high; 295 + spin_unlock_bh(&local->active_txq_lock[ac]); 296 + q_depth[ac] = atomic_read(&sta->airtime[ac].aql_tx_pending); 297 + } 298 + 299 + p += scnprintf(p, bufsz + buf - p, 300 + "Q depth: VO: %u us VI: %u us BE: %u us BK: %u us\n" 301 + "Q limit[low/high]: VO: %u/%u VI: %u/%u BE: %u/%u BK: %u/%u\n", 302 + q_depth[0], q_depth[1], q_depth[2], q_depth[3], 303 + q_limit_l[0], q_limit_h[0], q_limit_l[1], q_limit_h[1], 304 + q_limit_l[2], q_limit_h[2], q_limit_l[3], q_limit_h[3]), 305 + 306 + rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 307 + kfree(buf); 308 + return rv; 309 + } 310 + 311 + static ssize_t sta_aql_write(struct file *file, const char __user *userbuf, 312 + size_t count, loff_t *ppos) 313 + { 314 + struct sta_info *sta = file->private_data; 315 + u32 ac, q_limit_l, q_limit_h; 316 + char _buf[100] = {}, *buf = _buf; 317 + 318 + if (count > sizeof(_buf)) 319 + return -EINVAL; 320 + 321 + if (copy_from_user(buf, userbuf, count)) 322 + return -EFAULT; 323 + 324 + buf[sizeof(_buf) - 1] = '\0'; 325 + if (sscanf(buf, "limit %u %u %u", &ac, &q_limit_l, &q_limit_h) 326 + != 3) 327 + return -EINVAL; 328 + 329 + if (ac >= IEEE80211_NUM_ACS) 330 + return -EINVAL; 331 + 332 + sta->airtime[ac].aql_limit_low = q_limit_l; 333 + sta->airtime[ac].aql_limit_high = q_limit_h; 334 + 335 + return count; 336 + } 337 + STA_OPS_RW(aql); 338 + 247 339 248 340 static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, 249 341 size_t count, loff_t *ppos) ··· 1031 995 if (wiphy_ext_feature_isset(local->hw.wiphy, 1032 996 NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) 1033 997 DEBUGFS_ADD(airtime); 998 + 999 + if (wiphy_ext_feature_isset(local->hw.wiphy, 1000 + NL80211_EXT_FEATURE_AQL)) 1001 + DEBUGFS_ADD(aql); 1034 1002 1035 1003 debugfs_create_xul("driver_buffered_tids", 0400, sta->debugfs_dir, 1036 1004 &sta->driver_buffered_tids);
+1 -3
net/mac80211/main.c
··· 672 672 IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; 673 673 } 674 674 675 - local->airtime_flags = AIRTIME_USE_TX | 676 - AIRTIME_USE_RX | 677 - AIRTIME_USE_AQL; 675 + local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; 678 676 local->aql_threshold = IEEE80211_AQL_THRESHOLD; 679 677 atomic_set(&local->aql_total_pending_airtime, 0); 680 678
+3
net/mac80211/sta_info.c
··· 1916 1916 { 1917 1917 int tx_pending; 1918 1918 1919 + if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) 1920 + return; 1921 + 1919 1922 if (!tx_completed) { 1920 1923 if (sta) 1921 1924 atomic_add(tx_airtime,
-1
net/mac80211/sta_info.h
··· 127 127 /* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ 128 128 #define AIRTIME_USE_TX BIT(0) 129 129 #define AIRTIME_USE_RX BIT(1) 130 - #define AIRTIME_USE_AQL BIT(2) 131 130 132 131 struct airtime_info { 133 132 u64 rx_airtime;
+11 -2
net/mac80211/tx.c
··· 2256 2256 payload[7]); 2257 2257 } 2258 2258 2259 + /* 2260 + * Initialize skb->priority for QoS frames. This is put in the TID field 2261 + * of the frame before passing it to the driver. 2262 + */ 2263 + if (ieee80211_is_data_qos(hdr->frame_control)) { 2264 + u8 *p = ieee80211_get_qos_ctl(hdr); 2265 + skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; 2266 + } 2267 + 2259 2268 memset(info, 0, sizeof(*info)); 2260 2269 2261 2270 info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS | ··· 3677 3668 3678 3669 IEEE80211_SKB_CB(skb)->control.vif = vif; 3679 3670 3680 - if (local->airtime_flags & AIRTIME_USE_AQL) { 3671 + if (wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { 3681 3672 u32 airtime; 3682 3673 3683 3674 airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta, ··· 3799 3790 struct sta_info *sta; 3800 3791 struct ieee80211_local *local = hw_to_local(hw); 3801 3792 3802 - if (!(local->airtime_flags & AIRTIME_USE_AQL)) 3793 + if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) 3803 3794 return true; 3804 3795 3805 3796 if (!txq->sta)
+4 -3
net/netfilter/nf_conntrack_core.c
··· 895 895 } 896 896 897 897 /* Resolve race on insertion if this protocol allows this. */ 898 - static int nf_ct_resolve_clash(struct net *net, struct sk_buff *skb, 899 - enum ip_conntrack_info ctinfo, 900 - struct nf_conntrack_tuple_hash *h) 898 + static __cold noinline int 899 + nf_ct_resolve_clash(struct net *net, struct sk_buff *skb, 900 + enum ip_conntrack_info ctinfo, 901 + struct nf_conntrack_tuple_hash *h) 901 902 { 902 903 /* This is the conntrack entry already in hashes that won race. */ 903 904 struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
+3
net/netfilter/nf_conntrack_netlink.c
··· 3626 3626 3627 3627 list_for_each_entry(net, net_exit_list, exit_list) 3628 3628 ctnetlink_net_exit(net); 3629 + 3630 + /* wait for other cpus until they are done with ctnl_notifiers */ 3631 + synchronize_rcu(); 3629 3632 } 3630 3633 3631 3634 static struct pernet_operations ctnetlink_net_ops = {
+45 -38
net/netfilter/nf_flow_table_offload.c
··· 28 28 struct flow_dissector_key_basic basic; 29 29 union { 30 30 struct flow_dissector_key_ipv4_addrs ipv4; 31 + struct flow_dissector_key_ipv6_addrs ipv6; 31 32 }; 32 33 struct flow_dissector_key_tcp tcp; 33 34 struct flow_dissector_key_ports tp; ··· 58 57 NF_FLOW_DISSECTOR(match, FLOW_DISSECTOR_KEY_CONTROL, control); 59 58 NF_FLOW_DISSECTOR(match, FLOW_DISSECTOR_KEY_BASIC, basic); 60 59 NF_FLOW_DISSECTOR(match, FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4); 60 + NF_FLOW_DISSECTOR(match, FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6); 61 61 NF_FLOW_DISSECTOR(match, FLOW_DISSECTOR_KEY_TCP, tcp); 62 62 NF_FLOW_DISSECTOR(match, FLOW_DISSECTOR_KEY_PORTS, tp); 63 63 ··· 71 69 key->ipv4.dst = tuple->dst_v4.s_addr; 72 70 mask->ipv4.dst = 0xffffffff; 73 71 break; 72 + case AF_INET6: 73 + key->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; 74 + key->basic.n_proto = htons(ETH_P_IPV6); 75 + key->ipv6.src = tuple->src_v6; 76 + memset(&mask->ipv6.src, 0xff, sizeof(mask->ipv6.src)); 77 + key->ipv6.dst = tuple->dst_v6; 78 + memset(&mask->ipv6.dst, 0xff, sizeof(mask->ipv6.dst)); 79 + break; 74 80 default: 75 81 return -EOPNOTSUPP; 76 82 } 83 + match->dissector.used_keys |= BIT(key->control.addr_type); 77 84 mask->basic.n_proto = 0xffff; 78 85 79 86 switch (tuple->l4proto) { ··· 107 96 108 97 match->dissector.used_keys |= BIT(FLOW_DISSECTOR_KEY_CONTROL) | 109 98 BIT(FLOW_DISSECTOR_KEY_BASIC) | 110 - BIT(FLOW_DISSECTOR_KEY_IPV4_ADDRS) | 111 99 BIT(FLOW_DISSECTOR_KEY_PORTS); 112 100 return 0; 113 101 } 114 102 115 103 static void flow_offload_mangle(struct flow_action_entry *entry, 116 - enum flow_action_mangle_base htype, 117 - u32 offset, u8 *value, u8 *mask) 104 + enum flow_action_mangle_base htype, u32 offset, 105 + const __be32 *value, const __be32 *mask) 118 106 { 119 107 entry->id = FLOW_ACTION_MANGLE; 120 108 entry->mangle.htype = htype; ··· 150 140 memcpy(&val16, dev->dev_addr, 2); 151 141 val = val16 << 16; 152 142 flow_offload_mangle(entry0, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 4, 153 - (u8 *)&val, (u8 *)&mask); 143 + &val, &mask); 154 144 155 145 mask = ~0xffffffff; 156 146 memcpy(&val, dev->dev_addr + 2, 4); 157 147 flow_offload_mangle(entry1, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 8, 158 - (u8 *)&val, (u8 *)&mask); 148 + &val, &mask); 159 149 dev_put(dev); 160 150 161 151 return 0; ··· 180 170 mask = ~0xffffffff; 181 171 memcpy(&val, n->ha, 4); 182 172 flow_offload_mangle(entry0, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 0, 183 - (u8 *)&val, (u8 *)&mask); 173 + &val, &mask); 184 174 185 175 mask = ~0x0000ffff; 186 176 memcpy(&val16, n->ha + 4, 2); 187 177 val = val16; 188 178 flow_offload_mangle(entry1, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 4, 189 - (u8 *)&val, (u8 *)&mask); 179 + &val, &mask); 190 180 neigh_release(n); 191 181 192 182 return 0; ··· 216 206 } 217 207 218 208 flow_offload_mangle(entry, FLOW_ACT_MANGLE_HDR_TYPE_IP4, offset, 219 - (u8 *)&addr, (u8 *)&mask); 209 + &addr, &mask); 220 210 } 221 211 222 212 static void flow_offload_ipv4_dnat(struct net *net, ··· 243 233 } 244 234 245 235 flow_offload_mangle(entry, FLOW_ACT_MANGLE_HDR_TYPE_IP4, offset, 246 - (u8 *)&addr, (u8 *)&mask); 236 + &addr, &mask); 247 237 } 248 238 249 239 static void flow_offload_ipv6_mangle(struct nf_flow_rule *flow_rule, 250 240 unsigned int offset, 251 - u8 *addr, u8 *mask) 241 + const __be32 *addr, const __be32 *mask) 252 242 { 253 243 struct flow_action_entry *entry; 254 244 int i; ··· 256 246 for (i = 0; i < sizeof(struct in6_addr) / sizeof(u32); i += sizeof(u32)) { 257 247 entry = flow_action_entry_next(flow_rule); 258 248 flow_offload_mangle(entry, FLOW_ACT_MANGLE_HDR_TYPE_IP6, 259 - offset + i, 260 - &addr[i], mask); 249 + offset + i, &addr[i], mask); 261 250 } 262 251 } 263 252 ··· 266 257 struct nf_flow_rule *flow_rule) 267 258 { 268 259 u32 mask = ~htonl(0xffffffff); 269 - const u8 *addr; 260 + const __be32 *addr; 270 261 u32 offset; 271 262 272 263 switch (dir) { 273 264 case FLOW_OFFLOAD_DIR_ORIGINAL: 274 - addr = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_v6.s6_addr; 265 + addr = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_v6.s6_addr32; 275 266 offset = offsetof(struct ipv6hdr, saddr); 276 267 break; 277 268 case FLOW_OFFLOAD_DIR_REPLY: 278 - addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v6.s6_addr; 269 + addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v6.s6_addr32; 279 270 offset = offsetof(struct ipv6hdr, daddr); 280 271 break; 281 272 default: 282 273 return; 283 274 } 284 275 285 - flow_offload_ipv6_mangle(flow_rule, offset, (u8 *)addr, (u8 *)&mask); 276 + flow_offload_ipv6_mangle(flow_rule, offset, addr, &mask); 286 277 } 287 278 288 279 static void flow_offload_ipv6_dnat(struct net *net, ··· 291 282 struct nf_flow_rule *flow_rule) 292 283 { 293 284 u32 mask = ~htonl(0xffffffff); 294 - const u8 *addr; 285 + const __be32 *addr; 295 286 u32 offset; 296 287 297 288 switch (dir) { 298 289 case FLOW_OFFLOAD_DIR_ORIGINAL: 299 - addr = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.src_v6.s6_addr; 290 + addr = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.src_v6.s6_addr32; 300 291 offset = offsetof(struct ipv6hdr, daddr); 301 292 break; 302 293 case FLOW_OFFLOAD_DIR_REPLY: 303 - addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v6.s6_addr; 294 + addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v6.s6_addr32; 304 295 offset = offsetof(struct ipv6hdr, saddr); 305 296 break; 306 297 default: 307 298 return; 308 299 } 309 300 310 - flow_offload_ipv6_mangle(flow_rule, offset, (u8 *)addr, (u8 *)&mask); 301 + flow_offload_ipv6_mangle(flow_rule, offset, addr, &mask); 311 302 } 312 303 313 304 static int flow_offload_l4proto(const struct flow_offload *flow) ··· 335 326 struct nf_flow_rule *flow_rule) 336 327 { 337 328 struct flow_action_entry *entry = flow_action_entry_next(flow_rule); 338 - u32 mask = ~htonl(0xffff0000); 339 - __be16 port; 329 + u32 mask = ~htonl(0xffff0000), port; 340 330 u32 offset; 341 331 342 332 switch (dir) { 343 333 case FLOW_OFFLOAD_DIR_ORIGINAL: 344 - port = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port; 334 + port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port); 345 335 offset = 0; /* offsetof(struct tcphdr, source); */ 346 336 break; 347 337 case FLOW_OFFLOAD_DIR_REPLY: 348 - port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port; 338 + port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port); 349 339 offset = 0; /* offsetof(struct tcphdr, dest); */ 350 340 break; 351 341 default: 352 - break; 342 + return; 353 343 } 354 - 344 + port = htonl(port << 16); 355 345 flow_offload_mangle(entry, flow_offload_l4proto(flow), offset, 356 - (u8 *)&port, (u8 *)&mask); 346 + &port, &mask); 357 347 } 358 348 359 349 static void flow_offload_port_dnat(struct net *net, ··· 361 353 struct nf_flow_rule *flow_rule) 362 354 { 363 355 struct flow_action_entry *entry = flow_action_entry_next(flow_rule); 364 - u32 mask = ~htonl(0xffff); 365 - __be16 port; 356 + u32 mask = ~htonl(0xffff), port; 366 357 u32 offset; 367 358 368 359 switch (dir) { 369 360 case FLOW_OFFLOAD_DIR_ORIGINAL: 370 - port = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port; 361 + port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port); 371 362 offset = 0; /* offsetof(struct tcphdr, source); */ 372 363 break; 373 364 case FLOW_OFFLOAD_DIR_REPLY: 374 - port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port; 365 + port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port); 375 366 offset = 0; /* offsetof(struct tcphdr, dest); */ 376 367 break; 377 368 default: 378 - break; 369 + return; 379 370 } 380 - 371 + port = htonl(port); 381 372 flow_offload_mangle(entry, flow_offload_l4proto(flow), offset, 382 - (u8 *)&port, (u8 *)&mask); 373 + &port, &mask); 383 374 } 384 375 385 376 static void flow_offload_ipv4_checksum(struct net *net, ··· 581 574 cls_flow.rule = flow_rule->rule; 582 575 583 576 list_for_each_entry(block_cb, &flowtable->flow_block.cb_list, list) { 584 - err = block_cb->cb(TC_SETUP_FT, &cls_flow, 577 + err = block_cb->cb(TC_SETUP_CLSFLOWER, &cls_flow, 585 578 block_cb->cb_priv); 586 579 if (err < 0) 587 580 continue; ··· 606 599 &offload->flow->tuplehash[dir].tuple, &extack); 607 600 608 601 list_for_each_entry(block_cb, &flowtable->flow_block.cb_list, list) 609 - block_cb->cb(TC_SETUP_FT, &cls_flow, block_cb->cb_priv); 602 + block_cb->cb(TC_SETUP_CLSFLOWER, &cls_flow, block_cb->cb_priv); 610 603 611 604 offload->flow->flags |= FLOW_OFFLOAD_HW_DEAD; 612 605 } ··· 663 656 &offload->flow->tuplehash[dir].tuple, &extack); 664 657 665 658 list_for_each_entry(block_cb, &flowtable->flow_block.cb_list, list) 666 - block_cb->cb(TC_SETUP_FT, &cls_flow, block_cb->cb_priv); 659 + block_cb->cb(TC_SETUP_CLSFLOWER, &cls_flow, block_cb->cb_priv); 667 660 memcpy(stats, &cls_flow.stats, sizeof(*stats)); 668 661 } 669 662 ··· 829 822 bo.extack = &extack; 830 823 INIT_LIST_HEAD(&bo.cb_list); 831 824 832 - err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_BLOCK, &bo); 825 + err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_FT, &bo); 833 826 if (err < 0) 834 827 return err; 835 828
+1 -1
net/netfilter/nf_queue.c
··· 189 189 goto err; 190 190 } 191 191 192 - if (!skb_dst_force(skb) && state->hook != NF_INET_PRE_ROUTING) { 192 + if (skb_dst(skb) && !skb_dst_force(skb)) { 193 193 status = -ENETDOWN; 194 194 goto err; 195 195 }
+13 -5
net/netfilter/nf_tables_api.c
··· 4519 4519 return err; 4520 4520 4521 4521 err = -EINVAL; 4522 - if (desc.type != NFT_DATA_VALUE || desc.len != set->klen) 4522 + if (desc.type != NFT_DATA_VALUE || desc.len != set->klen) { 4523 + nft_data_release(&elem.key.val, desc.type); 4523 4524 return err; 4525 + } 4524 4526 4525 4527 priv = set->ops->get(ctx->net, set, &elem, flags); 4526 4528 if (IS_ERR(priv)) ··· 4758 4756 if (nla[NFTA_SET_ELEM_DATA] == NULL && 4759 4757 !(flags & NFT_SET_ELEM_INTERVAL_END)) 4760 4758 return -EINVAL; 4761 - if (nla[NFTA_SET_ELEM_DATA] != NULL && 4762 - flags & NFT_SET_ELEM_INTERVAL_END) 4763 - return -EINVAL; 4764 4759 } else { 4765 4760 if (nla[NFTA_SET_ELEM_DATA] != NULL) 4766 4761 return -EINVAL; 4767 4762 } 4763 + 4764 + if ((flags & NFT_SET_ELEM_INTERVAL_END) && 4765 + (nla[NFTA_SET_ELEM_DATA] || 4766 + nla[NFTA_SET_ELEM_OBJREF] || 4767 + nla[NFTA_SET_ELEM_TIMEOUT] || 4768 + nla[NFTA_SET_ELEM_EXPIRATION] || 4769 + nla[NFTA_SET_ELEM_USERDATA] || 4770 + nla[NFTA_SET_ELEM_EXPR])) 4771 + return -EINVAL; 4768 4772 4769 4773 timeout = 0; 4770 4774 if (nla[NFTA_SET_ELEM_TIMEOUT] != NULL) { ··· 5484 5476 if (nlh->nlmsg_flags & NLM_F_REPLACE) 5485 5477 return -EOPNOTSUPP; 5486 5478 5487 - type = nft_obj_type_get(net, objtype); 5479 + type = __nft_obj_type_get(objtype); 5488 5480 nft_ctx_init(&ctx, net, skb, nlh, family, table, NULL, nla); 5489 5481 5490 5482 return nf_tables_updobj(&ctx, type, nla[NFTA_OBJ_DATA], obj);
+6
net/netfilter/nf_tables_offload.c
··· 44 44 expr = nft_expr_next(expr); 45 45 } 46 46 47 + if (num_actions == 0) 48 + return ERR_PTR(-EOPNOTSUPP); 49 + 47 50 flow = nft_flow_rule_alloc(num_actions); 48 51 if (!flow) 49 52 return ERR_PTR(-ENOMEM); ··· 579 576 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 580 577 struct net *net = dev_net(dev); 581 578 struct nft_chain *chain; 579 + 580 + if (event != NETDEV_UNREGISTER) 581 + return NOTIFY_DONE; 582 582 583 583 mutex_lock(&net->nft.commit_mutex); 584 584 chain = __nft_offload_get_chain(dev);
+2 -2
net/netfilter/nft_bitwise.c
··· 80 80 tb[NFTA_BITWISE_MASK]); 81 81 if (err < 0) 82 82 return err; 83 - if (d1.len != priv->len) { 83 + if (d1.type != NFT_DATA_VALUE || d1.len != priv->len) { 84 84 err = -EINVAL; 85 85 goto err1; 86 86 } ··· 89 89 tb[NFTA_BITWISE_XOR]); 90 90 if (err < 0) 91 91 goto err1; 92 - if (d2.len != priv->len) { 92 + if (d2.type != NFT_DATA_VALUE || d2.len != priv->len) { 93 93 err = -EINVAL; 94 94 goto err2; 95 95 }
+6
net/netfilter/nft_cmp.c
··· 81 81 if (err < 0) 82 82 return err; 83 83 84 + if (desc.type != NFT_DATA_VALUE) { 85 + err = -EINVAL; 86 + nft_data_release(&priv->data, desc.type); 87 + return err; 88 + } 89 + 84 90 priv->sreg = nft_parse_register(tb[NFTA_CMP_SREG]); 85 91 err = nft_validate_register_load(priv->sreg, desc.len); 86 92 if (err < 0)
+10
net/netfilter/nft_range.c
··· 66 66 if (err < 0) 67 67 return err; 68 68 69 + if (desc_from.type != NFT_DATA_VALUE) { 70 + err = -EINVAL; 71 + goto err1; 72 + } 73 + 69 74 err = nft_data_init(NULL, &priv->data_to, sizeof(priv->data_to), 70 75 &desc_to, tb[NFTA_RANGE_TO_DATA]); 71 76 if (err < 0) 72 77 goto err1; 78 + 79 + if (desc_to.type != NFT_DATA_VALUE) { 80 + err = -EINVAL; 81 + goto err2; 82 + } 73 83 74 84 if (desc_from.len != desc_to.len) { 75 85 err = -EINVAL;
+16 -5
net/netfilter/nft_set_rbtree.c
··· 74 74 parent = rcu_dereference_raw(parent->rb_left); 75 75 continue; 76 76 } 77 - if (nft_rbtree_interval_end(rbe)) 78 - goto out; 77 + if (nft_rbtree_interval_end(rbe)) { 78 + if (nft_set_is_anonymous(set)) 79 + return false; 80 + parent = rcu_dereference_raw(parent->rb_left); 81 + interval = NULL; 82 + continue; 83 + } 79 84 80 85 *ext = &rbe->ext; 81 86 return true; ··· 93 88 *ext = &interval->ext; 94 89 return true; 95 90 } 96 - out: 91 + 97 92 return false; 98 93 } 99 94 ··· 144 139 if (flags & NFT_SET_ELEM_INTERVAL_END) 145 140 interval = rbe; 146 141 } else { 147 - if (!nft_set_elem_active(&rbe->ext, genmask)) 142 + if (!nft_set_elem_active(&rbe->ext, genmask)) { 148 143 parent = rcu_dereference_raw(parent->rb_left); 144 + continue; 145 + } 149 146 150 147 if (!nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) || 151 148 (*nft_set_ext_flags(&rbe->ext) & NFT_SET_ELEM_INTERVAL_END) == ··· 155 148 *elem = rbe; 156 149 return true; 157 150 } 158 - return false; 151 + 152 + if (nft_rbtree_interval_end(rbe)) 153 + interval = NULL; 154 + 155 + parent = rcu_dereference_raw(parent->rb_left); 159 156 } 160 157 } 161 158
+1 -1
net/nfc/nci/uart.c
··· 346 346 nu->rx_packet_len = -1; 347 347 nu->rx_skb = nci_skb_alloc(nu->ndev, 348 348 NCI_MAX_PACKET_SIZE, 349 - GFP_KERNEL); 349 + GFP_ATOMIC); 350 350 if (!nu->rx_skb) 351 351 return -ENOMEM; 352 352 }
+2 -1
net/packet/af_packet.c
··· 544 544 msec = 1; 545 545 div = ecmd.base.speed / 1000; 546 546 } 547 - } 547 + } else 548 + return DEFAULT_PRB_RETIRE_TOV; 548 549 549 550 mbits = (blk_size_in_bytes * 8) / (1024 * 1024); 550 551
+5 -2
net/rfkill/core.c
··· 1002 1002 int __must_check rfkill_register(struct rfkill *rfkill) 1003 1003 { 1004 1004 static unsigned long rfkill_no; 1005 - struct device *dev = &rfkill->dev; 1005 + struct device *dev; 1006 1006 int error; 1007 1007 1008 - BUG_ON(!rfkill); 1008 + if (!rfkill) 1009 + return -EINVAL; 1010 + 1011 + dev = &rfkill->dev; 1009 1012 1010 1013 mutex_lock(&rfkill_global_mutex); 1011 1014
+25
net/sched/cls_u32.c
··· 1108 1108 return err; 1109 1109 } 1110 1110 1111 + static bool u32_hnode_empty(struct tc_u_hnode *ht, bool *non_root_ht) 1112 + { 1113 + int i; 1114 + 1115 + if (!ht) 1116 + return true; 1117 + if (!ht->is_root) { 1118 + *non_root_ht = true; 1119 + return false; 1120 + } 1121 + if (*non_root_ht) 1122 + return false; 1123 + if (ht->refcnt < 2) 1124 + return true; 1125 + 1126 + for (i = 0; i <= ht->divisor; i++) { 1127 + if (rtnl_dereference(ht->ht[i])) 1128 + return false; 1129 + } 1130 + return true; 1131 + } 1132 + 1111 1133 static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg, 1112 1134 bool rtnl_held) 1113 1135 { 1114 1136 struct tc_u_common *tp_c = tp->data; 1137 + bool non_root_ht = false; 1115 1138 struct tc_u_hnode *ht; 1116 1139 struct tc_u_knode *n; 1117 1140 unsigned int h; ··· 1147 1124 ht = rtnl_dereference(ht->next)) { 1148 1125 if (ht->prio != tp->prio) 1149 1126 continue; 1127 + if (u32_hnode_empty(ht, &non_root_ht)) 1128 + return; 1150 1129 if (arg->count >= arg->skip) { 1151 1130 if (arg->fn(tp, ht, arg) < 0) { 1152 1131 arg->stop = 1;
+5
net/sctp/protocol.c
··· 227 227 sa->sin_port = sh->dest; 228 228 sa->sin_addr.s_addr = ip_hdr(skb)->daddr; 229 229 } 230 + memset(sa->sin_zero, 0, sizeof(sa->sin_zero)); 230 231 } 231 232 232 233 /* Initialize an sctp_addr from a socket. */ ··· 236 235 addr->v4.sin_family = AF_INET; 237 236 addr->v4.sin_port = 0; 238 237 addr->v4.sin_addr.s_addr = inet_sk(sk)->inet_rcv_saddr; 238 + memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); 239 239 } 240 240 241 241 /* Initialize sk->sk_rcv_saddr from sctp_addr. */ ··· 259 257 addr->v4.sin_family = AF_INET; 260 258 addr->v4.sin_port = port; 261 259 addr->v4.sin_addr.s_addr = param->v4.addr.s_addr; 260 + memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); 262 261 } 263 262 264 263 /* Initialize an address parameter from a sctp_addr and return the length ··· 284 281 saddr->v4.sin_family = AF_INET; 285 282 saddr->v4.sin_port = port; 286 283 saddr->v4.sin_addr.s_addr = fl4->saddr; 284 + memset(saddr->v4.sin_zero, 0, sizeof(saddr->v4.sin_zero)); 287 285 } 288 286 289 287 /* Compare two addresses exactly. */ ··· 307 303 addr->v4.sin_family = AF_INET; 308 304 addr->v4.sin_addr.s_addr = htonl(INADDR_ANY); 309 305 addr->v4.sin_port = port; 306 + memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); 310 307 } 311 308 312 309 /* Is this a wildcard address? */
+6 -2
net/sctp/stream.c
··· 84 84 return 0; 85 85 86 86 ret = genradix_prealloc(&stream->out, outcnt, gfp); 87 - if (ret) 87 + if (ret) { 88 + genradix_free(&stream->out); 88 89 return ret; 90 + } 89 91 90 92 stream->outcnt = outcnt; 91 93 return 0; ··· 102 100 return 0; 103 101 104 102 ret = genradix_prealloc(&stream->in, incnt, gfp); 105 - if (ret) 103 + if (ret) { 104 + genradix_free(&stream->in); 106 105 return ret; 106 + } 107 107 108 108 stream->incnt = incnt; 109 109 return 0;
+8 -6
net/smc/af_smc.c
··· 857 857 goto out; 858 858 859 859 sock_hold(&smc->sk); /* sock put in passive closing */ 860 + if (smc->use_fallback) 861 + goto out; 860 862 if (flags & O_NONBLOCK) { 861 863 if (schedule_work(&smc->connect_work)) 862 864 smc->connect_nonblock = 1; ··· 1723 1721 sk->sk_err = smc->clcsock->sk->sk_err; 1724 1722 sk->sk_error_report(sk); 1725 1723 } 1726 - if (rc) 1727 - return rc; 1728 1724 1729 1725 if (optlen < sizeof(int)) 1730 1726 return -EINVAL; ··· 1730 1730 return -EFAULT; 1731 1731 1732 1732 lock_sock(sk); 1733 + if (rc || smc->use_fallback) 1734 + goto out; 1733 1735 switch (optname) { 1734 1736 case TCP_ULP: 1735 1737 case TCP_FASTOPEN: ··· 1743 1741 smc_switch_to_fallback(smc); 1744 1742 smc->fallback_rsn = SMC_CLC_DECL_OPTUNSUPP; 1745 1743 } else { 1746 - if (!smc->use_fallback) 1747 - rc = -EINVAL; 1744 + rc = -EINVAL; 1748 1745 } 1749 1746 break; 1750 1747 case TCP_NODELAY: 1751 1748 if (sk->sk_state != SMC_INIT && 1752 1749 sk->sk_state != SMC_LISTEN && 1753 1750 sk->sk_state != SMC_CLOSED) { 1754 - if (val && !smc->use_fallback) 1751 + if (val) 1755 1752 mod_delayed_work(system_wq, &smc->conn.tx_work, 1756 1753 0); 1757 1754 } ··· 1759 1758 if (sk->sk_state != SMC_INIT && 1760 1759 sk->sk_state != SMC_LISTEN && 1761 1760 sk->sk_state != SMC_CLOSED) { 1762 - if (!val && !smc->use_fallback) 1761 + if (!val) 1763 1762 mod_delayed_work(system_wq, &smc->conn.tx_work, 1764 1763 0); 1765 1764 } ··· 1770 1769 default: 1771 1770 break; 1772 1771 } 1772 + out: 1773 1773 release_sock(sk); 1774 1774 1775 1775 return rc;
+1 -1
net/smc/smc_core.c
··· 1287 1287 unsigned long event, void *ptr) 1288 1288 { 1289 1289 smc_lgrs_shutdown(); 1290 - 1290 + smc_ib_unregister_client(); 1291 1291 return 0; 1292 1292 } 1293 1293
+15 -9
net/tipc/bcast.c
··· 305 305 * @skb: socket buffer to copy 306 306 * @method: send method to be used 307 307 * @dests: destination nodes for message. 308 - * @cong_link_cnt: returns number of encountered congested destination links 309 308 * Returns 0 if success, otherwise errno 310 309 */ 311 310 static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb, 312 311 struct tipc_mc_method *method, 313 - struct tipc_nlist *dests, 314 - u16 *cong_link_cnt) 312 + struct tipc_nlist *dests) 315 313 { 316 314 struct tipc_msg *hdr, *_hdr; 317 315 struct sk_buff_head tmpq; 318 316 struct sk_buff *_skb; 317 + u16 cong_link_cnt; 318 + int rc = 0; 319 319 320 320 /* Is a cluster supporting with new capabilities ? */ 321 321 if (!(tipc_net(net)->capabilities & TIPC_MCAST_RBCTL)) ··· 343 343 _hdr = buf_msg(_skb); 344 344 msg_set_size(_hdr, MCAST_H_SIZE); 345 345 msg_set_is_rcast(_hdr, !msg_is_rcast(hdr)); 346 + msg_set_errcode(_hdr, TIPC_ERR_NO_PORT); 346 347 347 348 __skb_queue_head_init(&tmpq); 348 349 __skb_queue_tail(&tmpq, _skb); 349 350 if (method->rcast) 350 - tipc_bcast_xmit(net, &tmpq, cong_link_cnt); 351 + rc = tipc_bcast_xmit(net, &tmpq, &cong_link_cnt); 351 352 else 352 - tipc_rcast_xmit(net, &tmpq, dests, cong_link_cnt); 353 + rc = tipc_rcast_xmit(net, &tmpq, dests, &cong_link_cnt); 353 354 354 355 /* This queue should normally be empty by now */ 355 356 __skb_queue_purge(&tmpq); 356 357 357 - return 0; 358 + return rc; 358 359 } 359 360 360 361 /* tipc_mcast_xmit - deliver message to indicated destination nodes ··· 397 396 msg_set_is_rcast(hdr, method->rcast); 398 397 399 398 /* Switch method ? */ 400 - if (rcast != method->rcast) 401 - tipc_mcast_send_sync(net, skb, method, 402 - dests, cong_link_cnt); 399 + if (rcast != method->rcast) { 400 + rc = tipc_mcast_send_sync(net, skb, method, dests); 401 + if (unlikely(rc)) { 402 + pr_err("Unable to send SYN: method %d, rc %d\n", 403 + rcast, rc); 404 + goto exit; 405 + } 406 + } 403 407 404 408 if (method->rcast) 405 409 rc = tipc_rcast_xmit(net, pkts, dests, cong_link_cnt);
+3 -3
net/tipc/discover.c
··· 194 194 { 195 195 struct tipc_net *tn = tipc_net(net); 196 196 struct tipc_msg *hdr = buf_msg(skb); 197 + u32 pnet_hash = msg_peer_net_hash(hdr); 197 198 u16 caps = msg_node_capabilities(hdr); 198 199 bool legacy = tn->legacy_addr_format; 199 200 u32 sugg = msg_sugg_node_addr(hdr); ··· 243 242 return; 244 243 if (!tipc_in_scope(legacy, b->domain, src)) 245 244 return; 246 - tipc_node_check_dest(net, src, peer_id, b, caps, signature, 247 - msg_peer_net_hash(hdr), &maddr, &respond, 248 - &dupl_addr); 245 + tipc_node_check_dest(net, src, peer_id, b, caps, signature, pnet_hash, 246 + &maddr, &respond, &dupl_addr); 249 247 if (dupl_addr) 250 248 disc_dupl_alert(b, src, &maddr); 251 249 if (!respond)
+179 -100
net/tipc/name_table.c
··· 36 36 37 37 #include <net/sock.h> 38 38 #include <linux/list_sort.h> 39 + #include <linux/rbtree_augmented.h> 39 40 #include "core.h" 40 41 #include "netlink.h" 41 42 #include "name_table.h" ··· 52 51 * @lower: service range lower bound 53 52 * @upper: service range upper bound 54 53 * @tree_node: member of service range RB tree 54 + * @max: largest 'upper' in this node subtree 55 55 * @local_publ: list of identical publications made from this node 56 56 * Used by closest_first lookup and multicast lookup algorithm 57 57 * @all_publ: all publications identical to this one, whatever node and scope ··· 62 60 u32 lower; 63 61 u32 upper; 64 62 struct rb_node tree_node; 63 + u32 max; 65 64 struct list_head local_publ; 66 65 struct list_head all_publ; 67 66 }; ··· 86 83 spinlock_t lock; /* Covers service range list */ 87 84 struct rcu_head rcu; 88 85 }; 86 + 87 + #define service_range_upper(sr) ((sr)->upper) 88 + RB_DECLARE_CALLBACKS_MAX(static, sr_callbacks, 89 + struct service_range, tree_node, u32, max, 90 + service_range_upper) 91 + 92 + #define service_range_entry(rbtree_node) \ 93 + (container_of(rbtree_node, struct service_range, tree_node)) 94 + 95 + #define service_range_overlap(sr, start, end) \ 96 + ((sr)->lower <= (end) && (sr)->upper >= (start)) 97 + 98 + /** 99 + * service_range_foreach_match - iterate over tipc service rbtree for each 100 + * range match 101 + * @sr: the service range pointer as a loop cursor 102 + * @sc: the pointer to tipc service which holds the service range rbtree 103 + * @start, end: the range (end >= start) for matching 104 + */ 105 + #define service_range_foreach_match(sr, sc, start, end) \ 106 + for (sr = service_range_match_first((sc)->ranges.rb_node, \ 107 + start, \ 108 + end); \ 109 + sr; \ 110 + sr = service_range_match_next(&(sr)->tree_node, \ 111 + start, \ 112 + end)) 113 + 114 + /** 115 + * service_range_match_first - find first service range matching a range 116 + * @n: the root node of service range rbtree for searching 117 + * @start, end: the range (end >= start) for matching 118 + * 119 + * Return: the leftmost service range node in the rbtree that overlaps the 120 + * specific range if any. Otherwise, returns NULL. 121 + */ 122 + static struct service_range *service_range_match_first(struct rb_node *n, 123 + u32 start, u32 end) 124 + { 125 + struct service_range *sr; 126 + struct rb_node *l, *r; 127 + 128 + /* Non overlaps in tree at all? */ 129 + if (!n || service_range_entry(n)->max < start) 130 + return NULL; 131 + 132 + while (n) { 133 + l = n->rb_left; 134 + if (l && service_range_entry(l)->max >= start) { 135 + /* A leftmost overlap range node must be one in the left 136 + * subtree. If not, it has lower > end, then nodes on 137 + * the right side cannot satisfy the condition either. 138 + */ 139 + n = l; 140 + continue; 141 + } 142 + 143 + /* No one in the left subtree can match, return if this node is 144 + * an overlap i.e. leftmost. 145 + */ 146 + sr = service_range_entry(n); 147 + if (service_range_overlap(sr, start, end)) 148 + return sr; 149 + 150 + /* Ok, try to lookup on the right side */ 151 + r = n->rb_right; 152 + if (sr->lower <= end && 153 + r && service_range_entry(r)->max >= start) { 154 + n = r; 155 + continue; 156 + } 157 + break; 158 + } 159 + 160 + return NULL; 161 + } 162 + 163 + /** 164 + * service_range_match_next - find next service range matching a range 165 + * @n: a node in service range rbtree from which the searching starts 166 + * @start, end: the range (end >= start) for matching 167 + * 168 + * Return: the next service range node to the given node in the rbtree that 169 + * overlaps the specific range if any. Otherwise, returns NULL. 170 + */ 171 + static struct service_range *service_range_match_next(struct rb_node *n, 172 + u32 start, u32 end) 173 + { 174 + struct service_range *sr; 175 + struct rb_node *p, *r; 176 + 177 + while (n) { 178 + r = n->rb_right; 179 + if (r && service_range_entry(r)->max >= start) 180 + /* A next overlap range node must be one in the right 181 + * subtree. If not, it has lower > end, then any next 182 + * successor (- an ancestor) of this node cannot 183 + * satisfy the condition either. 184 + */ 185 + return service_range_match_first(r, start, end); 186 + 187 + /* No one in the right subtree can match, go up to find an 188 + * ancestor of this node which is parent of a left-hand child. 189 + */ 190 + while ((p = rb_parent(n)) && n == p->rb_right) 191 + n = p; 192 + if (!p) 193 + break; 194 + 195 + /* Return if this ancestor is an overlap */ 196 + sr = service_range_entry(p); 197 + if (service_range_overlap(sr, start, end)) 198 + return sr; 199 + 200 + /* Ok, try to lookup more from this ancestor */ 201 + if (sr->lower <= end) { 202 + n = p; 203 + continue; 204 + } 205 + break; 206 + } 207 + 208 + return NULL; 209 + } 89 210 90 211 static int hash(int x) 91 212 { ··· 266 139 return service; 267 140 } 268 141 269 - /** 270 - * tipc_service_first_range - find first service range in tree matching instance 271 - * 272 - * Very time-critical, so binary search through range rb tree 273 - */ 274 - static struct service_range *tipc_service_first_range(struct tipc_service *sc, 275 - u32 instance) 276 - { 277 - struct rb_node *n = sc->ranges.rb_node; 278 - struct service_range *sr; 279 - 280 - while (n) { 281 - sr = container_of(n, struct service_range, tree_node); 282 - if (sr->lower > instance) 283 - n = n->rb_left; 284 - else if (sr->upper < instance) 285 - n = n->rb_right; 286 - else 287 - return sr; 288 - } 289 - return NULL; 290 - } 291 - 292 142 /* tipc_service_find_range - find service range matching publication parameters 293 143 */ 294 144 static struct service_range *tipc_service_find_range(struct tipc_service *sc, 295 145 u32 lower, u32 upper) 296 146 { 297 - struct rb_node *n = sc->ranges.rb_node; 298 147 struct service_range *sr; 299 148 300 - sr = tipc_service_first_range(sc, lower); 301 - if (!sr) 302 - return NULL; 303 - 304 - /* Look for exact match */ 305 - for (n = &sr->tree_node; n; n = rb_next(n)) { 306 - sr = container_of(n, struct service_range, tree_node); 307 - if (sr->upper == upper) 308 - break; 149 + service_range_foreach_match(sr, sc, lower, upper) { 150 + /* Look for exact match */ 151 + if (sr->lower == lower && sr->upper == upper) 152 + return sr; 309 153 } 310 - if (!n || sr->lower != lower || sr->upper != upper) 311 - return NULL; 312 154 313 - return sr; 155 + return NULL; 314 156 } 315 157 316 158 static struct service_range *tipc_service_create_range(struct tipc_service *sc, 317 159 u32 lower, u32 upper) 318 160 { 319 161 struct rb_node **n, *parent = NULL; 320 - struct service_range *sr, *tmp; 162 + struct service_range *sr; 321 163 322 164 n = &sc->ranges.rb_node; 323 165 while (*n) { 324 - tmp = container_of(*n, struct service_range, tree_node); 325 166 parent = *n; 326 - tmp = container_of(parent, struct service_range, tree_node); 327 - if (lower < tmp->lower) 328 - n = &(*n)->rb_left; 329 - else if (lower > tmp->lower) 330 - n = &(*n)->rb_right; 331 - else if (upper < tmp->upper) 332 - n = &(*n)->rb_left; 333 - else if (upper > tmp->upper) 334 - n = &(*n)->rb_right; 167 + sr = service_range_entry(parent); 168 + if (lower == sr->lower && upper == sr->upper) 169 + return sr; 170 + if (sr->max < upper) 171 + sr->max = upper; 172 + if (lower <= sr->lower) 173 + n = &parent->rb_left; 335 174 else 336 - return tmp; 175 + n = &parent->rb_right; 337 176 } 338 177 sr = kzalloc(sizeof(*sr), GFP_ATOMIC); 339 178 if (!sr) 340 179 return NULL; 341 180 sr->lower = lower; 342 181 sr->upper = upper; 182 + sr->max = upper; 343 183 INIT_LIST_HEAD(&sr->local_publ); 344 184 INIT_LIST_HEAD(&sr->all_publ); 345 185 rb_link_node(&sr->tree_node, parent, n); 346 - rb_insert_color(&sr->tree_node, &sc->ranges); 186 + rb_insert_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); 347 187 return sr; 348 188 } 349 189 ··· 404 310 struct list_head publ_list; 405 311 struct service_range *sr; 406 312 struct tipc_name_seq ns; 407 - struct rb_node *n; 408 313 u32 filter; 409 314 410 315 ns.type = tipc_sub_read(sb, seq.type); ··· 418 325 return; 419 326 420 327 INIT_LIST_HEAD(&publ_list); 421 - for (n = rb_first(&service->ranges); n; n = rb_next(n)) { 422 - sr = container_of(n, struct service_range, tree_node); 423 - if (sr->lower > ns.upper) 424 - break; 425 - if (!tipc_sub_check_overlap(&ns, sr->lower, sr->upper)) 426 - continue; 427 - 328 + service_range_foreach_match(sr, service, ns.lower, ns.upper) { 428 329 first = NULL; 429 330 list_for_each_entry(p, &sr->all_publ, all_publ) { 430 331 if (filter & TIPC_SUB_PORTS) ··· 512 425 513 426 /* Remove service range item if this was its last publication */ 514 427 if (list_empty(&sr->all_publ)) { 515 - rb_erase(&sr->tree_node, &sc->ranges); 428 + rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); 516 429 kfree(sr); 517 430 } 518 431 ··· 560 473 rcu_read_lock(); 561 474 sc = tipc_service_find(net, type); 562 475 if (unlikely(!sc)) 563 - goto not_found; 476 + goto exit; 564 477 565 478 spin_lock_bh(&sc->lock); 566 - sr = tipc_service_first_range(sc, instance); 567 - if (unlikely(!sr)) 568 - goto no_match; 569 - 570 - /* Select lookup algorithm: local, closest-first or round-robin */ 571 - if (*dnode == self) { 572 - list = &sr->local_publ; 573 - if (list_empty(list)) 574 - goto no_match; 575 - p = list_first_entry(list, struct publication, local_publ); 576 - list_move_tail(&p->local_publ, &sr->local_publ); 577 - } else if (legacy && !*dnode && !list_empty(&sr->local_publ)) { 578 - list = &sr->local_publ; 579 - p = list_first_entry(list, struct publication, local_publ); 580 - list_move_tail(&p->local_publ, &sr->local_publ); 581 - } else { 582 - list = &sr->all_publ; 583 - p = list_first_entry(list, struct publication, all_publ); 584 - list_move_tail(&p->all_publ, &sr->all_publ); 479 + service_range_foreach_match(sr, sc, instance, instance) { 480 + /* Select lookup algo: local, closest-first or round-robin */ 481 + if (*dnode == self) { 482 + list = &sr->local_publ; 483 + if (list_empty(list)) 484 + continue; 485 + p = list_first_entry(list, struct publication, 486 + local_publ); 487 + list_move_tail(&p->local_publ, &sr->local_publ); 488 + } else if (legacy && !*dnode && !list_empty(&sr->local_publ)) { 489 + list = &sr->local_publ; 490 + p = list_first_entry(list, struct publication, 491 + local_publ); 492 + list_move_tail(&p->local_publ, &sr->local_publ); 493 + } else { 494 + list = &sr->all_publ; 495 + p = list_first_entry(list, struct publication, 496 + all_publ); 497 + list_move_tail(&p->all_publ, &sr->all_publ); 498 + } 499 + port = p->port; 500 + node = p->node; 501 + /* Todo: as for legacy, pick the first matching range only, a 502 + * "true" round-robin will be performed as needed. 503 + */ 504 + break; 585 505 } 586 - port = p->port; 587 - node = p->node; 588 - no_match: 589 506 spin_unlock_bh(&sc->lock); 590 - not_found: 507 + 508 + exit: 591 509 rcu_read_unlock(); 592 510 *dnode = node; 593 511 return port; ··· 615 523 616 524 spin_lock_bh(&sc->lock); 617 525 618 - sr = tipc_service_first_range(sc, instance); 526 + /* Todo: a full search i.e. service_range_foreach_match() instead? */ 527 + sr = service_range_match_first(sc->ranges.rb_node, instance, instance); 619 528 if (!sr) 620 529 goto no_match; 621 530 ··· 645 552 struct service_range *sr; 646 553 struct tipc_service *sc; 647 554 struct publication *p; 648 - struct rb_node *n; 649 555 650 556 rcu_read_lock(); 651 557 sc = tipc_service_find(net, type); ··· 652 560 goto exit; 653 561 654 562 spin_lock_bh(&sc->lock); 655 - 656 - for (n = rb_first(&sc->ranges); n; n = rb_next(n)) { 657 - sr = container_of(n, struct service_range, tree_node); 658 - if (sr->upper < lower) 659 - continue; 660 - if (sr->lower > upper) 661 - break; 563 + service_range_foreach_match(sr, sc, lower, upper) { 662 564 list_for_each_entry(p, &sr->local_publ, local_publ) { 663 565 if (p->scope == scope || (!exact && p->scope < scope)) 664 566 tipc_dest_push(dports, 0, p->port); ··· 673 587 struct service_range *sr; 674 588 struct tipc_service *sc; 675 589 struct publication *p; 676 - struct rb_node *n; 677 590 678 591 rcu_read_lock(); 679 592 sc = tipc_service_find(net, type); ··· 680 595 goto exit; 681 596 682 597 spin_lock_bh(&sc->lock); 683 - 684 - for (n = rb_first(&sc->ranges); n; n = rb_next(n)) { 685 - sr = container_of(n, struct service_range, tree_node); 686 - if (sr->upper < lower) 687 - continue; 688 - if (sr->lower > upper) 689 - break; 598 + service_range_foreach_match(sr, sc, lower, upper) { 690 599 list_for_each_entry(p, &sr->all_publ, all_publ) { 691 600 tipc_nlist_add(nodes, p->node); 692 601 } ··· 878 799 tipc_service_remove_publ(sr, p->node, p->key); 879 800 kfree_rcu(p, rcu); 880 801 } 881 - rb_erase(&sr->tree_node, &sc->ranges); 802 + rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); 882 803 kfree(sr); 883 804 } 884 805 hlist_del_init_rcu(&sc->service_list);
+18 -14
net/tipc/socket.c
··· 1364 1364 struct tipc_msg *hdr = &tsk->phdr; 1365 1365 struct tipc_name_seq *seq; 1366 1366 struct sk_buff_head pkts; 1367 - u32 dport, dnode = 0; 1368 - u32 type, inst; 1367 + u32 dport = 0, dnode = 0; 1368 + u32 type = 0, inst = 0; 1369 1369 int mtu, rc; 1370 1370 1371 1371 if (unlikely(dlen > TIPC_MAX_USER_MSG_SIZE)) ··· 1418 1418 type = dest->addr.name.name.type; 1419 1419 inst = dest->addr.name.name.instance; 1420 1420 dnode = dest->addr.name.domain; 1421 - msg_set_type(hdr, TIPC_NAMED_MSG); 1422 - msg_set_hdr_sz(hdr, NAMED_H_SIZE); 1423 - msg_set_nametype(hdr, type); 1424 - msg_set_nameinst(hdr, inst); 1425 - msg_set_lookup_scope(hdr, tipc_node2scope(dnode)); 1426 1421 dport = tipc_nametbl_translate(net, type, inst, &dnode); 1427 - msg_set_destnode(hdr, dnode); 1428 - msg_set_destport(hdr, dport); 1429 1422 if (unlikely(!dport && !dnode)) 1430 1423 return -EHOSTUNREACH; 1431 1424 } else if (dest->addrtype == TIPC_ADDR_ID) { 1432 1425 dnode = dest->addr.id.node; 1433 - msg_set_type(hdr, TIPC_DIRECT_MSG); 1434 - msg_set_lookup_scope(hdr, 0); 1435 - msg_set_destnode(hdr, dnode); 1436 - msg_set_destport(hdr, dest->addr.id.ref); 1437 - msg_set_hdr_sz(hdr, BASIC_H_SIZE); 1438 1426 } else { 1439 1427 return -EINVAL; 1440 1428 } ··· 1432 1444 !tipc_dest_find(clinks, dnode, 0)); 1433 1445 if (unlikely(rc)) 1434 1446 return rc; 1447 + 1448 + if (dest->addrtype == TIPC_ADDR_NAME) { 1449 + msg_set_type(hdr, TIPC_NAMED_MSG); 1450 + msg_set_hdr_sz(hdr, NAMED_H_SIZE); 1451 + msg_set_nametype(hdr, type); 1452 + msg_set_nameinst(hdr, inst); 1453 + msg_set_lookup_scope(hdr, tipc_node2scope(dnode)); 1454 + msg_set_destnode(hdr, dnode); 1455 + msg_set_destport(hdr, dport); 1456 + } else { /* TIPC_ADDR_ID */ 1457 + msg_set_type(hdr, TIPC_DIRECT_MSG); 1458 + msg_set_lookup_scope(hdr, 0); 1459 + msg_set_destnode(hdr, dnode); 1460 + msg_set_destport(hdr, dest->addr.id.ref); 1461 + msg_set_hdr_sz(hdr, BASIC_H_SIZE); 1462 + } 1435 1463 1436 1464 __skb_queue_head_init(&pkts); 1437 1465 mtu = tipc_node_get_mtu(net, dnode, tsk->portid, false);
+19 -6
net/vmw_vsock/virtio_transport_common.c
··· 34 34 { 35 35 const struct vsock_transport *t = vsock_core_get_transport(vsk); 36 36 37 + if (WARN_ON(!t)) 38 + return NULL; 39 + 37 40 return container_of(t, struct virtio_transport, transport); 38 41 } 39 42 ··· 164 161 } 165 162 EXPORT_SYMBOL_GPL(virtio_transport_deliver_tap_pkt); 166 163 164 + /* This function can only be used on connecting/connected sockets, 165 + * since a socket assigned to a transport is required. 166 + * 167 + * Do not use on listener sockets! 168 + */ 167 169 static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, 168 170 struct virtio_vsock_pkt_info *info) 169 171 { 170 172 u32 src_cid, src_port, dst_cid, dst_port; 173 + const struct virtio_transport *t_ops; 171 174 struct virtio_vsock_sock *vvs; 172 175 struct virtio_vsock_pkt *pkt; 173 176 u32 pkt_len = info->pkt_len; 174 177 175 - src_cid = virtio_transport_get_ops(vsk)->transport.get_local_cid(); 178 + t_ops = virtio_transport_get_ops(vsk); 179 + if (unlikely(!t_ops)) 180 + return -EFAULT; 181 + 182 + src_cid = t_ops->transport.get_local_cid(); 176 183 src_port = vsk->local_addr.svm_port; 177 184 if (!info->remote_cid) { 178 185 dst_cid = vsk->remote_addr.svm_cid; ··· 215 202 216 203 virtio_transport_inc_tx_pkt(vvs, pkt); 217 204 218 - return virtio_transport_get_ops(vsk)->send_pkt(pkt); 205 + return t_ops->send_pkt(pkt); 219 206 } 220 207 221 208 static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, ··· 1034 1021 int ret; 1035 1022 1036 1023 if (le16_to_cpu(pkt->hdr.op) != VIRTIO_VSOCK_OP_REQUEST) { 1037 - virtio_transport_reset(vsk, pkt); 1024 + virtio_transport_reset_no_sock(t, pkt); 1038 1025 return -EINVAL; 1039 1026 } 1040 1027 1041 1028 if (sk_acceptq_is_full(sk)) { 1042 - virtio_transport_reset(vsk, pkt); 1029 + virtio_transport_reset_no_sock(t, pkt); 1043 1030 return -ENOMEM; 1044 1031 } 1045 1032 1046 1033 child = vsock_create_connected(sk); 1047 1034 if (!child) { 1048 - virtio_transport_reset(vsk, pkt); 1035 + virtio_transport_reset_no_sock(t, pkt); 1049 1036 return -ENOMEM; 1050 1037 } 1051 1038 ··· 1067 1054 */ 1068 1055 if (ret || vchild->transport != &t->transport) { 1069 1056 release_sock(child); 1070 - virtio_transport_reset(vsk, pkt); 1057 + virtio_transport_reset_no_sock(t, pkt); 1071 1058 sock_put(child); 1072 1059 return ret; 1073 1060 }
+1
net/wireless/core.c
··· 1102 1102 1103 1103 #ifdef CONFIG_CFG80211_WEXT 1104 1104 kzfree(wdev->wext.keys); 1105 + wdev->wext.keys = NULL; 1105 1106 #endif 1106 1107 /* only initialized if we have a netdev */ 1107 1108 if (wdev->netdev)
+8
net/x25/af_x25.c
··· 659 659 sock_set_flag(sk, SOCK_DEAD); 660 660 sock_set_flag(sk, SOCK_DESTROY); 661 661 break; 662 + 663 + case X25_STATE_5: 664 + x25_write_internal(sk, X25_CLEAR_REQUEST); 665 + x25_disconnect(sk, 0, 0, 0); 666 + __x25_destroy_socket(sk); 667 + goto out; 662 668 } 663 669 664 670 sock_orphan(sk); ··· 1060 1054 if (test_bit(X25_ACCPT_APPRV_FLAG, &makex25->flags)) { 1061 1055 x25_write_internal(make, X25_CALL_ACCEPTED); 1062 1056 makex25->state = X25_STATE_3; 1057 + } else { 1058 + makex25->state = X25_STATE_5; 1063 1059 } 1064 1060 1065 1061 /*
+32
net/x25/x25_in.c
··· 382 382 return 0; 383 383 } 384 384 385 + /* 386 + * State machine for state 5, Call Accepted / Call Connected pending (X25_ACCPT_APPRV_FLAG). 387 + * The handling of the timer(s) is in file x25_timer.c 388 + * Handling of state 0 and connection release is in af_x25.c. 389 + */ 390 + static int x25_state5_machine(struct sock *sk, struct sk_buff *skb, int frametype) 391 + { 392 + struct x25_sock *x25 = x25_sk(sk); 393 + 394 + switch (frametype) { 395 + case X25_CLEAR_REQUEST: 396 + if (!pskb_may_pull(skb, X25_STD_MIN_LEN + 2)) { 397 + x25_write_internal(sk, X25_CLEAR_REQUEST); 398 + x25->state = X25_STATE_2; 399 + x25_start_t23timer(sk); 400 + return 0; 401 + } 402 + 403 + x25_write_internal(sk, X25_CLEAR_CONFIRMATION); 404 + x25_disconnect(sk, 0, skb->data[3], skb->data[4]); 405 + break; 406 + 407 + default: 408 + break; 409 + } 410 + 411 + return 0; 412 + } 413 + 385 414 /* Higher level upcall for a LAPB frame */ 386 415 int x25_process_rx_frame(struct sock *sk, struct sk_buff *skb) 387 416 { ··· 434 405 break; 435 406 case X25_STATE_4: 436 407 queued = x25_state4_machine(sk, skb, frametype); 408 + break; 409 + case X25_STATE_5: 410 + queued = x25_state5_machine(sk, skb, frametype); 437 411 break; 438 412 } 439 413
+14 -8
net/xdp/xsk.c
··· 334 334 } 335 335 EXPORT_SYMBOL(xsk_umem_consume_tx); 336 336 337 - static int xsk_zc_xmit(struct xdp_sock *xs) 337 + static int xsk_wakeup(struct xdp_sock *xs, u8 flags) 338 338 { 339 339 struct net_device *dev = xs->dev; 340 + int err; 340 341 341 - return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, 342 - XDP_WAKEUP_TX); 342 + rcu_read_lock(); 343 + err = dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, flags); 344 + rcu_read_unlock(); 345 + 346 + return err; 347 + } 348 + 349 + static int xsk_zc_xmit(struct xdp_sock *xs) 350 + { 351 + return xsk_wakeup(xs, XDP_WAKEUP_TX); 343 352 } 344 353 345 354 static void xsk_destruct_skb(struct sk_buff *skb) ··· 462 453 __poll_t mask = datagram_poll(file, sock, wait); 463 454 struct sock *sk = sock->sk; 464 455 struct xdp_sock *xs = xdp_sk(sk); 465 - struct net_device *dev; 466 456 struct xdp_umem *umem; 467 457 468 458 if (unlikely(!xsk_is_bound(xs))) 469 459 return mask; 470 460 471 - dev = xs->dev; 472 461 umem = xs->umem; 473 462 474 463 if (umem->need_wakeup) { 475 - if (dev->netdev_ops->ndo_xsk_wakeup) 476 - dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, 477 - umem->need_wakeup); 464 + if (xs->zc) 465 + xsk_wakeup(xs, umem->need_wakeup); 478 466 else 479 467 /* Poll needs to drive Tx also in copy mode */ 480 468 __xsk_sendmsg(sk);
+16 -2
samples/bpf/syscall_tp_kern.c
··· 47 47 SEC("tracepoint/syscalls/sys_enter_open") 48 48 int trace_enter_open(struct syscalls_enter_open_args *ctx) 49 49 { 50 - count((void *)&enter_open_map); 50 + count(&enter_open_map); 51 + return 0; 52 + } 53 + 54 + SEC("tracepoint/syscalls/sys_enter_openat") 55 + int trace_enter_open_at(struct syscalls_enter_open_args *ctx) 56 + { 57 + count(&enter_open_map); 51 58 return 0; 52 59 } 53 60 54 61 SEC("tracepoint/syscalls/sys_exit_open") 55 62 int trace_enter_exit(struct syscalls_exit_open_args *ctx) 56 63 { 57 - count((void *)&exit_open_map); 64 + count(&exit_open_map); 65 + return 0; 66 + } 67 + 68 + SEC("tracepoint/syscalls/sys_exit_openat") 69 + int trace_enter_exit_at(struct syscalls_exit_open_args *ctx) 70 + { 71 + count(&exit_open_map); 58 72 return 0; 59 73 }
+2 -2
samples/bpf/trace_event_user.c
··· 37 37 } 38 38 39 39 printf("%s;", sym->name); 40 - if (!strcmp(sym->name, "sys_read")) 40 + if (!strstr(sym->name, "sys_read")) 41 41 sys_read_seen = true; 42 - else if (!strcmp(sym->name, "sys_write")) 42 + else if (!strstr(sym->name, "sys_write")) 43 43 sys_write_seen = true; 44 44 } 45 45
+1 -1
tools/bpf/bpftool/prog.c
··· 493 493 494 494 info = &info_linear->info; 495 495 if (mode == DUMP_JITED) { 496 - if (info->jited_prog_len == 0) { 496 + if (info->jited_prog_len == 0 || !info->jited_prog_insns) { 497 497 p_info("no instructions returned"); 498 498 goto err_free; 499 499 }
+1 -1
tools/bpf/bpftool/xlated_dumper.c
··· 174 174 struct kernel_sym *sym; 175 175 176 176 if (insn->src_reg == BPF_PSEUDO_CALL && 177 - (__u32) insn->imm < dd->nr_jited_ksyms) 177 + (__u32) insn->imm < dd->nr_jited_ksyms && dd->jited_ksyms) 178 178 address = dd->jited_ksyms[insn->imm]; 179 179 180 180 sym = kernel_syms_search(dd, address);
+39
tools/testing/selftests/bpf/test_ftrace.sh
··· 1 + #!/bin/bash 2 + 3 + TR=/sys/kernel/debug/tracing/ 4 + clear_trace() { # reset trace output 5 + echo > $TR/trace 6 + } 7 + 8 + disable_tracing() { # stop trace recording 9 + echo 0 > $TR/tracing_on 10 + } 11 + 12 + enable_tracing() { # start trace recording 13 + echo 1 > $TR/tracing_on 14 + } 15 + 16 + reset_tracer() { # reset the current tracer 17 + echo nop > $TR/current_tracer 18 + } 19 + 20 + disable_tracing 21 + clear_trace 22 + 23 + echo "" > $TR/set_ftrace_filter 24 + echo '*printk* *console* *wake* *serial* *lock*' > $TR/set_ftrace_notrace 25 + 26 + echo "bpf_prog_test*" > $TR/set_graph_function 27 + echo "" > $TR/set_graph_notrace 28 + 29 + echo function_graph > $TR/current_tracer 30 + 31 + enable_tracing 32 + ./test_progs -t fentry 33 + ./test_progs -t fexit 34 + disable_tracing 35 + clear_trace 36 + 37 + reset_tracer 38 + 39 + exit 0
+22 -21
tools/testing/selftests/bpf/test_verifier.c
··· 408 408 assert(!bpf_map_update_elem(fd, &index, &value, 0)); 409 409 } 410 410 411 - static int create_prog_dummy1(enum bpf_prog_type prog_type) 411 + static int create_prog_dummy_simple(enum bpf_prog_type prog_type, int ret) 412 412 { 413 413 struct bpf_insn prog[] = { 414 - BPF_MOV64_IMM(BPF_REG_0, 42), 414 + BPF_MOV64_IMM(BPF_REG_0, ret), 415 415 BPF_EXIT_INSN(), 416 416 }; 417 417 ··· 419 419 ARRAY_SIZE(prog), "GPL", 0, NULL, 0); 420 420 } 421 421 422 - static int create_prog_dummy2(enum bpf_prog_type prog_type, int mfd, int idx) 422 + static int create_prog_dummy_loop(enum bpf_prog_type prog_type, int mfd, 423 + int idx, int ret) 423 424 { 424 425 struct bpf_insn prog[] = { 425 426 BPF_MOV64_IMM(BPF_REG_3, idx), 426 427 BPF_LD_MAP_FD(BPF_REG_2, mfd), 427 428 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, 428 429 BPF_FUNC_tail_call), 429 - BPF_MOV64_IMM(BPF_REG_0, 41), 430 + BPF_MOV64_IMM(BPF_REG_0, ret), 430 431 BPF_EXIT_INSN(), 431 432 }; 432 433 ··· 436 435 } 437 436 438 437 static int create_prog_array(enum bpf_prog_type prog_type, uint32_t max_elem, 439 - int p1key) 438 + int p1key, int p2key, int p3key) 440 439 { 441 - int p2key = 1; 442 - int mfd, p1fd, p2fd; 440 + int mfd, p1fd, p2fd, p3fd; 443 441 444 442 mfd = bpf_create_map(BPF_MAP_TYPE_PROG_ARRAY, sizeof(int), 445 443 sizeof(int), max_elem, 0); ··· 449 449 return -1; 450 450 } 451 451 452 - p1fd = create_prog_dummy1(prog_type); 453 - p2fd = create_prog_dummy2(prog_type, mfd, p2key); 454 - if (p1fd < 0 || p2fd < 0) 455 - goto out; 452 + p1fd = create_prog_dummy_simple(prog_type, 42); 453 + p2fd = create_prog_dummy_loop(prog_type, mfd, p2key, 41); 454 + p3fd = create_prog_dummy_simple(prog_type, 24); 455 + if (p1fd < 0 || p2fd < 0 || p3fd < 0) 456 + goto err; 456 457 if (bpf_map_update_elem(mfd, &p1key, &p1fd, BPF_ANY) < 0) 457 - goto out; 458 + goto err; 458 459 if (bpf_map_update_elem(mfd, &p2key, &p2fd, BPF_ANY) < 0) 459 - goto out; 460 + goto err; 461 + if (bpf_map_update_elem(mfd, &p3key, &p3fd, BPF_ANY) < 0) { 462 + err: 463 + close(mfd); 464 + mfd = -1; 465 + } 466 + close(p3fd); 460 467 close(p2fd); 461 468 close(p1fd); 462 - 463 469 return mfd; 464 - out: 465 - close(p2fd); 466 - close(p1fd); 467 - close(mfd); 468 - return -1; 469 470 } 470 471 471 472 static int create_map_in_map(void) ··· 685 684 } 686 685 687 686 if (*fixup_prog1) { 688 - map_fds[4] = create_prog_array(prog_type, 4, 0); 687 + map_fds[4] = create_prog_array(prog_type, 4, 0, 1, 2); 689 688 do { 690 689 prog[*fixup_prog1].imm = map_fds[4]; 691 690 fixup_prog1++; ··· 693 692 } 694 693 695 694 if (*fixup_prog2) { 696 - map_fds[5] = create_prog_array(prog_type, 8, 7); 695 + map_fds[5] = create_prog_array(prog_type, 8, 7, 1, 2); 697 696 do { 698 697 prog[*fixup_prog2].imm = map_fds[5]; 699 698 fixup_prog2++;
+3 -3
tools/testing/selftests/bpf/verifier/ref_tracking.c
··· 455 455 BPF_MOV64_REG(BPF_REG_1, BPF_REG_0), 456 456 BPF_JMP_IMM(BPF_JNE, BPF_REG_1, 0, 7), 457 457 /* bpf_tail_call() */ 458 - BPF_MOV64_IMM(BPF_REG_3, 2), 458 + BPF_MOV64_IMM(BPF_REG_3, 3), 459 459 BPF_LD_MAP_FD(BPF_REG_2, 0), 460 460 BPF_MOV64_REG(BPF_REG_1, BPF_REG_7), 461 461 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), ··· 478 478 BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1), 479 479 BPF_EMIT_CALL(BPF_FUNC_sk_release), 480 480 /* bpf_tail_call() */ 481 - BPF_MOV64_IMM(BPF_REG_3, 2), 481 + BPF_MOV64_IMM(BPF_REG_3, 3), 482 482 BPF_LD_MAP_FD(BPF_REG_2, 0), 483 483 BPF_MOV64_REG(BPF_REG_1, BPF_REG_7), 484 484 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), ··· 497 497 BPF_SK_LOOKUP(sk_lookup_tcp), 498 498 /* bpf_tail_call() */ 499 499 BPF_MOV64_REG(BPF_REG_6, BPF_REG_0), 500 - BPF_MOV64_IMM(BPF_REG_3, 2), 500 + BPF_MOV64_IMM(BPF_REG_3, 3), 501 501 BPF_LD_MAP_FD(BPF_REG_2, 0), 502 502 BPF_MOV64_REG(BPF_REG_1, BPF_REG_7), 503 503 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call),
+152 -1
tools/testing/selftests/bpf/verifier/runtime_jit.c
··· 27 27 { 28 28 "runtime/jit: tail_call within bounds, no prog", 29 29 .insns = { 30 - BPF_MOV64_IMM(BPF_REG_3, 2), 30 + BPF_MOV64_IMM(BPF_REG_3, 3), 31 31 BPF_LD_MAP_FD(BPF_REG_2, 0), 32 32 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 33 33 BPF_MOV64_IMM(BPF_REG_0, 1), ··· 36 36 .fixup_prog1 = { 1 }, 37 37 .result = ACCEPT, 38 38 .retval = 1, 39 + }, 40 + { 41 + "runtime/jit: tail_call within bounds, key 2", 42 + .insns = { 43 + BPF_MOV64_IMM(BPF_REG_3, 2), 44 + BPF_LD_MAP_FD(BPF_REG_2, 0), 45 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 46 + BPF_MOV64_IMM(BPF_REG_0, 1), 47 + BPF_EXIT_INSN(), 48 + }, 49 + .fixup_prog1 = { 1 }, 50 + .result = ACCEPT, 51 + .retval = 24, 52 + }, 53 + { 54 + "runtime/jit: tail_call within bounds, key 2 / key 2, first branch", 55 + .insns = { 56 + BPF_MOV64_IMM(BPF_REG_0, 13), 57 + BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 58 + offsetof(struct __sk_buff, cb[0])), 59 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 60 + offsetof(struct __sk_buff, cb[0])), 61 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 13, 4), 62 + BPF_MOV64_IMM(BPF_REG_3, 2), 63 + BPF_LD_MAP_FD(BPF_REG_2, 0), 64 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 65 + BPF_MOV64_IMM(BPF_REG_3, 2), 66 + BPF_LD_MAP_FD(BPF_REG_2, 0), 67 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 68 + BPF_MOV64_IMM(BPF_REG_0, 1), 69 + BPF_EXIT_INSN(), 70 + }, 71 + .fixup_prog1 = { 5, 9 }, 72 + .result = ACCEPT, 73 + .retval = 24, 74 + }, 75 + { 76 + "runtime/jit: tail_call within bounds, key 2 / key 2, second branch", 77 + .insns = { 78 + BPF_MOV64_IMM(BPF_REG_0, 14), 79 + BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 80 + offsetof(struct __sk_buff, cb[0])), 81 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 82 + offsetof(struct __sk_buff, cb[0])), 83 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 13, 4), 84 + BPF_MOV64_IMM(BPF_REG_3, 2), 85 + BPF_LD_MAP_FD(BPF_REG_2, 0), 86 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 87 + BPF_MOV64_IMM(BPF_REG_3, 2), 88 + BPF_LD_MAP_FD(BPF_REG_2, 0), 89 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 90 + BPF_MOV64_IMM(BPF_REG_0, 1), 91 + BPF_EXIT_INSN(), 92 + }, 93 + .fixup_prog1 = { 5, 9 }, 94 + .result = ACCEPT, 95 + .retval = 24, 96 + }, 97 + { 98 + "runtime/jit: tail_call within bounds, key 0 / key 2, first branch", 99 + .insns = { 100 + BPF_MOV64_IMM(BPF_REG_0, 13), 101 + BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 102 + offsetof(struct __sk_buff, cb[0])), 103 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 104 + offsetof(struct __sk_buff, cb[0])), 105 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 13, 4), 106 + BPF_MOV64_IMM(BPF_REG_3, 0), 107 + BPF_LD_MAP_FD(BPF_REG_2, 0), 108 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 109 + BPF_MOV64_IMM(BPF_REG_3, 2), 110 + BPF_LD_MAP_FD(BPF_REG_2, 0), 111 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 112 + BPF_MOV64_IMM(BPF_REG_0, 1), 113 + BPF_EXIT_INSN(), 114 + }, 115 + .fixup_prog1 = { 5, 9 }, 116 + .result = ACCEPT, 117 + .retval = 24, 118 + }, 119 + { 120 + "runtime/jit: tail_call within bounds, key 0 / key 2, second branch", 121 + .insns = { 122 + BPF_MOV64_IMM(BPF_REG_0, 14), 123 + BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 124 + offsetof(struct __sk_buff, cb[0])), 125 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 126 + offsetof(struct __sk_buff, cb[0])), 127 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 13, 4), 128 + BPF_MOV64_IMM(BPF_REG_3, 0), 129 + BPF_LD_MAP_FD(BPF_REG_2, 0), 130 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 131 + BPF_MOV64_IMM(BPF_REG_3, 2), 132 + BPF_LD_MAP_FD(BPF_REG_2, 0), 133 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 134 + BPF_MOV64_IMM(BPF_REG_0, 1), 135 + BPF_EXIT_INSN(), 136 + }, 137 + .fixup_prog1 = { 5, 9 }, 138 + .result = ACCEPT, 139 + .retval = 42, 140 + }, 141 + { 142 + "runtime/jit: tail_call within bounds, different maps, first branch", 143 + .insns = { 144 + BPF_MOV64_IMM(BPF_REG_0, 13), 145 + BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 146 + offsetof(struct __sk_buff, cb[0])), 147 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 148 + offsetof(struct __sk_buff, cb[0])), 149 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 13, 4), 150 + BPF_MOV64_IMM(BPF_REG_3, 0), 151 + BPF_LD_MAP_FD(BPF_REG_2, 0), 152 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 153 + BPF_MOV64_IMM(BPF_REG_3, 0), 154 + BPF_LD_MAP_FD(BPF_REG_2, 0), 155 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 156 + BPF_MOV64_IMM(BPF_REG_0, 1), 157 + BPF_EXIT_INSN(), 158 + }, 159 + .fixup_prog1 = { 5 }, 160 + .fixup_prog2 = { 9 }, 161 + .result_unpriv = REJECT, 162 + .errstr_unpriv = "tail_call abusing map_ptr", 163 + .result = ACCEPT, 164 + .retval = 1, 165 + }, 166 + { 167 + "runtime/jit: tail_call within bounds, different maps, second branch", 168 + .insns = { 169 + BPF_MOV64_IMM(BPF_REG_0, 14), 170 + BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 171 + offsetof(struct __sk_buff, cb[0])), 172 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 173 + offsetof(struct __sk_buff, cb[0])), 174 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 13, 4), 175 + BPF_MOV64_IMM(BPF_REG_3, 0), 176 + BPF_LD_MAP_FD(BPF_REG_2, 0), 177 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 178 + BPF_MOV64_IMM(BPF_REG_3, 0), 179 + BPF_LD_MAP_FD(BPF_REG_2, 0), 180 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call), 181 + BPF_MOV64_IMM(BPF_REG_0, 1), 182 + BPF_EXIT_INSN(), 183 + }, 184 + .fixup_prog1 = { 5 }, 185 + .fixup_prog2 = { 9 }, 186 + .result_unpriv = REJECT, 187 + .errstr_unpriv = "tail_call abusing map_ptr", 188 + .result = ACCEPT, 189 + .retval = 42, 39 190 }, 40 191 { 41 192 "runtime/jit: tail_call out of bounds",
+1 -1
tools/testing/selftests/net/forwarding/router_bridge_vlan.sh
··· 36 36 { 37 37 ip -6 route del 2001:db8:1::/64 vrf v$h2 38 38 ip -4 route del 192.0.2.0/28 vrf v$h2 39 - simple_if_fini $h2 192.0.2.130/28 39 + simple_if_fini $h2 192.0.2.130/28 2001:db8:2::2/64 40 40 } 41 41 42 42 router_create()
+3 -3
tools/testing/selftests/net/pmtu.sh
··· 11 11 # R1 and R2 (also implemented with namespaces), with different MTUs: 12 12 # 13 13 # segment a_r1 segment b_r1 a_r1: 2000 14 - # .--------------R1--------------. a_r2: 1500 15 - # A B a_r3: 2000 16 - # '--------------R2--------------' a_r4: 1400 14 + # .--------------R1--------------. b_r1: 1400 15 + # A B a_r2: 2000 16 + # '--------------R2--------------' b_r2: 1500 17 17 # segment a_r2 segment b_r2 18 18 # 19 19 # Check that PMTU exceptions with the correct PMTU are created. Then
-28
tools/testing/selftests/net/tls.c
··· 722 722 EXPECT_EQ(memcmp(send_mem, recv_mem + 10, 5), 0); 723 723 } 724 724 725 - TEST_F(tls, recv_rcvbuf) 726 - { 727 - char send_mem[4096]; 728 - char recv_mem[4096]; 729 - int rcv_buf = 1024; 730 - 731 - memset(send_mem, 0x1c, sizeof(send_mem)); 732 - 733 - EXPECT_EQ(setsockopt(self->cfd, SOL_SOCKET, SO_RCVBUF, 734 - &rcv_buf, sizeof(rcv_buf)), 0); 735 - 736 - EXPECT_EQ(send(self->fd, send_mem, 512, 0), 512); 737 - memset(recv_mem, 0, sizeof(recv_mem)); 738 - EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), 0), 512); 739 - EXPECT_EQ(memcmp(send_mem, recv_mem, 512), 0); 740 - 741 - if (self->notls) 742 - return; 743 - 744 - EXPECT_EQ(send(self->fd, send_mem, 4096, 0), 4096); 745 - memset(recv_mem, 0, sizeof(recv_mem)); 746 - EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), 0), -1); 747 - EXPECT_EQ(errno, EMSGSIZE); 748 - 749 - EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), 0), -1); 750 - EXPECT_EQ(errno, EMSGSIZE); 751 - } 752 - 753 725 TEST_F(tls, bidir) 754 726 { 755 727 char const *test_str = "test_read";
+176 -156
tools/testing/selftests/netfilter/nft_nat.sh
··· 8 8 ret=0 9 9 test_inet_nat=true 10 10 11 + sfx=$(mktemp -u "XXXXXXXX") 12 + ns0="ns0-$sfx" 13 + ns1="ns1-$sfx" 14 + ns2="ns2-$sfx" 15 + 11 16 cleanup() 12 17 { 13 - for i in 0 1 2; do ip netns del ns$i;done 18 + for i in 0 1 2; do ip netns del ns$i-"$sfx";done 14 19 } 15 20 16 21 nft --version > /dev/null 2>&1 ··· 30 25 exit $ksft_skip 31 26 fi 32 27 33 - ip netns add ns0 28 + ip netns add "$ns0" 34 29 if [ $? -ne 0 ];then 35 - echo "SKIP: Could not create net namespace" 30 + echo "SKIP: Could not create net namespace $ns0" 36 31 exit $ksft_skip 37 32 fi 38 33 39 34 trap cleanup EXIT 40 35 41 - ip netns add ns1 42 - ip netns add ns2 36 + ip netns add "$ns1" 37 + if [ $? -ne 0 ];then 38 + echo "SKIP: Could not create net namespace $ns1" 39 + exit $ksft_skip 40 + fi 43 41 44 - ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 > /dev/null 2>&1 42 + ip netns add "$ns2" 43 + if [ $? -ne 0 ];then 44 + echo "SKIP: Could not create net namespace $ns2" 45 + exit $ksft_skip 46 + fi 47 + 48 + ip link add veth0 netns "$ns0" type veth peer name eth0 netns "$ns1" > /dev/null 2>&1 45 49 if [ $? -ne 0 ];then 46 50 echo "SKIP: No virtual ethernet pair device support in kernel" 47 51 exit $ksft_skip 48 52 fi 49 - ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 53 + ip link add veth1 netns "$ns0" type veth peer name eth0 netns "$ns2" 50 54 51 - ip -net ns0 link set lo up 52 - ip -net ns0 link set veth0 up 53 - ip -net ns0 addr add 10.0.1.1/24 dev veth0 54 - ip -net ns0 addr add dead:1::1/64 dev veth0 55 + ip -net "$ns0" link set lo up 56 + ip -net "$ns0" link set veth0 up 57 + ip -net "$ns0" addr add 10.0.1.1/24 dev veth0 58 + ip -net "$ns0" addr add dead:1::1/64 dev veth0 55 59 56 - ip -net ns0 link set veth1 up 57 - ip -net ns0 addr add 10.0.2.1/24 dev veth1 58 - ip -net ns0 addr add dead:2::1/64 dev veth1 60 + ip -net "$ns0" link set veth1 up 61 + ip -net "$ns0" addr add 10.0.2.1/24 dev veth1 62 + ip -net "$ns0" addr add dead:2::1/64 dev veth1 59 63 60 64 for i in 1 2; do 61 - ip -net ns$i link set lo up 62 - ip -net ns$i link set eth0 up 63 - ip -net ns$i addr add 10.0.$i.99/24 dev eth0 64 - ip -net ns$i route add default via 10.0.$i.1 65 - ip -net ns$i addr add dead:$i::99/64 dev eth0 66 - ip -net ns$i route add default via dead:$i::1 65 + ip -net ns$i-$sfx link set lo up 66 + ip -net ns$i-$sfx link set eth0 up 67 + ip -net ns$i-$sfx addr add 10.0.$i.99/24 dev eth0 68 + ip -net ns$i-$sfx route add default via 10.0.$i.1 69 + ip -net ns$i-$sfx addr add dead:$i::99/64 dev eth0 70 + ip -net ns$i-$sfx route add default via dead:$i::1 67 71 done 68 72 69 73 bad_counter() ··· 80 66 local ns=$1 81 67 local counter=$2 82 68 local expect=$3 69 + local tag=$4 83 70 84 - echo "ERROR: $counter counter in $ns has unexpected value (expected $expect)" 1>&2 71 + echo "ERROR: $counter counter in $ns has unexpected value (expected $expect) at $tag" 1>&2 85 72 ip netns exec $ns nft list counter inet filter $counter 1>&2 86 73 } 87 74 ··· 93 78 94 79 cnt=$(ip netns exec $ns nft list counter inet filter ns0in | grep -q "packets 1 bytes 84") 95 80 if [ $? -ne 0 ]; then 96 - bad_counter $ns ns0in "packets 1 bytes 84" 81 + bad_counter $ns ns0in "packets 1 bytes 84" "check_counters 1" 97 82 lret=1 98 83 fi 99 84 cnt=$(ip netns exec $ns nft list counter inet filter ns0out | grep -q "packets 1 bytes 84") 100 85 if [ $? -ne 0 ]; then 101 - bad_counter $ns ns0out "packets 1 bytes 84" 86 + bad_counter $ns ns0out "packets 1 bytes 84" "check_counters 2" 102 87 lret=1 103 88 fi 104 89 105 90 expect="packets 1 bytes 104" 106 91 cnt=$(ip netns exec $ns nft list counter inet filter ns0in6 | grep -q "$expect") 107 92 if [ $? -ne 0 ]; then 108 - bad_counter $ns ns0in6 "$expect" 93 + bad_counter $ns ns0in6 "$expect" "check_counters 3" 109 94 lret=1 110 95 fi 111 96 cnt=$(ip netns exec $ns nft list counter inet filter ns0out6 | grep -q "$expect") 112 97 if [ $? -ne 0 ]; then 113 - bad_counter $ns ns0out6 "$expect" 98 + bad_counter $ns ns0out6 "$expect" "check_counters 4" 114 99 lret=1 115 100 fi 116 101 ··· 122 107 local ns=$1 123 108 local lret=0 124 109 125 - cnt=$(ip netns exec ns0 nft list counter inet filter ns0in | grep -q "packets 0 bytes 0") 110 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0in | grep -q "packets 0 bytes 0") 126 111 if [ $? -ne 0 ]; then 127 - bad_counter ns0 ns0in "packets 0 bytes 0" 112 + bad_counter "$ns0" ns0in "packets 0 bytes 0" "check_ns0_counters 1" 128 113 lret=1 129 114 fi 130 115 131 - cnt=$(ip netns exec ns0 nft list counter inet filter ns0in6 | grep -q "packets 0 bytes 0") 116 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0in6 | grep -q "packets 0 bytes 0") 132 117 if [ $? -ne 0 ]; then 133 - bad_counter ns0 ns0in6 "packets 0 bytes 0" 118 + bad_counter "$ns0" ns0in6 "packets 0 bytes 0" 134 119 lret=1 135 120 fi 136 121 137 - cnt=$(ip netns exec ns0 nft list counter inet filter ns0out | grep -q "packets 0 bytes 0") 122 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0out | grep -q "packets 0 bytes 0") 138 123 if [ $? -ne 0 ]; then 139 - bad_counter ns0 ns0out "packets 0 bytes 0" 124 + bad_counter "$ns0" ns0out "packets 0 bytes 0" "check_ns0_counters 2" 140 125 lret=1 141 126 fi 142 - cnt=$(ip netns exec ns0 nft list counter inet filter ns0out6 | grep -q "packets 0 bytes 0") 127 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0out6 | grep -q "packets 0 bytes 0") 143 128 if [ $? -ne 0 ]; then 144 - bad_counter ns0 ns0out6 "packets 0 bytes 0" 129 + bad_counter "$ns0" ns0out6 "packets 0 bytes 0" "check_ns0_counters3 " 145 130 lret=1 146 131 fi 147 132 148 133 for dir in "in" "out" ; do 149 134 expect="packets 1 bytes 84" 150 - cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir} | grep -q "$expect") 135 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ${ns}${dir} | grep -q "$expect") 151 136 if [ $? -ne 0 ]; then 152 - bad_counter ns0 $ns$dir "$expect" 137 + bad_counter "$ns0" $ns$dir "$expect" "check_ns0_counters 4" 153 138 lret=1 154 139 fi 155 140 156 141 expect="packets 1 bytes 104" 157 - cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir}6 | grep -q "$expect") 142 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ${ns}${dir}6 | grep -q "$expect") 158 143 if [ $? -ne 0 ]; then 159 - bad_counter ns0 $ns$dir6 "$expect" 144 + bad_counter "$ns0" $ns$dir6 "$expect" "check_ns0_counters 5" 160 145 lret=1 161 146 fi 162 147 done ··· 167 152 reset_counters() 168 153 { 169 154 for i in 0 1 2;do 170 - ip netns exec ns$i nft reset counters inet > /dev/null 155 + ip netns exec ns$i-$sfx nft reset counters inet > /dev/null 171 156 done 172 157 } 173 158 ··· 181 166 IPF="ip6" 182 167 fi 183 168 184 - ip netns exec ns0 nft -f - <<EOF 169 + ip netns exec "$ns0" nft -f /dev/stdin <<EOF 185 170 table $family nat { 186 171 chain output { 187 172 type nat hook output priority 0; policy accept; ··· 195 180 fi 196 181 197 182 # ping netns1, expect rewrite to netns2 198 - ip netns exec ns0 ping -q -c 1 dead:1::99 > /dev/null 183 + ip netns exec "$ns0" ping -q -c 1 dead:1::99 > /dev/null 199 184 if [ $? -ne 0 ]; then 200 185 lret=1 201 186 echo "ERROR: ping6 failed" ··· 204 189 205 190 expect="packets 0 bytes 0" 206 191 for dir in "in6" "out6" ; do 207 - cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") 192 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") 208 193 if [ $? -ne 0 ]; then 209 - bad_counter ns0 ns1$dir "$expect" 194 + bad_counter "$ns0" ns1$dir "$expect" "test_local_dnat6 1" 210 195 lret=1 211 196 fi 212 197 done 213 198 214 199 expect="packets 1 bytes 104" 215 200 for dir in "in6" "out6" ; do 216 - cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") 201 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") 217 202 if [ $? -ne 0 ]; then 218 - bad_counter ns0 ns2$dir "$expect" 203 + bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat6 2" 219 204 lret=1 220 205 fi 221 206 done ··· 223 208 # expect 0 count in ns1 224 209 expect="packets 0 bytes 0" 225 210 for dir in "in6" "out6" ; do 226 - cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") 211 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") 227 212 if [ $? -ne 0 ]; then 228 - bad_counter ns1 ns0$dir "$expect" 213 + bad_counter "$ns1" ns0$dir "$expect" "test_local_dnat6 3" 229 214 lret=1 230 215 fi 231 216 done ··· 233 218 # expect 1 packet in ns2 234 219 expect="packets 1 bytes 104" 235 220 for dir in "in6" "out6" ; do 236 - cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") 221 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect") 237 222 if [ $? -ne 0 ]; then 238 - bad_counter ns2 ns0$dir "$expect" 223 + bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat6 4" 239 224 lret=1 240 225 fi 241 226 done 242 227 243 - test $lret -eq 0 && echo "PASS: ipv6 ping to ns1 was $family NATted to ns2" 244 - ip netns exec ns0 nft flush chain ip6 nat output 228 + test $lret -eq 0 && echo "PASS: ipv6 ping to $ns1 was $family NATted to $ns2" 229 + ip netns exec "$ns0" nft flush chain ip6 nat output 245 230 246 231 return $lret 247 232 } ··· 256 241 IPF="ip" 257 242 fi 258 243 259 - ip netns exec ns0 nft -f - <<EOF 2>/dev/null 244 + ip netns exec "$ns0" nft -f /dev/stdin <<EOF 2>/dev/null 260 245 table $family nat { 261 246 chain output { 262 247 type nat hook output priority 0; policy accept; ··· 275 260 fi 276 261 277 262 # ping netns1, expect rewrite to netns2 278 - ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null 263 + ip netns exec "$ns0" ping -q -c 1 10.0.1.99 > /dev/null 279 264 if [ $? -ne 0 ]; then 280 265 lret=1 281 266 echo "ERROR: ping failed" ··· 284 269 285 270 expect="packets 0 bytes 0" 286 271 for dir in "in" "out" ; do 287 - cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") 272 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") 288 273 if [ $? -ne 0 ]; then 289 - bad_counter ns0 ns1$dir "$expect" 274 + bad_counter "$ns0" ns1$dir "$expect" "test_local_dnat 1" 290 275 lret=1 291 276 fi 292 277 done 293 278 294 279 expect="packets 1 bytes 84" 295 280 for dir in "in" "out" ; do 296 - cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") 281 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") 297 282 if [ $? -ne 0 ]; then 298 - bad_counter ns0 ns2$dir "$expect" 283 + bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat 2" 299 284 lret=1 300 285 fi 301 286 done ··· 303 288 # expect 0 count in ns1 304 289 expect="packets 0 bytes 0" 305 290 for dir in "in" "out" ; do 306 - cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") 291 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") 307 292 if [ $? -ne 0 ]; then 308 - bad_counter ns1 ns0$dir "$expect" 293 + bad_counter "$ns1" ns0$dir "$expect" "test_local_dnat 3" 309 294 lret=1 310 295 fi 311 296 done ··· 313 298 # expect 1 packet in ns2 314 299 expect="packets 1 bytes 84" 315 300 for dir in "in" "out" ; do 316 - cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") 301 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect") 317 302 if [ $? -ne 0 ]; then 318 - bad_counter ns2 ns0$dir "$expect" 303 + bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat 4" 319 304 lret=1 320 305 fi 321 306 done 322 307 323 - test $lret -eq 0 && echo "PASS: ping to ns1 was $family NATted to ns2" 308 + test $lret -eq 0 && echo "PASS: ping to $ns1 was $family NATted to $ns2" 324 309 325 - ip netns exec ns0 nft flush chain $family nat output 310 + ip netns exec "$ns0" nft flush chain $family nat output 326 311 327 312 reset_counters 328 - ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null 313 + ip netns exec "$ns0" ping -q -c 1 10.0.1.99 > /dev/null 329 314 if [ $? -ne 0 ]; then 330 315 lret=1 331 316 echo "ERROR: ping failed" ··· 334 319 335 320 expect="packets 1 bytes 84" 336 321 for dir in "in" "out" ; do 337 - cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") 322 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") 338 323 if [ $? -ne 0 ]; then 339 - bad_counter ns1 ns1$dir "$expect" 324 + bad_counter "$ns1" ns1$dir "$expect" "test_local_dnat 5" 340 325 lret=1 341 326 fi 342 327 done 343 328 expect="packets 0 bytes 0" 344 329 for dir in "in" "out" ; do 345 - cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") 330 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") 346 331 if [ $? -ne 0 ]; then 347 - bad_counter ns0 ns2$dir "$expect" 332 + bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat 6" 348 333 lret=1 349 334 fi 350 335 done ··· 352 337 # expect 1 count in ns1 353 338 expect="packets 1 bytes 84" 354 339 for dir in "in" "out" ; do 355 - cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") 340 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") 356 341 if [ $? -ne 0 ]; then 357 - bad_counter ns0 ns0$dir "$expect" 342 + bad_counter "$ns0" ns0$dir "$expect" "test_local_dnat 7" 358 343 lret=1 359 344 fi 360 345 done ··· 362 347 # expect 0 packet in ns2 363 348 expect="packets 0 bytes 0" 364 349 for dir in "in" "out" ; do 365 - cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") 350 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect") 366 351 if [ $? -ne 0 ]; then 367 - bad_counter ns2 ns2$dir "$expect" 352 + bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat 8" 368 353 lret=1 369 354 fi 370 355 done 371 356 372 - test $lret -eq 0 && echo "PASS: ping to ns1 OK after $family nat output chain flush" 357 + test $lret -eq 0 && echo "PASS: ping to $ns1 OK after $family nat output chain flush" 373 358 374 359 return $lret 375 360 } ··· 381 366 local natflags=$2 382 367 local lret=0 383 368 384 - ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null 369 + ip netns exec "$ns0" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null 385 370 386 - ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 371 + ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 387 372 if [ $? -ne 0 ] ; then 388 - echo "ERROR: cannot ping ns1 from ns2 via ipv6" 373 + echo "ERROR: cannot ping $ns1 from $ns2 via ipv6" 389 374 return 1 390 375 lret=1 391 376 fi 392 377 393 378 expect="packets 1 bytes 104" 394 379 for dir in "in6" "out6" ; do 395 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 380 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 396 381 if [ $? -ne 0 ]; then 397 - bad_counter ns1 ns2$dir "$expect" 382 + bad_counter "$ns1" ns2$dir "$expect" "test_masquerade6 1" 398 383 lret=1 399 384 fi 400 385 401 - cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") 386 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") 402 387 if [ $? -ne 0 ]; then 403 - bad_counter ns2 ns1$dir "$expect" 388 + bad_counter "$ns2" ns1$dir "$expect" "test_masquerade6 2" 404 389 lret=1 405 390 fi 406 391 done ··· 408 393 reset_counters 409 394 410 395 # add masquerading rule 411 - ip netns exec ns0 nft -f - <<EOF 396 + ip netns exec "$ns0" nft -f /dev/stdin <<EOF 412 397 table $family nat { 413 398 chain postrouting { 414 399 type nat hook postrouting priority 0; policy accept; ··· 421 406 return $ksft_skip 422 407 fi 423 408 424 - ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 409 + ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 425 410 if [ $? -ne 0 ] ; then 426 - echo "ERROR: cannot ping ns1 from ns2 with active $family masquerade $natflags" 411 + echo "ERROR: cannot ping $ns1 from $ns2 with active $family masquerade $natflags" 427 412 lret=1 428 413 fi 429 414 430 415 # ns1 should have seen packets from ns0, due to masquerade 431 416 expect="packets 1 bytes 104" 432 417 for dir in "in6" "out6" ; do 433 - cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") 418 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") 434 419 if [ $? -ne 0 ]; then 435 - bad_counter ns1 ns0$dir "$expect" 420 + bad_counter "$ns1" ns0$dir "$expect" "test_masquerade6 3" 436 421 lret=1 437 422 fi 438 423 439 - cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") 424 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") 440 425 if [ $? -ne 0 ]; then 441 - bad_counter ns2 ns1$dir "$expect" 426 + bad_counter "$ns2" ns1$dir "$expect" "test_masquerade6 4" 442 427 lret=1 443 428 fi 444 429 done ··· 446 431 # ns1 should not have seen packets from ns2, due to masquerade 447 432 expect="packets 0 bytes 0" 448 433 for dir in "in6" "out6" ; do 449 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 434 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 450 435 if [ $? -ne 0 ]; then 451 - bad_counter ns1 ns0$dir "$expect" 436 + bad_counter "$ns1" ns0$dir "$expect" "test_masquerade6 5" 452 437 lret=1 453 438 fi 454 439 455 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 440 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") 456 441 if [ $? -ne 0 ]; then 457 - bad_counter ns2 ns1$dir "$expect" 442 + bad_counter "$ns0" ns1$dir "$expect" "test_masquerade6 6" 458 443 lret=1 459 444 fi 460 445 done 461 446 462 - ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 447 + ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 463 448 if [ $? -ne 0 ] ; then 464 - echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags (attempt 2)" 449 + echo "ERROR: cannot ping $ns1 from $ns2 with active ipv6 masquerade $natflags (attempt 2)" 465 450 lret=1 466 451 fi 467 452 468 - ip netns exec ns0 nft flush chain $family nat postrouting 453 + ip netns exec "$ns0" nft flush chain $family nat postrouting 469 454 if [ $? -ne 0 ]; then 470 455 echo "ERROR: Could not flush $family nat postrouting" 1>&2 471 456 lret=1 472 457 fi 473 458 474 - test $lret -eq 0 && echo "PASS: $family IPv6 masquerade $natflags for ns2" 459 + test $lret -eq 0 && echo "PASS: $family IPv6 masquerade $natflags for $ns2" 475 460 476 461 return $lret 477 462 } ··· 482 467 local natflags=$2 483 468 local lret=0 484 469 485 - ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null 486 - ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null 470 + ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null 471 + ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null 487 472 488 - ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 473 + ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 489 474 if [ $? -ne 0 ] ; then 490 - echo "ERROR: cannot ping ns1 from ns2 $natflags" 475 + echo "ERROR: cannot ping $ns1 from "$ns2" $natflags" 491 476 lret=1 492 477 fi 493 478 494 479 expect="packets 1 bytes 84" 495 480 for dir in "in" "out" ; do 496 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 481 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 497 482 if [ $? -ne 0 ]; then 498 - bad_counter ns1 ns2$dir "$expect" 483 + bad_counter "$ns1" ns2$dir "$expect" "test_masquerade 1" 499 484 lret=1 500 485 fi 501 486 502 - cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") 487 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") 503 488 if [ $? -ne 0 ]; then 504 - bad_counter ns2 ns1$dir "$expect" 489 + bad_counter "$ns2" ns1$dir "$expect" "test_masquerade 2" 505 490 lret=1 506 491 fi 507 492 done ··· 509 494 reset_counters 510 495 511 496 # add masquerading rule 512 - ip netns exec ns0 nft -f - <<EOF 497 + ip netns exec "$ns0" nft -f /dev/stdin <<EOF 513 498 table $family nat { 514 499 chain postrouting { 515 500 type nat hook postrouting priority 0; policy accept; ··· 522 507 return $ksft_skip 523 508 fi 524 509 525 - ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 510 + ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 526 511 if [ $? -ne 0 ] ; then 527 - echo "ERROR: cannot ping ns1 from ns2 with active $family masquerade $natflags" 512 + echo "ERROR: cannot ping $ns1 from $ns2 with active $family masquerade $natflags" 528 513 lret=1 529 514 fi 530 515 531 516 # ns1 should have seen packets from ns0, due to masquerade 532 517 expect="packets 1 bytes 84" 533 518 for dir in "in" "out" ; do 534 - cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") 519 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") 535 520 if [ $? -ne 0 ]; then 536 - bad_counter ns1 ns0$dir "$expect" 521 + bad_counter "$ns1" ns0$dir "$expect" "test_masquerade 3" 537 522 lret=1 538 523 fi 539 524 540 - cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") 525 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") 541 526 if [ $? -ne 0 ]; then 542 - bad_counter ns2 ns1$dir "$expect" 527 + bad_counter "$ns2" ns1$dir "$expect" "test_masquerade 4" 543 528 lret=1 544 529 fi 545 530 done ··· 547 532 # ns1 should not have seen packets from ns2, due to masquerade 548 533 expect="packets 0 bytes 0" 549 534 for dir in "in" "out" ; do 550 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 535 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 551 536 if [ $? -ne 0 ]; then 552 - bad_counter ns1 ns0$dir "$expect" 537 + bad_counter "$ns1" ns0$dir "$expect" "test_masquerade 5" 553 538 lret=1 554 539 fi 555 540 556 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 541 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") 557 542 if [ $? -ne 0 ]; then 558 - bad_counter ns2 ns1$dir "$expect" 543 + bad_counter "$ns0" ns1$dir "$expect" "test_masquerade 6" 559 544 lret=1 560 545 fi 561 546 done 562 547 563 - ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 548 + ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 564 549 if [ $? -ne 0 ] ; then 565 - echo "ERROR: cannot ping ns1 from ns2 with active ip masquerade $natflags (attempt 2)" 550 + echo "ERROR: cannot ping $ns1 from $ns2 with active ip masquerade $natflags (attempt 2)" 566 551 lret=1 567 552 fi 568 553 569 - ip netns exec ns0 nft flush chain $family nat postrouting 554 + ip netns exec "$ns0" nft flush chain $family nat postrouting 570 555 if [ $? -ne 0 ]; then 571 556 echo "ERROR: Could not flush $family nat postrouting" 1>&2 572 557 lret=1 573 558 fi 574 559 575 - test $lret -eq 0 && echo "PASS: $family IP masquerade $natflags for ns2" 560 + test $lret -eq 0 && echo "PASS: $family IP masquerade $natflags for $ns2" 576 561 577 562 return $lret 578 563 } ··· 582 567 local family=$1 583 568 local lret=0 584 569 585 - ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null 570 + ip netns exec "$ns0" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null 586 571 587 - ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 572 + ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 588 573 if [ $? -ne 0 ] ; then 589 - echo "ERROR: cannnot ping ns1 from ns2 via ipv6" 574 + echo "ERROR: cannnot ping $ns1 from $ns2 via ipv6" 590 575 lret=1 591 576 fi 592 577 593 578 expect="packets 1 bytes 104" 594 579 for dir in "in6" "out6" ; do 595 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 580 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 596 581 if [ $? -ne 0 ]; then 597 - bad_counter ns1 ns2$dir "$expect" 582 + bad_counter "$ns1" ns2$dir "$expect" "test_redirect6 1" 598 583 lret=1 599 584 fi 600 585 601 - cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") 586 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") 602 587 if [ $? -ne 0 ]; then 603 - bad_counter ns2 ns1$dir "$expect" 588 + bad_counter "$ns2" ns1$dir "$expect" "test_redirect6 2" 604 589 lret=1 605 590 fi 606 591 done ··· 608 593 reset_counters 609 594 610 595 # add redirect rule 611 - ip netns exec ns0 nft -f - <<EOF 596 + ip netns exec "$ns0" nft -f /dev/stdin <<EOF 612 597 table $family nat { 613 598 chain prerouting { 614 599 type nat hook prerouting priority 0; policy accept; ··· 621 606 return $ksft_skip 622 607 fi 623 608 624 - ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 609 + ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 625 610 if [ $? -ne 0 ] ; then 626 - echo "ERROR: cannot ping ns1 from ns2 via ipv6 with active $family redirect" 611 + echo "ERROR: cannot ping $ns1 from $ns2 via ipv6 with active $family redirect" 627 612 lret=1 628 613 fi 629 614 630 615 # ns1 should have seen no packets from ns2, due to redirection 631 616 expect="packets 0 bytes 0" 632 617 for dir in "in6" "out6" ; do 633 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 618 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 634 619 if [ $? -ne 0 ]; then 635 - bad_counter ns1 ns0$dir "$expect" 620 + bad_counter "$ns1" ns0$dir "$expect" "test_redirect6 3" 636 621 lret=1 637 622 fi 638 623 done ··· 640 625 # ns0 should have seen packets from ns2, due to masquerade 641 626 expect="packets 1 bytes 104" 642 627 for dir in "in6" "out6" ; do 643 - cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") 628 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") 644 629 if [ $? -ne 0 ]; then 645 - bad_counter ns1 ns0$dir "$expect" 630 + bad_counter "$ns1" ns0$dir "$expect" "test_redirect6 4" 646 631 lret=1 647 632 fi 648 633 done 649 634 650 - ip netns exec ns0 nft delete table $family nat 635 + ip netns exec "$ns0" nft delete table $family nat 651 636 if [ $? -ne 0 ]; then 652 637 echo "ERROR: Could not delete $family nat table" 1>&2 653 638 lret=1 654 639 fi 655 640 656 - test $lret -eq 0 && echo "PASS: $family IPv6 redirection for ns2" 641 + test $lret -eq 0 && echo "PASS: $family IPv6 redirection for $ns2" 657 642 658 643 return $lret 659 644 } ··· 663 648 local family=$1 664 649 local lret=0 665 650 666 - ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null 667 - ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null 651 + ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null 652 + ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null 668 653 669 - ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 654 + ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 670 655 if [ $? -ne 0 ] ; then 671 - echo "ERROR: cannot ping ns1 from ns2" 656 + echo "ERROR: cannot ping $ns1 from $ns2" 672 657 lret=1 673 658 fi 674 659 675 660 expect="packets 1 bytes 84" 676 661 for dir in "in" "out" ; do 677 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 662 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 678 663 if [ $? -ne 0 ]; then 679 - bad_counter ns1 ns2$dir "$expect" 664 + bad_counter "$ns1" $ns2$dir "$expect" "test_redirect 1" 680 665 lret=1 681 666 fi 682 667 683 - cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") 668 + cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") 684 669 if [ $? -ne 0 ]; then 685 - bad_counter ns2 ns1$dir "$expect" 670 + bad_counter "$ns2" ns1$dir "$expect" "test_redirect 2" 686 671 lret=1 687 672 fi 688 673 done ··· 690 675 reset_counters 691 676 692 677 # add redirect rule 693 - ip netns exec ns0 nft -f - <<EOF 678 + ip netns exec "$ns0" nft -f /dev/stdin <<EOF 694 679 table $family nat { 695 680 chain prerouting { 696 681 type nat hook prerouting priority 0; policy accept; ··· 703 688 return $ksft_skip 704 689 fi 705 690 706 - ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 691 + ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 707 692 if [ $? -ne 0 ] ; then 708 - echo "ERROR: cannot ping ns1 from ns2 with active $family ip redirect" 693 + echo "ERROR: cannot ping $ns1 from $ns2 with active $family ip redirect" 709 694 lret=1 710 695 fi 711 696 ··· 713 698 expect="packets 0 bytes 0" 714 699 for dir in "in" "out" ; do 715 700 716 - cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") 701 + cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") 717 702 if [ $? -ne 0 ]; then 718 - bad_counter ns1 ns0$dir "$expect" 703 + bad_counter "$ns1" ns0$dir "$expect" "test_redirect 3" 719 704 lret=1 720 705 fi 721 706 done ··· 723 708 # ns0 should have seen packets from ns2, due to masquerade 724 709 expect="packets 1 bytes 84" 725 710 for dir in "in" "out" ; do 726 - cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") 711 + cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") 727 712 if [ $? -ne 0 ]; then 728 - bad_counter ns1 ns0$dir "$expect" 713 + bad_counter "$ns0" ns0$dir "$expect" "test_redirect 4" 729 714 lret=1 730 715 fi 731 716 done 732 717 733 - ip netns exec ns0 nft delete table $family nat 718 + ip netns exec "$ns0" nft delete table $family nat 734 719 if [ $? -ne 0 ]; then 735 720 echo "ERROR: Could not delete $family nat table" 1>&2 736 721 lret=1 737 722 fi 738 723 739 - test $lret -eq 0 && echo "PASS: $family IP redirection for ns2" 724 + test $lret -eq 0 && echo "PASS: $family IP redirection for $ns2" 740 725 741 726 return $lret 742 727 } 743 728 744 729 745 - # ip netns exec ns0 ping -c 1 -q 10.0.$i.99 730 + # ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 746 731 for i in 0 1 2; do 747 - ip netns exec ns$i nft -f - <<EOF 732 + ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF 748 733 table inet filter { 749 734 counter ns0in {} 750 735 counter ns1in {} ··· 811 796 sleep 3 812 797 # test basic connectivity 813 798 for i in 1 2; do 814 - ip netns exec ns0 ping -c 1 -q 10.0.$i.99 > /dev/null 799 + ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 > /dev/null 815 800 if [ $? -ne 0 ];then 816 801 echo "ERROR: Could not reach other namespace(s)" 1>&2 817 802 ret=1 818 803 fi 819 804 820 - ip netns exec ns0 ping -c 1 -q dead:$i::99 > /dev/null 805 + ip netns exec "$ns0" ping -c 1 -q dead:$i::99 > /dev/null 821 806 if [ $? -ne 0 ];then 822 807 echo "ERROR: Could not reach other namespace(s) via ipv6" 1>&2 823 808 ret=1 824 809 fi 825 - check_counters ns$i 810 + check_counters ns$i-$sfx 826 811 if [ $? -ne 0 ]; then 827 812 ret=1 828 813 fi ··· 835 820 done 836 821 837 822 if [ $ret -eq 0 ];then 838 - echo "PASS: netns routing/connectivity: ns0 can reach ns1 and ns2" 823 + echo "PASS: netns routing/connectivity: $ns0 can reach $ns1 and $ns2" 839 824 fi 840 825 841 826 reset_counters ··· 860 845 reset_counters 861 846 $test_inet_nat && test_redirect inet 862 847 $test_inet_nat && test_redirect6 inet 848 + 849 + if [ $ret -ne 0 ];then 850 + echo -n "FAIL: " 851 + nft --version 852 + fi 863 853 864 854 exit $ret
+1 -1
tools/testing/selftests/tc-testing/tc-tests/filters/basic.json
··· 152 152 ] 153 153 }, 154 154 { 155 - "id": "6f5e", 155 + "id": "b99c", 156 156 "name": "Add basic filter with cmp ematch u8/transport layer and default action", 157 157 "category": [ 158 158 "filter",
-22
tools/testing/selftests/tc-testing/tc-tests/filters/tests.json
··· 1 1 [ 2 2 { 3 - "id": "e9a3", 4 - "name": "Add u32 with source match", 5 - "category": [ 6 - "filter", 7 - "u32" 8 - ], 9 - "plugins": { 10 - "requires": "nsPlugin" 11 - }, 12 - "setup": [ 13 - "$TC qdisc add dev $DEV1 ingress" 14 - ], 15 - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: protocol ip prio 1 u32 match ip src 127.0.0.1/32 flowid 1:1 action ok", 16 - "expExitCode": "0", 17 - "verifyCmd": "$TC filter show dev $DEV1 parent ffff:", 18 - "matchPattern": "match 7f000001/ffffffff at 12", 19 - "matchCount": "1", 20 - "teardown": [ 21 - "$TC qdisc del dev $DEV1 ingress" 22 - ] 23 - }, 24 - { 25 3 "id": "2638", 26 4 "name": "Add matchall and try to get it", 27 5 "category": [
+205
tools/testing/selftests/tc-testing/tc-tests/filters/u32.json
··· 1 + [ 2 + { 3 + "id": "afa9", 4 + "name": "Add u32 with source match", 5 + "category": [ 6 + "filter", 7 + "u32" 8 + ], 9 + "plugins": { 10 + "requires": "nsPlugin" 11 + }, 12 + "setup": [ 13 + "$TC qdisc add dev $DEV1 ingress" 14 + ], 15 + "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip prio 1 u32 match ip src 127.0.0.1/32 flowid 1:1 action ok", 16 + "expExitCode": "0", 17 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 18 + "matchPattern": "filter protocol ip pref 1 u32 chain (0[ ]+$|0 fh 800: ht divisor 1|0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1.*match 7f000001/ffffffff at 12)", 19 + "matchCount": "3", 20 + "teardown": [ 21 + "$TC qdisc del dev $DEV1 ingress" 22 + ] 23 + }, 24 + { 25 + "id": "6aa7", 26 + "name": "Add/Replace u32 with source match and invalid indev", 27 + "category": [ 28 + "filter", 29 + "u32" 30 + ], 31 + "plugins": { 32 + "requires": "nsPlugin" 33 + }, 34 + "setup": [ 35 + "$TC qdisc add dev $DEV1 ingress" 36 + ], 37 + "cmdUnderTest": "$TC filter replace dev $DEV1 ingress protocol ip prio 1 u32 match ip src 127.0.0.1/32 indev notexist20 flowid 1:1 action ok", 38 + "expExitCode": "2", 39 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 40 + "matchPattern": "filter protocol ip pref 1 u32 chain 0", 41 + "matchCount": "0", 42 + "teardown": [ 43 + "$TC qdisc del dev $DEV1 ingress" 44 + ] 45 + }, 46 + { 47 + "id": "bc4d", 48 + "name": "Replace valid u32 with source match and invalid indev", 49 + "category": [ 50 + "filter", 51 + "u32" 52 + ], 53 + "plugins": { 54 + "requires": "nsPlugin" 55 + }, 56 + "setup": [ 57 + "$TC qdisc add dev $DEV1 ingress", 58 + "$TC filter add dev $DEV1 ingress protocol ip prio 1 u32 match ip src 127.0.0.3/32 flowid 1:3 action ok" 59 + ], 60 + "cmdUnderTest": "$TC filter replace dev $DEV1 ingress protocol ip prio 1 u32 match ip src 127.0.0.2/32 indev notexist20 flowid 1:2 action ok", 61 + "expExitCode": "2", 62 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 63 + "matchPattern": "filter protocol ip pref 1 u32 chain (0[ ]+$|0 fh 800: ht divisor 1|0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:3.*match 7f000003/ffffffff at 12)", 64 + "matchCount": "3", 65 + "teardown": [ 66 + "$TC qdisc del dev $DEV1 ingress" 67 + ] 68 + }, 69 + { 70 + "id": "648b", 71 + "name": "Add u32 with custom hash table", 72 + "category": [ 73 + "filter", 74 + "u32" 75 + ], 76 + "plugins": { 77 + "requires": "nsPlugin" 78 + }, 79 + "setup": [ 80 + "$TC qdisc add dev $DEV1 ingress" 81 + ], 82 + "cmdUnderTest": "$TC filter add dev $DEV1 ingress prio 99 handle 42: u32 divisor 256", 83 + "expExitCode": "0", 84 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 85 + "matchPattern": "pref 99 u32 chain (0[ ]+$|0 fh 42: ht divisor 256|0 fh 800: ht divisor 1)", 86 + "matchCount": "3", 87 + "teardown": [ 88 + "$TC qdisc del dev $DEV1 ingress" 89 + ] 90 + }, 91 + { 92 + "id": "6658", 93 + "name": "Add/Replace u32 with custom hash table and invalid handle", 94 + "category": [ 95 + "filter", 96 + "u32" 97 + ], 98 + "plugins": { 99 + "requires": "nsPlugin" 100 + }, 101 + "setup": [ 102 + "$TC qdisc add dev $DEV1 ingress" 103 + ], 104 + "cmdUnderTest": "$TC filter replace dev $DEV1 ingress prio 99 handle 42:42 u32 divisor 256", 105 + "expExitCode": "2", 106 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 107 + "matchPattern": "pref 99 u32 chain 0", 108 + "matchCount": "0", 109 + "teardown": [ 110 + "$TC qdisc del dev $DEV1 ingress" 111 + ] 112 + }, 113 + { 114 + "id": "9d0a", 115 + "name": "Replace valid u32 with custom hash table and invalid handle", 116 + "category": [ 117 + "filter", 118 + "u32" 119 + ], 120 + "plugins": { 121 + "requires": "nsPlugin" 122 + }, 123 + "setup": [ 124 + "$TC qdisc add dev $DEV1 ingress", 125 + "$TC filter add dev $DEV1 ingress prio 99 handle 42: u32 divisor 256" 126 + ], 127 + "cmdUnderTest": "$TC filter replace dev $DEV1 ingress prio 99 handle 42:42 u32 divisor 128", 128 + "expExitCode": "2", 129 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 130 + "matchPattern": "pref 99 u32 chain (0[ ]+$|0 fh 42: ht divisor 256|0 fh 800: ht divisor 1)", 131 + "matchCount": "3", 132 + "teardown": [ 133 + "$TC qdisc del dev $DEV1 ingress" 134 + ] 135 + }, 136 + { 137 + "id": "1644", 138 + "name": "Add u32 filter that links to a custom hash table", 139 + "category": [ 140 + "filter", 141 + "u32" 142 + ], 143 + "plugins": { 144 + "requires": "nsPlugin" 145 + }, 146 + "setup": [ 147 + "$TC qdisc add dev $DEV1 ingress", 148 + "$TC filter add dev $DEV1 ingress prio 99 handle 43: u32 divisor 256" 149 + ], 150 + "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip prio 98 u32 link 43: hashkey mask 0x0000ff00 at 12 match ip src 192.168.0.0/16", 151 + "expExitCode": "0", 152 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 153 + "matchPattern": "filter protocol ip pref 98 u32 chain (0[ ]+$|0 fh 801: ht divisor 1|0 fh 801::800 order 2048 key ht 801 bkt 0 link 43:.*match c0a80000/ffff0000 at 12.*hash mask 0000ff00 at 12)", 154 + "matchCount": "3", 155 + "teardown": [ 156 + "$TC qdisc del dev $DEV1 ingress" 157 + ] 158 + }, 159 + { 160 + "id": "74c2", 161 + "name": "Add/Replace u32 filter with invalid hash table id", 162 + "category": [ 163 + "filter", 164 + "u32" 165 + ], 166 + "plugins": { 167 + "requires": "nsPlugin" 168 + }, 169 + "setup": [ 170 + "$TC qdisc add dev $DEV1 ingress" 171 + ], 172 + "cmdUnderTest": "$TC filter replace dev $DEV1 ingress protocol ip prio 20 u32 ht 47:47 action drop", 173 + "expExitCode": "2", 174 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 175 + "matchPattern": "filter protocol ip pref 20 u32 chain 0", 176 + "matchCount": "0", 177 + "teardown": [ 178 + "$TC qdisc del dev $DEV1 ingress" 179 + ] 180 + }, 181 + { 182 + "id": "1fe6", 183 + "name": "Replace valid u32 filter with invalid hash table id", 184 + "category": [ 185 + "filter", 186 + "u32" 187 + ], 188 + "plugins": { 189 + "requires": "nsPlugin" 190 + }, 191 + "setup": [ 192 + "$TC qdisc add dev $DEV1 ingress", 193 + "$TC filter add dev $DEV1 ingress protocol ip prio 99 handle 43: u32 divisor 1", 194 + "$TC filter add dev $DEV1 ingress protocol ip prio 98 u32 ht 43: match tcp src 22 FFFF classid 1:3" 195 + ], 196 + "cmdUnderTest": "$TC filter replace dev $DEV1 ingress protocol ip prio 98 u32 ht 43:1 match tcp src 23 FFFF classid 1:4", 197 + "expExitCode": "2", 198 + "verifyCmd": "$TC filter show dev $DEV1 ingress", 199 + "matchPattern": "filter protocol ip pref 99 u32 chain (0[ ]+$|0 fh (43|800): ht divisor 1|0 fh 43::800 order 2048 key ht 43 bkt 0 flowid 1:3.*match 00160000/ffff0000 at nexthdr\\+0)", 200 + "matchCount": "4", 201 + "teardown": [ 202 + "$TC qdisc del dev $DEV1 ingress" 203 + ] 204 + } 205 + ]