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 28A60A0524; Tue, 13 Apr 2021 18:00:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4DCA161142; Tue, 13 Apr 2021 18:00:53 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id DCA19161141 for ; Tue, 13 Apr 2021 18:00:52 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from lizh@nvidia.com) with SMTP; 13 Apr 2021 19:00:50 +0300 Received: from nvidia.com (c-235-17-1-009.mtl.labs.mlnx [10.235.17.9]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 13DG0n8j018509; Tue, 13 Apr 2021 19:00:49 +0300 From: Li Zhang To: dekelp@nvidia.com, orika@nvidia.com, viacheslavo@nvidia.com, matan@nvidia.com, shahafs@nvidia.com, cristian.dumitrescu@intel.com, lironh@marvell.com, jerinj@marvell.com, ferruh.yigit@intel.com, ajit.khaparde@broadcom.com, Xiaoyun Li Cc: dev@dpdk.org, thomas@monjalon.net, rasland@nvidia.com, roniba@nvidia.com Date: Tue, 13 Apr 2021 18:59:55 +0300 Message-Id: <20210413155958.2024584-3-lizh@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210413155958.2024584-1-lizh@nvidia.com> References: <20210331085405.1445546-1-lizh@nvidia.com> <20210413155958.2024584-1-lizh@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 2/4] app/testpmd: add meter profile packet mode option 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 Sender: "dev" add meter profile packet_mode to the ethernet device. One example: add port meter profile rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs) (packet_mode) Signed-off-by: Li Zhang Acked-by: Matan Azrad --- app/test-pmd/cmdline.c | 6 ++-- app/test-pmd/cmdline_mtr.c | 40 +++++++++++++++++++-- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++-------- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 56cf0bf405..ec98ccc652 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -693,13 +693,13 @@ static void cmd_help_long_parsed(void *parsed_result, "show port meter cap (port_id)\n" " Show port meter capability information\n\n" - "add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs)\n" + "add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs) (packet_mode)\n" " meter profile add - srtcm rfc 2697\n\n" - "add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs)\n" + "add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs) (packet_mode)\n" " meter profile add - trtcm rfc 2698\n\n" - "add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n" + "add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs) (packet_mode)\n" " meter profile add - trtcm rfc 4115\n\n" "del port meter profile (port_id) (profile_id)\n" diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index 3982787d20..4d9bfde78d 100644 --- a/app/test-pmd/cmdline_mtr.c +++ b/app/test-pmd/cmdline_mtr.c @@ -306,6 +306,18 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result, cap.policer_action_recolor_supported); printf("cap.policer_action_drop_supported %" PRId32 "\n", cap.policer_action_drop_supported); + printf("cap.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n", + cap.srtcm_rfc2697_byte_mode_supported); + printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n", + cap.srtcm_rfc2697_packet_mode_supported); + printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n", + cap.trtcm_rfc2698_byte_mode_supported); + printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n", + cap.trtcm_rfc2698_packet_mode_supported); + printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n", + cap.trtcm_rfc4115_byte_mode_supported); + printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n", + cap.trtcm_rfc4115_packet_mode_supported); printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask); } @@ -335,6 +347,7 @@ struct cmd_add_port_meter_profile_srtcm_result { uint64_t cir; uint64_t cbs; uint64_t ebs; + int packet_mode; }; cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add = @@ -376,6 +389,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_ebs = TOKEN_NUM_INITIALIZER( struct cmd_add_port_meter_profile_srtcm_result, ebs, RTE_UINT64); +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_packet_mode = + TOKEN_NUM_INITIALIZER( + struct cmd_add_port_meter_profile_srtcm_result, + packet_mode, RTE_UINT32); static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result, __rte_unused struct cmdline *cl, @@ -397,6 +414,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result, mp.srtcm_rfc2697.cir = res->cir; mp.srtcm_rfc2697.cbs = res->cbs; mp.srtcm_rfc2697.ebs = res->ebs; + mp.packet_mode = res->packet_mode; ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error); if (ret != 0) { @@ -408,7 +426,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result, cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = { .f = cmd_add_port_meter_profile_srtcm_parsed, .data = NULL, - .help_str = "add port meter profile srtcm_rfc2697 ", + .help_str = "add port meter profile srtcm_rfc2697 ", .tokens = { (void *)&cmd_add_port_meter_profile_srtcm_add, (void *)&cmd_add_port_meter_profile_srtcm_port, @@ -420,6 +438,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = { (void *)&cmd_add_port_meter_profile_srtcm_cir, (void *)&cmd_add_port_meter_profile_srtcm_cbs, (void *)&cmd_add_port_meter_profile_srtcm_ebs, + (void *)&cmd_add_port_meter_profile_srtcm_packet_mode, NULL, }, }; @@ -437,6 +456,7 @@ struct cmd_add_port_meter_profile_trtcm_result { uint64_t pir; uint64_t cbs; uint64_t pbs; + int packet_mode; }; cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add = @@ -482,6 +502,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_pbs = TOKEN_NUM_INITIALIZER( struct cmd_add_port_meter_profile_trtcm_result, pbs, RTE_UINT64); +cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_packet_mode = + TOKEN_NUM_INITIALIZER( + struct cmd_add_port_meter_profile_trtcm_result, + packet_mode, RTE_UINT32); static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result, __rte_unused struct cmdline *cl, @@ -504,6 +528,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result, mp.trtcm_rfc2698.pir = res->pir; mp.trtcm_rfc2698.cbs = res->cbs; mp.trtcm_rfc2698.pbs = res->pbs; + mp.packet_mode = res->packet_mode; ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error); if (ret != 0) { @@ -515,7 +540,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result, cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = { .f = cmd_add_port_meter_profile_trtcm_parsed, .data = NULL, - .help_str = "add port meter profile trtcm_rfc2698 ", + .help_str = "add port meter profile trtcm_rfc2698 ", .tokens = { (void *)&cmd_add_port_meter_profile_trtcm_add, (void *)&cmd_add_port_meter_profile_trtcm_port, @@ -528,6 +553,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = { (void *)&cmd_add_port_meter_profile_trtcm_pir, (void *)&cmd_add_port_meter_profile_trtcm_cbs, (void *)&cmd_add_port_meter_profile_trtcm_pbs, + (void *)&cmd_add_port_meter_profile_trtcm_packet_mode, NULL, }, }; @@ -545,6 +571,7 @@ struct cmd_add_port_meter_profile_trtcm_rfc4115_result { uint64_t eir; uint64_t cbs; uint64_t ebs; + int packet_mode; }; cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_rfc4115_add = @@ -592,6 +619,11 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_rfc4115_ebs = TOKEN_NUM_INITIALIZER( struct cmd_add_port_meter_profile_trtcm_rfc4115_result, ebs, RTE_UINT64); +cmdline_parse_token_num_t + cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode = + TOKEN_NUM_INITIALIZER( + struct cmd_add_port_meter_profile_trtcm_rfc4115_result, + packet_mode, RTE_UINT32); static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed( void *parsed_result, @@ -616,6 +648,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed( mp.trtcm_rfc4115.eir = res->eir; mp.trtcm_rfc4115.cbs = res->cbs; mp.trtcm_rfc4115.ebs = res->ebs; + mp.packet_mode = res->packet_mode; ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error); if (ret != 0) { @@ -627,7 +660,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed( cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = { .f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed, .data = NULL, - .help_str = "add port meter profile trtcm_rfc4115 ", + .help_str = "add port meter profile trtcm_rfc4115 ", .tokens = { (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add, (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port, @@ -640,6 +673,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = { (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir, (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs, (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs, + (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode, NULL, }, }; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 36f0a328a5..5785e94aeb 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2716,14 +2716,15 @@ add port meter profile (srTCM rfc2967) Add meter profile (srTCM rfc2697) to the ethernet device:: testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \ - (cir) (cbs) (ebs) + (cir) (cbs) (ebs) (packet_mode) where: * ``profile_id``: ID for the meter profile. -* ``cir``: Committed Information Rate (CIR) (bytes/second). -* ``cbs``: Committed Burst Size (CBS) (bytes). -* ``ebs``: Excess Burst Size (EBS) (bytes). +* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second). +* ``cbs``: Committed Burst Size (CBS) (bytes or packets). +* ``ebs``: Excess Burst Size (EBS) (bytes or packets). +* ``packet_mode``: Packets mode for meter profile. add port meter profile (trTCM rfc2968) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2731,15 +2732,16 @@ add port meter profile (trTCM rfc2968) Add meter profile (srTCM rfc2698) to the ethernet device:: testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \ - (cir) (pir) (cbs) (pbs) + (cir) (pir) (cbs) (pbs) (packet_mode) where: * ``profile_id``: ID for the meter profile. -* ``cir``: Committed information rate (bytes/second). -* ``pir``: Peak information rate (bytes/second). -* ``cbs``: Committed burst size (bytes). -* ``pbs``: Peak burst size (bytes). +* ``cir``: Committed information rate (bytes per second or packets per second). +* ``pir``: Peak information rate (bytes per second or packets per second). +* ``cbs``: Committed burst size (bytes or packets). +* ``pbs``: Peak burst size (bytes or packets). +* ``packet_mode``: Packets mode for meter profile. add port meter profile (trTCM rfc4115) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2747,15 +2749,16 @@ add port meter profile (trTCM rfc4115) Add meter profile (trTCM rfc4115) to the ethernet device:: testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \ - (cir) (eir) (cbs) (ebs) + (cir) (eir) (cbs) (ebs) (packet_mode) where: * ``profile_id``: ID for the meter profile. -* ``cir``: Committed information rate (bytes/second). -* ``eir``: Excess information rate (bytes/second). -* ``cbs``: Committed burst size (bytes). -* ``ebs``: Excess burst size (bytes). +* ``cir``: Committed information rate (bytes per second or packets per second). +* ``eir``: Excess information rate (bytes per second or packets per second). +* ``cbs``: Committed burst size (bytes or packets). +* ``ebs``: Excess burst size (bytes or packets). +* ``packet_mode``: Packets mode for meter profile. delete port meter profile ~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.27.0