From patchwork Thu Aug 24 16:20:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Lucero X-Patchwork-Id: 27894 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 32D818CF6; Thu, 24 Aug 2017 18:20:49 +0200 (CEST) Received: from netronome.com (host-79-78-33-110.static.as9105.net [79.78.33.110]) by dpdk.org (Postfix) with ESMTP id EEDEB7D24 for ; Thu, 24 Aug 2017 18:20:34 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id v7OGKOe2016329 for ; Thu, 24 Aug 2017 17:20:24 +0100 Received: (from alucero@localhost) by netronome.com (8.14.4/8.14.4/Submit) id v7OGKOVl016328 for dev@dpdk.org; Thu, 24 Aug 2017 17:20:24 +0100 From: Alejandro Lucero To: dev@dpdk.org Date: Thu, 24 Aug 2017 17:20:15 +0100 Message-Id: <1503591622-16232-10-git-send-email-alejandro.lucero@netronome.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503591622-16232-1-git-send-email-alejandro.lucero@netronome.com> References: <1503591622-16232-1-git-send-email-alejandro.lucero@netronome.com> Subject: [dpdk-dev] [PATCH 09/16] nfp: add support for vNIC rx/tx bar mappings 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" NFP vNICs use a subset of PCI device BARs. vNIC rx/tx bars point to NFP hardware queues unit. Unline vNIC config bar, the NFP address is always the same so the NFP expansion bar configuration always uses the same hardcoded physical address. This patch adds a NSPU API function for getting vNIC rx/tx bars mapped through a expansion bar using that specific physical address. The PMD will use the PCI bar offset returned for mapping the vNIC rx/tx bars. Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfp_nspu.c | 21 ++++++++++++++++++++- drivers/net/nfp/nfp_nspu.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c index f68bae6..df5af33 100644 --- a/drivers/net/nfp/nfp_nspu.c +++ b/drivers/net/nfp/nfp_nspu.c @@ -22,7 +22,8 @@ #define NFP_NSP_TARGET 7 /* Expansion BARs for mapping PF vnic BARs */ -#define NFP_NET_PF_CFG_EXP_BAR 6 +#define NFP_NET_PF_CFG_EXP_BAR 6 +#define NFP_NET_PF_HW_QUEUES_EXP_BAR 5 /* * This is an NFP internal address used for configuring properly an NFP @@ -509,3 +510,21 @@ return 0; } + +/* + * This is a hardcoded fixed NFP internal CPP bus address for the hw queues unit + * inside the PCIE island. + */ +#define NFP_CPP_PCIE_QUEUES ((uint64_t)(1ULL << 39) | 0x80000 | \ + ((uint64_t)0x4 & 0x3f) << 32) + +/* Configure a specific NFP expansion bar for accessing the vNIC rx/tx BARs */ +void +nfp_nsp_map_queues_bar(nspu_desc_t *desc, uint64_t *pcie_offset) +{ + nfp_nspu_mem_bar_cfg(desc, NFP_NET_PF_HW_QUEUES_EXP_BAR, 0, + NFP_CPP_PCIE_QUEUES, pcie_offset); + + /* This is the pcie offset to use by the host */ + *pcie_offset |= ((NFP_NET_PF_HW_QUEUES_EXP_BAR & 0x7) << (27 - 3)); +} diff --git a/drivers/net/nfp/nfp_nspu.h b/drivers/net/nfp/nfp_nspu.h index 8211f92..4b09d4f 100644 --- a/drivers/net/nfp/nfp_nspu.h +++ b/drivers/net/nfp/nfp_nspu.h @@ -74,3 +74,4 @@ int nfp_nspu_init(nspu_desc_t *desc, int nfp, int pcie_bar, size_t pcie_barsz, int nfp_nsp_get_abi_version(nspu_desc_t *desc, int *major, int *minor); int nfp_nsp_fw_setup(nspu_desc_t *desc, const char *sym, uint64_t *pcie_offset); int nfp_nsp_map_ctrl_bar(nspu_desc_t *desc, uint64_t *pcie_offset); +void nfp_nsp_map_queues_bar(nspu_desc_t *desc, uint64_t *pcie_offset);