[dpdk-dev] [PATCH 08/49] net/ice/base: code for removing advanced rule

Maxime Coquelin maxime.coquelin at redhat.com
Wed Jun 5 11:07:19 CEST 2019



On 6/4/19 7:42 AM, Leyi Rong wrote:
> This patch also contains ice_remove_adv_rule function to remove existing
> advanced rules. it also handles the case when we have multiple VSI using
> the same rule using the following helper functions:
> 
> ice_adv_rem_update_vsi_list - function to remove VS from VSI list for
> advanced rules.
> 
> Signed-off-by: Shivanshu Shukla <shivanshu.shukla at intel.com>
> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr at intel.com>
> Signed-off-by: Leyi Rong <leyi.rong at intel.com>
> ---
>   drivers/net/ice/base/ice_switch.c | 309 +++++++++++++++++++++++++++++-
>   drivers/net/ice/base/ice_switch.h |   9 +
>   2 files changed, 310 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
> index ca0497ca7..3719ac4bb 100644
> --- a/drivers/net/ice/base/ice_switch.c
> +++ b/drivers/net/ice/base/ice_switch.c

...

> +/**
> + * ice_rem_adv_for_vsi - removes existing advanced switch rules for a
> + *                       given VSI handle
> + * @hw: pointer to the hardware structure
> + * @vsi_handle: VSI handle for which we are supposed to remove all the rules.
> + *
> + * This function is used to remove all the rules for a given VSI and as soon
> + * as removing a rule fails, it will return immediately with the error code,
> + * else it will return ICE_SUCCESS
> + */
> +enum ice_status
> +ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)
> +{
> +	struct ice_adv_fltr_mgmt_list_entry *list_itr;
> +	struct ice_vsi_list_map_info *map_info;
> +	struct LIST_HEAD_TYPE *list_head;
> +	struct ice_adv_rule_info rinfo;
> +	struct ice_switch_info *sw;
> +	enum ice_status status;
> +	u16 vsi_list_id = 0;
> +	u8 rid;
> +
> +	sw = hw->switch_info;
> +	for (rid = 0; rid < ICE_MAX_NUM_RECIPES; rid++) {
> +		if (!sw->recp_list[rid].recp_created)
> +			continue;
> +		if (!sw->recp_list[rid].adv_rule)
> +			continue;
> +		list_head = &sw->recp_list[rid].filt_rules;
> +		map_info = NULL;

Useless assignation

> +		LIST_FOR_EACH_ENTRY(list_itr, list_head,
> +				    ice_adv_fltr_mgmt_list_entry, list_entry) {
> +			map_info = ice_find_vsi_list_entry(hw, rid, vsi_handle,
> +							   &vsi_list_id);
> +			if (!map_info)
> +				continue;
> +			rinfo = list_itr->rule_info;
> +			rinfo.sw_act.vsi_handle = vsi_handle;
> +			status = ice_rem_adv_rule(hw, list_itr->lkups,
> +						  list_itr->lkups_cnt, &rinfo);
> +			if (status)
> +				return status;
> +			map_info = NULL;

Useless assignation

> +		}
> +	}
> +	return ICE_SUCCESS;
> +}
> +
>   /**
>    * ice_replay_fltr - Replay all the filters stored by a specific list head
>    * @hw: pointer to the hardware structure



More information about the dev mailing list