src/dpdk/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
int32_t
ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item,
			     struct ulp_rte_parser_params *prm)
{
	const struct rte_flow_action_phy_port *phy_port;
	uint32_t pid;
	int32_t rc;
	uint16_t pid_s;
	enum bnxt_ulp_direction_type dir;

	phy_port = action_item->conf;
	if (!phy_port) {
		BNXT_TF_DBG(ERR,
			    "ParseErr: Invalid Argument\n");
		return BNXT_TF_RC_PARSE_ERR;
	}

	if (phy_port->original) {
		BNXT_TF_DBG(ERR,
			    "Parse Err:Port Original not supported\n");
		return BNXT_TF_RC_PARSE_ERR;
	}
	dir = ULP_COMP_FLD_IDX_RD(prm, BNXT_ULP_CF_IDX_DIRECTION);
	if (dir != BNXT_ULP_DIR_EGRESS) {
		BNXT_TF_DBG(ERR,
			    "Parse Err:Phy ports are valid only for egress\n");
		return BNXT_TF_RC_PARSE_ERR;
	}
	/* Get the physical port details from port db */
	rc = ulp_port_db_phy_port_vport_get(prm->ulp_ctx, phy_port->index,
					    &pid_s);
	if (rc) {
		BNXT_TF_DBG(ERR, "Failed to get port details\n");
		return -EINVAL;
	}

	pid = pid_s;
	pid = rte_cpu_to_be_32(pid);
	memcpy(&prm->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VPORT],
	       &pid, BNXT_ULP_ACT_PROP_SZ_VPORT);

	/* Update the action port set bit */
	ULP_COMP_FLD_IDX_WR(prm, BNXT_ULP_CF_IDX_ACT_PORT_IS_SET, 1);
	ULP_COMP_FLD_IDX_WR(prm, BNXT_ULP_CF_IDX_ACT_PORT_TYPE,
			    BNXT_ULP_INTF_TYPE_PHY_PORT);
	return BNXT_TF_RC_SUCCESS;
}
/* Function to handle the parsing of RTE Flow action phy_port. */
Function to handle the parsing of RTE Flow action phy_port.
Function to handle the parsing of RTE Flow action phy_port .
int32_t
ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item,
			     struct ulp_rte_parser_params *prm)
{
	const struct rte_flow_action_phy_port *phy_port;
	uint32_t pid;
	int32_t rc;
	uint16_t pid_s;
	enum bnxt_ulp_direction_type dir;
	phy_port = action_item->conf;
	if (!phy_port) {
		BNXT_TF_DBG(ERR,
			    "ParseErr: Invalid Argument\n");
		return BNXT_TF_RC_PARSE_ERR;
	}
	if (phy_port->original) {
		BNXT_TF_DBG(ERR,
			    "Parse Err:Port Original not supported\n");
		return BNXT_TF_RC_PARSE_ERR;
	}
	dir = ULP_COMP_FLD_IDX_RD(prm, BNXT_ULP_CF_IDX_DIRECTION);
	if (dir != BNXT_ULP_DIR_EGRESS) {
		BNXT_TF_DBG(ERR,
			    "Parse Err:Phy ports are valid only for egress\n");
		return BNXT_TF_RC_PARSE_ERR;
	}
	rc = ulp_port_db_phy_port_vport_get(prm->ulp_ctx, phy_port->index,
					    &pid_s);
	if (rc) {
		BNXT_TF_DBG(ERR, "Failed to get port details\n");
		return -EINVAL;
	}
	pid = pid_s;
	pid = rte_cpu_to_be_32(pid);
	memcpy(&prm->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VPORT],
	       &pid, BNXT_ULP_ACT_PROP_SZ_VPORT);
	ULP_COMP_FLD_IDX_WR(prm, BNXT_ULP_CF_IDX_ACT_PORT_IS_SET, 1);
	ULP_COMP_FLD_IDX_WR(prm, BNXT_ULP_CF_IDX_ACT_PORT_TYPE,
			    BNXT_ULP_INTF_TYPE_PHY_PORT);
	return BNXT_TF_RC_SUCCESS;
}
int32_t ulp_rte_phy_port_act_handler ( const struct rte_flow_action * action_item , struct ulp_rte_parser_params * prm ) { const struct rte_flow_action_phy_port * phy_port ; uint32_t pid ; int32_t rc ; uint16_t pid_s ; enum bnxt_ulp_direction_type dir ; phy_port = action_item -> conf ; if ( ! phy_port ) { BNXT_TF_DBG ( ERR , " \n " ) ; return BNXT_TF_RC_PARSE_ERR ; } if ( phy_port -> original ) { BNXT_TF_DBG ( ERR , " \n " ) ; return BNXT_TF_RC_PARSE_ERR ; } dir = ULP_COMP_FLD_IDX_RD ( prm , BNXT_ULP_CF_IDX_DIRECTION ) ; if ( dir != BNXT_ULP_DIR_EGRESS ) { BNXT_TF_DBG ( ERR , " \n " ) ; return BNXT_TF_RC_PARSE_ERR ; } rc = ulp_port_db_phy_port_vport_get ( prm -> ulp_ctx , phy_port -> index , & pid_s ) ; if ( rc ) { BNXT_TF_DBG ( ERR , " \n " ) ; return - EINVAL ; } pid = pid_s ; pid = rte_cpu_to_be_32 ( pid ) ; memcpy ( & prm -> act_prop . act_details [ BNXT_ULP_ACT_PROP_IDX_VPORT ] , & pid , BNXT_ULP_ACT_PROP_SZ_VPORT ) ; ULP_COMP_FLD_IDX_WR ( prm , BNXT_ULP_CF_IDX_ACT_PORT_IS_SET , 1 ) ; ULP_COMP_FLD_IDX_WR ( prm , BNXT_ULP_CF_IDX_ACT_PORT_TYPE , BNXT_ULP_INTF_TYPE_PHY_PORT ) ; return BNXT_TF_RC_SUCCESS ; }
Function to handle the parsing of RTE Flow action phy_port.
Function to handle the parsing of RTE Flow action phy_port .
/* Get the physical port details from port db */ /* Update the action port set bit */