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 4AF51A0547; Thu, 16 Jun 2022 04:41:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FAFE42BE2; Thu, 16 Jun 2022 04:41:13 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2099.outbound.protection.outlook.com [40.107.94.99]) by mails.dpdk.org (Postfix) with ESMTP id 3A8F342BD9 for ; Thu, 16 Jun 2022 04:41:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HBKa09Ajxw4m5xcsRQBlkwC6GymhB2/F6rxCV0/MzCGnH/1n0fBc2OlVBhxkmwWKmD+Mr3PH/SST8bdeeT+vcZR6h50QuhZnqe0/AfU9PS0pQfNuyhlsywZhnkmhTh3Pe9FJWEXFfdL2jqcHcQZVhy1ipHMihRNBMVIZ9WTx9caqH6I/7x2h7DPKldIc35auL5lTOD16WUxzs9rkiHEMvBuiX+iZ7BCYE4twB4doOiOfI/+YlD0G8gtp+3xiIWtii4UnglUMIUoyqZzkE/sMxp4hgKMLu+9Llnsz+ip64fACuGXryCffrUq0nU++jqouOMqkZXm1GZI2WUGJML/q6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t80PUa+V2/O+0PMbVVoQJFPYUwFsOaQhVQtE9jJ6mDk=; b=DqLAI0jqXQsGwBTdMIGEs8yfGCTW2wzqrbT6uaMSADkkscI8uuuH1SkrHisfjMqgogzeBEqQcGdWunwGEo0usWEQ9l0K5cNOnBK9fXQT10sSH4wNof/7HAHflQOu2E0qhsI5u/dGsDdgqeKvdJLs3WB2QtgV6qgm54jrywDF09u1t1iqqYvKrGkDeepZN19QXGklcigSOSrz7RWyr4iXi6jhe+n2MMzd8UJMEHqZoWrINqUBNaIB9TStXIuNVUuP+G9qlf+oY4Rrz0s1m1kan5kD+aZHgUoIJsqDu95vISRWqpwEOAZuCwM8mFDRBEfL+ISEhqE6m1WhJdXdijkF6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t80PUa+V2/O+0PMbVVoQJFPYUwFsOaQhVQtE9jJ6mDk=; b=pcbXi0LwDaU1KGvzSAFDTkBbclr1drthU69cre0j3R/Bavm7grZbmT1KXWZ9zSxgE8H/53X503bRz7WzUj4mWmr/RVh0liHo4Eb9Xn1CA4H638ViUV/A1M12nuTo8B6faPSTB4nsXm8amk6zJxIxK02/tIhPnje5MTGv/Gl2VZc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM6PR13MB3004.namprd13.prod.outlook.com (2603:10b6:5:191::21) by DM6PR13MB2345.namprd13.prod.outlook.com (2603:10b6:5:be::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.9; Thu, 16 Jun 2022 02:41:09 +0000 Received: from DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::ac31:a36a:cc15:cd35]) by DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::ac31:a36a:cc15:cd35%7]) with mapi id 15.20.5353.011; Thu, 16 Jun 2022 02:41:09 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH v2 08/15] net/nfp: support NFP3800 card Date: Thu, 16 Jun 2022 04:39:32 +0200 Message-Id: <20220616023939.1798769-9-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220616023939.1798769-1-jin.liu@corigine.com> References: <20220602015304.710197-1-jin.liu@corigine.com> <20220616023939.1798769-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0087.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::20) To DM6PR13MB3004.namprd13.prod.outlook.com (2603:10b6:5:191::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6373ea3f-9e40-4a84-59ee-08da4f41ab86 X-MS-TrafficTypeDiagnostic: DM6PR13MB2345:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4P7RiaAnPnnZ0iKtnDKXfBwTDslcbOe4VTWBmzQ2dvItC3kYkrt0oq0P1Q4o6x2AlztyNQeoR+tqLb7vmJ4nTRDWyz6/xynfS9w1cdIYsWvf/p4xupE438VL8eu/TxaswTCtnj9TphtqSo78HarXFTuzX2npPR4HLolw/6X2UBQGJ2S4/m81TJfbiXRywasdNOFc1nDap8jJl9/ltP0YYlHKCAeoXmqlmszHEKeZHY1Dpt7JytmAlgx5UqgIHbTZVLLA04MU2F4FuM/nashIKR4EefbudnpFGXL5VPaOjXDbAGquzsg5/z8MayraFscpjnQFDLzVvRy5ueGgIB5U4u7ymY1eHT9K5jcCpj1VufRG22yPnAjuBEEaNNt4Z8wo1GHh0RsibYO9liohabJ+pBRZrOROA2zn5habCo8Wmhxbya2x5iQo5vU2N/37TidA8DtjL+ux1zomXMy9mW3x9rTuhsoUBIv5ZvBRrLY59omO/VxDGup4tU0k8hlnNh5q5AbDjomtQdoBh3ZFW3zxMDbw/0i8B+QVkbaljWEMNVBNR2GrYcwyvne5V0OLYmt+GM+BWkINYFel/bYt2I87jPbldaw7Fss8ekHU1DughaMaweLKP/FyqMjmwyAgaBVGbb+z8X+c4MM+rgVzu6eMzFFPpDT1UHnHZv+3XIg5gpqMBlMmiZhAydHeLO0ZvXGfJhPNzqwSI7/81CgCeINElg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR13MB3004.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(346002)(396003)(366004)(39830400003)(136003)(6506007)(6666004)(26005)(316002)(66574015)(186003)(107886003)(6486002)(508600001)(41300700001)(2616005)(83380400001)(1076003)(36756003)(54906003)(6916009)(66556008)(8676002)(2906002)(4326008)(44832011)(38350700002)(6512007)(52116002)(5660300002)(66476007)(66946007)(86362001)(8936002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N0NwSDhCRXdTMEZ2YUhFV3Yxb3c0NjhHWGh0MDExRXE1aUVtcXVBOFFMYUtt?= =?utf-8?B?MzRDVytmNndvYzkva3I5dXcrdFFnZmtZb3hEMWpRUHArN29OVWU4Sjl2c2ZZ?= =?utf-8?B?OEtYZVgyMUl0U1d6TUMzZGw2ZGNjcXBmMTJHMVdiUlpEUmxId2U4a1M4am1W?= =?utf-8?B?TGtLQ095SlBmb3hsdVplOG1VNDBjUHUvQnlsWWp6c0tLcWhBSmRNUGlXaU9H?= =?utf-8?B?Wm1TZFVPWjMvUjVCc2ZuU2s5T2dQZWp5RzFxa0FFcDdUVVlDUmZOSW1Ld01M?= =?utf-8?B?NEd0bjdhSWVtSzErcHF1ZkNYSnZmYU9oaXIrUmNhMFZpL1VUbDJIb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lrb2RXZXhPNTRjcytuQ2lpdEZLQkdPUTJNWC80V0pURUZEVXVTREVvelVW?= =?utf-8?B?Yk00N1Fxa3N2R2dlVi9GbE8wVjk4YVd3azk2RnZIV09lamxhaEMzamNTZUpF?= =?utf-8?B?RWdCaE5YN04rSzJ4ajJqcFJDSXZuTC92enZYVFNpVFdTTlNDc0dUZFhFKzRQ?= =?utf-8?B?bURzMGI5aEQ3RFBwQm00eFViVzZ5Z2hEaEoyNjF0MmVaZEFsV25Ddz09?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6373ea3f-9e40-4a84-59ee-08da4f41ab86 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 02:41:09.8179 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MIQuyAtQ4Ft6fz7cZsKjwX3lY2JTLqkXw6LOAVDwACuUr0zSIuRBhfYWMu4bPkclS2Pz1AEkwI0f2W+AHI5eEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB2345 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 Add support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions. Signed-off-by: Jin Liu Signed-off-by: Diana Wang Signed-off-by: Peng Zhang Signed-off-by: Chaoyong He Signed-off-by: Niklas Söderlund --- drivers/net/nfp/nfp_common.h | 33 +++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 ++++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 ++++++++++++---- 5 files changed, 79 insertions(+), 13 deletions(-) diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 8e1b4fb6a4..274d188527 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -16,9 +16,11 @@ #define NFP_NET_PMD_VERSION "0.1" #define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803 #define PCI_DEVICE_ID_NFP4000_PF_NIC 0x4000 #define PCI_DEVICE_ID_NFP6000_PF_NIC 0x6000 -#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 +#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 /* Include NFP4000VF */ /* Forward declaration */ struct nfp_net_adapter; @@ -41,8 +43,16 @@ struct nfp_net_adapter; #define NFP_QCP_QUEUE_STS_HI 0x000c #define NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask (0x3ffff) +#define NFP_PCIE_QCP_NFP3800_OFFSET 0x400000 +#define NFP_PCIE_QCP_NFP6000_OFFSET 0x80000 +#define NFP_PCIE_QUEUE_NFP3800_MASK 0x1ff +#define NFP_PCIE_QUEUE_NFP6000_MASK 0xff +#define NFP_PCIE_QCP_PF_OFFSET 0x0 +#define NFP_PCIE_QCP_VF_OFFSET 0x0 + /* The offset of the queue controller queues in the PCIe Target */ -#define NFP_PCIE_QUEUE(_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) +#define NFP_PCIE_QUEUE(_offset, _q, _mask) \ + ((_offset) + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & (_mask)))) /* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0 @@ -342,6 +352,25 @@ nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr) return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask; } +static inline uint32_t nfp_pci_queue(struct rte_pci_device *pdev, uint16_t queue) +{ + switch (pdev->id.device_id) { + case PCI_DEVICE_ID_NFP4000_PF_NIC: + case PCI_DEVICE_ID_NFP6000_PF_NIC: + return NFP_PCIE_QUEUE(NFP_PCIE_QCP_PF_OFFSET, queue, + NFP_PCIE_QUEUE_NFP6000_MASK); + case PCI_DEVICE_ID_NFP3800_VF_NIC: + return NFP_PCIE_QUEUE(NFP_PCIE_QCP_VF_OFFSET, queue, + NFP_PCIE_QUEUE_NFP3800_MASK); + case PCI_DEVICE_ID_NFP6000_VF_NIC: + return NFP_PCIE_QUEUE(NFP_PCIE_QCP_VF_OFFSET, queue, + NFP_PCIE_QUEUE_NFP6000_MASK); + default: + return NFP_PCIE_QUEUE(NFP_PCIE_QCP_PF_OFFSET, queue, + NFP_PCIE_QUEUE_NFP3800_MASK); + } +} + /* Prototypes for common NFP functions */ int nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update); int nfp_net_configure(struct rte_eth_dev *dev); diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index ae6cb5943f..cb84dc3188 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -446,12 +446,13 @@ nfp_net_init(struct rte_eth_dev *eth_dev) /* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { + case PCI_DEVICE_ID_NFP3800_PF_NIC: case PCI_DEVICE_ID_NFP4000_PF_NIC: case PCI_DEVICE_ID_NFP6000_PF_NIC: start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ); - tx_bar_off = (uint64_t)start_q * NFP_QCP_QUEUE_ADDR_SZ; + tx_bar_off = nfp_pci_queue(pci_dev, start_q); start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_RXQ); - rx_bar_off = (uint64_t)start_q * NFP_QCP_QUEUE_ADDR_SZ; + rx_bar_off = nfp_pci_queue(pci_dev, start_q); break; default: PMD_DRV_LOG(ERR, "nfp_net: no device ID matching"); @@ -764,6 +765,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) { int err; int ret = 0; + uint64_t addr; int total_ports; struct nfp_cpp *cpp; struct nfp_pf_dev *pf_dev; @@ -867,8 +869,24 @@ nfp_pf_init(struct rte_pci_device *pci_dev) PMD_INIT_LOG(DEBUG, "ctrl bar: %p", pf_dev->ctrl_bar); /* configure access to tx/rx vNIC BARs */ + switch (pci_dev->id.device_id) { + case PCI_DEVICE_ID_NFP3800_PF_NIC: + addr = NFP_PCIE_QUEUE(NFP_PCIE_QCP_NFP3800_OFFSET, + 0, NFP_PCIE_QUEUE_NFP3800_MASK); + break; + case PCI_DEVICE_ID_NFP4000_PF_NIC: + case PCI_DEVICE_ID_NFP6000_PF_NIC: + addr = NFP_PCIE_QUEUE(NFP_PCIE_QCP_NFP6000_OFFSET, + 0, NFP_PCIE_QUEUE_NFP6000_MASK); + break; + default: + PMD_INIT_LOG(ERR, "nfp_net: no device ID matching"); + err = -ENODEV; + goto ctrl_area_cleanup; + } + pf_dev->hw_queues = nfp_cpp_map_area(pf_dev->cpp, 0, 0, - NFP_PCIE_QUEUE(0), NFP_QCP_QUEUE_AREA_SZ, + addr, NFP_QCP_QUEUE_AREA_SZ, &pf_dev->hwqueues_area); if (pf_dev->hw_queues == NULL) { PMD_INIT_LOG(ERR, "nfp_rtsym_map fails for net.qc"); @@ -995,6 +1013,10 @@ nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME, + PCI_DEVICE_ID_NFP3800_PF_NIC) + }, { RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NFP4000_PF_NIC) diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index d0fa1df24d..c46ee0f913 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -327,11 +327,12 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) /* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { + case PCI_DEVICE_ID_NFP3800_VF_NIC: case PCI_DEVICE_ID_NFP6000_VF_NIC: start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ); - tx_bar_off = (uint64_t)start_q * NFP_QCP_QUEUE_ADDR_SZ; + tx_bar_off = nfp_pci_queue(pci_dev, start_q); start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_RXQ); - rx_bar_off = (uint64_t)start_q * NFP_QCP_QUEUE_ADDR_SZ; + rx_bar_off = nfp_pci_queue(pci_dev, start_q); break; default: PMD_DRV_LOG(ERR, "nfp_net: no device ID matching"); @@ -456,6 +457,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) } static const struct rte_pci_id pci_id_nfp_vf_net_map[] = { + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME, + PCI_DEVICE_ID_NFP3800_VF_NIC) + }, { RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NFP6000_VF_NIC) diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h index 720d3989e6..a04a68f546 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp.h +++ b/drivers/net/nfp/nfpcore/nfp_cpp.h @@ -214,7 +214,7 @@ void nfp_cpp_free(struct nfp_cpp *cpp); * @return true if model is in the NFP6000 family, false otherwise. */ #define NFP_CPP_MODEL_IS_6000(model) \ - ((NFP_CPP_MODEL_CHIP_of(model) >= 0x4000) && \ + ((NFP_CPP_MODEL_CHIP_of(model) >= 0x3800) && \ (NFP_CPP_MODEL_CHIP_of(model) < 0x7000)) /* diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c index 67946891ab..f8f3c372ac 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c @@ -266,6 +266,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) struct nfp_eth_table *table; uint32_t table_sz; int i, j, ret, cnt = 0; + const struct rte_ether_addr *mac; entries = malloc(NSP_ETH_TABLE_SIZE); if (!entries) @@ -278,9 +279,15 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) goto err; } - for (i = 0; i < NSP_ETH_MAX_COUNT; i++) - if (entries[i].port & NSP_ETH_PORT_LANES_MASK) + /* The NFP3800 NIC support 8 ports, but only 2 ports are valid, + * the rest 6 ports mac are all 0, ensure we don't use these port + */ + for (i = 0; i < NSP_ETH_MAX_COUNT; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; + if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) && + (!rte_is_zero_ether_addr(mac))) cnt++; + } /* Some versions of flash will give us 0 instead of port count. For * those that give a port count, verify it against the value calculated @@ -299,10 +306,13 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) memset(table, 0, table_sz); table->count = cnt; - for (i = 0, j = 0; i < NSP_ETH_MAX_COUNT; i++) - if (entries[i].port & NSP_ETH_PORT_LANES_MASK) + for (i = 0, j = 0; i < NSP_ETH_MAX_COUNT; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; + if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) && + (!rte_is_zero_ether_addr(mac))) nfp_eth_port_translate(nsp, &entries[i], i, - &table->ports[j++]); + &table->ports[j++]); + } nfp_eth_calc_port_geometry(table); for (i = 0; i < (int)table->count; i++) -- 2.27.0