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 E8A9843795; Tue, 26 Dec 2023 08:29:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E3FC406BA; Tue, 26 Dec 2023 08:29:05 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2096.outbound.protection.outlook.com [40.107.212.96]) by mails.dpdk.org (Postfix) with ESMTP id 3A622402D8 for ; Tue, 26 Dec 2023 08:29:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mcn/aAFgRHRcMo+arqOwqi0Ua8MTcQySOmzsMCbDjyY4pwu+Tsz2r4OxU5xvOB/XE8Q/B+SVrHJ9QAW8/cr/mEhNpttLqGf444pCwWXzgsxYUcxjUnBSUEbstf1sTjer6N+mv0fHKLZ9/U2Xocaz+7II5BVXfwMttDH8dreyVQG4p5S/bgyBBhAh6bNUtXho9bc+VpAiji0164d1KjGhCC7e+cq0hHeoEeZ/kjqGLDY+WT6CfJ9K3A+uk/AMlrdCreMNSyX5M2b3fXcr6URYNHubueXF9hZfgMJsfZaKy5Mg7Q/ERaiSQUeSJovwzYat85LKIqp6pmgy2LsJ9ugCtA== 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=GsQm6C8L2kSY1k5odiGIKzT3UhOuRLGhZUYRJmXtpE4=; b=V7WQCHHqHUt5UxQXxVOvmnXEvPXusOCsP4Z9LMu8C9mGUsuqXGHnU26/YbGcLi0lDaIviRtXqM5zGZkz0BFNU/BOzgggGVNTtQeSQBpSY0aUa9+RW4HOY7/8Z5PFHU6BToM0X2Sampqu8oQbDUZW5eh3cG81Qy+nfgp/6VMWPYx49Ec2wJHWZYZY41GiO2qFHdJFco97cxT4yijvhurNvDJxXWkOrTHU2Q0IrED6dkLgl0THfP6ZZ54weUJQmm0okh55I6YuL2R8Xnw+dCDu7pIc3cBqpUgkAJVjn2T/MkyseRQcFsN7PLDNHRC4qRcZuvFL/RAB/UywJFESSZulTA== 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=GsQm6C8L2kSY1k5odiGIKzT3UhOuRLGhZUYRJmXtpE4=; b=lJAp9Jsrb+Wz2F6k8fyBrd+I4XyBz6aAE/baE7PWpFvn8c8e5GhIyXZrDpKs/t1J8glLLBS7lSehpMbKDFShL1PF5FRrHbTDnV1oAWgFhs6yJWIuKHGvOh3PZkMZeRp1hqaMwLhn0nOQ0lSs7Lc4aa+qRfeyiCWYu5WceUlKK2I= 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 CH3PR13MB6506.namprd13.prod.outlook.com (2603:10b6:610:1a3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Tue, 26 Dec 2023 07:29:01 +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.027; Tue, 26 Dec 2023 07:29:01 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Peng Zhang , Chaoyong He Subject: [PATCH v6 09/14] net/nfp: reset bond configuration of firmware Date: Tue, 26 Dec 2023 15:28:19 +0800 Message-Id: <20231226072824.3163121-10-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231226072824.3163121-1-chaoyong.he@corigine.com> References: <20231226023745.3144143-1-chaoyong.he@corigine.com> <20231226072824.3163121-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0239.namprd03.prod.outlook.com (2603:10b6:a03:39f::34) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH3PR13MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: 112b8d1e-45cf-420c-dbd4-08dc05e454bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rR4Mbtcye1PX8JZJn/KYuwp/zC9/daq0Xv2jJKR5fboCgsVk1NFR5D6EE4lsfvTqEqSuM2igUMLwGwY5A+C0GO3Ait2NctizjLy7W6kqBbrqVUQLxhckBPB2BJ5/wjtAP6tEVL0ZvNHmDnaux5Uv2t1qT1LQSkzE3MPIGa/wx1TBxEyDmthYSEvPvNPoidNOwJLBKixxw4Af6S+EuUTGeij85pzXPInMS5eKV/dO0MWZeWq8wJZ78u1z0dolYasKpKpD5Mn+PkjCpF1qY3RzE0hotQOT8cQSfAf3y6HQPAQkS8OuatRrWaxE2UvyjWM2GPaha0HR8aEZIzupiXf7JAZfs8P83cuQHjlzgfAmIeDSFTzFI7ipFMTNRgBdxCDQdBcdYf+ln1lZGxniKmNzJM5UjjHlDw1eX/t+Re1zEGwW0OJ4n8ZLIPXbCTBtvsGF+sCGZaeEJXUgrlV2sPFIbR+BoMKe9gkmYZgX3rLJEMgtuiOoguup6Pn+WhagVbeeBCQ5SPxIB+DuE5tbMB/ScX6DdufmrZuDs+UUPCEZwmiFMnq3HiugesPzSX5K+v7+QbSb8lUZI6JC0fi/Gf+87uKqynnIC0ethr8XJQrhGUmlxbQNApeMkTfFt4lIBExSNslWLvF0IAPfL52rZOnY4SiYJvU4BO9VgvFs9+8Eh3c= 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)(376002)(346002)(136003)(396003)(366004)(39840400004)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(26005)(1076003)(52116002)(6666004)(2616005)(6512007)(83380400001)(5660300002)(44832011)(4326008)(8676002)(41300700001)(2906002)(8936002)(6486002)(478600001)(316002)(6916009)(54906003)(66476007)(66556008)(66946007)(6506007)(86362001)(36756003)(38100700002)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LE+tiUIjHYNvY4mKGCwac1f/NS0vnVn9GOx4QmEDogVPM29Vvsunub74ep++?= =?us-ascii?Q?UIuAgmt74lI8b19wSF9tEnhWFiGwp1vgI1+sQ54Nw/xBrvRS1sU2ncIXUhzh?= =?us-ascii?Q?BFL6/mspfbFzzy3S9JdZotspSlo1vZhUhiSDzfKTJ+SYLJy8qBVGr0kkHoD3?= =?us-ascii?Q?6K4C5wmWtCHTYYUDHRJcpLNufZeEtBl2b8IUWgCX1BM0VZmF90DBBiWbNZbY?= =?us-ascii?Q?PnOHKwutmOWa8q8zrJfQ1+sHOTS83FVjvQXKTjOCN0YYqD3xiJxJmC3CNDIA?= =?us-ascii?Q?74y+Bs7xqvMPIebrVBiXwGPd6oJa+aAH6OK5/lpbZqxShgY6UEOIjC0HjrjP?= =?us-ascii?Q?yclmv6ANQhcSJC0D1zrZKrxTP3x4Y9lxdtDwOObfo50MTuZ+HQZX4Huo8ML2?= =?us-ascii?Q?uaWUw3CWxWHNcsRhbvqjv5USpIwgn1+P1VzJkiRN5hR/bxPAAv61o4TJVdCN?= =?us-ascii?Q?DDuj4MsltYNdv5UD4R2A02BqHseg9MJZArmV6N1pjc6cz4HoEjCajsziJkMx?= =?us-ascii?Q?rQz8Czm7xIupi7g2gcK2l5BIqeZs3dXJ1kgmhh9zpE9T7OalAEF2NNQhj37I?= =?us-ascii?Q?uYeHUHrqAkROHXk7OgZhdhKwZpgJYvw2juz2YaPpYnqEqbYPHhq+5F3ok0Wm?= =?us-ascii?Q?TqrB/iQT7SoJPDAUyjjETO7jM80zS3eJ8WIqSQEhD4tcmMHx2mYHPwbZVZ0C?= =?us-ascii?Q?ki46xHCOhJD1YUl6Ym/zJFxIcLaEpd29vnbLEDWZa9wOrqk68uZR6i7XDR7g?= =?us-ascii?Q?JSacMvixjssuMWLdf+Two9p/gT6bqkuXA6ED+w0URtNXK4e/jvqbiAq2/LjK?= =?us-ascii?Q?jOBxyk9VJlc/XPPLXBwIUC46HhrhxHX1MNX0PAAgzkl3Cn4Kkdhwot6djiBk?= =?us-ascii?Q?oZ5hEmCvidslUMtUeEH+6g4qqO8roZLuIx8nwff2xF5/EwVyowsYMWlff37p?= =?us-ascii?Q?/qhRepbWAgga+zDmVmqTdUGM2vqHRIfQ1sPSyEx883SNBXBGf0JS65g885dz?= =?us-ascii?Q?RGsZpyRQOc3CombGHKe8+2E1JH/+WKX+H3CJ0pF8i9Td48efmwGF7Mv0a+8o?= =?us-ascii?Q?urfAJ4tO0yR/eYuN/Uvr5elqzftDpd0aGEOwpmBuu2L7xoRfYbc3aYPsdM/m?= =?us-ascii?Q?e9ulpvASVp5ObiK7GemVIdiVC5sJPJ9KIZqlfNOu7c5U5bhf8qHdkHhLNV85?= =?us-ascii?Q?2ScWLW526iDtYfTxOf69MA8ltO4v7PSh1fz+kz0s1NtyFCUbCx0K+3+l0a5/?= =?us-ascii?Q?wI2/apNHAovK5XFfsJnFN7CziWS30z0hmQyYpZPL0p9Z3ZJg+fweiMkMpwgz?= =?us-ascii?Q?I6D2Nd1JJdKVES6ZPBwOZOmdRnOR150+7C7hscXRlouM/tbnXA7ewQFSfTv8?= =?us-ascii?Q?ZXyhSNeT4OfGGfiGLnT8KrzFfRboCojkwOnqnmpTSeKYDhXsxv9ht/MRKh0d?= =?us-ascii?Q?rXJvi7e8z3fSYZe8ECEENN79L5bqSsRvJNBYyP2z9orQc/8L0Ex/WRUjPc8k?= =?us-ascii?Q?CBYLapShgv/OpJj3O6OPZj0lJ2onO+ixFYLUAgNlLYrdO3D32gxMYJYFVaBr?= =?us-ascii?Q?vGf3/tUshzS/zurt8inxmsleEkFtla/pU/qdEq1Eh34Y/9J1FhwNc6wPLrxN?= =?us-ascii?Q?ww=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 112b8d1e-45cf-420c-dbd4-08dc05e454bd X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2023 07:29:01.5088 (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: qzYMZziWW7VHuxJsAZH/VpHPbBAJP5fX8Y7NIUezzyJFSOBHACDj55nqUkY8isdG01k6zQqj+0IpUwvD/RO8XCC/oj/SLXO2jDJRY3rEz/k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR13MB6506 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 be79764a23..e15d9e09d5 100644 --- a/drivers/net/nfp/flower/nfp_flower_bond.h +++ b/drivers/net/nfp/flower/nfp_flower_bond.h @@ -7,18 +7,61 @@ #define __NFP_FLOWER_BOND_H__ #include +#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_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