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 8D11EA0548; Thu, 2 Jun 2022 03:54:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 910BF42B74; Thu, 2 Jun 2022 03:54:51 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2128.outbound.protection.outlook.com [40.107.223.128]) by mails.dpdk.org (Postfix) with ESMTP id 2E3B642847 for ; Thu, 2 Jun 2022 03:54:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J0d4zqFMkRpCI7eaD/2n8xTwMQk7KpM1JDhrWB5QfwqH2hVSA9OpQm/XxKp2xWu+FuSMfDDH/6IQusN8yHwAETiZhYCshnxGsgJ+RAmsR4Ggy0giktYUCtwFtxZyjFR7tCSCN0uh8Y2cZLGWUDzTRFWcy9wszAvECBhT+4Iwx51x+39NTq8phxSq4/6R2eDxSUdiDDzM29OkMT1Cl/J8AiOmk20P8X+KD4DedfofftmgtKphNWliRvL6FiLsTNnAkXsZ0FGB42CuGfrFOzvK6F3Ho0Pir9A3exHaulVNo+me3rZDiqi6CjrI8F3Dq/+ncAjXCoud2yB1MnFgvcJ6Lg== 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=WipdKj8g2K9w3e5HgYQ576L9ZS9LjE3xhqx6UlMbo2Y=; b=K6pltlKsw5WTjGChUFuMayV4KIyJEL7FY6qmsbwoUxrCuae5A9tfiCjNd7px9Q2VS83V9/kL84wYJ0m3NvCilMZxIdpDhbrwosj4RteevJSfHSKMi+20BaxqtzKS+yWGDd+1FzMeEb1T8NJoiREzpFLJOkPFQ7UR8Yye2KWFvp5+ykoDZ4KxxwisH5ZsLJk+ViWgaYfEcsY9EV2EH80JvrlqrOoSLjguF/mpUE6iMA9E9bwlSlpGWUOlrBge8p+bJlJI6fs90WUiTg2/+hBezqTIKKcaa0OSVeNMMFK1iczGrq4txpN7iQEaLoVVF/vTHUKQ4TILYZkDIpji9kChYA== 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=WipdKj8g2K9w3e5HgYQ576L9ZS9LjE3xhqx6UlMbo2Y=; b=C39VxGkROdtq8mNHnw6KKnEov01kdVga9kX3P30ntAZ+lt0jVFdK0LA4SPb0Kr17dKVzw9NKqDuqHM5YR8DdRQGUNZvKV9Atxn6N3UpT9CYOxII2rIhQ9cydjJZo7mmaJCrA1FNUAFCOAY9CxP4ixuIGEzpVYR14o661rBXAemw= 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 DM4PR13MB5858.namprd13.prod.outlook.com (2603:10b6:8:46::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.11; Thu, 2 Jun 2022 01:54:48 +0000 Received: from DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::d902:ed7d:82bb:c753]) by DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::d902:ed7d:82bb:c753%4]) with mapi id 15.20.5314.013; Thu, 2 Jun 2022 01:54:48 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH 06/14] net/nfp: support NFP3800 card Date: Thu, 2 Jun 2022 03:52:56 +0200 Message-Id: <20220602015304.710197-7-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220602015304.710197-1-jin.liu@corigine.com> References: <20220602015304.710197-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0457.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1aa::12) 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: 43906f08-11b9-492f-0fe2-08da443ae015 X-MS-TrafficTypeDiagnostic: DM4PR13MB5858: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: 6aAAAoqG8G0hL3jxk/WuyY9apRzV0ZtLgv1xyLrpfenkLA9pI7GyVmQwojplIOxJ1B1Sh7UkLe/LvezQ+IE2OlGmpcdJ4e5nX3pyGkJlAnMrKys2wLA5IY0HK24u8YKo9jv5qu4qhaQ7fMBE0FYnfHsB4ITYX4rGhNznRM+gK8AAYDwTcnwlVHHwNsy26GcKSUeBnVTRNsy1R9FtKqfEW8ataMM0pBEZR7L1OInDhS5vkGMib/msHyvxz/DmfpOrcjW2trAKvcJrmbd04gCoeAgF+XAT7Kq+AcFOVFS5psQ48pP3+He/wdBjPHCSWOx72e8ZCS16gB1K5utU2F8cx4dRxDRXdQ657eHhqv5hGgAsfJgyU9tdDnTXaU7jHl+PfhY+dI3gG+2y1/XCxcFOvzoop6tC8vH5s95dvK+20fQsrzIcNHwQd6CoLvH4QkKrQ8l2K2rbF83VheeddtiJELJ3/C/MgBdepn5VrsawR+fMyPn4YN8LgbOTyd0GHGN2ibq3dcFG8Q4waF5K8X4b4ahQIVRAZroyhaBb+I70eSXgOg5o/LsPn92jIjq/u6JkEpuEBu5HvR9lcneQkP+524DaSsbuV/O9GVhXpuwnYIfn/DNgQUW6kRTb/DKOHmk+9bUBb2kvBkEpgBcpcBcdfiKSBYEWR3hFLCY6NMqhxY/ZCFIPQcTvjuSVP0zVIcWC 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:(13230001)(4636009)(346002)(366004)(396003)(136003)(376002)(39840400004)(36756003)(186003)(66574015)(83380400001)(5660300002)(4326008)(44832011)(8936002)(2906002)(6916009)(54906003)(1076003)(107886003)(6506007)(316002)(2616005)(41300700001)(8676002)(66946007)(66476007)(6666004)(66556008)(26005)(6512007)(52116002)(38100700002)(38350700002)(86362001)(6486002)(508600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SGdncmtNWWZ2aGxoQWlwcTJXdEZrd3BCY1pTemt4TC9jcjdBNWx1RFdjN3Q3?= =?utf-8?B?cittMExpcms2djN1RzlEN0V1SXErODNXN0lSMXhaVk1IRExzSzdsbE1KaGRF?= =?utf-8?B?YnJKN2dETGJkaE12ZG9Jb1BTVEZWeDdhUm5ZQVZ0TnBQbEgxQnFNckFPUXJM?= =?utf-8?B?VnhqWVlxemZIYjBnL1ZtZHlPakx0RFF4QmhSbGU5RS8yUHJTTWNNZDJ2enZr?= =?utf-8?B?QkFGSVdXQU4yaHZVcytUU05GUUl5RUd6b0ZWcTAvWWgrU1pWSTFINmhmdmor?= =?utf-8?B?Y01MR3ZORUc2N05mcksyY0xFQ0lNM1JzKytUMWNoMUpDR3kwVFJUc2hOMUM2?= =?utf-8?B?OVcyaHUyR3YvUVk2WW5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=?utf-8?B?S1gyMnNKdkV5MzFHWnhDOFNjdXRoUnVTUUJaOUVkaE1tbmZvUWNuN0VwNnZF?= =?utf-8?B?TWliUmJDYnF4QWJRa1BmY0tmeE5LcEFtaUFRdXgreEgyNnQ3aWM4T1hkNEtt?= =?utf-8?B?UUNOSmkyUDFNN1dYbG9aOTNKRUV1WnZmaXJmQlFaMFh1WHdBeGFXUT09?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43906f08-11b9-492f-0fe2-08da443ae015 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2022 01:54:48.7114 (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: jIKNtG6ZiIS1u7Rpj/maJE22Koh6E9obamdsoZ/tppbAnHibOBFYyiqMWb77a3FgSRGvkxNIL3XjdPGBJmAlAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR13MB5858 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 1dd230bcc6..346fece527 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 @@ -339,6 +349,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 0d5caf94ea..4d2cd9b0b3 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -445,12 +445,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"); @@ -763,6 +764,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; @@ -866,8 +868,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"); @@ -994,6 +1012,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 7d79a08041..f5a0406e7d 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -326,11 +326,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"); @@ -455,6 +456,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