From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 2CDFB23C for ; Tue, 1 May 2018 17:15:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 May 2018 08:15:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,351,1520924400"; d="scan'208";a="52283357" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga001.jf.intel.com with ESMTP; 01 May 2018 08:15:13 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.150]) by IRSMSX152.ger.corp.intel.com ([169.254.6.199]) with mapi id 14.03.0319.002; Tue, 1 May 2018 16:15:13 +0100 From: "Dumitrescu, Cristian" To: "Rao, Nikhil" CC: "dev@dpdk.org" , "Shelton, Benjamin H" , "Vangati, Narender" , "Gujjar, Abhinandan S" Thread-Topic: [PATCH] ethdev: add support for WRED thresholds in bytes Thread-Index: AQHTqk8mKi50wye8dkyD1cFvsIsyO6QbaRGA Date: Tue, 1 May 2018 15:15:12 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891267BB644E4@IRSMSX108.ger.corp.intel.com> References: <1519133453-109024-1-git-send-email-nikhil.rao@intel.com> In-Reply-To: <1519133453-109024-1-git-send-email-nikhil.rao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ethdev: add support for WRED thresholds in bytes 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, 01 May 2018 15:15:16 -0000 > -----Original Message----- > From: Rao, Nikhil > Sent: Tuesday, February 20, 2018 1:31 PM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; Shelton, Benjamin H ; > Vangati, Narender ; Gujjar, Abhinandan S > ; Rao, Nikhil > Subject: [PATCH] ethdev: add support for WRED thresholds in bytes >=20 > WRED thresholds can be specified in bytes if the TM leaf > node supports it. Also extend WRED thresholds to 32 bits from 16. >=20 > TM capability (port/level/queue) fields > cman_wred_packet_mode_supported and > cman_wred_byte_mode_supported, when non-zero, indicate support for > WRED > thresholds in packets and bytes respectively. >=20 > The packet_mode member of struct rte_tm_wred_params, when non-zero, > indicates that the min and max thresholds are specified in > packets and when zero, indicates that the min and max thresholds > are specified in bytes. >=20 > Signed-off-by: Nikhil Rao > --- >=20 > Thanks to Cristian for his help with developing this patch. >=20 > lib/librte_ether/rte_tm.h | 53 > ++++++++++++++++++++++++++++++-- > drivers/net/softnic/rte_eth_softnic_tm.c | 22 +++++++++++++ > 2 files changed, 73 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_ether/rte_tm.h b/lib/librte_ether/rte_tm.h > index 2b25a87..23098ab 100644 > --- a/lib/librte_ether/rte_tm.h > +++ b/lib/librte_ether/rte_tm.h > @@ -377,6 +377,22 @@ struct rte_tm_capabilities { > */ > uint32_t sched_wfq_weight_max; >=20 > + /** WRED packet mode support. When non-zero, this parameter > indicates > + * that there is atleast one leaf node that supports the WRED packet > + * mode, which might not be true for all the leaf nodes. In packet > + * mode, the WRED thresholds specify the queue length in packets, > as > + * opposed to bytes. > + */ > + int cman_wred_packet_mode_supported; > + > + /** WRED byte mode support. When non-zero, this parameter > indicates that > + * there is atleast one leaf node that supports the WRED byte mode, > + * which might not be true for all the leaf nodes. In byte mode, the > + * WRED thresholds specify the queue length in bytes, as opposed to > + * packets. > + */ > + int cman_wred_byte_mode_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. > @@ -628,6 +644,24 @@ struct rte_tm_level_capabilities { > */ > uint32_t shaper_shared_n_max; >=20 > + /** WRED packet mode support. When non-zero, > this > + * parameter indicates that there is atleast one leaf > + * node on this level that supports the WRED packet > + * mode, which might not be true for all the leaf > + * nodes. In packet mode, the WRED thresholds > specify > + * the queue length in packets, as opposed to bytes. > + */ > + int cman_wred_packet_mode_supported; > + > + /** WRED byte mode support. When non-zero, this > + * parameter indicates that there is atleast one leaf > + * node on this level that supports the WRED byte > mode, > + * which might not be true for all the leaf nodes. In > + * byte mode, the WRED thresholds specify the > queue > + * length in bytes, as opposed to packets. > + */ > + int cman_wred_byte_mode_supported; > + > /** Head drop algorithm support. When non-zero, > this > * parameter indicates that there is at least one leaf > * node on this level that supports the head drop > @@ -743,6 +777,12 @@ struct rte_tm_node_capabilities { >=20 > /** Items valid only for leaf nodes. */ > struct { > + /** WRED packet mode support for current node. */ > + int cman_wred_packet_mode_supported; > + > + /** WRED byte mode support for current node. */ > + int cman_wred_byte_mode_supported; > + > /** Head drop algorithm support for current node. > */ > int cman_head_drop_supported; >=20 > @@ -791,10 +831,10 @@ enum rte_tm_cman_mode { > */ > struct rte_tm_red_params { > /** Minimum queue threshold */ > - uint16_t min_th; > + uint32_t min_th; >=20 > /** Maximum queue threshold */ > - uint16_t max_th; > + uint32_t max_th; >=20 > /** Inverse of packet marking probability maximum value (maxp), > i.e. > * maxp_inv =3D 1 / maxp > @@ -815,10 +855,19 @@ struct rte_tm_red_params { > * WRED context is used to perform congestion management for a single > leaf > * node, while a shared WRED context is used to perform congestion > management > * for a group of leaf nodes. > + * > + * @see struct rte_tm_capabilities::cman_wred_packet_mode_supported > + * @see struct rte_tm_capabilities::cman_wred_byte_mode_supported > */ > struct rte_tm_wred_params { > /** One set of RED parameters per packet color */ > struct rte_tm_red_params red_params[RTE_TM_COLORS]; > + > + /** When non-zero, the *min_th* and *max_th* thresholds are > specified > + * in packets (WRED packet mode). When zero, the *min_th* and > *max_th* > + * thresholds are specified in bytes (WRED byte mode) > + */ > + int packet_mode; > }; >=20 > /** > diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c > b/drivers/net/softnic/rte_eth_softnic_tm.c > index 79f1c6a..e915c36 100644 > --- a/drivers/net/softnic/rte_eth_softnic_tm.c > +++ b/drivers/net/softnic/rte_eth_softnic_tm.c > @@ -479,6 +479,8 @@ > .sched_wfq_n_groups_max =3D 1, > .sched_wfq_weight_max =3D UINT32_MAX, >=20 > + .cman_wred_packet_mode_supported =3D WRED_SUPPORTED, > + .cman_wred_byte_mode_supported =3D 0, > .cman_head_drop_supported =3D 0, > .cman_wred_context_n_max =3D 0, > .cman_wred_context_private_n_max =3D 0, > @@ -667,6 +669,8 @@ > .shaper_shared_n_max =3D 0, >=20 > .cman_head_drop_supported =3D 0, > + .cman_wred_packet_mode_supported =3D > WRED_SUPPORTED, > + .cman_wred_byte_mode_supported =3D 0, > .cman_wred_context_private_supported =3D > WRED_SUPPORTED, > .cman_wred_context_shared_n_max =3D 0, >=20 > @@ -828,6 +832,8 @@ >=20 > {.leaf =3D { > .cman_head_drop_supported =3D 0, > + .cman_wred_packet_mode_supported =3D > WRED_SUPPORTED, > + .cman_wred_byte_mode_supported =3D 0, > .cman_wred_context_private_supported =3D > WRED_SUPPORTED, > .cman_wred_context_shared_n_max =3D 0, > } }, > @@ -1226,6 +1232,14 @@ > NULL, > rte_strerror(EINVAL)); >=20 > + /* WRED profile should be in packet mode */ > + if (profile->packet_mode =3D=3D 0) > + return -rte_tm_error_set(error, > + ENOTSUP, > + RTE_TM_ERROR_TYPE_WRED_PROFILE, > + NULL, > + rte_strerror(ENOTSUP)); > + > /* WRED profile must not exist. */ > wp =3D tm_wred_profile_search(dev, wred_profile_id); > if (wp) > @@ -1248,6 +1262,14 @@ > uint16_t min_th =3D profile->red_params[color].min_th; > uint16_t max_th =3D profile->red_params[color].max_th; >=20 > + if (profile->red_params[color].min_th >=3D (1 << 16) || > + profile->red_params[color].max_th >=3D (1 << > 16)) > + return -rte_tm_error_set(error, > + EINVAL, > + > RTE_TM_ERROR_TYPE_WRED_PROFILE, > + NULL, > + rte_strerror(EINVAL)); > + > if (min_th > max_th || max_th =3D=3D 0) > return -rte_tm_error_set(error, > EINVAL, > -- > 1.8.3.1 Acked-by: Cristian Dumitrescu Applied to next-qos tree with some minor adjustments in file rte_eth_softni= c_tm.c: - moved check on profile->packet_mode after the check that profile is not N= ULL - consolidated checks on min_th and max_th under a single block - replaced 1 << 16 with UINT16_MAX Thanks!