From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 3EF511B90D for ; Thu, 10 Jan 2019 17:37:20 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 08:37:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,462,1539673200"; d="scan'208";a="108890624" Received: from unknown (HELO broadwell-dev-4.localdomain) ([10.224.122.193]) by orsmga008.jf.intel.com with ESMTP; 10 Jan 2019 08:37:16 -0800 From: Nikhil Rao To: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, dev@dpdk.org, Nikhil Rao Date: Thu, 10 Jan 2019 22:05:33 +0530 Message-Id: <1547138133-54919-1-git-send-email-nikhil.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543470882-145287-1-git-send-email-nikhil.rao@intel.com> References: <1543470882-145287-1-git-send-email-nikhil.rao@intel.com> Subject: [dpdk-dev] [PATCH v2] ethdev: support double precision RED queue weight 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: Thu, 10 Jan 2019 16:37:20 -0000 RED queue weight is currently specified as a negated log of 2. Add support for RED queue weight to be specified in double precision and TM capability flags for double precision and negated log2 RED queue weight support. Update the softnic PMD and testpmd for the new tm capability flags and the struct rte_tm_red_params::wq_is_log2 flag. Signed-off-by: Nikhil Rao --- lib/librte_ethdev/rte_tm.h | 40 ++++++++++++++++++++++++++++++-- app/test-pmd/cmdline_tm.c | 8 ++++++- drivers/net/softnic/rte_eth_softnic_tm.c | 7 ++++-- 3 files changed, 50 insertions(+), 5 deletions(-) v2: * added RTE_STD_C11 for anonymnous union * testpmd: added cman_wred_wq_log2/wq_dp_supported to "show port tm cap" cli command * testpmd: set wq_is_log2 for WRED profiles added on testpmd cli Cristian, I assume the testpmd changes will be upstreamed via the dpdk-next-qos tree. diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h index c4a788b..4fad31b 100644 --- a/lib/librte_ethdev/rte_tm.h +++ b/lib/librte_ethdev/rte_tm.h @@ -391,6 +391,22 @@ struct rte_tm_capabilities { */ int cman_wred_byte_mode_supported; + /** Double precision RED queue weight support. When non-zero, this + * this parameter indicates that RED queue weight in double precision + * format is supported. + * @see struct rte_tm_red_params::wq_is_log2 + * @see struct rte_tm_red_params::wq_dp + */ + int cman_wred_wq_dp_supported; + + /** Negated log2 RED queue weight support. When non-zero, this + * parameter indicates that RED queue weight in negated log2 format + * is supported. + * @see struct rte_tm_red_params::wq_is_log2 + * @see struct rte_tm_red_params::wq_log2 + */ + int cman_wred_wq_log2_supported; + /** Head drop algorithm support. When non-zero, this parameter * indicates that there is at least one leaf node that supports the head * drop algorithm, which might not be true for all the leaf nodes. @@ -839,8 +855,28 @@ struct rte_tm_red_params { */ uint16_t maxp_inv; - /** Negated log2 of queue weight (wq), i.e. wq = 1 / (2 ^ wq_log2) */ - uint16_t wq_log2; + /** When non-zero, RED queue weight (wq) is negated log2 of queue + * weight + * + * @see struct rte_tm_capabilities::cman_wred_wq_dp_supported + * @see struct rte_tm_capabilities::cman_wred_wq_log2_supported + */ + int wq_is_log2; + + RTE_STD_C11 + union { + /** Double precision queue weight + * + * @see struct rte_tm_capabilities::cman_wred_wq_dp_supported + */ + double wq_dp; + /** Negated log2 of queue weight (wq), + * i.e. wq = 1 / (2 ^ wq_log2) + * + * @see struct rte_tm_capabilities::cman_wred_wq_log2_supported + */ + uint16_t wq_log2; + }; }; /** diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index 1012084..afc1d63 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -283,6 +283,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result, cap.sched_wfq_n_groups_max); printf("cap.sched_wfq_weight_max %" PRIu32 "\n", cap.sched_wfq_weight_max); + printf("cap.cman_wred_wq_dp_supported %" PRId32 "\n", + cap.cman_wred_wq_dp_supported); + printf("cap.cman_wred_wq_log2_supported %" PRId32 "\n", + cap.cman_wred_wq_log2_supported); printf("cap.cman_head_drop_supported %" PRId32 "\n", cap.cman_head_drop_supported); printf("cap.cman_wred_context_n_max %" PRIu32 "\n", @@ -1285,7 +1289,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result, wp.red_params[color].max_th = res->max_th_g; wp.red_params[color].maxp_inv = res->maxp_inv_g; wp.red_params[color].wq_log2 = res->wq_log2_g; - + wp.red_params[color].wq_is_log2 = 1; /* WRED Params (Yellow Color)*/ color = RTE_TM_YELLOW; @@ -1293,6 +1297,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result, wp.red_params[color].max_th = res->max_th_y; wp.red_params[color].maxp_inv = res->maxp_inv_y; wp.red_params[color].wq_log2 = res->wq_log2_y; + wp.red_params[color].wq_is_log2 = 1; /* WRED Params (Red Color)*/ color = RTE_TM_RED; @@ -1300,6 +1305,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result, wp.red_params[color].max_th = res->max_th_r; wp.red_params[color].maxp_inv = res->maxp_inv_r; wp.red_params[color].wq_log2 = res->wq_log2_r; + wp.red_params[color].wq_is_log2 = 1; ret = rte_tm_wred_profile_add(port_id, wred_profile_id, &wp, &error); if (ret != 0) { diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index baaafbe..e96ea8e 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -469,7 +469,8 @@ struct softnic_tmgr_port * .cman_wred_context_shared_n_max = 0, .cman_wred_context_shared_n_nodes_per_context_max = 0, .cman_wred_context_shared_n_contexts_per_node_max = 0, - + .cman_wred_wq_dp_supported = 0, + .cman_wred_wq_log2_supported = WRED_SUPPORTED, .mark_vlan_dei_supported = {0, 0, 0}, .mark_ip_ecn_tcp_supported = {0, 0, 0}, .mark_ip_ecn_sctp_supported = {0, 0, 0}, @@ -1243,8 +1244,10 @@ struct softnic_tmgr_port * for (color = RTE_TM_GREEN; color < RTE_TM_COLORS; color++) { uint32_t min_th = profile->red_params[color].min_th; uint32_t max_th = profile->red_params[color].max_th; + int wq_is_log2 = profile->red_params[color].wq_is_log2; - if (min_th > max_th || + if (wq_is_log2 == 0 || + min_th > max_th || max_th == 0 || min_th > UINT16_MAX || max_th > UINT16_MAX) -- 1.8.3.1