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.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Paolo Abeni:
"Including fixes from can and ipsec subtrees.

Current release - regressions:

- sched: fix off by one in htb_activate_prios()

- eth: mana: fix accessing freed irq affinity_hint

- eth: ice: fix out-of-bounds KASAN warning in virtchnl

Current release - new code bugs:

- eth: mtk_eth_soc: enable special tag when any MAC uses DSA

Previous releases - always broken:

- core: fix sk->sk_txrehash default

- neigh: make sure used and confirmed times are valid

- mptcp: be careful on subflow status propagation on errors

- xfrm: prevent potential spectre v1 gadget in xfrm_xlate32_attr()

- phylink: move phy_device_free() to correctly release phy device

- eth: mlx5:
- fix crash unsetting rx-vlan-filter in switchdev mode
- fix hang on firmware reset
- serialize module cleanup with reload and remove"

* tag 'net-6.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (57 commits)
selftests: forwarding: lib: quote the sysctl values
net: mscc: ocelot: fix all IPv6 getting trapped to CPU when PTP timestamping is used
rds: rds_rm_zerocopy_callback() use list_first_entry()
net: txgbe: Update support email address
selftests: Fix failing VXLAN VNI filtering test
selftests: mptcp: stop tests earlier
selftests: mptcp: allow more slack for slow test-case
mptcp: be careful on subflow status propagation on errors
mptcp: fix locking for in-kernel listener creation
mptcp: fix locking for setsockopt corner-case
mptcp: do not wait for bare sockets' timeout
net: ethernet: mtk_eth_soc: fix DSA TX tag hwaccel for switch port 0
nfp: ethtool: fix the bug of setting unsupported port speed
txhash: fix sk->sk_txrehash default
net: ethernet: mtk_eth_soc: fix wrong parameters order in __xdp_rxq_info_reg()
net: ethernet: mtk_eth_soc: enable special tag when any MAC uses DSA
net: sched: sch: Fix off by one in htb_activate_prios()
igc: Add ndo_tx_timeout support
net: mana: Fix accessing freed irq affinity_hint
hv_netvsc: Allocate memory in netvsc_dma_map() with GFP_ATOMIC
...

