src/dpdk/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
static int32_t
ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params,
			uint32_t ifindex,
			uint16_t mask)
{
	uint16_t svif;
	enum bnxt_ulp_direction_type dir;
	struct ulp_rte_hdr_field *hdr_field;
	enum bnxt_ulp_svif_type svif_type;
	enum bnxt_ulp_intf_type port_type;

	if (ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_SVIF_FLAG) !=
	    BNXT_ULP_INVALID_SVIF_VAL) {
		BNXT_TF_DBG(ERR,
			    "SVIF already set,multiple source not support'd\n");
		return BNXT_TF_RC_ERROR;
	}

	/* Get port type details */
	port_type = ulp_port_db_port_type_get(params->ulp_ctx, ifindex);
	if (port_type == BNXT_ULP_INTF_TYPE_INVALID) {
		BNXT_TF_DBG(ERR, "Invalid port type\n");
		return BNXT_TF_RC_ERROR;
	}

	/* Update the match port type */
	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_MATCH_PORT_TYPE, port_type);

	/* compute the direction */
	bnxt_ulp_rte_parser_direction_compute(params);

	/* Get the computed direction */
	dir = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION);
	if (dir == BNXT_ULP_DIR_INGRESS) {
		svif_type = BNXT_ULP_PHY_PORT_SVIF;
	} else {
		if (port_type == BNXT_ULP_INTF_TYPE_VF_REP)
			svif_type = BNXT_ULP_VF_FUNC_SVIF;
		else
			svif_type = BNXT_ULP_DRV_FUNC_SVIF;
	}
	ulp_port_db_svif_get(params->ulp_ctx, ifindex, svif_type,
			     &svif);
	svif = rte_cpu_to_be_16(svif);
	hdr_field = &params->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX];
	memcpy(hdr_field->spec, &svif, sizeof(svif));
	memcpy(hdr_field->mask, &mask, sizeof(mask));
	hdr_field->size = sizeof(svif);
	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_SVIF_FLAG,
			    rte_be_to_cpu_16(svif));
	return BNXT_TF_RC_SUCCESS;
}
/* Function to handle the parsing of RTE Flow item PF Header. */
Function to handle the parsing of RTE Flow item PF Header.
Function to handle the parsing of RTE Flow item PF Header .
static int32_t
ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params,
			uint32_t ifindex,
			uint16_t mask)
{
	uint16_t svif;
	enum bnxt_ulp_direction_type dir;
	struct ulp_rte_hdr_field *hdr_field;
	enum bnxt_ulp_svif_type svif_type;
	enum bnxt_ulp_intf_type port_type;
	if (ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_SVIF_FLAG) !=
	    BNXT_ULP_INVALID_SVIF_VAL) {
		BNXT_TF_DBG(ERR,
			    "SVIF already set,multiple source not support'd\n");
		return BNXT_TF_RC_ERROR;
	}
	port_type = ulp_port_db_port_type_get(params->ulp_ctx, ifindex);
	if (port_type == BNXT_ULP_INTF_TYPE_INVALID) {
		BNXT_TF_DBG(ERR, "Invalid port type\n");
		return BNXT_TF_RC_ERROR;
	}
	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_MATCH_PORT_TYPE, port_type);
	bnxt_ulp_rte_parser_direction_compute(params);
	dir = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION);
	if (dir == BNXT_ULP_DIR_INGRESS) {
		svif_type = BNXT_ULP_PHY_PORT_SVIF;
	} else {
		if (port_type == BNXT_ULP_INTF_TYPE_VF_REP)
			svif_type = BNXT_ULP_VF_FUNC_SVIF;
		else
			svif_type = BNXT_ULP_DRV_FUNC_SVIF;
	}
	ulp_port_db_svif_get(params->ulp_ctx, ifindex, svif_type,
			     &svif);
	svif = rte_cpu_to_be_16(svif);
	hdr_field = &params->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX];
	memcpy(hdr_field->spec, &svif, sizeof(svif));
	memcpy(hdr_field->mask, &mask, sizeof(mask));
	hdr_field->size = sizeof(svif);
	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_SVIF_FLAG,
			    rte_be_to_cpu_16(svif));
	return BNXT_TF_RC_SUCCESS;
}
static int32_t ulp_rte_parser_svif_set ( struct ulp_rte_parser_params * params , uint32_t ifindex , uint16_t mask ) { uint16_t svif ; enum bnxt_ulp_direction_type dir ; struct ulp_rte_hdr_field * hdr_field ; enum bnxt_ulp_svif_type svif_type ; enum bnxt_ulp_intf_type port_type ; if ( ULP_COMP_FLD_IDX_RD ( params , BNXT_ULP_CF_IDX_SVIF_FLAG ) != BNXT_ULP_INVALID_SVIF_VAL ) { BNXT_TF_DBG ( ERR , " \n " ) ; return BNXT_TF_RC_ERROR ; } port_type = ulp_port_db_port_type_get ( params -> ulp_ctx , ifindex ) ; if ( port_type == BNXT_ULP_INTF_TYPE_INVALID ) { BNXT_TF_DBG ( ERR , " \n " ) ; return BNXT_TF_RC_ERROR ; } ULP_COMP_FLD_IDX_WR ( params , BNXT_ULP_CF_IDX_MATCH_PORT_TYPE , port_type ) ; bnxt_ulp_rte_parser_direction_compute ( params ) ; dir = ULP_COMP_FLD_IDX_RD ( params , BNXT_ULP_CF_IDX_DIRECTION ) ; if ( dir == BNXT_ULP_DIR_INGRESS ) { svif_type = BNXT_ULP_PHY_PORT_SVIF ; } else { if ( port_type == BNXT_ULP_INTF_TYPE_VF_REP ) svif_type = BNXT_ULP_VF_FUNC_SVIF ; else svif_type = BNXT_ULP_DRV_FUNC_SVIF ; } ulp_port_db_svif_get ( params -> ulp_ctx , ifindex , svif_type , & svif ) ; svif = rte_cpu_to_be_16 ( svif ) ; hdr_field = & params -> hdr_field [ BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX ] ; memcpy ( hdr_field -> spec , & svif , sizeof ( svif ) ) ; memcpy ( hdr_field -> mask , & mask , sizeof ( mask ) ) ; hdr_field -> size = sizeof ( svif ) ; ULP_COMP_FLD_IDX_WR ( params , BNXT_ULP_CF_IDX_SVIF_FLAG , rte_be_to_cpu_16 ( svif ) ) ; return BNXT_TF_RC_SUCCESS ; }
Function to handle the parsing of RTE Flow item PF Header.
Function to handle the parsing of RTE Flow item PF Header .
/* Get port type details */ /* Update the match port type */ /* compute the direction */ /* Get the computed direction */