src/dpdk/drivers/net/ice/base/ice_acl_ctrl.c
enum ice_status
ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx)
{
	struct ice_aqc_actpair act_buf;
	struct ice_aqc_acl_data buf;
	u8 entry_tcam, num_cscd, i;
	enum ice_status status = ICE_SUCCESS;
	u16 idx;

	if (!scen)
		return ICE_ERR_DOES_NOT_EXIST;

	if (entry_idx >= scen->num_entry)
		return ICE_ERR_MAX_LIMIT;

	if (!ice_is_bit_set(scen->entry_bitmap, entry_idx))
		return ICE_ERR_DOES_NOT_EXIST;

	/* Determine number of cascaded TCAMs */
	num_cscd = DIVIDE_AND_ROUND_UP(scen->width,
				       ICE_AQC_ACL_KEY_WIDTH_BYTES);

	entry_tcam = ICE_ACL_TBL_TCAM_IDX(scen->start);
	idx = ICE_ACL_TBL_TCAM_ENTRY_IDX(scen->start + entry_idx);

	/* invalidate the flow entry */
	ice_memset(&buf, 0, sizeof(buf), ICE_NONDMA_MEM);
	for (i = 0; i < num_cscd; i++) {
		status = ice_aq_program_acl_entry(hw, entry_tcam + i, idx, &buf,
						  NULL);
		if (status)
			ice_debug(hw, ICE_DBG_ACL, "AQ program ACL entry failed status: %d\n",
				  status);
	}

	ice_memset(&act_buf, 0, sizeof(act_buf), ICE_NONDMA_MEM);

	ice_for_each_set_bit(i, scen->act_mem_bitmap,
			     ICE_AQC_MAX_ACTION_MEMORIES) {
		struct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i];

		if (mem->member_of_tcam >= entry_tcam &&
		    mem->member_of_tcam < entry_tcam + num_cscd) {
			/* Invalidate allocated action pairs */
			status = ice_aq_program_actpair(hw, i, idx, &act_buf,
							NULL);
			if (status)
				ice_debug(hw, ICE_DBG_ACL, "program actpair failed status: %d\n",
					  status);
		}
	}

	ice_acl_scen_free_entry_idx(scen, entry_idx);

	return status;
}
/**
 * ice_acl_rem_entry - Remove a flow entry from an ACL scenario
 * @hw: pointer to the HW struct
 * @scen: scenario to remove the entry from
 * @entry_idx: the scenario-relative index of the flow entry being removed
 */
Remove a flow entry from an ACL scenario
@hw: pointer to the HW struct
@scen: scenario to remove the entry from
@entry_idx: the scenario-relative index of the flow entry being removed
Remove a flow entry from an ACL scenario @hw : pointer to the HW struct @scen : scenario to remove the entry from @entry_idx : the scenario - relative index of the flow entry being removed
enum ice_status
ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx)
{
	struct ice_aqc_actpair act_buf;
	struct ice_aqc_acl_data buf;
	u8 entry_tcam, num_cscd, i;
	enum ice_status status = ICE_SUCCESS;
	u16 idx;
	if (!scen)
		return ICE_ERR_DOES_NOT_EXIST;
	if (entry_idx >= scen->num_entry)
		return ICE_ERR_MAX_LIMIT;
	if (!ice_is_bit_set(scen->entry_bitmap, entry_idx))
		return ICE_ERR_DOES_NOT_EXIST;
	num_cscd = DIVIDE_AND_ROUND_UP(scen->width,
				       ICE_AQC_ACL_KEY_WIDTH_BYTES);
	entry_tcam = ICE_ACL_TBL_TCAM_IDX(scen->start);
	idx = ICE_ACL_TBL_TCAM_ENTRY_IDX(scen->start + entry_idx);
	ice_memset(&buf, 0, sizeof(buf), ICE_NONDMA_MEM);
	for (i = 0; i < num_cscd; i++) {
		status = ice_aq_program_acl_entry(hw, entry_tcam + i, idx, &buf,
						  NULL);
		if (status)
			ice_debug(hw, ICE_DBG_ACL, "AQ program ACL entry failed status: %d\n",
				  status);
	}
	ice_memset(&act_buf, 0, sizeof(act_buf), ICE_NONDMA_MEM);
	ice_for_each_set_bit(i, scen->act_mem_bitmap,
			     ICE_AQC_MAX_ACTION_MEMORIES) {
		struct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i];
		if (mem->member_of_tcam >= entry_tcam &&
		    mem->member_of_tcam < entry_tcam + num_cscd) {
			status = ice_aq_program_actpair(hw, i, idx, &act_buf,
							NULL);
			if (status)
				ice_debug(hw, ICE_DBG_ACL, "program actpair failed status: %d\n",
					  status);
		}
	}
	ice_acl_scen_free_entry_idx(scen, entry_idx);
	return status;
}
enum ice_status ice_acl_rem_entry ( struct ice_hw * hw , struct ice_acl_scen * scen , u16 entry_idx ) { struct ice_aqc_actpair act_buf ; struct ice_aqc_acl_data buf ; u8 entry_tcam , num_cscd , i ; enum ice_status status = ICE_SUCCESS ; u16 idx ; if ( ! scen ) return ICE_ERR_DOES_NOT_EXIST ; if ( entry_idx >= scen -> num_entry ) return ICE_ERR_MAX_LIMIT ; if ( ! ice_is_bit_set ( scen -> entry_bitmap , entry_idx ) ) return ICE_ERR_DOES_NOT_EXIST ; num_cscd = DIVIDE_AND_ROUND_UP ( scen -> width , ICE_AQC_ACL_KEY_WIDTH_BYTES ) ; entry_tcam = ICE_ACL_TBL_TCAM_IDX ( scen -> start ) ; idx = ICE_ACL_TBL_TCAM_ENTRY_IDX ( scen -> start + entry_idx ) ; ice_memset ( & buf , 0 , sizeof ( buf ) , ICE_NONDMA_MEM ) ; for ( i = 0 ; i < num_cscd ; i ++ ) { status = ice_aq_program_acl_entry ( hw , entry_tcam + i , idx , & buf , NULL ) ; if ( status ) ice_debug ( hw , ICE_DBG_ACL , " \n " , status ) ; } ice_memset ( & act_buf , 0 , sizeof ( act_buf ) , ICE_NONDMA_MEM ) ; ice_for_each_set_bit ( i , scen -> act_mem_bitmap , ICE_AQC_MAX_ACTION_MEMORIES ) { struct ice_acl_act_mem * mem = & hw -> acl_tbl -> act_mems [ i ] ; if ( mem -> member_of_tcam >= entry_tcam && mem -> member_of_tcam < entry_tcam + num_cscd ) { status = ice_aq_program_actpair ( hw , i , idx , & act_buf , NULL ) ; if ( status ) ice_debug ( hw , ICE_DBG_ACL , " \n " , status ) ; } } ice_acl_scen_free_entry_idx ( scen , entry_idx ) ; return status ; }
ice_acl_rem_entry - Remove a flow entry from an ACL scenario
 @hw: pointer to the HW struct
 @scen: scenario to remove the entry from
 @entry_idx: the scenario-relative index of the flow entry being removed
ice_acl_rem_entry - Remove a flow entry from an ACL scenario @hw : pointer to the HW struct @scen : scenario to remove the entry from @entry_idx : the scenario - relative index of the flow entry being removed
/* Determine number of cascaded TCAMs */ /* invalidate the flow entry */ /* Invalidate allocated action pairs */