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 A13C04378F; Tue, 26 Dec 2023 03:39:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2548440647; Tue, 26 Dec 2023 03:38:23 +0100 (CET) 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 CFE2C402E7 for ; Tue, 26 Dec 2023 03:38:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=laH7wAZsr7qd23W/2kf7YtckirVE2FQrlEjgVKqawgVOj3BHizTAZigowUpFjEs57IX/tvj0SUDwgL4JNJmVUYXZEoIbRbB0fzpeaQrdFjxddcYHXevCfSEz63o9zCj8o7Uq+LtpOjO4QxA8ERg+lJi8O5Gi8WAJHYYnHMKAYz1CV/POc/rbSpUZrc0TZUkrcGXQJthIGI/mt5EVwcsnl5PJMUePfZj0jdYXVZ9EehgsIXXyABWdz/fKuc4nu4KKf66eTAy/vek5C3aH0QamMeDYVd1cUpovrrG9rew9z0hCeFZVhChCYgMZjCa0/4Ljd8jOxdgFTJxYL/Q/fiMEKw== 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=twycyoVMnbqRppD/ZS5EgrBApnJbu4ugflEfR36Hu98=; b=WIg9Sy2AgQWOw1Ch45E77HEHTbIR3zk2wTNZvkxAj2NuBDB+aDcwI4m6yJtSU/Uq10/oJYn9IGrVqG/NOB3mS2/j8509YQ9cnXmhmoX2RRXMyKi5SCXkQfA7CmTe3fBbqt2Y3dRCvl+3qwC+rqjDRp9xT12an4qT0HLSHuvr4cwdAOiGTtNDYTp6PZ+LGIo6y8r71YlKzhwh/qx7J4dmBNU9NK5+g9pWKDrh7lpxxPP9YDc01+kufvGlDhuiTjibgsMUhKE18cwgx5bWzgOHq7+kQGEwUL2DI2KbOYtTnXfgw0g+Q2uuOaY+vafwTtNKA/kuMny9mfcoVCGn5LOVMA== 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=twycyoVMnbqRppD/ZS5EgrBApnJbu4ugflEfR36Hu98=; b=oAqPpCq0pUjOZ/w4RD6JbY9iskbKl2/ZL0shJHf0Z8CkXvmxr97KX56oV439wjITxesZN3BxreyP27kLVLchr46U+yy/RXNOMsN2pYeX7kCwFzqwuh4/Vqm9oBmf+OEX9i/cgzofloyh67ZYIPkFJUxUFKgtWap0QotzSnKQ6mA= 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 MW4PR13MB5864.namprd13.prod.outlook.com (2603:10b6:303:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Tue, 26 Dec 2023 02:38:20 +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.026; Tue, 26 Dec 2023 02:38:20 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , James Hershaw , Peng Zhang Subject: [PATCH v5 06/14] net/bonding: add commands for bonding port notification Date: Tue, 26 Dec 2023 10:37:37 +0800 Message-Id: <20231226023745.3144143-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231226023745.3144143-1-chaoyong.he@corigine.com> References: <20231018074821.1908906-1-chaoyong.he@corigine.com> <20231226023745.3144143-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0156.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::36) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW4PR13MB5864:EE_ X-MS-Office365-Filtering-Correlation-Id: 6100b183-08d7-4826-562c-08dc05bbb903 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6EBISsqHYFqmmzv/INqMfbSPjTiT8V7mdDtdyx2fTOHjmhUX2SZWRjEnlIS32pEeV64L51DWPb5u3YNpw8SYW8z5WFe+561im1r3JtduaZNsPemfNmv50kB3V4XOT2nL/RkDJwsJqRP7vQTy+Z+I0p3TJCrGwJp471tpWGKM6be1olJPPu/dICP9K4xUnOpeaBRuOXmkdCXfCsrTykjiAQGW5SI9674Ku3rScBVGxOEl+7KRYvgdhG9nY0gt4I+pRd0yAlTl6UIlLdkUQFANzjQ8VrKef13FpjA306p5tLSaME2gNLDrsxL2NXZo9YpDwc2peZgijPQX3HgicKOl/9qKmqf1fqH6fqgMO5u84ZJ7GFs6ubns+OtpysPxuvD/nxW61Y7IYgy7qUMvVFpo0VL5NabYgdD4b9pUgrJD4uhcJV0jiqd15BWYIvSHt6VfE2IzvuAy3GJntHDQBkSCAV6BHDzEpilVc7WjClSdGxgvvJ0N5Fc3pUseXUZxuBQ/mFL2F+YphrH+IQoE37jC9XJyVjDuno5dCZ+WY2L4v0eQHEVAmeZDE+ZjkjWrrNMjSFYaLSpeZWlaUewGcYaWoh0Nk+pDktZ58zM7OCWphgFONOUTWn0P4OQZkswnbUcEneLoKOgrDg7KLU9OLqzvEv+Z4wh91/xG7D5Yi7EM56s= 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)(39840400004)(376002)(396003)(366004)(136003)(346002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(38100700002)(26005)(107886003)(1076003)(316002)(4326008)(54906003)(8676002)(2906002)(5660300002)(15650500001)(44832011)(8936002)(478600001)(6512007)(6666004)(6506007)(52116002)(66476007)(66556008)(66946007)(6486002)(6916009)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2bvhyJOvVjAk0Qd7BfYf3QGyuloLtmqMSKDc6L8uYYHf8sf8d90s6PuKxSpk?= =?us-ascii?Q?YWdlZDa226/dr1VHZhit2IeEdN5JpUPFStfNrh6OvhDT17eHt1pfOsVlXWNo?= =?us-ascii?Q?2fvJS+vbED6MlVB7RcL7CCuZ7wZ/HH0VnldZf+e7yV7PiewN9TaXIID0n4Vc?= =?us-ascii?Q?bNVOr35SjXr0ELuuwZd+F8Hg3hDVSJCTd7ov1K1PnsxAdYVaEDi//jTMLLuI?= =?us-ascii?Q?qJ9J3c6VGgoICWOa/QVg7EjYEx467FYpl997sUecQ4qZEL4DtNBAFP+tGOnP?= =?us-ascii?Q?x/tuqSIf2wpL/yf6P5rnx0UaIqGDwjp60HrrLokL5J1MK5eewwJvzn3sagFD?= =?us-ascii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dOj9aPvj0bCaf?= =?us-ascii?Q?GRRiJqGHolByXEr6HtAw/J4Uc9nx3wavtwPsMAF6iEF2Om0DYc5N2xwcRPHO?= =?us-ascii?Q?YdaZBKsG/VkzF0wLe6yhkd3zRbivhnL9LpTXISSlPj5BkySfS5VhbTsiHusF?= =?us-ascii?Q?csmBuCZmSs2y7BlWbWNhknfeegkqsuedittTGfl3ixtUqukT0Syr7iNhWMB4?= =?us-ascii?Q?HaieR2lZ6AsCLh6Mw4+eQ5eWL8oKiuLdR2qgA2FsUW/HU8N4GSY+/HXWdLaw?= =?us-ascii?Q?0ZlXdxn4nBJpaA++U61rTSBBj9JZmDPXHpl/9pKjs+qX/p0t+YLTi9rOZRhr?= =?us-ascii?Q?fa6YSqSI9hyulZia2Fzfwpyt/5rUA9k5PhLniijq8viod1s/BJEhcgMQPktP?= =?us-ascii?Q?Vg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6100b183-08d7-4826-562c-08dc05bbb903 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2023 02:38:20.2309 (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: vJt+RUfTAJJ3VyFQ734XJKBTiZO/E7Md4Z1YIhjBNj8rPW/zQvdnXKcsuwK+xymcV/h+rkBUeFMyMz1qA8FZikgpPtfQSePMhRciKClz1X8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR13MB5864 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. Users can enable the notification by command: "set bonding notify_member (port_id) (enable|disable)" 2. If member port firmware try to create the bonding port after notification users can get the status by command: "get bonding member firmware create (member_port_id) (bonding_port_id)" Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: James Hershaw Reviewed-by: Peng Zhang --- .../link_bonding_poll_mode_drv_lib.rst | 18 +++ drivers/net/bonding/bonding_testpmd.c | 128 ++++++++++++++++++ 2 files changed, 146 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..653d2f850d 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,21 @@ 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. + +get bonding member firmware create +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Get the status of member port hardware creating the bonding port:: + + testpmd> get bonding member firmware 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..48f71da3a7 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 firmware; + 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_fw_create_get(res->bonding_port_id, res->member_port_id); + if (ret == 0) + printf("Member port %u firmware creates bonding port %u successfully\n", + res->member_port_id, res->bonding_port_id); + else + printf("Failed to get status of member port %u firmware 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_firmware = + TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result, + create, "firmware"); +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 firmware 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_firmware, + (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 firmware create (member_port_id) (bonding_port_id)\n" + " Get the status of member port firmware creating the bonding port\n", + }, { NULL, NULL }, }, }; -- 2.39.1