+static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
+{
+ int rc;
+ struct bnxt_representor *vfr = vfr_ethdev->data->dev_private;
+ struct rte_eth_dev *parent_dev = vfr->parent_dev;
+ struct bnxt *parent_bp = parent_dev->data->dev_private;
+
+ if (!parent_bp || !parent_bp->ulp_ctx) {
+ BNXT_TF_DBG(ERR, "Invalid arguments\n");
+ return 0;
+ }
+
+ /* Update the ULP portdata base with the new VFR interface */
+ rc = ulp_port_db_dev_port_intf_update(parent_bp->ulp_ctx, vfr_ethdev);
+ if (rc) {
+ BNXT_TF_DBG(ERR, "Failed to update ulp port details vfr:%u\n",
+ vfr->vf_id);
+ return rc;
+ }
+
+ /* Create the default rules for the VFR */
+ rc = bnxt_ulp_create_vfr_default_rules(vfr_ethdev);
+ if (rc) {
+ BNXT_TF_DBG(ERR, "Failed to create VFR default rules vfr:%u\n",
+ vfr->vf_id);
+ return rc;
+ }
+ /* update the port id so you can backtrack to ethdev */
+ vfr->dpdk_port_id = vfr_ethdev->data->port_id;
+
+ if (BNXT_STINGRAY(parent_bp)) {
+ rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
+ } else {
+ rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
+ }
+ if (rc) {
+ BNXT_TF_DBG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
+ vfr->vf_id, rc);
+ (void)bnxt_ulp_delete_vfr_default_rules(vfr);
+ }
+ BNXT_TF_DBG(DEBUG, "BNXT Port:%d VFR created and initialized\n",
+ vfr->dpdk_port_id);
+ return rc;
+}
+
+static int bnxt_vfr_alloc(struct rte_eth_dev *vfr_ethdev)