]> git.droids-corp.org - dpdk.git/commitdiff
net/bnxt: modify VF representor allocation sequence
authorKishore Padmanabha <kishore.padmanabha@broadcom.com>
Wed, 3 Nov 2021 00:52:45 +0000 (17:52 -0700)
committerAjit Khaparde <ajit.khaparde@broadcom.com>
Thu, 4 Nov 2021 21:13:13 +0000 (22:13 +0100)
When the VF representor interface is created, the VF pair relationship
is established between the VF and it is representor. If the pair
already exists then the pair needs to be deleted before allocation.
This could happen if the application is abruptly killed and restarted.
If the deletion of an existing VF rep is not done then hw pipeline is
not cleaned and a new allocation shall leave the hw in inconsistent
state.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_hwrm.c
drivers/net/bnxt/bnxt_hwrm.h
drivers/net/bnxt/bnxt_reps.c

index 94a7daf632f3fe157e3db01794852f41421086d5..67ed807dad8f2b985a5b93a3b2e7cdc60f8f9bf7 100644 (file)
@@ -5994,6 +5994,34 @@ int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
        return rc;
 }
 
+int bnxt_hwrm_cfa_pair_exists(struct bnxt *bp, struct bnxt_representor *rep_bp)
+{
+       struct hwrm_cfa_pair_info_output *resp = bp->hwrm_cmd_resp_addr;
+       struct hwrm_cfa_pair_info_input req = {0};
+       int rc = 0;
+
+       if (!(BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))) {
+               PMD_DRV_LOG(DEBUG,
+                           "Not a PF or trusted VF. Command not supported\n");
+               return 0;
+       }
+
+       HWRM_PREP(&req, HWRM_CFA_PAIR_INFO, BNXT_USE_CHIMP_MB);
+       snprintf(req.pair_name, sizeof(req.pair_name), "%svfr%d",
+                bp->eth_dev->data->name, rep_bp->vf_id);
+       req.flags =
+               rte_cpu_to_le_32(HWRM_CFA_PAIR_INFO_INPUT_FLAGS_LOOKUP_TYPE);
+
+       rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+       HWRM_CHECK_RESULT();
+       if (rc == HWRM_ERR_CODE_SUCCESS && strlen(resp->pair_name)) {
+               HWRM_UNLOCK();
+               return !rc;
+       }
+       HWRM_UNLOCK();
+       return rc;
+}
+
 int bnxt_hwrm_cfa_pair_alloc(struct bnxt *bp, struct bnxt_representor *rep_bp)
 {
        struct hwrm_cfa_pair_alloc_output *resp = bp->hwrm_cmd_resp_addr;
index 72d486468c811f950394b57ae919ce02c0b40bfa..f8f05562015666de9a3a67460a5958043d287c11 100644 (file)
@@ -293,6 +293,7 @@ int bnxt_clear_one_vnic_filter(struct bnxt *bp,
 void bnxt_free_vf_info(struct bnxt *bp);
 int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
                                uint16_t *first_vf_id);
+int bnxt_hwrm_cfa_pair_exists(struct bnxt *bp, struct bnxt_representor *rep_bp);
 int bnxt_hwrm_cfa_pair_alloc(struct bnxt *bp, struct bnxt_representor *rep);
 int bnxt_hwrm_cfa_pair_free(struct bnxt *bp, struct bnxt_representor *rep);
 int bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(struct bnxt *bp);
index 60aaa5629996c84694caf99f11ae48d35a9842c0..22b76b72b926296d6c216473c2f9adebe50a4e65 100644 (file)
@@ -315,6 +315,12 @@ static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
                BNXT_TF_DBG(ERR, "Invalid arguments\n");
                return 0;
        }
+       /* update the port id so you can backtrack to ethdev */
+       vfr->dpdk_port_id = vfr_ethdev->data->port_id;
+
+       /* If pair is present, then delete the pair */
+       if (bnxt_hwrm_cfa_pair_exists(parent_bp, vfr))
+               (void)bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
 
        /* Update the ULP portdata base with the new VFR interface */
        rc = ulp_port_db_dev_port_intf_update(parent_bp->ulp_ctx, vfr_ethdev);