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

Configure Feed

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

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

Pull networking fixes from Jakub Kicinski:
"Including fixes from netfilter and wireless.

Current release - fix to a fix:

- net: do not write to msg_get_inq in callee

- arp: do not assume dev_hard_header() does not change skb->head

Current release - regressions:

- wifi: mac80211: don't iterate not running interfaces

- eth: mlx5: fix NULL pointer dereference in ioctl module EEPROM

Current release - new code bugs:

- eth: bnge: add AUXILIARY_BUS to Kconfig dependencies

Previous releases - regressions:

- eth: mlx5: dealloc forgotten PSP RX modify header

Previous releases - always broken:

- ping: fix ICMP out SNMP stats double-counting with ICMP sockets

- bonding: preserve NETIF_F_ALL_FOR_ALL across TSO updates

- bridge: fix C-VLAN preservation in 802.1ad vlan_tunnel egress

- eth: bnxt: fix potential data corruption with HW GRO/LRO"

* tag 'net-6.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (70 commits)
arp: do not assume dev_hard_header() does not change skb->head
net: enetc: fix build warning when PAGE_SIZE is greater than 128K
atm: Fix dma_free_coherent() size
tools: ynl: don't install tests
net: do not write to msg_get_inq in callee
bnxt_en: Fix NULL pointer crash in bnxt_ptp_enable during error cleanup
net: usb: pegasus: fix memory leak in update_eth_regs_async()
net: 3com: 3c59x: fix possible null dereference in vortex_probe1()
net/sched: sch_qfq: Fix NULL deref when deactivating inactive aggregate in qfq_reset
wifi: mac80211: collect station statistics earlier when disconnect
wifi: mac80211: restore non-chanctx injection behaviour
wifi: mac80211_hwsim: disable BHs for hwsim_radio_lock
wifi: mac80211: don't iterate not running interfaces
wifi: mac80211_hwsim: fix typo in frequency notification
wifi: avoid kernel-infoleak from struct iw_point
net: airoha: Fix schedule while atomic in airoha_ppe_deinit()
selftests: netdevsim: add carrier state consistency test
net: netdevsim: fix inconsistent carrier state after link/unlink
selftests: drv-net: Bring back tool() to driver __init__s
net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy
...

