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 B3F00426D6; Sat, 7 Oct 2023 03:36:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD76740DC9; Sat, 7 Oct 2023 03:35:25 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2124.outbound.protection.outlook.com [40.107.94.124]) by mails.dpdk.org (Postfix) with ESMTP id B10BE40A6B for ; Sat, 7 Oct 2023 03:35:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M9nLlNIrhiSrX/3rx3t2sQgaEzLwnaD1YjBp8T5J9aVY9Rsu6DsLlqh74kjC9DN3WdS+m4ZaQ+RPy7ifxHwi9J1Nus0euSh14G934Ym6i6A35GHyS78Dks1ItOsYaezc7EdqkyUyuTB04qDC/Egg13t2lROrg7HkPhJVx3I8zfQCMgZOBwfIcusXzRrBXHNXLqc3zhb+53/gSGyaVom6/b2+kwgMj91tngc0vwUbpbSWyit3Z/wlEVQnA/kxbZbqIKRCcbvEv6LJLBT+Vt4G+/XsxISBIgUDEp90jUx1bnGlOY9RsmBGgpMhIAq7ZiolxfLysjDHUM7y9UcmaGELdg== 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=r2uSKdjD8aUYDsFnQ6gOb3ZDt2NvVI3Te+OojzDVCUo=; b=ArPBBbyPlmr4P/oJEsYHSf+6uv7WbpQVNJyps4FoGd4V4s8r/5PPipxYv5yObl28niL3tso0k2pEihS6J+LIThqYC8gsyZjl8IGD8GIvTfYIzwM2Xz2NEK39K/ZOnbMKNK0tVTznTYc2eakzDvecM+ASRWBTx96Tk6uLlie+Cb/iO4uRNmKu7BbRA4aCQoZngAKphdYQksEwK9Bcpzy0zl8E+Q5oz4QKQCiwMsuVAKrluCJojr9o88nyDDZIJqZ1r03CRXSebPjx85ZbdYF8bTuZKNVp7Y9RV4U9lxPbip1/BDHQGi5yFQzPGXcmMGHH8h3O73+/RPu2SWaQLa4Ymw== 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=r2uSKdjD8aUYDsFnQ6gOb3ZDt2NvVI3Te+OojzDVCUo=; b=v5A/nzYysb1Xd+w399hQUU1cefFnGSoncNBoDRmsYlH9oIdxVq9bWAkHyIltb1cDrM+BnAdirg2DvwIf3zGEW4DxCPcPCD8Kvyn5FTV+iKlmWy4wpIODZM8XV3sd/YrT416od/gYLcE/gDgUInBeCPyYGr1s4TQv841pKjLhnMk= 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 BY3PR13MB4913.namprd13.prod.outlook.com (2603:10b6:a03:364::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.37; Sat, 7 Oct 2023 01:35:19 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::28c0:63e2:ecd1:9314]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::28c0:63e2:ecd1:9314%4]) with mapi id 15.20.6813.027; Sat, 7 Oct 2023 01:35:19 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH v2 8/8] net/bonding: add commands for bonding port notification Date: Sat, 7 Oct 2023 09:34:40 +0800 Message-Id: <20231007013440.1309422-9-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231007013440.1309422-1-chaoyong.he@corigine.com> References: <20231005024012.1279810-1-chaoyong.he@corigine.com> <20231007013440.1309422-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH8PR20CA0008.namprd20.prod.outlook.com (2603:10b6:510:23c::18) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY3PR13MB4913:EE_ X-MS-Office365-Filtering-Correlation-Id: d35b5a54-2954-4599-d4ac-08dbc6d5aa72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SNac08oDvjplaEKKlCkAFCRvCUKcWxl/PEpi+pshOG5sByAAut4BQ2vuF9IR7zgOmwMT9cknHbpcy18PMtly2Vzug2EBF9Sr32Ze5DygbsdOFdFYKu28qdcJWTAcRkRSfhx9cRulf3KbMVaVrtvWnKoqIW3IZscb7GuIbRQ78F2CDEJQBcm3g6mrj/7tvPnosomNxJLm4ddPnBUzmPJ+vNSo734E62fozvGLQptT5wDLJ9qBwTc0aojNFhOII+XOZkuCa7lNTyTig7Mc/6LxK5L2o6FkqUdXgnbUrKY9kI5t5qwPwq3kAkTZiX1MMHQLLqJVJfVzGs65AQftb+R/mCmfvvtN7giZ+AG5WohvX25ZKMeaJyavPRKrr9Ezay2y4jedIZs6t2sKI1sb03tUBYg51Iv7BMdiV5EQ6ezbZhz5+SZq9weDlSyRRIte53oBbb0SaTXc25m/fCUCfVT/rKAJFArzPgmJhYPu+LzBC6qwk8VnyhtDQhKqN37+D6Xi07GafJ7ONNmeGxsmfPZBZy+henGsa6AkGg+IK05bTm7Znbrkh+hx0AXBfVAZOnQOTlCjp+1+P8oQIKbahGN+CMNcnLNDMVy8hMB/aPDOJZaa+H96o6xr7A4QXou3xaSc+XfLC41J4ludjOZZ46onlRcCpOS/RFGzPBmAP6hIPig= 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)(136003)(396003)(366004)(376002)(346002)(39830400003)(230922051799003)(186009)(451199024)(1800799009)(64100799003)(15650500001)(2906002)(44832011)(8676002)(8936002)(5660300002)(4326008)(54906003)(41300700001)(66946007)(316002)(6916009)(2616005)(66556008)(66476007)(6666004)(26005)(36756003)(52116002)(107886003)(1076003)(6512007)(6506007)(86362001)(38350700002)(478600001)(38100700002)(83380400001)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DMpM5kZa6/UJFg+/uiBbl86H5In/Nz9FWXO2l9lOWQPoSpIOEC/OU6I0/f74?= =?us-ascii?Q?gjaUCUB2ZXaIs4KawlDwnfXcA2WyjV1o9HE0gQphGWZATb5lkY7H8HHma8PE?= =?us-ascii?Q?WrrUvGgP0Pc/lun9dkRixb6TioQc1gwHFhtjGzIcfO/LIWVPrXCGlWlCy77D?= =?us-ascii?Q?qpwfYoYyG41HarSnmZBfn/XoPlbz00eAW4UH8B0Q54S1NW1maMpsAMRFM03r?= =?us-ascii?Q?1Vl4gPZcjSru5pBYUNU30R1QvBQfWCnPSUTf7KbYWRhtwDO9F1LUf0IPQFmF?= =?us-ascii?Q?n7DPw6hisJOovdg5YEI17zMQJSgJZu1HwUnL6LK7Rt4noWiQUec7C9y+z1JR?= =?us-ascii?Q?R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V5lK5uB65fMGNmfe2nM?= =?us-ascii?Q?pTkAn/WN5zKMZiOAfZtoHwHhmxj9gGSse95XGQGIvvA6Hrp/ME8cq5dVJ5sG?= =?us-ascii?Q?SLrXtGcR+AxSuUe788VCumrpIiN4EndHgCa5bWN8IqdAJLjrq8E+RX9/+Rm3?= =?us-ascii?Q?Wsb3rwuwiHwU2/Xl42kESQi/IhSFvIp+VkcfR0VHnb6JlDc5M13XJX1vRfOJ?= =?us-ascii?Q?j9r6IF8LwIiwvn0X2cmYCe4iq7ZRgrHxk+09SoKsuLnoq4OpRcT82Xv6Whae?= =?us-ascii?Q?Qc2Ex6p25mgNmXMrL7D63Rv1NorbeN4MmhmdhvtqCBqHb+U0yr0z7sGugCrY?= =?us-ascii?Q?wLnqtt6KnfyPyuKViMG52Z7SUO4E6OGh8pS5ip3vtLNs3ccgNVNJlW/oM077?= =?us-ascii?Q?gQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d35b5a54-2954-4599-d4ac-08dbc6d5aa72 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2023 01:35:19.6272 (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: mMRQcI+urXowCn2fnaDuQav/xoPLQfwYq3UPzObB+76nbg0zZdDOh9RhyjmON5yC1RZ2CY3pxdtLCVhfQnsol5YuqC0Kq5T6J8mc2B+HO54= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR13MB4913 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 Add some commands to support bonding port notification in dpdk-testpmd. 1. We can enable the notification by command: "set bonding notify_member (port_id) (enable|disable)" 2. If member port hardware try to create the bonding port after notification we can get the status by command: "get bonding member hardware create (member_port_id) (bonding_port_id)" Signed-off-by: Long Wu Reviewed-by: James Hershaw Reviewed-by: Chaoyong He --- .../link_bonding_poll_mode_drv_lib.rst | 19 +++ drivers/net/bonding/bonding_testpmd.c | 128 ++++++++++++++++++ 2 files changed, 147 insertions(+) diff --git a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst index 60717a3587..9f6443ebd8 100644 --- a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst +++ b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst @@ -637,3 +637,22 @@ in balance mode with a transmission policy of layer 2+3:: Members (3): [1 3 4] Active Members (3): [1 3 4] Primary: [3] + +set bonding notify_member +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set the notify member flag of bonding port:: + + testpmd> set bonding notify_member (port_id) (enable|disable) + +This command just set the flag of notification. +If we enable it, bonding PMD will notify member ports when its some +configurations changed. So member ports can do some private things, maybe hardware +bonding creation and etc. + +get bonding member hardware create +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Get the status of member port hardware creating the bonding port:: + + testpmd> get bonding member hardware create (member_port_id) (bonding_port_id) diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c index 8fcd6cadd0..da7d9cc58f 100644 --- a/drivers/net/bonding/bonding_testpmd.c +++ b/drivers/net/bonding/bonding_testpmd.c @@ -692,6 +692,124 @@ static cmdline_parse_inst_t cmd_set_bonding_agg_mode_policy = { } }; +struct cmd_set_bonding_notify_member_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t bonding; + cmdline_fixed_string_t notify_member; + uint16_t port_num; + cmdline_fixed_string_t mode; +}; + +static void +cmd_set_bonding_notify_member_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, __rte_unused void *data) +{ + struct cmd_set_bonding_notify_member_result *res = parsed_result; + bool notify_member = false; + + if (strcmp(res->notify_member, "enable") == 0) + notify_member = true; + else if (strcmp(res->notify_member, "disable") == 0) + notify_member = false; + + rte_eth_bond_notify_member_flag_set(res->port_num, notify_member); +} + +static cmdline_parse_token_string_t cmd_set_bonding_notify_member_set = + TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result, + set, "set"); +static cmdline_parse_token_string_t cmd_set_bonding_notify_member_bonding = + TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result, + bonding, "bonding"); +static cmdline_parse_token_string_t cmd_set_bonding_notify_member = + TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result, + notify_member, "notify_member"); +static cmdline_parse_token_num_t cmd_set_bonding_notify_member_portnum = + TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_notify_member_result, + port_num, RTE_UINT16); +static cmdline_parse_token_string_t cmd_set_bonding_notify_member_mode_string = + TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result, + mode, "enable#disable"); + +static cmdline_parse_inst_t cmd_set_bonding_notify_member_ports = { + .f = cmd_set_bonding_notify_member_parsed, + .data = NULL, + .help_str = "set bonding notify_member (port_id) (enable|disable)", + .tokens = { + (void *)&cmd_set_bonding_notify_member_set, + (void *)&cmd_set_bonding_notify_member_bonding, + (void *)&cmd_set_bonding_notify_member, + (void *)&cmd_set_bonding_notify_member_portnum, + (void *)&cmd_set_bonding_notify_member_mode_string, + NULL + } +}; + +struct cmd_get_bonding_member_hw_create_result { + cmdline_fixed_string_t get; + cmdline_fixed_string_t bonding; + cmdline_fixed_string_t member; + cmdline_fixed_string_t hardware; + cmdline_fixed_string_t create; + uint16_t member_port_id; + uint16_t bonding_port_id; +}; + +static void +cmd_get_bonding_member_hw_create_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, __rte_unused void *data) +{ + struct cmd_get_bonding_member_hw_create_result *res = parsed_result; + int ret; + + ret = rte_eth_bond_hw_create_get(res->bonding_port_id, res->member_port_id); + if (ret == 0) + printf("Member port %u hardware creates bonding port %u successfully\n", + res->member_port_id, res->bonding_port_id); + else + printf("Failed to get status of member port %u hardware creating" + " bonding port %u, %d\n", + res->member_port_id, res->bonding_port_id, ret); +} + +static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + get, "get"); +static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_bonding = + TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + bonding, "bonding"); +static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_member = + TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + member, "member"); +static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_hardware = + TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + create, "hardware"); +static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_create = + TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + create, "create"); +static cmdline_parse_token_num_t cmd_get_bonding_member_hw_create_memberportid = + TOKEN_NUM_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + member_port_id, RTE_UINT16); +static cmdline_parse_token_num_t cmd_get_bonding_member_hw_create_bondingportid = + TOKEN_NUM_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + bonding_port_id, RTE_UINT16); + +static cmdline_parse_inst_t cmd_get_member_hw_create_bonding = { + .f = cmd_get_bonding_member_hw_create_parsed, + .data = NULL, + .help_str = "get bonding member hardware create (member_port_id) (bonding_port_id)", + .tokens = { + (void *)&cmd_get_bonding_member_hw_create_get, + (void *)&cmd_get_bonding_member_hw_create_bonding, + (void *)&cmd_get_bonding_member_hw_create_member, + (void *)&cmd_get_bonding_member_hw_create_hardware, + (void *)&cmd_get_bonding_member_hw_create_create, + (void *)&cmd_get_bonding_member_hw_create_memberportid, + (void *)&cmd_get_bonding_member_hw_create_bondingportid, + NULL + } +}; + static struct testpmd_driver_commands bonding_cmds = { .commands = { { @@ -749,6 +867,16 @@ static struct testpmd_driver_commands bonding_cmds = { "set bonding mode IEEE802.3AD aggregator policy (port_id) (agg_name)\n" " Set Aggregation mode for IEEE802.3AD (mode 4)\n", }, + { + &cmd_set_bonding_notify_member_ports, + "set bonding notify_member (port_id) (enable|disable)\n" + " Enable/disable the notify member flag of bonding port\n", + }, + { + &cmd_get_member_hw_create_bonding, + "get bonding member hardware create (member_port_id) (bonding_port_id)\n" + " Get the status of member port hardware creating the bonding port\n", + }, { NULL, NULL }, }, }; -- 2.39.1