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 6BC3DA0093; Mon, 7 Nov 2022 08:12:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 279AF40156; Mon, 7 Nov 2022 08:12:44 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id E68F340151 for ; Mon, 7 Nov 2022 08:12:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667805162; x=1699341162; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=hZY/ckYREq5wrGkNV5sao2EFwP38pGiE+bc2JiHvvkI=; b=WTUWgfHxs2DMH+B+KxgxyrRvy4rDNV344n/UM9welP8GLXS1bwmE0OTM KUAF4jHqaGugJP7tUfjjwnS1ZkJgADu1Fn920/L8m6ewsCGKhYPkt9wrf kuJ4K7Gtq+t78NfUogMBllX/UUHtmO4mvDKkgkvtuZyJXHtOLQwvuXIku kiltynS/z0cBleaRG57RTOOYhygLjGgaINaOXAky1EO7KjAa+Sbat4P9m nCCbXIRNuiEJh9DEv3JwrKYdkSfVl/VR+2wAzcwnj5SM7ZZoeujACzsa6 zY/xj0K5mit6vohInVixjcN/Pnlr8Hm4ac8h2Iq3ManqtfwJJpwe6fbR7 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10523"; a="372462189" X-IronPort-AV: E=Sophos;i="5.96,143,1665471600"; d="scan'208";a="372462189" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2022 23:12:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10523"; a="810738066" X-IronPort-AV: E=Sophos;i="5.96,143,1665471600"; d="scan'208";a="810738066" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga005.jf.intel.com with ESMTP; 06 Nov 2022 23:12:40 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 6 Nov 2022 23:12:40 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Sun, 6 Nov 2022 23:12:40 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.170) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Sun, 6 Nov 2022 23:12:39 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNvNnSqO7squk4QnDlXyGe2/6/RUpjV+Koh+LBzNcnRWVIawavWHaM9K5Oq/2ItGSSgR7a4I52Rh/vYhCr6fP+wYh/GseIosnHOuzQQr1bJZ+BEihizf6y7Tl+tp/ZXu91pNAtaKfX8copQ2OxhdXfy9ms/UKE/m/OACYT65ilKxWWGVknr+49mfDmlYLYiqv02Anb907ftXmmxGX2zYSZi+wKTrtB+J1ff6KOSpLRdYhrHYJ6+G9nByTxmu6ePDt5vbpJTghiukURbRoVzvKlP1RjmuXFWr4HYHS8+rmlxay2UPdTwGeidL92wyeSWEmftpvXrkWGqVZh16tWzCjQ== 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=hoB13UHEh0AfGG5dowvCq4ZcAMMwVHg3oAU/bPWAQbQ=; b=SfufjXpeZVaasWgySLmW5j0LfQ0FEe8hPHTlFYIdYDRyZTPmPRLW4v16ZWVhPS1ZPuzvHtr63v0Ae3l2mi3LCLwRi3Gv/eKGWuVACNKh0Q6SnIX5NHXuhGm2N1+EP5kNq3KFLmeEDlhLV4YJk6KxBhWRA/FgWJB6xkicM5mJQitVOKPaazij+YHS1OB2cVbfIFmKXMuMHR42g44+VpCUC2AXqIBJ1xuK79bcUgbEyUUvgWgJLLxRv8FEj8LmnDE/GrQK9xNTQ8lYpPlTeG1NRijyV2kueP6qrG0uvgyXhYkAjd4IypsxxkNJc1guFt10aChomzebnZy8KZThp754rw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) by SA0PR11MB4590.namprd11.prod.outlook.com (2603:10b6:806:96::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.26; Mon, 7 Nov 2022 07:12:37 +0000 Received: from MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::1780:8430:737b:b6aa]) by MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::1780:8430:737b:b6aa%5]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 07:12:37 +0000 Message-ID: Date: Mon, 7 Nov 2022 12:42:28 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH v2 1/3] app/testpmd: support congestion management CLIs Content-Language: en-US To: Andrew Rybchenko , Yuying Zhang , Cristian Dumitrescu CC: "dev@dpdk.org" , Sunil Kumar Kori References: <20220919124117.1059642-3-skori@marvell.com> <20220929095455.2173071-1-skori@marvell.com> <3a3012a6-d6a4-e109-a2b2-eadb1a7e1d3e@oktetlabs.ru> From: "Singh, Aman Deep" In-Reply-To: <3a3012a6-d6a4-e109-a2b2-eadb1a7e1d3e@oktetlabs.ru> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: PN2PR01CA0037.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:22::12) To MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR11MB0062:EE_|SA0PR11MB4590:EE_ X-MS-Office365-Filtering-Correlation-Id: 03b7ed8f-a716-4ccd-be1b-08dac08f72fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CP/6RPJ4RoDWRkl5TuRRD6u7pU0u416/ikERiA4THE53GbONZj+hSmEFEOC4oD1B0eE6uA8Lam7fyV4XoeeGNnh9o00S9SK8KcWwzPvJhgd2G8AWiDzN+SU8GCtr4Z7ckicbcu3fV6PYknKroMhuCQwc39uyNYBKW5wxb9Kt2P/rKEFP3a6ecwxl48VSB6kjQqgZSCNlZZCdSstcGlVHTRcw0gakHAwuw771ZSWS+HB/T/pW+nJnDog/77Hd6oFJaTjbv3/Mp8NMUn3xEUhBUK6MTCEWfMdyePq3ZtWI8Fe8kkm5lhdtx3tpYe9mHq0+hz6ragMXGsi191qlg44dXIZxGGZWnO7liDX5xaY8zknHU1Lxjv+o9aG0Z+55U+8tKLcZlM3p2Rry8PSvpmTa1kbhcAtOwg5CnFFL1GBxpe1Mq3XPddKjhQSYfF8SkVEfMF1QG88YmXbPrQeCs5r80K7Qh2jQUHhdk28pNHk0JGsbPK+HfpotEKKaDzxJa4rOeO4nYs/tq4qhlAKIDw8RsuNPaaykWVDgJkX7yZjsm8PBlxDel4kwx/nmaV0XE0W8xCIcZ2ZzFWVt/fTcAygevmCwcv31jqGFD/JsASLf5EwgRQcbKHyk25/Tnjtj8aaRTiwNZNDJhSD2jGtnyfZAHqPCF6kndKPMbFFW3pgUmoiDtVtaY8jTa+25nsJvMYYBdtJ0JCA+tM/MaX/p2sNFZDI/Z8hJP53dROdBFT/cszUQZm1Wld0JCXmAimK72he92KV1+3DV0MhZfIDJD2eaNl2UTozAbOURoxhfWWYNxAs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB0062.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(376002)(39860400002)(396003)(366004)(451199015)(6666004)(6512007)(26005)(6506007)(53546011)(186003)(2616005)(38100700002)(83380400001)(8936002)(2906002)(30864003)(54906003)(110136005)(6486002)(478600001)(6636002)(316002)(4326008)(8676002)(41300700001)(5660300002)(66476007)(66556008)(66946007)(82960400001)(86362001)(31696002)(36756003)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SUNBUEVadVZjdTlzRlNNMHhzUEttMlNpWGpwYVJ0SUx3c3J0eGlaT0FlNkl2?= =?utf-8?B?QVRIZEtsL2hyS1JKR3dIVTZ3b3NzdkdPOUw4MFNGTi9KaDlkRkFBMkI0Um4y?= =?utf-8?B?ZEZnNnVMUlZCUFdKUUc5SVVyNVR6Z1pqVUpZcEIvYktmT0hNaFlRbVIvTGtk?= =?utf-8?B?TnJZOERLK1dNOFdETW1mZlFPQ296UUMzNDlTeXJZa2JRMm9qd0pzRDlXNE9v?= =?utf-8?B?ZjJMcFJVS0hZamh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mJlTVlqS3MxVWRBMWdJRzZu?= =?utf-8?B?cnhIQ0RrMEs4WW5ZYjdYRkNIUGZOR0x2N1h3NVdJVGJ2VTZoTTRQVDlleXlC?= =?utf-8?B?V1VhMURJNU56UEllREo5aVJlMWZKelBHc3VXMnpjRmNBS0JjL2lkWlJud25I?= =?utf-8?B?Q1E9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 03b7ed8f-a716-4ccd-be1b-08dac08f72fc X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB0062.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 07:12:37.1806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0aYEiWAPmCF9nyeYT6vP7fNukNNKtyqEMxWzKxYHiXDyxHSoQLJEU7S/zMA5Xo3HRP2FTpG6W3hVKbMW7C/szWQyi/SckyKlGr5XKkSzyTs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4590 X-OriginatorOrg: intel.com 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 These newly added files for Congestion Management look in-line to Traffic Metering part, would like @Cristian to also have a look. Regards Aman On 11/6/2022 3:38 PM, Andrew Rybchenko wrote: > @Aman, @Yuying, please, help to review the patch. > > On 10/12/22 12:01, Sunil Kumar Kori wrote: >> Please review the following changes and provide feedback. >> >> Regards >> Sunil Kumar Kori >> >>> -----Original Message----- >>> From: skori@marvell.com >>> Sent: Thursday, September 29, 2022 3:25 PM >>> To: Aman Singh ; Yuying Zhang >>> >>> Cc: dev@dpdk.org; Sunil Kumar Kori >>> Subject: [PATCH v2 1/3] app/testpmd: support congestion management CLIs >>> >>> From: Sunil Kumar Kori >>> >>> Support congestion management CLIs. >>> >>> Depends-on: patch-24902 ("ethdev: support congestion management") >>> >>> Signed-off-by: Sunil Kumar Kori Acked-by: Aman Singh >>> --- >>> v1..v2: >>>   - Rebase on top of the dpdk-next-net-mrvl/for-next-net >>> >>>   app/test-pmd/cmdline.c                      |  15 + >>>   app/test-pmd/cmdline_cman.c                 | 390 >>> ++++++++++++++++++++ >>>   app/test-pmd/cmdline_cman.h                 |  12 + >>>   app/test-pmd/meson.build                    |   1 + >>>   doc/guides/testpmd_app_ug/testpmd_funcs.rst |  26 ++ >>>   5 files changed, 444 insertions(+) >>>   create mode 100644 app/test-pmd/cmdline_cman.c  create mode 100644 >>> app/test-pmd/cmdline_cman.h >>> >>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index >>> 51321de9ed..ce278eadb0 100644 >>> --- a/app/test-pmd/cmdline.c >>> +++ b/app/test-pmd/cmdline.c >>> @@ -60,6 +60,7 @@ >>>   #include >>>   #endif >>>   #include "testpmd.h" >>> +#include "cmdline_cman.h" >>>   #include "cmdline_mtr.h" >>>   #include "cmdline_tm.h" >>>   #include "bpf_cmd.h" >>> @@ -599,6 +600,17 @@ static void cmd_help_long_parsed(void >>> *parsed_result, >>>               "set port (port_id) fec_mode auto|off|rs|baser\n" >>>               "    set fec mode for a specific port\n\n" >>> >>> +            "show port cman capa (port_id)\n" >>> +            "    Show congestion management capabilities\n\n" >>> + >>> +            "show port cman config (port_id)\n" >>> +            "    Show congestion management configuration\n\n" >>> + >>> +            "set port cman config (port_id) (queue_id) default | " >>> +            "[obj (queue|queue_mempool) mode red >>> (min_thresh) " >>> +            "(max_thresh) (prob_inv)]\n" >>> +            "    Set congestion management configuration\n\n" >>> + >>>               , list_pkt_forwarding_modes() >>>           ); >>>       } >>> @@ -12990,6 +13002,9 @@ static cmdline_parse_ctx_t builtin_ctx[] = { >>>       (cmdline_parse_inst_t *)&cmd_show_capability, >>>       (cmdline_parse_inst_t *)&cmd_set_flex_is_pattern, >>>       (cmdline_parse_inst_t *)&cmd_set_flex_spec_pattern, >>> +    (cmdline_parse_inst_t *)&cmd_show_port_cman_capa, >>> +    (cmdline_parse_inst_t *)&cmd_show_port_cman_config, >>> +    (cmdline_parse_inst_t *)&cmd_set_port_cman_config, >>>       NULL, >>>   }; >>> >>> diff --git a/app/test-pmd/cmdline_cman.c b/app/test-pmd/cmdline_cman.c >>> new file mode 100644 index 0000000000..344759189d >>> --- /dev/null >>> +++ b/app/test-pmd/cmdline_cman.c >>> @@ -0,0 +1,390 @@ >>> +/* SPDX-License-Identifier: BSD-3-Clause >>> + * Copyright(C) 2022 Marvell International Ltd. >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> + >>> +#include >>> + >>> +#include "testpmd.h" >>> + >>> +#define PARSE_DELIMITER                " \f\n\r\t\v" >>> + >>> +static int >>> +parse_uint(uint64_t *value, const char *str) { >>> +    char *next = NULL; >>> +    uint64_t n; >>> + >>> +    errno = 0; >>> +    /* Parse number string */ >>> +    n = strtol(str, &next, 10); >>> +    if (errno != 0 || str == next || *next != '\0') >>> +        return -1; >>> + >>> +    *value = n; >>> + >>> +    return 0; >>> +} >>> + >>> +static int >>> +parse_cman_obj_str(char *str, uint64_t *obj) { >>> +    char *token; >>> + >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) >>> +        return 0; >>> + >>> +    if (strcasecmp(token, "queue") == 0) >>> +        *obj = RTE_ETH_CMAN_OBJ_RX_QUEUE; >>> +    else if (strcasecmp(token, "queue_mempool") == 0) >>> +        *obj = RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL; >>> +    else >>> +        return -1; >>> + >>> +    return 0; >>> +} >>> + >>> +static int >>> +parse_cman_mode_str(char *str, uint64_t *mode) { >>> +    char *token; >>> + >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) >>> +        return 0; >>> + >>> +    if (strcasecmp(token, "red") == 0) >>> +        *mode = RTE_CMAN_RED; >>> +    else >>> +        return -1; >>> + >>> +    return 0; >>> +} >>> + >>> +static int >>> +parse_cman_params_str(uint16_t port_id, char *str, >>> +              struct rte_eth_cman_config *cfg) { >>> +    uint64_t obj = 0, mode = 0, min_th = 0, max_th = 0, maxp_inv = 0; >>> +    struct rte_eth_cman_info info; >>> +    char *token; >>> +    int ret; >>> + >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (!strcasecmp(token, "default")) { >>> +        ret = rte_eth_cman_config_init(port_id, cfg); >>> +        if (ret) { >>> +            fprintf(stderr, "error in default initialization\n"); >>> +            return ret; >>> +        } >>> +        return 0; >>> +    } >>> + >>> +    /* First token: obj name */ >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) { >>> +        fprintf(stderr, "Object param parse error\n"); >>> +        goto error; >>> +    } >>> + >>> +    ret = parse_cman_obj_str(token, &obj); >>> +    if (ret) { >>> +        fprintf(stderr, "Object value is invalid\n"); >>> +        goto error; >>> +    } >>> + >>> +    /* Second token: mode name */ >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) { >>> +        fprintf(stderr, " Mode param is invalid\n"); >>> +        goto error; >>> +    } >>> + >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) { >>> +        fprintf(stderr, " Mode value is invalid\n"); >>> +        goto error; >>> +    } >>> + >>> +    ret = parse_cman_mode_str(token, &mode); >>> +    if (ret) { >>> +        fprintf(stderr, "mode string parse error\n"); >>> +        goto error; >>> +    } >>> + >>> +    /* Third token: minimum threshold */ >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) { >>> +        fprintf(stderr, "Minimum threshold parse error\n"); >>> +        goto error; >>> +    } >>> + >>> +    ret = parse_uint(&min_th, token); >>> +    if (ret != 0 || min_th > UINT8_MAX) { >>> +        fprintf(stderr, "Minimum threshold is invalid\n"); >>> +        goto error; >>> +    } >>> + >>> +    /* Fourth token: maximum threshold */ >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) { >>> +        fprintf(stderr, "Maximum threshold parse error\n"); >>> +        goto error; >>> +    } >>> + >>> +    ret = parse_uint(&max_th, token); >>> +    if (ret != 0 || max_th > UINT8_MAX) { >>> +        fprintf(stderr, "Maximum threshold is invalid\n"); >>> +        goto error; >>> +    } >>> + >>> +    /* Fifth token: probability inversion */ >>> +    token = strtok_r(str, PARSE_DELIMITER, &str); >>> +    if (token == NULL) { >>> +        fprintf(stderr, "Maximum probability inversion parse >>> error\n"); >>> +        goto error; >>> +    } >>> + >>> +    ret = parse_uint(&maxp_inv, token); >>> +    if (ret != 0 || maxp_inv == 0 || maxp_inv > UINT16_MAX) { >>> +        fprintf(stderr, "Maximum probability inversion is invalid\n"); >>> +        goto error; >>> +    } >>> + >>> +    memset(&info, 0, sizeof(struct rte_eth_cman_info)); >>> +    ret = rte_eth_cman_info_get(port_id, &info); >>> +    if (ret) { >>> +        fprintf(stderr, "Congestion management capa get error\n"); >>> +        goto error; >>> +    } >>> + >>> +    if (!(info.objs_supported & obj)) { >>> +        fprintf(stderr, "Object type is not supported by driver\n"); >>> +        goto error; >>> +    } >>> + >>> +    if (!(info.modes_supported & mode)) { >>> +        fprintf(stderr, "Mode is not supported by driver\n"); >>> +        goto error; >>> +    } >>> + >>> +    cfg->obj = obj; >>> +    cfg->mode = mode; >>> +    cfg->mode_param.red.min_th = min_th; >>> +    cfg->mode_param.red.max_th = max_th; >>> +    cfg->mode_param.red.maxp_inv = maxp_inv; >>> + >>> +    return 0; >>> + >>> +error: >>> +    return -EINVAL; >>> +} >>> + >>> +/* *** Show Port Congestion Management Capabilities *** */ struct >>> +cmd_show_port_cman_capa_result { >>> +    cmdline_fixed_string_t show; >>> +    cmdline_fixed_string_t port; >>> +    cmdline_fixed_string_t cman; >>> +    cmdline_fixed_string_t capa; >>> +    uint16_t port_id; >>> +}; >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_capa_show = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_capa_result, show, "show"); >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_capa_port = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_capa_result, port, "port"); >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_capa_cman = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_capa_result, cman, "cman"); >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_capa_capa = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_capa_result, capa, "capa"); >>> + >>> +static cmdline_parse_token_num_t cmd_show_port_cman_capa_port_id = >>> +    TOKEN_NUM_INITIALIZER( >>> +        struct cmd_show_port_cman_capa_result, port_id, >>> RTE_UINT16); >>> + >>> +static void cmd_show_port_cman_capa_parsed(void *parsed_result, >>> +    __rte_unused struct cmdline *cl, >>> +    __rte_unused void *data) >>> +{ >>> +    struct cmd_show_port_cman_capa_result *res = parsed_result; >>> +    uint16_t port_id = res->port_id; >>> +    struct rte_eth_cman_info info; >>> +    int ret; >>> + >>> +    memset(&info, 0, sizeof(struct rte_eth_cman_info)); >>> +    ret = rte_eth_cman_info_get(port_id, &info); >>> +    if (ret) >>> +        return; >>> + >>> +    printf("\n****   Port Congestion Management Capabilities >>> ****\n\n"); >>> +    printf("modes_supported 0x%" PRIx64 "\n", info.modes_supported); >>> +    printf("objs_supported 0x%" PRIx64 "\n", info.objs_supported); } >>> + >>> +cmdline_parse_inst_t cmd_show_port_cman_capa = { >>> +    .f = cmd_show_port_cman_capa_parsed, >>> +    .data = NULL, >>> +    .help_str = "show port cman capa ", >>> +    .tokens = { >>> +        (void *)&cmd_show_port_cman_capa_show, >>> +        (void *)&cmd_show_port_cman_capa_port, >>> +        (void *)&cmd_show_port_cman_capa_cman, >>> +        (void *)&cmd_show_port_cman_capa_capa, >>> +        (void *)&cmd_show_port_cman_capa_port_id, >>> +        NULL, >>> +    }, >>> +}; >>> + >>> +/* *** Show Port Congestion Management configuration *** */ struct >>> +cmd_show_port_cman_cfg_result { >>> +    cmdline_fixed_string_t show; >>> +    cmdline_fixed_string_t port; >>> +    cmdline_fixed_string_t cman; >>> +    cmdline_fixed_string_t cfg; >>> +    uint16_t port_id; >>> +}; >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_cfg_show = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_cfg_result, show, "show"); >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_cfg_port = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_cfg_result, port, "port"); >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_cfg_cman = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_cfg_result, cman, "cman"); >>> + >>> +static cmdline_parse_token_string_t cmd_show_port_cman_cfg_cfg = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_show_port_cman_cfg_result, cfg, "config"); >>> + >>> +static cmdline_parse_token_num_t cmd_show_port_cman_cfg_port_id = >>> +    TOKEN_NUM_INITIALIZER( >>> +        struct cmd_show_port_cman_cfg_result, port_id, >>> RTE_UINT16); >>> + >>> +static void cmd_show_port_cman_cfg_parsed(void *parsed_result, >>> +    __rte_unused struct cmdline *cl, >>> +    __rte_unused void *data) >>> +{ >>> +    struct cmd_show_port_cman_cfg_result *res = parsed_result; >>> +    uint16_t port_id = res->port_id; >>> +    struct rte_eth_cman_config cfg; >>> +    int ret; >>> + >>> +    memset(&cfg, 0, sizeof(struct rte_eth_cman_config)); >>> +    ret = rte_eth_cman_config_get(port_id, &cfg); >>> +    if (ret) >>> +        return; >>> + >>> +    printf("\n****   Port Congestion Management Configuration >>> ****\n\n"); >>> +    printf("cman object 0x%" PRIx32 "\n", cfg.obj); >>> +    printf("cman Rx queue %" PRIx16 "\n", cfg.obj_param.rx_queue); >>> +    printf("cman mode 0x%" PRIx32 "\n", cfg.mode); >>> +    printf("cman RED min thresh %" PRIx8 "\n", >>> cfg.mode_param.red.min_th); >>> +    printf("cman RED max thresh %" PRIx8 "\n", >>> cfg.mode_param.red.max_th); >>> +    printf("cman RED Prob inversion %" PRIx16 "\n", >>> +        cfg.mode_param.red.maxp_inv); >>> +} >>> + >>> +cmdline_parse_inst_t cmd_show_port_cman_config = { >>> +    .f = cmd_show_port_cman_cfg_parsed, >>> +    .data = NULL, >>> +    .help_str = "show port cman config ", >>> +    .tokens = { >>> +        (void *)&cmd_show_port_cman_cfg_show, >>> +        (void *)&cmd_show_port_cman_cfg_port, >>> +        (void *)&cmd_show_port_cman_cfg_cman, >>> +        (void *)&cmd_show_port_cman_cfg_cfg, >>> +        (void *)&cmd_show_port_cman_cfg_port_id, >>> +        NULL, >>> +    }, >>> +}; >>> + >>> +/* *** Set Port Congestion Management configuration *** */ struct >>> +cmd_set_port_cman_cfg_result { >>> +    cmdline_fixed_string_t set; >>> +    cmdline_fixed_string_t port; >>> +    cmdline_fixed_string_t cman; >>> +    cmdline_fixed_string_t cfg; >>> +    uint16_t port_id; >>> +    uint16_t qid; >>> +    cmdline_multi_string_t params; >>> +}; >>> + >>> +static cmdline_parse_token_string_t cmd_set_port_cman_cfg_set = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_set_port_cman_cfg_result, set, "set"); >>> + >>> +static cmdline_parse_token_string_t cmd_set_port_cman_cfg_port = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_set_port_cman_cfg_result, port, "port"); >>> + >>> +static cmdline_parse_token_string_t cmd_set_port_cman_cfg_cman = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_set_port_cman_cfg_result, cman, "cman"); >>> + >>> +static cmdline_parse_token_string_t cmd_set_port_cman_cfg_cfg = >>> +    TOKEN_STRING_INITIALIZER( >>> +        struct cmd_set_port_cman_cfg_result, cfg, "config"); >>> + >>> +static cmdline_parse_token_num_t cmd_set_port_cman_cfg_port_id = >>> +    TOKEN_NUM_INITIALIZER( >>> +        struct cmd_set_port_cman_cfg_result, port_id, RTE_UINT16); >>> + >>> +static cmdline_parse_token_num_t cmd_set_port_cman_cfg_qid = >>> +    TOKEN_NUM_INITIALIZER( >>> +        struct cmd_set_port_cman_cfg_result, qid, RTE_UINT16); >>> + >>> +static cmdline_parse_token_string_t cmd_set_port_cman_cfg_params = >>> +    TOKEN_STRING_INITIALIZER(struct cmd_set_port_cman_cfg_result, >>> +        params, TOKEN_STRING_MULTI); >>> + >>> +static void cmd_set_port_cman_cfg_parsed(void *parsed_result, >>> +    __rte_unused struct cmdline *cl, >>> +    __rte_unused void *data) >>> +{ >>> +    struct cmd_set_port_cman_cfg_result *res = parsed_result; >>> +    uint16_t port_id = res->port_id; >>> +    struct rte_eth_cman_config cfg; >>> +    int ret; >>> + >>> +    ret = parse_cman_params_str(port_id, res->params, &cfg); >>> +    if (ret) { >>> +        fprintf(stderr, "params string parse error\n"); >>> +        return; >>> +    } >>> + >>> +    cfg.obj_param.rx_queue = res->qid; >>> +    rte_eth_cman_config_set(port_id, &cfg); } >>> + >>> +cmdline_parse_inst_t cmd_set_port_cman_config = { >>> +    .f = cmd_set_port_cman_cfg_parsed, >>> +    .data = NULL, >>> +    .help_str = "set port cman config " >>> +            "default | [obj mode red " >>> +            " ]", >>> +    .tokens = { >>> +        (void *)&cmd_set_port_cman_cfg_set, >>> +        (void *)&cmd_set_port_cman_cfg_port, >>> +        (void *)&cmd_set_port_cman_cfg_cman, >>> +        (void *)&cmd_set_port_cman_cfg_cfg, >>> +        (void *)&cmd_set_port_cman_cfg_port_id, >>> +        (void *)&cmd_set_port_cman_cfg_qid, >>> +        (void *)&cmd_set_port_cman_cfg_params, >>> +        NULL, >>> +    }, >>> +}; >>> diff --git a/app/test-pmd/cmdline_cman.h b/app/test-pmd/cmdline_cman.h >>> new file mode 100644 index 0000000000..bd6c99ce35 >>> --- /dev/null >>> +++ b/app/test-pmd/cmdline_cman.h >>> @@ -0,0 +1,12 @@ >>> +/* SPDX-License-Identifier: BSD-3-Clause >>> + * Copyright(C) 2022 Marvell International Ltd. >>> + */ >>> + >>> +#ifndef _CMDLINE_CMAN_H_ >>> +#define _CMDLINE_CMAN_H_ >>> + >>> +extern cmdline_parse_inst_t cmd_show_port_cman_capa; extern >>> +cmdline_parse_inst_t cmd_show_port_cman_config; extern >>> +cmdline_parse_inst_t cmd_set_port_cman_config; >>> + >>> +#endif /* _CMDLINE_CMAN_H_ */ >>> diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index >>> 74399178dd..c03d9dfebb 100644 >>> --- a/app/test-pmd/meson.build >>> +++ b/app/test-pmd/meson.build >>> @@ -7,6 +7,7 @@ cflags += '-Wno-deprecated-declarations' >>>   sources = files( >>>           '5tswap.c', >>>           'cmdline.c', >>> +        'cmdline_cman.c', >>>           'cmdline_flow.c', >>>           'cmdline_mtr.c', >>>           'cmdline_tm.c', >>> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst >>> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst >>> index d3075bf87d..b9c7b468af 100644 >>> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst >>> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst >>> @@ -5317,6 +5317,32 @@ Flex pattern can be shared between ports. >>>      testpmd> flow create 0 ingress pattern eth / ipv4 / udp / flex >>> item is 3 >>> pattern is 2 / end actions mark id 1 / queue index 0 / end >>>      Flow rule #0 created >>> >>> +Congestion Management >>> +--------------------- >>> + >>> +Get capabilities >>> +~~~~~~~~~~~~~~~~ >>> + >>> +Retrieve congestion management capabilities supported by driver for >>> given >>> port. >>> +Below example command retrieves capabilities for port 0:: >>> + >>> +   testpmd> show port cman capa 0 >>> + >>> +Get configuration >>> +~~~~~~~~~~~~~~~~~ >>> +Retrieve congestion management configuration for given port. Below >>> +example command retrieves configuration for port 0:: >>> + >>> +   testpmd> show port cman config 0 >>> + >>> +Set configuration >>> +~~~~~~~~~~~~~~~~~ >>> +Configures congestion management settings on given queue or mempool >>> +associated with queue. Below example command configures RED as >>> +congestion management algo for port 0 and queue 0:: >>> + >>> +   testpmd> set port cman config 0 0 obj queue mode red 10 100 1 >>> + Rather than adding this section at the end can we put it near TM section 4.9 >>>   Driver specific commands >>>   ------------------------ >>> >>> -- >>> 2.25.1 >> >