+638 -373
+1
.mailmap
··· 416 416 Juha Yrjola <juha.yrjola@nokia.com> 417 417 Juha Yrjola <juha.yrjola@solidboot.com> 418 418 Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com> 419 + Justin Iurman <justin.iurman@gmail.com> <justin.iurman@uliege.be> 419 420 Iskren Chernev <me@iskren.info> <iskren.chernev@gmail.com> 420 421 Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org> 421 422 Kalle Valo <kvalo@kernel.org> <quic_kvalo@quicinc.com>
+4 -2
Documentation/netlink/specs/netdev.yaml
··· 142 142 name: ifindex 143 143 doc: | 144 144 ifindex of the netdev to which the pool belongs. 145 - May be reported as 0 if the page pool was allocated for a netdev 145 + May not be reported if the page pool was allocated for a netdev 146 146 which got destroyed already (page pools may outlast their netdevs 147 147 because they wait for all memory to be returned). 148 148 type: u32 ··· 601 601 name: page-pool-get 602 602 doc: | 603 603 Get / dump information about Page Pools. 604 - (Only Page Pools associated with a net_device can be listed.) 604 + Only Page Pools associated by the driver with a net_device 605 + can be listed. ifindex will not be reported if the net_device 606 + no longer exists. 605 607 attribute-set: page-pool 606 608 do: 607 609 request:
+2 -1
MAINTAINERS
··· 1283 1283 1284 1284 AMD XGBE DRIVER 1285 1285 M: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com> 1286 + M: Raju Rangoju <Raju.Rangoju@amd.com> 1286 1287 L: netdev@vger.kernel.org 1287 1288 S: Maintained 1288 1289 F: arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi ··· 18284 18283 X: tools/testing/selftests/net/can/ 18285 18284 18286 18285 NETWORKING [IOAM] 18287 - M: Justin Iurman <justin.iurman@uliege.be> 18286 + M: Justin Iurman <justin.iurman@gmail.com> 18288 18287 S: Maintained 18289 18288 F: Documentation/networking/ioam6* 18290 18289 F: include/linux/ioam6*
+2 -1
drivers/atm/he.c
··· 1587 1587 he_dev->tbrq_base, he_dev->tbrq_phys); 1588 1588 1589 1589 if (he_dev->tpdrq_base) 1590 - dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), 1590 + dma_free_coherent(&he_dev->pci_dev->dev, 1591 + CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), 1591 1592 he_dev->tpdrq_base, he_dev->tpdrq_phys); 1592 1593 1593 1594 dma_pool_destroy(he_dev->tpd_pool);
-23
drivers/net/dsa/mv88e6xxx/chip.c
··· 3364 3364 3365 3365 static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) 3366 3366 { 3367 - struct device_node *phy_handle = NULL; 3368 3367 struct fwnode_handle *ports_fwnode; 3369 3368 struct fwnode_handle *port_fwnode; 3370 3369 struct dsa_switch *ds = chip->ds; 3371 3370 struct mv88e6xxx_port *p; 3372 - struct dsa_port *dp; 3373 - int tx_amp; 3374 3371 int err; 3375 3372 u16 reg; 3376 3373 u32 val; ··· 3577 3580 err = chip->info->ops->port_setup_message_port(chip, port); 3578 3581 if (err) 3579 3582 return err; 3580 - } 3581 - 3582 - if (chip->info->ops->serdes_set_tx_amplitude) { 3583 - dp = dsa_to_port(ds, port); 3584 - if (dp) 3585 - phy_handle = of_parse_phandle(dp->dn, "phy-handle", 0); 3586 - 3587 - if (phy_handle && !of_property_read_u32(phy_handle, 3588 - "tx-p2p-microvolt", 3589 - &tx_amp)) 3590 - err = chip->info->ops->serdes_set_tx_amplitude(chip, 3591 - port, tx_amp); 3592 - if (phy_handle) { 3593 - of_node_put(phy_handle); 3594 - if (err) 3595 - return err; 3596 - } 3597 3583 } 3598 3584 3599 3585 /* Port based VLAN map: give each port the same default address ··· 4748 4768 .serdes_irq_mapping = mv88e6352_serdes_irq_mapping, 4749 4769 .serdes_get_regs_len = mv88e6352_serdes_get_regs_len, 4750 4770 .serdes_get_regs = mv88e6352_serdes_get_regs, 4751 - .serdes_set_tx_amplitude = mv88e6352_serdes_set_tx_amplitude, 4752 4771 .gpio_ops = &mv88e6352_gpio_ops, 4753 4772 .phylink_get_caps = mv88e6352_phylink_get_caps, 4754 4773 .pcs_ops = &mv88e6352_pcs_ops, ··· 5023 5044 .serdes_irq_mapping = mv88e6352_serdes_irq_mapping, 5024 5045 .serdes_get_regs_len = mv88e6352_serdes_get_regs_len, 5025 5046 .serdes_get_regs = mv88e6352_serdes_get_regs, 5026 - .serdes_set_tx_amplitude = mv88e6352_serdes_set_tx_amplitude, 5027 5047 .gpio_ops = &mv88e6352_gpio_ops, 5028 5048 .avb_ops = &mv88e6352_avb_ops, 5029 5049 .ptp_ops = &mv88e6352_ptp_ops, ··· 5459 5481 .serdes_get_stats = mv88e6352_serdes_get_stats, 5460 5482 .serdes_get_regs_len = mv88e6352_serdes_get_regs_len, 5461 5483 .serdes_get_regs = mv88e6352_serdes_get_regs, 5462 - .serdes_set_tx_amplitude = mv88e6352_serdes_set_tx_amplitude, 5463 5484 .phylink_get_caps = mv88e6352_phylink_get_caps, 5464 5485 .pcs_ops = &mv88e6352_pcs_ops, 5465 5486 };
-4
drivers/net/dsa/mv88e6xxx/chip.h
··· 642 642 void (*serdes_get_regs)(struct mv88e6xxx_chip *chip, int port, 643 643 void *_p); 644 644 645 - /* SERDES SGMII/Fiber Output Amplitude */ 646 - int (*serdes_set_tx_amplitude)(struct mv88e6xxx_chip *chip, int port, 647 - int val); 648 - 649 645 /* Address Translation Unit operations */ 650 646 int (*atu_get_hash)(struct mv88e6xxx_chip *chip, u8 *hash); 651 647 int (*atu_set_hash)(struct mv88e6xxx_chip *chip, u8 hash);
-46
drivers/net/dsa/mv88e6xxx/serdes.c
··· 25 25 reg, val); 26 26 } 27 27 28 - static int mv88e6352_serdes_write(struct mv88e6xxx_chip *chip, int reg, 29 - u16 val) 30 - { 31 - return mv88e6xxx_phy_page_write(chip, MV88E6352_ADDR_SERDES, 32 - MV88E6352_SERDES_PAGE_FIBER, 33 - reg, val); 34 - } 35 - 36 28 static int mv88e6390_serdes_read(struct mv88e6xxx_chip *chip, 37 29 int lane, int device, int reg, u16 *val) 38 30 { ··· 497 505 if (!err) 498 506 p[i] = reg; 499 507 } 500 - } 501 - 502 - static const int mv88e6352_serdes_p2p_to_reg[] = { 503 - /* Index of value in microvolts corresponds to the register value */ 504 - 14000, 112000, 210000, 308000, 406000, 504000, 602000, 700000, 505 - }; 506 - 507 - int mv88e6352_serdes_set_tx_amplitude(struct mv88e6xxx_chip *chip, int port, 508 - int val) 509 - { 510 - bool found = false; 511 - u16 ctrl, reg; 512 - int err; 513 - int i; 514 - 515 - err = mv88e6352_g2_scratch_port_has_serdes(chip, port); 516 - if (err <= 0) 517 - return err; 518 - 519 - for (i = 0; i < ARRAY_SIZE(mv88e6352_serdes_p2p_to_reg); ++i) { 520 - if (mv88e6352_serdes_p2p_to_reg[i] == val) { 521 - reg = i; 522 - found = true; 523 - break; 524 - } 525 - } 526 - 527 - if (!found) 528 - return -EINVAL; 529 - 530 - err = mv88e6352_serdes_read(chip, MV88E6352_SERDES_SPEC_CTRL2, &ctrl); 531 - if (err) 532 - return err; 533 - 534 - ctrl &= ~MV88E6352_SERDES_OUT_AMP_MASK; 535 - ctrl |= reg; 536 - 537 - return mv88e6352_serdes_write(chip, MV88E6352_SERDES_SPEC_CTRL2, ctrl); 538 508 }
-5
drivers/net/dsa/mv88e6xxx/serdes.h
··· 29 29 #define MV88E6352_SERDES_INT_FIBRE_ENERGY BIT(4) 30 30 #define MV88E6352_SERDES_INT_STATUS 0x13 31 31 32 - #define MV88E6352_SERDES_SPEC_CTRL2 0x1a 33 - #define MV88E6352_SERDES_OUT_AMP_MASK 0x0007 34 32 35 33 #define MV88E6341_PORT5_LANE 0x15 36 34 ··· 137 139 void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p); 138 140 int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port); 139 141 void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p); 140 - 141 - int mv88e6352_serdes_set_tx_amplitude(struct mv88e6xxx_chip *chip, int port, 142 - int val); 143 142 144 143 /* Return the (first) SERDES lane address a port is using, -errno otherwise. */ 145 144 static inline int mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip,
+1 -1
drivers/net/ethernet/3com/3c59x.c
··· 1473 1473 return 0; 1474 1474 1475 1475 free_ring: 1476 - dma_free_coherent(&pdev->dev, 1476 + dma_free_coherent(gendev, 1477 1477 sizeof(struct boom_rx_desc) * RX_RING_SIZE + 1478 1478 sizeof(struct boom_tx_desc) * TX_RING_SIZE, 1479 1479 vp->rx_ring, vp->rx_ring_dma);
+6 -3
drivers/net/ethernet/airoha/airoha_ppe.c
··· 1547 1547 { 1548 1548 struct airoha_npu *npu; 1549 1549 1550 - rcu_read_lock(); 1551 - npu = rcu_dereference(eth->npu); 1550 + mutex_lock(&flow_offload_mutex); 1551 + 1552 + npu = rcu_replace_pointer(eth->npu, NULL, 1553 + lockdep_is_held(&flow_offload_mutex)); 1552 1554 if (npu) { 1553 1555 npu->ops.ppe_deinit(npu); 1554 1556 airoha_npu_put(npu); 1555 1557 } 1556 - rcu_read_unlock(); 1558 + 1559 + mutex_unlock(&flow_offload_mutex); 1557 1560 1558 1561 rhashtable_destroy(&eth->ppe->l2_flows); 1559 1562 rhashtable_destroy(&eth->flow_table);
+4
drivers/net/ethernet/amazon/ena/ena_devlink.c
··· 53 53 { 54 54 union devlink_param_value value; 55 55 56 + devl_lock(devlink); 56 57 value.vbool = false; 57 58 devl_param_driverinit_value_set(devlink, 58 59 DEVLINK_PARAM_GENERIC_ID_ENABLE_PHC, 59 60 value); 61 + devl_unlock(devlink); 60 62 } 61 63 62 64 static void ena_devlink_port_register(struct devlink *devlink) ··· 147 145 return rc; 148 146 } 149 147 148 + devl_lock(devlink); 150 149 value.vbool = ena_phc_is_enabled(adapter); 151 150 devl_param_driverinit_value_set(devlink, 152 151 DEVLINK_PARAM_GENERIC_ID_ENABLE_PHC, 153 152 value); 153 + devl_unlock(devlink); 154 154 155 155 return 0; 156 156 }
+1
drivers/net/ethernet/broadcom/Kconfig
··· 259 259 depends on PCI 260 260 select NET_DEVLINK 261 261 select PAGE_POOL 262 + select AUXILIARY_BUS 262 263 help 263 264 This driver supports Broadcom ThorUltra 50/100/200/400/800 gigabit 264 265 Ethernet cards. The module will be called bng_en. To compile this
+15 -6
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 1482 1482 struct bnxt_tpa_idx_map *map = rxr->rx_tpa_idx_map; 1483 1483 u16 idx = agg_id & MAX_TPA_P5_MASK; 1484 1484 1485 - if (test_bit(idx, map->agg_idx_bmap)) 1486 - idx = find_first_zero_bit(map->agg_idx_bmap, 1487 - BNXT_AGG_IDX_BMAP_SIZE); 1485 + if (test_bit(idx, map->agg_idx_bmap)) { 1486 + idx = find_first_zero_bit(map->agg_idx_bmap, MAX_TPA_P5); 1487 + if (idx >= MAX_TPA_P5) 1488 + return INVALID_HW_RING_ID; 1489 + } 1488 1490 __set_bit(idx, map->agg_idx_bmap); 1489 1491 map->agg_id_tbl[agg_id] = idx; 1490 1492 return idx; ··· 1550 1548 if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { 1551 1549 agg_id = TPA_START_AGG_ID_P5(tpa_start); 1552 1550 agg_id = bnxt_alloc_agg_idx(rxr, agg_id); 1551 + if (unlikely(agg_id == INVALID_HW_RING_ID)) { 1552 + netdev_warn(bp->dev, "Unable to allocate agg ID for ring %d, agg 0x%x\n", 1553 + rxr->bnapi->index, 1554 + TPA_START_AGG_ID_P5(tpa_start)); 1555 + bnxt_sched_reset_rxr(bp, rxr); 1556 + return; 1557 + } 1553 1558 } else { 1554 1559 agg_id = TPA_START_AGG_ID(tpa_start); 1555 1560 } ··· 16891 16882 16892 16883 init_err_pci_clean: 16893 16884 bnxt_hwrm_func_drv_unrgtr(bp); 16894 - bnxt_free_hwrm_resources(bp); 16895 - bnxt_hwmon_uninit(bp); 16896 - bnxt_ethtool_free(bp); 16897 16885 bnxt_ptp_clear(bp); 16898 16886 kfree(bp->ptp_cfg); 16899 16887 bp->ptp_cfg = NULL; 16888 + bnxt_free_hwrm_resources(bp); 16889 + bnxt_hwmon_uninit(bp); 16890 + bnxt_ethtool_free(bp); 16900 16891 kfree(bp->fw_health); 16901 16892 bp->fw_health = NULL; 16902 16893 bnxt_cleanup_pci(bp);
+1 -3
drivers/net/ethernet/broadcom/bnxt/bnxt.h
··· 1080 1080 struct rx_agg_cmp *agg_arr; 1081 1081 }; 1082 1082 1083 - #define BNXT_AGG_IDX_BMAP_SIZE (MAX_TPA_P5 / BITS_PER_LONG) 1084 - 1085 1083 struct bnxt_tpa_idx_map { 1086 1084 u16 agg_id_tbl[1024]; 1087 - unsigned long agg_idx_bmap[BNXT_AGG_IDX_BMAP_SIZE]; 1085 + DECLARE_BITMAP(agg_idx_bmap, MAX_TPA_P5); 1088 1086 }; 1089 1087 1090 1088 struct bnxt_rx_ring_info {
+2 -2
drivers/net/ethernet/freescale/enetc/enetc.h
··· 79 79 #define ENETC_RXB_TRUESIZE (PAGE_SIZE >> 1) 80 80 #define ENETC_RXB_PAD NET_SKB_PAD /* add extra space if needed */ 81 81 #define ENETC_RXB_DMA_SIZE \ 82 - (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD) 82 + min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD, 0xffff) 83 83 #define ENETC_RXB_DMA_SIZE_XDP \ 84 - (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM) 84 + min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM, 0xffff) 85 85 86 86 struct enetc_rx_swbd { 87 87 dma_addr_t dma;
+3 -4
drivers/net/ethernet/intel/idpf/idpf.h
··· 284 284 285 285 struct idpf_fsteer_fltr { 286 286 struct list_head list; 287 - u32 loc; 288 - u32 q_index; 287 + struct ethtool_rx_flow_spec fs; 289 288 }; 290 289 291 290 /** ··· 423 424 * @rss_key: RSS hash key 424 425 * @rss_lut_size: Size of RSS lookup table 425 426 * @rss_lut: RSS lookup table 426 - * @cached_lut: Used to restore previously init RSS lut 427 427 */ 428 428 struct idpf_rss_data { 429 429 u16 rss_key_size; 430 430 u8 *rss_key; 431 431 u16 rss_lut_size; 432 432 u32 *rss_lut; 433 - u32 *cached_lut; 434 433 }; 435 434 436 435 /** ··· 555 558 * @max_q: Maximum possible queues 556 559 * @req_qs_chunks: Queue chunk data for requested queues 557 560 * @mac_filter_list_lock: Lock to protect mac filters 561 + * @flow_steer_list_lock: Lock to protect fsteer filters 558 562 * @flags: See enum idpf_vport_config_flags 559 563 */ 560 564 struct idpf_vport_config { ··· 563 565 struct idpf_vport_max_q max_q; 564 566 struct virtchnl2_add_queues *req_qs_chunks; 565 567 spinlock_t mac_filter_list_lock; 568 + spinlock_t flow_steer_list_lock; 566 569 DECLARE_BITMAP(flags, IDPF_VPORT_CONFIG_FLAGS_NBITS); 567 570 }; 568 571
+63 -29
drivers/net/ethernet/intel/idpf/idpf_ethtool.c
··· 37 37 { 38 38 struct idpf_netdev_priv *np = netdev_priv(netdev); 39 39 struct idpf_vport_user_config_data *user_config; 40 + struct idpf_vport_config *vport_config; 40 41 struct idpf_fsteer_fltr *f; 41 42 struct idpf_vport *vport; 42 43 unsigned int cnt = 0; ··· 45 44 46 45 idpf_vport_ctrl_lock(netdev); 47 46 vport = idpf_netdev_to_vport(netdev); 48 - user_config = &np->adapter->vport_config[np->vport_idx]->user_config; 47 + vport_config = np->adapter->vport_config[np->vport_idx]; 48 + user_config = &vport_config->user_config; 49 49 50 50 switch (cmd->cmd) { 51 51 case ETHTOOL_GRXCLSRLCNT: ··· 54 52 cmd->data = idpf_fsteer_max_rules(vport); 55 53 break; 56 54 case ETHTOOL_GRXCLSRULE: 57 - err = -EINVAL; 55 + err = -ENOENT; 56 + spin_lock_bh(&vport_config->flow_steer_list_lock); 58 57 list_for_each_entry(f, &user_config->flow_steer_list, list) 59 - if (f->loc == cmd->fs.location) { 60 - cmd->fs.ring_cookie = f->q_index; 58 + if (f->fs.location == cmd->fs.location) { 59 + /* Avoid infoleak from padding: zero first, 60 + * then assign fields 61 + */ 62 + memset(&cmd->fs, 0, sizeof(cmd->fs)); 63 + cmd->fs = f->fs; 61 64 err = 0; 62 65 break; 63 66 } 67 + spin_unlock_bh(&vport_config->flow_steer_list_lock); 64 68 break; 65 69 case ETHTOOL_GRXCLSRLALL: 66 70 cmd->data = idpf_fsteer_max_rules(vport); 71 + spin_lock_bh(&vport_config->flow_steer_list_lock); 67 72 list_for_each_entry(f, &user_config->flow_steer_list, list) { 68 73 if (cnt == cmd->rule_cnt) { 69 74 err = -EMSGSIZE; 70 75 break; 71 76 } 72 - rule_locs[cnt] = f->loc; 77 + rule_locs[cnt] = f->fs.location; 73 78 cnt++; 74 79 } 75 80 if (!err) 76 81 cmd->rule_cnt = user_config->num_fsteer_fltrs; 82 + spin_unlock_bh(&vport_config->flow_steer_list_lock); 77 83 break; 78 84 default: 79 85 break; ··· 178 168 struct idpf_vport *vport; 179 169 u32 flow_type, q_index; 180 170 u16 num_rxq; 181 - int err; 171 + int err = 0; 182 172 183 173 vport = idpf_netdev_to_vport(netdev); 184 174 vport_config = vport->adapter->vport_config[np->vport_idx]; ··· 203 193 rule = kzalloc(struct_size(rule, rule_info, 1), GFP_KERNEL); 204 194 if (!rule) 205 195 return -ENOMEM; 196 + 197 + fltr = kzalloc(sizeof(*fltr), GFP_KERNEL); 198 + if (!fltr) { 199 + err = -ENOMEM; 200 + goto out_free_rule; 201 + } 202 + 203 + /* detect duplicate entry and reject before adding rules */ 204 + spin_lock_bh(&vport_config->flow_steer_list_lock); 205 + list_for_each_entry(f, &user_config->flow_steer_list, list) { 206 + if (f->fs.location == fsp->location) { 207 + err = -EEXIST; 208 + break; 209 + } 210 + 211 + if (f->fs.location > fsp->location) 212 + break; 213 + parent = f; 214 + } 215 + spin_unlock_bh(&vport_config->flow_steer_list_lock); 216 + 217 + if (err) 218 + goto out; 206 219 207 220 rule->vport_id = cpu_to_le32(vport->vport_id); 208 221 rule->count = cpu_to_le32(1); ··· 265 232 goto out; 266 233 } 267 234 268 - fltr = kzalloc(sizeof(*fltr), GFP_KERNEL); 269 - if (!fltr) { 270 - err = -ENOMEM; 271 - goto out; 272 - } 235 + /* Save a copy of the user's flow spec so ethtool can later retrieve it */ 236 + fltr->fs = *fsp; 273 237 274 - fltr->loc = fsp->location; 275 - fltr->q_index = q_index; 276 - list_for_each_entry(f, &user_config->flow_steer_list, list) { 277 - if (f->loc >= fltr->loc) 278 - break; 279 - parent = f; 280 - } 281 - 238 + spin_lock_bh(&vport_config->flow_steer_list_lock); 282 239 parent ? list_add(&fltr->list, &parent->list) : 283 240 list_add(&fltr->list, &user_config->flow_steer_list); 284 241 285 242 user_config->num_fsteer_fltrs++; 243 + spin_unlock_bh(&vport_config->flow_steer_list_lock); 244 + goto out_free_rule; 286 245 287 246 out: 247 + kfree(fltr); 248 + out_free_rule: 288 249 kfree(rule); 289 250 return err; 290 251 } ··· 329 302 goto out; 330 303 } 331 304 305 + spin_lock_bh(&vport_config->flow_steer_list_lock); 332 306 list_for_each_entry_safe(f, iter, 333 307 &user_config->flow_steer_list, list) { 334 - if (f->loc == fsp->location) { 308 + if (f->fs.location == fsp->location) { 335 309 list_del(&f->list); 336 310 kfree(f); 337 311 user_config->num_fsteer_fltrs--; 338 - goto out; 312 + goto out_unlock; 339 313 } 340 314 } 341 - err = -EINVAL; 315 + err = -ENOENT; 342 316 317 + out_unlock: 318 + spin_unlock_bh(&vport_config->flow_steer_list_lock); 343 319 out: 344 320 kfree(rule); 345 321 return err; ··· 411 381 * @netdev: network interface device structure 412 382 * @rxfh: pointer to param struct (indir, key, hfunc) 413 383 * 414 - * Reads the indirection table directly from the hardware. Always returns 0. 384 + * RSS LUT and Key information are read from driver's cached 385 + * copy. When rxhash is off, rss lut will be displayed as zeros. 386 + * 387 + * Return: 0 on success, -errno otherwise. 415 388 */ 416 389 static int idpf_get_rxfh(struct net_device *netdev, 417 390 struct ethtool_rxfh_param *rxfh) ··· 422 389 struct idpf_netdev_priv *np = netdev_priv(netdev); 423 390 struct idpf_rss_data *rss_data; 424 391 struct idpf_adapter *adapter; 392 + struct idpf_vport *vport; 393 + bool rxhash_ena; 425 394 int err = 0; 426 395 u16 i; 427 396 428 397 idpf_vport_ctrl_lock(netdev); 398 + vport = idpf_netdev_to_vport(netdev); 429 399 430 400 adapter = np->adapter; 431 401 ··· 438 402 } 439 403 440 404 rss_data = &adapter->vport_config[np->vport_idx]->user_config.rss_data; 441 - if (!test_bit(IDPF_VPORT_UP, np->state)) 442 - goto unlock_mutex; 443 405 406 + rxhash_ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH); 444 407 rxfh->hfunc = ETH_RSS_HASH_TOP; 445 408 446 409 if (rxfh->key) ··· 447 412 448 413 if (rxfh->indir) { 449 414 for (i = 0; i < rss_data->rss_lut_size; i++) 450 - rxfh->indir[i] = rss_data->rss_lut[i]; 415 + rxfh->indir[i] = rxhash_ena ? rss_data->rss_lut[i] : 0; 451 416 } 452 417 453 418 unlock_mutex: ··· 487 452 } 488 453 489 454 rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; 490 - if (!test_bit(IDPF_VPORT_UP, np->state)) 491 - goto unlock_mutex; 492 455 493 456 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && 494 457 rxfh->hfunc != ETH_RSS_HASH_TOP) { ··· 502 469 rss_data->rss_lut[lut] = rxfh->indir[lut]; 503 470 } 504 471 505 - err = idpf_config_rss(vport); 472 + if (test_bit(IDPF_VPORT_UP, np->state)) 473 + err = idpf_config_rss(vport); 506 474 507 475 unlock_mutex: 508 476 idpf_vport_ctrl_unlock(netdev);
+1 -1
drivers/net/ethernet/intel/idpf/idpf_idc.c
··· 322 322 for (i = 0; i < adapter->num_alloc_vports; i++) { 323 323 struct idpf_vport *vport = adapter->vports[i]; 324 324 325 - if (!vport) 325 + if (!vport || !vport->vdev_info) 326 326 continue; 327 327 328 328 idpf_unplug_aux_dev(vport->vdev_info->adev);
+154 -120
drivers/net/ethernet/intel/idpf/idpf_lib.c
··· 443 443 } 444 444 445 445 /** 446 + * idpf_del_all_flow_steer_filters - Delete all flow steer filters in list 447 + * @vport: main vport struct 448 + * 449 + * Takes flow_steer_list_lock spinlock. Deletes all filters 450 + */ 451 + static void idpf_del_all_flow_steer_filters(struct idpf_vport *vport) 452 + { 453 + struct idpf_vport_config *vport_config; 454 + struct idpf_fsteer_fltr *f, *ftmp; 455 + 456 + vport_config = vport->adapter->vport_config[vport->idx]; 457 + 458 + spin_lock_bh(&vport_config->flow_steer_list_lock); 459 + list_for_each_entry_safe(f, ftmp, &vport_config->user_config.flow_steer_list, 460 + list) { 461 + list_del(&f->list); 462 + kfree(f); 463 + } 464 + vport_config->user_config.num_fsteer_fltrs = 0; 465 + spin_unlock_bh(&vport_config->flow_steer_list_lock); 466 + } 467 + 468 + /** 446 469 * idpf_find_mac_filter - Search filter list for specific mac filter 447 470 * @vconfig: Vport config structure 448 471 * @macaddr: The MAC address ··· 752 729 return 0; 753 730 } 754 731 732 + static void idpf_detach_and_close(struct idpf_adapter *adapter) 733 + { 734 + int max_vports = adapter->max_vports; 735 + 736 + for (int i = 0; i < max_vports; i++) { 737 + struct net_device *netdev = adapter->netdevs[i]; 738 + 739 + /* If the interface is in detached state, that means the 740 + * previous reset was not handled successfully for this 741 + * vport. 742 + */ 743 + if (!netif_device_present(netdev)) 744 + continue; 745 + 746 + /* Hold RTNL to protect racing with callbacks */ 747 + rtnl_lock(); 748 + netif_device_detach(netdev); 749 + if (netif_running(netdev)) { 750 + set_bit(IDPF_VPORT_UP_REQUESTED, 751 + adapter->vport_config[i]->flags); 752 + dev_close(netdev); 753 + } 754 + rtnl_unlock(); 755 + } 756 + } 757 + 758 + static void idpf_attach_and_open(struct idpf_adapter *adapter) 759 + { 760 + int max_vports = adapter->max_vports; 761 + 762 + for (int i = 0; i < max_vports; i++) { 763 + struct idpf_vport *vport = adapter->vports[i]; 764 + struct idpf_vport_config *vport_config; 765 + struct net_device *netdev; 766 + 767 + /* In case of a critical error in the init task, the vport 768 + * will be freed. Only continue to restore the netdevs 769 + * if the vport is allocated. 770 + */ 771 + if (!vport) 772 + continue; 773 + 774 + /* No need for RTNL on attach as this function is called 775 + * following detach and dev_close(). We do take RTNL for 776 + * dev_open() below as it can race with external callbacks 777 + * following the call to netif_device_attach(). 778 + */ 779 + netdev = adapter->netdevs[i]; 780 + netif_device_attach(netdev); 781 + vport_config = adapter->vport_config[vport->idx]; 782 + if (test_and_clear_bit(IDPF_VPORT_UP_REQUESTED, 783 + vport_config->flags)) { 784 + rtnl_lock(); 785 + dev_open(netdev, NULL); 786 + rtnl_unlock(); 787 + } 788 + } 789 + } 790 + 755 791 /** 756 792 * idpf_cfg_netdev - Allocate, configure and register a netdev 757 793 * @vport: main vport structure ··· 1073 991 u16 idx = vport->idx; 1074 992 1075 993 vport_config = adapter->vport_config[vport->idx]; 1076 - idpf_deinit_rss(vport); 994 + idpf_deinit_rss_lut(vport); 1077 995 rss_data = &vport_config->user_config.rss_data; 1078 996 kfree(rss_data->rss_key); 1079 997 rss_data->rss_key = NULL; ··· 1105 1023 kfree(adapter->vport_config[idx]->req_qs_chunks); 1106 1024 adapter->vport_config[idx]->req_qs_chunks = NULL; 1107 1025 } 1026 + kfree(vport->rx_ptype_lkup); 1027 + vport->rx_ptype_lkup = NULL; 1108 1028 kfree(vport); 1109 1029 adapter->num_alloc_vports--; 1110 1030 } ··· 1125 1041 idpf_idc_deinit_vport_aux_device(vport->vdev_info); 1126 1042 1127 1043 idpf_deinit_mac_addr(vport); 1128 - idpf_vport_stop(vport, true); 1129 1044 1130 - if (!test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags)) 1045 + if (!test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags)) { 1046 + idpf_vport_stop(vport, true); 1131 1047 idpf_decfg_netdev(vport); 1132 - if (test_bit(IDPF_REMOVE_IN_PROG, adapter->flags)) 1048 + } 1049 + if (test_bit(IDPF_REMOVE_IN_PROG, adapter->flags)) { 1133 1050 idpf_del_all_mac_filters(vport); 1051 + idpf_del_all_flow_steer_filters(vport); 1052 + } 1134 1053 1135 1054 if (adapter->netdevs[i]) { 1136 1055 struct idpf_netdev_priv *np = netdev_priv(adapter->netdevs[i]); ··· 1226 1139 u16 idx = adapter->next_vport; 1227 1140 struct idpf_vport *vport; 1228 1141 u16 num_max_q; 1142 + int err; 1229 1143 1230 1144 if (idx == IDPF_NO_FREE_SLOT) 1231 1145 return NULL; ··· 1277 1189 1278 1190 idpf_vport_init(vport, max_q); 1279 1191 1280 - /* This alloc is done separate from the LUT because it's not strictly 1281 - * dependent on how many queues we have. If we change number of queues 1282 - * and soft reset we'll need a new LUT but the key can remain the same 1283 - * for as long as the vport exists. 1192 + /* LUT and key are both initialized here. Key is not strictly dependent 1193 + * on how many queues we have. If we change number of queues and soft 1194 + * reset is initiated, LUT will be freed and a new LUT will be allocated 1195 + * as per the updated number of queues during vport bringup. However, 1196 + * the key remains the same for as long as the vport exists. 1284 1197 */ 1285 1198 rss_data = &adapter->vport_config[idx]->user_config.rss_data; 1286 1199 rss_data->rss_key = kzalloc(rss_data->rss_key_size, GFP_KERNEL); ··· 1290 1201 1291 1202 /* Initialize default rss key */ 1292 1203 netdev_rss_key_fill((void *)rss_data->rss_key, rss_data->rss_key_size); 1204 + 1205 + /* Initialize default rss LUT */ 1206 + err = idpf_init_rss_lut(vport); 1207 + if (err) 1208 + goto free_rss_key; 1293 1209 1294 1210 /* fill vport slot in the adapter struct */ 1295 1211 adapter->vports[idx] = vport; ··· 1306 1212 1307 1213 return vport; 1308 1214 1215 + free_rss_key: 1216 + kfree(rss_data->rss_key); 1309 1217 free_vector_idxs: 1310 1218 kfree(vport->q_vector_idxs); 1311 1219 free_vport: ··· 1484 1388 { 1485 1389 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); 1486 1390 struct idpf_adapter *adapter = vport->adapter; 1487 - struct idpf_vport_config *vport_config; 1488 1391 int err; 1489 1392 1490 1393 if (test_bit(IDPF_VPORT_UP, np->state)) ··· 1524 1429 if (err) { 1525 1430 dev_err(&adapter->pdev->dev, "Failed to initialize queue registers for vport %u: %d\n", 1526 1431 vport->vport_id, err); 1527 - goto queues_rel; 1432 + goto intr_deinit; 1528 1433 } 1529 1434 1530 1435 err = idpf_rx_bufs_init_all(vport); 1531 1436 if (err) { 1532 1437 dev_err(&adapter->pdev->dev, "Failed to initialize RX buffers for vport %u: %d\n", 1533 1438 vport->vport_id, err); 1534 - goto queues_rel; 1439 + goto intr_deinit; 1535 1440 } 1536 1441 1537 1442 idpf_rx_init_buf_tail(vport); ··· 1577 1482 1578 1483 idpf_restore_features(vport); 1579 1484 1580 - vport_config = adapter->vport_config[vport->idx]; 1581 - if (vport_config->user_config.rss_data.rss_lut) 1582 - err = idpf_config_rss(vport); 1583 - else 1584 - err = idpf_init_rss(vport); 1485 + err = idpf_config_rss(vport); 1585 1486 if (err) { 1586 - dev_err(&adapter->pdev->dev, "Failed to initialize RSS for vport %u: %d\n", 1487 + dev_err(&adapter->pdev->dev, "Failed to configure RSS for vport %u: %d\n", 1587 1488 vport->vport_id, err); 1588 1489 goto disable_vport; 1589 1490 } ··· 1588 1497 if (err) { 1589 1498 dev_err(&adapter->pdev->dev, "Failed to complete interface up for vport %u: %d\n", 1590 1499 vport->vport_id, err); 1591 - goto deinit_rss; 1500 + goto disable_vport; 1592 1501 } 1593 1502 1594 1503 if (rtnl) ··· 1596 1505 1597 1506 return 0; 1598 1507 1599 - deinit_rss: 1600 - idpf_deinit_rss(vport); 1601 1508 disable_vport: 1602 1509 idpf_send_disable_vport_msg(vport); 1603 1510 disable_queues: ··· 1633 1544 struct idpf_vport_config *vport_config; 1634 1545 struct idpf_vport_max_q max_q; 1635 1546 struct idpf_adapter *adapter; 1636 - struct idpf_netdev_priv *np; 1637 1547 struct idpf_vport *vport; 1638 1548 u16 num_default_vports; 1639 1549 struct pci_dev *pdev; ··· 1667 1579 goto unwind_vports; 1668 1580 } 1669 1581 1582 + err = idpf_send_get_rx_ptype_msg(vport); 1583 + if (err) 1584 + goto unwind_vports; 1585 + 1670 1586 index = vport->idx; 1671 1587 vport_config = adapter->vport_config[index]; 1672 1588 1673 1589 spin_lock_init(&vport_config->mac_filter_list_lock); 1590 + spin_lock_init(&vport_config->flow_steer_list_lock); 1674 1591 1675 1592 INIT_LIST_HEAD(&vport_config->user_config.mac_filter_list); 1676 1593 INIT_LIST_HEAD(&vport_config->user_config.flow_steer_list); ··· 1683 1590 err = idpf_check_supported_desc_ids(vport); 1684 1591 if (err) { 1685 1592 dev_err(&pdev->dev, "failed to get required descriptor ids\n"); 1686 - goto cfg_netdev_err; 1593 + goto unwind_vports; 1687 1594 } 1688 1595 1689 1596 if (idpf_cfg_netdev(vport)) 1690 - goto cfg_netdev_err; 1691 - 1692 - err = idpf_send_get_rx_ptype_msg(vport); 1693 - if (err) 1694 - goto handle_err; 1695 - 1696 - /* Once state is put into DOWN, driver is ready for dev_open */ 1697 - np = netdev_priv(vport->netdev); 1698 - clear_bit(IDPF_VPORT_UP, np->state); 1699 - if (test_and_clear_bit(IDPF_VPORT_UP_REQUESTED, vport_config->flags)) 1700 - idpf_vport_open(vport, true); 1597 + goto unwind_vports; 1701 1598 1702 1599 /* Spawn and return 'idpf_init_task' work queue until all the 1703 1600 * default vports are created ··· 1718 1635 set_bit(IDPF_VPORT_REG_NETDEV, vport_config->flags); 1719 1636 } 1720 1637 1721 - /* As all the required vports are created, clear the reset flag 1722 - * unconditionally here in case we were in reset and the link was down. 1723 - */ 1638 + /* Clear the reset and load bits as all vports are created */ 1724 1639 clear_bit(IDPF_HR_RESET_IN_PROG, adapter->flags); 1640 + clear_bit(IDPF_HR_DRV_LOAD, adapter->flags); 1725 1641 /* Start the statistics task now */ 1726 1642 queue_delayed_work(adapter->stats_wq, &adapter->stats_task, 1727 1643 msecs_to_jiffies(10 * (pdev->devfn & 0x07))); 1728 1644 1729 1645 return; 1730 1646 1731 - handle_err: 1732 - idpf_decfg_netdev(vport); 1733 - cfg_netdev_err: 1734 - idpf_vport_rel(vport); 1735 - adapter->vports[index] = NULL; 1736 1647 unwind_vports: 1737 1648 if (default_vport) { 1738 1649 for (index = 0; index < adapter->max_vports; index++) { ··· 1734 1657 idpf_vport_dealloc(adapter->vports[index]); 1735 1658 } 1736 1659 } 1660 + /* Cleanup after vc_core_init, which has no way of knowing the 1661 + * init task failed on driver load. 1662 + */ 1663 + if (test_and_clear_bit(IDPF_HR_DRV_LOAD, adapter->flags)) { 1664 + cancel_delayed_work_sync(&adapter->serv_task); 1665 + cancel_delayed_work_sync(&adapter->mbx_task); 1666 + } 1667 + idpf_ptp_release(adapter); 1668 + 1737 1669 clear_bit(IDPF_HR_RESET_IN_PROG, adapter->flags); 1738 1670 } 1739 1671 ··· 1873 1787 } 1874 1788 1875 1789 /** 1876 - * idpf_set_vport_state - Set the vport state to be after the reset 1877 - * @adapter: Driver specific private structure 1878 - */ 1879 - static void idpf_set_vport_state(struct idpf_adapter *adapter) 1880 - { 1881 - u16 i; 1882 - 1883 - for (i = 0; i < adapter->max_vports; i++) { 1884 - struct idpf_netdev_priv *np; 1885 - 1886 - if (!adapter->netdevs[i]) 1887 - continue; 1888 - 1889 - np = netdev_priv(adapter->netdevs[i]); 1890 - if (test_bit(IDPF_VPORT_UP, np->state)) 1891 - set_bit(IDPF_VPORT_UP_REQUESTED, 1892 - adapter->vport_config[i]->flags); 1893 - } 1894 - } 1895 - 1896 - /** 1897 1790 * idpf_init_hard_reset - Initiate a hardware reset 1898 1791 * @adapter: Driver specific private structure 1899 1792 * ··· 1880 1815 * reallocate. Also reinitialize the mailbox. Return 0 on success, 1881 1816 * negative on failure. 1882 1817 */ 1883 - static int idpf_init_hard_reset(struct idpf_adapter *adapter) 1818 + static void idpf_init_hard_reset(struct idpf_adapter *adapter) 1884 1819 { 1885 1820 struct idpf_reg_ops *reg_ops = &adapter->dev_ops.reg_ops; 1886 1821 struct device *dev = &adapter->pdev->dev; 1887 - struct net_device *netdev; 1888 1822 int err; 1889 - u16 i; 1890 1823 1824 + idpf_detach_and_close(adapter); 1891 1825 mutex_lock(&adapter->vport_ctrl_lock); 1892 1826 1893 1827 dev_info(dev, "Device HW Reset initiated\n"); 1894 1828 1895 - /* Avoid TX hangs on reset */ 1896 - for (i = 0; i < adapter->max_vports; i++) { 1897 - netdev = adapter->netdevs[i]; 1898 - if (!netdev) 1899 - continue; 1900 - 1901 - netif_carrier_off(netdev); 1902 - netif_tx_disable(netdev); 1903 - } 1904 - 1905 1829 /* Prepare for reset */ 1906 - if (test_and_clear_bit(IDPF_HR_DRV_LOAD, adapter->flags)) { 1830 + if (test_bit(IDPF_HR_DRV_LOAD, adapter->flags)) { 1907 1831 reg_ops->trigger_reset(adapter, IDPF_HR_DRV_LOAD); 1908 1832 } else if (test_and_clear_bit(IDPF_HR_FUNC_RESET, adapter->flags)) { 1909 1833 bool is_reset = idpf_is_reset_detected(adapter); 1910 1834 1911 1835 idpf_idc_issue_reset_event(adapter->cdev_info); 1912 1836 1913 - idpf_set_vport_state(adapter); 1914 1837 idpf_vc_core_deinit(adapter); 1915 1838 if (!is_reset) 1916 1839 reg_ops->trigger_reset(adapter, IDPF_HR_FUNC_RESET); ··· 1945 1892 unlock_mutex: 1946 1893 mutex_unlock(&adapter->vport_ctrl_lock); 1947 1894 1948 - /* Wait until all vports are created to init RDMA CORE AUX */ 1949 - if (!err) 1950 - err = idpf_idc_init(adapter); 1951 - 1952 - return err; 1895 + /* Attempt to restore netdevs and initialize RDMA CORE AUX device, 1896 + * provided vc_core_init succeeded. It is still possible that 1897 + * vports are not allocated at this point if the init task failed. 1898 + */ 1899 + if (!err) { 1900 + idpf_attach_and_open(adapter); 1901 + idpf_idc_init(adapter); 1902 + } 1953 1903 } 1954 1904 1955 1905 /** ··· 2053 1997 idpf_vport_stop(vport, false); 2054 1998 } 2055 1999 2056 - idpf_deinit_rss(vport); 2057 2000 /* We're passing in vport here because we need its wait_queue 2058 2001 * to send a message and it should be getting all the vport 2059 2002 * config data out of the adapter but we need to be careful not ··· 2077 2022 err = idpf_set_real_num_queues(vport); 2078 2023 if (err) 2079 2024 goto err_open; 2025 + 2026 + if (reset_cause == IDPF_SR_Q_CHANGE && 2027 + !netif_is_rxfh_configured(vport->netdev)) 2028 + idpf_fill_dflt_rss_lut(vport); 2080 2029 2081 2030 if (vport_is_up) 2082 2031 err = idpf_vport_open(vport, false); ··· 2225 2166 } 2226 2167 2227 2168 /** 2228 - * idpf_vport_manage_rss_lut - disable/enable RSS 2229 - * @vport: the vport being changed 2230 - * 2231 - * In the event of disable request for RSS, this function will zero out RSS 2232 - * LUT, while in the event of enable request for RSS, it will reconfigure RSS 2233 - * LUT with the default LUT configuration. 2234 - */ 2235 - static int idpf_vport_manage_rss_lut(struct idpf_vport *vport) 2236 - { 2237 - bool ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH); 2238 - struct idpf_rss_data *rss_data; 2239 - u16 idx = vport->idx; 2240 - int lut_size; 2241 - 2242 - rss_data = &vport->adapter->vport_config[idx]->user_config.rss_data; 2243 - lut_size = rss_data->rss_lut_size * sizeof(u32); 2244 - 2245 - if (ena) { 2246 - /* This will contain the default or user configured LUT */ 2247 - memcpy(rss_data->rss_lut, rss_data->cached_lut, lut_size); 2248 - } else { 2249 - /* Save a copy of the current LUT to be restored later if 2250 - * requested. 2251 - */ 2252 - memcpy(rss_data->cached_lut, rss_data->rss_lut, lut_size); 2253 - 2254 - /* Zero out the current LUT to disable */ 2255 - memset(rss_data->rss_lut, 0, lut_size); 2256 - } 2257 - 2258 - return idpf_config_rss(vport); 2259 - } 2260 - 2261 - /** 2262 2169 * idpf_set_features - set the netdev feature flags 2263 2170 * @netdev: ptr to the netdev being adjusted 2264 2171 * @features: the feature set that the stack is suggesting ··· 2249 2224 } 2250 2225 2251 2226 if (changed & NETIF_F_RXHASH) { 2227 + struct idpf_netdev_priv *np = netdev_priv(netdev); 2228 + 2252 2229 netdev->features ^= NETIF_F_RXHASH; 2253 - err = idpf_vport_manage_rss_lut(vport); 2254 - if (err) 2255 - goto unlock_mutex; 2230 + 2231 + /* If the interface is not up when changing the rxhash, update 2232 + * to the HW is skipped. The updated LUT will be committed to 2233 + * the HW when the interface is brought up. 2234 + */ 2235 + if (test_bit(IDPF_VPORT_UP, np->state)) { 2236 + err = idpf_config_rss(vport); 2237 + if (err) 2238 + goto unlock_mutex; 2239 + } 2256 2240 } 2257 2241 2258 2242 if (changed & NETIF_F_GRO_HW) {
+19 -27
drivers/net/ethernet/intel/idpf/idpf_txrx.c
··· 695 695 static int idpf_rx_bufs_init_singleq(struct idpf_rx_queue *rxq) 696 696 { 697 697 struct libeth_fq fq = { 698 - .count = rxq->desc_count, 699 - .type = LIBETH_FQE_MTU, 700 - .nid = idpf_q_vector_to_mem(rxq->q_vector), 698 + .count = rxq->desc_count, 699 + .type = LIBETH_FQE_MTU, 700 + .buf_len = IDPF_RX_MAX_BUF_SZ, 701 + .nid = idpf_q_vector_to_mem(rxq->q_vector), 701 702 }; 702 703 int ret; 703 704 ··· 755 754 .truesize = bufq->truesize, 756 755 .count = bufq->desc_count, 757 756 .type = type, 757 + .buf_len = IDPF_RX_MAX_BUF_SZ, 758 758 .hsplit = idpf_queue_has(HSPLIT_EN, bufq), 759 759 .xdp = idpf_xdp_enabled(bufq->q_vector->vport), 760 760 .nid = idpf_q_vector_to_mem(bufq->q_vector), ··· 4643 4641 * idpf_fill_dflt_rss_lut - Fill the indirection table with the default values 4644 4642 * @vport: virtual port structure 4645 4643 */ 4646 - static void idpf_fill_dflt_rss_lut(struct idpf_vport *vport) 4644 + void idpf_fill_dflt_rss_lut(struct idpf_vport *vport) 4647 4645 { 4648 4646 struct idpf_adapter *adapter = vport->adapter; 4649 4647 u16 num_active_rxq = vport->num_rxq; ··· 4652 4650 4653 4651 rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; 4654 4652 4655 - for (i = 0; i < rss_data->rss_lut_size; i++) { 4653 + for (i = 0; i < rss_data->rss_lut_size; i++) 4656 4654 rss_data->rss_lut[i] = i % num_active_rxq; 4657 - rss_data->cached_lut[i] = rss_data->rss_lut[i]; 4658 - } 4659 4655 } 4660 4656 4661 4657 /** 4662 - * idpf_init_rss - Allocate and initialize RSS resources 4658 + * idpf_init_rss_lut - Allocate and initialize RSS LUT 4663 4659 * @vport: virtual port 4664 4660 * 4665 - * Return 0 on success, negative on failure 4661 + * Return: 0 on success, negative on failure 4666 4662 */ 4667 - int idpf_init_rss(struct idpf_vport *vport) 4663 + int idpf_init_rss_lut(struct idpf_vport *vport) 4668 4664 { 4669 4665 struct idpf_adapter *adapter = vport->adapter; 4670 4666 struct idpf_rss_data *rss_data; 4671 - u32 lut_size; 4672 4667 4673 4668 rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; 4669 + if (!rss_data->rss_lut) { 4670 + u32 lut_size; 4674 4671 4675 - lut_size = rss_data->rss_lut_size * sizeof(u32); 4676 - rss_data->rss_lut = kzalloc(lut_size, GFP_KERNEL); 4677 - if (!rss_data->rss_lut) 4678 - return -ENOMEM; 4679 - 4680 - rss_data->cached_lut = kzalloc(lut_size, GFP_KERNEL); 4681 - if (!rss_data->cached_lut) { 4682 - kfree(rss_data->rss_lut); 4683 - rss_data->rss_lut = NULL; 4684 - 4685 - return -ENOMEM; 4672 + lut_size = rss_data->rss_lut_size * sizeof(u32); 4673 + rss_data->rss_lut = kzalloc(lut_size, GFP_KERNEL); 4674 + if (!rss_data->rss_lut) 4675 + return -ENOMEM; 4686 4676 } 4687 4677 4688 4678 /* Fill the default RSS lut values */ 4689 4679 idpf_fill_dflt_rss_lut(vport); 4690 4680 4691 - return idpf_config_rss(vport); 4681 + return 0; 4692 4682 } 4693 4683 4694 4684 /** 4695 - * idpf_deinit_rss - Release RSS resources 4685 + * idpf_deinit_rss_lut - Release RSS LUT 4696 4686 * @vport: virtual port 4697 4687 */ 4698 - void idpf_deinit_rss(struct idpf_vport *vport) 4688 + void idpf_deinit_rss_lut(struct idpf_vport *vport) 4699 4689 { 4700 4690 struct idpf_adapter *adapter = vport->adapter; 4701 4691 struct idpf_rss_data *rss_data; 4702 4692 4703 4693 rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; 4704 - kfree(rss_data->cached_lut); 4705 - rss_data->cached_lut = NULL; 4706 4694 kfree(rss_data->rss_lut); 4707 4695 rss_data->rss_lut = NULL; 4708 4696 }
+4 -2
drivers/net/ethernet/intel/idpf/idpf_txrx.h
··· 101 101 idx = 0; \ 102 102 } while (0) 103 103 104 + #define IDPF_RX_MAX_BUF_SZ (16384 - 128) 104 105 #define IDPF_RX_BUF_STRIDE 32 105 106 #define IDPF_RX_BUF_POST_STRIDE 16 106 107 #define IDPF_LOW_WATERMARK 64 ··· 1086 1085 void idpf_vport_intr_deinit(struct idpf_vport *vport); 1087 1086 int idpf_vport_intr_init(struct idpf_vport *vport); 1088 1087 void idpf_vport_intr_ena(struct idpf_vport *vport); 1088 + void idpf_fill_dflt_rss_lut(struct idpf_vport *vport); 1089 1089 int idpf_config_rss(struct idpf_vport *vport); 1090 - int idpf_init_rss(struct idpf_vport *vport); 1091 - void idpf_deinit_rss(struct idpf_vport *vport); 1090 + int idpf_init_rss_lut(struct idpf_vport *vport); 1091 + void idpf_deinit_rss_lut(struct idpf_vport *vport); 1092 1092 int idpf_rx_bufs_init_all(struct idpf_vport *vport); 1093 1093 1094 1094 struct idpf_q_vector *idpf_find_rxq_vec(const struct idpf_vport *vport,
+12 -1
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
··· 2804 2804 * @vport: virtual port data structure 2805 2805 * @get: flag to set or get rss look up table 2806 2806 * 2807 + * When rxhash is disabled, RSS LUT will be configured with zeros. If rxhash 2808 + * is enabled, the LUT values stored in driver's soft copy will be used to setup 2809 + * the HW. 2810 + * 2807 2811 * Returns 0 on success, negative on failure. 2808 2812 */ 2809 2813 int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get) ··· 2818 2814 struct idpf_rss_data *rss_data; 2819 2815 int buf_size, lut_buf_size; 2820 2816 ssize_t reply_sz; 2817 + bool rxhash_ena; 2821 2818 int i; 2822 2819 2823 2820 rss_data = 2824 2821 &vport->adapter->vport_config[vport->idx]->user_config.rss_data; 2822 + rxhash_ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH); 2825 2823 buf_size = struct_size(rl, lut, rss_data->rss_lut_size); 2826 2824 rl = kzalloc(buf_size, GFP_KERNEL); 2827 2825 if (!rl) ··· 2845 2839 } else { 2846 2840 rl->lut_entries = cpu_to_le16(rss_data->rss_lut_size); 2847 2841 for (i = 0; i < rss_data->rss_lut_size; i++) 2848 - rl->lut[i] = cpu_to_le32(rss_data->rss_lut[i]); 2842 + rl->lut[i] = rxhash_ena ? 2843 + cpu_to_le32(rss_data->rss_lut[i]) : 0; 2849 2844 2850 2845 xn_params.vc_op = VIRTCHNL2_OP_SET_RSS_LUT; 2851 2846 } ··· 3577 3570 */ 3578 3571 void idpf_vc_core_deinit(struct idpf_adapter *adapter) 3579 3572 { 3573 + struct idpf_hw *hw = &adapter->hw; 3580 3574 bool remove_in_prog; 3581 3575 3582 3576 if (!test_bit(IDPF_VC_CORE_INIT, adapter->flags)) ··· 3600 3592 cancel_delayed_work_sync(&adapter->mbx_task); 3601 3593 3602 3594 idpf_vport_params_buf_rel(adapter); 3595 + 3596 + kfree(hw->lan_regs); 3597 + hw->lan_regs = NULL; 3603 3598 3604 3599 kfree(adapter->vports); 3605 3600 adapter->vports = NULL;
+2
drivers/net/ethernet/marvell/prestera/prestera_devlink.c
··· 387 387 388 388 dl = devlink_alloc(&prestera_dl_ops, sizeof(struct prestera_switch), 389 389 dev->dev); 390 + if (!dl) 391 + return NULL; 390 392 391 393 return devlink_priv(dl); 392 394 }
+11 -3
drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c
··· 44 44 struct mlx5_flow_table *ft; 45 45 struct mlx5_flow_group *miss_group; 46 46 struct mlx5_flow_handle *miss_rule; 47 + struct mlx5_modify_hdr *rx_modify_hdr; 47 48 struct mlx5_flow_destination default_dest; 48 49 struct mlx5e_psp_rx_err rx_err; 49 50 u32 refcnt; ··· 287 286 return err; 288 287 } 289 288 290 - static void accel_psp_fs_rx_fs_destroy(struct mlx5e_accel_fs_psp_prot *fs_prot) 289 + static void accel_psp_fs_rx_fs_destroy(struct mlx5e_psp_fs *fs, 290 + struct mlx5e_accel_fs_psp_prot *fs_prot) 291 291 { 292 292 if (fs_prot->def_rule) { 293 293 mlx5_del_flow_rules(fs_prot->def_rule); 294 294 fs_prot->def_rule = NULL; 295 + } 296 + 297 + if (fs_prot->rx_modify_hdr) { 298 + mlx5_modify_header_dealloc(fs->mdev, fs_prot->rx_modify_hdr); 299 + fs_prot->rx_modify_hdr = NULL; 295 300 } 296 301 297 302 if (fs_prot->miss_rule) { ··· 403 396 modify_hdr = NULL; 404 397 goto out_err; 405 398 } 399 + fs_prot->rx_modify_hdr = modify_hdr; 406 400 407 401 flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | 408 402 MLX5_FLOW_CONTEXT_ACTION_CRYPTO_DECRYPT | ··· 424 416 goto out; 425 417 426 418 out_err: 427 - accel_psp_fs_rx_fs_destroy(fs_prot); 419 + accel_psp_fs_rx_fs_destroy(fs, fs_prot); 428 420 out: 429 421 kvfree(flow_group_in); 430 422 kvfree(spec); ··· 441 433 /* The netdev unreg already happened, so all offloaded rule are already removed */ 442 434 fs_prot = &accel_psp->fs_prot[type]; 443 435 444 - accel_psp_fs_rx_fs_destroy(fs_prot); 436 + accel_psp_fs_rx_fs_destroy(fs, fs_prot); 445 437 446 438 accel_psp_fs_rx_err_destroy_ft(fs, &fs_prot->rx_err); 447 439
+5 -4
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 1608 1608 { 1609 1609 int mode = fec_active_mode(priv->mdev); 1610 1610 1611 - if (mode == MLX5E_FEC_NOFEC || 1612 - !MLX5_CAP_PCAM_FEATURE(priv->mdev, ppcnt_statistical_group)) 1611 + if (mode == MLX5E_FEC_NOFEC) 1613 1612 return; 1614 1613 1615 - fec_set_corrected_bits_total(priv, fec_stats); 1616 - fec_set_block_stats(priv, mode, fec_stats); 1614 + if (MLX5_CAP_PCAM_FEATURE(priv->mdev, ppcnt_statistical_group)) { 1615 + fec_set_corrected_bits_total(priv, fec_stats); 1616 + fec_set_block_stats(priv, mode, fec_stats); 1617 + } 1617 1618 1618 1619 if (MLX5_CAP_PCAM_REG(priv->mdev, pphcr)) 1619 1620 fec_set_histograms_stats(priv, mode, hist);
+7 -2
drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c
··· 173 173 } 174 174 175 175 /* Handle multipath entry with lower priority value */ 176 - if (mp->fib.mfi && mp->fib.mfi != fi && 176 + if (mp->fib.mfi && 177 177 (mp->fib.dst != fen_info->dst || mp->fib.dst_len != fen_info->dst_len) && 178 - fi->fib_priority >= mp->fib.priority) 178 + mp->fib.dst_len <= fen_info->dst_len && 179 + !(mp->fib.dst_len == fen_info->dst_len && 180 + fi->fib_priority < mp->fib.priority)) { 181 + mlx5_core_dbg(ldev->pf[idx].dev, 182 + "Multipath entry with lower priority was rejected\n"); 179 183 return; 184 + } 180 185 181 186 nh_dev0 = mlx5_lag_get_next_fib_dev(ldev, fi, NULL); 182 187 nh_dev1 = mlx5_lag_get_next_fib_dev(ldev, fi, nh_dev0);
+6 -3
drivers/net/ethernet/mellanox/mlx5/core/port.c
··· 393 393 if (err) 394 394 return err; 395 395 396 - *status = MLX5_GET(mcia_reg, out, status); 397 - if (*status) 396 + if (MLX5_GET(mcia_reg, out, status)) { 397 + if (status) 398 + *status = MLX5_GET(mcia_reg, out, status); 398 399 return -EIO; 400 + } 399 401 400 402 ptr = MLX5_ADDR_OF(mcia_reg, out, dword_0); 401 403 memcpy(data, ptr, size); ··· 431 429 mlx5_qsfp_eeprom_params_set(&query.i2c_address, &query.page, &offset); 432 430 break; 433 431 default: 434 - mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id); 432 + mlx5_core_dbg(dev, "Module ID not recognized: 0x%x\n", 433 + module_id); 435 434 return -EINVAL; 436 435 } 437 436
+4 -2
drivers/net/ethernet/mscc/ocelot.c
··· 2307 2307 2308 2308 /* Now, set PGIDs for each active LAG */ 2309 2309 for (lag = 0; lag < ocelot->num_phys_ports; lag++) { 2310 - struct net_device *bond = ocelot->ports[lag]->bond; 2310 + struct ocelot_port *ocelot_port = ocelot->ports[lag]; 2311 2311 int num_active_ports = 0; 2312 + struct net_device *bond; 2312 2313 unsigned long bond_mask; 2313 2314 u8 aggr_idx[16]; 2314 2315 2315 - if (!bond || (visited & BIT(lag))) 2316 + if (!ocelot_port || !ocelot_port->bond || (visited & BIT(lag))) 2316 2317 continue; 2317 2318 2319 + bond = ocelot_port->bond; 2318 2320 bond_mask = ocelot_get_bond_mask(ocelot, bond); 2319 2321 2320 2322 for_each_set_bit(port, &bond_mask, ocelot->num_phys_ports) {
+8
drivers/net/netdevsim/bus.c
··· 332 332 rcu_assign_pointer(nsim_a->peer, nsim_b); 333 333 rcu_assign_pointer(nsim_b->peer, nsim_a); 334 334 335 + if (netif_running(dev_a) && netif_running(dev_b)) { 336 + netif_carrier_on(dev_a); 337 + netif_carrier_on(dev_b); 338 + } 339 + 335 340 out_err: 336 341 put_net(ns_b); 337 342 put_net(ns_a); ··· 385 380 peer = rtnl_dereference(nsim->peer); 386 381 if (!peer) 387 382 goto out_put_netns; 383 + 384 + netif_carrier_off(dev); 385 + netif_carrier_off(peer->netdev); 388 386 389 387 err = 0; 390 388 RCU_INIT_POINTER(nsim->peer, NULL);
+3
drivers/net/phy/mxl-86110.c
··· 938 938 PHY_ID_MATCH_EXACT(PHY_ID_MXL86110), 939 939 .name = "MXL86110 Gigabit Ethernet", 940 940 .config_init = mxl86110_config_init, 941 + .suspend = genphy_suspend, 942 + .resume = genphy_resume, 943 + .soft_reset = genphy_soft_reset, 941 944 .get_wol = mxl86110_get_wol, 942 945 .set_wol = mxl86110_set_wol, 943 946 .led_brightness_set = mxl86110_led_brightness_set,
+1 -1
drivers/net/phy/sfp.c
··· 765 765 dev_addr++; 766 766 } 767 767 768 - return 0; 768 + return data - (u8 *)buf; 769 769 } 770 770 771 771 static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
+2
drivers/net/usb/pegasus.c
··· 168 168 netif_device_detach(pegasus->net); 169 169 netif_err(pegasus, drv, pegasus->net, 170 170 "%s returned %d\n", __func__, ret); 171 + usb_free_urb(async_urb); 172 + kfree(req); 171 173 } 172 174 return ret; 173 175 }
+3 -3
drivers/net/virtio_net.c
··· 3791 3791 if (vi->has_rss && !netif_is_rxfh_configured(dev)) { 3792 3792 old_rss_hdr = vi->rss_hdr; 3793 3793 old_rss_trailer = vi->rss_trailer; 3794 - vi->rss_hdr = devm_kzalloc(&dev->dev, virtnet_rss_hdr_size(vi), GFP_KERNEL); 3794 + vi->rss_hdr = devm_kzalloc(&vi->vdev->dev, virtnet_rss_hdr_size(vi), GFP_KERNEL); 3795 3795 if (!vi->rss_hdr) { 3796 3796 vi->rss_hdr = old_rss_hdr; 3797 3797 return -ENOMEM; ··· 3802 3802 3803 3803 if (!virtnet_commit_rss_command(vi)) { 3804 3804 /* restore ctrl_rss if commit_rss_command failed */ 3805 - devm_kfree(&dev->dev, vi->rss_hdr); 3805 + devm_kfree(&vi->vdev->dev, vi->rss_hdr); 3806 3806 vi->rss_hdr = old_rss_hdr; 3807 3807 vi->rss_trailer = old_rss_trailer; 3808 3808 ··· 3810 3810 queue_pairs); 3811 3811 return -EINVAL; 3812 3812 } 3813 - devm_kfree(&dev->dev, old_rss_hdr); 3813 + devm_kfree(&vi->vdev->dev, old_rss_hdr); 3814 3814 goto succ; 3815 3815 } 3816 3816
+3 -3
drivers/net/wireless/virtual/mac80211_hwsim.c
··· 4040 4040 ieee80211_vif_to_wdev(data->nan_device_vif); 4041 4041 4042 4042 if (data->nan_curr_dw_band == NL80211_BAND_5GHZ) 4043 - ch = ieee80211_get_channel(hw->wiphy, 5475); 4043 + ch = ieee80211_get_channel(hw->wiphy, 5745); 4044 4044 else 4045 4045 ch = ieee80211_get_channel(hw->wiphy, 2437); 4046 4046 ··· 4112 4112 hrtimer_cancel(&data->nan_timer); 4113 4113 data->nan_device_vif = NULL; 4114 4114 4115 - spin_lock(&hwsim_radio_lock); 4115 + spin_lock_bh(&hwsim_radio_lock); 4116 4116 list_for_each_entry(data2, &hwsim_radios, list) { 4117 4117 if (data2->nan_device_vif) { 4118 4118 nan_cluster_running = true; 4119 4119 break; 4120 4120 } 4121 4121 } 4122 - spin_unlock(&hwsim_radio_lock); 4122 + spin_unlock_bh(&hwsim_radio_lock); 4123 4123 4124 4124 if (!nan_cluster_running) 4125 4125 memset(hwsim_nan_cluster_id, 0, ETH_ALEN);
+6
drivers/net/wwan/iosm/iosm_ipc_mux.c
··· 456 456 struct sk_buff_head *free_list; 457 457 union mux_msg mux_msg; 458 458 struct sk_buff *skb; 459 + int i; 459 460 460 461 if (!ipc_mux->initialized) 461 462 return; ··· 478 477 if (ipc_mux->channel) { 479 478 ipc_mux->channel->ul_pipe.is_open = false; 480 479 ipc_mux->channel->dl_pipe.is_open = false; 480 + } 481 + 482 + if (ipc_mux->protocol != MUX_LITE) { 483 + for (i = 0; i < IPC_MEM_MUX_IP_SESSION_ENTRIES; i++) 484 + kfree(ipc_mux->ul_adb.pp_qlt[i]); 481 485 } 482 486 483 487 kfree(ipc_mux);
+2 -1
include/linux/netdevice.h
··· 5323 5323 static inline netdev_features_t netdev_add_tso_features(netdev_features_t features, 5324 5324 netdev_features_t mask) 5325 5325 { 5326 - return netdev_increment_features(features, NETIF_F_ALL_TSO, mask); 5326 + return netdev_increment_features(features, NETIF_F_ALL_TSO | 5327 + NETIF_F_ALL_FOR_ALL, mask); 5327 5328 } 5328 5329 5329 5330 int __netdev_update_features(struct net_device *dev);
+4 -4
include/linux/soc/airoha/airoha_offload.h
··· 71 71 #define NPU_RX1_DESC_NUM 512 72 72 73 73 /* CTRL */ 74 - #define NPU_RX_DMA_DESC_LAST_MASK BIT(29) 75 - #define NPU_RX_DMA_DESC_LEN_MASK GENMASK(28, 15) 76 - #define NPU_RX_DMA_DESC_CUR_LEN_MASK GENMASK(14, 1) 74 + #define NPU_RX_DMA_DESC_LAST_MASK BIT(27) 75 + #define NPU_RX_DMA_DESC_LEN_MASK GENMASK(26, 14) 76 + #define NPU_RX_DMA_DESC_CUR_LEN_MASK GENMASK(13, 1) 77 77 #define NPU_RX_DMA_DESC_DONE_MASK BIT(0) 78 78 /* INFO */ 79 - #define NPU_RX_DMA_PKT_COUNT_MASK GENMASK(31, 28) 79 + #define NPU_RX_DMA_PKT_COUNT_MASK GENMASK(31, 29) 80 80 #define NPU_RX_DMA_PKT_ID_MASK GENMASK(28, 26) 81 81 #define NPU_RX_DMA_SRC_PORT_MASK GENMASK(25, 21) 82 82 #define NPU_RX_DMA_CRSN_MASK GENMASK(20, 16)
+7 -4
net/bridge/br_vlan_tunnel.c
··· 189 189 IP_TUNNEL_DECLARE_FLAGS(flags) = { }; 190 190 struct metadata_dst *tunnel_dst; 191 191 __be64 tunnel_id; 192 - int err; 193 192 194 193 if (!vlan) 195 194 return 0; ··· 198 199 return 0; 199 200 200 201 skb_dst_drop(skb); 201 - err = skb_vlan_pop(skb); 202 - if (err) 203 - return err; 202 + /* For 802.1ad (QinQ), skb_vlan_pop() incorrectly moves the C-VLAN 203 + * from payload to hwaccel after clearing S-VLAN. We only need to 204 + * clear the hwaccel S-VLAN; the C-VLAN must stay in payload for 205 + * correct VXLAN encapsulation. This is also correct for 802.1Q 206 + * where no C-VLAN exists in payload. 207 + */ 208 + __vlan_hwaccel_clear_tag(skb); 204 209 205 210 if (BR_INPUT_SKB_CB(skb)->backup_nhid) { 206 211 __set_bit(IP_TUNNEL_KEY_BIT, flags);
+1 -1
net/bridge/netfilter/ebtables.c
··· 1299 1299 list_for_each_entry(tmpl, &template_tables, list) { 1300 1300 if (WARN_ON_ONCE(strcmp(t->name, tmpl->name) == 0)) { 1301 1301 mutex_unlock(&ebt_mutex); 1302 - return -EEXIST; 1302 + return -EBUSY; 1303 1303 } 1304 1304 } 1305 1305
+5 -3
net/core/skbuff.c
··· 4636 4636 { 4637 4637 struct sk_buff *list_skb = skb_shinfo(skb)->frag_list; 4638 4638 unsigned int tnl_hlen = skb_tnl_header_len(skb); 4639 - unsigned int delta_truesize = 0; 4640 4639 unsigned int delta_len = 0; 4641 4640 struct sk_buff *tail = NULL; 4642 4641 struct sk_buff *nskb, *tmp; 4643 4642 int len_diff, err; 4643 + 4644 + /* Only skb_gro_receive_list generated skbs arrive here */ 4645 + DEBUG_NET_WARN_ON_ONCE(!(skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST)); 4644 4646 4645 4647 skb_push(skb, -skb_network_offset(skb) + offset); 4646 4648 ··· 4657 4655 nskb = list_skb; 4658 4656 list_skb = list_skb->next; 4659 4657 4658 + DEBUG_NET_WARN_ON_ONCE(nskb->sk); 4659 + 4660 4660 err = 0; 4661 - delta_truesize += nskb->truesize; 4662 4661 if (skb_shared(nskb)) { 4663 4662 tmp = skb_clone(nskb, GFP_ATOMIC); 4664 4663 if (tmp) { ··· 4702 4699 goto err_linearize; 4703 4700 } 4704 4701 4705 - skb->truesize = skb->truesize - delta_truesize; 4706 4702 skb->data_len = skb->data_len - delta_len; 4707 4703 skb->len = skb->len - delta_len; 4708 4704
+4 -3
net/core/sock.c
··· 3896 3896 int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, 3897 3897 int level, int type) 3898 3898 { 3899 - struct sock_exterr_skb *serr; 3899 + struct sock_extended_err ee; 3900 3900 struct sk_buff *skb; 3901 3901 int copied, err; 3902 3902 ··· 3916 3916 3917 3917 sock_recv_timestamp(msg, sk, skb); 3918 3918 3919 - serr = SKB_EXT_ERR(skb); 3920 - put_cmsg(msg, level, type, sizeof(serr->ee), &serr->ee); 3919 + /* We must use a bounce buffer for CONFIG_HARDENED_USERCOPY=y */ 3920 + ee = SKB_EXT_ERR(skb)->ee; 3921 + put_cmsg(msg, level, type, sizeof(ee), &ee); 3921 3922 3922 3923 msg->msg_flags |= MSG_ERRQUEUE; 3923 3924 err = copied;
+4 -3
net/ipv4/arp.c
··· 564 564 565 565 skb_reserve(skb, hlen); 566 566 skb_reset_network_header(skb); 567 - arp = skb_put(skb, arp_hdr_len(dev)); 567 + skb_put(skb, arp_hdr_len(dev)); 568 568 skb->dev = dev; 569 569 skb->protocol = htons(ETH_P_ARP); 570 570 if (!src_hw) ··· 572 572 if (!dest_hw) 573 573 dest_hw = dev->broadcast; 574 574 575 - /* 576 - * Fill the device header for the ARP frame 575 + /* Fill the device header for the ARP frame. 576 + * Note: skb->head can be changed. 577 577 */ 578 578 if (dev_hard_header(skb, dev, ptype, dest_hw, src_hw, skb->len) < 0) 579 579 goto out; 580 580 581 + arp = arp_hdr(skb); 581 582 /* 582 583 * Fill out the arp protocol part. 583 584 *
+2
net/ipv4/inet_fragment.c
··· 488 488 } 489 489 490 490 FRAG_CB(skb)->ip_defrag_offset = offset; 491 + if (offset) 492 + nf_reset_ct(skb); 491 493 492 494 return IPFRAG_OK; 493 495 }
+1 -3
net/ipv4/ping.c
··· 828 828 out_free: 829 829 if (free) 830 830 kfree(ipc.opt); 831 - if (!err) { 832 - icmp_out_count(sock_net(sk), user_icmph.type); 831 + if (!err) 833 832 return len; 834 - } 835 833 return err; 836 834 837 835 do_confirm:
+3 -5
net/ipv4/tcp.c
··· 2652 2652 if (sk->sk_state == TCP_LISTEN) 2653 2653 goto out; 2654 2654 2655 - if (tp->recvmsg_inq) { 2655 + if (tp->recvmsg_inq) 2656 2656 *cmsg_flags = TCP_CMSG_INQ; 2657 - msg->msg_get_inq = 1; 2658 - } 2659 2657 timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 2660 2658 2661 2659 /* Urgent data needs to be handled specially. */ ··· 2927 2929 ret = tcp_recvmsg_locked(sk, msg, len, flags, &tss, &cmsg_flags); 2928 2930 release_sock(sk); 2929 2931 2930 - if ((cmsg_flags || msg->msg_get_inq) && ret >= 0) { 2932 + if ((cmsg_flags | msg->msg_get_inq) && ret >= 0) { 2931 2933 if (cmsg_flags & TCP_CMSG_TS) 2932 2934 tcp_recv_timestamp(msg, sk, &tss); 2933 - if (msg->msg_get_inq) { 2935 + if ((cmsg_flags & TCP_CMSG_INQ) | msg->msg_get_inq) { 2934 2936 msg->msg_inq = tcp_inq_hint(sk); 2935 2937 if (cmsg_flags & TCP_CMSG_INQ) 2936 2938 put_cmsg(msg, SOL_TCP, TCP_CM_INQ,
+1
net/ipv4/udp.c
··· 1851 1851 sk_peek_offset_bwd(sk, len); 1852 1852 1853 1853 if (!skb_shared(skb)) { 1854 + skb_orphan(skb); 1854 1855 skb_attempt_defer_free(skb); 1855 1856 return; 1856 1857 }
+3
net/mac80211/chan.c
··· 90 90 /* next (or first) interface */ 91 91 iter->sdata = list_prepare_entry(iter->sdata, &local->interfaces, list); 92 92 list_for_each_entry_continue(iter->sdata, &local->interfaces, list) { 93 + if (!ieee80211_sdata_running(iter->sdata)) 94 + continue; 95 + 93 96 /* AP_VLAN has a chanctx pointer but follows AP */ 94 97 if (iter->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 95 98 continue;
+4 -3
net/mac80211/sta_info.c
··· 1533 1533 } 1534 1534 } 1535 1535 1536 + sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); 1537 + if (sinfo) 1538 + sta_set_sinfo(sta, sinfo, true); 1539 + 1536 1540 if (sta->uploaded) { 1537 1541 ret = drv_sta_state(local, sdata, sta, IEEE80211_STA_NONE, 1538 1542 IEEE80211_STA_NOTEXIST); ··· 1545 1541 1546 1542 sta_dbg(sdata, "Removed STA %pM\n", sta->sta.addr); 1547 1543 1548 - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); 1549 - if (sinfo) 1550 - sta_set_sinfo(sta, sinfo, true); 1551 1544 cfg80211_del_sta_sinfo(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL); 1552 1545 kfree(sinfo); 1553 1546
+2
net/mac80211/tx.c
··· 2397 2397 2398 2398 if (chanctx_conf) 2399 2399 chandef = &chanctx_conf->def; 2400 + else if (local->emulate_chanctx) 2401 + chandef = &local->hw.conf.chandef; 2400 2402 else 2401 2403 goto fail_rcu; 2402 2404
+1 -1
net/netfilter/nf_conncount.c
··· 229 229 230 230 nf_ct_put(found_ct); 231 231 } 232 + list->last_gc = (u32)jiffies; 232 233 233 234 add_new_node: 234 235 if (WARN_ON_ONCE(list->count > INT_MAX)) { ··· 249 248 conn->jiffies32 = (u32)jiffies; 250 249 list_add_tail(&conn->node, &list->head); 251 250 list->count++; 252 - list->last_gc = (u32)jiffies; 253 251 254 252 out_put: 255 253 if (refcounted)
+2 -2
net/netfilter/nf_log.c
··· 89 89 if (pf == NFPROTO_UNSPEC) { 90 90 for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++) { 91 91 if (rcu_access_pointer(loggers[i][logger->type])) { 92 - ret = -EEXIST; 92 + ret = -EBUSY; 93 93 goto unlock; 94 94 } 95 95 } ··· 97 97 rcu_assign_pointer(loggers[i][logger->type], logger); 98 98 } else { 99 99 if (rcu_access_pointer(loggers[pf][logger->type])) { 100 - ret = -EEXIST; 100 + ret = -EBUSY; 101 101 goto unlock; 102 102 } 103 103 rcu_assign_pointer(loggers[pf][logger->type], logger);
+2 -1
net/netfilter/nf_tables_api.c
··· 4439 4439 4440 4440 if (!nft_use_inc(&chain->use)) { 4441 4441 err = -EMFILE; 4442 - goto err_release_rule; 4442 + goto err_destroy_flow; 4443 4443 } 4444 4444 4445 4445 if (info->nlh->nlmsg_flags & NLM_F_REPLACE) { ··· 4489 4489 4490 4490 err_destroy_flow_rule: 4491 4491 nft_use_dec_restore(&chain->use); 4492 + err_destroy_flow: 4492 4493 if (flow) 4493 4494 nft_flow_rule_destroy(flow); 4494 4495 err_release_rule:
+2 -2
net/netfilter/nft_set_pipapo.c
··· 1317 1317 else 1318 1318 dup_end = dup_key; 1319 1319 1320 - if (!memcmp(start, dup_key->data, sizeof(*dup_key->data)) && 1321 - !memcmp(end, dup_end->data, sizeof(*dup_end->data))) { 1320 + if (!memcmp(start, dup_key->data, set->klen) && 1321 + !memcmp(end, dup_end->data, set->klen)) { 1322 1322 *elem_priv = &dup->priv; 1323 1323 return -EEXIST; 1324 1324 }
+3 -3
net/netfilter/nft_synproxy.c
··· 48 48 struct tcphdr *_tcph, 49 49 struct synproxy_options *opts) 50 50 { 51 - struct nf_synproxy_info info = priv->info; 51 + struct nf_synproxy_info info = READ_ONCE(priv->info); 52 52 struct net *net = nft_net(pkt); 53 53 struct synproxy_net *snet = synproxy_pernet(net); 54 54 struct sk_buff *skb = pkt->skb; ··· 79 79 struct tcphdr *_tcph, 80 80 struct synproxy_options *opts) 81 81 { 82 - struct nf_synproxy_info info = priv->info; 82 + struct nf_synproxy_info info = READ_ONCE(priv->info); 83 83 struct net *net = nft_net(pkt); 84 84 struct synproxy_net *snet = synproxy_pernet(net); 85 85 struct sk_buff *skb = pkt->skb; ··· 340 340 struct nft_synproxy *newpriv = nft_obj_data(newobj); 341 341 struct nft_synproxy *priv = nft_obj_data(obj); 342 342 343 - priv->info = newpriv->info; 343 + WRITE_ONCE(priv->info, newpriv->info); 344 344 } 345 345 346 346 static struct nft_object_type nft_synproxy_obj_type;
+1 -1
net/netfilter/x_tables.c
··· 1764 1764 int xt_register_template(const struct xt_table *table, 1765 1765 int (*table_init)(struct net *net)) 1766 1766 { 1767 - int ret = -EEXIST, af = table->af; 1767 + int ret = -EBUSY, af = table->af; 1768 1768 struct xt_template *t; 1769 1769 1770 1770 mutex_lock(&xt[af].mutex);
+2
net/sched/act_api.c
··· 940 940 int ret; 941 941 942 942 idr_for_each_entry_ul(idr, p, tmp, id) { 943 + if (IS_ERR(p)) 944 + continue; 943 945 if (tc_act_in_hw(p) && !mutex_taken) { 944 946 rtnl_lock(); 945 947 mutex_taken = true;
+13 -13
net/sched/act_mirred.c
··· 266 266 goto err_cant_do; 267 267 } 268 268 269 - /* we could easily avoid the clone only if called by ingress and clsact; 270 - * since we can't easily detect the clsact caller, skip clone only for 271 - * ingress - that covers the TC S/W datapath. 272 - */ 273 - at_ingress = skb_at_tc_ingress(skb); 274 - dont_clone = skb_at_tc_ingress(skb) && is_redirect && 275 - tcf_mirred_can_reinsert(retval); 276 - if (!dont_clone) { 277 - skb_to_send = skb_clone(skb, GFP_ATOMIC); 278 - if (!skb_to_send) 279 - goto err_cant_do; 280 - } 281 - 282 269 want_ingress = tcf_mirred_act_wants_ingress(m_eaction); 283 270 271 + at_ingress = skb_at_tc_ingress(skb); 284 272 if (dev == skb->dev && want_ingress == at_ingress) { 285 273 pr_notice_once("tc mirred: Loop (%s:%s --> %s:%s)\n", 286 274 netdev_name(skb->dev), ··· 276 288 netdev_name(dev), 277 289 want_ingress ? "ingress" : "egress"); 278 290 goto err_cant_do; 291 + } 292 + 293 + /* we could easily avoid the clone only if called by ingress and clsact; 294 + * since we can't easily detect the clsact caller, skip clone only for 295 + * ingress - that covers the TC S/W datapath. 296 + */ 297 + dont_clone = skb_at_tc_ingress(skb) && is_redirect && 298 + tcf_mirred_can_reinsert(retval); 299 + if (!dont_clone) { 300 + skb_to_send = skb_clone(skb, GFP_ATOMIC); 301 + if (!skb_to_send) 302 + goto err_cant_do; 279 303 } 280 304 281 305 /* All mirred/redirected skbs should clear previous ct info */
+1 -1
net/sched/sch_qfq.c
··· 1481 1481 1482 1482 for (i = 0; i < q->clhash.hashsize; i++) { 1483 1483 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) { 1484 - if (cl->qdisc->q.qlen > 0) 1484 + if (cl_is_active(cl)) 1485 1485 qfq_deactivate_class(q, cl); 1486 1486 1487 1487 qdisc_reset(cl->qdisc);
+3 -5
net/unix/af_unix.c
··· 2904 2904 unsigned int last_len; 2905 2905 struct unix_sock *u; 2906 2906 int copied = 0; 2907 - bool do_cmsg; 2908 2907 int err = 0; 2909 2908 long timeo; 2910 2909 int target; ··· 2929 2930 2930 2931 u = unix_sk(sk); 2931 2932 2932 - do_cmsg = READ_ONCE(u->recvmsg_inq); 2933 - if (do_cmsg) 2934 - msg->msg_get_inq = 1; 2935 2933 redo: 2936 2934 /* Lock the socket to prevent queue disordering 2937 2935 * while sleeps in memcpy_tomsg ··· 3086 3090 3087 3091 mutex_unlock(&u->iolock); 3088 3092 if (msg) { 3093 + bool do_cmsg = READ_ONCE(u->recvmsg_inq); 3094 + 3089 3095 scm_recv_unix(sock, msg, &scm, flags); 3090 3096 3091 - if (msg->msg_get_inq && (copied ?: err) >= 0) { 3097 + if ((do_cmsg | msg->msg_get_inq) && (copied ?: err) >= 0) { 3092 3098 msg->msg_inq = READ_ONCE(u->inq_len); 3093 3099 if (do_cmsg) 3094 3100 put_cmsg(msg, SOL_SOCKET, SCM_INQ,
+4
net/vmw_vsock/af_vsock.c
··· 1787 1787 } else { 1788 1788 newsock->state = SS_CONNECTED; 1789 1789 sock_graft(connected, newsock); 1790 + 1791 + set_bit(SOCK_CUSTOM_SOCKOPT, 1792 + &connected->sk_socket->flags); 1793 + 1790 1794 if (vsock_msgzerocopy_allow(vconnected->transport)) 1791 1795 set_bit(SOCK_SUPPORT_ZC, 1792 1796 &connected->sk_socket->flags);
+4
net/wireless/wext-core.c
··· 1101 1101 return ioctl_standard_call(dev, iwr, cmd, info, handler); 1102 1102 1103 1103 iwp_compat = (struct compat_iw_point *) &iwr->u.data; 1104 + 1105 + /* struct iw_point has a 32bit hole on 64bit arches. */ 1106 + memset(&iwp, 0, sizeof(iwp)); 1107 + 1104 1108 iwp.pointer = compat_ptr(iwp_compat->pointer); 1105 1109 iwp.length = iwp_compat->length; 1106 1110 iwp.flags = iwp_compat->flags;
+4
net/wireless/wext-priv.c
··· 228 228 struct iw_point iwp; 229 229 230 230 iwp_compat = (struct compat_iw_point *) &iwr->u.data; 231 + 232 + /* struct iw_point has a 32bit hole on 64bit arches. */ 233 + memset(&iwp, 0, sizeof(iwp)); 234 + 231 235 iwp.pointer = compat_ptr(iwp_compat->pointer); 232 236 iwp.length = iwp_compat->length; 233 237 iwp.flags = iwp_compat->flags;
-1
tools/net/ynl/Makefile
··· 51 51 @echo -e "\tINSTALL pyynl" 52 52 @pip install --prefix=$(DESTDIR)$(prefix) . 53 53 @make -C generated install 54 - @make -C tests install 55 54 56 55 run_tests: 57 56 @$(MAKE) -C tests run_tests
+2 -2
tools/testing/selftests/drivers/net/hw/lib/py/__init__.py
··· 22 22 NlError, RtnlFamily, DevlinkFamily, PSPFamily 23 23 from net.lib.py import CmdExitFailure 24 24 from net.lib.py import bkg, cmd, bpftool, bpftrace, defer, ethtool, \ 25 - fd_read_timeout, ip, rand_port, wait_port_listen, wait_file 25 + fd_read_timeout, ip, rand_port, wait_port_listen, wait_file, tool 26 26 from net.lib.py import KsftSkipEx, KsftFailEx, KsftXfailEx 27 27 from net.lib.py import ksft_disruptive, ksft_exit, ksft_pr, ksft_run, \ 28 28 ksft_setup, ksft_variants, KsftNamedVariant ··· 37 37 "CmdExitFailure", 38 38 "bkg", "cmd", "bpftool", "bpftrace", "defer", "ethtool", 39 39 "fd_read_timeout", "ip", "rand_port", 40 - "wait_port_listen", "wait_file", 40 + "wait_port_listen", "wait_file", "tool", 41 41 "KsftSkipEx", "KsftFailEx", "KsftXfailEx", 42 42 "ksft_disruptive", "ksft_exit", "ksft_pr", "ksft_run", 43 43 "ksft_setup", "ksft_variants", "KsftNamedVariant",
+59
tools/testing/selftests/drivers/net/netdevsim/peer.sh
··· 52 52 ip netns del nssv 53 53 } 54 54 55 + is_carrier_up() 56 + { 57 + local netns="$1" 58 + local nsim_dev="$2" 59 + 60 + test "$(ip netns exec "$netns" \ 61 + cat /sys/class/net/"$nsim_dev"/carrier 2>/dev/null)" -eq 1 62 + } 63 + 64 + assert_carrier_up() 65 + { 66 + local netns="$1" 67 + local nsim_dev="$2" 68 + 69 + if ! is_carrier_up "$netns" "$nsim_dev"; then 70 + echo "$nsim_dev's carrier should be UP, but it isn't" 71 + cleanup_ns 72 + exit 1 73 + fi 74 + } 75 + 76 + assert_carrier_down() 77 + { 78 + local netns="$1" 79 + local nsim_dev="$2" 80 + 81 + if is_carrier_up "$netns" "$nsim_dev"; then 82 + echo "$nsim_dev's carrier should be DOWN, but it isn't" 83 + cleanup_ns 84 + exit 1 85 + fi 86 + } 87 + 55 88 ### 56 89 ### Code start 57 90 ### ··· 145 112 cleanup_ns 146 113 exit 1 147 114 fi 115 + 116 + # netdevsim carrier state consistency checking 117 + assert_carrier_up nssv "$NSIM_DEV_1_NAME" 118 + assert_carrier_up nscl "$NSIM_DEV_2_NAME" 119 + 120 + echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX" > "$NSIM_DEV_SYS_UNLINK" 121 + 122 + assert_carrier_down nssv "$NSIM_DEV_1_NAME" 123 + assert_carrier_down nscl "$NSIM_DEV_2_NAME" 124 + 125 + ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" down 126 + ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" up 127 + 128 + assert_carrier_down nssv "$NSIM_DEV_1_NAME" 129 + assert_carrier_down nscl "$NSIM_DEV_2_NAME" 130 + 131 + echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_FD:$NSIM_DEV_2_IFIDX" > $NSIM_DEV_SYS_LINK 132 + 133 + assert_carrier_up nssv "$NSIM_DEV_1_NAME" 134 + assert_carrier_up nscl "$NSIM_DEV_2_NAME" 135 + 136 + ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" down 137 + ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" up 138 + 139 + assert_carrier_up nssv "$NSIM_DEV_1_NAME" 140 + assert_carrier_up nscl "$NSIM_DEV_2_NAME" 148 141 149 142 # send/recv packets 150 143
+2 -2
tools/testing/selftests/net/lib/py/__init__.py
··· 13 13 from .netns import NetNS, NetNSEnter 14 14 from .nsim import NetdevSim, NetdevSimDev 15 15 from .utils import CmdExitFailure, fd_read_timeout, cmd, bkg, defer, \ 16 - bpftool, ip, ethtool, bpftrace, rand_port, wait_port_listen, wait_file 16 + bpftool, ip, ethtool, bpftrace, rand_port, wait_port_listen, wait_file, tool 17 17 from .ynl import NlError, YnlFamily, EthtoolFamily, NetdevFamily, RtnlFamily, RtnlAddrFamily 18 18 from .ynl import NetshaperFamily, DevlinkFamily, PSPFamily 19 19 ··· 26 26 "NetNS", "NetNSEnter", 27 27 "CmdExitFailure", "fd_read_timeout", "cmd", "bkg", "defer", 28 28 "bpftool", "ip", "ethtool", "bpftrace", "rand_port", 29 - "wait_port_listen", "wait_file", 29 + "wait_port_listen", "wait_file", "tool", 30 30 "NetdevSim", "NetdevSimDev", 31 31 "NetshaperFamily", "DevlinkFamily", "PSPFamily", "NlError", 32 32 "YnlFamily", "EthtoolFamily", "NetdevFamily", "RtnlFamily",
+1
tools/testing/selftests/net/mptcp/Makefile
··· 3 3 top_srcdir = ../../../../.. 4 4 5 5 CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES) 6 + CFLAGS += -I$(top_srcdir)/tools/include 6 7 7 8 TEST_PROGS := \ 8 9 diag.sh \
+2 -1
tools/testing/selftests/net/mptcp/mptcp_connect.c
··· 33 33 #include <linux/tcp.h> 34 34 #include <linux/time_types.h> 35 35 #include <linux/sockios.h> 36 + #include <linux/compiler.h> 36 37 37 38 extern int optind; 38 39 ··· 141 140 exit(1); 142 141 } 143 142 144 - static void xerror(const char *fmt, ...) 143 + static void __noreturn xerror(const char *fmt, ...) 145 144 { 146 145 va_list ap; 147 146
+2 -1
tools/testing/selftests/net/mptcp/mptcp_diag.c
··· 5 5 #include <linux/rtnetlink.h> 6 6 #include <linux/inet_diag.h> 7 7 #include <linux/netlink.h> 8 + #include <linux/compiler.h> 8 9 #include <sys/socket.h> 9 10 #include <netinet/in.h> 10 11 #include <linux/tcp.h> ··· 88 87 89 88 #define rta_getattr(type, value) (*(type *)RTA_DATA(value)) 90 89 91 - static void die_perror(const char *msg) 90 + static void __noreturn die_perror(const char *msg) 92 91 { 93 92 perror(msg); 94 93 exit(1);
+3 -2
tools/testing/selftests/net/mptcp/mptcp_inq.c
··· 28 28 29 29 #include <linux/tcp.h> 30 30 #include <linux/sockios.h> 31 + #include <linux/compiler.h> 31 32 32 33 #ifndef IPPROTO_MPTCP 33 34 #define IPPROTO_MPTCP 262 ··· 41 40 static int proto_tx = IPPROTO_MPTCP; 42 41 static int proto_rx = IPPROTO_MPTCP; 43 42 44 - static void die_perror(const char *msg) 43 + static void __noreturn die_perror(const char *msg) 45 44 { 46 45 perror(msg); 47 46 exit(1); ··· 53 52 exit(r); 54 53 } 55 54 56 - static void xerror(const char *fmt, ...) 55 + static void __noreturn xerror(const char *fmt, ...) 57 56 { 58 57 va_list ap; 59 58
+3 -2
tools/testing/selftests/net/mptcp/mptcp_sockopt.c
··· 25 25 #include <netinet/in.h> 26 26 27 27 #include <linux/tcp.h> 28 + #include <linux/compiler.h> 28 29 29 30 static int pf = AF_INET; 30 31 ··· 128 127 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 129 128 #endif 130 129 131 - static void die_perror(const char *msg) 130 + static void __noreturn die_perror(const char *msg) 132 131 { 133 132 perror(msg); 134 133 exit(1); ··· 140 139 exit(r); 141 140 } 142 141 143 - static void xerror(const char *fmt, ...) 142 + static void __noreturn xerror(const char *fmt, ...) 144 143 { 145 144 va_list ap; 146 145
+44 -1
tools/testing/selftests/net/netfilter/nft_concat_range.sh
··· 29 29 net6_port_net6_port net_port_mac_proto_net" 30 30 31 31 # Reported bugs, also described by TYPE_ variables below 32 - BUGS="flush_remove_add reload net_port_proto_match avx2_mismatch doublecreate" 32 + BUGS="flush_remove_add reload net_port_proto_match avx2_mismatch doublecreate insert_overlap" 33 33 34 34 # List of possible paths to pktgen script from kernel tree for performance tests 35 35 PKTGEN_SCRIPT_PATHS=" ··· 410 410 411 411 TYPE_doublecreate=" 412 412 display cannot create same element twice 413 + type_spec ipv4_addr . ipv4_addr 414 + chain_spec ip saddr . ip daddr 415 + dst addr4 416 + proto icmp 417 + 418 + race_repeat 0 419 + 420 + perf_duration 0 421 + " 422 + 423 + TYPE_insert_overlap=" 424 + display reject overlapping range on add 413 425 type_spec ipv4_addr . ipv4_addr 414 426 chain_spec ip saddr . ip daddr 415 427 dst addr4 ··· 1962 1950 err "Could not flush and re-create element in one transaction" 1963 1951 return 1 1964 1952 fi 1953 + 1954 + return 0 1955 + } 1956 + 1957 + add_fail() 1958 + { 1959 + if nft add element inet filter test "$1" 2>/dev/null ; then 1960 + err "Returned success for add ${1} given set:" 1961 + err "$(nft -a list set inet filter test )" 1962 + return 1 1963 + fi 1964 + 1965 + return 0 1966 + } 1967 + 1968 + test_bug_insert_overlap() 1969 + { 1970 + local elements="1.2.3.4 . 1.2.4.1" 1971 + 1972 + setup veth send_"${proto}" set || return ${ksft_skip} 1973 + 1974 + add "{ $elements }" || return 1 1975 + 1976 + elements="1.2.3.0-1.2.3.4 . 1.2.4.1" 1977 + add_fail "{ $elements }" || return 1 1978 + 1979 + elements="1.2.3.0-1.2.3.4 . 1.2.4.2" 1980 + add "{ $elements }" || return 1 1981 + 1982 + elements="1.2.3.4 . 1.2.4.1-1.2.4.2" 1983 + add_fail "{ $elements }" || return 1 1965 1984 1966 1985 return 0 1967 1986 }
+47
tools/testing/selftests/tc-testing/tc-tests/actions/mirred.json
··· 1098 1098 "teardown": [ 1099 1099 "$TC qdisc del dev $DUMMY root" 1100 1100 ] 1101 + }, 1102 + { 1103 + "id": "4ed9", 1104 + "name": "Try to redirect to self on egress with clsact", 1105 + "category": [ 1106 + "filter", 1107 + "mirred" 1108 + ], 1109 + "plugins": { 1110 + "requires": [ 1111 + "nsPlugin" 1112 + ] 1113 + }, 1114 + "setup": [ 1115 + "$IP link set dev $DUMMY up || true", 1116 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 1117 + "$TC qdisc add dev $DUMMY clsact", 1118 + "$TC filter add dev $DUMMY egress protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 1" 1119 + ], 1120 + "cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1", 1121 + "expExitCode": "1", 1122 + "verifyCmd": "$TC -j -s actions get action mirred index 1", 1123 + "matchJSON": [ 1124 + { 1125 + "total acts": 0 1126 + }, 1127 + { 1128 + "actions": [ 1129 + { 1130 + "order": 1, 1131 + "kind": "mirred", 1132 + "mirred_action": "redirect", 1133 + "direction": "egress", 1134 + "index": 1, 1135 + "stats": { 1136 + "packets": 1, 1137 + "overlimits": 1 1138 + }, 1139 + "not_in_hw": true 1140 + } 1141 + ] 1142 + } 1143 + ], 1144 + "teardown": [ 1145 + "$TC qdisc del dev $DUMMY clsact" 1146 + ] 1101 1147 } 1148 + 1102 1149 ]
+32
tools/testing/vsock/vsock_test.c
··· 2192 2192 close(fd); 2193 2193 } 2194 2194 2195 + static void test_stream_accepted_setsockopt_client(const struct test_opts *opts) 2196 + { 2197 + int fd; 2198 + 2199 + fd = vsock_stream_connect(opts->peer_cid, opts->peer_port); 2200 + if (fd < 0) { 2201 + perror("connect"); 2202 + exit(EXIT_FAILURE); 2203 + } 2204 + 2205 + close(fd); 2206 + } 2207 + 2208 + static void test_stream_accepted_setsockopt_server(const struct test_opts *opts) 2209 + { 2210 + int fd; 2211 + 2212 + fd = vsock_stream_accept(VMADDR_CID_ANY, opts->peer_port, NULL); 2213 + if (fd < 0) { 2214 + perror("accept"); 2215 + exit(EXIT_FAILURE); 2216 + } 2217 + 2218 + enable_so_zerocopy_check(fd); 2219 + close(fd); 2220 + } 2221 + 2195 2222 static struct test_case test_cases[] = { 2196 2223 { 2197 2224 .name = "SOCK_STREAM connection reset", ··· 2397 2370 .name = "SOCK_SEQPACKET ioctl(SIOCINQ) functionality", 2398 2371 .run_client = test_seqpacket_unread_bytes_client, 2399 2372 .run_server = test_seqpacket_unread_bytes_server, 2373 + }, 2374 + { 2375 + .name = "SOCK_STREAM accept()ed socket custom setsockopt()", 2376 + .run_client = test_stream_accepted_setsockopt_client, 2377 + .run_server = test_stream_accepted_setsockopt_server, 2400 2378 }, 2401 2379 {}, 2402 2380 };