From patchwork Tue Nov 2 04:05:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkat Duvvuru X-Patchwork-Id: 103413 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6C2C6A0C4D; Tue, 2 Nov 2021 05:07:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D72A441190; Tue, 2 Nov 2021 05:06:30 +0100 (CET) Received: from relay.smtp-ext.broadcom.com (lpdvsmtp09.broadcom.com [192.19.166.228]) by mails.dpdk.org (Postfix) with ESMTP id B53FE4115F for ; Tue, 2 Nov 2021 05:06:28 +0100 (CET) Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 0548D7A21; Mon, 1 Nov 2021 21:06:26 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 0548D7A21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1635825988; bh=Y/60mFciM+G+nfCCfDsSPc6hS36LOOYwWMjE4H+oLBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mq3u6XkM4KiV16A+OvpmK7ZgT4RDMhv2RnNKjLaum4zK5PujDBbJkZilC9Zm30D+t CVAEe5hMpbxbEEy3BOxaD7X2mZDv+6NssnWBXIq6aUtXqep1LCQvGWCMJBhWG4TGb6 H7wlyXvMxqoWLbP9TLm12fgvnEEKZGpJX5jxY71s= From: Venkat Duvvuru To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru Date: Tue, 2 Nov 2021 09:35:50 +0530 Message-Id: <20211102040556.7840-15-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211102040556.7840-1-venkatkumar.duvvuru@broadcom.com> References: <20211001055909.27276-1-venkatkumar.duvvuru@broadcom.com> <20211102040556.7840-1-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH v3 14/20] net/bnxt: delete the VF pair before VF representor alloc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kishore Padmanabha 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 Signed-off-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde Reviewed-by: Shahaji Bhosle --- drivers/net/bnxt/bnxt_hwrm.c | 28 ++++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 1 + drivers/net/bnxt/bnxt_reps.c | 6 ++++++ 3 files changed, 35 insertions(+) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index c7041143a3..f8c27fe316 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -6025,6 +6025,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; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 6dc23b93ac..33e6ba99d5 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -294,6 +294,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); diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 988f5a33a7..111d226a59 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -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);