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 9A81543795; Tue, 26 Dec 2023 08:29:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E86440698; Tue, 26 Dec 2023 08:28:58 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2115.outbound.protection.outlook.com [40.107.212.115]) by mails.dpdk.org (Postfix) with ESMTP id 1C5494068A for ; Tue, 26 Dec 2023 08:28:57 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PiA0/tIxBt3XCQkS+9Dw/4gEqJgPrheq8yZw0xCui3T6+VTTeqOuJx9yemYu+eCu5QrvdjNreWrS9HqQOpQyzv6XnqTCRPg8sKPIBAcaGU/GWBFVCmXoxThueLahIIeTWSF+YVMMAiS7ImbeGiGnvAdmvu8TzwfiFjmvCmwWdLNt8iXqJd4xQwbfFgGmKIv1hlL+8HXFYC2LAitDNGECvSMrJ6lVKKj1vfs792t7YYmLbfGhdP70yM7L1EUDHk9Nad9YYZriyhVKDABv2VefJ48MVM4xqpxgqsj3hJ3BwC1+79kACmVX16QYZ6meRh1Pmt+h6mZx6u+cBzYJVz9IIg== 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=NC11EVcm6j+AqjoBTXbteJ+TS0Y9U9SCvL1E5fl/1/kUjJp20KEKDGUH2HmhC4V7RNQnkXKHwzvnjyoCjwFuTdeMRONFABBxjupWRfJvo9YXtsh6PNerhA4Dgar9EwWJdUFm2ZBgN6Hj0Zcm3gZBkG7rHdPKjQrn2NWlgrvPyhI84FNQrJM3tmEhZk+gg+4I9M/Nu5JqE0eCqlQoKAu/iHQ7HlhpAUHpv3NMgz/Twa4emnCRIziUAHJMy73d52JRm264aV9QHUXLiW5sLcy985iJZQfSSm0xhQgiDBMZevhGHm8nT7FU0w20b3ajSwhzVnfb5yOIAh8lJfF42Lc+fw== 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=Vkp5MKwR9x83XlmtHcuOKJIzEEnC6IakFslFZLBBiwlOssPscxYXtLwF+7Zl/65PaLFy+NJRbrcTum3LlPbfejAGP7Fu7xv/+zi6ITBJiFmpfbk2WquGUNL4TYXO0UmxbHpam5XqqYEM2Hsk3robj25ejLAYv02gFFaeU9oSqmA= 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 CH3PR13MB6506.namprd13.prod.outlook.com (2603:10b6:610:1a3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Tue, 26 Dec 2023 07:28:55 +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.027; Tue, 26 Dec 2023 07:28:55 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , James Hershaw , Peng Zhang Subject: [PATCH v6 06/14] net/bonding: add commands for bonding port notification Date: Tue, 26 Dec 2023 15:28:16 +0800 Message-Id: <20231226072824.3163121-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231226072824.3163121-1-chaoyong.he@corigine.com> References: <20231226023745.3144143-1-chaoyong.he@corigine.com> <20231226072824.3163121-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0239.namprd03.prod.outlook.com (2603:10b6:a03:39f::34) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH3PR13MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: 25b3bd4a-e111-4aff-6628-08dc05e4513d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FrlvsgGTEeeitsPK9BXz5iRIp/DfgHeNNwXlmO3XNoDYIZO24vzFbjdcAIyKcxYehICxVuO5TTXLFAyIUsBji3+RsL/JyqMryJcMbaRc0QEIVAXHw5dKODWvUC8h7jla5Q5j2WAFwp7fwJROnV3UJ/FgZ0mJX29pIQIK2/f9ckm6z6eT9c2fkHGyOtLRogm68BH8VciENEMLYA1EnN+/6wwZDI51ajAEDOKao7s0y9Gnal+txG7tduOTrtRDvdd73g82OMKaysx9oAupRxHQoF90MNjJ7feKrl6QIeIwU4OgYjG5op4Pln2KzkP2t3VBi2MV/Aw2t3gWEVoegjWCm4bGZZbEkGnP0Ld0gm7uWF1D2fVbZKB31aXwuZQ2o/4CfBlUmuqFrxQSo+S0ecfXtRuWWTd9xRStW/17aJoz9Ct44dslBHB0A1StcTSgOMv+aoIVZ9mHcDWl0DsntvFua/UXK+XVMEUxWJpAwNZ8MCxeqRXy2LMfTM7/3v+q457apbignyoRG2yL3OYLtxQeXIL2D9mXiUl1XBme7C0Ik1fZcRMZkP6hWF99G6m+HyXIbYSE4UbXysAl3lwA+lGPzOJ7HUbnoG/zT1D4TeqM52amlqYMXMjgG4awV0RBR+swRGmMOrwn2i3XxBsvQn9DfBtCV4sGJ/BCXOq1Vm102t8= 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)(376002)(346002)(136003)(396003)(366004)(39840400004)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(26005)(1076003)(52116002)(6666004)(2616005)(6512007)(83380400001)(5660300002)(44832011)(15650500001)(4326008)(8676002)(41300700001)(2906002)(8936002)(6486002)(478600001)(316002)(6916009)(54906003)(66476007)(66556008)(66946007)(6506007)(86362001)(36756003)(38100700002)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6ZgI7RE3MDtGdl/k2u/t3nqUdI6VJMLhcatE71J9eWQTzItO1vMoqBX8nSQn?= =?us-ascii?Q?3VMcwGmSxl4IeT0QyO7T0zyzlkPlpJKwMc87QSNOGcQX5f82sIgiv9qAGy1V?= =?us-ascii?Q?0yGKgXmHdDznv4Yg2D3Fdu//xrATYic2Xj/pDVNnXxEhFOSG/6aTazQiFmXB?= =?us-ascii?Q?d2ut3fXrc9IYJ6W8k4X3Mpa7mvr6LcLaj9ynkNQkzs9f4sZ8VV8heU4JQAsf?= =?us-ascii?Q?+VBMuNZoDJfJOPEw509dCHN0hmI3SxhF+VdZxH4F85eAnueJe0YnZcf+cv5w?= =?us-ascii?Q?lTCq+60gmezquFX7qwhUqpIfSdf79CAKTlIESBKq+PE9eRq+RqCdzZpu9lYI?= =?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cbPLgHGBL5u49XAAi72Zo1?= =?us-ascii?Q?W73VfuPYYbIE/Y17YS5hNDvpOstYuM3UWUv8sJ9++wt9v/NA+tH1jlNMMGCM?= =?us-ascii?Q?HGkiJtlbwEqszhxgF78SfVpMes2Z8E2DaiJcF8VxLPzRPR8hptIePFFZUeeO?= =?us-ascii?Q?WudAcH6VjhgI74JThIsayQFnX9eUWpDGi87ELvtSxy9xJOnQ4/MvbkJ0+sUZ?= =?us-ascii?Q?7vOicmzz0Z0QWU3mK0bPDCx9Xn3V6rKvUwZcweW6KiGjUMpbF9ERPgGPmFsK?= =?us-ascii?Q?nRvLgCvRm3FhSOPHUnFod/uBYYR0z25/Grok2XjMKtrUNERbabboQ5rRk6zX?= =?us-ascii?Q?IQn3OnspN4xu8BYoqz14cx5qZ1ibzSW0ak9QVWhBcyiOPN7cKc4izt8Y4/MP?= =?us-ascii?Q?tQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25b3bd4a-e111-4aff-6628-08dc05e4513d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2023 07:28:55.6083 (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: KRF7Zv6k6kKW+mPSse0sGVT/Pdatso4+SET0gu0Q9a8gtoBxGxWwbvBi2mQ5l1UXfNdVg6i0sYnkAt9nSSMk/d7nKIxCYyZH7unEbE4+t6s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR13MB6506 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