+798 -353
+1 -1
Documentation/networking/device_drivers/ethernet/wangxun/txgbe.rst
··· 16 16 17 17 Support 18 18 ======= 19 - If you got any problem, contact Wangxun support team via support@trustnetic.com 19 + If you got any problem, contact Wangxun support team via nic-support@net-swift.com 20 20 and Cc: netdev.
+1 -1
drivers/net/bonding/bond_debugfs.c
··· 76 76 77 77 d = debugfs_rename(bonding_debug_root, bond->debug_dir, 78 78 bonding_debug_root, bond->dev->name); 79 - if (d) { 79 + if (!IS_ERR(d)) { 80 80 bond->debug_dir = d; 81 81 } else { 82 82 netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n");
+19 -7
drivers/net/dsa/mt7530.c
··· 1309 1309 if (!priv->ports[port].pvid) 1310 1310 mt7530_rmw(priv, MT7530_PVC_P(port), ACC_FRM_MASK, 1311 1311 MT7530_VLAN_ACC_TAGGED); 1312 - } 1313 1312 1314 - /* Set the port as a user port which is to be able to recognize VID 1315 - * from incoming packets before fetching entry within the VLAN table. 1316 - */ 1317 - mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK, 1318 - VLAN_ATTR(MT7530_VLAN_USER) | 1319 - PVC_EG_TAG(MT7530_VLAN_EG_DISABLED)); 1313 + /* Set the port as a user port which is to be able to recognize 1314 + * VID from incoming packets before fetching entry within the 1315 + * VLAN table. 1316 + */ 1317 + mt7530_rmw(priv, MT7530_PVC_P(port), 1318 + VLAN_ATTR_MASK | PVC_EG_TAG_MASK, 1319 + VLAN_ATTR(MT7530_VLAN_USER) | 1320 + PVC_EG_TAG(MT7530_VLAN_EG_DISABLED)); 1321 + } else { 1322 + /* Also set CPU ports to the "user" VLAN port attribute, to 1323 + * allow VLAN classification, but keep the EG_TAG attribute as 1324 + * "consistent" (i.o.w. don't change its value) for packets 1325 + * received by the switch from the CPU, so that tagged packets 1326 + * are forwarded to user ports as tagged, and untagged as 1327 + * untagged. 1328 + */ 1329 + mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK, 1330 + VLAN_ATTR(MT7530_VLAN_USER)); 1331 + } 1320 1332 } 1321 1333 1322 1334 static void
+16 -15
drivers/net/ethernet/cadence/macb_main.c
··· 4627 4627 if (ret) 4628 4628 return dev_err_probe(&pdev->dev, ret, 4629 4629 "failed to init SGMII PHY\n"); 4630 - } 4631 4630 4632 - ret = zynqmp_pm_is_function_supported(PM_IOCTL, IOCTL_SET_GEM_CONFIG); 4633 - if (!ret) { 4634 - u32 pm_info[2]; 4631 + ret = zynqmp_pm_is_function_supported(PM_IOCTL, IOCTL_SET_GEM_CONFIG); 4632 + if (!ret) { 4633 + u32 pm_info[2]; 4635 4634 4636 - ret = of_property_read_u32_array(pdev->dev.of_node, "power-domains", 4637 - pm_info, ARRAY_SIZE(pm_info)); 4638 - if (ret) { 4639 - dev_err(&pdev->dev, "Failed to read power management information\n"); 4640 - goto err_out_phy_exit; 4635 + ret = of_property_read_u32_array(pdev->dev.of_node, "power-domains", 4636 + pm_info, ARRAY_SIZE(pm_info)); 4637 + if (ret) { 4638 + dev_err(&pdev->dev, "Failed to read power management information\n"); 4639 + goto err_out_phy_exit; 4640 + } 4641 + ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_FIXED, 0); 4642 + if (ret) 4643 + goto err_out_phy_exit; 4644 + 4645 + ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_SGMII_MODE, 1); 4646 + if (ret) 4647 + goto err_out_phy_exit; 4641 4648 } 4642 - ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_FIXED, 0); 4643 - if (ret) 4644 - goto err_out_phy_exit; 4645 4649 4646 - ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_SGMII_MODE, 1); 4647 - if (ret) 4648 - goto err_out_phy_exit; 4649 4650 } 4650 4651 4651 4652 /* Fully reset controller at hardware level if mapped in device tree */
+4 -5
drivers/net/ethernet/intel/ice/ice_common.c
··· 5524 5524 * returned by the firmware is a 16 bit * value, but is indexed 5525 5525 * by [fls(speed) - 1] 5526 5526 */ 5527 - static const u32 ice_aq_to_link_speed[15] = { 5527 + static const u32 ice_aq_to_link_speed[] = { 5528 5528 SPEED_10, /* BIT(0) */ 5529 5529 SPEED_100, 5530 5530 SPEED_1000, ··· 5536 5536 SPEED_40000, 5537 5537 SPEED_50000, 5538 5538 SPEED_100000, /* BIT(10) */ 5539 - 0, 5540 - 0, 5541 - 0, 5542 - 0 /* BIT(14) */ 5543 5539 }; 5544 5540 5545 5541 /** ··· 5546 5550 */ 5547 5551 u32 ice_get_link_speed(u16 index) 5548 5552 { 5553 + if (index >= ARRAY_SIZE(ice_aq_to_link_speed)) 5554 + return 0; 5555 + 5549 5556 return ice_aq_to_link_speed[index]; 5550 5557 }
+1 -1
drivers/net/ethernet/intel/ice/ice_main.c
··· 5541 5541 pr_info("%s\n", ice_driver_string); 5542 5542 pr_info("%s\n", ice_copyright); 5543 5543 5544 - ice_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, KBUILD_MODNAME); 5544 + ice_wq = alloc_workqueue("%s", 0, 0, KBUILD_MODNAME); 5545 5545 if (!ice_wq) { 5546 5546 pr_err("Failed to create workqueue\n"); 5547 5547 return -ENOMEM;
+1 -1
drivers/net/ethernet/intel/ice/ice_switch.c
··· 5420 5420 */ 5421 5421 status = ice_add_special_words(rinfo, lkup_exts, ice_is_dvm_ena(hw)); 5422 5422 if (status) 5423 - goto err_free_lkup_exts; 5423 + goto err_unroll; 5424 5424 5425 5425 /* Group match words into recipes using preferred recipe grouping 5426 5426 * criteria.
+1 -1
drivers/net/ethernet/intel/ice/ice_tc_lib.c
··· 1681 1681 struct ice_vsi *ch_vsi = NULL; 1682 1682 u16 queue = act->rx_queue; 1683 1683 1684 - if (queue > vsi->num_rxq) { 1684 + if (queue >= vsi->num_rxq) { 1685 1685 NL_SET_ERR_MSG_MOD(fltr->extack, 1686 1686 "Unable to add filter because specified queue is invalid"); 1687 1687 return -EINVAL;
+8 -13
drivers/net/ethernet/intel/ice/ice_vf_mbx.c
··· 39 39 return ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd); 40 40 } 41 41 42 - static const u32 ice_legacy_aq_to_vc_speed[15] = { 42 + static const u32 ice_legacy_aq_to_vc_speed[] = { 43 43 VIRTCHNL_LINK_SPEED_100MB, /* BIT(0) */ 44 44 VIRTCHNL_LINK_SPEED_100MB, 45 45 VIRTCHNL_LINK_SPEED_1GB, ··· 51 51 VIRTCHNL_LINK_SPEED_40GB, 52 52 VIRTCHNL_LINK_SPEED_40GB, 53 53 VIRTCHNL_LINK_SPEED_40GB, 54 - VIRTCHNL_LINK_SPEED_UNKNOWN, 55 - VIRTCHNL_LINK_SPEED_UNKNOWN, 56 - VIRTCHNL_LINK_SPEED_UNKNOWN, 57 - VIRTCHNL_LINK_SPEED_UNKNOWN /* BIT(14) */ 58 54 }; 59 55 60 56 /** ··· 67 71 */ 68 72 u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed) 69 73 { 70 - u32 speed; 74 + /* convert a BIT() value into an array index */ 75 + u32 index = fls(link_speed) - 1; 71 76 72 - if (adv_link_support) { 73 - /* convert a BIT() value into an array index */ 74 - speed = ice_get_link_speed(fls(link_speed) - 1); 75 - } else { 77 + if (adv_link_support) 78 + return ice_get_link_speed(index); 79 + else if (index < ARRAY_SIZE(ice_legacy_aq_to_vc_speed)) 76 80 /* Virtchnl speeds are not defined for every speed supported in 77 81 * the hardware. To maintain compatibility with older AVF 78 82 * drivers, while reporting the speed the new speed values are 79 83 * resolved to the closest known virtchnl speeds 80 84 */ 81 - speed = ice_legacy_aq_to_vc_speed[fls(link_speed) - 1]; 82 - } 85 + return ice_legacy_aq_to_vc_speed[index]; 83 86 84 - return speed; 87 + return VIRTCHNL_LINK_SPEED_UNKNOWN; 85 88 } 86 89 87 90 /* The mailbox overflow detection algorithm helps to check if there
+15 -1
drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
··· 44 44 45 45 /* outer VLAN ops regardless of port VLAN config */ 46 46 vlan_ops->add_vlan = ice_vsi_add_vlan; 47 - vlan_ops->dis_rx_filtering = ice_vsi_dis_rx_vlan_filtering; 48 47 vlan_ops->ena_tx_filtering = ice_vsi_ena_tx_vlan_filtering; 49 48 vlan_ops->dis_tx_filtering = ice_vsi_dis_tx_vlan_filtering; 50 49 51 50 if (ice_vf_is_port_vlan_ena(vf)) { 52 51 /* setup outer VLAN ops */ 53 52 vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan; 53 + /* all Rx traffic should be in the domain of the 54 + * assigned port VLAN, so prevent disabling Rx VLAN 55 + * filtering 56 + */ 57 + vlan_ops->dis_rx_filtering = noop_vlan; 54 58 vlan_ops->ena_rx_filtering = 55 59 ice_vsi_ena_rx_vlan_filtering; 56 60 ··· 67 63 vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion; 68 64 vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion; 69 65 } else { 66 + vlan_ops->dis_rx_filtering = 67 + ice_vsi_dis_rx_vlan_filtering; 68 + 70 69 if (!test_bit(ICE_FLAG_VF_VLAN_PRUNING, pf->flags)) 71 70 vlan_ops->ena_rx_filtering = noop_vlan; 72 71 else ··· 103 96 vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan; 104 97 vlan_ops->ena_rx_filtering = 105 98 ice_vsi_ena_rx_vlan_filtering; 99 + /* all Rx traffic should be in the domain of the 100 + * assigned port VLAN, so prevent disabling Rx VLAN 101 + * filtering 102 + */ 103 + vlan_ops->dis_rx_filtering = noop_vlan; 106 104 } else { 105 + vlan_ops->dis_rx_filtering = 106 + ice_vsi_dis_rx_vlan_filtering; 107 107 if (!test_bit(ICE_FLAG_VF_VLAN_PRUNING, pf->flags)) 108 108 vlan_ops->ena_rx_filtering = noop_vlan; 109 109 else
+23 -2
drivers/net/ethernet/intel/igc/igc_main.c
··· 2942 2942 if (tx_buffer->next_to_watch && 2943 2943 time_after(jiffies, tx_buffer->time_stamp + 2944 2944 (adapter->tx_timeout_factor * HZ)) && 2945 - !(rd32(IGC_STATUS) & IGC_STATUS_TXOFF)) { 2945 + !(rd32(IGC_STATUS) & IGC_STATUS_TXOFF) && 2946 + (rd32(IGC_TDH(tx_ring->reg_idx)) != 2947 + readl(tx_ring->tail))) { 2946 2948 /* detected Tx unit hang */ 2947 2949 netdev_err(tx_ring->netdev, 2948 2950 "Detected Tx Unit Hang\n" ··· 5071 5069 } 5072 5070 5073 5071 /** 5072 + * igc_tx_timeout - Respond to a Tx Hang 5073 + * @netdev: network interface device structure 5074 + * @txqueue: queue number that timed out 5075 + **/ 5076 + static void igc_tx_timeout(struct net_device *netdev, 5077 + unsigned int __always_unused txqueue) 5078 + { 5079 + struct igc_adapter *adapter = netdev_priv(netdev); 5080 + struct igc_hw *hw = &adapter->hw; 5081 + 5082 + /* Do the reset outside of interrupt context */ 5083 + adapter->tx_timeout_count++; 5084 + schedule_work(&adapter->reset_task); 5085 + wr32(IGC_EICS, 5086 + (adapter->eims_enable_mask & ~adapter->eims_other)); 5087 + } 5088 + 5089 + /** 5074 5090 * igc_get_stats64 - Get System Network Statistics 5075 5091 * @netdev: network interface device structure 5076 5092 * @stats: rtnl_link_stats64 pointer ··· 5515 5495 case SPEED_100: 5516 5496 case SPEED_1000: 5517 5497 case SPEED_2500: 5518 - adapter->tx_timeout_factor = 7; 5498 + adapter->tx_timeout_factor = 1; 5519 5499 break; 5520 5500 } 5521 5501 ··· 6340 6320 .ndo_set_rx_mode = igc_set_rx_mode, 6341 6321 .ndo_set_mac_address = igc_set_mac, 6342 6322 .ndo_change_mtu = igc_change_mtu, 6323 + .ndo_tx_timeout = igc_tx_timeout, 6343 6324 .ndo_get_stats64 = igc_get_stats64, 6344 6325 .ndo_fix_features = igc_fix_features, 6345 6326 .ndo_set_features = igc_set_features,
+19 -17
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 1570 1570 if (IS_ERR(pp)) 1571 1571 return pp; 1572 1572 1573 - err = __xdp_rxq_info_reg(xdp_q, &eth->dummy_dev, eth->rx_napi.napi_id, 1574 - id, PAGE_SIZE); 1573 + err = __xdp_rxq_info_reg(xdp_q, &eth->dummy_dev, id, 1574 + eth->rx_napi.napi_id, PAGE_SIZE); 1575 1575 if (err < 0) 1576 1576 goto err_free_pp; 1577 1577 ··· 1870 1870 1871 1871 while (done < budget) { 1872 1872 unsigned int pktlen, *rxdcsum; 1873 + bool has_hwaccel_tag = false; 1873 1874 struct net_device *netdev; 1875 + u16 vlan_proto, vlan_tci; 1874 1876 dma_addr_t dma_addr; 1875 1877 u32 hash, reason; 1876 1878 int mac = 0; ··· 2012 2010 2013 2011 if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) { 2014 2012 if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { 2015 - if (trxd.rxd3 & RX_DMA_VTAG_V2) 2016 - __vlan_hwaccel_put_tag(skb, 2017 - htons(RX_DMA_VPID(trxd.rxd4)), 2018 - RX_DMA_VID(trxd.rxd4)); 2013 + if (trxd.rxd3 & RX_DMA_VTAG_V2) { 2014 + vlan_proto = RX_DMA_VPID(trxd.rxd4); 2015 + vlan_tci = RX_DMA_VID(trxd.rxd4); 2016 + has_hwaccel_tag = true; 2017 + } 2019 2018 } else if (trxd.rxd2 & RX_DMA_VTAG) { 2020 - __vlan_hwaccel_put_tag(skb, htons(RX_DMA_VPID(trxd.rxd3)), 2021 - RX_DMA_VID(trxd.rxd3)); 2019 + vlan_proto = RX_DMA_VPID(trxd.rxd3); 2020 + vlan_tci = RX_DMA_VID(trxd.rxd3); 2021 + has_hwaccel_tag = true; 2022 2022 } 2023 2023 } 2024 2024 2025 2025 /* When using VLAN untagging in combination with DSA, the 2026 2026 * hardware treats the MTK special tag as a VLAN and untags it. 2027 2027 */ 2028 - if (skb_vlan_tag_present(skb) && netdev_uses_dsa(netdev)) { 2029 - unsigned int port = ntohs(skb->vlan_proto) & GENMASK(2, 0); 2028 + if (has_hwaccel_tag && netdev_uses_dsa(netdev)) { 2029 + unsigned int port = vlan_proto & GENMASK(2, 0); 2030 2030 2031 2031 if (port < ARRAY_SIZE(eth->dsa_meta) && 2032 2032 eth->dsa_meta[port]) 2033 2033 skb_dst_set_noref(skb, &eth->dsa_meta[port]->dst); 2034 - 2035 - __vlan_hwaccel_clear_tag(skb); 2034 + } else if (has_hwaccel_tag) { 2035 + __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci); 2036 2036 } 2037 2037 2038 2038 skb_record_rx_queue(skb, 0); ··· 3115 3111 3116 3112 val |= config; 3117 3113 3118 - if (!i && eth->netdev[0] && netdev_uses_dsa(eth->netdev[0])) 3114 + if (eth->netdev[i] && netdev_uses_dsa(eth->netdev[i])) 3119 3115 val |= MTK_GDMA_SPECIAL_TAG; 3120 3116 3121 3117 mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i)); ··· 3181 3177 struct mtk_eth *eth = mac->hw; 3182 3178 int i, err; 3183 3179 3184 - if ((mtk_uses_dsa(dev) && !eth->prog) && 3185 - !(mac->id == 1 && MTK_HAS_CAPS(eth->soc->caps, MTK_GMAC1_TRGMII))) { 3180 + if (mtk_uses_dsa(dev) && !eth->prog) { 3186 3181 for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) { 3187 3182 struct metadata_dst *md_dst = eth->dsa_meta[i]; 3188 3183 ··· 3198 3195 } 3199 3196 } else { 3200 3197 /* Hardware special tag parsing needs to be disabled if at least 3201 - * one MAC does not use DSA, or the second MAC of the MT7621 and 3202 - * MT7623 SoCs is being used. 3198 + * one MAC does not use DSA. 3203 3199 */ 3204 3200 u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL); 3205 3201 val &= ~MTK_CDMP_STAG_EN;
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
··· 245 245 pages = dev->priv.dbg.pages_debugfs; 246 246 247 247 debugfs_create_u32("fw_pages_total", 0400, pages, &dev->priv.fw_pages); 248 - debugfs_create_u32("fw_pages_vfs", 0400, pages, &dev->priv.vfs_pages); 249 - debugfs_create_u32("fw_pages_host_pf", 0400, pages, &dev->priv.host_pf_pages); 248 + debugfs_create_u32("fw_pages_vfs", 0400, pages, &dev->priv.page_counters[MLX5_VF]); 249 + debugfs_create_u32("fw_pages_sfs", 0400, pages, &dev->priv.page_counters[MLX5_SF]); 250 + debugfs_create_u32("fw_pages_host_pf", 0400, pages, &dev->priv.page_counters[MLX5_HOST_PF]); 250 251 debugfs_create_u32("fw_pages_alloc_failed", 0400, pages, &dev->priv.fw_pages_alloc_failed); 251 252 debugfs_create_u32("fw_pages_give_dropped", 0400, pages, &dev->priv.give_pages_dropped); 252 253 debugfs_create_u32("fw_pages_reclaim_discard", 0400, pages,
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
··· 64 64 MLX5_GET(mtrc_cap, out, num_string_trace); 65 65 tracer->str_db.num_string_db = MLX5_GET(mtrc_cap, out, num_string_db); 66 66 tracer->owner = !!MLX5_GET(mtrc_cap, out, trace_owner); 67 + tracer->str_db.loaded = false; 67 68 68 69 for (i = 0; i < tracer->str_db.num_string_db; i++) { 69 70 mtrc_cap_sp = MLX5_ADDR_OF(mtrc_cap, out, string_db_param[i]); ··· 757 756 if (err) 758 757 mlx5_core_warn(dev, "FWTracer: Failed to set tracer configurations %d\n", err); 759 758 759 + tracer->buff.consumer_index = 0; 760 760 return err; 761 761 } 762 762 ··· 822 820 mlx5_core_dbg(tracer->dev, "FWTracer: ownership changed, current=(%d)\n", tracer->owner); 823 821 if (tracer->owner) { 824 822 tracer->owner = false; 825 - tracer->buff.consumer_index = 0; 826 823 return; 827 824 } 828 825
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/ecpf.c
··· 87 87 88 88 mlx5_host_pf_cleanup(dev); 89 89 90 - err = mlx5_wait_for_pages(dev, &dev->priv.host_pf_pages); 90 + err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_HOST_PF]); 91 91 if (err) 92 92 mlx5_core_warn(dev, "Timeout reclaiming external host PF pages err(%d)\n", err); 93 93 }
-4
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
··· 438 438 439 439 switch (event) { 440 440 case SWITCHDEV_FDB_ADD_TO_BRIDGE: 441 - /* only handle the event on native eswtich of representor */ 442 - if (!mlx5_esw_bridge_is_local(dev, rep, esw)) 443 - break; 444 - 445 441 fdb_info = container_of(info, 446 442 struct switchdev_notifier_fdb_info, 447 443 info);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
··· 443 443 444 444 void mlx5e_disable_cvlan_filter(struct mlx5e_flow_steering *fs, bool promisc) 445 445 { 446 - if (fs->vlan->cvlan_filter_disabled) 446 + if (!fs->vlan || fs->vlan->cvlan_filter_disabled) 447 447 return; 448 448 449 449 fs->vlan->cvlan_filter_disabled = true;
+19 -71
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 591 591 rq->ix = c->ix; 592 592 rq->channel = c; 593 593 rq->mdev = mdev; 594 - rq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu); 594 + rq->hw_mtu = 595 + MLX5E_SW2HW_MTU(params, params->sw_mtu) - ETH_FCS_LEN * !params->scatter_fcs_en; 595 596 rq->xdpsq = &c->rq_xdpsq; 596 597 rq->stats = &c->priv->channel_stats[c->ix]->rq; 597 598 rq->ptp_cyc2time = mlx5_rq_ts_translator(mdev); ··· 1013 1012 mlx5e_free_rx_descs(rq); 1014 1013 1015 1014 return mlx5e_rq_to_ready(rq, curr_state); 1016 - } 1017 - 1018 - static int mlx5e_modify_rq_scatter_fcs(struct mlx5e_rq *rq, bool enable) 1019 - { 1020 - struct mlx5_core_dev *mdev = rq->mdev; 1021 - 1022 - void *in; 1023 - void *rqc; 1024 - int inlen; 1025 - int err; 1026 - 1027 - inlen = MLX5_ST_SZ_BYTES(modify_rq_in); 1028 - in = kvzalloc(inlen, GFP_KERNEL); 1029 - if (!in) 1030 - return -ENOMEM; 1031 - 1032 - rqc = MLX5_ADDR_OF(modify_rq_in, in, ctx); 1033 - 1034 - MLX5_SET(modify_rq_in, in, rq_state, MLX5_RQC_STATE_RDY); 1035 - MLX5_SET64(modify_rq_in, in, modify_bitmask, 1036 - MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_SCATTER_FCS); 1037 - MLX5_SET(rqc, rqc, scatter_fcs, enable); 1038 - MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RDY); 1039 - 1040 - err = mlx5_core_modify_rq(mdev, rq->rqn, in); 1041 - 1042 - kvfree(in); 1043 - 1044 - return err; 1045 1015 } 1046 1016 1047 1017 static int mlx5e_modify_rq_vsd(struct mlx5e_rq *rq, bool vsd) ··· 3286 3314 mlx5e_destroy_tises(priv); 3287 3315 } 3288 3316 3289 - static int mlx5e_modify_channels_scatter_fcs(struct mlx5e_channels *chs, bool enable) 3290 - { 3291 - int err = 0; 3292 - int i; 3293 - 3294 - for (i = 0; i < chs->num; i++) { 3295 - err = mlx5e_modify_rq_scatter_fcs(&chs->c[i]->rq, enable); 3296 - if (err) 3297 - return err; 3298 - } 3299 - 3300 - return 0; 3301 - } 3302 - 3303 3317 static int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd) 3304 3318 { 3305 3319 int err; ··· 3861 3903 return mlx5_set_ports_check(mdev, in, sizeof(in)); 3862 3904 } 3863 3905 3906 + static int mlx5e_set_rx_port_ts_wrap(struct mlx5e_priv *priv, void *ctx) 3907 + { 3908 + struct mlx5_core_dev *mdev = priv->mdev; 3909 + bool enable = *(bool *)ctx; 3910 + 3911 + return mlx5e_set_rx_port_ts(mdev, enable); 3912 + } 3913 + 3864 3914 static int set_feature_rx_fcs(struct net_device *netdev, bool enable) 3865 3915 { 3866 3916 struct mlx5e_priv *priv = netdev_priv(netdev); 3867 3917 struct mlx5e_channels *chs = &priv->channels; 3868 - struct mlx5_core_dev *mdev = priv->mdev; 3918 + struct mlx5e_params new_params; 3869 3919 int err; 3870 3920 3871 3921 mutex_lock(&priv->state_lock); 3872 3922 3873 - if (enable) { 3874 - err = mlx5e_set_rx_port_ts(mdev, false); 3875 - if (err) 3876 - goto out; 3877 - 3878 - chs->params.scatter_fcs_en = true; 3879 - err = mlx5e_modify_channels_scatter_fcs(chs, true); 3880 - if (err) { 3881 - chs->params.scatter_fcs_en = false; 3882 - mlx5e_set_rx_port_ts(mdev, true); 3883 - } 3884 - } else { 3885 - chs->params.scatter_fcs_en = false; 3886 - err = mlx5e_modify_channels_scatter_fcs(chs, false); 3887 - if (err) { 3888 - chs->params.scatter_fcs_en = true; 3889 - goto out; 3890 - } 3891 - err = mlx5e_set_rx_port_ts(mdev, true); 3892 - if (err) { 3893 - mlx5_core_warn(mdev, "Failed to set RX port timestamp %d\n", err); 3894 - err = 0; 3895 - } 3896 - } 3897 - 3898 - out: 3923 + new_params = chs->params; 3924 + new_params.scatter_fcs_en = enable; 3925 + err = mlx5e_safe_switch_params(priv, &new_params, mlx5e_set_rx_port_ts_wrap, 3926 + &new_params.scatter_fcs_en, true); 3899 3927 mutex_unlock(&priv->state_lock); 3900 3928 return err; 3901 3929 } ··· 4017 4073 features &= ~NETIF_F_GRO_HW; 4018 4074 if (netdev->features & NETIF_F_GRO_HW) 4019 4075 netdev_warn(netdev, "Disabling HW_GRO, not supported in switchdev mode\n"); 4076 + 4077 + features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; 4078 + if (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER) 4079 + netdev_warn(netdev, "Disabling HW_VLAN CTAG FILTERING, not supported in switchdev mode\n"); 4020 4080 4021 4081 return features; 4022 4082 }
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
··· 1715 1715 struct mlx5_esw_bridge *bridge; 1716 1716 1717 1717 port = mlx5_esw_bridge_port_lookup(vport_num, esw_owner_vhca_id, br_offloads); 1718 - if (!port || port->flags & MLX5_ESW_BRIDGE_PORT_FLAG_PEER) 1718 + if (!port) 1719 1719 return; 1720 1720 1721 1721 bridge = port->bridge;
+5 -8
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
··· 189 189 } 190 190 } 191 191 192 - static int mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper) 192 + static u32 mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper) 193 193 { 194 194 int rate, width; 195 195 196 196 rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper); 197 197 if (rate < 0) 198 - return -EINVAL; 198 + return SPEED_UNKNOWN; 199 199 width = mlx5_ptys_width_enum_to_int(ib_link_width_oper); 200 200 if (width < 0) 201 - return -EINVAL; 201 + return SPEED_UNKNOWN; 202 202 203 203 return rate * width; 204 204 } ··· 221 221 ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); 222 222 223 223 speed = mlx5i_get_speed_settings(ib_link_width_oper, ib_proto_oper); 224 - if (speed < 0) 225 - return -EINVAL; 224 + link_ksettings->base.speed = speed; 225 + link_ksettings->base.duplex = speed == SPEED_UNKNOWN ? DUPLEX_UNKNOWN : DUPLEX_FULL; 226 226 227 - link_ksettings->base.duplex = DUPLEX_FULL; 228 227 link_ksettings->base.port = PORT_OTHER; 229 228 230 229 link_ksettings->base.autoneg = AUTONEG_DISABLE; 231 - 232 - link_ksettings->base.speed = speed; 233 230 234 231 return 0; 235 232 }
+7 -7
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 2110 2110 mlx5_core_verify_params(); 2111 2111 mlx5_register_debugfs(); 2112 2112 2113 - err = pci_register_driver(&mlx5_core_driver); 2113 + err = mlx5e_init(); 2114 2114 if (err) 2115 2115 goto err_debug; 2116 2116 ··· 2118 2118 if (err) 2119 2119 goto err_sf; 2120 2120 2121 - err = mlx5e_init(); 2121 + err = pci_register_driver(&mlx5_core_driver); 2122 2122 if (err) 2123 - goto err_en; 2123 + goto err_pci; 2124 2124 2125 2125 return 0; 2126 2126 2127 - err_en: 2127 + err_pci: 2128 2128 mlx5_sf_driver_unregister(); 2129 2129 err_sf: 2130 - pci_unregister_driver(&mlx5_core_driver); 2130 + mlx5e_cleanup(); 2131 2131 err_debug: 2132 2132 mlx5_unregister_debugfs(); 2133 2133 return err; ··· 2135 2135 2136 2136 static void __exit mlx5_cleanup(void) 2137 2137 { 2138 - mlx5e_cleanup(); 2139 - mlx5_sf_driver_unregister(); 2140 2138 pci_unregister_driver(&mlx5_core_driver); 2139 + mlx5_sf_driver_unregister(); 2140 + mlx5e_cleanup(); 2141 2141 mlx5_unregister_debugfs(); 2142 2142 } 2143 2143
+21 -16
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
··· 74 74 return (u32)func_id | (ec_function << 16); 75 75 } 76 76 77 + static u16 func_id_to_type(struct mlx5_core_dev *dev, u16 func_id, bool ec_function) 78 + { 79 + if (!func_id) 80 + return mlx5_core_is_ecpf(dev) && !ec_function ? MLX5_HOST_PF : MLX5_PF; 81 + 82 + return func_id <= mlx5_core_max_vfs(dev) ? MLX5_VF : MLX5_SF; 83 + } 84 + 77 85 static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function) 78 86 { 79 87 struct rb_root *root; ··· 340 332 u32 out[MLX5_ST_SZ_DW(manage_pages_out)] = {0}; 341 333 int inlen = MLX5_ST_SZ_BYTES(manage_pages_in); 342 334 int notify_fail = event; 335 + u16 func_type; 343 336 u64 addr; 344 337 int err; 345 338 u32 *in; ··· 392 383 goto out_dropped; 393 384 } 394 385 386 + func_type = func_id_to_type(dev, func_id, ec_function); 387 + dev->priv.page_counters[func_type] += npages; 395 388 dev->priv.fw_pages += npages; 396 - if (func_id) 397 - dev->priv.vfs_pages += npages; 398 - else if (mlx5_core_is_ecpf(dev) && !ec_function) 399 - dev->priv.host_pf_pages += npages; 400 389 401 390 mlx5_core_dbg(dev, "npages %d, ec_function %d, func_id 0x%x, err %d\n", 402 391 npages, ec_function, func_id, err); ··· 421 414 struct rb_root *root; 422 415 struct rb_node *p; 423 416 int npages = 0; 417 + u16 func_type; 424 418 425 419 root = xa_load(&dev->priv.page_root_xa, function); 426 420 if (WARN_ON_ONCE(!root)) ··· 436 428 free_fwp(dev, fwp, fwp->free_count); 437 429 } 438 430 431 + func_type = func_id_to_type(dev, func_id, ec_function); 432 + dev->priv.page_counters[func_type] -= npages; 439 433 dev->priv.fw_pages -= npages; 440 - if (func_id) 441 - dev->priv.vfs_pages -= npages; 442 - else if (mlx5_core_is_ecpf(dev) && !ec_function) 443 - dev->priv.host_pf_pages -= npages; 444 434 445 435 mlx5_core_dbg(dev, "npages %d, ec_function %d, func_id 0x%x\n", 446 436 npages, ec_function, func_id); ··· 504 498 int outlen = MLX5_ST_SZ_BYTES(manage_pages_out); 505 499 u32 in[MLX5_ST_SZ_DW(manage_pages_in)] = {}; 506 500 int num_claimed; 501 + u16 func_type; 507 502 u32 *out; 508 503 int err; 509 504 int i; ··· 556 549 if (nclaimed) 557 550 *nclaimed = num_claimed; 558 551 552 + func_type = func_id_to_type(dev, func_id, ec_function); 553 + dev->priv.page_counters[func_type] -= num_claimed; 559 554 dev->priv.fw_pages -= num_claimed; 560 - if (func_id) 561 - dev->priv.vfs_pages -= num_claimed; 562 - else if (mlx5_core_is_ecpf(dev) && !ec_function) 563 - dev->priv.host_pf_pages -= num_claimed; 564 555 565 556 out_free: 566 557 kvfree(out); ··· 711 706 WARN(dev->priv.fw_pages, 712 707 "FW pages counter is %d after reclaiming all pages\n", 713 708 dev->priv.fw_pages); 714 - WARN(dev->priv.vfs_pages, 709 + WARN(dev->priv.page_counters[MLX5_VF], 715 710 "VFs FW pages counter is %d after reclaiming all pages\n", 716 - dev->priv.vfs_pages); 717 - WARN(dev->priv.host_pf_pages, 711 + dev->priv.page_counters[MLX5_VF]); 712 + WARN(dev->priv.page_counters[MLX5_HOST_PF], 718 713 "External host PF FW pages counter is %d after reclaiming all pages\n", 719 - dev->priv.host_pf_pages); 714 + dev->priv.page_counters[MLX5_HOST_PF]); 720 715 721 716 return 0; 722 717 }
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/sriov.c
··· 147 147 148 148 mlx5_eswitch_disable_sriov(dev->priv.eswitch, clear_vf); 149 149 150 - if (mlx5_wait_for_pages(dev, &dev->priv.vfs_pages)) 150 + if (mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_VF])) 151 151 mlx5_core_warn(dev, "timeout reclaiming VFs pages\n"); 152 152 } 153 153
+15 -10
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
··· 1138 1138 rule->flow_source)) 1139 1139 return 0; 1140 1140 1141 + mlx5dr_domain_nic_lock(nic_dmn); 1142 + 1141 1143 ret = mlx5dr_matcher_select_builders(matcher, 1142 1144 nic_matcher, 1143 1145 dr_rule_get_ipv(&param->outer), 1144 1146 dr_rule_get_ipv(&param->inner)); 1145 1147 if (ret) 1146 - return ret; 1148 + goto err_unlock; 1147 1149 1148 1150 hw_ste_arr_is_opt = nic_matcher->num_of_builders <= DR_RULE_MAX_STES_OPTIMIZED; 1149 1151 if (likely(hw_ste_arr_is_opt)) { ··· 1154 1152 hw_ste_arr = kzalloc((nic_matcher->num_of_builders + DR_ACTION_MAX_STES) * 1155 1153 DR_STE_SIZE, GFP_KERNEL); 1156 1154 1157 - if (!hw_ste_arr) 1158 - return -ENOMEM; 1155 + if (!hw_ste_arr) { 1156 + ret = -ENOMEM; 1157 + goto err_unlock; 1158 + } 1159 1159 } 1160 - 1161 - mlx5dr_domain_nic_lock(nic_dmn); 1162 1160 1163 1161 ret = mlx5dr_matcher_add_to_tbl_nic(dmn, nic_matcher); 1164 1162 if (ret) ··· 1225 1223 1226 1224 mlx5dr_domain_nic_unlock(nic_dmn); 1227 1225 1228 - goto out; 1226 + if (unlikely(!hw_ste_arr_is_opt)) 1227 + kfree(hw_ste_arr); 1228 + 1229 + return 0; 1229 1230 1230 1231 free_rule: 1231 1232 dr_rule_clean_rule_members(rule, nic_rule); ··· 1243 1238 mlx5dr_matcher_remove_from_tbl_nic(dmn, nic_matcher); 1244 1239 1245 1240 free_hw_ste: 1246 - mlx5dr_domain_nic_unlock(nic_dmn); 1247 - 1248 - out: 1249 - if (unlikely(!hw_ste_arr_is_opt)) 1241 + if (!hw_ste_arr_is_opt) 1250 1242 kfree(hw_ste_arr); 1243 + 1244 + err_unlock: 1245 + mlx5dr_domain_nic_unlock(nic_dmn); 1251 1246 1252 1247 return ret; 1253 1248 }
+2 -2
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
··· 633 633 /* Enable master counters */ 634 634 spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0x7), sparx5, PTP_PTP_DOM_CFG); 635 635 636 - for (i = 0; i < sparx5->port_count; i++) { 636 + for (i = 0; i < SPX5_PORTS; i++) { 637 637 port = sparx5->ports[i]; 638 638 if (!port) 639 639 continue; ··· 649 649 struct sparx5_port *port; 650 650 int i; 651 651 652 - for (i = 0; i < sparx5->port_count; i++) { 652 + for (i = 0; i < SPX5_PORTS; i++) { 653 653 port = sparx5->ports[i]; 654 654 if (!port) 655 655 continue;
+11 -26
drivers/net/ethernet/microsoft/mana/gdma_main.c
··· 1217 1217 unsigned int max_queues_per_port = num_online_cpus(); 1218 1218 struct gdma_context *gc = pci_get_drvdata(pdev); 1219 1219 struct gdma_irq_context *gic; 1220 - unsigned int max_irqs; 1221 - u16 *cpus; 1222 - cpumask_var_t req_mask; 1220 + unsigned int max_irqs, cpu; 1223 1221 int nvec, irq; 1224 1222 int err, i = 0, j; 1225 1223 ··· 1238 1240 goto free_irq_vector; 1239 1241 } 1240 1242 1241 - if (!zalloc_cpumask_var(&req_mask, GFP_KERNEL)) { 1242 - err = -ENOMEM; 1243 - goto free_irq; 1244 - } 1245 - 1246 - cpus = kcalloc(nvec, sizeof(*cpus), GFP_KERNEL); 1247 - if (!cpus) { 1248 - err = -ENOMEM; 1249 - goto free_mask; 1250 - } 1251 - for (i = 0; i < nvec; i++) 1252 - cpus[i] = cpumask_local_spread(i, gc->numa_node); 1253 - 1254 1243 for (i = 0; i < nvec; i++) { 1255 - cpumask_set_cpu(cpus[i], req_mask); 1256 1244 gic = &gc->irq_contexts[i]; 1257 1245 gic->handler = NULL; 1258 1246 gic->arg = NULL; ··· 1253 1269 irq = pci_irq_vector(pdev, i); 1254 1270 if (irq < 0) { 1255 1271 err = irq; 1256 - goto free_mask; 1272 + goto free_irq; 1257 1273 } 1258 1274 1259 1275 err = request_irq(irq, mana_gd_intr, 0, gic->name, gic); 1260 1276 if (err) 1261 - goto free_mask; 1262 - irq_set_affinity_and_hint(irq, req_mask); 1263 - cpumask_clear(req_mask); 1277 + goto free_irq; 1278 + 1279 + cpu = cpumask_local_spread(i, gc->numa_node); 1280 + irq_set_affinity_and_hint(irq, cpumask_of(cpu)); 1264 1281 } 1265 - free_cpumask_var(req_mask); 1266 - kfree(cpus); 1267 1282 1268 1283 err = mana_gd_alloc_res_map(nvec, &gc->msix_resource); 1269 1284 if (err) ··· 1273 1290 1274 1291 return 0; 1275 1292 1276 - free_mask: 1277 - free_cpumask_var(req_mask); 1278 - kfree(cpus); 1279 1293 free_irq: 1280 1294 for (j = i - 1; j >= 0; j--) { 1281 1295 irq = pci_irq_vector(pdev, j); 1282 1296 gic = &gc->irq_contexts[j]; 1297 + 1298 + irq_update_affinity_hint(irq, NULL); 1283 1299 free_irq(irq, gic); 1284 1300 } 1285 1301 ··· 1306 1324 continue; 1307 1325 1308 1326 gic = &gc->irq_contexts[i]; 1327 + 1328 + /* Need to clear the hint before free_irq */ 1329 + irq_update_affinity_hint(irq, NULL); 1309 1330 free_irq(irq, gic); 1310 1331 } 1311 1332
+12 -12
drivers/net/ethernet/mscc/ocelot_flower.c
··· 605 605 flow_rule_match_control(rule, &match); 606 606 } 607 607 608 + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) { 609 + struct flow_match_vlan match; 610 + 611 + flow_rule_match_vlan(rule, &match); 612 + filter->key_type = OCELOT_VCAP_KEY_ANY; 613 + filter->vlan.vid.value = match.key->vlan_id; 614 + filter->vlan.vid.mask = match.mask->vlan_id; 615 + filter->vlan.pcp.value[0] = match.key->vlan_priority; 616 + filter->vlan.pcp.mask[0] = match.mask->vlan_priority; 617 + match_protocol = false; 618 + } 619 + 608 620 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { 609 621 struct flow_match_eth_addrs match; 610 622 ··· 746 734 filter->key.ipv4.sport.mask = ntohs(match.mask->src); 747 735 filter->key.ipv4.dport.value = ntohs(match.key->dst); 748 736 filter->key.ipv4.dport.mask = ntohs(match.mask->dst); 749 - match_protocol = false; 750 - } 751 - 752 - if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) { 753 - struct flow_match_vlan match; 754 - 755 - flow_rule_match_vlan(rule, &match); 756 - filter->key_type = OCELOT_VCAP_KEY_ANY; 757 - filter->vlan.vid.value = match.key->vlan_id; 758 - filter->vlan.vid.mask = match.mask->vlan_id; 759 - filter->vlan.pcp.value[0] = match.key->vlan_priority; 760 - filter->vlan.pcp.mask[0] = match.mask->vlan_priority; 761 737 match_protocol = false; 762 738 } 763 739
+4 -4
drivers/net/ethernet/mscc/ocelot_ptp.c
··· 335 335 ocelot_populate_ipv6_ptp_event_trap_key(struct ocelot_vcap_filter *trap) 336 336 { 337 337 trap->key_type = OCELOT_VCAP_KEY_IPV6; 338 - trap->key.ipv4.proto.value[0] = IPPROTO_UDP; 339 - trap->key.ipv4.proto.mask[0] = 0xff; 338 + trap->key.ipv6.proto.value[0] = IPPROTO_UDP; 339 + trap->key.ipv6.proto.mask[0] = 0xff; 340 340 trap->key.ipv6.dport.value = PTP_EV_PORT; 341 341 trap->key.ipv6.dport.mask = 0xffff; 342 342 } ··· 355 355 ocelot_populate_ipv6_ptp_general_trap_key(struct ocelot_vcap_filter *trap) 356 356 { 357 357 trap->key_type = OCELOT_VCAP_KEY_IPV6; 358 - trap->key.ipv4.proto.value[0] = IPPROTO_UDP; 359 - trap->key.ipv4.proto.mask[0] = 0xff; 358 + trap->key.ipv6.proto.value[0] = IPPROTO_UDP; 359 + trap->key.ipv6.proto.mask[0] = 0xff; 360 360 trap->key.ipv6.dport.value = PTP_GEN_PORT; 361 361 trap->key.ipv6.dport.mask = 0xffff; 362 362 }
+158 -36
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
··· 293 293 } 294 294 } 295 295 296 - static const u16 nfp_eth_media_table[] = { 297 - [NFP_MEDIA_1000BASE_CX] = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, 298 - [NFP_MEDIA_1000BASE_KX] = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, 299 - [NFP_MEDIA_10GBASE_KX4] = ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, 300 - [NFP_MEDIA_10GBASE_KR] = ETHTOOL_LINK_MODE_10000baseKR_Full_BIT, 301 - [NFP_MEDIA_10GBASE_CX4] = ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, 302 - [NFP_MEDIA_10GBASE_CR] = ETHTOOL_LINK_MODE_10000baseCR_Full_BIT, 303 - [NFP_MEDIA_10GBASE_SR] = ETHTOOL_LINK_MODE_10000baseSR_Full_BIT, 304 - [NFP_MEDIA_10GBASE_ER] = ETHTOOL_LINK_MODE_10000baseER_Full_BIT, 305 - [NFP_MEDIA_25GBASE_KR] = ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, 306 - [NFP_MEDIA_25GBASE_KR_S] = ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, 307 - [NFP_MEDIA_25GBASE_CR] = ETHTOOL_LINK_MODE_25000baseCR_Full_BIT, 308 - [NFP_MEDIA_25GBASE_CR_S] = ETHTOOL_LINK_MODE_25000baseCR_Full_BIT, 309 - [NFP_MEDIA_25GBASE_SR] = ETHTOOL_LINK_MODE_25000baseSR_Full_BIT, 310 - [NFP_MEDIA_40GBASE_CR4] = ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT, 311 - [NFP_MEDIA_40GBASE_KR4] = ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT, 312 - [NFP_MEDIA_40GBASE_SR4] = ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT, 313 - [NFP_MEDIA_40GBASE_LR4] = ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT, 314 - [NFP_MEDIA_50GBASE_KR] = ETHTOOL_LINK_MODE_50000baseKR_Full_BIT, 315 - [NFP_MEDIA_50GBASE_SR] = ETHTOOL_LINK_MODE_50000baseSR_Full_BIT, 316 - [NFP_MEDIA_50GBASE_CR] = ETHTOOL_LINK_MODE_50000baseCR_Full_BIT, 317 - [NFP_MEDIA_50GBASE_LR] = ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT, 318 - [NFP_MEDIA_50GBASE_ER] = ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT, 319 - [NFP_MEDIA_50GBASE_FR] = ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT, 320 - [NFP_MEDIA_100GBASE_KR4] = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, 321 - [NFP_MEDIA_100GBASE_SR4] = ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT, 322 - [NFP_MEDIA_100GBASE_CR4] = ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, 323 - [NFP_MEDIA_100GBASE_KP4] = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, 324 - [NFP_MEDIA_100GBASE_CR10] = ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, 296 + static const struct nfp_eth_media_link_mode { 297 + u16 ethtool_link_mode; 298 + u16 speed; 299 + } nfp_eth_media_table[NFP_MEDIA_LINK_MODES_NUMBER] = { 300 + [NFP_MEDIA_1000BASE_CX] = { 301 + .ethtool_link_mode = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, 302 + .speed = NFP_SPEED_1G, 303 + }, 304 + [NFP_MEDIA_1000BASE_KX] = { 305 + .ethtool_link_mode = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, 306 + .speed = NFP_SPEED_1G, 307 + }, 308 + [NFP_MEDIA_10GBASE_KX4] = { 309 + .ethtool_link_mode = ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, 310 + .speed = NFP_SPEED_10G, 311 + }, 312 + [NFP_MEDIA_10GBASE_KR] = { 313 + .ethtool_link_mode = ETHTOOL_LINK_MODE_10000baseKR_Full_BIT, 314 + .speed = NFP_SPEED_10G, 315 + }, 316 + [NFP_MEDIA_10GBASE_CX4] = { 317 + .ethtool_link_mode = ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, 318 + .speed = NFP_SPEED_10G, 319 + }, 320 + [NFP_MEDIA_10GBASE_CR] = { 321 + .ethtool_link_mode = ETHTOOL_LINK_MODE_10000baseCR_Full_BIT, 322 + .speed = NFP_SPEED_10G, 323 + }, 324 + [NFP_MEDIA_10GBASE_SR] = { 325 + .ethtool_link_mode = ETHTOOL_LINK_MODE_10000baseSR_Full_BIT, 326 + .speed = NFP_SPEED_10G, 327 + }, 328 + [NFP_MEDIA_10GBASE_ER] = { 329 + .ethtool_link_mode = ETHTOOL_LINK_MODE_10000baseER_Full_BIT, 330 + .speed = NFP_SPEED_10G, 331 + }, 332 + [NFP_MEDIA_25GBASE_KR] = { 333 + .ethtool_link_mode = ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, 334 + .speed = NFP_SPEED_25G, 335 + }, 336 + [NFP_MEDIA_25GBASE_KR_S] = { 337 + .ethtool_link_mode = ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, 338 + .speed = NFP_SPEED_25G, 339 + }, 340 + [NFP_MEDIA_25GBASE_CR] = { 341 + .ethtool_link_mode = ETHTOOL_LINK_MODE_25000baseCR_Full_BIT, 342 + .speed = NFP_SPEED_25G, 343 + }, 344 + [NFP_MEDIA_25GBASE_CR_S] = { 345 + .ethtool_link_mode = ETHTOOL_LINK_MODE_25000baseCR_Full_BIT, 346 + .speed = NFP_SPEED_25G, 347 + }, 348 + [NFP_MEDIA_25GBASE_SR] = { 349 + .ethtool_link_mode = ETHTOOL_LINK_MODE_25000baseSR_Full_BIT, 350 + .speed = NFP_SPEED_25G, 351 + }, 352 + [NFP_MEDIA_40GBASE_CR4] = { 353 + .ethtool_link_mode = ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT, 354 + .speed = NFP_SPEED_40G, 355 + }, 356 + [NFP_MEDIA_40GBASE_KR4] = { 357 + .ethtool_link_mode = ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT, 358 + .speed = NFP_SPEED_40G, 359 + }, 360 + [NFP_MEDIA_40GBASE_SR4] = { 361 + .ethtool_link_mode = ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT, 362 + .speed = NFP_SPEED_40G, 363 + }, 364 + [NFP_MEDIA_40GBASE_LR4] = { 365 + .ethtool_link_mode = ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT, 366 + .speed = NFP_SPEED_40G, 367 + }, 368 + [NFP_MEDIA_50GBASE_KR] = { 369 + .ethtool_link_mode = ETHTOOL_LINK_MODE_50000baseKR_Full_BIT, 370 + .speed = NFP_SPEED_50G, 371 + }, 372 + [NFP_MEDIA_50GBASE_SR] = { 373 + .ethtool_link_mode = ETHTOOL_LINK_MODE_50000baseSR_Full_BIT, 374 + .speed = NFP_SPEED_50G, 375 + }, 376 + [NFP_MEDIA_50GBASE_CR] = { 377 + .ethtool_link_mode = ETHTOOL_LINK_MODE_50000baseCR_Full_BIT, 378 + .speed = NFP_SPEED_50G, 379 + }, 380 + [NFP_MEDIA_50GBASE_LR] = { 381 + .ethtool_link_mode = ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT, 382 + .speed = NFP_SPEED_50G, 383 + }, 384 + [NFP_MEDIA_50GBASE_ER] = { 385 + .ethtool_link_mode = ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT, 386 + .speed = NFP_SPEED_50G, 387 + }, 388 + [NFP_MEDIA_50GBASE_FR] = { 389 + .ethtool_link_mode = ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT, 390 + .speed = NFP_SPEED_50G, 391 + }, 392 + [NFP_MEDIA_100GBASE_KR4] = { 393 + .ethtool_link_mode = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, 394 + .speed = NFP_SPEED_100G, 395 + }, 396 + [NFP_MEDIA_100GBASE_SR4] = { 397 + .ethtool_link_mode = ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT, 398 + .speed = NFP_SPEED_100G, 399 + }, 400 + [NFP_MEDIA_100GBASE_CR4] = { 401 + .ethtool_link_mode = ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, 402 + .speed = NFP_SPEED_100G, 403 + }, 404 + [NFP_MEDIA_100GBASE_KP4] = { 405 + .ethtool_link_mode = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, 406 + .speed = NFP_SPEED_100G, 407 + }, 408 + [NFP_MEDIA_100GBASE_CR10] = { 409 + .ethtool_link_mode = ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, 410 + .speed = NFP_SPEED_100G, 411 + }, 412 + }; 413 + 414 + static const unsigned int nfp_eth_speed_map[NFP_SUP_SPEED_NUMBER] = { 415 + [NFP_SPEED_1G] = SPEED_1000, 416 + [NFP_SPEED_10G] = SPEED_10000, 417 + [NFP_SPEED_25G] = SPEED_25000, 418 + [NFP_SPEED_40G] = SPEED_40000, 419 + [NFP_SPEED_50G] = SPEED_50000, 420 + [NFP_SPEED_100G] = SPEED_100000, 325 421 }; 326 422 327 423 static void nfp_add_media_link_mode(struct nfp_port *port, ··· 430 334 }; 431 335 struct nfp_cpp *cpp = port->app->cpp; 432 336 433 - if (nfp_eth_read_media(cpp, &ethm)) 337 + if (nfp_eth_read_media(cpp, &ethm)) { 338 + bitmap_fill(port->speed_bitmap, NFP_SUP_SPEED_NUMBER); 434 339 return; 340 + } 341 + 342 + bitmap_zero(port->speed_bitmap, NFP_SUP_SPEED_NUMBER); 435 343 436 344 for (u32 i = 0; i < 2; i++) { 437 345 supported_modes[i] = le64_to_cpu(ethm.supported_modes[i]); ··· 444 344 445 345 for (u32 i = 0; i < NFP_MEDIA_LINK_MODES_NUMBER; i++) { 446 346 if (i < 64) { 447 - if (supported_modes[0] & BIT_ULL(i)) 448 - __set_bit(nfp_eth_media_table[i], 347 + if (supported_modes[0] & BIT_ULL(i)) { 348 + __set_bit(nfp_eth_media_table[i].ethtool_link_mode, 449 349 cmd->link_modes.supported); 350 + __set_bit(nfp_eth_media_table[i].speed, 351 + port->speed_bitmap); 352 + } 450 353 451 354 if (advertised_modes[0] & BIT_ULL(i)) 452 - __set_bit(nfp_eth_media_table[i], 355 + __set_bit(nfp_eth_media_table[i].ethtool_link_mode, 453 356 cmd->link_modes.advertising); 454 357 } else { 455 - if (supported_modes[1] & BIT_ULL(i - 64)) 456 - __set_bit(nfp_eth_media_table[i], 358 + if (supported_modes[1] & BIT_ULL(i - 64)) { 359 + __set_bit(nfp_eth_media_table[i].ethtool_link_mode, 457 360 cmd->link_modes.supported); 361 + __set_bit(nfp_eth_media_table[i].speed, 362 + port->speed_bitmap); 363 + } 458 364 459 365 if (advertised_modes[1] & BIT_ULL(i - 64)) 460 - __set_bit(nfp_eth_media_table[i], 366 + __set_bit(nfp_eth_media_table[i].ethtool_link_mode, 461 367 cmd->link_modes.advertising); 462 368 } 463 369 } ··· 574 468 575 469 if (cmd->base.speed != SPEED_UNKNOWN) { 576 470 u32 speed = cmd->base.speed / eth_port->lanes; 471 + bool is_supported = false; 472 + 473 + for (u32 i = 0; i < NFP_SUP_SPEED_NUMBER; i++) { 474 + if (cmd->base.speed == nfp_eth_speed_map[i] && 475 + test_bit(i, port->speed_bitmap)) { 476 + is_supported = true; 477 + break; 478 + } 479 + } 480 + 481 + if (!is_supported) { 482 + netdev_err(netdev, "Speed %u is not supported.\n", 483 + cmd->base.speed); 484 + err = -EINVAL; 485 + goto err_bad_set; 486 + } 577 487 578 488 if (req_aneg) { 579 489 netdev_err(netdev, "Speed changing is not allowed when working on autoneg mode.\n");
+12
drivers/net/ethernet/netronome/nfp/nfp_port.h
··· 38 38 NFP_PORT_CHANGED = 0, 39 39 }; 40 40 41 + enum { 42 + NFP_SPEED_1G, 43 + NFP_SPEED_10G, 44 + NFP_SPEED_25G, 45 + NFP_SPEED_40G, 46 + NFP_SPEED_50G, 47 + NFP_SPEED_100G, 48 + NFP_SUP_SPEED_NUMBER 49 + }; 50 + 41 51 /** 42 52 * struct nfp_port - structure representing NFP port 43 53 * @netdev: backpointer to associated netdev ··· 62 52 * @eth_forced: for %NFP_PORT_PHYS_PORT port is forced UP or DOWN, don't change 63 53 * @eth_port: for %NFP_PORT_PHYS_PORT translated ETH Table port entry 64 54 * @eth_stats: for %NFP_PORT_PHYS_PORT MAC stats if available 55 + * @speed_bitmap: for %NFP_PORT_PHYS_PORT supported speed bitmap 65 56 * @pf_id: for %NFP_PORT_PF_PORT, %NFP_PORT_VF_PORT ID of the PCI PF (0-3) 66 57 * @vf_id: for %NFP_PORT_VF_PORT ID of the PCI VF within @pf_id 67 58 * @pf_split: for %NFP_PORT_PF_PORT %true if PCI PF has more than one vNIC ··· 89 78 bool eth_forced; 90 79 struct nfp_eth_table_port *eth_port; 91 80 u8 __iomem *eth_stats; 81 + DECLARE_BITMAP(speed_bitmap, NFP_SUP_SPEED_NUMBER); 92 82 }; 93 83 /* NFP_PORT_PF_PORT, NFP_PORT_VF_PORT */ 94 84 struct {
+8 -1
drivers/net/ethernet/pensando/ionic/ionic_dev.c
··· 708 708 q->lif->index, q->name, q->hw_type, q->hw_index, 709 709 q->head_idx, ring_doorbell); 710 710 711 - if (ring_doorbell) 711 + if (ring_doorbell) { 712 712 ionic_dbell_ring(lif->kern_dbpage, q->hw_type, 713 713 q->dbval | q->head_idx); 714 + 715 + q->dbell_jiffies = jiffies; 716 + 717 + if (q_to_qcq(q)->napi_qcq) 718 + mod_timer(&q_to_qcq(q)->napi_qcq->napi_deadline, 719 + jiffies + IONIC_NAPI_DEADLINE); 720 + } 714 721 } 715 722 716 723 static bool ionic_q_is_posted(struct ionic_queue *q, unsigned int pos)
+12
drivers/net/ethernet/pensando/ionic/ionic_dev.h
··· 25 25 #define IONIC_DEV_INFO_REG_COUNT 32 26 26 #define IONIC_DEV_CMD_REG_COUNT 32 27 27 28 + #define IONIC_NAPI_DEADLINE (HZ / 200) /* 5ms */ 29 + #define IONIC_ADMIN_DOORBELL_DEADLINE (HZ / 2) /* 500ms */ 30 + #define IONIC_TX_DOORBELL_DEADLINE (HZ / 100) /* 10ms */ 31 + #define IONIC_RX_MIN_DOORBELL_DEADLINE (HZ / 100) /* 10ms */ 32 + #define IONIC_RX_MAX_DOORBELL_DEADLINE (HZ * 5) /* 5s */ 33 + 28 34 struct ionic_dev_bar { 29 35 void __iomem *vaddr; 30 36 phys_addr_t bus_addr; ··· 222 216 struct ionic_lif *lif; 223 217 struct ionic_desc_info *info; 224 218 u64 dbval; 219 + unsigned long dbell_deadline; 220 + unsigned long dbell_jiffies; 225 221 u16 head_idx; 226 222 u16 tail_idx; 227 223 unsigned int index; ··· 368 360 unsigned int stop_index); 369 361 int ionic_heartbeat_check(struct ionic *ionic); 370 362 bool ionic_is_fw_running(struct ionic_dev *idev); 363 + 364 + bool ionic_adminq_poke_doorbell(struct ionic_queue *q); 365 + bool ionic_txq_poke_doorbell(struct ionic_queue *q); 366 + bool ionic_rxq_poke_doorbell(struct ionic_queue *q); 371 367 372 368 #endif /* _IONIC_DEV_H_ */
+59 -9
drivers/net/ethernet/pensando/ionic/ionic_lif.c
··· 16 16 17 17 #include "ionic.h" 18 18 #include "ionic_bus.h" 19 + #include "ionic_dev.h" 19 20 #include "ionic_lif.h" 20 21 #include "ionic_txrx.h" 21 22 #include "ionic_ethtool.h" ··· 201 200 } 202 201 } 203 202 203 + static void ionic_napi_deadline(struct timer_list *timer) 204 + { 205 + struct ionic_qcq *qcq = container_of(timer, struct ionic_qcq, napi_deadline); 206 + 207 + napi_schedule(&qcq->napi); 208 + } 209 + 204 210 static irqreturn_t ionic_isr(int irq, void *data) 205 211 { 206 212 struct napi_struct *napi = data; ··· 277 269 .oper = IONIC_Q_ENABLE, 278 270 }, 279 271 }; 272 + int ret; 280 273 281 274 idev = &lif->ionic->idev; 282 275 dev = lif->ionic->dev; ··· 285 276 dev_dbg(dev, "q_enable.index %d q_enable.qtype %d\n", 286 277 ctx.cmd.q_control.index, ctx.cmd.q_control.type); 287 278 279 + if (qcq->flags & IONIC_QCQ_F_INTR) 280 + ionic_intr_clean(idev->intr_ctrl, qcq->intr.index); 281 + 282 + ret = ionic_adminq_post_wait(lif, &ctx); 283 + if (ret) 284 + return ret; 285 + 286 + if (qcq->napi.poll) 287 + napi_enable(&qcq->napi); 288 + 288 289 if (qcq->flags & IONIC_QCQ_F_INTR) { 289 290 irq_set_affinity_hint(qcq->intr.vector, 290 291 &qcq->intr.affinity_mask); 291 - napi_enable(&qcq->napi); 292 - ionic_intr_clean(idev->intr_ctrl, qcq->intr.index); 293 292 ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, 294 293 IONIC_INTR_MASK_CLEAR); 295 294 } 296 295 297 - return ionic_adminq_post_wait(lif, &ctx); 296 + return 0; 298 297 } 299 298 300 299 static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int fw_err) ··· 333 316 synchronize_irq(qcq->intr.vector); 334 317 irq_set_affinity_hint(qcq->intr.vector, NULL); 335 318 napi_disable(&qcq->napi); 319 + del_timer_sync(&qcq->napi_deadline); 336 320 } 337 321 338 322 /* If there was a previous fw communcation error, don't bother with ··· 469 451 470 452 n_qcq->intr.vector = src_qcq->intr.vector; 471 453 n_qcq->intr.index = src_qcq->intr.index; 454 + n_qcq->napi_qcq = src_qcq->napi_qcq; 472 455 } 473 456 474 457 static int ionic_alloc_qcq_interrupt(struct ionic_lif *lif, struct ionic_qcq *qcq) ··· 583 564 } 584 565 585 566 if (flags & IONIC_QCQ_F_NOTIFYQ) { 586 - int q_size, cq_size; 567 + int q_size; 587 568 588 - /* q & cq need to be contiguous in case of notifyq */ 569 + /* q & cq need to be contiguous in NotifyQ, so alloc it all in q 570 + * and don't alloc qc. We leave new->qc_size and new->qc_base 571 + * as 0 to be sure we don't try to free it later. 572 + */ 589 573 q_size = ALIGN(num_descs * desc_size, PAGE_SIZE); 590 - cq_size = ALIGN(num_descs * cq_desc_size, PAGE_SIZE); 591 - 592 - new->q_size = PAGE_SIZE + q_size + cq_size; 574 + new->q_size = PAGE_SIZE + q_size + 575 + ALIGN(num_descs * cq_desc_size, PAGE_SIZE); 593 576 new->q_base = dma_alloc_coherent(dev, new->q_size, 594 577 &new->q_base_pa, GFP_KERNEL); 595 578 if (!new->q_base) { ··· 794 773 dev_dbg(dev, "txq->hw_type %d\n", q->hw_type); 795 774 dev_dbg(dev, "txq->hw_index %d\n", q->hw_index); 796 775 797 - if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) 776 + q->dbell_deadline = IONIC_TX_DOORBELL_DEADLINE; 777 + q->dbell_jiffies = jiffies; 778 + 779 + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) { 798 780 netif_napi_add(lif->netdev, &qcq->napi, ionic_tx_napi); 781 + qcq->napi_qcq = qcq; 782 + timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0); 783 + } 799 784 800 785 qcq->flags |= IONIC_QCQ_F_INITED; 801 786 ··· 855 828 dev_dbg(dev, "rxq->hw_type %d\n", q->hw_type); 856 829 dev_dbg(dev, "rxq->hw_index %d\n", q->hw_index); 857 830 831 + q->dbell_deadline = IONIC_RX_MIN_DOORBELL_DEADLINE; 832 + q->dbell_jiffies = jiffies; 833 + 858 834 if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) 859 835 netif_napi_add(lif->netdev, &qcq->napi, ionic_rx_napi); 860 836 else 861 837 netif_napi_add(lif->netdev, &qcq->napi, ionic_txrx_napi); 838 + 839 + qcq->napi_qcq = qcq; 840 + timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0); 862 841 863 842 qcq->flags |= IONIC_QCQ_F_INITED; 864 843 ··· 1183 1150 struct ionic_dev *idev = &lif->ionic->idev; 1184 1151 unsigned long irqflags; 1185 1152 unsigned int flags = 0; 1153 + bool resched = false; 1186 1154 int rx_work = 0; 1187 1155 int tx_work = 0; 1188 1156 int n_work = 0; ··· 1220 1186 credits = n_work + a_work + rx_work + tx_work; 1221 1187 ionic_intr_credits(idev->intr_ctrl, intr->index, credits, flags); 1222 1188 } 1189 + 1190 + if (!a_work && ionic_adminq_poke_doorbell(&lif->adminqcq->q)) 1191 + resched = true; 1192 + if (lif->hwstamp_rxq && !rx_work && ionic_rxq_poke_doorbell(&lif->hwstamp_rxq->q)) 1193 + resched = true; 1194 + if (lif->hwstamp_txq && !tx_work && ionic_txq_poke_doorbell(&lif->hwstamp_txq->q)) 1195 + resched = true; 1196 + if (resched) 1197 + mod_timer(&lif->adminqcq->napi_deadline, 1198 + jiffies + IONIC_NAPI_DEADLINE); 1223 1199 1224 1200 return work_done; 1225 1201 } ··· 3289 3245 dev_dbg(dev, "adminq->hw_type %d\n", q->hw_type); 3290 3246 dev_dbg(dev, "adminq->hw_index %d\n", q->hw_index); 3291 3247 3248 + q->dbell_deadline = IONIC_ADMIN_DOORBELL_DEADLINE; 3249 + q->dbell_jiffies = jiffies; 3250 + 3292 3251 netif_napi_add(lif->netdev, &qcq->napi, ionic_adminq_napi); 3252 + 3253 + qcq->napi_qcq = qcq; 3254 + timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0); 3293 3255 3294 3256 napi_enable(&qcq->napi); 3295 3257
+2
drivers/net/ethernet/pensando/ionic/ionic_lif.h
··· 74 74 struct ionic_queue q; 75 75 struct ionic_cq cq; 76 76 struct ionic_intr_info intr; 77 + struct timer_list napi_deadline; 77 78 struct napi_struct napi; 78 79 unsigned int flags; 80 + struct ionic_qcq *napi_qcq; 79 81 struct dentry *dentry; 80 82 }; 81 83
+29
drivers/net/ethernet/pensando/ionic/ionic_main.c
··· 289 289 complete_all(&ctx->work); 290 290 } 291 291 292 + bool ionic_adminq_poke_doorbell(struct ionic_queue *q) 293 + { 294 + struct ionic_lif *lif = q->lif; 295 + unsigned long now, then, dif; 296 + unsigned long irqflags; 297 + 298 + spin_lock_irqsave(&lif->adminq_lock, irqflags); 299 + 300 + if (q->tail_idx == q->head_idx) { 301 + spin_unlock_irqrestore(&lif->adminq_lock, irqflags); 302 + return false; 303 + } 304 + 305 + now = READ_ONCE(jiffies); 306 + then = q->dbell_jiffies; 307 + dif = now - then; 308 + 309 + if (dif > q->dbell_deadline) { 310 + ionic_dbell_ring(q->lif->kern_dbpage, q->hw_type, 311 + q->dbval | q->head_idx); 312 + 313 + q->dbell_jiffies = now; 314 + } 315 + 316 + spin_unlock_irqrestore(&lif->adminq_lock, irqflags); 317 + 318 + return true; 319 + } 320 + 292 321 int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) 293 322 { 294 323 struct ionic_desc_info *desc_info;
+85 -2
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
··· 22 22 ionic_q_post(q, ring_dbell, cb_func, cb_arg); 23 23 } 24 24 25 + bool ionic_txq_poke_doorbell(struct ionic_queue *q) 26 + { 27 + unsigned long now, then, dif; 28 + struct netdev_queue *netdev_txq; 29 + struct net_device *netdev; 30 + 31 + netdev = q->lif->netdev; 32 + netdev_txq = netdev_get_tx_queue(netdev, q->index); 33 + 34 + HARD_TX_LOCK(netdev, netdev_txq, smp_processor_id()); 35 + 36 + if (q->tail_idx == q->head_idx) { 37 + HARD_TX_UNLOCK(netdev, netdev_txq); 38 + return false; 39 + } 40 + 41 + now = READ_ONCE(jiffies); 42 + then = q->dbell_jiffies; 43 + dif = now - then; 44 + 45 + if (dif > q->dbell_deadline) { 46 + ionic_dbell_ring(q->lif->kern_dbpage, q->hw_type, 47 + q->dbval | q->head_idx); 48 + 49 + q->dbell_jiffies = now; 50 + } 51 + 52 + HARD_TX_UNLOCK(netdev, netdev_txq); 53 + 54 + return true; 55 + } 56 + 57 + bool ionic_rxq_poke_doorbell(struct ionic_queue *q) 58 + { 59 + unsigned long now, then, dif; 60 + 61 + /* no lock, called from rx napi or txrx napi, nothing else can fill */ 62 + 63 + if (q->tail_idx == q->head_idx) 64 + return false; 65 + 66 + now = READ_ONCE(jiffies); 67 + then = q->dbell_jiffies; 68 + dif = now - then; 69 + 70 + if (dif > q->dbell_deadline) { 71 + ionic_dbell_ring(q->lif->kern_dbpage, q->hw_type, 72 + q->dbval | q->head_idx); 73 + 74 + q->dbell_jiffies = now; 75 + 76 + dif = 2 * q->dbell_deadline; 77 + if (dif > IONIC_RX_MAX_DOORBELL_DEADLINE) 78 + dif = IONIC_RX_MAX_DOORBELL_DEADLINE; 79 + 80 + q->dbell_deadline = dif; 81 + } 82 + 83 + return true; 84 + } 85 + 25 86 static inline struct netdev_queue *q_to_ndq(struct ionic_queue *q) 26 87 { 27 88 return netdev_get_tx_queue(q->lif->netdev, q->index); ··· 485 424 486 425 ionic_dbell_ring(q->lif->kern_dbpage, q->hw_type, 487 426 q->dbval | q->head_idx); 427 + 428 + q->dbell_deadline = IONIC_RX_MIN_DOORBELL_DEADLINE; 429 + q->dbell_jiffies = jiffies; 430 + 431 + mod_timer(&q_to_qcq(q)->napi_qcq->napi_deadline, 432 + jiffies + IONIC_NAPI_DEADLINE); 488 433 } 489 434 490 435 void ionic_rx_empty(struct ionic_queue *q) ··· 578 511 work_done, flags); 579 512 } 580 513 514 + if (!work_done && ionic_txq_poke_doorbell(&qcq->q)) 515 + mod_timer(&qcq->napi_deadline, jiffies + IONIC_NAPI_DEADLINE); 516 + 581 517 return work_done; 582 518 } 583 519 ··· 614 544 work_done, flags); 615 545 } 616 546 547 + if (!work_done && ionic_rxq_poke_doorbell(&qcq->q)) 548 + mod_timer(&qcq->napi_deadline, jiffies + IONIC_NAPI_DEADLINE); 549 + 617 550 return work_done; 618 551 } 619 552 620 553 int ionic_txrx_napi(struct napi_struct *napi, int budget) 621 554 { 622 - struct ionic_qcq *qcq = napi_to_qcq(napi); 555 + struct ionic_qcq *rxqcq = napi_to_qcq(napi); 623 556 struct ionic_cq *rxcq = napi_to_cq(napi); 624 557 unsigned int qi = rxcq->bound_q->index; 558 + struct ionic_qcq *txqcq; 625 559 struct ionic_dev *idev; 626 560 struct ionic_lif *lif; 627 561 struct ionic_cq *txcq; 562 + bool resched = false; 628 563 u32 rx_work_done = 0; 629 564 u32 tx_work_done = 0; 630 565 u32 flags = 0; 631 566 632 567 lif = rxcq->bound_q->lif; 633 568 idev = &lif->ionic->idev; 569 + txqcq = lif->txqcqs[qi]; 634 570 txcq = &lif->txqcqs[qi]->cq; 635 571 636 572 tx_work_done = ionic_cq_service(txcq, IONIC_TX_BUDGET_DEFAULT, ··· 648 572 ionic_rx_fill(rxcq->bound_q); 649 573 650 574 if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { 651 - ionic_dim_update(qcq, 0); 575 + ionic_dim_update(rxqcq, 0); 652 576 flags |= IONIC_INTR_CRED_UNMASK; 653 577 rxcq->bound_intr->rearm_count++; 654 578 } ··· 658 582 ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index, 659 583 tx_work_done + rx_work_done, flags); 660 584 } 585 + 586 + if (!rx_work_done && ionic_rxq_poke_doorbell(&rxqcq->q)) 587 + resched = true; 588 + if (!tx_work_done && ionic_txq_poke_doorbell(&txqcq->q)) 589 + resched = true; 590 + if (resched) 591 + mod_timer(&rxqcq->napi_deadline, jiffies + IONIC_NAPI_DEADLINE); 661 592 662 593 return rx_work_done; 663 594 }
+1 -1
drivers/net/hyperv/netvsc.c
··· 1034 1034 1035 1035 packet->dma_range = kcalloc(page_count, 1036 1036 sizeof(*packet->dma_range), 1037 - GFP_KERNEL); 1037 + GFP_ATOMIC); 1038 1038 if (!packet->dma_range) 1039 1039 return -ENOMEM; 1040 1040
+2
drivers/net/phy/meson-gxl.c
··· 261 261 .handle_interrupt = meson_gxl_handle_interrupt, 262 262 .suspend = genphy_suspend, 263 263 .resume = genphy_resume, 264 + .read_mmd = genphy_read_mmd_unsupported, 265 + .write_mmd = genphy_write_mmd_unsupported, 264 266 }, { 265 267 PHY_ID_MATCH_EXACT(0x01803301), 266 268 .name = "Meson G12A Internal PHY",
+2 -3
drivers/net/phy/phylink.c
··· 1812 1812 1813 1813 ret = phy_attach_direct(pl->netdev, phy_dev, flags, 1814 1814 pl->link_interface); 1815 - if (ret) { 1816 - phy_device_free(phy_dev); 1815 + phy_device_free(phy_dev); 1816 + if (ret) 1817 1817 return ret; 1818 - } 1819 1818 1820 1819 ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface); 1821 1820 if (ret)
+1 -3
drivers/net/usb/plusb.c
··· 57 57 static inline int 58 58 pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index) 59 59 { 60 - return usbnet_read_cmd(dev, req, 61 - USB_DIR_IN | USB_TYPE_VENDOR | 62 - USB_RECIP_DEVICE, 60 + return usbnet_write_cmd(dev, req, USB_TYPE_VENDOR | USB_RECIP_DEVICE, 63 61 val, index, NULL, 0); 64 62 } 65 63
+10 -3
include/linux/mlx5/driver.h
··· 573 573 struct dentry *lag_debugfs; 574 574 }; 575 575 576 + enum mlx5_func_type { 577 + MLX5_PF, 578 + MLX5_VF, 579 + MLX5_SF, 580 + MLX5_HOST_PF, 581 + MLX5_FUNC_TYPE_NUM, 582 + }; 583 + 576 584 struct mlx5_ft_pool; 577 585 struct mlx5_priv { 578 586 /* IRQ table valid only for real pci devices PF or VF */ ··· 591 583 struct mlx5_nb pg_nb; 592 584 struct workqueue_struct *pg_wq; 593 585 struct xarray page_root_xa; 594 - u32 fw_pages; 595 586 atomic_t reg_pages; 596 587 struct list_head free_list; 597 - u32 vfs_pages; 598 - u32 host_pf_pages; 588 + u32 fw_pages; 589 + u32 page_counters[MLX5_FUNC_TYPE_NUM]; 599 590 u32 fw_pages_alloc_failed; 600 591 u32 give_pages_dropped; 601 592 u32 reclaim_pages_discard;
+1
include/uapi/linux/ip.h
··· 18 18 #ifndef _UAPI_LINUX_IP_H 19 19 #define _UAPI_LINUX_IP_H 20 20 #include <linux/types.h> 21 + #include <linux/stddef.h> 21 22 #include <asm/byteorder.h> 22 23 23 24 #define IPTOS_TOS_MASK 0x1E
+1
include/uapi/linux/ipv6.h
··· 4 4 5 5 #include <linux/libc-compat.h> 6 6 #include <linux/types.h> 7 + #include <linux/stddef.h> 7 8 #include <linux/in6.h> 8 9 #include <asm/byteorder.h> 9 10
+40
net/can/j1939/address-claim.c
··· 165 165 * leaving this function. 166 166 */ 167 167 ecu = j1939_ecu_get_by_name_locked(priv, name); 168 + 169 + if (ecu && ecu->addr == skcb->addr.sa) { 170 + /* The ISO 11783-5 standard, in "4.5.2 - Address claim 171 + * requirements", states: 172 + * d) No CF shall begin, or resume, transmission on the 173 + * network until 250 ms after it has successfully claimed 174 + * an address except when responding to a request for 175 + * address-claimed. 176 + * 177 + * But "Figure 6" and "Figure 7" in "4.5.4.2 - Address-claim 178 + * prioritization" show that the CF begins the transmission 179 + * after 250 ms from the first AC (address-claimed) message 180 + * even if it sends another AC message during that time window 181 + * to resolve the address contention with another CF. 182 + * 183 + * As stated in "4.4.2.3 - Address-claimed message": 184 + * In order to successfully claim an address, the CF sending 185 + * an address claimed message shall not receive a contending 186 + * claim from another CF for at least 250 ms. 187 + * 188 + * As stated in "4.4.3.2 - NAME management (NM) message": 189 + * 1) A commanding CF can 190 + * d) request that a CF with a specified NAME transmit 191 + * the address-claimed message with its current NAME. 192 + * 2) A target CF shall 193 + * d) send an address-claimed message in response to a 194 + * request for a matching NAME 195 + * 196 + * Taking the above arguments into account, the 250 ms wait is 197 + * requested only during network initialization. 198 + * 199 + * Do not restart the timer on AC message if both the NAME and 200 + * the address match and so if the address has already been 201 + * claimed (timer has expired) or the AC message has been sent 202 + * to resolve the contention with another CF (timer is still 203 + * running). 204 + */ 205 + goto out_ecu_put; 206 + } 207 + 168 208 if (!ecu && j1939_address_is_unicast(skcb->addr.sa)) 169 209 ecu = j1939_ecu_create_locked(priv, name); 170 210
+6 -3
net/core/devlink.c
··· 9979 9979 goto err_xa_alloc; 9980 9980 9981 9981 devlink->netdevice_nb.notifier_call = devlink_netdevice_event; 9982 - ret = register_netdevice_notifier_net(net, &devlink->netdevice_nb); 9982 + ret = register_netdevice_notifier(&devlink->netdevice_nb); 9983 9983 if (ret) 9984 9984 goto err_register_netdevice_notifier; 9985 9985 ··· 10171 10171 xa_destroy(&devlink->snapshot_ids); 10172 10172 xa_destroy(&devlink->ports); 10173 10173 10174 - WARN_ON_ONCE(unregister_netdevice_notifier_net(devlink_net(devlink), 10175 - &devlink->netdevice_nb)); 10174 + WARN_ON_ONCE(unregister_netdevice_notifier(&devlink->netdevice_nb)); 10176 10175 10177 10176 xa_erase(&devlinks, devlink->index); 10178 10177 ··· 10502 10503 break; 10503 10504 case NETDEV_REGISTER: 10504 10505 case NETDEV_CHANGENAME: 10506 + if (devlink_net(devlink) != dev_net(netdev)) 10507 + return NOTIFY_OK; 10505 10508 /* Set the netdev on top of previously set type. Note this 10506 10509 * event happens also during net namespace change so here 10507 10510 * we take into account netdev pointer appearing in this ··· 10513 10512 netdev); 10514 10513 break; 10515 10514 case NETDEV_UNREGISTER: 10515 + if (devlink_net(devlink) != dev_net(netdev)) 10516 + return NOTIFY_OK; 10516 10517 /* Clear netdev pointer, but not the type. This event happens 10517 10518 * also during net namespace change so we need to clear 10518 10519 * pointer to netdev that is going to another net namespace.
+15 -3
net/core/neighbour.c
··· 269 269 (n->nud_state == NUD_NOARP) || 270 270 (tbl->is_multicast && 271 271 tbl->is_multicast(n->primary_key)) || 272 - time_after(tref, n->updated)) 272 + !time_in_range(n->updated, tref, jiffies)) 273 273 remove = true; 274 274 write_unlock(&n->lock); 275 275 ··· 289 289 290 290 static void neigh_add_timer(struct neighbour *n, unsigned long when) 291 291 { 292 + /* Use safe distance from the jiffies - LONG_MAX point while timer 293 + * is running in DELAY/PROBE state but still show to user space 294 + * large times in the past. 295 + */ 296 + unsigned long mint = jiffies - (LONG_MAX - 86400 * HZ); 297 + 292 298 neigh_hold(n); 299 + if (!time_in_range(n->confirmed, mint, jiffies)) 300 + n->confirmed = mint; 301 + if (time_before(n->used, n->confirmed)) 302 + n->used = n->confirmed; 293 303 if (unlikely(mod_timer(&n->timer, when))) { 294 304 printk("NEIGH: BUG, double timer add, state is %x\n", 295 305 n->nud_state); ··· 1011 1001 goto next_elt; 1012 1002 } 1013 1003 1014 - if (time_before(n->used, n->confirmed)) 1004 + if (time_before(n->used, n->confirmed) && 1005 + time_is_before_eq_jiffies(n->confirmed)) 1015 1006 n->used = n->confirmed; 1016 1007 1017 1008 if (refcount_read(&n->refcnt) == 1 && 1018 1009 (state == NUD_FAILED || 1019 - time_after(jiffies, n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) { 1010 + !time_in_range_open(jiffies, n->used, 1011 + n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) { 1020 1012 *np = n->next; 1021 1013 neigh_mark_dead(n); 1022 1014 write_unlock(&n->lock);
+2 -1
net/core/sock.c
··· 1531 1531 ret = -EINVAL; 1532 1532 break; 1533 1533 } 1534 + if ((u8)val == SOCK_TXREHASH_DEFAULT) 1535 + val = READ_ONCE(sock_net(sk)->core.sysctl_txrehash); 1534 1536 /* Paired with READ_ONCE() in tcp_rtx_synack() */ 1535 1537 WRITE_ONCE(sk->sk_txrehash, (u8)val); 1536 1538 break; ··· 3453 3451 sk->sk_pacing_rate = ~0UL; 3454 3452 WRITE_ONCE(sk->sk_pacing_shift, 10); 3455 3453 sk->sk_incoming_cpu = -1; 3456 - sk->sk_txrehash = SOCK_TXREHASH_DEFAULT; 3457 3454 3458 3455 sk_rx_queue_clear(sk); 3459 3456 /*
+1
net/ipv4/af_inet.c
··· 347 347 sk->sk_destruct = inet_sock_destruct; 348 348 sk->sk_protocol = protocol; 349 349 sk->sk_backlog_rcv = sk->sk_prot->backlog_rcv; 350 + sk->sk_txrehash = READ_ONCE(net->core.sysctl_txrehash); 350 351 351 352 inet->uc_ttl = -1; 352 353 inet->mc_loop = 1;
-3
net/ipv4/inet_connection_sock.c
··· 1225 1225 sk->sk_ack_backlog = 0; 1226 1226 inet_csk_delack_init(sk); 1227 1227 1228 - if (sk->sk_txrehash == SOCK_TXREHASH_DEFAULT) 1229 - sk->sk_txrehash = READ_ONCE(sock_net(sk)->core.sysctl_txrehash); 1230 - 1231 1228 /* There is race window here: we announce ourselves listening, 1232 1229 * but this transition is still not validated by get_port(). 1233 1230 * It is OK, because this socket enters to hash table only
+1
net/ipv6/af_inet6.c
··· 222 222 np->pmtudisc = IPV6_PMTUDISC_WANT; 223 223 np->repflow = net->ipv6.sysctl.flowlabel_reflect & FLOWLABEL_REFLECT_ESTABLISHED; 224 224 sk->sk_ipv6only = net->ipv6.sysctl.bindv6only; 225 + sk->sk_txrehash = READ_ONCE(net->core.sysctl_txrehash); 225 226 226 227 /* Init the ipv4 part of the socket since we can have sockets 227 228 * using v6 API for ipv4.
+6 -4
net/mptcp/pm_netlink.c
··· 998 998 { 999 999 int addrlen = sizeof(struct sockaddr_in); 1000 1000 struct sockaddr_storage addr; 1001 - struct mptcp_sock *msk; 1002 1001 struct socket *ssock; 1002 + struct sock *newsk; 1003 1003 int backlog = 1024; 1004 1004 int err; 1005 1005 ··· 1008 1008 if (err) 1009 1009 return err; 1010 1010 1011 - msk = mptcp_sk(entry->lsk->sk); 1012 - if (!msk) 1011 + newsk = entry->lsk->sk; 1012 + if (!newsk) 1013 1013 return -EINVAL; 1014 1014 1015 - ssock = __mptcp_nmpc_socket(msk); 1015 + lock_sock(newsk); 1016 + ssock = __mptcp_nmpc_socket(mptcp_sk(newsk)); 1017 + release_sock(newsk); 1016 1018 if (!ssock) 1017 1019 return -EINVAL; 1018 1020
+9
net/mptcp/protocol.c
··· 2897 2897 struct mptcp_subflow_context *subflow; 2898 2898 struct mptcp_sock *msk = mptcp_sk(sk); 2899 2899 bool do_cancel_work = false; 2900 + int subflows_alive = 0; 2900 2901 2901 2902 sk->sk_shutdown = SHUTDOWN_MASK; 2902 2903 ··· 2923 2922 struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 2924 2923 bool slow = lock_sock_fast_nested(ssk); 2925 2924 2925 + subflows_alive += ssk->sk_state != TCP_CLOSE; 2926 + 2926 2927 /* since the close timeout takes precedence on the fail one, 2927 2928 * cancel the latter 2928 2929 */ ··· 2939 2936 unlock_sock_fast(ssk, slow); 2940 2937 } 2941 2938 sock_orphan(sk); 2939 + 2940 + /* all the subflows are closed, only timeout can change the msk 2941 + * state, let's not keep resources busy for no reasons 2942 + */ 2943 + if (subflows_alive == 0) 2944 + inet_sk_state_store(sk, TCP_CLOSE); 2942 2945 2943 2946 sock_hold(sk); 2944 2947 pr_debug("msk=%p state=%d", sk, sk->sk_state);
+9 -2
net/mptcp/sockopt.c
··· 760 760 static int mptcp_setsockopt_first_sf_only(struct mptcp_sock *msk, int level, int optname, 761 761 sockptr_t optval, unsigned int optlen) 762 762 { 763 + struct sock *sk = (struct sock *)msk; 763 764 struct socket *sock; 765 + int ret = -EINVAL; 764 766 765 767 /* Limit to first subflow, before the connection establishment */ 768 + lock_sock(sk); 766 769 sock = __mptcp_nmpc_socket(msk); 767 770 if (!sock) 768 - return -EINVAL; 771 + goto unlock; 769 772 770 - return tcp_setsockopt(sock->sk, level, optname, optval, optlen); 773 + ret = tcp_setsockopt(sock->sk, level, optname, optval, optlen); 774 + 775 + unlock: 776 + release_sock(sk); 777 + return ret; 771 778 } 772 779 773 780 static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
+10 -2
net/mptcp/subflow.c
··· 1399 1399 mptcp_for_each_subflow(msk, subflow) { 1400 1400 struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 1401 1401 int err = sock_error(ssk); 1402 + int ssk_state; 1402 1403 1403 1404 if (!err) 1404 1405 continue; ··· 1410 1409 if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk)) 1411 1410 continue; 1412 1411 1413 - inet_sk_state_store(sk, inet_sk_state_load(ssk)); 1412 + /* We need to propagate only transition to CLOSE state. 1413 + * Orphaned socket will see such state change via 1414 + * subflow_sched_work_if_closed() and that path will properly 1415 + * destroy the msk as needed. 1416 + */ 1417 + ssk_state = inet_sk_state_load(ssk); 1418 + if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD)) 1419 + inet_sk_state_store(sk, ssk_state); 1414 1420 sk->sk_err = -err; 1415 1421 1416 1422 /* This barrier is coupled with smp_rmb() in mptcp_poll() */ ··· 1687 1679 if (err) 1688 1680 return err; 1689 1681 1690 - lock_sock(sf->sk); 1682 + lock_sock_nested(sf->sk, SINGLE_DEPTH_NESTING); 1691 1683 1692 1684 /* the newly created socket has to be in the same cgroup as its parent */ 1693 1685 mptcp_attach_cgroup(sk, sf->sk);
+3 -3
net/rds/message.c
··· 104 104 spin_lock_irqsave(&q->lock, flags); 105 105 head = &q->zcookie_head; 106 106 if (!list_empty(head)) { 107 - info = list_entry(head, struct rds_msg_zcopy_info, 108 - rs_zcookie_next); 109 - if (info && rds_zcookie_add(info, cookie)) { 107 + info = list_first_entry(head, struct rds_msg_zcopy_info, 108 + rs_zcookie_next); 109 + if (rds_zcookie_add(info, cookie)) { 110 110 spin_unlock_irqrestore(&q->lock, flags); 111 111 kfree(rds_info_from_znotifier(znotif)); 112 112 /* caller invokes rds_wake_sk_sleep() */
+1 -1
net/sched/sch_htb.c
··· 433 433 while (m) { 434 434 unsigned int prio = ffz(~m); 435 435 436 - if (WARN_ON_ONCE(prio > ARRAY_SIZE(p->inner.clprio))) 436 + if (WARN_ON_ONCE(prio >= ARRAY_SIZE(p->inner.clprio))) 437 437 break; 438 438 m &= ~(1 << prio); 439 439
+3 -1
net/xfrm/xfrm_compat.c
··· 5 5 * Based on code and translator idea by: Florian Westphal <fw@strlen.de> 6 6 */ 7 7 #include <linux/compat.h> 8 + #include <linux/nospec.h> 8 9 #include <linux/xfrm.h> 9 10 #include <net/xfrm.h> 10 11 ··· 303 302 nla_for_each_attr(nla, attrs, len, remaining) { 304 303 int err; 305 304 306 - switch (type) { 305 + switch (nlh_src->nlmsg_type) { 307 306 case XFRM_MSG_NEWSPDINFO: 308 307 err = xfrm_nla_cpy(dst, nla, nla_len(nla)); 309 308 break; ··· 438 437 NL_SET_ERR_MSG(extack, "Bad attribute"); 439 438 return -EOPNOTSUPP; 440 439 } 440 + type = array_index_nospec(type, XFRMA_MAX + 1); 441 441 if (nla_len(nla) < compat_policy[type].len) { 442 442 NL_SET_ERR_MSG(extack, "Attribute bad length"); 443 443 return -EOPNOTSUPP;
+1 -2
net/xfrm/xfrm_input.c
··· 279 279 goto out; 280 280 281 281 if (x->props.flags & XFRM_STATE_DECAP_DSCP) 282 - ipv6_copy_dscp(ipv6_get_dsfield(ipv6_hdr(skb)), 283 - ipipv6_hdr(skb)); 282 + ipv6_copy_dscp(XFRM_MODE_SKB_CB(skb)->tos, ipipv6_hdr(skb)); 284 283 if (!(x->props.flags & XFRM_STATE_NOECN)) 285 284 ipip6_ecn_decapsulate(skb); 286 285
+50 -4
net/xfrm/xfrm_interface_core.c
··· 310 310 skb->mark = 0; 311 311 } 312 312 313 + static int xfrmi_input(struct sk_buff *skb, int nexthdr, __be32 spi, 314 + int encap_type, unsigned short family) 315 + { 316 + struct sec_path *sp; 317 + 318 + sp = skb_sec_path(skb); 319 + if (sp && (sp->len || sp->olen) && 320 + !xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family)) 321 + goto discard; 322 + 323 + XFRM_SPI_SKB_CB(skb)->family = family; 324 + if (family == AF_INET) { 325 + XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); 326 + XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL; 327 + } else { 328 + XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); 329 + XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL; 330 + } 331 + 332 + return xfrm_input(skb, nexthdr, spi, encap_type); 333 + discard: 334 + kfree_skb(skb); 335 + return 0; 336 + } 337 + 338 + static int xfrmi4_rcv(struct sk_buff *skb) 339 + { 340 + return xfrmi_input(skb, ip_hdr(skb)->protocol, 0, 0, AF_INET); 341 + } 342 + 343 + static int xfrmi6_rcv(struct sk_buff *skb) 344 + { 345 + return xfrmi_input(skb, skb_network_header(skb)[IP6CB(skb)->nhoff], 346 + 0, 0, AF_INET6); 347 + } 348 + 349 + static int xfrmi4_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) 350 + { 351 + return xfrmi_input(skb, nexthdr, spi, encap_type, AF_INET); 352 + } 353 + 354 + static int xfrmi6_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) 355 + { 356 + return xfrmi_input(skb, nexthdr, spi, encap_type, AF_INET6); 357 + } 358 + 313 359 static int xfrmi_rcv_cb(struct sk_buff *skb, int err) 314 360 { 315 361 const struct xfrm_mode *inner_mode; ··· 991 945 }; 992 946 993 947 static struct xfrm6_protocol xfrmi_esp6_protocol __read_mostly = { 994 - .handler = xfrm6_rcv, 995 - .input_handler = xfrm_input, 948 + .handler = xfrmi6_rcv, 949 + .input_handler = xfrmi6_input, 996 950 .cb_handler = xfrmi_rcv_cb, 997 951 .err_handler = xfrmi6_err, 998 952 .priority = 10, ··· 1042 996 #endif 1043 997 1044 998 static struct xfrm4_protocol xfrmi_esp4_protocol __read_mostly = { 1045 - .handler = xfrm4_rcv, 1046 - .input_handler = xfrm_input, 999 + .handler = xfrmi4_rcv, 1000 + .input_handler = xfrmi4_input, 1047 1001 .cb_handler = xfrmi_rcv_cb, 1048 1002 .err_handler = xfrmi4_err, 1049 1003 .priority = 10,
+10 -4
net/xfrm/xfrm_policy.c
··· 336 336 } 337 337 if (xp->lft.hard_use_expires_seconds) { 338 338 time64_t tmo = xp->lft.hard_use_expires_seconds + 339 - (xp->curlft.use_time ? : xp->curlft.add_time) - now; 339 + (READ_ONCE(xp->curlft.use_time) ? : xp->curlft.add_time) - now; 340 340 if (tmo <= 0) 341 341 goto expired; 342 342 if (tmo < next) ··· 354 354 } 355 355 if (xp->lft.soft_use_expires_seconds) { 356 356 time64_t tmo = xp->lft.soft_use_expires_seconds + 357 - (xp->curlft.use_time ? : xp->curlft.add_time) - now; 357 + (READ_ONCE(xp->curlft.use_time) ? : xp->curlft.add_time) - now; 358 358 if (tmo <= 0) { 359 359 warn = 1; 360 360 tmo = XFRM_KM_TIMEOUT; ··· 3661 3661 return 1; 3662 3662 } 3663 3663 3664 - pol->curlft.use_time = ktime_get_real_seconds(); 3664 + /* This lockless write can happen from different cpus. */ 3665 + WRITE_ONCE(pol->curlft.use_time, ktime_get_real_seconds()); 3665 3666 3666 3667 pols[0] = pol; 3667 3668 npols++; ··· 3677 3676 xfrm_pol_put(pols[0]); 3678 3677 return 0; 3679 3678 } 3680 - pols[1]->curlft.use_time = ktime_get_real_seconds(); 3679 + /* This write can happen from different cpus. */ 3680 + WRITE_ONCE(pols[1]->curlft.use_time, 3681 + ktime_get_real_seconds()); 3681 3682 npols++; 3682 3683 } 3683 3684 } ··· 3744 3741 XFRM_INC_STATS(net, LINUX_MIB_XFRMINTMPLMISMATCH); 3745 3742 goto reject; 3746 3743 } 3744 + 3745 + if (if_id) 3746 + secpath_reset(skb); 3747 3747 3748 3748 xfrm_pols_put(pols, npols); 3749 3749 return 1;
+9 -9
net/xfrm/xfrm_state.c
··· 577 577 if (x->km.state == XFRM_STATE_EXPIRED) 578 578 goto expired; 579 579 if (x->lft.hard_add_expires_seconds) { 580 - long tmo = x->lft.hard_add_expires_seconds + 580 + time64_t tmo = x->lft.hard_add_expires_seconds + 581 581 x->curlft.add_time - now; 582 582 if (tmo <= 0) { 583 583 if (x->xflags & XFRM_SOFT_EXPIRE) { ··· 594 594 next = tmo; 595 595 } 596 596 if (x->lft.hard_use_expires_seconds) { 597 - long tmo = x->lft.hard_use_expires_seconds + 598 - (x->curlft.use_time ? : now) - now; 597 + time64_t tmo = x->lft.hard_use_expires_seconds + 598 + (READ_ONCE(x->curlft.use_time) ? : now) - now; 599 599 if (tmo <= 0) 600 600 goto expired; 601 601 if (tmo < next) ··· 604 604 if (x->km.dying) 605 605 goto resched; 606 606 if (x->lft.soft_add_expires_seconds) { 607 - long tmo = x->lft.soft_add_expires_seconds + 607 + time64_t tmo = x->lft.soft_add_expires_seconds + 608 608 x->curlft.add_time - now; 609 609 if (tmo <= 0) { 610 610 warn = 1; ··· 616 616 } 617 617 } 618 618 if (x->lft.soft_use_expires_seconds) { 619 - long tmo = x->lft.soft_use_expires_seconds + 620 - (x->curlft.use_time ? : now) - now; 619 + time64_t tmo = x->lft.soft_use_expires_seconds + 620 + (READ_ONCE(x->curlft.use_time) ? : now) - now; 621 621 if (tmo <= 0) 622 622 warn = 1; 623 623 else if (tmo < next) ··· 1906 1906 1907 1907 hrtimer_start(&x1->mtimer, ktime_set(1, 0), 1908 1908 HRTIMER_MODE_REL_SOFT); 1909 - if (x1->curlft.use_time) 1909 + if (READ_ONCE(x1->curlft.use_time)) 1910 1910 xfrm_state_check_expire(x1); 1911 1911 1912 1912 if (x->props.smark.m || x->props.smark.v || x->if_id) { ··· 1940 1940 { 1941 1941 xfrm_dev_state_update_curlft(x); 1942 1942 1943 - if (!x->curlft.use_time) 1944 - x->curlft.use_time = ktime_get_real_seconds(); 1943 + if (!READ_ONCE(x->curlft.use_time)) 1944 + WRITE_ONCE(x->curlft.use_time, ktime_get_real_seconds()); 1945 1945 1946 1946 if (x->curlft.bytes >= x->lft.hard_byte_limit || 1947 1947 x->curlft.packets >= x->lft.hard_packet_limit) {
+1 -1
tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh
··· 246 246 bridge vlan add dev $swp2 vid 300 247 247 248 248 tc filter add dev $swp1 ingress chain $(IS1 2) pref 3 \ 249 - protocol 802.1Q flower skip_sw vlan_id 200 \ 249 + protocol 802.1Q flower skip_sw vlan_id 200 src_mac $h1_mac \ 250 250 action vlan modify id 300 \ 251 251 action goto chain $(IS2 0 0) 252 252
+2 -2
tools/testing/selftests/net/forwarding/lib.sh
··· 914 914 local value=$1; shift 915 915 916 916 SYSCTL_ORIG[$key]=$(sysctl -n $key) 917 - sysctl -qw $key=$value 917 + sysctl -qw $key="$value" 918 918 } 919 919 920 920 sysctl_restore() 921 921 { 922 922 local key=$1; shift 923 923 924 - sysctl -qw $key=${SYSCTL_ORIG["$key"]} 924 + sysctl -qw $key="${SYSCTL_ORIG[$key]}" 925 925 } 926 926 927 927 forwarding_enable()
+17 -5
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 498 498 kill_wait $evts_ns2_pid 499 499 } 500 500 501 + kill_tests_wait() 502 + { 503 + kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1) 504 + wait 505 + } 506 + 501 507 pm_nl_set_limits() 502 508 { 503 509 local ns=$1 ··· 1700 1694 local subflow_nr=$3 1701 1695 local cnt1 1702 1696 local cnt2 1697 + local dump_stats 1703 1698 1704 1699 if [ -n "${need_title}" ]; then 1705 1700 printf "%03u %-36s %s" "${TEST_COUNT}" "${TEST_NAME}" "${msg}" ··· 1718 1711 echo "[ ok ]" 1719 1712 fi 1720 1713 1721 - [ "${dump_stats}" = 1 ] && ( ss -N $ns1 -tOni ; ss -N $ns1 -tOni | grep token; ip -n $ns1 mptcp endpoint ) 1714 + if [ "${dump_stats}" = 1 ]; then 1715 + ss -N $ns1 -tOni 1716 + ss -N $ns1 -tOni | grep token 1717 + ip -n $ns1 mptcp endpoint 1718 + dump_stats 1719 + fi 1722 1720 } 1723 1721 1724 1722 chk_link_usage() ··· 3061 3049 pm_nl_set_limits $ns1 2 2 3062 3050 pm_nl_set_limits $ns2 2 2 3063 3051 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal 3064 - run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow & 3052 + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow 2>/dev/null & 3065 3053 3066 3054 wait_mpj $ns1 3067 3055 pm_nl_check_endpoint 1 "creation" \ ··· 3074 3062 pm_nl_add_endpoint $ns2 10.0.2.2 flags signal 3075 3063 pm_nl_check_endpoint 0 "modif is allowed" \ 3076 3064 $ns2 10.0.2.2 id 1 flags signal 3077 - wait 3065 + kill_tests_wait 3078 3066 fi 3079 3067 3080 3068 if reset "delete and re-add"; then 3081 3069 pm_nl_set_limits $ns1 1 1 3082 3070 pm_nl_set_limits $ns2 1 1 3083 3071 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow 3084 - run_tests $ns1 $ns2 10.0.1.1 4 0 0 slow & 3072 + run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null & 3085 3073 3086 3074 wait_mpj $ns2 3087 3075 pm_nl_del_endpoint $ns2 2 10.0.2.2 ··· 3091 3079 pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow 3092 3080 wait_mpj $ns2 3093 3081 chk_subflow_nr "" "after re-add" 2 3094 - wait 3082 + kill_tests_wait 3095 3083 fi 3096 3084 } 3097 3085
+5 -13
tools/testing/selftests/net/test_vxlan_vnifiltering.sh
··· 293 293 elif [[ -n $vtype && $vtype == "vnifilterg" ]]; then 294 294 # Add per vni group config with 'bridge vni' api 295 295 if [ -n "$group" ]; then 296 - if [ "$family" == "v4" ]; then 297 - if [ $mcast -eq 1 ]; then 298 - bridge -netns hv-$hvid vni add dev $vxlandev vni $tid group $group 299 - else 300 - bridge -netns hv-$hvid vni add dev $vxlandev vni $tid remote $group 301 - fi 302 - else 303 - if [ $mcast -eq 1 ]; then 304 - bridge -netns hv-$hvid vni add dev $vxlandev vni $tid group6 $group 305 - else 306 - bridge -netns hv-$hvid vni add dev $vxlandev vni $tid remote6 $group 307 - fi 308 - fi 296 + if [ $mcast -eq 1 ]; then 297 + bridge -netns hv-$hvid vni add dev $vxlandev vni $tid group $group 298 + else 299 + bridge -netns hv-$hvid vni add dev $vxlandev vni $tid remote $group 300 + fi 309 301 fi 310 302 fi 311 303 done