From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0075.outbound.protection.outlook.com [104.47.32.75]) by dpdk.org (Postfix) with ESMTP id CFE542C5 for ; Fri, 17 Aug 2018 13:40:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WXn34hmXrV8lTm00nRZAFW6R20XfRj8CyHV7EM2JaXw=; b=c8nQ1ajyNafLos8aolhTFYEw8+ZYznGmvPZWQdDJRp+kqBz13WTs1mBs9GMXVZJJy98HONRBWuGmOQyrnlCXgMDkwpwl5nEqNuvRnAGKqEhPvm1m5O04JiqacX9KGnY5nY5Z3+Tp2QziMStpVKtyfI4JpdhmwvNaoy0jPaQKDlw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Krzysztof.Kanas@cavium.com; Received: from kk-box-0.semihalf.local (31.172.191.173) by BN6PR07MB2946.namprd07.prod.outlook.com (2603:10b6:404:42::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.21; Fri, 17 Aug 2018 11:40:30 +0000 From: Krzysztof Kanas To: dev@dpdk.org Cc: krzysztof.kanas@caviumnetworks.com, Jerin.JacobKollanukkaran@cavium.com, Nithin.Dabilpuram@cavium.com Date: Fri, 17 Aug 2018 13:39:19 +0200 Message-Id: <20180817113919.32095-1-krzysztof.kanas@caviumnetworks.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: CY4PR08CA0029.namprd08.prod.outlook.com (2603:10b6:903:151::15) To BN6PR07MB2946.namprd07.prod.outlook.com (2603:10b6:404:42::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3606c3ff-341d-4573-dc89-08d604363d3e X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BN6PR07MB2946; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB2946; 3:+Kl6OoZKxuA8v0dkhvp78pMblbW16OYMN1isAg5d+0cWSTbdfVSAi0zmtfRbIHplzpcoslLGp/9i5AUraszwhloh654inlYzpgHyyKQZF4VQFr5fVSXgRKjvTOXu+BRsttNuFV1cYsjXXomqKTd5cv10RmuBAYuWsQD+KrJ6Sl9T4Ky+UJqCusn1Z3aPsSLIJ/R6240QPO3srqopEWYoa81WZGzByytWT5XDd+CgTEHAHYdTZXhLFql8Rvs89Hjp; 25:bFoHdb9A8cXb54vwiUjoiNSbSaDeMdTCvlSOvUe8eOFmSuMj4Ye6OBYh0IOv0MXyCmEb87I7VCaxdB2l1D0/9b+EQ1iSY6dHfLii5qo9cZiTZRJAsdglFEQEQshHi5lydNG+g/hDRZkRXEG/4Rr+3JWU3x3XOQD3vFEFdNsYw2AWw5O5TivMCfHkmnhj7oNpL98aaL63D5p+rlHLIcxEwS8mddvcwN30Epv+NRRgGVrSrpQTaWTjGMBfy6PPWiAtwrfLNp1N7Mb+gAFptcqQk6lFZ41uhLtr1fTLxS6B4of7OzPiL+g2AZbexGSvii0mD/MRwNd41ACPZFzBN+/wRQ==; 31:tKd/tY9XJq/WbDqcboCPCA9uapxeNiuBx/VsZdHIDZrTDRZafdeE37lewhDRdhDV9c1TLw7g+xR1Me1okg/4Sn7fWvek8ik2j8R1emlCc3Yam/+a4c1/w513QdrKvHnCSnsDLwD+WYpYdAzSzKWD/4lF8pOnuT7rhanHKf5rWGjq7MrOHbS73TL1NgC07feGkbxmvSDio9MW1VqrprnfgIWTxudp8x5GxBFVlMVu57k= X-MS-TrafficTypeDiagnostic: BN6PR07MB2946: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB2946; 20:TRaPR1DTuyXCENfLDvBovS65ZRmz4gPw3wWvAtMJ6UT+31NcD6p44x460YHNUw+mAoTV4yqMjvVDMqLo79E6gP9X0U5cP5E4ZcwehJrlF1+HGf0/CS2pCe/gxfsoRJ/y5xK+JBe34KipO48aF9AAkBip7naofvZNlbR0AbLGRDVRwbbIFib0d4SGBgBZVIFdKZk/ZyiQnj5fvdhGfg8W91e7qUUkMG/N7jizMpRTMKeR2U93ZThoxj+52G0sCN3Ie9vd6ixZ3TKtv9Ye56F/OgyuB93wZogd8pRT222BaJXwqbswyV77JVulMhPUhUp5dxT3g4tHrC3D5F18Q0RO9LnzbEM3ZrqkBqLvOt93VsFdHOVNS87HX7jO7zfxOkSAJcUSyXfneY1bHgaMYzWH3lYFs0KazrAg41bRONr30uisfN2zWO2HSCCTSHIq6pUIPXLxQEtRIuja8yIf1C/47E+5jpDHgvIEbHI3QUcUNLnl3GqSPXRBG4218NKvIIviPxFLqEcWlG5XVVK1tViAWTfNUKNN9TvawcjRn+7KD95VEtHuPt63c1b8gXKskj+m2TAUBenb8NDZ+UHQtxmNz3+/RskCSd4RYgnnCvfqrZc=; 4:VQbeIFp8dQZ2sM90imP7WpuBigchSdYeQn3xL6wgKfqnYsScq2LjJ5N54l4z7F+9v+mDZfhCqzF0n89sA72ymXrH+QAXWH6P80pvuNN5BwR+I6BM2/9U2QDO/qsOK28zJVXwaxaw2i8c/jGAQPZZozhNGcoAnaRUkRmaOh5eNR3qjl9IZHvaWYikI90H2CXtEf21hfvtems2JYsPe2zZMVJfKsO5sttKekWp9ow72HCM6OChRNmaU/y3KE5dMxbOvh1RMqV/b2YwCDi++56yVA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(10201501046)(93006095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699016); SRVR:BN6PR07MB2946; BCL:0; PCL:0; RULEID:; SRVR:BN6PR07MB2946; X-Forefront-PRVS: 076777155F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(6486002)(478600001)(53936002)(72206003)(1076002)(6116002)(3846002)(51416003)(6512007)(8676002)(16586007)(81166006)(81156014)(5660300001)(305945005)(7736002)(6916009)(52116002)(97736004)(6666003)(316002)(2361001)(36756003)(106356001)(26005)(4326008)(44832011)(105586002)(8936002)(68736007)(107886003)(42882007)(186003)(486006)(16526019)(2351001)(1857600001)(2616005)(956004)(476003)(25786009)(2906002)(14444005)(50466002)(50226002)(66066001)(47776003)(386003)(6506007)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB2946; H:kk-box-0.semihalf.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB2946; 23:chTqGZaj9k8Q4xn/+1th22wDkSA3VcWfN9nRL7wKN?= =?us-ascii?Q?wzMX0EnmTvee7GZmPgfFFI5X892+oy6gI/AoXeDtFMNVrRwH1YN1RfU6bqe4?= =?us-ascii?Q?i/PyKhyyVi8omVUAMk2f2NYfZO5xJOp1ijTe4hdvzmhnekYe5P1sAPKwkWhy?= =?us-ascii?Q?LrzddVOMduTzrpfGKeIcWJI3pijwQK+8qEu+z/dstCwn38rwcYDHjMutn/Iz?= =?us-ascii?Q?lySMJpT6k44zDXfuos4f6nFbGnZBQvQZxUHh7sSFccKE9mcexfAX0ABSDIhW?= =?us-ascii?Q?e9p/8rA+zO35LfICI0nHmKAd35Kv6s5uTHp12dTCcTbTSozZJI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crFYXtbWprSBthi8/HWC73wOOS5oka7tiyPMgz+fBBpzvOT07yppx5tcAHrOz46EZw6mWzhB5GGt8Lkyn8K54=; 7:MkyT+5nI2MlUv4IWVbOfRAk7nzQGT7m1ob5GyDOR/GeSZZasLfOhimySDOdC7zvSKYFkoN15TAeW7/Z3YvAUy98OVe3jRPrUBj+zWguK/QV2DTaLS3MaK+esqsxyfDv5qNjd2fitW0Zdk0iPlNgMkVLmwzvknjH8hd9lk99IATA3COMVkszag7dUBfhicpB6Q4m16l/p4wTpScsvlt9rZZiy3wS8dSb89YzbEF9pE7h0V8SR8cyjNGTxedyydz5j SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2018 11:40:30.9122 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3606c3ff-341d-4573-dc89-08d604363d3e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB2946 Subject: [dpdk-dev] [PATCH] app/testpmd: add commands for TM to mark pkts X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 11:40:35 -0000 Add following testpmd run-time commands to support test of TM packet marking: set port tm mark ip_ecn set port tm mark ip_dscp set port tm mark vlan_dei Signed-off-by: Krzysztof Kanas --- app/test-pmd/cmdline.c | 3 + app/test-pmd/cmdline_tm.c | 260 ++++++++++++++++++++ app/test-pmd/cmdline_tm.h | 3 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 57 +++++ 4 files changed, 323 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 589121d69cca..327014ddff9d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17854,6 +17854,9 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_suspend_port_tm_node, (cmdline_parse_inst_t *)&cmd_resume_port_tm_node, (cmdline_parse_inst_t *)&cmd_port_tm_hierarchy_commit, + (cmdline_parse_inst_t *)&cmd_port_tm_mark_ip_ecn, + (cmdline_parse_inst_t *)&cmd_port_tm_mark_ip_dscp, + (cmdline_parse_inst_t *)&cmd_port_tm_mark_vlan_dei, (cmdline_parse_inst_t *)&cmd_cfg_tunnel_udp_port, (cmdline_parse_inst_t *)&cmd_rx_offload_get_capa, (cmdline_parse_inst_t *)&cmd_rx_offload_get_configuration, diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index 631f1799579c..b4307974695b 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -2187,3 +2187,263 @@ cmdline_parse_inst_t cmd_port_tm_hierarchy_commit = { NULL, }, }; + +/* *** Port TM Mark IP ECN *** */ +struct cmd_port_tm_mark_ip_ecn_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t port; + cmdline_fixed_string_t tm; + cmdline_fixed_string_t mark; + cmdline_fixed_string_t ip_ecn; + uint16_t port_id; + uint16_t green; + uint16_t yellow; + uint16_t red; +}; + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_set = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + set, "set"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_port = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + port, "port"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_tm = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, tm, + "tm"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_mark = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + mark, "mark"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_ip_ecn = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + ip_ecn, "ip_ecn"); +cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + port_id, UINT16); + +cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_green = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + green, UINT16); +cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_yellow = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + yellow, UINT16); +cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_red = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, + red, UINT16); + +static void cmd_port_tm_mark_ip_ecn_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_port_tm_mark_ip_ecn_result *res = parsed_result; + struct rte_tm_error error; + portid_t port_id = res->port_id; + int green = res->green; + int yellow = res->yellow; + int red = res->red; + int ret; + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + memset(&error, 0, sizeof(struct rte_tm_error)); + ret = rte_tm_mark_ip_ecn(port_id, green, yellow, red, &error); + if (ret != 0) { + print_err_msg(&error); + return; + } +} + +cmdline_parse_inst_t cmd_port_tm_mark_ip_ecn = { + .f = cmd_port_tm_mark_ip_ecn_parsed, + .data = NULL, + .help_str = "set port tm mark ip_ecn ", + .tokens = { + (void *)&cmd_port_tm_mark_ip_ecn_set, + (void *)&cmd_port_tm_mark_ip_ecn_port, + (void *)&cmd_port_tm_mark_ip_ecn_tm, + (void *)&cmd_port_tm_mark_ip_ecn_mark, + (void *)&cmd_port_tm_mark_ip_ecn_ip_ecn, + (void *)&cmd_port_tm_mark_ip_ecn_port_id, + (void *)&cmd_port_tm_mark_ip_ecn_green, + (void *)&cmd_port_tm_mark_ip_ecn_yellow, + (void *)&cmd_port_tm_mark_ip_ecn_red, + NULL, + }, +}; + + +/* *** Port TM Mark IP DSCP *** */ +struct cmd_port_tm_mark_ip_dscp_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t port; + cmdline_fixed_string_t tm; + cmdline_fixed_string_t mark; + cmdline_fixed_string_t ip_dscp; + uint16_t port_id; + uint16_t green; + uint16_t yellow; + uint16_t red; +}; + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_set = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + set, "set"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_port = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + port, "port"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_tm = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, tm, + "tm"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_mark = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + mark, "mark"); + +cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_ip_dscp = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + ip_dscp, "ip_dscp"); +cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + port_id, UINT16); + +cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_green = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + green, UINT16); +cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_yellow = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + yellow, UINT16); +cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_red = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, + red, UINT16); + +static void cmd_port_tm_mark_ip_dscp_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_port_tm_mark_ip_dscp_result *res = parsed_result; + struct rte_tm_error error; + portid_t port_id = res->port_id; + int green = res->green; + int yellow = res->yellow; + int red = res->red; + int ret; + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + memset(&error, 0, sizeof(struct rte_tm_error)); + ret = rte_tm_mark_ip_dscp(port_id, green, yellow, red, &error); + if (ret != 0) { + print_err_msg(&error); + return; + } +} + +cmdline_parse_inst_t cmd_port_tm_mark_ip_dscp = { + .f = cmd_port_tm_mark_ip_dscp_parsed, + .data = NULL, + .help_str = "set port tm mark ip_dscp ", + .tokens = { + (void *)&cmd_port_tm_mark_ip_dscp_set, + (void *)&cmd_port_tm_mark_ip_dscp_port, + (void *)&cmd_port_tm_mark_ip_dscp_tm, + (void *)&cmd_port_tm_mark_ip_dscp_mark, + (void *)&cmd_port_tm_mark_ip_dscp_ip_dscp, + (void *)&cmd_port_tm_mark_ip_dscp_port_id, + (void *)&cmd_port_tm_mark_ip_dscp_green, + (void *)&cmd_port_tm_mark_ip_dscp_yellow, + (void *)&cmd_port_tm_mark_ip_dscp_red, + NULL, + }, +}; + + +/* *** Port TM Mark VLAN_DEI *** */ +struct cmd_port_tm_mark_vlan_dei_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t port; + cmdline_fixed_string_t tm; + cmdline_fixed_string_t mark; + cmdline_fixed_string_t vlan_dei; + uint16_t port_id; + uint16_t green; + uint16_t yellow; + uint16_t red; +}; + +cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_set = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + set, "set"); + +cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_port = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + port, "port"); + +cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_tm = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, tm, + "tm"); + +cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_mark = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + mark, "mark"); + +cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_vlan_dei = + TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + vlan_dei, "vlan_dei"); +cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + port_id, UINT16); + +cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_green = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + green, UINT16); +cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_yellow = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + yellow, UINT16); +cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_red = + TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, + red, UINT16); + +static void cmd_port_tm_mark_vlan_dei_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_port_tm_mark_vlan_dei_result *res = parsed_result; + struct rte_tm_error error; + portid_t port_id = res->port_id; + int green = res->green; + int yellow = res->yellow; + int red = res->red; + int ret; + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + memset(&error, 0, sizeof(struct rte_tm_error)); + ret = rte_tm_mark_vlan_dei(port_id, green, yellow, red, &error); + if (ret != 0) { + print_err_msg(&error); + return; + } +} + +cmdline_parse_inst_t cmd_port_tm_mark_vlan_dei = { + .f = cmd_port_tm_mark_vlan_dei_parsed, + .data = NULL, + .help_str = "set port tm mark vlan_dei ", + .tokens = { + (void *)&cmd_port_tm_mark_vlan_dei_set, + (void *)&cmd_port_tm_mark_vlan_dei_port, + (void *)&cmd_port_tm_mark_vlan_dei_tm, + (void *)&cmd_port_tm_mark_vlan_dei_mark, + (void *)&cmd_port_tm_mark_vlan_dei_vlan_dei, + (void *)&cmd_port_tm_mark_vlan_dei_port_id, + (void *)&cmd_port_tm_mark_vlan_dei_green, + (void *)&cmd_port_tm_mark_vlan_dei_yellow, + (void *)&cmd_port_tm_mark_vlan_dei_red, + NULL, + }, +}; diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h index b3a14ade6348..950cb7538911 100644 --- a/app/test-pmd/cmdline_tm.h +++ b/app/test-pmd/cmdline_tm.h @@ -25,5 +25,8 @@ extern cmdline_parse_inst_t cmd_set_port_tm_node_parent; extern cmdline_parse_inst_t cmd_suspend_port_tm_node; extern cmdline_parse_inst_t cmd_resume_port_tm_node; extern cmdline_parse_inst_t cmd_port_tm_hierarchy_commit; +extern cmdline_parse_inst_t cmd_port_tm_mark_vlan_dei; +extern cmdline_parse_inst_t cmd_port_tm_mark_ip_ecn; +extern cmdline_parse_inst_t cmd_port_tm_mark_ip_dscp; #endif /* _CMDLINE_TM_H_ */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index dde205a2bb43..4bc01b50bf89 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2656,6 +2656,63 @@ where: call failure. On the other hand, hierarchy is preserved when this parameter is equal to zero. +Set port traffic management mark VLAN dei +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Enables/Disables the traffic management marking on the port for VLAN packets:: + + testpmd> set port tm mark vlan_dei + +where: + +* ``port_id``: The port which on which VLAN packets marked as ``green`` or + ``yellow`` or ``red`` will have dei bit enabled + +* ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green + +* ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow + +* ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red + +Set port traffic management mark IP dscp +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Enables/Disables the traffic management marking on the port for IP dscp packets:: + + testpmd> set port tm mark ip_dscp + +where: + +* ``port_id``: The port which on which IP packets marked as ``green`` or + ``yellow`` or ``red`` will have IP dscp bits updated + +* ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets + +* ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets + +* ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets + +Set port traffic management mark IP ecn +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Enables/Disables the traffic management marking on the port for IP ecn packets:: + + testpmd> set port tm mark ip_ecn + +where: + +* ``port_id``: The port which on which IP packets marked as ``green`` or + ``yellow`` or ``red`` will have IP ecn bits updated + +* ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01 or 2'b10 + to ecn of 2'b11 when IP is caring TCP or SCTP + +* ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10 + to ecn of 2'b11 when IP is caring TCP or SCTP + +* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10 + to ecn of 2'b11 when IP is caring TCP or SCTP + Set port traffic management default hierarchy (softnic forwarding mode) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.18.0