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 4E38D426E6; Sun, 8 Oct 2023 03:52:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7383640A77; Sun, 8 Oct 2023 03:51:45 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2095.outbound.protection.outlook.com [40.107.237.95]) by mails.dpdk.org (Postfix) with ESMTP id E776340A6C for ; Sun, 8 Oct 2023 03:51:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bzf/3F4ieUF+Dj018MktrWze6W+y1QVV4ZoQbKKg9Sm70pqwEZx1EygXsS8HdaoWNzi0hABu72CzMNjTdzOG8SfFUOErIM7MvWRd7lIYMdI6LeHEIyNvWo9+XzG/mBf83a2Lq5Q1H5+h+MZ7BYH8M2Eu5GQzrp4azgL5S0VLmvL/MINf2LOuq8TxoX1zba66g7z0eoycsoJsRbQFS/suxstciM/qZoHfqp6Ydp5ngzuFBps0bVraV15LqPstJ55THJfqoruO9XNZR6T40A+Z6KfxgSoozyG7arWQyE/Tj+KNFdDKw3ZbBQBie7J88DWOVzn6VvZaYFPmCPx2924TVg== 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=jGKUd5SMU+mUsp5d3ZwOWqU/ttC0PXJOCJonkLw2SyBmWeMyu0DaNDsqBLbRZixiy2NoS99VeWoaA0NboYC1apB+ENiCzijQoOoS0wO7kzemI9ekbQbVlteYS+xAHfUCiH0WwGwBgg64JIUA2EtCmcA643Zuw6FmmpknkYknV6LJjkx0jDrwWy4qHdEXmpPqEWkqlisJj0wQuEtukUjj/NyOvASJft8tutrzRLvM0nHhaCuDrj+wHcLP42kP6L/fQpO6cLWsYYu1ckMINolE2CP3rBTYttdnsemM4gONp+K0fBlBltEUYMhvtJiqK2vQq7aYtTHndDprmof4uctHyA== 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=sS56+mmHHfMOhTG2F7OVknMm8+DOXrOVe9WSeb7dJZ2qIHeLFNBLN3iJ4BA42wgNSy+eMfr0ONDTXUvECY1p13Jrt7obeLEK8sKp5uL0LG1+48oeTM2QgTjm2vNhnZKzQG4PC1oDTMgaglEsRD52ua/kvUMXM1D5odwtCGr/05M= 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 BLAPR13MB4579.namprd13.prod.outlook.com (2603:10b6:208:327::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.41; Sun, 8 Oct 2023 01:51:41 +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; Sun, 8 Oct 2023 01:51:41 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH v3 8/8] net/bonding: add commands for bonding port notification Date: Sun, 8 Oct 2023 09:50:41 +0800 Message-Id: <20231008015041.1551165-9-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231008015041.1551165-1-chaoyong.he@corigine.com> References: <20231007013440.1309422-1-chaoyong.he@corigine.com> <20231008015041.1551165-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR05CA0173.namprd05.prod.outlook.com (2603:10b6:a03:339::28) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BLAPR13MB4579:EE_ X-MS-Office365-Filtering-Correlation-Id: 77514756-9584-44ab-ea1a-08dbc7a11df5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4VI8c79FOSGDWTBXDIiNute6Rfg3tgMechzDhvkPJZl+cr8O0U2SIIlO+nuEo4b8XbHnG1tkaGxwGd8YDNuyHLT5lgmram4M9f3/S7sKx7NYhEKuniW3eNZ3bA1zmOXRtol78zVFR8tdRdw0sNW0WYnRYyr9yGHqQUzHgCA1jjRSMCqy9otNd4Uea3+Byn1NaYqIyiKBOkhTztEREpLmin/+0jQC0k08IppRMcZ5EcutAihPmJMEqbGn61bUMq9RUs1yBrgkVUNbgIGL+g0x4CMB/FnzQSkDLF6BWIlzuLq+4fztM10awrnD8iHxASAxVlXZJNzJAwelx2yOzneGifkNN095P79RYcg+RNXzc9kQSmV4MxWI2b3uT7jmEXR4WmfbCxlgntF8qeYYqnQlZ6dR6jyKleWvfe31yxLNb0F6dKxvJVAzxHTmb2+xH8Xf4E6VzPAoKWemUjMJCOrate4K6QtgCwqSA1fLH3VpHCPpAGAq3zr+rRCo09BUNoscdRrI9NWxafY6dwAEftPX6Hq1tROxvV9CsCEUbpZ+5EwI2oW1hW+MVHyfoJSB1NDI44r/Rl+Gah0VO7PlEZG8xhxLDZaBW0OaPzqRBI2pazI0CbuvPiS4ykDczM1t8n4GdOvQhFVWP7Yx6cUs7Qy6vYVtTFzBk8p8CvxLE2RUaoU= 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)(39830400003)(376002)(396003)(366004)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(41300700001)(1076003)(107886003)(2616005)(316002)(6916009)(66556008)(66946007)(54906003)(66476007)(36756003)(5660300002)(44832011)(83380400001)(38350700002)(38100700002)(15650500001)(86362001)(2906002)(26005)(8676002)(8936002)(4326008)(478600001)(6486002)(6506007)(52116002)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?mfNHpNm0wQKyw5dngZj8tGeehAGRkEv6VzSJVI5C8k28zW2qKkC286vSlCeb?= =?us-ascii?Q?dMtU9LZDP9H9bDiZRofotJXyBZHiWCmU+bFh8Ttb1wwsPjsrqSaVug0JZVrz?= =?us-ascii?Q?IJ2FAVkvyggqUJ05INufaY7co/ZA2wfE7FX+qQBvNvXXzTVTE3Irzv+toKTs?= =?us-ascii?Q?9/vqxgAgl/jqa0hXM/IVoYfatWQyeeXMYpZ3rt4OFVXjW/WrvxrqQYEsYuOr?= =?us-ascii?Q?FfTTOLeqSwZeJvQyng58EF3u+ndaMGva77/E8XUroSU2zXp6pn8hUNktIwzB?= =?us-ascii?Q?goFxwpbYld1XQWq+uRTAs7ypGxYn0G6/EcVFjCywVlSevu9CRsMSo97KWYH8?= =?us-ascii?Q?cd1v5bqMzazSjADK0XcAm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IB?= =?us-ascii?Q?dLaN17TrF9eVrJpKEBYIfyjdfxHBheEozRtmiiAawdORabI0osFg97nXM7CR?= =?us-ascii?Q?2NUp5kB+/grdW4+dQmD7McOlIk8XZgbVal3D7bB3OlaV57n1i8a3nXyiqLjw?= =?us-ascii?Q?I9c1jXvv5smVgHl9ENPEf+gIE/CXh50yQt8jNeh2x9qNksWZm/ox07zyB66B?= =?us-ascii?Q?ptD4Iy7WmH+6y5A60iw3KOR1JTAKPgoFJkwHFXTfasPM8Fy3dJnhsKVjIBna?= =?us-ascii?Q?98n+socRCveIQoVcnfi5IrzvJ4mBpNb2FI0fVL5mbfSSaSyU6PUNuR5XZCN+?= =?us-ascii?Q?SQWZmt677V3kicd7HAnw4j4ySnXABdi1Hm+Vm2vShdcJNCnfjR/3vWHcr+qV?= =?us-ascii?Q?Tw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77514756-9584-44ab-ea1a-08dbc7a11df5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2023 01:51:41.2213 (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: N/bPAFC9V3+a8g3SQqJ/YcN0k0CN/0voH7gcNqWKLLSSXu2zm2CqJRHpsCJ/FAwbAMGfZo0zZu/eg+kHAv/j+jfqVyoo0KsT8g6G3WQ1Sls= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR13MB4579 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