From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B83D1A0C4B; Wed, 3 Nov 2021 01:54:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 540C8411EB; Wed, 3 Nov 2021 01:53:17 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 6DD2C411AB for ; Wed, 3 Nov 2021 01:53:14 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id t5-20020a17090a4e4500b001a0a284fcc2so239369pjl.2 for ; Tue, 02 Nov 2021 17:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=SotFTyQenal+4YFApSU0BOLQpkwenwYk/XAfv0xxiZk=; b=KbiEpk0SSoUyz5prfUvl7Ey74sKMIAJzUDxZ/mbxe6lps8F8KJBsQQAUFZ52P3RfMO sK25cb6NZCiAvMz4lpzGaMC3ntdElTo2TDuaJMbvQLjioMnjotTxkbuz4c5vt1GSak1Z UhLgSRKoUK0Mu2Xk3ydll2961e1XeF/jGp+d0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=SotFTyQenal+4YFApSU0BOLQpkwenwYk/XAfv0xxiZk=; b=Q4Pu2dNMbfEQZynL5XbxYZKQRoOT7sP5g5AhGs9LEgwJIJpYJpcRyOVmAYUJ0AgBjb LVKlyAmGXG8GkXK8/9+mWO/vYwcOjAanusz8x0HFHxE1HsEfuoOPp10WC0lMKOnoHCwt lIUAeGf2G5Ddf/tYZkuloZ+TMiES55nNtOgFio5+1Twt72rOrbOjlqUxm5o8RUWZT0pe ppN3MmZLhvTiELBYN50c8AnakMnZ+9UsBbi3lYURvVqlUslfLuVcHSf/ViN7tN+x5r6X KhNQSnSAGpOScuA+0qDhXqJXtls8JAz3beHCPeV+nTvnTVnKdJlu4Si8zWkxAjvRCepq muow== X-Gm-Message-State: AOAM530Nt52zKocW4RV/rke67sXvh6nPDPeNVKiRTLGE53UxzLQLxHr0 EPxBQYWziP621BTw8i/tHATMM7BfFAO8QCOYi9zBdEJ2SWXQbvMMFgy3ZNTJB6kXAMNv0B4rKmj Wk1o5bGHZF+UXfpvCpFpW2KzUJ//8pqehsVBkp1Yt4Ogdrq32LSAgX+6tGEnjHtA= X-Google-Smtp-Source: ABdhPJxxakEM3ES5SHvrRi+SeMW18mO6uKhLVbS/dTOKtsm1lBzVODap1upLcB13/+U5llGeL1AG+w== X-Received: by 2002:a17:902:f54a:b0:142:c5f:2e42 with SMTP id h10-20020a170902f54a00b001420c5f2e42mr7071164plf.76.1635900793306; Tue, 02 Nov 2021 17:53:13 -0700 (PDT) Received: from localhost.localdomain ([192.19.224.250]) by smtp.gmail.com with ESMTPSA id k2sm323450pfu.112.2021.11.02.17.53.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Nov 2021 17:53:12 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru , Shahaji Bhosle Date: Tue, 2 Nov 2021 17:52:45 -0700 Message-Id: <20211103005251.25524-15-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20211103005251.25524-1-ajit.khaparde@broadcom.com> References: <20211102040556.7840-1-venkatkumar.duvvuru@broadcom.com> <20211103005251.25524-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000b2df7505cfd7d556" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH v4 14/20] net/bnxt: modify VF representor alloc sequence 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" --000000000000b2df7505cfd7d556 Content-Transfer-Encoding: 8bit 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: Shahaji Bhosle Reviewed-by: Ajit Khaparde --- 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 37640abcbe..1ad39c1445 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -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; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 72d486468c..f8f0556201 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -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); diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 60aaa56299..22b76b72b9 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); -- 2.30.1 (Apple Git-130) --000000000000b2df7505cfd7d556--