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 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 Signed-off-by: Jakub Ramaseuski --- 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(-) diff --git a/drivers/net/ethernet/intel/ice/ice_flow.c b/drivers/net/ethernet/intel/ice/ice_flow.c index 9be769b105cca..02337d9d3de56 100644 --- a/drivers/net/ethernet/intel/ice/ice_flow.c +++ b/drivers/net/ethernet/intel/ice/ice_flow.c @@ -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; diff --git a/drivers/net/ethernet/intel/ice/ice_flow.h b/drivers/net/ethernet/intel/ice/ice_flow.h index 97de59776cdd4..6c6cdc8addb12 100644 --- a/drivers/net/ethernet/intel/ice/ice_flow.h +++ b/drivers/net/ethernet/intel/ice/ice_flow.h @@ -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 { diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index d2e1dc102ce35..f3fefab09f8c1 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -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); } } -- 2.56.0