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 289BE426BB; Thu, 5 Oct 2023 04:41:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CED1040A67; Thu, 5 Oct 2023 04:40:53 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 30EDD4067C for ; Thu, 5 Oct 2023 04:40:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fLjb9uieTBkf6A+L1iC9bmhoPsVKXdyrvaJ5Kf0txCgxuborWHS747qOZARwqXx+GN1NP4ek0Ce+gXAq+nYdWcbIfS6ZwZY/PcvLfsvAKeYAGrCll0Nn6uMFgTQqh0JGkILqgt7VSKo0Vqe1FCAjJMMo3+qTwDcTrPD32D17GdsbSTrsi5ve8a9WpKtf38i++Xa6V+5RqXKa79RH/HL3izJVyLkkhfCc3tW7Io8dC9jTPEP7M7ZOB8BysWREVWKJQatOqgyur3ZaenHFZCegI8A0mRsgiO/52LCK5QixwGgT7UhPu0RvZQeUN/st87jy5+PjiYO3mCtfTT0tuqxDhw== 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=YWo3ro+S5sW9WE5gQ9mG6jXAy2tNe40WcdY9Ojc5s/PylWmFYBKh4nXOQaJscezEPud6DbQtvWXKJ8LJUIkXQd/eKO805iLz7rJY/rFrD3BmZ1qCrD15ZD2VL4SiDJnL+o7kuDYJssIolBKLVr4Of/m3VQJiwnIghEYWRAxfHYjukCaKbU1+hOgmpOgJKhXJ2nu+QJatpc99mx1/t+GRnNv0TGGHZ+hbSmwDATOTkv6C3Em9i22sOc8rrFZCGxW7n+OSdXIe0n4HfRmhQZbn/a+tlmoX4N1esDk91g127KOPWrlDwNocfb/WaqLiPxXzTYww87PWOgANnmupDt0rMQ== 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=B3PXd0FwXtsYOC2G2hv0ctJb7KMCsTFcbZSHoVSr7ooiA3z9HjDYNwTc/RVbeVFjX/a4wsioNenMyC1tlk1LuxxvWqL1QZeXI4T2YMOU13InXxho9YQKkKdaOnHm9aLhL9Rw1M2woyvitMJftr4RksKqDrtfkJx2c0ih9yjwYIU= 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 PH0PR13MB4780.namprd13.prod.outlook.com (2603:10b6:510:79::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.28; Thu, 5 Oct 2023 02:40:50 +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; Thu, 5 Oct 2023 02:40:50 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH 8/8] net/bonding: add commands for bonding port notification Date: Thu, 5 Oct 2023 10:40:12 +0800 Message-Id: <20231005024012.1279810-9-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231005024012.1279810-1-chaoyong.he@corigine.com> References: <20231005024012.1279810-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH0PR07CA0064.namprd07.prod.outlook.com (2603:10b6:510:f::9) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB4780:EE_ X-MS-Office365-Filtering-Correlation-Id: eba5cdad-9b5b-496d-b212-08dbc54c7cd1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fouIA2tNTQDnjcFB4Yox5f+rbs95DCQAoEouhpH8xlYijNf5mxBwOo4PBtL3jf0YgjfX389wXheLEUCY7hEUftbPg6Z4Sls0g4v8CzQwjmIXUe5Udxy4gGfg/G3TmAvxrWFqoSizlB3RxhRsb44lnFaycPHp+a5yNrm88Mw2t5QZCQuh+y8LF8PXzRWBa9YsdUe03YBkhZTji8hM3mm5kubrYfQBPsxpeAX80MpTu8L25b1Uk1Tv5dpwc6EoukyCiu+XEKDS9sraOILaVUnwN6H2fySEeM4mfaGFsonKnEjoQCdQQa5MA3c5OpbjrV6z/VGTnQ6vv+stNkggdqBsHbhunHhELuTbeYeLp8yOxDML8Xwe0eP+Z9pwB5O296LSLVZgNQ8WFyULpWwnHNusx2sentCStVOlHTsmkMB8lX3hMUyMPJgUOQuPWhlmGSm1yevwY+/qCU7n/ktwzrS9ROYyDTRnYOTysxWxpsco4rDov94JxREetSYHOgw4Kr1sSePJXSQRZHPelLCPkjrgahZEmL/1GRg0f4meEkJPGc3nXCREe7IdROxO+GFawRkrcgkJ3OytTUqqGnRvDVr3szU4PMyjUlSfgWBbLKUevcerLaMep280DJHkIs2Rrxgj0EzrThgSGjpHoeaL79oft6V0mHNzkNo0QOX24JDsFPw= 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)(366004)(376002)(346002)(136003)(39830400003)(396003)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(8676002)(107886003)(2616005)(66476007)(4326008)(38100700002)(54906003)(316002)(478600001)(8936002)(66556008)(66946007)(38350700002)(2906002)(6916009)(86362001)(41300700001)(6486002)(15650500001)(6506007)(5660300002)(52116002)(83380400001)(6512007)(1076003)(6666004)(26005)(44832011)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Rr56CcqFykaTxNS6hLnaP8hAVgCJDTBdOr/vnLJK6Je0RsiP4vx78XiSX6J9?= =?us-ascii?Q?UDebJiJ8Jv/ntRA8KM9LdSf+vaYLag02L/MIoTygL467g3saX1OiV6Ec4f1c?= =?us-ascii?Q?Kh6jr0TNR1yrrBqfUqhdsFcWO3IarwesXBxsR4NY/IxQSk3ZyiVUHi8VQJpF?= =?us-ascii?Q?wH2IUULLvZY14RaR4nW0lkNAywQzLAqkqQROTgqNi2yD6Ks88Ik9Uwj/grhf?= =?us-ascii?Q?fL4eH9vaQBqnE5GxRvTBdIrRs5AWViZBq29Xjhr5bL7ckkzohWjocpse++VJ?= =?us-ascii?Q?akIHYITj4RZzY8Z2k+mesCPodqcxhequb17IbOEmoIwY3NHgJC1gvQF7/qMQ?= =?us-ascii?Q?gxIf3qs2D0gg/I0oFoSLTVXynOaBBsImvS7HnZ2yWD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HDFl6pbrR9/eeqkrVxBqM8UJI3UhEwz0xQMUitKwKvtjazH66sl?= =?us-ascii?Q?nlVXbbcDwgqVffBAfcrueCtpy00rofmIFhW78SyZ0Olv28j6vrCyuik5oXjJ?= =?us-ascii?Q?vi6XqDRkWGoHNV4rz8+CqZv8K20XcJfDiCr1eiIn6362gXnXzPCSdSK8/A3o?= =?us-ascii?Q?hYy7jSathOrxi0YeQFd7nVSFWxOpGkAuEoxOYB6Va1bvq4l+3CAMkFq5ngJY?= =?us-ascii?Q?1CyVbDY0i3SMYUB8QcCS4ntEQGg1Fv8lw2gweAum2X83V7AIv59PpGLZM4Ts?= =?us-ascii?Q?/aA+2oLuvWB/s/E1/Qx86yFZNH3Q+JFp5AB6GjjuOM9P6bm26tL6ZGvs94vp?= =?us-ascii?Q?Rw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: eba5cdad-9b5b-496d-b212-08dbc54c7cd1 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2023 02:40:50.8017 (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: o8qwxXQdlGEJbu8ZKuQxUmi9xPEWcheRKBQJ/UwBT7ZCf2WU3edU1Njom8kxEuCQy/FGd9iZaAH23yZjRoyaYIicyySI4S2Qe2RD1ZW89t4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB4780 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