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 22DBE4378F; Tue, 26 Dec 2023 03:39:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E888406FF; Tue, 26 Dec 2023 03:38:32 +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 C947F40697 for ; Tue, 26 Dec 2023 03:38:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Su6OzOHX6B7yzzHk4CrN+0uCDGAo97OOwPT8dZSDiYWdMAvzY7CTPuR0BL6i44ttfDIB/uVJcdTf+TXm6j4Oce96VtlmsaHu2g3WGp2jkDReY3LmFYeO1G7csNL3cMYIbvnnEpbITBcYE07CqzIvOHNlPw81WOTXczCl1vDqvMYQ1b1EvAxVC9xnsxwOOPPQdRYepPYoOLEEEgzpVlkbiA8lQEvEfv12pSANyOCWw364/t9zS0AqSV5HfIYfWw2ayLRSL0/518tof/ujRFhfMFjETH+VfAgu2wupWfDrrjStXAlB9QdnBr73c4m5HdjqnUa3QK2GAhrxnRbswBc9kQ== 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=6MtqN7T2XM1S75/NTQSKdzavGHZrDfet1zw0zu66vvw=; b=SZF358X2osAJVtMt7RVOMmf85OpSODiS/2ahlPam9ZzKEwVbIiVpOaow1ro+Oy8rmRFwXHYAggyCsGwrDkmvtGQmCYNW3UKaUUl0N5+Ycl1GBIpp2BfjW6b5hUsSuXjt5xldFQ2kS4B01XZ/cpu/kqvYtvfwStoNviLpqodyMr+PqnADFsHgRsWyy/d40jbszi7X9fV3G63lQCHTME+6Vi6zzQgofUPhIYTyEsOFD4YMqF4uLKL5D65efD50Q1xRPAtHX4pZV1qGRoWTNvyvjecVdXCHexwdKNe9sVTBGnNhez0RpckHMRrv24txAyu95mu1xtJjioTngTuYuNFnxQ== 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=6MtqN7T2XM1S75/NTQSKdzavGHZrDfet1zw0zu66vvw=; b=PcTlVkVRZ0L4lZ+peqCaYSZ9xsR6m1jqdCBeSR73grCx3wlwUCmlMy7YKvPUTIw+DaKr2k3BZQRjwNBfN5XKjUi3iUq9lVIadHbTbCLMXzsuQbNxbiU4A7ToFtSwRYJenXzWvmUmSluTjMLUyyONyZGdPundnq7m66l+zJQ3WWM= 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:27 +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:27 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Peng Zhang , Chaoyong He Subject: [PATCH v5 09/14] net/nfp: reset bond configuration of firmware Date: Tue, 26 Dec 2023 10:37:40 +0800 Message-Id: <20231226023745.3144143-10-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: 57706c3f-26ca-4651-6317-08dc05bbbcfd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tlxnQglOSptI2CD58NO1+unKj7Plw67a3+SzQtPK+WSmMqJvq2fBye8MgmFkyhoi3EhuMmRNqOo87JqEm/TvZZu+etfvcY/tGDgBpnT+7KxoRo69olkCmeYz47g0MhTIFEwGno1X74aodDJGTNpTuMOset5ZXOL06mo/vJCPCzseUO64CnK9+axdJu+/xJm4kOnduT/wklZNYD838w0dQjmyk1XggxC11SPS1Y3IC+WvZbBuHYPw0AN1Sy/PBHHUb1iRSLRLtIzG7OhCo0GrwEhrXVjkJp/tCGbkEz2tDUfBmjH3ZT9BQVTvBa0Tq8wVLO3EWcxnHK+D+R0pJDKtLKyhvdGCD+F2OR8f2jyUITgE+kbyDl4RkQOH12KGXRjMZ1SsySFW2SGRFPAiDfV1tQJ77XOPSIHs57IizdvohxDTlxtpWdFWwZCJFk+THZcFdyGc6CUp6nxt3brFgxLY1VqYu/P4vGOAdXFY1jpqQ5txpcWFK7B4H5nFjBAZ5I5qIBXelS0eHYdIGx4tFxqX9ZM3HUaKgdXFFKMQj5R/ln19jf//YFtf8IQId4NHRKVJt8e0zykNtrb9sYgj2EOWb9zPGx4xp1om+qTmuPrBSw2wiXZExDUFBj58/j2jnusLk7bkntLkKEH3bK98rH8qYrWeu5frptJ335G0tVc6XuE= 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?g+wdEF504fKWzHS75eUM/GZ6F3GQGhqqCUTK4O7x/TJaP7R7Ct/gr1CKRHmt?= =?us-ascii?Q?QtBIRDyse7E0temYXpj63yEe6zKjCVPfBOwwAcv8+6wip2baBTfYpQCzXXn7?= =?us-ascii?Q?eHD2s4maVI67AyUGRJ1YnAtm5QfXGPLtvPsTJ/DIa9LCUMnGPIGcYwgzddzG?= =?us-ascii?Q?hX3tDWrvqyT/jubgmgjv9iuQSGjKtnim7m9saR75BW9OQwh1xNYATv2ezsP3?= =?us-ascii?Q?FsyJlpOjuoc0WAOFdy/JliQNbzC4TfOwB+6nhXl9ax615xNZm11RsQ8XyP3I?= =?us-ascii?Q?zsF3f/Hw1UhhWNHiE+khr085xS9oZJbzbMePDWWulKCoi+09dVgboJqltOgV?= =?us-ascii?Q?a64R5Y43bLhm9c3cm4KSag9lri6kwlwZu5VktCaPSuelOrX/4QaBfhfOskIg?= =?us-ascii?Q?v8CUL99yTKJnrkS4SB5pvTBLgBLCD0vKadAfWyF0dnlnJfJVjTRGmS5m09nb?= =?us-ascii?Q?9glawn9id7Gp3AfZk9FceC5r3elMpxe3YuaRIMcQr8yQB+e1EfTkGjlsYTce?= =?us-ascii?Q?juoO/ktXdhXC5gmAoyJKpTfApOlYXK/y1x1Qq2MrEACoFd2iBMD9hzKYuiBA?= =?us-ascii?Q?URxKLjYr2Movc9rJ2aY2JNYXfvObncdIGSrp30pgagAFQShaNzjCflqXVWKs?= =?us-ascii?Q?nS8IX2VkMNuZpS/ifxFw4biuC6Em1WX6yg8PIwWH9xw9CmRWs2VP/TZ7Ggyv?= =?us-ascii?Q?0EUHC+rZ7dKfk0bCOjdzruKTrAp5ekVFhhr2gwmv1M08IIfJnbszIpPpI1e0?= =?us-ascii?Q?vXTsZYD2wjbQBNAK7oofHQqzyg/VzkQOHHBWtvd8hhLGYFqmXmeGw+OdD2mC?= =?us-ascii?Q?yFQjBOzBRO/6YXoBzX+Pk1rmN1HokouahGXKx8sosfPbwZY7bnDB0h8E4mOE?= =?us-ascii?Q?ztHf6QISBd4CmLEqOmx88r1dWj9G9bgpguQaCxR/ln5zeGGutFcg/gti6qzg?= =?us-ascii?Q?VsS9l5YDLz3SL4/oXJ41vLrmCf7snx3yj0Ajx9jULhbxC2PUy0lj0ZwAe+Ky?= =?us-ascii?Q?2ubqv6f8/kzubwz+ZsGR3StSPmp96tcTIW1ha2hXiEg92DtzVGAgiZviIib4?= =?us-ascii?Q?adJ/KC3VNxw6P8EjRW5CSqpPMnntGFm9AKCD0oQ/SuBlsAsdfLDWqPDBWrUg?= =?us-ascii?Q?wiksvq1ZUs8z0wrHPFcqAuxHSnOSPj9j3B55JSBNzhSgjdORGXFgPK2ebQAM?= =?us-ascii?Q?Nk5pwtRLRQEBFd11PZUkTN0oWyoDZe6icE8Nc6hrhIIeoMRvM1oKqsp3+Wxy?= =?us-ascii?Q?VTVngAnuWTTsgFzRuh7PuB9IcCPlpijmLnX6msueq4NW3UFLFDSq2ynIwUsG?= =?us-ascii?Q?RheIteiTe7SYpYubH5uE4RUFHjxvTuygiB29XyrhTWwHU7LtvlUiRLgcBPtf?= =?us-ascii?Q?CJB/kUPWqukBycE3tdWcwCVdevEEVoaVpCP+wduHj2enSXbtibhrIn5D2NC5?= =?us-ascii?Q?jrZDnUvTlBM+q2Qxy6Fb30ggf0nw42djevT5aIsNqOjTJadZ7sLdjTMRSV9i?= =?us-ascii?Q?nkNMKbzcFTnhAMDHRb5sozGzpYtZQMaX3ha3p48l9e1b/cVGAYj11+/9e2q4?= =?us-ascii?Q?3dHtSEW02+UiBAgEQnva8R6pK+JZfapaaVrqnZ1Uc/qryAFwT1ns4nVDxjTQ?= =?us-ascii?Q?KA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57706c3f-26ca-4651-6317-08dc05bbbcfd 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:27.0471 (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: KtNuZvntXe6ENSmy4c/YWYShuQoEWsNfNt2wVcJqNgo6mHxlE9I6WgKXoaplOahAY0wuyihVt+QOXaAveiwBzA/C+i/nEH3zfC2T0D2eN/A= 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 Driver sends control message to reset the bond firmware configuration in flower NIC initialization. Firmware should reset bond configuration to avoid strange problems caused by residues. Signed-off-by: Long Wu Reviewed-by: Peng Zhang Reviewed-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower.c | 23 ++++++ drivers/net/nfp/flower/nfp_flower_bond.c | 90 ++++++++++++++++++++++++ drivers/net/nfp/flower/nfp_flower_bond.h | 54 ++++++++++++++ drivers/net/nfp/flower/nfp_flower_cmsg.c | 35 +++++++++ drivers/net/nfp/flower/nfp_flower_cmsg.h | 3 + 5 files changed, 205 insertions(+) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 195960e00d..fc3ea84828 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -589,6 +589,22 @@ nfp_flower_sync_feature_cleanup(struct nfp_app_fw_flower *app_fw_flower) nfp_flower_bond_feature_cleanup(app_fw_flower); } +static int +nfp_flower_start_features(struct nfp_app_fw_flower *app_flower) +{ + int ret; + + if (nfp_flower_support_bond_offload(app_flower)) { + ret = nfp_flower_bond_reset(app_flower->nfp_bond); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Reset bond feature failed"); + return ret; + } + } + + return 0; +} + static int nfp_flower_start_ctrl_vnic(struct nfp_net_hw *net_hw) { @@ -826,6 +842,13 @@ nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev, goto ctrl_vnic_cleanup; } + /* Start up some features */ + ret = nfp_flower_start_features(app_fw_flower); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to start features"); + goto sync_feature_cleanup; + } + /* Start up flower services */ ret = nfp_flower_enable_services(app_fw_flower); if (ret != 0) { diff --git a/drivers/net/nfp/flower/nfp_flower_bond.c b/drivers/net/nfp/flower/nfp_flower_bond.c index bbd2818e68..4ac27f117c 100644 --- a/drivers/net/nfp/flower/nfp_flower_bond.c +++ b/drivers/net/nfp/flower/nfp_flower_bond.c @@ -6,8 +6,31 @@ #include +#include "nfp_flower_cmsg.h" #include "nfp_flower_representor.h" +static void +nfp_fl_bond_cmsg_args_init(struct nfp_flower_bond_cmsg_args *cmsg_args, + struct nfp_bond_group *group, + struct rte_eth_dev **active_members, + uint32_t member_cnt, + enum nfp_flower_bond_batch batch) +{ + cmsg_args->group = group; + cmsg_args->active_members = active_members; + cmsg_args->member_cnt = member_cnt; + cmsg_args->batch = batch; +} + +static uint32_t +nfp_fl_get_next_pkt_number(struct nfp_flower_bond *nfp_bond) +{ + nfp_bond->pkt_num++; + nfp_bond->pkt_num &= NFP_FL_BOND_PKT_NUMBER_MASK; + + return nfp_bond->pkt_num; +} + static void nfp_flower_bond_increment_version(struct nfp_flower_bond *nfp_bond) { @@ -57,3 +80,70 @@ nfp_flower_bond_cleanup(struct nfp_app_fw_flower *app_fw_flower) rte_free(nfp_bond); app_fw_flower->nfp_bond = NULL; } + +int +nfp_flower_bond_reset(struct nfp_flower_bond *nfp_bond) +{ + struct nfp_app_fw_flower *app_flower; + enum nfp_flower_bond_batch batch = NFP_FLOWER_BOND_BATCH_FIRST; + struct nfp_flower_bond_cmsg_args init_args; + + app_flower = nfp_bond->app_fw_flower; + app_flower->nfp_bond->rst_cfg = true; + + nfp_fl_bond_cmsg_args_init(&init_args, NULL, NULL, 0, batch); + + return nfp_flower_cmsg_bond_config_group(app_flower, &init_args, &batch); +} + +enum nfp_flower_bond_batch +nfp_flower_bond_cmsg_payload(struct nfp_flower_bond *nfp_bond, + struct nfp_flower_cmsg_bond_config *msg, + struct nfp_flower_bond_cmsg_args *init_args) +{ + uint32_t i; + uint8_t flags = 0; + struct nfp_flower_representor *repr; + enum nfp_flower_bond_batch batch = init_args->batch; + + /* Increment batch version for each new batch of config messages. */ + if (batch == NFP_FLOWER_BOND_BATCH_FIRST) { + flags |= NFP_FL_BOND_FIRST; + nfp_flower_bond_increment_version(nfp_bond); + batch = NFP_FLOWER_BOND_BATCH_MEMBER; + } + + /* If it is a reset msg then it is also the end of the batch. */ + if (nfp_bond->rst_cfg) { + flags |= NFP_FL_BOND_RESET; + batch = NFP_FLOWER_BOND_BATCH_FINISHED; + } + + /* + * To signal the end of a batch, both the switch and last flags are set + * and the reserved SYNC group ID is used. + */ + if (batch == NFP_FLOWER_BOND_BATCH_FINISHED) { + flags |= NFP_FL_BOND_SWITCH | NFP_FL_BOND_LAST; + nfp_bond->rst_cfg = false; + msg->group_id = rte_cpu_to_be_32(NFP_FL_BOND_SYNC_ID); + msg->group_inst = 0; + } else { + msg->group_id = rte_cpu_to_be_32(init_args->group->group_id); + msg->group_inst = rte_cpu_to_be_32(init_args->group->group_inst); + } + + msg->reserved[0] = 0; + msg->reserved[1] = 0; + msg->ttl = NFP_FL_BOND_HOST_TTL; + msg->ctrl_flags = flags; + msg->batch_ver = rte_cpu_to_be_32(nfp_bond->batch_ver); + msg->pkt_number = rte_cpu_to_be_32(nfp_fl_get_next_pkt_number(nfp_bond)); + + for (i = 0; i < init_args->member_cnt; i++) { + repr = init_args->active_members[i]->data->dev_private; + msg->members[i] = rte_cpu_to_be_32(repr->port_id); + } + + return batch; +} diff --git a/drivers/net/nfp/flower/nfp_flower_bond.h b/drivers/net/nfp/flower/nfp_flower_bond.h index 9612b2c6cf..bb7ba8a1ad 100644 --- a/drivers/net/nfp/flower/nfp_flower_bond.h +++ b/drivers/net/nfp/flower/nfp_flower_bond.h @@ -6,6 +6,7 @@ #ifndef __NFP_FLOWER_BOND_H__ #define __NFP_FLOWER_BOND_H__ +#include #include #include #include @@ -13,12 +14,54 @@ /* The batch version of bond offload packets between firmware and driver */ #define NFP_FL_BOND_VERSION_MASK 0x007fffff /* [0, 22] */ +#define NFP_FL_BOND_PKT_NUMBER_MASK 0x7fffffff /* [0, 30] */ + #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 +#define NFP_FL_BOND_HOST_TTL 0xff + +/* Use this ID with zero members to ack a batch config */ +#define NFP_FL_BOND_SYNC_ID 0 + +/* BOND group config flags */ +#define NFP_FL_BOND_LAST RTE_BIT32(1) +#define NFP_FL_BOND_FIRST RTE_BIT32(2) +#define NFP_FL_BOND_DATA RTE_BIT32(3) +#define NFP_FL_BOND_XON RTE_BIT32(4) +#define NFP_FL_BOND_SYNC RTE_BIT32(5) +#define NFP_FL_BOND_SWITCH RTE_BIT32(6) +#define NFP_FL_BOND_RESET RTE_BIT32(7) + +enum nfp_flower_bond_batch { + NFP_FLOWER_BOND_BATCH_FIRST, + NFP_FLOWER_BOND_BATCH_MEMBER, + NFP_FLOWER_BOND_BATCH_FINISHED +}; + +/* Control message payload for bond config */ +struct nfp_flower_cmsg_bond_config { + /** Configuration flags */ + uint8_t ctrl_flags; + /** Reserved for future use */ + uint8_t reserved[2]; + /** Time to live of packet - host always sets to 0xff */ + uint8_t ttl; + /** Config message packet number - increment for each message */ + rte_be32_t pkt_number; + /** Batch version of messages - increment for each batch of messages */ + rte_be32_t batch_ver; + /** Group ID applicable */ + rte_be32_t group_id; + /** Group instance number - increment when group is reused */ + rte_be32_t group_inst; + /** Array of 32-bit words listing all active group members */ + rte_be32_t members[]; +}; + /* List entry for each bond group */ struct nfp_bond_group { /** List entry */ @@ -59,7 +102,18 @@ struct nfp_flower_bond { struct nfp_app_fw_flower *app_fw_flower; }; +struct nfp_flower_bond_cmsg_args { + struct nfp_bond_group *group; + struct rte_eth_dev **active_members; + uint32_t member_cnt; + enum nfp_flower_bond_batch batch; +}; + 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); +int nfp_flower_bond_reset(struct nfp_flower_bond *nfp_bond); +enum nfp_flower_bond_batch nfp_flower_bond_cmsg_payload(struct nfp_flower_bond *nfp_bond, + struct nfp_flower_cmsg_bond_config *msg, + struct nfp_flower_bond_cmsg_args *init_args); #endif /* __NFP_FLOWER_BOND_H__ */ diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c index 8effe9474d..0cf1bf2281 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c @@ -567,3 +567,38 @@ nfp_flower_cmsg_qos_stats(struct nfp_app_fw_flower *app_fw_flower, return 0; } + +int +nfp_flower_cmsg_bond_config_group(struct nfp_app_fw_flower *app_flower, + struct nfp_flower_bond_cmsg_args *init_args, + enum nfp_flower_bond_batch *batch_out) +{ + uint16_t cnt; + uint32_t size; + struct rte_mbuf *mbuf; + struct nfp_flower_bond *nfp_bond; + struct nfp_flower_cmsg_bond_config *msg; + + mbuf = rte_pktmbuf_alloc(app_flower->ctrl_pktmbuf_pool); + if (mbuf == NULL) { + PMD_DRV_LOG(DEBUG, "Alloc mbuf for bond config failed"); + return -ENOMEM; + } + + size = sizeof(*msg) + sizeof(rte_be32_t) * init_args->member_cnt; + msg = nfp_flower_cmsg_init(app_flower, mbuf, + NFP_FLOWER_CMSG_TYPE_LAG_CONFIG, size); + + nfp_bond = app_flower->nfp_bond; + + *batch_out = nfp_flower_bond_cmsg_payload(nfp_bond, msg, init_args); + + cnt = nfp_flower_ctrl_vnic_xmit(app_flower, mbuf); + if (cnt == 0) { + PMD_DRV_LOG(ERR, "Send cmsg through ctrl vnic failed."); + rte_pktmbuf_free(mbuf); + return -EIO; + } + + return 0; +} diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 45543816ae..60ab58a3b1 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -988,5 +988,8 @@ int nfp_flower_cmsg_qos_delete(struct nfp_app_fw_flower *app_fw_flower, struct nfp_profile_conf *conf); int nfp_flower_cmsg_qos_stats(struct nfp_app_fw_flower *app_fw_flower, struct nfp_cfg_head *head); +int nfp_flower_cmsg_bond_config_group(struct nfp_app_fw_flower *app_flower, + struct nfp_flower_bond_cmsg_args *init_args, + enum nfp_flower_bond_batch *batch_out); #endif /* __NFP_CMSG_H__ */ -- 2.39.1