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 3E3E543196; Wed, 18 Oct 2023 09:49:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A0D4427E6; Wed, 18 Oct 2023 09:49:00 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2120.outbound.protection.outlook.com [40.107.223.120]) by mails.dpdk.org (Postfix) with ESMTP id 220E742DE8 for ; Wed, 18 Oct 2023 09:48:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QcIL0oRA5T1H2q1wsaBZg8S4FZpS2yQQkN4UJA+1KaZNUZGeVXhMKTsQ+11e3zgFODN9hNcZ3EV08PlkVeP+Is6KaDL16ueXiiGUAZHGAMm0ZALLlEerXKcjTSzq3ht8G4tdLXp2dV+m83if+VJr5Vls+vPzz+a5QzlABELuj23F1RFNaQiFWOzbbFBFq2BMh1fSHtVaoN78vIWXGh/A8XLGVt0BmYvCk6AafK9NdwrSx7KulHK8Y1wL7TrM6jEFK48jKZB0Ufx9voywFx040EUNRuB3ynwfiwO4HfkC4KA+t/+B1PTPWTsURA4G8v0nb/aWIdFqO03F4S5zqgqxTg== 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=iqBxqM2makEu+DZ/jOXbNEWCz7JOyHNFPUS5KbRLp6F1G9021Y6YhYX74qo1RC7h4ftqcV6PiDW14C+LxStyqTmRs0tHlpubNsbAdyqLFp3+y3ZVLUJVSlTI3Fb8a2foobpnG6li5oPe7oYovD6rjZyFJeG6JK/o/sydQ0lrSVZtsu5VB59xAdLTvR6PzvOKRylZreRgzF1KzqsxZc+9nWIamMAN7npU8oFGnuZeTmCWRzmfexBvBnVQyeYd8r67PpgrngKIck9omo9Nixy3x7mZbyvXN0aYR3cptYsKVDSidYgbWXo1fRFi3fjDhsNK6lK6grX3I9qBbOW+vBNnOw== 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=pWOVj5gwQMR3Xo0K7VTOvNCvG8lUarCpyNGIfzAYwidt+IQMYMdPgqEezS5bQ1DBGKVUS76F/CjMTM13cx7JEkdfRmH9ttecEHljduIUYFL4Q/wuQYFs1S3zMNTVgUUW7xvzicdgx2scXJLm/ffzxKgly5el6+oJolZ7MAb+ess= 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 CH0PR13MB5188.namprd13.prod.outlook.com (2603:10b6:610:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 07:48:55 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::142e:d47c:7320:8a9d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::142e:d47c:7320:8a9d%4]) with mapi id 15.20.6907.021; Wed, 18 Oct 2023 07:48:55 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH v4 6/6] net/bonding: add commands for bonding port notification Date: Wed, 18 Oct 2023 15:48:21 +0800 Message-Id: <20231018074821.1908906-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231018074821.1908906-1-chaoyong.he@corigine.com> References: <20231008015041.1551165-1-chaoyong.he@corigine.com> <20231018074821.1908906-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH0PR13MB5188:EE_ X-MS-Office365-Filtering-Correlation-Id: 90d08cde-87cd-4ad4-c492-08dbcfaeade9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T3piG3WHERSLLycAJpaqW/+e6SCN3xsGt/iS9lDvO1j4phfEtZtWwIQj+hI4x9//gxEVX1FKaDL2spAEZA9oXRPR4GvpczrMjb+hpvpt6Z3ilWCBugsJb2AVUGET23NrzUBGhZi9ppkeTq7LSNlAIPHoyma4razZBIZ7fVOURCftKMlNFsbWNEVxlQBY3ws6Uxc6J62zskds62TwberOARs/3pLOe/SOcrAEgiwKZPAfTnGba7U4uMNUACxqDAWtdIhM3OQE0q/sFqdMo1o5nFMKlzmJhycOoI47Yg8sEafPCmbFRPyHbjaparE9ce34yO43i6zBP4Od64iIncHyCAClf4AnKv+oIuYR58kqIcPx0lkon6IVQIsvInX1AQ0sIgjGnRqJM8kyrYxo7zVOu6z8jrgarZcHobCbEyL8+l6jFphCh/uBCcEtNbFmdPYdLJXg9Lnp6UwY+1Aax+YUr/wU0PqLVM+HvdVN/zNjO+3EE9PLc0Iold6sPSeLMAwVj1xniqWpGfEJtCHfe8hYTRZwRan7370Qz8JEc+0kCV74G4CkT841AQG5155PlA+/s4Sh4ivxhtsXoRoc5eXyDOLLf+KU3jpdinHd9BuIdIYygiPDLYxeWGjh7EBhaWP5PFXYcvl12AX16iA3vsDgdF3OfKmtnQkyAP9n5dC/0kk= 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)(136003)(396003)(346002)(376002)(39830400003)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(86362001)(41300700001)(5660300002)(8936002)(4326008)(8676002)(15650500001)(2906002)(44832011)(36756003)(6486002)(478600001)(107886003)(2616005)(1076003)(26005)(52116002)(6512007)(6666004)(83380400001)(6506007)(38350700005)(54906003)(66476007)(66556008)(66946007)(316002)(6916009)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9st8FIfC2CJg3hxZ84PPxl18MBFZ5218YfEutUPNqja1fsJHtOu1YIRmzIab?= =?us-ascii?Q?HEEOVyLs+cHy9sbYugZnUCI30KK0ZTDmdUjpt6tdzVYWB8jot57v5jfoXuvW?= =?us-ascii?Q?qVurr5rATNddsrb35nMTPLfaqtiqXzdyTlGys0+USsduPtfOdtUsRhtbWi09?= =?us-ascii?Q?UH9Az3KV+MuLHsIO9+V00mQzuKdsf5WOGEgBhTp9m0jOSdGAEJw/N7yvb0ep?= =?us-ascii?Q?YhiD4D+6Tl1/MOqI2j1rJWg/XC+h8mePW9VpRvztVa4NS9Bhh7HCILAf+Ub6?= =?us-ascii?Q?0UU8epwevyxwiuiNb4FmXjAiBoKoEkEnlv3EWJuP0ojqjky2gySY2uasWqX+?= =?us-ascii?Q?LmEy5GetwAGSNTuEk24C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q?++CzJ19HZJ7pF/GQ0+nRe74OBjOZU1N08vvSUg/gZ5NO3QppK6HjyJrAVJMf?= =?us-ascii?Q?fX9dkQPDBGm0jaYBsf3foXV8+q9OwYK89GHcHZXBD9kT1zRmfb5Eykmtl+pR?= =?us-ascii?Q?ozJmvlJ9NatxdiWqhtPrB67mVuYRj9DW89Lb/3dweF+rNjKpYMD3e31JJTus?= =?us-ascii?Q?lfJrdPTUOL8fmw19SeXQbjWSj4lQux/DHjVgdf+8GgjpBdRYTP8TPNWsWfEM?= =?us-ascii?Q?v6rEwWvdfewnfwXfYlzT8CKTqjrNvYxiSVsZgxMU0qHYl3qyjh80DVTzdSUh?= =?us-ascii?Q?Qd65QD+nAvat4gKAYQpB73J/LxV4ektOEWdZKcPNSU3R+nEv0nKP1ECwcZbF?= =?us-ascii?Q?5w=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90d08cde-87cd-4ad4-c492-08dbcfaeade9 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 07:48:55.3616 (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: ze7cvcv4VyOGfjxz9TAWL21aoiS3IBv2b4l1GhjW4kwsKPFT2fXkjfjpe+F6/bAYmyybzfke5r1JCP9EmLGFLeUZjLX+y9WMXL6LCK60pd8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR13MB5188 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