+ if (!bp || !BNXT_TRUFLOW_EN(bp))
+ return 0;
+
+ port_id = vfr_ethdev->data->port_id;
+ info = bnxt_ulp_cntxt_ptr2_ulp_vfr_info_get(bp->ulp_ctx, port_id);
+
+ if (!info) {
+ BNXT_TF_DBG(ERR, "Failed to get vfr ulp context\n");
+ return -EINVAL;
+ }
+
+ if (info->valid) {
+ BNXT_TF_DBG(ERR, "VFR already allocated\n");
+ return -EINVAL;
+ }
+
+ memset(info, 0, sizeof(struct bnxt_ulp_vfr_rule_info));
+ rc = bnxt_create_port_vfr_default_rule(bp, BNXT_ULP_DF_TPL_DEFAULT_VFR,
+ vfr_port_id,
+ &info->vfr_flow_id);
+ if (rc) {
+ BNXT_TF_DBG(ERR, "Failed to create VFR default rule\n");
+ goto error;
+ }
+ rc = ulp_default_flow_db_cfa_action_get(bp->ulp_ctx,
+ info->vfr_flow_id,
+ &vfr->vfr_tx_cfa_action);
+ if (rc) {
+ BNXT_TF_DBG(ERR, "Failed to get the tx cfa action\n");
+ goto error;
+ }
+
+ /* Update the other details */
+ info->valid = true;
+ info->parent_port_id = bp->eth_dev->data->port_id;
+ return 0;
+
+error:
+ if (info->vfr_flow_id)
+ ulp_default_flow_destroy(bp->eth_dev, info->vfr_flow_id);