}
/**
- * ice_rem_all_rss_vsi_ctx - remove all RSS configurations from VSI context
+ * ice_rem_vsi_rss_list - remove VSI from RSS list
* @hw: pointer to the hardware structure
* @vsi_handle: software VSI handle
*
+ * Remove the VSI from all RSS configurations in the list.
*/
-void ice_rem_all_rss_vsi_ctx(struct ice_hw *hw, u16 vsi_handle)
+void ice_rem_vsi_rss_list(struct ice_hw *hw, u16 vsi_handle)
{
struct ice_rss_cfg *r, *tmp;
- if (!ice_is_vsi_valid(hw, vsi_handle) ||
- LIST_EMPTY(&hw->vsi_ctx[vsi_handle]->rss_list_head))
+ if (LIST_EMPTY(&hw->rss_list_head))
return;
- ice_acquire_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
- LIST_FOR_EACH_ENTRY_SAFE(r, tmp,
- &hw->vsi_ctx[vsi_handle]->rss_list_head,
+ ice_acquire_lock(&hw->rss_locks);
+ LIST_FOR_EACH_ENTRY_SAFE(r, tmp, &hw->rss_list_head,
ice_rss_cfg, l_entry) {
- LIST_DEL(&r->l_entry);
- ice_free(hw, r);
+ if (ice_is_bit_set(r->vsis, vsi_handle)) {
+ ice_clear_bit(vsi_handle, r->vsis);
+
+ if (!ice_is_any_bit_set(r->vsis, ICE_MAX_VSI)) {
+ LIST_DEL(&r->l_entry);
+ ice_free(hw, r);
+ }
+ }
}
- ice_release_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
+ ice_release_lock(&hw->rss_locks);
}
/**
}
/**
- * ice_rem_rss_cfg_vsi_ctx - remove RSS configuration from VSI context
+ * ice_rem_rss_list - remove RSS configuration from list
* @hw: pointer to the hardware structure
* @vsi_handle: software VSI handle
* @prof: pointer to flow profile
* Assumption: lock has already been acquired for RSS list
*/
static void
-ice_rem_rss_cfg_vsi_ctx(struct ice_hw *hw, u16 vsi_handle,
- struct ice_flow_prof *prof)
+ice_rem_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
{
struct ice_rss_cfg *r, *tmp;
* hash configurations associated to the flow profile. If found
* remove from the RSS entry list of the VSI context and delete entry.
*/
- LIST_FOR_EACH_ENTRY_SAFE(r, tmp,
- &hw->vsi_ctx[vsi_handle]->rss_list_head,
+ LIST_FOR_EACH_ENTRY_SAFE(r, tmp, &hw->rss_list_head,
ice_rss_cfg, l_entry) {
if (r->hashed_flds == prof->segs[prof->segs_cnt - 1].match &&
r->packet_hdr == prof->segs[prof->segs_cnt - 1].hdrs) {
- LIST_DEL(&r->l_entry);
- ice_free(hw, r);
+ ice_clear_bit(vsi_handle, r->vsis);
+ if (!ice_is_any_bit_set(r->vsis, ICE_MAX_VSI)) {
+ LIST_DEL(&r->l_entry);
+ ice_free(hw, r);
+ }
return;
}
}
}
/**
- * ice_add_rss_vsi_ctx - add RSS configuration to VSI context
+ * ice_add_rss_list - add RSS configuration to list
* @hw: pointer to the hardware structure
* @vsi_handle: software VSI handle
* @prof: pointer to flow profile
* Assumption: lock has already been acquired for RSS list
*/
static enum ice_status
-ice_add_rss_vsi_ctx(struct ice_hw *hw, u16 vsi_handle,
- struct ice_flow_prof *prof)
+ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
{
struct ice_rss_cfg *r, *rss_cfg;
- LIST_FOR_EACH_ENTRY(r, &hw->vsi_ctx[vsi_handle]->rss_list_head,
+ LIST_FOR_EACH_ENTRY(r, &hw->rss_list_head,
ice_rss_cfg, l_entry)
if (r->hashed_flds == prof->segs[prof->segs_cnt - 1].match &&
- r->packet_hdr == prof->segs[prof->segs_cnt - 1].hdrs)
+ r->packet_hdr == prof->segs[prof->segs_cnt - 1].hdrs) {
+ ice_set_bit(vsi_handle, r->vsis);
return ICE_SUCCESS;
+ }
rss_cfg = (struct ice_rss_cfg *)ice_malloc(hw, sizeof(*rss_cfg));
if (!rss_cfg)
rss_cfg->hashed_flds = prof->segs[prof->segs_cnt - 1].match;
rss_cfg->packet_hdr = prof->segs[prof->segs_cnt - 1].hdrs;
- LIST_ADD_TAIL(&rss_cfg->l_entry,
- &hw->vsi_ctx[vsi_handle]->rss_list_head);
+ ice_set_bit(vsi_handle, rss_cfg->vsis);
+
+ LIST_ADD_TAIL(&rss_cfg->l_entry, &hw->rss_list_head);
return ICE_SUCCESS;
}
if (prof) {
status = ice_flow_disassoc_prof(hw, blk, prof, vsi_handle);
if (!status)
- ice_rem_rss_cfg_vsi_ctx(hw, vsi_handle, prof);
+ ice_rem_rss_list(hw, vsi_handle, prof);
else
goto exit;
if (prof) {
status = ice_flow_assoc_prof(hw, blk, prof, vsi_handle);
if (!status)
- status = ice_add_rss_vsi_ctx(hw, vsi_handle, prof);
+ status = ice_add_rss_list(hw, vsi_handle, prof);
goto exit;
}
goto exit;
}
- status = ice_add_rss_vsi_ctx(hw, vsi_handle, prof);
+ status = ice_add_rss_list(hw, vsi_handle, prof);
exit:
ice_free(hw, segs);
!ice_is_vsi_valid(hw, vsi_handle))
return ICE_ERR_PARAM;
- ice_acquire_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
+ ice_acquire_lock(&hw->rss_locks);
status = ice_add_rss_cfg_sync(hw, vsi_handle, hashed_flds, addl_hdrs);
- ice_release_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
+ ice_release_lock(&hw->rss_locks);
return status;
}
/* Remove RSS configuration from VSI context before deleting
* the flow profile.
*/
- ice_rem_rss_cfg_vsi_ctx(hw, vsi_handle, prof);
+ ice_rem_rss_list(hw, vsi_handle, prof);
if (!ice_is_any_bit_set(prof->vsis, ICE_MAX_VSI))
status = ice_flow_rem_prof_sync(hw, blk, prof);
!ice_is_vsi_valid(hw, vsi_handle))
return ICE_ERR_PARAM;
- ice_acquire_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
+ ice_acquire_lock(&hw->rss_locks);
status = ice_rem_rss_cfg_sync(hw, vsi_handle, hashed_flds, addl_hdrs);
- ice_release_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
+ ice_release_lock(&hw->rss_locks);
return status;
}
/**
- * ice_replay_rss_cfg - remove RSS configurations associated with VSI
+ * ice_replay_rss_cfg - replay RSS configurations associated with VSI
* @hw: pointer to the hardware structure
* @vsi_handle: software VSI handle
*/
if (!ice_is_vsi_valid(hw, vsi_handle))
return ICE_ERR_PARAM;
- ice_acquire_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
- LIST_FOR_EACH_ENTRY(r, &hw->vsi_ctx[vsi_handle]->rss_list_head,
+ ice_acquire_lock(&hw->rss_locks);
+ LIST_FOR_EACH_ENTRY(r, &hw->rss_list_head,
ice_rss_cfg, l_entry) {
- status = ice_add_rss_cfg_sync(hw, vsi_handle, r->hashed_flds,
- r->packet_hdr);
- if (status)
- break;
+ if (ice_is_bit_set(r->vsis, vsi_handle)) {
+ status = ice_add_rss_cfg_sync(hw, vsi_handle,
+ r->hashed_flds,
+ r->packet_hdr);
+ if (status)
+ break;
+ }
}
- ice_release_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
+ ice_release_lock(&hw->rss_locks);
return status;
}
if (hdrs == ICE_FLOW_SEG_HDR_NONE || !ice_is_vsi_valid(hw, vsi_handle))
return ICE_HASH_INVALID;
- ice_acquire_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
- LIST_FOR_EACH_ENTRY(r, &hw->vsi_ctx[vsi_handle]->rss_list_head,
+ ice_acquire_lock(&hw->rss_locks);
+ LIST_FOR_EACH_ENTRY(r, &hw->rss_list_head,
ice_rss_cfg, l_entry)
- if (r->packet_hdr == hdrs) {
+ if (ice_is_bit_set(r->vsis, vsi_handle) &&
+ r->packet_hdr == hdrs) {
rss_cfg = r;
break;
}
- ice_release_lock(&hw->vsi_ctx[vsi_handle]->rss_locks);
+ ice_release_lock(&hw->rss_locks);
return rss_cfg ? rss_cfg->hashed_flds : ICE_HASH_INVALID;
}