ice: share RSS hash profile IDs between PFs
Subsystems (3)
cover ice: share RSS hash profile IDs between PFs
The DDP package gives all PFs of a device 126 RSS hash profile IDs, and since commit a6d63bbf2c52 ("ice: Implement RSS settings for GTP using ethtool") the default RSS configuration of each PF takes 19 of them. On devices with 8 PFs, like the E830-XXVDA8F, the PFs probed last lose part or all of their default RSS, and RSS configurations requested later fail, for example for VFs:
ice 0000:6c:00.0: ice_add_rss_cfg failed for VF 0, VSI 2, error:-5
The PFs configure the same profiles, and firmware already lets them share an ID; what is missing is a way for a PF to find the ID another PF uses for an extraction sequence. This series keeps a list of the shared IDs in struct ice_adapter.
Dropping part of the default RSS configuration, for example the 12 GTP entries added by a6d63bbf2c52, would also make it fit, but it would take the default GTP hashing away from users, which feels more like a step back, and it only moves the limit: without sharing, the IDs grow with the number of PFs times the configurations of each, so VFs and ethtool settings can exhaust them again. With sharing, they grow with the number of distinct configurations.
Patch 1 fixes a profile ID leak on the error paths of ice_add_prof(). It is independent of the rest and comes first, so that it can be backported on its own.
Patch 2 shares the IDs of the default RSS configuration, which fixes the exhaustion.
Patch 3 shares the IDs of all RSS profiles added through the flow API (ethtool, VFs, replay).
On an E810-CQDA2 split to 8 PFs, with a VF on each PF and the same "rx-flow-hash" settings on every VF, the PFs hold 126 IDs and fail 70 allocations before the series, and hold 37 IDs with no failures after it.
Patch 2 and 3 were also checked on an E830-XXVDA8F with one VF per PF and "rx-flow-hash {tcp,udp}{4,6} fn" on each, all 32 changes succeed with no ice errors.
The series is for iwl-next although patches 1 and 2 carry Fixes tags:
sharing profile IDs between PFs is a new feature rather than a plain
fix, and patch 2 builds on the shared devlink instance holding struct ice_adapter, added by
commit 6381ef1b1338 ("ice: use shared devlink to store ice_adapters instead of custom xarray") which is not in net, and it is too large for net.
Notes for reviewers:
- CORER, GLOBR and EMPR clear the IDs of all PFs, and every PF empties the list while preparing for such a reset, before it can allocate again. A PF that prepares late can drop entries made by a PF that has already rebuilt; that only costs sharing, the IDs stay valid and are freed as private ones. Skipping the flush on some PFs would instead let a PF join an ID the reset freed, which firmware may meanwhile have given to a PF the list does not track (DPDK, a PF assigned to a VM).
- Sharing relies on the device serial number identifying one device, like the rest of struct ice_adapter; E825C and devices without a serial number don't share.
Jakub Ramaseuski (3):
ice: release the profile ID on ice_add_prof() error paths
ice: share default RSS hash profiles between PFs
ice: share all RSS hash profiles between PFs
.../net/ethernet/intel/ice/devlink/devlink.c | 2 + drivers/net/ethernet/intel/ice/ice_adapter.c | 13 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- .../net/ethernet/intel/ice/ice_flex_pipe.c | 356 +++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 9 +- .../net/ethernet/intel/ice/ice_flex_type.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 14 +- drivers/net/ethernet/intel/ice/ice_main.c | 5 + drivers/net/ethernet/intel/ice/virt/rss.c | 2 +- 10 files changed, 395 insertions(+), 16 deletions(-)
Signature · 1 line
2.56.0
PATCH 1/3 ice: release the profile ID on ice_add_prof() error paths
When no profile ID matches the extraction sequence, ice_add_prof() allocates a new one. If ice_update_fd_swap() or ice_update_prof_masking() then fails, it returns without freeing the ID, and if allocating the profile map entry fails, without dropping the reference it took. Either way the profile ID, a resource of the whole device, is leaked.
Free the ID on the first two paths, and drop the reference on the third before jumping to err_ice_add_prof.
--- drivers/net/ethernet/intel/ice/ice_flex_pipe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +7 -2
@@ -3065,14 +3065,18 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,* during Tx. */ status =ice_update_fd_swap (hw, prof_id, es); -if (status) +if (status) { +ice_free_prof_id (hw, blk, prof_id); goto err_ice_add_prof; + } }else if (blk ==ICE_BLK_FD ) {ice_disable_fd_swap (hw, prof_id); } status =ice_update_prof_masking (hw, blk, prof_id, masks); -if (status) +if (status) { +ice_free_prof_id (hw, blk, prof_id); goto err_ice_add_prof; + }/* and write new es */ ice_write_es (hw, blk, prof_id, es, symm);
@@ -3083,6 +3087,7 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,/* add profile info */ prof =devm_kzalloc_obj (ice_hw_to_dev (hw), *prof);if (!prof) { +ice_prof_dec_ref (hw, blk, prof_id); status = -ENOMEM ; goto err_ice_add_prof; }
Signature · 1 line
2.56.0
PATCH 2/3 ice: share default RSS hash profiles between PFs
In reply to Jakub RamaseuskiRSS hash profile IDs are a firmware resource of the whole device: the DDP package defines 128 of them, of which IDs 2-127 can be used by the PFs. Each PF allocates its own IDs, and since
commit a6d63bbf2c52 ("ice: Implement RSS settings for GTP using ethtool") its default RSS configuration takes 19 of them. On devices with 8 PFs, like the E830-XXVDA8F, that is 152 IDs: the PFs probed last lose part or all of their default RSS configuration, and RSS configurations requested later, e.g. by VFs, fail:
ice 0000:6c:00.0: ice_add_rss_cfg failed for VF 0, VSI 2, error:-5
The default configuration is the same on all PFs, and so are the profiles it needs. The package, for E810 and E830 alike, defines the RSS profile IDs as shared resources: firmware lets a PF allocate an ID another PF holds, by allocating that index without ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX, keeps the ID until its last user frees it, and a PF reset releases the IDs of that PF. What firmware does not provide is a lookup of the ID programmed with an extraction sequence.
Keep a list of the profile IDs shared by the PFs in struct ice_adapter, keyed by extraction sequence. When a PF needs an ID for a default profile, it joins the ID another PF uses for the same extraction sequence, or allocates a new one and adds it to the list. Each PF takes and releases its own firmware reference, through its own admin queue, when its reference count of the profile goes from 0 to 1 and from 1 to 0; the PFs never access the tables of each other.
Only profiles using neither field masks nor symmetric hashing are shared:
the GLQF_HMASK registers are split between the PFs, and GLQF_HSYMM is programmed by every user of a profile. Such profiles, including the two GTP-U ones hashing on the QFI field, keep one ID per PF. Raw (parser) profiles program GLQF_HSYMM on their own and never use a shared ID.
A PF leaves the list on reset, devlink reload and remove, as firmware releases its IDs then. CORER, GLOBR and EMPR empty the list: each PF empties it while preparing for the reset, before it can allocate IDs again, so no PF joins an ID the reset freed. A PF that prepares late may drop entries a faster PF made after its rebuild; their IDs stay valid and are freed as usual, only not shared. An ID firmware hands out as a new one drops a stale entry for it. Sharing is off when an ice_adapter can cover more than one device (E825C, devices without a serial number).
While at it, replace the fd_swap parameter of ice_add_prof() with flags.
Measured on an E810-CQDA2 split to 8 PFs (NVM 4.30), with all PFs bound, then one VF created on each PF and "rx-flow-hash {tcp,udp}{4,6} fn" set on it, reading the IDs the PFs hold from firmware:
IDs in use IDs in use after failed profile ID
after probe VFs and ethtool allocations
before 126 126 70 (30 at probe)
after 33 65 0Also checked on an E830-XXVDA8F (8 PFs) with a RHEL 9.6 backport: one VF per PF and "rx-flow-hash {tcp,udp}{4,6} fn" on each, all 32 input set changes succeed with no ice errors.
--- .../net/ethernet/intel/ice/devlink/devlink.c | 2 + drivers/net/ethernet/intel/ice/ice_adapter.c | 13 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- .../net/ethernet/intel/ice/ice_flex_pipe.c | 351 +++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 9 +- .../net/ethernet/intel/ice/ice_flex_type.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 51 ++- drivers/net/ethernet/intel/ice/ice_flow.h | 2 + drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- drivers/net/ethernet/intel/ice/ice_main.c | 5 + drivers/net/ethernet/intel/ice/virt/rss.c | 2 +- 12 files changed, 427 insertions(+), 28 deletions(-)
drivers/net/ethernet/intel/ice/devlink/devlink.c +2 -0
@@ -460,6 +460,7 @@ static void ice_devlink_reinit_down(struct ice_pf *pf)ice_vsi_decfg (ice_get_main_vsi (pf));rtnl_unlock ();ice_deinit_pf (pf); +ice_put_shared_profs (&pf->hw);ice_deinit_hw (&pf->hw);ice_deinit_dev (pf); }
@@ -1326,6 +1327,7 @@ static int ice_devlink_reinit_up(struct ice_pf *pf) unroll_dev_init: need_dev_deinit = true; unroll_hw_init: +ice_put_shared_profs (&pf->hw);ice_deinit_hw (&pf->hw);if (need_dev_deinit)ice_deinit_dev (pf);
drivers/net/ethernet/intel/ice/ice_adapter.c +13 -0
@@ -53,7 +53,9 @@ static int ice_adapter_init(void *priv, void *init_param) {const struct ice_hw *hw = init_param;struct ice_adapter *adapter = priv; +struct ice_pf *pf = hw->back;struct devlink *devlink; +u64 index; devlink =shd_priv_to_devlink (adapter); adapter->devlink = devlink;
@@ -84,6 +86,15 @@ static int ice_adapter_init(void *priv, void *init_param) adapter->phc.use_timecounter =ice_adapter_use_timecounter (hw); +mutex_init (&adapter->rss_prof_lock); +INIT_LIST_HEAD (&adapter->rss_profs); +/* RSS hash profile IDs come from the firmware of a single device. +* The NACs of E825C, and devices without a serial number, +* may share one ice_adapter, but not the profile IDs. +*/ + index =ice_adapter_index (pf->pdev); + adapter->rss_prof_share = index && !(index &ICE_ADAPTER_FIXED_INDEX ); +return init_srcu_struct (&adapter->ports.srcu); }
@@ -92,10 +103,12 @@ static void ice_adapter_fini(void *priv)struct ice_adapter *adapter = priv;WARN_ON (!list_empty (&adapter->ports.list)); +WARN_ON (!list_empty (&adapter->rss_profs));for (int i =0 ; i <ARRAY_SIZE (adapter->cpi_phy_lock); i++)mutex_destroy (&adapter->cpi_phy_lock[i]);mutex_destroy (&adapter->cgu_synce_lock);mutex_destroy (&adapter->rebuild_lock); +mutex_destroy (&adapter->rss_prof_lock);cleanup_srcu_struct (&adapter->ports.srcu);mutex_destroy (&adapter->ps_lock);
drivers/net/ethernet/intel/ice/ice_adapter.h +7 -0
@@ -101,6 +101,9 @@ struct ice_phc {* @ctrl_pf: Control PF of the adapter * @rebuild_lock: serialize PFR recovery across PFs of the same adapter * @ports: Ports list +* @rss_prof_lock: Mutex protecting @rss_profs +* @rss_profs: RSS hash profile IDs shared by the PFs, see ice_flex_pipe.c +* @rss_prof_share: The PFs may share RSS hash profile IDs */ struct ice_adapter {struct devlink *devlink;
@@ -124,6 +127,10 @@ struct ice_adapter {struct rw_semaphore ctrl_pf_lock;struct ice_pf __rcu *ctrl_pf;struct ice_port_list ports; +/* For access to the list of shared RSS hash profiles */ +struct mutex rss_prof_lock; +struct list_head rss_profs; +bool rss_prof_share; };struct ice_adapter *ice_adapter_get (struct pci_dev *pdev);
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -1
@@ -2966,7 +2966,7 @@ ice_set_rxfh_fields(struct net_device *netdev,struct ice_netdev_priv *np =netdev_priv (netdev);struct ice_vsi *vsi = np->vsi;struct ice_pf *pf = vsi->back; -struct ice_rss_hash_cfg cfg; +struct ice_rss_hash_cfg cfg = {};struct device *dev;u64 hashed_flds;int status;
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +342 -9
438 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +8 -1
@@ -8,6 +8,11 @@#define ICE_FDIR_REG_SET_SIZE 4 +/* ice_add_prof() flags */ +#define ICE_PROF_FD_SWAP BIT(0)/* FD: swap paired src/dst fields */ +#define ICE_PROF_SHARED BIT(1)/* RSS: may share the ID with other PFs */ +#define ICE_PROF_RAW BIT(2)/* parser profile: never use a shared ID */ +int ice_acquire_change_lock (struct ice_hw *hw,enum ice_aq_res_access_type access);void ice_release_change_lock (struct ice_hw *hw);
@@ -42,7 +47,7 @@ int ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, unsigned long *ptypes, const struct ice_ptype_attributes *attr, u16 attr_cnt, struct ice_fv_word *es, u16 *masks, bool symm, - bool fd_swap); + u32 flags);struct ice_prof_map *ice_search_prof_id (struct ice_hw *hw,enum ice_block blk,u64 id);int
@@ -61,6 +66,8 @@ void ice_free_seg(struct ice_hw *hw);void ice_fill_blk_tbls (struct ice_hw *hw);void ice_clear_hw_tbls (struct ice_hw *hw);void ice_free_hw_tbls (struct ice_hw *hw); +void ice_put_shared_profs (struct ice_hw *hw); +void ice_flush_shared_profs (struct ice_hw *hw);int ice_rem_prof (struct ice_hw *hw,enum ice_block blk,u64 id);struct ice_buf_build * ice_pkg_buf_alloc_single_section(struct ice_hw *hw, u32 type, u16 size,
drivers/net/ethernet/intel/ice/ice_flex_type.h +1 -0
@@ -148,6 +148,7 @@ struct ice_es {struct list_head prof_map;struct ice_fv_word *t;u8 *symm;/* symmetric setting per profile (RSS blk)*/ +u8 *shared;/* profile ID is shared with other PFs (RSS blk) */ struct mutex prof_map_lock;/* protect access to profiles list */ u8 *written;u8 reverse;/* set to true to reverse FV order */
drivers/net/ethernet/intel/ice/ice_flow.c +39 -12
125 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flow.h +2 -0
@@ -383,6 +383,7 @@ struct ice_rss_hash_cfg {u64 hash_flds;/* hash bit field (ICE_FLOW_HASH_*) to configure */ enum ice_rss_cfg_hdr_type hdr_type;/* to specify inner or outer */ bool symm;/* symmetric or asymmetric hash */ +bool shared;/* may share the HW profile with other PFs */ };enum ice_flow_dir {
@@ -482,6 +483,7 @@ struct ice_flow_prof {DECLARE_BITMAP (vsis,ICE_MAX_VSI );bool symm;/* Symmetric Hash for RSS */ +bool shared;/* HW profile may be shared with other PFs */ };struct ice_rss_raw_cfg {
drivers/net/ethernet/intel/ice/ice_lib.c +6 -4
@@ -1778,13 +1778,15 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi)return ; }for (i =0 ; i <ARRAY_SIZE (default_rss_cfgs); i++) { -const struct ice_rss_hash_cfg *cfg = &default_rss_cfgs[i]; +struct ice_rss_hash_cfg cfg = default_rss_cfgs[i]; - status =ice_add_rss_cfg (hw, vsi, cfg); +/* the defaults are the same on all PFs, share their profiles */ + cfg.shared = true; + status =ice_add_rss_cfg (hw, vsi, &cfg);if (status)dev_dbg (dev,"ice_add_rss_cfg failed, addl_hdrs = %x, hash_flds = %llx, hdr_type = %d, symm = %d\n" , - cfg->addl_hdrs, cfg->hash_flds, - cfg->hdr_type, cfg->symm); + cfg.addl_hdrs, cfg.hash_flds, + cfg.hdr_type, cfg.symm); } }
drivers/net/ethernet/intel/ice/ice_main.c +5 -0
@@ -672,6 +672,9 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)ice_fdir_clear_flow_handles (hw);/* clear SW filtering DB */ ice_clear_hw_tbls (hw); +/* a CORER, GLOBR or EMPR also clears the profile IDs of the other PFs */ +if (reset_type !=ICE_RESET_PFR ) +ice_flush_shared_profs (hw);/* disable the VSIs and their queues that are not already DOWN */ set_bit (ICE_VSI_REBUILD_PENDING ,ice_get_main_vsi (pf)->state);ice_pf_dis_all_vsi (pf, false);
@@ -5390,6 +5393,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) unroll_dev_init: need_dev_deinit = true; unroll_adapter: +ice_put_shared_profs (hw);ice_adapter_put (adapter); unroll_hw_init:ice_deinit_hw (hw);
@@ -5506,6 +5510,7 @@ static void ice_remove(struct pci_dev *pdev)ice_set_wake (pf); +ice_put_shared_profs (&pf->hw);ice_adapter_put (pf->adapter);ice_deinit_hw (&pf->hw);
drivers/net/ethernet/intel/ice/virt/rss.c +1 -1
@@ -1646,7 +1646,7 @@ int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add) v_ret =VIRTCHNL_STATUS_ERR_PARAM ; } }else { -struct ice_rss_hash_cfg cfg; +struct ice_rss_hash_cfg cfg = {};/* Only check for none raw pattern case */ if (!ice_vc_validate_pattern (vf, &rss_cfg->proto_hdrs)) {
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH iwl-next 2/3] ice: share default RSS hash profiles between PFs
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] ice: use-after-free in…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] ice: use-after-free in ice_vc_fdir_rem_prof() during PF reset
[1]
--
commit 48401f6c29b813715dc1bcf787d7992e20c344db
Author: Jakub Ramaseuski <[email protected]>
ice: share default RSS hash profiles between PFs
This commit tracks shared RSS hash profile IDs in struct ice_adapter so that multiple PFs on the same device can reuse firmware profile IDs for default RSS configurations without exhausting the device-wide pool.
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-0
drivers/net/ethernet/intel/ice/ice_main.c ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type) · line 612
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_main.c +3
-0@@ -604,6 +604,9 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)ice_fdir_clear_flow_handles (hw);/* clear SW filtering DB */ ice_clear_hw_tbls (hw); +/* a CORER, GLOBR or EMPR also clears the profile IDs of the other PFs */ +if (reset_type !=ICE_RESET_PFR ) +ice_flush_shared_profs (hw);/* disable the VSIs and their queues that are not already DOWN */ set_bit (ICE_VSI_REBUILD_PENDING ,ice_get_main_vsi (pf)->state);ice_pf_dis_all_vsi (pf, false);
[Severity: High]
This problem wasn't introduced by this patch, but can ice_clear_hw_tbls() here trigger a use-after-free and double free of struct ice_flow_entry in ice_vc_fdir_rem_prof() during a PF reset [1]?
ice_fdir_clear_flow_handles() clears the PF's cached flow entry handles before ice_clear_hw_tbls() -> ice_free_flow_profs() frees every profile and entry in hw->fl_profs[ICE_BLK_FD], but nothing clears the handles cached by VFs in vf_prof->entry_h:
drivers/net/ethernet/intel/ice/virt/fdir.c:ice_vc_fdir_rem_prof() {
...
for (i = 0; i < fdir->prof_entry_cnt[flow][tun]; i++)
if (vf_prof->entry_h[i][tun]) {
u16 vsi_num = ice_get_hw_vsi_num(hw, vf_prof->vsi_h[i]);
ice_rem_prof_id_flow(hw, ICE_BLK_FD, vsi_num, prof_id);
ice_flow_rem_entry(hw, ICE_BLK_FD,
vf_prof->entry_h[i][tun]);
vf_prof->entry_h[i][tun] = 0;
}
...
}When the reset later runs ice_reset_all_vfs() -> ice_vf_fdir_exit() -> ice_vc_fdir_rem_prof_all() -> ice_vc_fdir_rem_prof(), those dangling vf_prof->entry_h pointers are passed to ice_flow_rem_entry(), which dereferences and frees the struct ice_flow_entry a second time, and the stale vf_prof->prof_id is passed to ice_flow_rem_prof(), which can remove a flow profile reallocated during ice_rebuild().
[1] https://sashiko.dev/#/bug/linux-bf11eccc-e91f-476d-9247-5b7368b4b35b
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Przemek Kitszel
maintainerRe: [PATCH iwl-next 2/3] ice: share default RSS hash profiles between PFs
In reply to Jakub RamaseuskiQuoted 110 lines · Jakub Ramaseuski
RSS hash profile IDs are a firmware resource of the whole device: the DDP package defines 128 of them, of which IDs 2-127 can be used by the PFs. Each PF allocates its own IDs, and since
commita6d63bbf2c52("ice: Implement RSS settings for GTP using ethtool") its default RSS configuration takes 19 of them. On devices with 8 PFs, like the E830-XXVDA8F, that is 152 IDs: the PFs probed last lose part or all of their default RSS configuration, and RSS configurations requested later, e.g. by VFs, fail:ice 0000:6c:00.0: ice_add_rss_cfg failed for VF 0, VSI 2, error:-5The default configuration is the same on all PFs, and so are the profiles it needs. The package, for E810 and E830 alike, defines the RSS profile IDs as shared resources: firmware lets a PF allocate an ID another PF holds, by allocating that index without
ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX, keeps the ID until its last user frees it, and a PF reset releases the IDs of that PF. What firmware does not provide is a lookup of the ID programmed with an extraction sequence.Keep a list of the profile IDs shared by the PFs in struct
ice_adapter, keyed by extraction sequence. When a PF needs an ID for a default profile, it joins the ID another PF uses for the same extraction sequence, or allocates a new one and adds it to the list. Each PF takes and releases its own firmware reference, through its own admin queue, when its reference count of the profile goes from 0 to 1 and from 1 to 0; the PFs never access the tables of each other.Only profiles using neither field masks nor symmetric hashing are shared:
theGLQF_HMASKregisters are split between the PFs, andGLQF_HSYMMis programmed by every user of a profile. Such profiles, including the two GTP-U ones hashing on the QFI field, keep one ID per PF. Raw (parser) profiles programGLQF_HSYMMon their own and never use a shared ID.A PF leaves the list on reset, devlink reload and remove, as firmware releases its IDs then. CORER, GLOBR and EMPR empty the list: each PF empties it while preparing for the reset, before it can allocate IDs again, so no PF joins an ID the reset freed. A PF that prepares late may drop entries a faster PF made after its rebuild; their IDs stay valid and are freed as usual, only not shared. An ID firmware hands out as a new one drops a stale entry for it. Sharing is off when an
ice_adaptercan cover more than one device (E825C, devices without a serial number).While at it, replace the
fd_swapparameter ofice_add_prof()with flags.Measured on an E810-CQDA2 split to 8 PFs (NVM 4.30), with all PFs bound, then one VF created on each PF and "rx-flow-hash {tcp,udp}{4,6} fn" set on it, reading the IDs the PFs hold from firmware:
IDs in use IDs in use after failed profile ID after probe VFs and ethtool allocations before 126 126 70 (30 at probe) after 33 65 0Also checked on an E830-XXVDA8F (8 PFs) with a RHEL 9.6 backport: one VF per PF and "rx-flow-hash {tcp,udp}{4,6} fn" on each, all 32 input set changes succeed with no ice errors.
Fixes a6d63bbf2c52 ("ice: Implement RSS settings for GTP using ethtool")Signed-off-by Jakub Ramaseuski <[email protected]>--- .../net/ethernet/intel/ice/devlink/devlink.c | 2 + drivers/net/ethernet/intel/ice/ice_adapter.c | 13 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- .../net/ethernet/intel/ice/ice_flex_pipe.c | 351 +++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 9 +- .../net/ethernet/intel/ice/ice_flex_type.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 51 ++- drivers/net/ethernet/intel/ice/ice_flow.h | 2 + drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- drivers/net/ethernet/intel/ice/ice_main.c | 5 + drivers/net/ethernet/intel/ice/virt/rss.c | 2 +- 12 files changed, 427 insertions(+), 28 deletions(-)drivers/net/ethernet/intel/ice/devlink/devlink.c +2
-0@@ -460,6 +460,7 @@ static void ice_devlink_reinit_down(struct ice_pf *pf)ice_vsi_decfg (ice_get_main_vsi (pf));rtnl_unlock ();ice_deinit_pf (pf); +ice_put_shared_profs (&pf->hw);ice_deinit_hw (&pf->hw);ice_deinit_dev (pf); }@@ -1326,6 +1327,7 @@ static int ice_devlink_reinit_up(struct ice_pf *pf) unroll_dev_init: need_dev_deinit = true; unroll_hw_init: +ice_put_shared_profs (&pf->hw);ice_deinit_hw (&pf->hw);if (need_dev_deinit)ice_deinit_dev (pf);drivers/net/ethernet/intel/ice/ice_adapter.c +2
-0@@ -53,7 +53,9 @@ static int ice_adapter_init(void *priv, void *init_param) {const struct ice_hw *hw = init_param;struct ice_adapter *adapter = priv; +struct ice_pf *pf = hw->back;struct devlink *devlink; +u64 index; devlink =shd_priv_to_devlink (adapter); adapter->devlink = devlink;
drivers/net/ethernet/intel/ice/ice_adapter.c static int ice_adapter_init(void *priv, void *init_param) · line 92
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +4
-0@@ -84,6 +86,15 @@ static int ice_adapter_init(void *priv, void *init_param) adapter->phc.use_timecounter =ice_adapter_use_timecounter (hw); +mutex_init (&adapter->rss_prof_lock); +INIT_LIST_HEAD (&adapter->rss_profs); +/* RSS hash profile IDs come from the firmware of a single device. +* The NACs of E825C, and devices without a serial number,
I would not care about devices w/o DNS - those are strictly "pre-prod", and if someone at intel (those should not leave our lab) would have such cards, it will be sufficient to just use only one per machine, or to program DNS number to some other value.
--
For the 2 NAC mode, it bothers me after working with the code around, that it was melted with the "whole device" thing, except its shared or not depending on the topic. Would be great to add one more level of common abstraction. Of course its not easy given there are multiple series in flight that touch the code.
(this is not an action item for you, just saying that improvement here would be much welcomed by me personally)
Quoted 51 lines
drivers/net/ethernet/intel/ice/ice_adapter.c +7
-0+* may share one ice_adapter, but not the profile IDs. +*/ + index =ice_adapter_index (pf->pdev); + adapter->rss_prof_share = index && !(index &ICE_ADAPTER_FIXED_INDEX ); +return init_srcu_struct (&adapter->ports.srcu); }@@ -92,10 +103,12 @@ static void ice_adapter_fini(void *priv)struct ice_adapter *adapter = priv;WARN_ON (!list_empty (&adapter->ports.list)); +WARN_ON (!list_empty (&adapter->rss_profs));for (int i =0 ; i <ARRAY_SIZE (adapter->cpi_phy_lock); i++)mutex_destroy (&adapter->cpi_phy_lock[i]);mutex_destroy (&adapter->cgu_synce_lock);mutex_destroy (&adapter->rebuild_lock); +mutex_destroy (&adapter->rss_prof_lock);cleanup_srcu_struct (&adapter->ports.srcu);mutex_destroy (&adapter->ps_lock);drivers/net/ethernet/intel/ice/ice_adapter.h +7
-0@@ -101,6 +101,9 @@ struct ice_phc {* @ctrl_pf: Control PF of the adapter * @rebuild_lock: serialize PFR recovery across PFs of the same adapter * @ports: Ports list +* @rss_prof_lock: Mutex protecting @rss_profs +* @rss_profs: RSS hash profile IDs shared by the PFs, see ice_flex_pipe.c +* @rss_prof_share: The PFs may share RSS hash profile IDs */ struct ice_adapter {struct devlink *devlink;@@ -124,6 +127,10 @@ struct ice_adapter {struct rw_semaphore ctrl_pf_lock;struct ice_pf __rcu *ctrl_pf;struct ice_port_list ports; +/* For access to the list of shared RSS hash profiles */ +struct mutex rss_prof_lock; +struct list_head rss_profs; +bool rss_prof_share; };struct ice_adapter *ice_adapter_get (struct pci_dev *pdev);drivers/net/ethernet/intel/ice/ice_ethtool.c +0
-0
drivers/net/ethernet/intel/ice/ice_ethtool.c ice_set_rxfh_fields(struct net_device *netdev, · line 2969
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +1
-1@@ -2966,7 +2966,7 @@ ice_set_rxfh_fields(struct net_device *netdev,struct ice_netdev_priv *np =netdev_priv (netdev);struct ice_vsi *vsi = np->vsi;struct ice_pf *pf = vsi->back; -struct ice_rss_hash_cfg cfg; +struct ice_rss_hash_cfg cfg = {};
rct
Quoted 65 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +0
-0struct device *dev;u64 hashed_flds;int status;drivers/net/ethernet/intel/ice/ice_flex_pipe.c +34
-1@@ -1215,12 +1215,13 @@ ice_prof_has_mask(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 *masks)* @fv: field vector to search for * @masks: masks for FV * @symm: symmetric setting for RSS flows +* @skip_shared: do not return a profile ID shared with other PFs * @prof_id: receives the profile ID */ static int ice_find_prof_id_with_mask (struct ice_hw *hw,enum ice_block blk,struct ice_fv_word *fv,u16 *masks,bool symm, -u8 *prof_id) +bool skip_shared,u8 *prof_id) {struct ice_es *es = &hw->blk[blk].es;u8 i;@@ -1237,6 +1238,9 @@ ice_find_prof_id_with_mask(struct ice_hw *hw, enum ice_block blk,if (blk ==ICE_BLK_RSS && es->symm[i] != symm)continue ; +if (skip_shared && es->shared[i]) +continue ; +if (memcmp (&es->t[off], fv, es->fvw *sizeof (*fv)))continue ;@@ -1376,6 +1380,324 @@ static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id)return ice_free_hw_res (hw, res_type,1 , &tmp_prof_id); } +/** +* struct ice_shared_prof - RSS hash profile ID shared by the PFs of an adapter +* @list: entry in the list of shared profiles of the adapter +* @es: extraction sequence the profile ID is programmed with +* @pfs: bitmap of the PFs (by hw->pf_id) holding a reference to the ID +* @prof_id: the profile ID +* +* The DDP package defines the RSS profile IDs as shared resources: firmware +* lets every PF allocate an ID that another PF already holds, keeps the ID +* until its last user frees it, and a PF reset drops the references of that +* PF. Firmware cannot look up the ID programmed with an extraction sequence, +* the adapter keeps a list of these entries for that. +* +* Only profiles without field masks and symmetric hashing are shared, their +* only hardware state is the extraction sequence, which all PFs write the +* same. The GLQF_HMASK registers are split between the PFs, and GLQF_HSYMM is +* programmed by every user of a profile. +*/ +struct ice_shared_prof { +struct list_head list; +struct ice_fv_word es[ICE_MAX_FV_WORDS ]; +unsigned long pfs; +u8 prof_id; +}; + +/** +* ice_shared_profs_adapter - get the adapter whose PFs share profile IDs +* @hw: pointer to the HW struct +* @blk: hardware block
drivers/net/ethernet/intel/ice/ice_flex_pipe.c static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) · line 1421
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +10
-0+* +* Return: the adapter of the PF, if its PFs may share profile IDs of @blk, +* NULL otherwise. +*/ +static struct ice_adapter * +ice_shared_profs_adapter (struct ice_hw *hw,enum ice_block blk) +{ +struct ice_pf *pf = hw->back; + +if (blk !=ICE_BLK_RSS || !pf->adapter || !pf->adapter->rss_prof_share)
I guess pf->adapter cannot be null
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +9
-0+return NULL ; + +return pf->adapter; +} + +/** +* ice_prof_can_share - check if a profile ID may be shared with other PFs +* @hw: pointer to the HW struct +* @blk: hardware block
drivers/net/ethernet/intel/ice/ice_flex_pipe.c static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) · line 1440
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +10
-0+* @masks: masks for the extraction sequence +* @symm: symmetric setting for RSS profiles +* +* Return: true if the profile uses neither field masks nor symmetric hashing. +*/ +static bool +ice_prof_can_share (struct ice_hw *hw,enum ice_block blk,u16 *masks, +bool symm) +{ +u16 i;
the default type for variable is "int", and loop counters should be declared in the loop header
Quoted 77 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +77
-0+ +if (symm) +return false; + +if (!masks) +return true; + +for (i =0 ; i < hw->blk[blk].es.fvw; i++) +if (masks[i] && masks[i] !=0xFFFF ) +return false; + +return true; +} + +/** +* ice_find_shared_prof - find the shared profile ID for an extraction sequence +* @adapter: adapter of the PFs sharing the profile IDs +* @es: extraction sequence +* @fvw: number of words in @es +* +* Return: the shared profile, NULL if there is none. +*/ +static struct ice_shared_prof * +ice_find_shared_prof (struct ice_adapter *adapter,struct ice_fv_word *es, +u16 fvw) +{ +struct ice_shared_prof *sp; + +list_for_each_entry (sp, &adapter->rss_profs, list) +if (!memcmp (sp->es, es, fvw *sizeof (*es))) +return sp; + +return NULL ; +} + +/** +* ice_find_shared_prof_id - find a shared profile by its ID +* @adapter: adapter of the PFs sharing the profile IDs +* @prof_id: the profile ID +* +* Return: the shared profile, NULL if there is none. +*/ +static struct ice_shared_prof * +ice_find_shared_prof_id (struct ice_adapter *adapter,u8 prof_id) +{ +struct ice_shared_prof *sp; + +list_for_each_entry (sp, &adapter->rss_profs, list) +if (sp->prof_id == prof_id) +return sp; + +return NULL ; +} + +/** +* ice_drop_shared_prof - remove a PF from the users of a shared profile ID +* @sp: the shared profile +* @pf_id: the PF +* +* Free the entry when it has no users left. +*/ +static void ice_drop_shared_prof (struct ice_shared_prof *sp,u8 pf_id) +{ + sp->pfs &= ~BIT (pf_id); +if (sp->pfs) +return ; + +list_del (&sp->list); +kfree (sp); +} + +/** +* ice_join_prof_id - take a reference to a profile ID another PF allocated +* @hw: pointer to the HW struct +* @blk: the block of the profile ID +* @prof_id: the profile ID +*
drivers/net/ethernet/intel/ice/ice_flex_pipe.c static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) · line 1527
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +10
-0+* Allocate the given profile ID, without ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX: +* firmware adds the PF to the users of the ID. +* +* Return: 0 on success, negative error code otherwise. +*/ +static int ice_join_prof_id (struct ice_hw *hw,enum ice_block blk,u8 prof_id) +{ + DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1); +u16 res_type, idx; +int status;
in new code please name the variable "err", not "status"
Quoted 45 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +45
-0+ +if (!ice_prof_id_rsrc_type (blk, &res_type)) +return -EINVAL ; + + buf->num_elems =cpu_to_le16 (1 ); + buf->res_type =cpu_to_le16 (res_type |ICE_AQC_RES_TYPE_FLAG_DEDICATED ); + buf->elem[0 ].e.sw_resp =cpu_to_le16 (prof_id); + + status =ice_aq_alloc_free_res (hw, buf,__struct_size (buf), + ice_aqc_opc_alloc_res); +if (status) +return status; + + idx =le16_to_cpu (buf->elem[0 ].e.sw_resp); +if (idx != prof_id) { +ice_free_hw_res (hw, res_type,1 , &idx); +return -EIO ; + } + +return 0 ; +} + +/** +* ice_get_prof_id - get a profile ID for an extraction sequence +* @hw: pointer to the HW struct +* @blk: hardware block +* @es: extraction sequence of the profile +* @masks: masks for @es +* @symm: symmetric setting for RSS profiles +* @flags: ICE_PROF_* flags of the profile +* @prof_id: receives the profile ID +* +* Get a profile ID for @es, which the PF does not have yet. With +* ICE_PROF_SHARED, join the ID another PF of the adapter has for @es, or +* allocate a new one and make it available to the other PFs. +* +* Return: 0 on success, negative error code otherwise. +*/ +static int +ice_get_prof_id (struct ice_hw *hw,enum ice_block blk,struct ice_fv_word *es, +u16 *masks,bool symm,u32 flags,u8 *prof_id) +{ +struct ice_adapter *adapter =ice_shared_profs_adapter (hw, blk); +u16 fvw = hw->blk[blk].es.fvw; +struct ice_shared_prof *sp;
drivers/net/ethernet/intel/ice/ice_flex_pipe.c static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) · line 1582
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +10
-0+bool share; +int status; + +if (!adapter) +return ice_alloc_prof_id (hw, blk, prof_id); + + share = (flags &ICE_PROF_SHARED ) && +ice_prof_can_share (hw, blk, masks, symm); + +guard (mutex)(&adapter->rss_prof_lock);
we ban guard()() in netdev, scoped_guard() is fine
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +13
-0+ + sp = share ?ice_find_shared_prof (adapter, es, fvw) :NULL ; +if (sp) { + status =ice_join_prof_id (hw, blk, sp->prof_id); +if (!status) { + sp->pfs |=BIT (hw->pf_id); + hw->blk[blk].es.shared[sp->prof_id] =1 ; + *prof_id = sp->prof_id; +return 0 ; + } + +ice_debug (hw,ICE_DBG_PKG ,"Failed to join profile ID %u, allocating a new one: %d\n" , + sp->prof_id, status);
drivers/net/ethernet/intel/ice/ice_flex_pipe.c static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) · line 1605
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +10
-0+ share = false; + } + + status =ice_alloc_prof_id (hw, blk, prof_id); +if (status) +return status; + +/* Firmware hands out unused IDs only, an entry for the ID is a stale +* one, left from before a reset that cleared the IDs of all PFs. +*/
should we clear those at reset?
drivers/net/ethernet/intel/ice/ice_flex_pipe.c static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) · line 1615
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +10
-0+ sp =ice_find_shared_prof_id (adapter, *prof_id); +if (sp) { +list_del (&sp->list); +kfree (sp); + } + +if (!share) +return 0 ; + +/* without an entry the ID just stays private to the PF */
too many comments - general rule is to avoid (esp. in the AI era), it's fine to comment about something that is not inferrable from the code, like FW/HW behavior
Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +12
-0+ sp =kzalloc_obj (*sp); +if (!sp) +return 0 ; + +memcpy (sp->es, es, fvw *sizeof (*es)); + sp->pfs =BIT (hw->pf_id); + sp->prof_id = *prof_id; +list_add (&sp->list, &adapter->rss_profs); + hw->blk[blk].es.shared[*prof_id] =1 ; + +return 0 ; +}
PATCH 3/3 ice: share all RSS hash profiles between PFs
In reply to Jakub RamaseuskiThe previous patch lets the PFs of a device share the profile IDs of the default RSS configuration. RSS profiles added later still take an ID per PF, even when the same profile exists on all PFs: with a VF on each of 8 PFs, the default RSS of the VF VSIs and the same "ethtool -N <vf> rx-flow-hash" settings on all VFs take 4 more IDs per PF.
A profile ID depends only on the extraction sequence, everything else (TCAM entries, VSI groups) is per PF. Share the ID of every RSS profile added through the flow API: besides the defaults, the ones added by ethtool, by VFs (advanced RSS and the AVF hash enable bits) and on replay. As before, profiles using field masks or symmetric hashing, and raw profiles, keep IDs of their own.
The shared flag of the RSS hash configuration is not needed any more, remove it.
Measured on an E810-CQDA2 split to 8 PFs (NVM 4.30), with all PFs bound, then one VF created on each PF and "rx-flow-hash {tcp,udp}{4,6} fn" set on it, reading the IDs the PFs hold from firmware:
IDs in use IDs in use after failed profile ID
after probe VFs and ethtool allocations
before 33 65 0
after 33 37 0--- drivers/net/ethernet/intel/ice/ice_flow.c | 49 +++++++---------------- drivers/net/ethernet/intel/ice/ice_flow.h | 2 - drivers/net/ethernet/intel/ice/ice_lib.c | 10 ++--- 3 files changed, 18 insertions(+), 43 deletions(-)
drivers/net/ethernet/intel/ice/ice_flow.c +14 -35
@@ -1444,7 +1444,6 @@ ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block __always_unused blk,* @segs: array of one or more packet segments that describe the flow * @segs_cnt: number of packet segments provided * @symm: symmetric setting for RSS profiles -* @shared: the HW profile may be shared with other PFs * @prof: stores the returned flow profile added * * Assumption: the caller has acquired the lock to the profile list
@@ -1453,7 +1452,7 @@ static int ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir, struct ice_flow_seg_info *segs, u8 segs_cnt, - bool symm, bool shared, struct ice_flow_prof **prof) + bool symm, struct ice_flow_prof **prof) { struct ice_flow_prof_params *params;struct ice_prof_id *ids;
@@ -1490,7 +1489,6 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, params->prof->dir = dir; params->prof->segs_cnt = segs_cnt; params->prof->symm = symm; - params->prof->shared = shared;/* Make a copy of the segments that need to be persistent in the flow * profile instance
@@ -1504,11 +1502,14 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, goto out; } -/* Add a HW profile for this flow profile */ +/* Add a HW profile for this flow profile. An RSS profile without +* field masks and symmetric hashing may share its ID with the other +* PFs, see ice_prof_can_share(). +*/ status =ice_add_prof (hw, blk, prof_id, params->ptypes, params->attr, params->attr_cnt, params->es, params->mask, symm, -ICE_PROF_FD_SWAP | (shared ?ICE_PROF_SHARED :0 )); +ICE_PROF_FD_SWAP |ICE_PROF_SHARED );if (status) {ice_debug (hw,ICE_DBG_FLOW ,"Error adding a HW flow profile\n" ); goto out;
@@ -1716,23 +1717,21 @@ ice_flow_set_parser_prof(struct ice_hw *hw, u16 dest_vsi, u16 fdir_vsi, }/** -* __ice_flow_add_prof - Add a flow profile for packet segments and fields +* ice_flow_add_prof - Add a flow profile for packet segments and matched fields * @hw: pointer to the HW struct * @blk: classification stage * @dir: flow direction * @segs: array of one or more packet segments that describe the flow * @segs_cnt: number of packet segments provided * @symm: symmetric setting for RSS profiles -* @shared: the HW profile may be shared with other PFs * @prof: stores the returned flow profile added * * Return: 0 on success, negative error code otherwise. */ -static int -__ice_flow_add_prof (struct ice_hw *hw,enum ice_block blk, -enum ice_flow_dir dir,struct ice_flow_seg_info *segs, -u8 segs_cnt,bool symm,bool shared, -struct ice_flow_prof **prof) +int +ice_flow_add_prof (struct ice_hw *hw,enum ice_block blk,enum ice_flow_dir dir, +struct ice_flow_seg_info *segs,u8 segs_cnt, +bool symm,struct ice_flow_prof **prof) {int status;
@@ -1752,7 +1751,7 @@ __ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk,mutex_lock (&hw->fl_profs_locks[blk]); status =ice_flow_add_prof_sync (hw, blk, dir, segs, segs_cnt, - symm, shared, prof); + symm, prof);if (!status)list_add (&(*prof)->l_entry, &hw->fl_profs[blk]);
@@ -1761,25 +1760,6 @@ __ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk,return status; } -/** -* ice_flow_add_prof - Add a flow profile for packet segments and matched fields -* @hw: pointer to the HW struct -* @blk: classification stage -* @dir: flow direction -* @segs: array of one or more packet segments that describe the flow -* @segs_cnt: number of packet segments provided -* @symm: symmetric setting for RSS profiles -* @prof: stores the returned flow profile added -*/ -int -ice_flow_add_prof (struct ice_hw *hw,enum ice_block blk,enum ice_flow_dir dir, -struct ice_flow_seg_info *segs,u8 segs_cnt, -bool symm,struct ice_flow_prof **prof) -{ -return __ice_flow_add_prof (hw, blk, dir, segs, segs_cnt, symm, false, - prof); -} -/** * ice_flow_rem_prof - Remove a flow profile and all entries associated with it * @hw: pointer to the HW struct
@@ -2300,7 +2280,6 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof) rss_cfg->hash.addl_hdrs = prof->segs[prof->segs_cnt -1 ].hdrs; rss_cfg->hash.hdr_type = hdr_type; rss_cfg->hash.symm = prof->symm; - rss_cfg->hash.shared = prof->shared;set_bit (vsi_handle, rss_cfg->vsis);list_add_tail (&rss_cfg->l_entry, &hw->rss_list_head);
@@ -2645,8 +2624,8 @@ ice_add_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, }/* Create a new flow profile with packet segment information. */ - status =__ice_flow_add_prof (hw, blk,ICE_FLOW_RX , segs, segs_cnt, - cfg->symm, cfg->shared, &prof); + status =ice_flow_add_prof (hw, blk,ICE_FLOW_RX , + segs, segs_cnt, cfg->symm, &prof);if (status) goto exit;
drivers/net/ethernet/intel/ice/ice_flow.h +0 -2
@@ -383,7 +383,6 @@ struct ice_rss_hash_cfg {u64 hash_flds;/* hash bit field (ICE_FLOW_HASH_*) to configure */ enum ice_rss_cfg_hdr_type hdr_type;/* to specify inner or outer */ bool symm;/* symmetric or asymmetric hash */ -bool shared;/* may share the HW profile with other PFs */ };enum ice_flow_dir {
@@ -483,7 +482,6 @@ struct ice_flow_prof {DECLARE_BITMAP (vsis,ICE_MAX_VSI );bool symm;/* Symmetric Hash for RSS */ -bool shared;/* HW profile may be shared with other PFs */ };struct ice_rss_raw_cfg {
drivers/net/ethernet/intel/ice/ice_lib.c +4 -6
@@ -1778,15 +1778,13 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi)return ; }for (i =0 ; i <ARRAY_SIZE (default_rss_cfgs); i++) { -struct ice_rss_hash_cfg cfg = default_rss_cfgs[i]; +const struct ice_rss_hash_cfg *cfg = &default_rss_cfgs[i]; -/* the defaults are the same on all PFs, share their profiles */ - cfg.shared = true; - status =ice_add_rss_cfg (hw, vsi, &cfg); + status =ice_add_rss_cfg (hw, vsi, cfg);if (status)dev_dbg (dev,"ice_add_rss_cfg failed, addl_hdrs = %x, hash_flds = %llx, hdr_type = %d, symm = %d\n" , - cfg.addl_hdrs, cfg.hash_flds, - cfg.hdr_type, cfg.symm); + cfg->addl_hdrs, cfg->hash_flds, + cfg->hdr_type, cfg->symm); } }
Signature · 1 line
2.56.0
Przemek Kitszel
maintainerRe: [PATCH iwl-next 3/3] ice: share all RSS hash profiles between PFs
Quoted 37 lines · Jakub Ramaseuski
The previous patch lets the PFs of a device share the profile IDs of the default RSS configuration. RSS profiles added later still take an ID per PF, even when the same profile exists on all PFs: with a VF on each of 8 PFs, the default RSS of the VF VSIs and the same "ethtool -N <vf> rx-flow-hash" settings on all VFs take 4 more IDs per PF.
A profile ID depends only on the extraction sequence, everything else (TCAM entries, VSI groups) is per PF. Share the ID of every RSS profile added through the flow API: besides the defaults, the ones added by ethtool, by VFs (advanced RSS and the AVF hash enable bits) and on replay. As before, profiles using field masks or symmetric hashing, and raw profiles, keep IDs of their own.
The shared flag of the RSS hash configuration is not needed any more, remove it.
Measured on an E810-CQDA2 split to 8 PFs (NVM 4.30), with all PFs bound, then one VF created on each PF and "rx-flow-hash {tcp,udp}{4,6} fn" set on it, reading the IDs the PFs hold from firmware:
IDs in use IDs in use after failed profile ID after probe VFs and ethtool allocations before 33 65 0 after 33 37 0Signed-off-by Jakub Ramaseuski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_flow.c | 49 +++++++---------------- drivers/net/ethernet/intel/ice/ice_flow.h | 2 - drivers/net/ethernet/intel/ice/ice_lib.c | 10 ++--- 3 files changed, 18 insertions(+), 43 deletions(-)drivers/net/ethernet/intel/ice/ice_flow.c +0
-0
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block __always_unused blk, · line 1447
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_flow.c +0
-1@@ -1444,7 +1444,6 @@ ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block __always_unused blk,* @segs: array of one or more packet segments that describe the flow * @segs_cnt: number of packet segments provided * @symm: symmetric setting for RSS profiles -* @shared: the HW profile may be shared with other PFs
(general rule)
avoid trashing - please structure your PR in a way that code grows incrementally instead adding then removing things
unless you really want to get first two commits via -net, and this one as a feature