src/dpdk/drivers/net/ice/base/ice_acl_ctrl.c
static void
ice_acl_fill_tcam_select(struct ice_aqc_acl_scen *scen_buf,
			 struct ice_acl_scen *scen, u16 tcam_idx,
			 u16 tcam_idx_in_cascade)
{
	u16 cascade_cnt, idx;
	u8 j;

	idx = tcam_idx_in_cascade * ICE_AQC_ACL_KEY_WIDTH_BYTES;
	cascade_cnt = DIVIDE_AND_ROUND_UP(scen->width,
					  ICE_AQC_ACL_KEY_WIDTH_BYTES);

	/* For each scenario, we reserved last three bytes of scenario width for
	 * profile ID, range checker, and packet direction. Thus, the last three
	 * bytes of the last cascaded TCAMs will have value of 1st, 31st and
	 * 32nd byte location of BYTE selection base.
	 *
	 * For other bytes in the TCAMs:
	 * For non-cascade mode (1 TCAM wide) scenario, TCAM[x]'s Select {0-1}
	 * select indices 0-1 of the Byte Selection Base
	 * For cascade mode, the leftmost TCAM of the first cascade row selects
	 * indices 0-4 of the Byte Selection Base; the second TCAM in the
	 * cascade row selects indices starting with 5-n
	 */
	for (j = 0; j < ICE_AQC_ACL_KEY_WIDTH_BYTES; j++) {
		/* PKT DIR uses the 1st location of Byte Selection Base: + 1 */
		u8 val = ICE_AQC_ACL_BYTE_SEL_BASE + 1 + idx;

		if (tcam_idx_in_cascade == cascade_cnt - 1) {
			if (j == ICE_ACL_SCEN_RNG_CHK_IDX_IN_TCAM)
				val = ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK;
			else if (j == ICE_ACL_SCEN_PID_IDX_IN_TCAM)
				val = ICE_AQC_ACL_BYTE_SEL_BASE_PID;
			else if (j == ICE_ACL_SCEN_PKT_DIR_IDX_IN_TCAM)
				val = ICE_AQC_ACL_BYTE_SEL_BASE_PKT_DIR;
		}

		/* In case that scenario's width is greater than the width of
		 * the Byte selection base, we will not assign a value to the
		 * tcam_select[j]. As a result, the tcam_select[j] will have
		 * default value which is zero.
		 */
		if (val > ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK)
			continue;

		scen_buf->tcam_cfg[tcam_idx].tcam_select[j] = val;

		idx++;
	}
}
/**
 * ice_acl_fill_tcam_select
 * @scen_buf: Pointer to the scenario buffer that needs to be populated
 * @scen: Pointer to the available space for the scenario
 * @tcam_idx: Index of the TCAM used for this scenario
 * @tcam_idx_in_cascade : Local index of the TCAM in the cascade scenario
 *
 * For all TCAM that participate in this scenario, fill out the tcam_select
 * value.
 */
ice_acl_fill_tcam_select
@scen_buf: Pointer to the scenario buffer that needs to be populated
@scen: Pointer to the available space for the scenario
@tcam_idx: Index of the TCAM used for this scenario
@tcam_idx_in_cascade : Local index of the TCAM in the cascade scenario

