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 56803A00BE; Fri, 12 Jun 2020 15:35:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D865D1BF02; Fri, 12 Jun 2020 15:34:12 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 888CF1BEAE for ; Fri, 12 Jun 2020 15:34:09 +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 3B8F01BD7AC; Fri, 12 Jun 2020 06:34:08 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 3B8F01BD7AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591968849; bh=pul8q0Bi+1ATZ9Nv3/3adTXHQamVjVAivBqD7YDn+KY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1erGlIDEGtnO8TRXrKIyxai9BOiLc4zng76V/zJbhHv5Zs5oi0Zi2IuqoYyvYnWt Fj9jTv3KNhCTqXBuCc5HriApU4HKDFp2xKsF7hWMvs3O8uWDP3EbcB5W629LUQXQ8i yMWyMaouJ4GKV350BEVMppxmcretDujm2t1l2yKU= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 12 Jun 2020 18:58:48 +0530 Message-Id: <20200612132934.16488-5-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 04/50] net/bnxt: initialize parent PF information 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" From: Lance Richardson Add support to query parent PF information (MAC address, function ID, port ID and default VNIC) from firmware. Current firmware returns zero for parent default vnic, a temporary Wh+-specific workaround is included until that can be fixed. Signed-off-by: Lance Richardson Signed-off-by: Venkat Duvvuru Reviewed-by: Kalesh Anakkur Purayil Reviewed-by: Somnath Kotur Reviewed-by: Kishore Padmanabha Signed-off-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 9 +++++++++ drivers/net/bnxt/bnxt_ethdev.c | 23 +++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.c | 42 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 1 + 4 files changed, 75 insertions(+) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 7afbd5c..2b87899 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -217,6 +217,14 @@ struct bnxt_child_vf_info { bool persist_stats; }; +struct bnxt_parent_info { +#define BNXT_PF_FID_INVALID 0xFFFF + uint16_t fid; + uint16_t vnic; + uint16_t port_id; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; +}; + struct bnxt_pf_info { #define BNXT_FIRST_PF_FID 1 #define BNXT_MAX_VFS(bp) ((bp)->pf->max_vfs) @@ -738,6 +746,7 @@ struct bnxt { #define BNXT_OUTER_TPID_BD_SHFT 16 uint32_t outer_tpid_bd; struct bnxt_pf_info *pf; + struct bnxt_parent_info *parent; uint8_t vxlan_port_cnt; uint8_t geneve_port_cnt; uint16_t vxlan_port; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 4202904..bf018be 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -97,6 +97,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { #define BNXT_DEVARG_TRUFLOW "host-based-truflow" #define BNXT_DEVARG_FLOW_XSTAT "flow-xstat" #define BNXT_DEVARG_MAX_NUM_KFLOWS "max-num-kflows" + static const char *const bnxt_dev_args[] = { BNXT_DEVARG_TRUFLOW, BNXT_DEVARG_FLOW_XSTAT, @@ -173,6 +174,11 @@ uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp) return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR; } +static void bnxt_free_parent_info(struct bnxt *bp) +{ + rte_free(bp->parent); +} + static void bnxt_free_pf_info(struct bnxt *bp) { rte_free(bp->pf); @@ -223,6 +229,16 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig) bp->grp_info = NULL; } +static int bnxt_alloc_parent_info(struct bnxt *bp) +{ + bp->parent = rte_zmalloc("bnxt_parent_info", + sizeof(struct bnxt_parent_info), 0); + if (bp->parent == NULL) + return -ENOMEM; + + return 0; +} + static int bnxt_alloc_pf_info(struct bnxt *bp) { bp->pf = rte_zmalloc("bnxt_pf_info", sizeof(struct bnxt_pf_info), 0); @@ -1322,6 +1338,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) bnxt_free_cos_queues(bp); bnxt_free_link_info(bp); bnxt_free_pf_info(bp); + bnxt_free_parent_info(bp); eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; @@ -5210,6 +5227,8 @@ static int bnxt_init_fw(struct bnxt *bp) bnxt_hwrm_port_mac_qcfg(bp); + bnxt_hwrm_parent_pf_qcfg(bp); + rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp); if (rc) return rc; @@ -5528,6 +5547,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused) if (rc) goto error_free; + rc = bnxt_alloc_parent_info(bp); + if (rc) + goto error_free; + rc = bnxt_alloc_hwrm_resources(bp); if (rc) { PMD_DRV_LOG(ERR, diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index ed42e58..347e1c7 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3094,6 +3094,48 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) return rc; } +int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp) +{ + struct hwrm_func_qcfg_input req = {0}; + struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; + int rc; + + if (!BNXT_VF_IS_TRUSTED(bp)) + return 0; + + if (!bp->parent) + return -EINVAL; + + bp->parent->fid = BNXT_PF_FID_INVALID; + + HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB); + + req.fid = rte_cpu_to_le_16(0xfffe); /* Request parent PF information. */ + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); + + HWRM_CHECK_RESULT(); + + memcpy(bp->parent->mac_addr, resp->mac_address, RTE_ETHER_ADDR_LEN); + bp->parent->vnic = rte_le_to_cpu_16(resp->dflt_vnic_id); + bp->parent->fid = rte_le_to_cpu_16(resp->fid); + bp->parent->port_id = rte_le_to_cpu_16(resp->port_id); + + /* FIXME: Temporary workaround - remove when firmware issue is fixed. */ + if (bp->parent->vnic == 0) { + PMD_DRV_LOG(ERR, "Error: parent VNIC unavailable.\n"); + /* Use hard-coded values appropriate for current Wh+ fw. */ + if (bp->parent->fid == 2) + bp->parent->vnic = 0x100; + else + bp->parent->vnic = 1; + } + + HWRM_UNLOCK(); + + return 0; +} + int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid, uint16_t *vnic_id, uint16_t *svif) { diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 8d19998..ef89975 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -274,4 +274,5 @@ 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); +int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp); #endif -- 2.7.4