From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D019EA00BE; Fri, 12 Jun 2020 15:34:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6842A1BED7; Fri, 12 Jun 2020 15:34:11 +0200 (CEST) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 2144B1BECC for ; Fri, 12 Jun 2020 15:34:08 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id D0A181BD7A4; Fri, 12 Jun 2020 06:34:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com D0A181BD7A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591968847; bh=5lW+duYp53k2oD0m50JDzhMtu+w3soDem4ey6L1xLaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H+4cT/gMYzDvdOuEnzPj3lkmnkAr+h2fTh/T2BkIcjcywk7eR/9G+/iA8/6D14YQC A3c5pkcZt1XHZuJmVDxMZt1WrDra5kch20zPJPZ9tDsLitETAK7KCbFei2WTSWguLZ U4ijAeMpvmCwY+f5xK0LaCSPx+Bq0TQtJLHNduKo= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 12 Jun 2020 18:58:47 +0530 Message-Id: <20200612132934.16488-4-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200612132934.16488-1-somnath.kotur@broadcom.com> References: <20200612132934.16488-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 03/50] net/bnxt: add support to get FID, default vnic ID and svif of VF-Rep Endpoint X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Use 'first_vf_id' and the 'vf_id' that is input as part of adding a representor to obtain the PCI function ID(FID) of the VF(VFR endpoint). Use the FID as an input to FUNC_QCFG HWRM cmd to obtain the default vnic ID of the VF. Along with getting the default vNIC ID by supplying the FW FID of the VF-rep endpoint to HWRM_FUNC_QCFG, obtain and store it's function svif. Reviewed-by: Ajit Kumar Khaparde Signed-off-by: Somnath Kotur Signed-off-by: Venkat Duvvuru --- drivers/net/bnxt/bnxt.h | 3 +++ drivers/net/bnxt/bnxt_hwrm.c | 27 +++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 4 ++++ drivers/net/bnxt/bnxt_reps.c | 12 ++++++++++++ 4 files changed, 46 insertions(+) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 443d9fe..7afbd5c 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -784,6 +784,9 @@ struct bnxt { struct bnxt_vf_representor { uint16_t switch_domain_id; uint16_t vf_id; + uint16_t fw_fid; + uint16_t dflt_vnic_id; + uint16_t svif; uint16_t tx_cfa_action; uint16_t rx_cfa_code; /* Private data store of associated PF/Trusted VF */ diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 945bc90..ed42e58 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3094,6 +3094,33 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) return rc; } +int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid, + uint16_t *vnic_id, uint16_t *svif) +{ + struct hwrm_func_qcfg_input req = {0}; + struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; + uint16_t svif_info; + int rc = 0; + + HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB); + req.fid = rte_cpu_to_le_16(fid); + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); + + HWRM_CHECK_RESULT(); + + if (vnic_id) + *vnic_id = rte_le_to_cpu_16(resp->dflt_vnic_id); + + svif_info = rte_le_to_cpu_16(resp->svif_info); + if (svif && (svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID)) + *svif = svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_MASK; + + HWRM_UNLOCK(); + + return rc; +} + int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp) { struct hwrm_port_mac_qcfg_input req = {0}; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 58b414d..8d19998 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -270,4 +270,8 @@ int bnxt_hwrm_cfa_counter_qstats(struct bnxt *bp, enum bnxt_flow_dir dir, uint16_t cntr, uint16_t num_entries); +int bnxt_hwrm_get_dflt_vnic_id(struct bnxt *bp, uint16_t fid, + uint16_t *vnic_id); +int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid, + uint16_t *vnic_id, uint16_t *svif); #endif diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 39f3d23..b6964ab 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -150,6 +150,7 @@ int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params) (struct bnxt_vf_representor *)params; struct rte_eth_link *link; struct bnxt *parent_bp; + int rc = 0; vf_rep_bp->vf_id = rep_params->vf_id; vf_rep_bp->switch_domain_id = rep_params->switch_domain_id; @@ -179,6 +180,17 @@ int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params) eth_dev->data->dev_link.link_status = link->link_status; eth_dev->data->dev_link.link_autoneg = link->link_autoneg; + vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id; + PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid); + rc = bnxt_hwrm_get_dflt_vnic_svif(parent_bp, vf_rep_bp->fw_fid, + &vf_rep_bp->dflt_vnic_id, + &vf_rep_bp->svif); + if (rc) + PMD_DRV_LOG(ERR, "Failed to get default vnic id of VF\n"); + else + PMD_DRV_LOG(INFO, "vf_rep->dflt_vnic_id = %d\n", + vf_rep_bp->dflt_vnic_id); + PMD_DRV_LOG(INFO, "calling bnxt_print_link_info\n"); bnxt_print_link_info(eth_dev); -- 2.7.4