[PATCH 47/54] net/bnxt/tf_ulp: truflow add pf action handler
Manish Kurup
manish.kurup at broadcom.com
Tue Sep 30 02:35:57 CEST 2025
From: Shahaji Bhosle <shahaji.bhosle at broadcom.com>
Update pf action handler callback to use parent PF vnic
Signed-off-by: Shahaji Bhosle <shahaji.bhosle at broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha at broadcom.com>
---
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 42 ++++++++++++++++--------
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index ceda1ff5ef..82baf722cd 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -2946,30 +2946,44 @@ int32_t
ulp_rte_pf_act_handler(const struct rte_flow_action *action_item __rte_unused,
struct ulp_rte_parser_params *params)
{
+ struct bnxt *bp;
uint32_t port_id;
- uint32_t ifindex;
- enum bnxt_ulp_intf_type intf_type;
+ enum bnxt_ulp_direction_type dir;
+ struct ulp_rte_act_prop *act = ¶ms->act_prop;
/* Get the port id of the current device */
port_id = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_INCOMING_IF);
- /* Get the port db ifindex */
- if (ulp_port_db_dev_port_to_ulp_index(params->ulp_ctx, port_id,
- &ifindex)) {
- BNXT_DRV_DBG(ERR, "Invalid port id\n");
+ params->port_id = port_id;
+ bp = bnxt_pmd_get_bp(params->port_id);
+ if (bp == NULL) {
+ BNXT_DRV_DBG(ERR, "Invalid bp");
return BNXT_TF_RC_ERROR;
}
- /* Check the port is PF port */
- intf_type = ulp_port_db_port_type_get(params->ulp_ctx, ifindex);
- if (intf_type != BNXT_ULP_INTF_TYPE_PF) {
- BNXT_DRV_DBG(ERR, "Port is not a PF port\n");
+ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, BNXT_ULP_INTF_TYPE_PF);
+
+ /* Get the direction */
+ dir = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION);
+ if (dir == BNXT_ULP_DIR_EGRESS) {
+ BNXT_DRV_DBG(ERR, "Invalid direction");
return BNXT_TF_RC_ERROR;
+ } else {
+ uint16_t pid_s = bp->parent->vnic;
+ uint32_t pid = pid_s;
+ pid = rte_cpu_to_be_32(pid);
+ memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_VNIC],
+ &pid, BNXT_ULP_ACT_PROP_SZ_VNIC);
+ /*
+ * Update appropriate port (A/B) VNIC based on multi-port
+ * indication.
+ */
+ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_MP_VNIC_A, pid_s);
}
- /* Update the action properties */
- ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, intf_type);
- return ulp_rte_parser_act_port_set(params, ifindex, false,
- BNXT_ULP_DIR_INVALID);
+
+ /* Update the action port set bit */
+ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_IS_SET, 1);
+ return BNXT_TF_RC_SUCCESS;
}
/* Function to handle the parsing of RTE Flow action VF. */
--
2.39.5 (Apple Git-154)
More information about the dev
mailing list