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 C46174378F; Tue, 26 Dec 2023 03:39:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9B4A406B7; Tue, 26 Dec 2023 03:38:29 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2107.outbound.protection.outlook.com [40.107.94.107]) by mails.dpdk.org (Postfix) with ESMTP id 9FE60406B7 for ; Tue, 26 Dec 2023 03:38:27 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LgnEhuiS1hOwndROrNGl1xOAiJnN79mpWbTADxq1sayfLRLKKbfNmxHEJb6752TXx/m1J1SEJun4cVi07aH5rXQgQR/N8/c05aT4hZZ7bTuExOrzzmXGJGiNO3TGpMFoq5m+fScm3g1wGMtOqnhLH5i4kb5czU6awAym0D8WlIa1TjK+0oB+hHZneHTSQNqli3I4l2xejjYractJICUJ+kRD1KrirA2hS4+tH7JF+EKyRjpg4Llr90RL8LqV4lq+8G4QDWJOgxi7ESmKY9+MmK48AAND1gv70wklfOzaKQCWDF0+vSJ7PC8EdMru1e0cUQNG4xCtP2OuJZa4tdycNw== 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=f34MhI40T6bdE7Vmlvcw5B5/c82Hd5gyVNkoWJaf5i0=; b=V0OP+odwhqlKNz60U61+K8zhy9OHEGC4fco6ffM2j+8KOmiwJd8b9WI+w63J0r93e0kLBJaHaWqkuVKlsTGz/jPiRQslsLrdBfBppCNNCuODC1GJPdQhA3VHTi9LQuGymyXiDXjVX/5JBTek2Dyo0/ajWOv3RvYCRI84lUPCqQ/4L33104WBpAkUWCCTqXz5NVUyggVeb0L18E735xkcMpWX+DQO/jcDMO+gkHRFkThiJG+2yEHVXaoKVcG0VpvqQnNzmu/oOSqQA6BXhh+VBg6LrzgAawroAgb5NcihqfuFn46gBIQZSv/fTPGBIVX9Cl3dtucIaq/UuKzYBFf6fw== 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=f34MhI40T6bdE7Vmlvcw5B5/c82Hd5gyVNkoWJaf5i0=; b=Qr9uERpBFCQgrabAsPOZvldJxBSwiOnL3SieCx49uBulG+Wm7CtOMrvOPQ08Xx7PRWHhl/0CbqHyCFUMyFuxLxtIf3/bejc7bY014XG6IQYW7fEGMP9ztCIrZ8TYWBgr/e9oK9SYzgDtJao9cyfjUSuSgyFGzEtKzjt02P36hm0= 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 MW4PR13MB5864.namprd13.prod.outlook.com (2603:10b6:303:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Tue, 26 Dec 2023 02:38:24 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b%6]) with mapi id 15.20.7113.026; Tue, 26 Dec 2023 02:38:24 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Peng Zhang , Chaoyong He Subject: [PATCH v5 08/14] net/nfp: add bond firmware creation initialization Date: Tue, 26 Dec 2023 10:37:39 +0800 Message-Id: <20231226023745.3144143-9-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231226023745.3144143-1-chaoyong.he@corigine.com> References: <20231018074821.1908906-1-chaoyong.he@corigine.com> <20231226023745.3144143-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0156.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::36) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW4PR13MB5864:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c894392-3c0d-488f-728e-08dc05bbbba8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GlnUW1CP3fpUt3/axvdtteYiUaB9CNPpEGplJ6y5jqXwh4zw/OJE5h/LIRODxNmeL50uleDrGDsqrLCkOHg3gbj/nWHHCxIgnVIovVAVeMtjwohdioR2A/SjnJe9kDohT92kg8RUFrMUPFOFaMygkJN5r6OhVUrt6U+nqaCnAXbGF2GSXVcZyG4t866n4cyQqFigNGIGa/1aIEL4PZIG9v5+u+qIgC7aTK2dJbDOW3kkwYVdvjNwJHbZh4VvBFvrI2DWpi5/VqlzRkyhnAi4d2tky5dPGu4vFPsYkb0F/4lq0HLMtXOWs+0oRu5I9iwEwyXvu9Q37/bQtSlCA9gZCcYTEU7eY4KBhjmVB7eBs3WcjSYxu5kNHZKP5HzP+3qwG1rXXaH8kuUSA8gKgC9jP6IkH7PcjLO4J/1kDKXYAOoxu2duL0VwM0s+PDNIlbcwmmdqZFJbpZPe4LdzQaY0UlDpO5kRb9+J3CtmI+cCHG5C8+62bJYRqep6G7cVj1WXFYGooF3ATYO2/JlRdb0xTOozo2/kY0XQ0AxBh+I+ZWpFTKqv1YJB+APP0GnZ9DwZ043q4HZRVGz56ufzm47pdXhl8W2VS8Bnv8qTSKkWxvRI+H7j+GwzcXH+mFcfCjauJdBo9pK82x9+yMmVUDnrIShQmVRu6xYy4q2EGIifYrc= 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:(13230031)(39840400004)(376002)(396003)(366004)(136003)(346002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(38100700002)(26005)(107886003)(1076003)(316002)(4326008)(54906003)(8676002)(2906002)(5660300002)(44832011)(8936002)(478600001)(6512007)(6666004)(6506007)(52116002)(66476007)(66556008)(66946007)(6486002)(6916009)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0XnF4UmXDc/bS9pv026st5GjuElvk8Ptqp8o4/6Qlk1yw3FDUE7fPQEvsH+o?= =?us-ascii?Q?fV0QGg6QrWTGg6ji9hPjhuggtP55/e72mtGNky38DtMKUYjPiHpKSsAyT/UE?= =?us-ascii?Q?mGAYi/0yg84fRafo4cYyEXhQuC4bbfIIWwRFBZZHDFa+aca9+FLpQnfiy68b?= =?us-ascii?Q?fMMKlFmZ4I9EgyX+beFowsan4+WmLoL66JtQRxPMFUI9otbBedIjTM3Jx5eM?= =?us-ascii?Q?ZmghbAQb5l1P0OSNwe6vjVnZMfVyXeqfh7O5ZU3JxvAR3JWGmVrT04UdXdyl?= =?us-ascii?Q?zxAt+cAfBH9aDhajoJAGqIGULgfB1z8sBNMLZNOyj5pNh4PaPNuIcEygBQKX?= =?us-ascii?Q?t0O+N9wN1fnMc7VTZOCZFz42bZu+2xeE2CVQ3MSuBWTXvY6uCnmP2J9RgT18?= =?us-ascii?Q?ROKw50JRVIFn8Vzn2cSGlhlsnGUGc4cSdV2z52L5a1xC1A7+AxnEPX3hWPS4?= =?us-ascii?Q?qkbDTdKMS1N1Bsrj63gwK5F85YhRwhAu2tGDX16P3zw6/r5gyCWMqO7K2ZYw?= =?us-ascii?Q?9FDZm0d/mTsBsCADv430k0qa653qdI4jZkcVUEoupK3iYUUF/edctTRamE+q?= =?us-ascii?Q?4RtuWDaCyeybqnjEFKF6i/y/HD60XEDV6qjowKwpD8maEpuYYQzej3tj764d?= =?us-ascii?Q?HuHSIjC+erS/zJMmi5pVNBA99ex5QTXJp12ZzPTkGZVSgd/JMQTLmVRn64J4?= =?us-ascii?Q?D0U/L5XraXx8OMAi1Z0ZOA0PqmFuj26KF2kGnwk6kGyaHQ3cMqVa7u6LaehG?= =?us-ascii?Q?VzMDk4pU7r9yls00Bv78jJOZnhAqO7EoDKZluvGWhVLMh8jLdCBcSVrj3kpE?= =?us-ascii?Q?ZbJFQg1NRrmyZnWCCyw+Yz4DJAn43KCHjuabAmu6bVeShtBHGY025LiSxdzG?= =?us-ascii?Q?iGsLUml5qO3ycefie4f6SYnDYFkuIliRmHTeN32O81CIUcSLKdny0BEDuSR5?= =?us-ascii?Q?2h9roIDsVX+enfIDtCV12ou0Wl/Ka+gGs7qVx1ThtMc5TF8L68YYR1LTqVBi?= =?us-ascii?Q?oT9hCsxKxildbTSSbBBPm1rpkhokqCcf7Ewjm1ini8g+ZWL49A63wwO7ZaoS?= =?us-ascii?Q?WUVcK+mfsh02UyXduSE1UwYrCYmsVqfhIoL8RY4nAdoiCMOPXhxkycbgWxKv?= =?us-ascii?Q?3J/PAsONKkaTBuKmTtGDpr3Vp9vRgtU6MSiXnStziBD54ZDCIyt4K9PuEHfR?= =?us-ascii?Q?9w/XHCqnRFXRV5keXytvsTWs+YsCmYWdyvS6yBgdjAKmx1XJRmrabKP6iwSw?= =?us-ascii?Q?l6ZBnk+KY+ImYOUVweTJ6ICEXi3WP8guCbQV2m+fQFPffjwIjpZY69YYs+3r?= =?us-ascii?Q?woDrXq4NcmZPykT4wg0G/n+ZUxv0ZBuN1Ge97rOPs9V9XavGYvqPBb/3116M?= =?us-ascii?Q?LHvfCu7GZKW9ShPsXZrAZPNma8lRPdbbZhS/flF4WUDIxMXbSCEyHxHIjrbP?= =?us-ascii?Q?QXSBPuWxoIJKHnrQ95Pt7BgO/gjlnPizNq6rXjc31YYe4gZ9067FfPTP/s/w?= =?us-ascii?Q?b2G47F70QZWuwQFZ2igyfaJACqjJ0vUb5dfPU75pJbBKwLF+3HpGWOhnThSK?= =?us-ascii?Q?DZA1WtBk2QmPXLOUERHe7q53R021C7zYEk/Ginozflh7tF9FchgqQe+Y3uGe?= =?us-ascii?Q?sA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c894392-3c0d-488f-728e-08dc05bbbba8 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2023 02:38:24.8129 (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: Q2yEmfnPj1c+mI5oUduZdjxL5YGh/EBXBZzCycm3PArfveQcjHtp/leJnRfghpWt5sgSVJ6wh1yda75AxdX7XKK7+ZJ2Ps/s6Co7bWwWTmA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR13MB5864 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 From: Long Wu Firmware supports several features and bond firmware creation is one of the features. Driver notifies firmware that driver supports bond firmware creation feature by CPP bus write. If write successfully, initialize driver configuration. Signed-off-by: Long Wu Reviewed-by: Peng Zhang Reviewed-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower.c | 64 ++++++++++++++++++++++- drivers/net/nfp/flower/nfp_flower.h | 13 +++++ drivers/net/nfp/flower/nfp_flower_bond.c | 59 +++++++++++++++++++++ drivers/net/nfp/flower/nfp_flower_bond.h | 65 ++++++++++++++++++++++++ drivers/net/nfp/meson.build | 1 + 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 drivers/net/nfp/flower/nfp_flower_bond.c create mode 100644 drivers/net/nfp/flower/nfp_flower_bond.h diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 94b50611f0..195960e00d 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -16,6 +16,7 @@ #include "../nfp_cpp_bridge.h" #include "../nfp_logs.h" #include "../nfp_mtr.h" +#include "nfp_flower_bond.h" #include "nfp_flower_ctrl.h" #include "nfp_flower_representor.h" @@ -228,6 +229,42 @@ nfp_flower_init_vnic_common(struct nfp_net_hw *hw, return 0; } +static int +nfp_flower_bond_feature_init(struct nfp_app_fw_flower *app_fw_flower) +{ + int ret; + + /* Notify hardware that driver supports hardware creation of bonding port */ + ret = nfp_rtsym_write_le(app_fw_flower->pf_hw->pf_dev->sym_tbl, + "_abi_flower_balance_sync_enable", 1); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Enable bonding port hardware creation failed."); + return ret; + } + + ret = nfp_flower_bond_init(app_fw_flower); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Initialize bonding structure failed."); + return ret; + } + + app_fw_flower->flower_en_feats |= NFP_FL_ENABLE_BOND; + + return 0; +} + +static int +nfp_flower_sync_feature_bits(struct nfp_app_fw_flower *app_fw_flower) +{ + int ret; + + ret = nfp_flower_bond_feature_init(app_fw_flower); + if (ret != 0) + return ret; + + return 0; +} + static int nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw) { @@ -538,6 +575,20 @@ nfp_flower_cleanup_ctrl_vnic(struct nfp_net_hw *hw) rte_free(eth_dev); } +static void +nfp_flower_bond_feature_cleanup(struct nfp_app_fw_flower *app_fw_flower) +{ + nfp_flower_bond_cleanup(app_fw_flower); + app_fw_flower->flower_en_feats &= ~NFP_FL_ENABLE_BOND; +} + +static void +nfp_flower_sync_feature_cleanup(struct nfp_app_fw_flower *app_fw_flower) +{ + if (nfp_flower_support_bond_offload(app_fw_flower)) + nfp_flower_bond_feature_cleanup(app_fw_flower); +} + static int nfp_flower_start_ctrl_vnic(struct nfp_net_hw *net_hw) { @@ -768,22 +819,31 @@ nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev, goto ctrl_vnic_cleanup; } + /* Synchronize the features of driver and hardware */ + ret = nfp_flower_sync_feature_bits(app_fw_flower); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Sync feature bits failed"); + goto ctrl_vnic_cleanup; + } + /* Start up flower services */ ret = nfp_flower_enable_services(app_fw_flower); if (ret != 0) { PMD_INIT_LOG(ERR, "Could not enable flower services"); ret = -ESRCH; - goto ctrl_vnic_cleanup; + goto sync_feature_cleanup; } ret = nfp_flower_repr_create(app_fw_flower); if (ret != 0) { PMD_INIT_LOG(ERR, "Could not create representor ports"); - goto ctrl_vnic_cleanup; + goto sync_feature_cleanup; } return 0; +sync_feature_cleanup: + nfp_flower_sync_feature_cleanup(app_fw_flower); ctrl_vnic_cleanup: nfp_flower_cleanup_ctrl_vnic(app_fw_flower->ctrl_hw); ctrl_cpp_area_cleanup: diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index 8393de66c5..30443cd568 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -7,6 +7,7 @@ #define __NFP_FLOWER_H__ #include "../nfp_net_common.h" +#include "nfp_flower_bond.h" /* Extra features bitmap. */ #define NFP_FL_FEATS_GENEVE RTE_BIT64(0) @@ -61,6 +62,9 @@ struct nfp_app_fw_flower { /** Number of phyport representors */ uint8_t num_phyport_reprs; + /** Bitmap of features enabled by HW */ + uint8_t flower_en_feats; + /** Pointer to the PF vNIC */ struct nfp_net_hw *pf_hw; @@ -96,6 +100,9 @@ struct nfp_app_fw_flower { /** Function pointers for different NFD version */ struct nfp_flower_nfd_func nfd_func; + + /** Link bond data block */ + struct nfp_flower_bond *nfp_bond; }; static inline bool @@ -104,6 +111,12 @@ nfp_flower_support_decap_v2(const struct nfp_app_fw_flower *app_fw_flower) return app_fw_flower->ext_features & NFP_FL_FEATS_DECAP_V2; } +static inline bool +nfp_flower_support_bond_offload(const struct nfp_app_fw_flower *app_fw_flower) +{ + return app_fw_flower->flower_en_feats & NFP_FL_ENABLE_BOND; +} + int nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev, const struct nfp_dev_info *dev_info); void nfp_uninit_app_fw_flower(struct nfp_pf_dev *pf_dev); diff --git a/drivers/net/nfp/flower/nfp_flower_bond.c b/drivers/net/nfp/flower/nfp_flower_bond.c new file mode 100644 index 0000000000..bbd2818e68 --- /dev/null +++ b/drivers/net/nfp/flower/nfp_flower_bond.c @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2023 Corigine, Inc. + * All rights reserved. + */ +#include "nfp_flower_bond.h" + +#include + +#include "nfp_flower_representor.h" + +static void +nfp_flower_bond_increment_version(struct nfp_flower_bond *nfp_bond) +{ + /* LSB is not considered by firmware so add 2 for each increment. */ + nfp_bond->batch_ver += 2; + nfp_bond->batch_ver &= NFP_FL_BOND_VERSION_MASK; + + /* Zero is reserved by firmware. */ + if (nfp_bond->batch_ver == 0) + nfp_bond->batch_ver += 2; +} + +int +nfp_flower_bond_init(struct nfp_app_fw_flower *app_fw_flower) +{ + struct nfp_flower_bond *nfp_bond; + + app_fw_flower->nfp_bond = rte_zmalloc("nfp_bond", + sizeof(struct nfp_flower_bond), RTE_CACHE_LINE_SIZE); + if (app_fw_flower->nfp_bond == NULL) + return -ENOMEM; + + nfp_bond = app_fw_flower->nfp_bond; + pthread_mutex_init(&nfp_bond->mutex, NULL); + LIST_INIT(&nfp_bond->group_list); + nfp_flower_bond_increment_version(nfp_bond); + nfp_bond->app_fw_flower = app_fw_flower; + + return 0; +} + +void +nfp_flower_bond_cleanup(struct nfp_app_fw_flower *app_fw_flower) +{ + struct nfp_bond_group *entry; + struct nfp_flower_bond *nfp_bond = app_fw_flower->nfp_bond; + + pthread_mutex_lock(&nfp_bond->mutex); + LIST_FOREACH(entry, &nfp_bond->group_list, next) { + LIST_REMOVE(entry, next); + rte_free(entry); + } + pthread_mutex_unlock(&nfp_bond->mutex); + + pthread_mutex_destroy(&nfp_bond->mutex); + + rte_free(nfp_bond); + app_fw_flower->nfp_bond = NULL; +} diff --git a/drivers/net/nfp/flower/nfp_flower_bond.h b/drivers/net/nfp/flower/nfp_flower_bond.h new file mode 100644 index 0000000000..9612b2c6cf --- /dev/null +++ b/drivers/net/nfp/flower/nfp_flower_bond.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Corigine, Inc. + * All rights reserved. + */ + +#ifndef __NFP_FLOWER_BOND_H__ +#define __NFP_FLOWER_BOND_H__ + +#include +#include +#include + +/* The batch version of bond offload packets between firmware and driver */ +#define NFP_FL_BOND_VERSION_MASK 0x007fffff /* [0, 22] */ + +#define NFP_FL_ENABLE_BOND RTE_BIT32(1) + +/* ID 0 reserved and IDs 1 to 31 are valid */ +#define NFP_FL_BOND_GROUP_MIN 1 +#define NFP_FL_BOND_GROUP_MAX 32 + +/* List entry for each bond group */ +struct nfp_bond_group { + /** List entry */ + LIST_ENTRY(nfp_bond_group) next; + /** Marked if the group needs synced to HW */ + bool dirty; + /** Marked if the group is currently offloaded to NIC */ + bool offloaded; + /** Marked if the group should be removed from NIC */ + bool to_remove; + /** Marked if the group should be removed from driver */ + bool to_destroy; + /** Assigned group ID for host/kernel sync */ + uint32_t group_id; + /** Number of members in group */ + uint32_t member_cnt; + /** Group instance in case of ID reuse */ + uint32_t group_inst; + /** Group main Netdev */ + struct rte_eth_dev *main_dev; +}; + +/* Flower APP priv data for bond offload */ +struct nfp_flower_bond { + /** Marker to reset firmware bond config */ + bool rst_cfg; + /** List of all main/member groups offloaded */ + LIST_HEAD(, nfp_bond_group) group_list; + /** Lock to protect bond group_list */ + pthread_mutex_t mutex; + /** Incremented for each batch of config packets */ + uint32_t batch_ver; + /** Instance allocator for groups */ + uint32_t global_inst; + /** Incremented for each config packet sent */ + uint32_t pkt_num; + /** Pointer to the flower app */ + struct nfp_app_fw_flower *app_fw_flower; +}; + +int nfp_flower_bond_init(struct nfp_app_fw_flower *app_fw_flower); +void nfp_flower_bond_cleanup(struct nfp_app_fw_flower *app_fw_flower); + +#endif /* __NFP_FLOWER_BOND_H__ */ diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build index 46be6f60cd..f0d4bbcecb 100644 --- a/drivers/net/nfp/meson.build +++ b/drivers/net/nfp/meson.build @@ -13,6 +13,7 @@ sources = files( 'flower/nfp_flower_ctrl.c', 'flower/nfp_flower_flow.c', 'flower/nfp_flower_representor.c', + 'flower/nfp_flower_bond.c', 'nfd3/nfp_nfd3_dp.c', 'nfdk/nfp_nfdk_dp.c', 'nfpcore/nfp_cppcore.c', -- 2.39.1