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 19E7BA00C5; Thu, 15 Sep 2022 12:45:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC5134281B; Thu, 15 Sep 2022 12:45:01 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2139.outbound.protection.outlook.com [40.107.220.139]) by mails.dpdk.org (Postfix) with ESMTP id 5C3104281E for ; Thu, 15 Sep 2022 12:45:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbhlQS2Gt7lEiobhL7UaXABQYsvbScHXv9iNYfnWvKWjtSfcIfZUCyJrEeuR5t6LkjIOXMnZ05g+0fs+osFNItdtZU0TXSXcfndnQekmIIIPV03BmiEQ42oj2ICA+80BOuDbm0dPHYWrY2a57F6jMIWEobSGEzJEPUIig4qnmD75x9i01TH81A+8UhqhkW380rdg6leLEYvgue+HhR7dlGjJ5YYJiK3oB0Ue3KEwCAuQSnv+EweRUN43nGGtluPyDWxJZHiBE9cGwQAzpjoTH8D1j8Qyio5Qa17kdUP1qZ8HluDoJXxfZj9VELIx3gWiHjaPKUCYCjjdiGSG5Aw5+g== 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=bEvwA9VkEl2s15rJh3+YoW47PzX16s0/HEQeWcsq4ME=; b=JK/7TE2MYYUtzT02hAQ+Hk5viD68cEIKD+N6jInBI7z5V7Voyw1k5A6b4+0cjKyY16uN6+dqh7yz2O8lcEeQjyQRVg7BSdRgdrpK23lqH/qZ+ua94V/tDJ6tx/3VoVhejQgMA+1j9u28n6lVFj4bYmTGPy1+lmni2Ec1W/yA87jqo2AcQtXg45ohT1UX5k141E4r0zO0Ei1ehxuZTuY4LG5kQk+t6i9ahrkVH/PVyJkAx5UAXc2n2We6Smvu15EK352G8GNe6OYpEb2A6CBNvjIInmGTrhv6xO5g8XlvtsqxlVqLE/if5DCahqc1qEuvKF5EMPbkJI2cC7Jv7GWITQ== 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=bEvwA9VkEl2s15rJh3+YoW47PzX16s0/HEQeWcsq4ME=; b=hUeeIJedAaIBSfBs5/x98ngabk1o/4+pEk0ljFL5kvwVhUwxnOrR3/Gj0/rZg6KyCb5JHtBHPt8ftIHbMvPWOR+O+81FJNuAbeSUW+KVYVDwlMIM9lIY15ereIXUMWO3gCgvi1xHVsYeU5R1ZOBmjXqjZGmlKHhQxSAzJ6TAzvI= 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 SA0PR13MB4158.namprd13.prod.outlook.com (2603:10b6:806:9b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.5; Thu, 15 Sep 2022 10:44:58 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::819:38c:6513:bf15]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::819:38c:6513:bf15%4]) with mapi id 15.20.5632.012; Thu, 15 Sep 2022 10:44:58 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v9 04/12] net/nfp: add initial flower firmware support Date: Thu, 15 Sep 2022 18:44:21 +0800 Message-Id: <1663238669-12244-5-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663238669-12244-1-git-send-email-chaoyong.he@corigine.com> References: <1663238669-12244-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR11CA0071.namprd11.prod.outlook.com (2603:10b6:a03:80::48) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA0PR13MB4158:EE_ X-MS-Office365-Filtering-Correlation-Id: 91d277f9-1043-4b76-5bfa-08da97075582 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qcSCefwD/4mo44zncN8YZkAISBkNz0LOcdL2CY2fDgTyAVyxtHpLgATeU9GYjeywiyrsEud8/3sM37m6LIvpucyH/JgcPtmZWjUGiGcwrFRBFXVuFwDbQ76R0r2poJERp73FVUlhE9U9UKP53Onc/Q24dAQFYM0Nn1Y/nUNZPL0S2D4/BtkZq6qXNynTphUun9mcttwy/FI7m7CZ2C+A+igtlFy850cowCgPXgMhCW1MALr4rZFBLqY1ZPR9JqOOzeut3s+fFS1IK0MyUydXC5q59k/+Jpxr7/PwH/2kG9Fnk3KURka8y9osYi7wkfeX6Cns7hMRz8ue06aKPeUxmaokv2Yct7tZAm7dFStsRhsM4bjG/uHstqODz2gEpKtLPPiTigx31XCNeynLxa2yQ6kdssOh6qqYH8DHl4x+y5gAgu47KJVmc2uzZSl0nxmwLKIMuNHZ/61S8YEk35jqiJBtz7Bx20CMSjf9u33N4TI0CWc8NsJ53DLJqc2/3o6HnX1znliW7MLGUOvIdIaUghXHQQkSLGr9u7uh+l7uSYZ/KBhTDhhcTymu5yGVCzBaz0Uxiwatr5TRa1wjTKlYmhVTlMLuk0ukZQBBiy1W/ZnNUYKl/tKl4qV157k6DJlWzTwz5ZuAxYvwWD74Ku6EDhxryTgj3isiifqVzZRwKbnzlZ/iqFTXDf0VjIR2UqYGeMdaiXLEYYqVKarv+QxgkxHJPkirPRSZYocIAgVlZ8+u6YPZ9NWnQxxodW2lwyjzrrVmQqO+OA2tGZPgjuhnZA== 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:(13230022)(4636009)(396003)(346002)(366004)(376002)(39840400004)(136003)(451199015)(2616005)(66574015)(38350700002)(38100700002)(186003)(86362001)(83380400001)(107886003)(8676002)(66946007)(66476007)(4326008)(66556008)(44832011)(8936002)(41300700001)(2906002)(5660300002)(6506007)(478600001)(6666004)(316002)(30864003)(6512007)(26005)(6486002)(52116002)(54906003)(6916009)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bTgxK2w5STZjWnAvb2JleHk5WWwzdG5hQTFyQlN5bDVBWWJWSTMvN3lKdlBi?= =?utf-8?B?Tmp4K21nV1VtS04yajFrWjZyQ1lxVmh5Q09UUE1KUEZ0dmd2MzNDNXFvbjQ3?= =?utf-8?B?WlpzRnJPZktWeDJCWUR2RjcrMzN5UnM1TmREaGZRREt2aFZOSlNEZG82ajhC?= =?utf-8?B?SmU5NnJxdDVVbThBWGpUbjBnbWFUbXRMVFl2YUEzTk1QcVhmczFzL3JJMVdE?= =?utf-8?B?ME9lYVdzL0taM3hLdDMyc0NPUWI5LzFtakRQdnlkSVl3SUFjOGhEU0V2dUMr?= =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CUXBuejBoQm9LbEZOejRsU2o3QjZHa3RS?= =?utf-8?B?aHRaYmdaQXptSUQ3NHBESFp1SDJrK05YM0NLeU01cVlYMW1MWXd6a25ONmxl?= =?utf-8?B?Zmc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB4158 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 application. 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/nics/nfp.rst | 13 +++++ doc/guides/rel_notes/release_22_11.rst | 7 +++ drivers/net/nfp/flower/nfp_flower.c | 45 +++++++++++++++++ drivers/net/nfp/flower/nfp_flower.h | 16 +++++++ drivers/net/nfp/meson.build | 1 + drivers/net/nfp/nfp_common.h | 1 + drivers/net/nfp/nfp_cpp_bridge.c | 88 +++++++++++++++++++++++++++++----- drivers/net/nfp/nfp_cpp_bridge.h | 6 ++- drivers/net/nfp/nfp_ethdev.c | 31 +++++++++++- 9 files changed, 192 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/nics/nfp.rst b/doc/guides/nics/nfp.rst index 55539ac..4faab39 100644 --- a/doc/guides/nics/nfp.rst +++ b/doc/guides/nics/nfp.rst @@ -181,3 +181,16 @@ System configuration -k option shows the device driver, if any, that devices are bound to. Depending on the modules loaded at this point the new PCI devices may be bound to nfp_netvf driver. + + +Flow offload +------------ + +Use the flower firmware application, some type of Netronome's SmartNICs can +offload the flow into cards. + +The flower firmware application requires the PMD running two services: + + * PF vNIC service: handling the feedback traffic. + * ctrl vNIC service: communicate between PMD and firmware through + control message. diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index f601617..6a666aa 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -55,6 +55,13 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated Netronome nfp driver.** + + Add the needed data structures and logics to support the offload of rte_flow: + + * 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..87cb922 --- /dev/null +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Corigine, Inc. + * All rights reserved. + */ + +#include +#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) +{ + unsigned int numa_node; + 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) { + PMD_INIT_LOG(ERR, "Could not malloc app fw flower"); + return -ENOMEM; + } + + pf_dev->app_fw_priv = app_fw_flower; + + return 0; +} + +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..8b9ef95 --- /dev/null +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -0,0 +1,16 @@ +/* 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 { +}; + +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..155628d 100644 --- a/drivers/net/nfp/nfp_cpp_bridge.c +++ b/drivers/net/nfp/nfp_cpp_bridge.c @@ -28,22 +28,86 @@ 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) +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; + } + } + + service_name = rte_service_get_name(service_id); + PMD_INIT_LOG(INFO, "Mapping service %s to core %u", service_name, slcore); - 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; + 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)) + PMD_INIT_LOG(INFO, "The service %s is running", service_name); else - RTE_LOG(DEBUG, PMD, "NFP CPP bridge service registered"); + PMD_INIT_LOG(ERR, "The service %s is not running", service_name); + + return 0; +} + +int +nfp_enable_cpp_service(struct nfp_cpp *cpp) +{ + int ret; + uint32_t service_id = 0; + struct rte_service_spec cpp_service = { + .name = "nfp_cpp_service", + .callback = nfp_cpp_bridge_service_func, + }; + + cpp_service.callback_userdata = (void *)cpp; + + /* Register the cpp service */ + ret = rte_service_component_register(&cpp_service, &service_id); + if (ret != 0) { + PMD_INIT_LOG(WARNING, "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(service_id); + if (ret != 0) { + PMD_INIT_LOG(DEBUG, "Could not map nfp cpp service"); + return -EINVAL; + } + + return 0; } /* @@ -307,7 +371,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..7fee3a9 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_enable_cpp_service(struct nfp_cpp *cpp); +int nfp_map_service(uint32_t service_id); #endif /* _NFP_CPP_BRIDGE_H_ */ /* diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 0d09a69..ddfe495 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_fw_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,12 @@ } /* 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(ERR, "Enable cpp service failed."); + ret = -EINVAL; + goto hwqueues_cleanup; + } return 0; @@ -1098,6 +1113,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; @@ -1105,7 +1128,11 @@ } /* 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(ERR, "Enable cpp service failed."); + ret = -EINVAL; + } sym_tbl_cleanup: free(sym_tbl); -- 1.8.3.1