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 8B6D6A0548; Thu, 8 Sep 2022 10:45:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32BD741141; Thu, 8 Sep 2022 10:45:37 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2130.outbound.protection.outlook.com [40.107.223.130]) by mails.dpdk.org (Postfix) with ESMTP id 93B4C42847 for ; Thu, 8 Sep 2022 10:45:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CKd7M1048ZXbXmPew6smFQGyOFB4wrt/5LYt84htsdh+I7jfOTAjj4rT8uz3hWK0Hq1doT6xtQgC+d/13IAVRE5t1kJSQzs/AWE2cWwhBrw1skzuG2E2P2cuvsX8ZacMxQeH1Ir8Kl6TBx+1L5/nsFdPcV7WIUEK2GX+393zPnNVyyNFp0YNGFUBbhf//2JfLDLo6toYJHC8rvAKYtrFHWNyOXNMzf2objTJLuGw6xRyQL5qQFUOaHj0YUIlftps2irHya6bDGrxwjAZnE38U7Y5E+BBV6UCxVoGIbb0Gm9TARpjoD+yKrgfWMHFz03kRAtmA+Bg6p3MENK4ehEniw== 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=l4XeONNDg+Y3cGr+Frqy9Q+FMWsQdKulF6lSDGxdtFw=; b=VPLufScgeU+wAtsYx1Rn9sRjDepWfXR8kgSQ/xy2SBGGQUqYCl62aF4/S1sCQ5jws7Yix71MNi4w3SuhyBjhcIfe5XEvY4yqe6V8WoJ3ExpeFb/XLs1Xp/Bv3IxUiTzT9s3GwWGs4Z/RwYCNnnTKYK8Z5LBKWQjnyPOScon5Lhu1mGvLjMBfOy/jh5iHQ31MNMouKzOdKJC0drtu2ps2DIcrU+L+QDGB33AozFYM1XbX/h58qBXlx9BkcjrlvT38n/sK2iqP8/AkiucLnGKaTbLtSFUNbl3ZZlN2jb2IWpj4ezxaUwoTqznz2Pqnl4qD3t8PXH6+T7kufdWtjuCw4A== 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=l4XeONNDg+Y3cGr+Frqy9Q+FMWsQdKulF6lSDGxdtFw=; b=ZS5ULdsrOen6Q2LUCm+eUZyV8t6pmDbFjKhZTJfU6xyvwPnd8GnCCxkt/4kjkTdNUkgOkuKgvRIQhc+efd/2x5kMCW7LXyG5Ajl0uSHSL+XOxzAMo3JFoaXyeDtEhKDftTAp1SjC3r0W+/3COxL/hzeq+0P9/BORaJCe95GTykE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by MW4PR13MB5940.namprd13.prod.outlook.com (2603:10b6:303:1b8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.3; Thu, 8 Sep 2022 08:45:34 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431%6]) with mapi id 15.20.5612.009; Thu, 8 Sep 2022 08:45:34 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v8 04/12] net/nfp: add initial flower firmware support Date: Thu, 8 Sep 2022 16:44:54 +0800 Message-Id: <1662626702-17254-5-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> References: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0023.apcprd01.prod.exchangelabs.com (2603:1096:4:192::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW4PR13MB5940:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d6fefc0-9015-4d07-7b6d-08da91767e69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ItkQflthLJhyPdX3YbZvQxEs3xhbMpNTqniYpKez5nRO3rqJCvuFHTaRvgJegbydQYr9GVB1S52BPAcLb/PYzXz5gE8FQc1ruLlbqacZPM7rrRSAtfjDjRaJT7RogM3+nF8bOP46trEH8wH3764ZRhDArK8QTzbGlKx0lQX/7tcYGTSSwbHNboZ9sroF+AYLxdJbWh0x/qLh8DpJolRnz/wynV+fJKZFFr0Cl1897zhGfJwgfgfsuUepyq3KYhnX+hTrQLFgKqiTcf6bbYvm3YDm9M+oPI2mGYGrkVch1IFvOatZOoQgpB9yikObDPq/mK8y4uOo8eHBYyjRzsLa1rUPrWwxPJC/7w9/BarP4ZaIyc0mqfZzjEmSWpEEuEFmBNGQmCetQ5bLMUBLTqdXb0t7d9SVLidz3GR9Yd0WffqUvv6qaLVygrz5CHlAmNARX3QBdYP8r1ERNMUqK3rqy8vJL/VQXeZpK1GAoqedVElisl3+osd1lmKESUi7yovNE0uZMdCZYXBEPdRmvHDr5iKC/obSaSyVVK/zz8QiIFwoMJ7ay2XM/CW9pnMxfd5gCRW+CN0dz1Cjej0HIyCc7pgmDzseiqyj6vxOUH0WVoZijDq0tY1+OdquG/QReFmw0Qgagq2P4dol3j+2Ve38Kr/diUDJ4RphlqdOAqdBILnWKmStZuMdBqtDjT8LZs5jift8hMICfiqKr8J2YyWWHiFbbXkxTISpGp6A9VyjDTaUTmYUQr+0t01lbizGw4Z6dyg3eqi1CZP/+Ur860VhNw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(366004)(39840400004)(346002)(376002)(136003)(107886003)(44832011)(2616005)(30864003)(41300700001)(6916009)(38350700002)(83380400001)(66574015)(26005)(6512007)(186003)(36756003)(38100700002)(4326008)(54906003)(2906002)(6506007)(316002)(66946007)(478600001)(86362001)(5660300002)(66476007)(52116002)(6486002)(6666004)(8936002)(8676002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bGpRTlhzZ3pkR2hhSlhTQUx1dGRYNDhjWkJJSGF5RnBMSFI1K0VEY0VhNHFr?= =?utf-8?B?VFN2SHd2L3VRSmZFRmFIcENLQklSQXhlVVpXS0c1TUJka2xTWm9MVDJjSTJI?= =?utf-8?B?YWR4azNTTFRVK00zanpCUmtBSTN0akNsWnBCSFhhV3YvNjEwSXRNdGQzc1JB?= =?utf-8?B?RlBxaXdMNThBelU2dlhBOU85aWRaU0ljSFVKL3BXejRyOVNvL2lYWGh6QmNt?= =?utf-8?B?STIxNjN3cW5uQjg3SWNNQWZSYlhORXhNU0NJcWNBaWpiSFVW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eksxWkNvdWpYaklPcmZ2TExydTBqNklN?= =?utf-8?B?VmxvdENSZmdIMFBvckVMK2x4SkJLaWN3YS9pNFRGZjhmQjc2cG50NWVNVHFJ?= =?utf-8?B?alE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR13MB5940 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 Adds the basic probing infrastructure to support the flower firmware. Adds the basic infrastructure needed by the flower firmware to operate. The firmware requires threads to service both the PF vNIC and the ctrl vNIC. The PF is responsible for handling any fallback traffic and the ctrl vNIC is used to communicate various control messages to and from the smartNIC. rte_services are used to facilitate this logic. Adds the cpp service, used for some user tools. Signed-off-by: Chaoyong He Signed-off-by: Heinrich Kuhn Reviewed-by: Niklas Söderlund --- doc/guides/rel_notes/release_22_11.rst | 3 ++ drivers/net/nfp/flower/nfp_flower.c | 59 +++++++++++++++++++++++ drivers/net/nfp/flower/nfp_flower.h | 18 +++++++ drivers/net/nfp/meson.build | 1 + drivers/net/nfp/nfp_common.h | 1 + drivers/net/nfp/nfp_cpp_bridge.c | 87 +++++++++++++++++++++++++++++----- drivers/net/nfp/nfp_cpp_bridge.h | 6 ++- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++- 8 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 drivers/net/nfp/flower/nfp_flower.c create mode 100644 drivers/net/nfp/flower/nfp_flower.h diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index f601617..bb170e3 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -55,6 +55,9 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= + * **Updated Netronome nfp driver.** + Added the support of flower firmware. + Added the flower service infrastructure. Removed Items ------------- diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c new file mode 100644 index 0000000..e0506bd --- /dev/null +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Corigine, Inc. + * All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include "../nfp_common.h" +#include "../nfp_logs.h" +#include "../nfp_ctrl.h" +#include "../nfp_cpp_bridge.h" +#include "nfp_flower.h" + +int +nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev) +{ + int ret; + unsigned int numa_node; + struct nfp_net_hw *pf_hw; + struct nfp_app_fw_flower *app_fw_flower; + + numa_node = rte_socket_id(); + + /* Allocate memory for the Flower app */ + app_fw_flower = rte_zmalloc_socket("nfp_app_fw_flower", sizeof(*app_fw_flower), + RTE_CACHE_LINE_SIZE, numa_node); + if (app_fw_flower == NULL) { + ret = -ENOMEM; + goto done; + } + + pf_dev->app_fw_priv = app_fw_flower; + + /* Allocate memory for the PF AND ctrl vNIC here (hence the * 2) */ + pf_hw = rte_zmalloc_socket("nfp_pf_vnic", 2 * sizeof(struct nfp_net_adapter), + RTE_CACHE_LINE_SIZE, numa_node); + if (pf_hw == NULL) { + ret = -ENOMEM; + goto app_cleanup; + } + + return 0; + +app_cleanup: + rte_free(app_fw_flower); +done: + return ret; +} + +int +nfp_secondary_init_app_fw_flower(__rte_unused struct nfp_cpp *cpp) +{ + PMD_INIT_LOG(ERR, "Flower firmware not supported"); + return -ENOTSUP; +} diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h new file mode 100644 index 0000000..51e05e8 --- /dev/null +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Corigine, Inc. + * All rights reserved. + */ + +#ifndef _NFP_FLOWER_H_ +#define _NFP_FLOWER_H_ + +/* The flower application's private structure */ +struct nfp_app_fw_flower { + /* Pointer to the PF vNIC */ + struct nfp_net_hw *pf_hw; +}; + +int nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev); +int nfp_secondary_init_app_fw_flower(struct nfp_cpp *cpp); + +#endif /* _NFP_FLOWER_H_ */ diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build index 810f02a..7ae3115 100644 --- a/drivers/net/nfp/meson.build +++ b/drivers/net/nfp/meson.build @@ -6,6 +6,7 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') reason = 'only supported on 64-bit Linux' endif sources = files( + 'flower/nfp_flower.c', 'nfpcore/nfp_cpp_pcie_ops.c', 'nfpcore/nfp_nsp.c', 'nfpcore/nfp_cppcore.c', diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 6af8481..cefe717 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -114,6 +114,7 @@ /* Firmware application ID's */ enum nfp_app_fw_id { NFP_APP_FW_CORE_NIC = 0x1, + NFP_APP_FW_FLOWER_NIC = 0x3, }; /* nfp_qcp_ptr - Read or Write Pointer of a queue */ diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c index 0922ea9..fb409b6 100644 --- a/drivers/net/nfp/nfp_cpp_bridge.c +++ b/drivers/net/nfp/nfp_cpp_bridge.c @@ -28,22 +28,85 @@ static int nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp); static int nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp); static int nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp *cpp); +static int nfp_cpp_bridge_service_func(void *args); -void nfp_register_cpp_service(struct nfp_cpp *cpp) +static struct rte_service_spec cpp_service = { + .name = "nfp_cpp_service", + .callback = nfp_cpp_bridge_service_func, +}; + +int +nfp_map_service(uint32_t service_id) { - uint32_t *cpp_service_id = NULL; - struct rte_service_spec service; + int32_t ret; + uint32_t slcore = 0; + int32_t slcore_count; + uint8_t service_count; + const char *service_name; + uint32_t slcore_array[RTE_MAX_LCORE]; + uint8_t min_service_count = UINT8_MAX; + + slcore_count = rte_service_lcore_list(slcore_array, RTE_MAX_LCORE); + if (slcore_count <= 0) { + PMD_INIT_LOG(DEBUG, "No service cores found"); + return -ENOENT; + } + + /* + * Find a service core with the least number of services already + * registered to it + */ + while (slcore_count--) { + service_count = rte_service_lcore_count_services(slcore_array[slcore_count]); + if (service_count < min_service_count) { + slcore = slcore_array[slcore_count]; + min_service_count = service_count; + } + } - memset(&service, 0, sizeof(struct rte_service_spec)); - snprintf(service.name, sizeof(service.name), "nfp_cpp_service"); - service.callback = nfp_cpp_bridge_service_func; - service.callback_userdata = (void *)cpp; + service_name = rte_service_get_name(service_id); + PMD_INIT_LOG(INFO, "Mapping service %s to core %u", service_name, slcore); + ret = rte_service_map_lcore_set(service_id, slcore, 1); + if (ret != 0) { + PMD_INIT_LOG(DEBUG, "Could not map flower service"); + return -ENOENT; + } - if (rte_service_component_register(&service, - cpp_service_id)) - RTE_LOG(WARNING, PMD, "NFP CPP bridge service register() failed"); + rte_service_runstate_set(service_id, 1); + rte_service_component_runstate_set(service_id, 1); + rte_service_lcore_start(slcore); + if (rte_service_may_be_active(slcore)) + RTE_LOG(INFO, PMD, "The service %s is running", service_name); else - RTE_LOG(DEBUG, PMD, "NFP CPP bridge service registered"); + RTE_LOG(INFO, PMD, "The service %s is not running", service_name); + + return 0; +} + +int nfp_enable_cpp_service(struct nfp_cpp *cpp) +{ + int ret = 0; + uint32_t id = 0; + + cpp_service.callback_userdata = (void *)cpp; + + /* Register the cpp service */ + ret = rte_service_component_register(&cpp_service, &id); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not register nfp cpp service"); + return -EINVAL; + } + + PMD_INIT_LOG(INFO, "NFP cpp service registered"); + + /* Map it to available service core*/ + ret = nfp_map_service(id); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not map nfp cpp service"); + return -EINVAL; + } + + return 0; } /* @@ -307,7 +370,7 @@ void nfp_register_cpp_service(struct nfp_cpp *cpp) * unaware of the CPP bridge performing the NFP kernel char driver for CPP * accesses. */ -int32_t +static int nfp_cpp_bridge_service_func(void *args) { struct sockaddr address; diff --git a/drivers/net/nfp/nfp_cpp_bridge.h b/drivers/net/nfp/nfp_cpp_bridge.h index aea5fdc..1e55033 100644 --- a/drivers/net/nfp/nfp_cpp_bridge.h +++ b/drivers/net/nfp/nfp_cpp_bridge.h @@ -16,6 +16,8 @@ #ifndef _NFP_CPP_BRIDGE_H_ #define _NFP_CPP_BRIDGE_H_ +#include "nfp_common.h" + #define NFP_CPP_MEMIO_BOUNDARY (1 << 20) #define NFP_BRIDGE_OP_READ 20 #define NFP_BRIDGE_OP_WRITE 30 @@ -24,8 +26,8 @@ #define NFP_IOCTL 'n' #define NFP_IOCTL_CPP_IDENTIFICATION _IOW(NFP_IOCTL, 0x8f, uint32_t) -void nfp_register_cpp_service(struct nfp_cpp *cpp); -int32_t nfp_cpp_bridge_service_func(void *args); +int nfp_map_service(uint32_t service_id); +int nfp_enable_cpp_service(struct nfp_cpp *cpp); #endif /* _NFP_CPP_BRIDGE_H_ */ /* diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 19b26cb..fea41b7 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -38,6 +38,8 @@ #include "nfp_ctrl.h" #include "nfp_cpp_bridge.h" +#include "flower/nfp_flower.h" + static int nfp_net_pf_read_mac(struct nfp_app_fw_nic *app_hw_nic, int port) { @@ -967,6 +969,14 @@ goto hwqueues_cleanup; } break; + case NFP_APP_FW_FLOWER_NIC: + PMD_INIT_LOG(INFO, "Initializing Flower"); + ret = nfp_init_app_fw_flower(pf_dev); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not initialize Flower!"); + goto hwqueues_cleanup; + } + break; default: PMD_INIT_LOG(ERR, "Unsupported Firmware loaded"); ret = -EINVAL; @@ -974,7 +984,9 @@ } /* register the CPP bridge service here for primary use */ - nfp_register_cpp_service(pf_dev->cpp); + ret = nfp_enable_cpp_service(pf_dev->cpp); + if (ret != 0) + PMD_INIT_LOG(WARNING, "Enable cpp service failed."); return 0; @@ -1098,6 +1110,14 @@ goto sym_tbl_cleanup; } break; + case NFP_APP_FW_FLOWER_NIC: + PMD_INIT_LOG(INFO, "Initializing Flower"); + ret = nfp_secondary_init_app_fw_flower(cpp); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not initialize Flower!"); + goto sym_tbl_cleanup; + } + break; default: PMD_INIT_LOG(ERR, "Unsupported Firmware loaded"); ret = -EINVAL; @@ -1108,7 +1128,11 @@ goto sym_tbl_cleanup; /* Register the CPP bridge service for the secondary too */ - nfp_register_cpp_service(cpp); + ret = nfp_enable_cpp_service(cpp); + if (ret != 0) { + PMD_INIT_LOG(WARNING, "Enable cpp service failed."); + ret = 0; + } sym_tbl_cleanup: free(sym_tbl); -- 1.8.3.1