From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by dpdk.org (Postfix) with ESMTP id CCE5B1B363 for ; Tue, 30 Jan 2018 08:37:22 +0100 (CET) Received: by mail-lf0-f65.google.com with SMTP id 63so13823158lfv.4 for ; Mon, 29 Jan 2018 23:37:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=R0pBlpLWX6I5BezKTezc5j1LQX70g1jrD+OSXvgvK/4=; b=TfXX63Lo9oKGApWZQloWong1mw7sbu1dtEiNUopA1WU8WvFg3V8gNka88Fz66bk9Ro sPKD1hKPrQ8dwSYxIbr6zTfE//KG2W+DtsnJ6PCDMzI1xJJLFhASBLbMf50TzxfKlRda WGBrb9xwVlKDL6IqgJ9Yhxb49H2adWxJZam9ovaYTtcyjQN4jQeCkq4RUt6hhEOykD8e XGnXG38GjFLRy1h0Vcuy2sLw+OOJeyE7X1atW6YRTUj9UhLBibCUjbtqEugclsn10Rrg tfZ3gQbCYAJIbJxrGmfn5YJr2WHAOT5XNvn3Ir9fWSYbC2fTAf1nePvl3UY6xyyfSODB V7JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=R0pBlpLWX6I5BezKTezc5j1LQX70g1jrD+OSXvgvK/4=; b=ts6ok46LpDVXcZaS/9vj9PtqzYV2Ok6tUEhJVCRdeK1Dgy7Z9Ka7rQ9Xqa+mijhEqP TZ8HvTGBoZFgoRZ5lzZMPvJWArCwagNNbTzFVCMy4IPuAxHRFNrWdcVOtom7Uscq4tiF GnhbG1PKO/Rae40ZNS42xaQ2Qn+QFYFlorcTSCuanGffxb/p0UxP0z4wA0LdeF5dPHJe Gjhpjk9aMnfuGhfmxMrzI+TTKoJVXUwPPG4oP2BezOy5eKtoJq5qEjWWYiab9fcPZAyw W6GI1oHlcUk4Yei6bpmiD9+NjyCiIkAxUnws/KosexbeN/5x7GqGbGRrR0LU8zT17W2t h1og== X-Gm-Message-State: AKwxytepNq6KjFQGMgSkg3XNVkNk4t71/HnUOpz043sjoEtcpcAzc2Do 778/Iwn4Ur39pzpsBbMtCnQHr5w8BjI= X-Google-Smtp-Source: AH8x225a/sbZuqgF4ZF2HGTJUDqJY11Ma1tPoL5U4PDjF97avqV8PTBknKkR0klZfGrX6L8gjqIkXg== X-Received: by 10.25.168.141 with SMTP id r135mr16362875lfe.80.1517297841484; Mon, 29 Jan 2018 23:37:21 -0800 (PST) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id x62sm349658ljb.69.2018.01.29.23.37.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Jan 2018 23:37:20 -0800 (PST) From: Tomasz Duszynski To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, Tomasz Duszynski Date: Tue, 30 Jan 2018 08:37:08 +0100 Message-Id: <1517297828-3111-1-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] app/testpmd: allow setting shaper profile id to none 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: Tue, 30 Jan 2018 07:37:23 -0000 Private shaper profiles are attached to nodes defined in traffic manager hierarchy. Since not every node must have a configured shaper testpmd should allow setting shaper profile id to invalid (RTE_TM_SHAPER_PROFILE_ID_NONE) easily. This patch follows same approach as in case of setting parent id of the root node i.e passing a negative value sets node id to RTE_TM_NODE_ID_NULL. In case of private shaper profile negative value will set shaper profile id to RTE_TM_SHAPER_PROFILE_ID_NONE. Signed-off-by: Tomasz Duszynski --- app/test-pmd/cmdline_tm.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index 35cad54..9859c3d 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -1500,7 +1500,7 @@ struct cmd_add_port_tm_nonleaf_node_result { uint32_t priority; uint32_t weight; uint32_t level_id; - uint32_t shaper_profile_id; + int32_t shaper_profile_id; uint32_t n_sp_priorities; uint64_t stats_mask; cmdline_multi_string_t multi_shared_shaper_id; @@ -1542,7 +1542,7 @@ cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_level_id = level_id, UINT32); cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_shaper_profile_id = TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_result, - shaper_profile_id, UINT32); + shaper_profile_id, INT32); cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_n_sp_priorities = TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_result, n_sp_priorities, UINT32); @@ -1593,7 +1593,11 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result, return; } - np.shaper_profile_id = res->shaper_profile_id; + if (res->shaper_profile_id < 0) + np.shaper_profile_id = UINT32_MAX; + else + np.shaper_profile_id = res->shaper_profile_id; + np.n_shared_shapers = n_shared_shapers; if (np.n_shared_shapers) np.shared_shaper_id = &shared_shaper_id[0]; @@ -1651,7 +1655,7 @@ struct cmd_add_port_tm_leaf_node_result { uint32_t priority; uint32_t weight; uint32_t level_id; - uint32_t shaper_profile_id; + int32_t shaper_profile_id; uint32_t cman_mode; uint32_t wred_profile_id; uint64_t stats_mask; @@ -1693,7 +1697,7 @@ cmdline_parse_token_num_t cmd_add_port_tm_leaf_node_level_id = level_id, UINT32); cmdline_parse_token_num_t cmd_add_port_tm_leaf_node_shaper_profile_id = TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_leaf_node_result, - shaper_profile_id, UINT32); + shaper_profile_id, INT32); cmdline_parse_token_num_t cmd_add_port_tm_leaf_node_cman_mode = TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_leaf_node_result, cman_mode, UINT32); @@ -1747,7 +1751,11 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result, return; } - np.shaper_profile_id = res->shaper_profile_id; + if (res->shaper_profile_id < 0) + np.shaper_profile_id = UINT32_MAX; + else + np.shaper_profile_id = res->shaper_profile_id; + np.n_shared_shapers = n_shared_shapers; if (np.n_shared_shapers) -- 2.7.4