For all TCAM that participate in this scenario, fill out the tcam_select
value.
ice_acl_fill_tcam_select @scen_buf : Pointer to the scenario buffer that needs to be populated @scen : Pointer to the available space for the scenario @tcam_idx : Index of the TCAM used for this scenario @tcam_idx_in_cascade : Local index of the TCAM in the cascade scenario For all TCAM that participate in this scenario fill out the tcam_select value .
static void
ice_acl_fill_tcam_select(struct ice_aqc_acl_scen *scen_buf,
			 struct ice_acl_scen *scen, u16 tcam_idx,
			 u16 tcam_idx_in_cascade)
{
	u16 cascade_cnt, idx;
	u8 j;
	idx = tcam_idx_in_cascade * ICE_AQC_ACL_KEY_WIDTH_BYTES;
	cascade_cnt = DIVIDE_AND_ROUND_UP(scen->width,
					  ICE_AQC_ACL_KEY_WIDTH_BYTES);
	for (j = 0; j < ICE_AQC_ACL_KEY_WIDTH_BYTES; j++) {
		u8 val = ICE_AQC_ACL_BYTE_SEL_BASE + 1 + idx;
		if (tcam_idx_in_cascade == cascade_cnt - 1) {
			if (j == ICE_ACL_SCEN_RNG_CHK_IDX_IN_TCAM)
				val = ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK;
			else if (j == ICE_ACL_SCEN_PID_IDX_IN_TCAM)
				val = ICE_AQC_ACL_BYTE_SEL_BASE_PID;
			else if (j == ICE_ACL_SCEN_PKT_DIR_IDX_IN_TCAM)
				val = ICE_AQC_ACL_BYTE_SEL_BASE_PKT_DIR;
		}
		if (val > ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK)
			continue;
		scen_buf->tcam_cfg[tcam_idx].tcam_select[j] = val;
		idx++;
	}
}
static void ice_acl_fill_tcam_select ( struct ice_aqc_acl_scen * scen_buf , struct ice_acl_scen * scen , u16 tcam_idx , u16 tcam_idx_in_cascade ) { u16 cascade_cnt , idx ; u8 j ; idx = tcam_idx_in_cascade * ICE_AQC_ACL_KEY_WIDTH_BYTES ; cascade_cnt = DIVIDE_AND_ROUND_UP ( scen -> width , ICE_AQC_ACL_KEY_WIDTH_BYTES ) ; for ( j = 0 ; j < ICE_AQC_ACL_KEY_WIDTH_BYTES ; j ++ ) { u8 val = ICE_AQC_ACL_BYTE_SEL_BASE + 1 + idx ; if ( tcam_idx_in_cascade == cascade_cnt - 1 ) { if ( j == ICE_ACL_SCEN_RNG_CHK_IDX_IN_TCAM ) val = ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK ; else if ( j == ICE_ACL_SCEN_PID_IDX_IN_TCAM ) val = ICE_AQC_ACL_BYTE_SEL_BASE_PID ; else if ( j == ICE_ACL_SCEN_PKT_DIR_IDX_IN_TCAM ) val = ICE_AQC_ACL_BYTE_SEL_BASE_PKT_DIR ; } if ( val > ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK ) continue ; scen_buf -> tcam_cfg [ tcam_idx ] . tcam_select [ j ] = val ; idx ++ ; } }
ice_acl_fill_tcam_select
 @scen_buf: Pointer to the scenario buffer that needs to be populated
 @scen: Pointer to the available space for the scenario
 @tcam_idx: Index of the TCAM used for this scenario
 @tcam_idx_in_cascade : Local index of the TCAM in the cascade scenario
ice_acl_fill_tcam_select @scen_buf : Pointer to the scenario buffer that needs to be populated @scen : Pointer to the available space for the scenario @tcam_idx : Index of the TCAM used for this scenario @tcam_idx_in_cascade : Local index of the TCAM in the cascade scenario
/* For each scenario, we reserved last three bytes of scenario width for
	 * profile ID, range checker, and packet direction. Thus, the last three
	 * bytes of the last cascaded TCAMs will have value of 1st, 31st and
	 * 32nd byte location of BYTE selection base.
	 *
	 * For other bytes in the TCAMs:
	 * For non-cascade mode (1 TCAM wide) scenario, TCAM[x]'s Select {0-1}
	 * select indices 0-1 of the Byte Selection Base
	 * For cascade mode, the leftmost TCAM of the first cascade row selects
	 * indices 0-4 of the Byte Selection Base; the second TCAM in the
	 * cascade row selects indices starting with 5-n
	 */ /* PKT DIR uses the 1st location of Byte Selection Base: + 1 */ /* In case that scenario's width is greater than the width of
		 * the Byte selection base, we will not assign a value to the
		 * tcam_select[j]. As a result, the tcam_select[j] will have
		 * default value which is zero.
		 */