src/dpdk/drivers/net/ice/base/ice_acl_ctrl.c
enum ice_status
ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
		 struct ice_acl_act_entry *acts, u8 acts_cnt,
		 u16 entry_idx)
{
	u8 entry_tcam, num_cscd, i, actx_idx = 0;
	struct ice_aqc_actpair act_buf;
	enum ice_status status = ICE_SUCCESS;
	u16 idx;

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

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

	/* 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);

	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 (actx_idx >= acts_cnt)
			break;
		if (mem->member_of_tcam >= entry_tcam &&
		    mem->member_of_tcam < entry_tcam + num_cscd) {
			ice_memcpy(&act_buf.act[0], &acts[actx_idx],
				   sizeof(struct ice_acl_act_entry),
				   ICE_NONDMA_TO_NONDMA);

			if (++actx_idx < acts_cnt) {
				ice_memcpy(&act_buf.act[1], &acts[actx_idx],
					   sizeof(struct ice_acl_act_entry),
					   ICE_NONDMA_TO_NONDMA);
			}

			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);
				break;
			}
			actx_idx++;
		}
	}

	if (!status && actx_idx < acts_cnt)
		status = ICE_ERR_MAX_LIMIT;

	return status;
}
/**
 * ice_acl_prog_act - Program a scenario's action memory
 * @hw: pointer to the HW struct
 * @scen: scenario to add the entry to
 * @acts: pointer to a buffer containing formatted actions
 * @acts_cnt: indicates the number of actions stored in "acts"
 * @entry_idx: scenario relative index of the added flow entry
 *
 * Program a scenario's action memory
 */


Program a scenario's action memory
Program a scenario ' s action memory
enum ice_status
ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
		 struct ice_acl_act_entry *acts, u8 acts_cnt,
		 u16 entry_idx)
{
	u8 entry_tcam, num_cscd, i, actx_idx = 0;
	struct ice_aqc_actpair act_buf;
	enum ice_status status = ICE_SUCCESS;
	u16 idx;
	if (entry_idx >= scen->num_entry)
		return ICE_ERR_MAX_LIMIT;
	ice_memset(&act_buf, 0, sizeof(act_buf), ICE_NONDMA_MEM);
	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_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 (actx_idx >= acts_cnt)
			break;
		if (mem->member_of_tcam >= entry_tcam &&
		    mem->member_of_tcam < entry_tcam + num_cscd) {
			ice_memcpy(&act_buf.act[0], &acts[actx_idx],
				   sizeof(struct ice_acl_act_entry),
				   ICE_NONDMA_TO_NONDMA);
			if (++actx_idx < acts_cnt) {
				ice_memcpy(&act_buf.act[1], &acts[actx_idx],
					   sizeof(struct ice_acl_act_entry),
					   ICE_NONDMA_TO_NONDMA);
			}
			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);
				break;
			}
			actx_idx++;
		}
	}
	if (!status && actx_idx < acts_cnt)
		status = ICE_ERR_MAX_LIMIT;
	return status;
}
enum ice_status ice_acl_prog_act ( struct ice_hw * hw , struct ice_acl_scen * scen , struct ice_acl_act_entry * acts , u8 acts_cnt , u16 entry_idx ) { u8 entry_tcam , num_cscd , i , actx_idx = 0 ; struct ice_aqc_actpair act_buf ; enum ice_status status = ICE_SUCCESS ; u16 idx ; if ( entry_idx >= scen -> num_entry ) return ICE_ERR_MAX_LIMIT ; ice_memset ( & act_buf , 0 , sizeof ( act_buf ) , ICE_NONDMA_MEM ) ; 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_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 ( actx_idx >= acts_cnt ) break ; if ( mem -> member_of_tcam >= entry_tcam && mem -> member_of_tcam < entry_tcam + num_cscd ) { ice_memcpy ( & act_buf . act [ 0 ] , & acts [ actx_idx ] , sizeof ( struct ice_acl_act_entry ) , ICE_NONDMA_TO_NONDMA ) ; if ( ++ actx_idx < acts_cnt ) { ice_memcpy ( & act_buf . act [ 1 ] , & acts [ actx_idx ] , sizeof ( struct ice_acl_act_entry ) , ICE_NONDMA_TO_NONDMA ) ; } status = ice_aq_program_actpair ( hw , i , idx , & act_buf , NULL ) ; if ( status ) { ice_debug ( hw , ICE_DBG_ACL , " \n " , status ) ; break ; } actx_idx ++ ; } } if ( ! status && actx_idx < acts_cnt ) status = ICE_ERR_MAX_LIMIT ; return status ; }
ice_acl_prog_act - Program a scenario's action memory
 @hw: pointer to the HW struct
 @scen: scenario to add the entry to
 @acts: pointer to a buffer containing formatted actions
 @acts_cnt: indicates the number of actions stored in "acts"
 @entry_idx: scenario relative index of the added flow entry
ice_acl_prog_act - Program a scenario ' s action memory @hw : pointer to the HW struct @scen : scenario to add the entry to @acts : pointer to a buffer containing formatted actions @acts_cnt : indicates the number of actions stored in " acts " @entry_idx : scenario relative index of the added flow entry
/* Determine number of cascaded TCAMs */