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 058DD42B1C; Tue, 16 May 2023 07:42:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA7AD40C35; Tue, 16 May 2023 07:42:07 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2087.outbound.protection.outlook.com [40.107.212.87]) by mails.dpdk.org (Postfix) with ESMTP id 0C35640A7A for ; Tue, 16 May 2023 07:42:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EdcfiBr1HsV03DhYhnSkihcdHK3tdQ/riWeZzh9XhC1ETzz1YgF9fsVaHv1dIfq0a5nkAZXm9GMnVkG/obiXs4b2GwcyYhkiPSTTVBq9WMe7X38u4TIfY0k4VHrbSkhJXZXOPqMSRJNcknrFp5N8eHUMpfUUnrCkQIEmlYyZ2rM2AqIbvDWK4M5PYu/Fan9Tp2zB1mhhTfoudAOQtgA1q1+2ojekiJ9XYjiNeD24WJRDhVeEnRF7pG28Rd9WISmVQkDerXvhobydnHFo0nBc+9CGRog2Gybv1Ut6VPkclhHwfBoHTNb0B7umUNRqaxVzShFLbxvkCbcb6yf/37ojeg== 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=1x6ogoFQlsdS0PHWX6E6KaOJRwqAG4q4+3bP/x9dbRw=; b=Mb7TC4oU0ZciH5TZpkssh7kqM/vNL3+BdExCV1d17q87JN/RE2wClB7f0mKDUU5ny1BBlUsfgpTpkN0yPGD4QFTHQ+vmHSX43uC7JZAaeHXiB6w9lU389gCjvc0HzzOanFSnlztoAsEXaJ5saSne3RhFODIpbHUUPzPGB2YGux41RuW2hp8OzVy8fx+E6Bn7Kl6rHhGvcCVheSmNrER/7YrU2vzOqi/txeTZLJpU8ZwlgmfFlT/vLtF/Or1CxcVBLEPfCqUXUWtIrQqN3xQMjznM4wSzFXBvWlaq2aa0jmCV2prF0Lo1VGFDSmr/dyJ0WEwCd4sHi+dnLXpBCRQwag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1x6ogoFQlsdS0PHWX6E6KaOJRwqAG4q4+3bP/x9dbRw=; b=OWE8SjqkVeC74uKa+W+AFWIVXmbXwsLDZaDT/q3/e62yZznGj+tW6LDXneJ4/lMmFg3D4x1/k1bCYzKCByxqOfxf7USpbz/AQm8gDGqCyf6V4Z2tXP8qTyJkGK1CAw8qzSD1KoMj7NyVNcH/UB44xQcX/ZboumuB9zNiVdhhlU0lWGq2balg7oi761YHySsmGl8XJHwPCVuLZ2OuAPySX4kgn9Gj8MgvHfJx6ofSZzvTZzXyr/u33QpPPmyrtoTy+R4KEyXjKRxHv1/nB2ZCSml8eizsQJfWn4TN9dSOLJFGaRJBCgaGRXPzrbCugSMAl82dm+y2tT808197xnglHw== Received: from MW4PR04CA0301.namprd04.prod.outlook.com (2603:10b6:303:82::6) by MW5PR12MB5682.namprd12.prod.outlook.com (2603:10b6:303:19f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Tue, 16 May 2023 05:42:05 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:303:82:cafe::36) by MW4PR04CA0301.outlook.office365.com (2603:10b6:303:82::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30 via Frontend Transport; Tue, 16 May 2023 05:42:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.15 via Frontend Transport; Tue, 16 May 2023 05:42:05 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 15 May 2023 22:41:51 -0700 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 15 May 2023 22:41:50 -0700 From: Rongwei Liu To: , , , , Subject: [PATCH v1] net/mlx5: add test for hot upgrade Date: Tue, 16 May 2023 08:41:37 +0300 Message-ID: <20230516054137.1396922-1-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT044:EE_|MW5PR12MB5682:EE_ X-MS-Office365-Filtering-Correlation-Id: 526a9cc8-f174-4346-2640-08db55d047f4 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yATQ3MUJVrAfJQ1syQzRBbxpfN4sq3tmJI7hUQzakn0VVGlDDN5bl3G5hvNwGw0D8SrWOP3JfJfszRdWpqvu6zV1xNHXaobSWdTV6cLkL037AcG6PYfwLHPV0v9k2H18q/pXPoETtN+GlwwsS+GLQaZPF31bYnnrSYQMuT50huA2JF1fYdi/AfJIzkolzMVKnrYbhp0iwP4GrabFFhDyGHUoHdeVZtjGn2H8froOItugD0kLBbTqlaMKOg+vFbWPFeAGYpEfsLud9F6YmHFaxz7hO/gCPARYmuR+O1J+O5z9wrXcmruOIXZ1PZhb1AlS/mjnRtiS05h7Im825pSFdLVgkH9VEwiWzfsSyHsmeOdAy2MPNfujihmbWAcCaXqQnrjw/j8afNwcZrCUI7Me7P9PSBrZMb6trquiOCbSbEAQOzddHo3umqqMVmU+B1MH7ykHMZlAQQBOijCDrUYmKAZb8zLtjfsVHnHx1Y3/l0YEYKcrwpDx6eAW7kGDabESdJd+S08tE53z9IC9OTKqBgT25t68WVJJFTHWL7Nm4QRAuZWEXtBAS5cjGZdM7fZcCz93ZyBR9iMpj8Ouo9FS2l6R4oa6k7iVc7bw2/FJwkfpm5E14QsKcz6LK1YMHYKo9dRwZsSOMXoDN1o7XFnvIb5ryxZc45Fw+t1Tc6rnRiWLxDy9Vv5qwJ+yqF+1iKEXGrE+qB4twDRv2j3L9WG2PNdMJMxg6WOd1cDuqyeYwnMWgFDa5AXumCxdsExFh0i4 X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(396003)(376002)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(36756003)(110136005)(316002)(70206006)(478600001)(70586007)(86362001)(7696005)(6286002)(55016003)(82310400005)(40480700001)(2616005)(8676002)(5660300002)(8936002)(6666004)(2906002)(82740400003)(7636003)(16526019)(356005)(41300700001)(83380400001)(1076003)(186003)(26005)(336012)(36860700001)(47076005)(426003)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2023 05:42:05.0861 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 526a9cc8-f174-4346-2640-08db55d047f4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5682 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 This patch adds testpmd app a runtime function to test the hot upgrade API. testpmd> mlx5 set flow_engine <0|1> (flag) 0 stands for active mode while 1 for standby mode. Signed-off-by: Rongwei Liu Acked-by: Viacheslav Ovsiienko --- doc/guides/nics/mlx5.rst | 10 ++++++ drivers/net/mlx5/mlx5_testpmd.c | 63 +++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 7a137d5f6a..1867b2a3c0 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -2057,3 +2057,13 @@ where: * ``sw_queue_id``: queue index in range [64536, 65535]. This range is the highest 1000 numbers. * ``hw_queue_id``: queue index given by HW in queue creation. + +Set Flow Engine Mode +^^^^^^^^^^^^^^^^^^^^ + +Set the flow engine to active(0) or standby(1) mode with specific flags:: + testpmd> mlx5 set flow_engine <0|1> (flags) + +This command works for software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports. diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c index 879ea2826e..cb0cafe1e9 100644 --- a/drivers/net/mlx5/mlx5_testpmd.c +++ b/drivers/net/mlx5/mlx5_testpmd.c @@ -561,6 +561,64 @@ cmdline_parse_inst_t mlx5_cmd_unmap_ext_rxq = { } }; +/* Set flow engine mode with flags command. */ +struct mlx5_cmd_set_flow_engine_mode { + cmdline_fixed_string_t mlx5; + cmdline_fixed_string_t set; + cmdline_fixed_string_t flow_engine; + uint8_t mode; + uint32_t flags; +}; + + +static void +mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct mlx5_cmd_set_flow_engine_mode *res = parsed_result; + int ret; + + ret = rte_pmd_mlx5_flow_engine_set_mode((enum mlx5_flow_engine_mode)res->mode, res->flags); + + if (ret < 0) + fprintf(stderr, "Fail to set flow_engine to %s mode with flags %x, error %s\n", + !res->mode ? "active" : "standby", res->flags, strerror(-ret)); + else + TESTPMD_LOG(DEBUG, "Set %d ports flow_engine to %s mode with flags %x\n", ret, + !res->mode ? "active" : "standby", res->flags); +} + +cmdline_parse_token_string_t mlx5_cmd_set_flow_engine_mode_mlx5 = + TOKEN_STRING_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, mlx5, + "mlx5"); +cmdline_parse_token_string_t mlx5_cmd_set_flow_engine_mode_set = + TOKEN_STRING_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, set, + "set"); +cmdline_parse_token_string_t mlx5_cmd_set_flow_engine_mode_flow_engine = + TOKEN_STRING_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, flow_engine, + "flow_engine"); +cmdline_parse_token_num_t mlx5_cmd_set_flow_engine_mode_mode = + TOKEN_NUM_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, mode, + RTE_UINT8); +cmdline_parse_token_num_t mlx5_cmd_set_flow_engine_mode_flags = + TOKEN_NUM_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, flags, + RTE_UINT32); + +cmdline_parse_inst_t mlx5_cmd_set_flow_engine_mode = { + .f = &mlx5_cmd_set_flow_engine_mode_parsed, + .data = NULL, + .help_str = "mlx5 set flow_engine <0|1> (flag)", + .tokens = { + (void *)&mlx5_cmd_set_flow_engine_mode_mlx5, + (void *)&mlx5_cmd_set_flow_engine_mode_set, + (void *)&mlx5_cmd_set_flow_engine_mode_flow_engine, + (void *)&mlx5_cmd_set_flow_engine_mode_mode, + (void *)&mlx5_cmd_set_flow_engine_mode_flags, + NULL, + } +}; + static struct testpmd_driver_commands mlx5_driver_cmds = { .commands = { { @@ -588,6 +646,11 @@ static struct testpmd_driver_commands mlx5_driver_cmds = { .help = "mlx5 port (port_id) ext_rxq unmap (sw_queue_id)\n" " Unmap external Rx queue ethdev index mapping\n\n", }, + { + .ctx = &mlx5_cmd_set_flow_engine_mode, + .help = "mlx5 set flow_engine (mode) (flag)\n" + " Set flow_engine to the specific mode with flags.\n\n" + }, { .ctx = NULL, }, -- 2.27.0