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 C9F53A0C5E; Thu, 4 Nov 2021 23:00:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9D5A427F8; Thu, 4 Nov 2021 22:59:19 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id 370CB427E4 for ; Thu, 4 Nov 2021 22:59:15 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id u11so9588918plf.3 for ; Thu, 04 Nov 2021 14:59:15 -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=L2DPvxO8toGeU32btKk/0dRXPFu3cw4rkgFTGickopc=; b=YUDKiK4mL0qPLZqbfFDaQUmxhjWN5jXqTgDvSIp6Ye6G2ZdrId/ES1R/iqukk+CULY ETJSwQKZVwZQvU68DDCZMq4d0HWe2mSlgpgfOXVyJoPehaLnM/IZf5yIaMuZvgv5UBQO bBrdKMi63+IQk+JxBr9VhcxN7uiYQ4n9028OE= 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=L2DPvxO8toGeU32btKk/0dRXPFu3cw4rkgFTGickopc=; b=Ugql9FBf0wCHQf7wFSCXG9ycLTCIYLcj10wSGJdKxup2bgTcrKBZqjxppgXobm91oF UwF1MNF6TSgU2JaEJPu789ujR08eHCQjKMwFVlIKIs0kmwiRT3sv6c5tgYccGPd74kyT GybLpfS4OuUaktsO6t4/Im4mhYP/k6UyvAhFY7z1MtQUNQmwU/i7t8euZJGLQCaE9r+Y s7gfWDGXe7TKwGg9GwMVz4gInOyuyL6MoW1mZLOWUStwM1BHwf/2fWMF44T33eM7ajas z6m2pOku77NGKCM6+57/YiM+NocYLU9zGYKjgjEvme4UgavaA+yxYRE+Bu7jcAqFqnO4 K+6w== X-Gm-Message-State: AOAM531Q+JU48ZHQQtKT+AhcZpvRfc5ZjHHDWXsuTKdQ14gbE6AOLEbG ipMkrH/ZiXdLjrhHuFv4fgohrkSnFzCrfbWyVLfkyDZW1i1S/sKl8oSICmGNhL5PfF7HKWdAVyp jmNbuRgYuEL04plMhu2FmLIDzcqCn7olXxOgCE22Ucos3kcHwHcwWfuFbicV0s6s= X-Google-Smtp-Source: ABdhPJxa+1JxUR/i9KMgXXWf7/L8ASEPcJa0bltTCRwf1uW2zrvKJVVkusml8BWGVxamyJRRk6VXzw== X-Received: by 2002:a17:902:db01:b0:141:ea12:2176 with SMTP id m1-20020a170902db0100b00141ea122176mr28135195plx.44.1636063154149; Thu, 04 Nov 2021 14:59:14 -0700 (PDT) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id pg5sm8532242pjb.26.2021.11.04.14.59.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Nov 2021 14:59:13 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru , Shahaji Bhosle Date: Thu, 4 Nov 2021 14:58:40 -0700 Message-Id: <20211104215846.58672-17-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20211104215846.58672-1-ajit.khaparde@broadcom.com> References: <20211103005251.25524-1-ajit.khaparde@broadcom.com> <20211104215846.58672-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000028268305cffda325" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH v5 16/22] 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" --00000000000028268305cffda325 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 94a7daf632..67ed807dad 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) --00000000000028268305cffda325--