From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AABBB1E2F for ; Tue, 14 Aug 2018 08:45:19 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2018 23:45:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="64745044" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 13 Aug 2018 23:45:16 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 13 Aug 2018 23:45:16 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 13 Aug 2018 23:45:15 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.150]) with mapi id 14.03.0319.002; Tue, 14 Aug 2018 14:45:13 +0800 From: "Xu, Rosen" To: Jerin Jacob CC: "dev@dpdk.org" , "Dumitrescu, Cristian" , "Lu, Wenzhuo" , "Singh, Jasvinder" , "Yigit, Ferruh" , "nithin.dabilpuram@cavium.com" Thread-Topic: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management Thread-Index: AQHUMtrqRr+ffxTq90+G0fWphV0s96S+PckAgACQVuA= Date: Tue, 14 Aug 2018 06:45:12 +0000 Message-ID: <0E78D399C70DA940A335608C6ED296D73A1CB17C@SHSMSX104.ccr.corp.intel.com> References: <1534146812-120570-1-git-send-email-rosen.xu@intel.com> <20180814060528.GA21200@jerin> In-Reply-To: <20180814060528.GA21200@jerin> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDAwYzc0ZTAtOGY0NC00NjI3LTg4ODgtNjQ2YjM1NDEyMDA0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTGYrN244SjlUWDZtUzlwOHlEclNSeWFVXC8wcm9pTFZcL2xXdHhCUlg2SzluUyswSTdrVHJnMVlqdkJhZ1lPRVVPIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management 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, 14 Aug 2018 06:45:20 -0000 > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Tuesday, August 14, 2018 14:06 > To: Xu, Rosen > Cc: dev@dpdk.org; Dumitrescu, Cristian ; L= u, > Wenzhuo ; Singh, Jasvinder > ; Yigit, Ferruh ; > nithin.dabilpuram@cavium.com > Subject: Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic > management >=20 > -----Original Message----- > > Date: Mon, 13 Aug 2018 15:53:32 +0800 > > From: Rosen Xu > > To: dev@dpdk.org > > CC: cristian.dumitrescu@intel.com, wenzhuo.lu@intel.com, > > jasvinder.singh@intel.com, rosen.xu@intel.com, ferruh.yigit@intel.com > > Subject: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic > > management > > X-Mailer: git-send-email 1.8.3.1 > > > > > > This patch introduces new ethdev generic Tail Drop API for Traffic > > Management, which is yet another standard congestion management > > offload for Ethernet devices. > > > > Tail Drop is about packets dropping when they arrive on a congested > > interface buffer. It's one mode of congestion management for hierarchy > > leaf nodes. > > > > There are two configuration parameters for Tail Drop: > > 1. Buffer Depth: determine the depth of receive fifo for packet RX. >=20 > If it is for Packet Rx, We should not add it in rte_tm, Right? For cyber function perspective, it belongs to tm ingress, just like WRED, s= o it add it in rte_tm. > Apart from tail drop, RED(random early detection) also found in some HW > on RX side. How about creating generic Rx congestion management, which > includes RED and Tail drop based on the capability.(In future some other > scheme also) It's a good idea, but the configuration is different between RED and Tail D= rop, especially for FPGA IP, so I added new. >=20 >=20 > > 2. Drop Threshold: water line of receive fifo to judge whether the > > current received packet dropped or enqueue. > > > > Signed-off-by: Rosen Xu > > --- > > lib/librte_ethdev/rte_tm.c | 42 ++++++++++ > > lib/librte_ethdev/rte_tm.h | 172 > ++++++++++++++++++++++++++++++++++++++ > > lib/librte_ethdev/rte_tm_driver.h | 35 ++++++++ > > 3 files changed, 249 insertions(+) > > > > diff --git a/lib/librte_ethdev/rte_tm.c b/lib/librte_ethdev/rte_tm.c > > index 9709454..89a7dec 100644 > > --- a/lib/librte_ethdev/rte_tm.c > > +++ b/lib/librte_ethdev/rte_tm.c > > @@ -168,6 +168,48 @@ int rte_tm_shared_wred_context_delete(uint16_t > port_id, > > shared_wred_context_id, error); } > > > > +/* Add Tail Drop profile */ > > +int rte_tm_tdrop_profile_add(uint16_t port_id, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_tdrop_params *profile, > > + struct rte_tm_error *error) > > +{ > > + struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > > + return RTE_TM_FUNC(port_id, tdrop_profile_add)(dev, > > + tdrop_profile_id, profile, error); } > > + > > +/* Delete Tail Drop profile */ > > +int rte_tm_tdrop_profile_delete(uint16_t port_id, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_error *error) > > +{ > > + struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > > + return RTE_TM_FUNC(port_id, tdrop_profile_delete)(dev, > > + tdrop_profile_id, error); } > > + > > +/* Add/update shared Tail Drop context */ int > > +rte_tm_shared_tdrop_context_add_update(uint16_t port_id, > > + uint32_t shared_tdrop_context_id, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_error *error) > > +{ > > + struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > > + return RTE_TM_FUNC(port_id, > shared_tdrop_context_add_update)(dev, > > + shared_tdrop_context_id, tdrop_profile_id, error); } > > + > > +/* Delete shared Tail Drop context */ int > > +rte_tm_shared_tdrop_context_delete(uint16_t port_id, > > + uint32_t shared_tdrop_context_id, > > + struct rte_tm_error *error) > > +{ > > + struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > > + return RTE_TM_FUNC(port_id, shared_tdrop_context_delete)(dev, > > + shared_tdrop_context_id, error); } > > + > > /* Add shaper profile */ > > int rte_tm_shaper_profile_add(uint16_t port_id, > > uint32_t shaper_profile_id, > > diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h > > index 955f02f..91b087d 100644 > > --- a/lib/librte_ethdev/rte_tm.h > > +++ b/lib/librte_ethdev/rte_tm.h > > @@ -93,6 +93,15 @@ > > #define RTE_TM_WRED_PROFILE_ID_NONE UINT32_MAX > > > > /** > > + * Invalid TDROP profile ID. > > + * > > + * @see struct rte_tm_node_params > > + * @see rte_tm_node_add() > > + * @see rte_tm_node_tdrop_context_update() > > + */ > > +#define RTE_TM_TDROP_PROFILE_ID_NONE UINT32_MAX > > + > > +/** > > *Invalid shaper profile ID. > > * > > * @see struct rte_tm_node_params > > @@ -871,6 +880,37 @@ struct rte_tm_wred_params { }; > > > > /** > > + * Tail Drop (TDROP) profile > > + * > > + * Multiple TDROP contexts can share the same TDROP profile. Each > > +leaf node with > > + * TDROP enabled as its congestion management mode has zero or one > > +private TDROP > > + * context (only one leaf node using it) and/or zero, one or several > > +shared > > + * TDROP contexts (multiple leaf nodes use the same TDROP context). A > > +private > > + * TDROP context is used to perform congestion management for a > > +single leaf > > + * node, while a shared TDROP context is used to perform congestion > > +management > > + * for a group of leaf nodes. > > + * > > + * @see struct rte_tm_capabilities::cman_tdrop_packet_mode_supported > > + * @see struct rte_tm_capabilities::cman_tdrop_byte_mode_supported > > + */ > > +struct rte_tm_tdrop_params { > > + /** Committed queue length (in bytes) */ > > + uint64_t committed_length; > > + > > + /** Peak queue length (in bytes) */ > > + uint64_t peak_length; > > + > > + /** Drop threshold of queue */ > > + uint64_t drop_th; > > + > > + /** When non-zero, the *drop_th* threshold is specified > > + * in packets (TDROP packet mode). When zero, the *drop_th* > > + * threshold is specified in bytes (TDROP byte mode) > > + */ > > + int packet_mode; > > +}; > > + > > +/** > > * Token bucket > > */ > > struct rte_tm_token_bucket { > > @@ -1000,6 +1040,32 @@ struct rte_tm_node_params { > > */ > > uint32_t n_shared_wred_contexts; > > } wred; > > + > > + /** TDROP parameters (only valid when *cman* is= set to > > + * TDROP). > > + */ > > + struct { > > + /** TDROP profile for private TDROP con= text. The > > + * absence of a private TDROP context f= or the > > + * current leaf node is indicated by va= lue > > + * RTE_TM_TDROP_PROFILE_ID_NONE. > > + */ > > + uint32_t tdrop_profile_id; > > + > > + /** User allocated array of shared TDRO= P context > > + * IDs. When set to NULL, it indicates = that the > > + * current leaf node should not current= ly be > > + * part of any shared TDROP contexts. > > + */ > > + uint32_t *shared_tdrop_context_id; > > + > > + /** Number of elements in the > > + * *shared_tdrop_context_id* array. Onl= y valid > > + * when *shared_tdrop_context_id* is no= n-NULL, > > + * in which case it should be non-zero. > > + */ > > + uint32_t n_shared_tdrop_contexts; > > + } tdrop; > > } leaf; > > }; > > > > @@ -1028,6 +1094,8 @@ enum rte_tm_error_type { > > RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW, > > RTE_TM_ERROR_TYPE_WRED_PROFILE_RED, > > RTE_TM_ERROR_TYPE_WRED_PROFILE_ID, > > + RTE_TM_ERROR_TYPE_TDROP_PROFILE, > > + RTE_TM_ERROR_TYPE_TDROP_PROFILE_ID, > > RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID, > > RTE_TM_ERROR_TYPE_SHAPER_PROFILE, > > RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE, > > @@ -1279,6 +1347,110 @@ struct rte_tm_error { > > struct rte_tm_error *error); > > > > /** > > + * Traffic manager Tail Drop profile add > > + * > > + * Create a new Tail Drop profile with ID set to *tdrop_profile_id*. > > + * The new profile is used to create one or several Tail Drop contexts= . > > + * > > + * @param[in] port_id > > + * The port identifier of the Ethernet device. > > + * @param[in] tdrop_profile_id > > + * Tail Drop profile ID for the new profile. Needs to be unused. > > + * @param[in] profile > > + * Tail Drop profile parameters. Needs to be pre-allocated and valid= . > > + * @param[out] error > > + * Error details. Filled in only on error, when not NULL. > > + * @return > > + * 0 on success, non-zero error code otherwise. > > + * > > + * @see struct rte_tm_capabilities::cman_tdrop_context_n_max > > + */ > > +int > > +rte_tm_tdrop_profile_add(uint16_t port_id, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_tdrop_params *profile, > > + struct rte_tm_error *error); > > + > > +/** > > + * Traffic manager Tail Drop profile delete > > + * > > + * Delete an existing Tail Drop profile. This operation fails when > > +there is > > + * currently at least one user (i.e. Tail Drop context) of this Tail > > +Drop > > + * profile. > > + * > > + * @param[in] port_id > > + * The port identifier of the Ethernet device. > > + * @param[in] tdrop_profile_id > > + * Tail Drop profile ID. Needs to be the valid. > > + * @param[out] error > > + * Error details. Filled in only on error, when not NULL. > > + * @return > > + * 0 on success, non-zero error code otherwise. > > + * > > + * @see struct rte_tm_capabilities::cman_tdrop_context_n_max > > + */ > > +int > > +rte_tm_tdrop_profile_delete(uint16_t port_id, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_error *error); > > + > > +/** > > + * Traffic manager shared Tail Drop context add or update > > + * > > + * When *shared_tdrop_context_id* is invalid, a new Tail Drop context > > +with > > + * this ID is created by using the Tail Drop profile identified by > > + * *tdrop_profile_id*. > > + * > > + * When *shared_tdrop_context_id* is valid, this Tail Drop context is > > +no > > + * longer using the profile previously assigned to it and is updated > > +to > > + * use the profile identified by *tdrop_profile_id*. > > + * > > + * A valid shared Tail Drop context can be assigned to several > > +hierarchy > > + * leaf nodes configured to use Tail Drop as the congestion management > mode. > > + * > > + * @param[in] port_id > > + * The port identifier of the Ethernet device. > > + * @param[in] shared_tdrop_context_id > > + * Shared Tail Drop context ID > > + * @param[in] tdrop_profile_id > > + * Tail Drop profile ID. Needs to be the valid. > > + * @param[out] error > > + * Error details. Filled in only on error, when not NULL. > > + * @return > > + * 0 on success, non-zero error code otherwise. > > + * > > + * @see struct rte_tm_capabilities::cman_tdrop_context_shared_n_max > > + */ > > +int > > +rte_tm_shared_tdrop_context_add_update(uint16_t port_id, > > + uint32_t shared_tdrop_context_id, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_error *error); > > + > > +/** > > + * Traffic manager shared Tail Drop context delete > > + * > > + * Delete an existing shared Tail Drop context. This operation fails > > +when > > + * there is currently at least one user (i.e. hierarchy leaf node) of > > +this > > + * shared Tail Drop context. > > + * > > + * @param[in] port_id > > + * The port identifier of the Ethernet device. > > + * @param[in] shared_tdrop_context_id > > + * Shared Tail Drop context ID. Needs to be the valid. > > + * @param[out] error > > + * Error details. Filled in only on error, when not NULL. > > + * @return > > + * 0 on success, non-zero error code otherwise. > > + * > > + * @see struct rte_tm_capabilities::cman_tdrop_context_shared_n_max > > + */ > > +int > > +rte_tm_shared_tdrop_context_delete(uint16_t port_id, > > + uint32_t shared_tdrop_context_id, > > + struct rte_tm_error *error); > > + > > +/** > > * Traffic manager shaper profile add > > * > > * Create a new shaper profile with ID set to *shaper_profile_id*. > > The new diff --git a/lib/librte_ethdev/rte_tm_driver.h > > b/lib/librte_ethdev/rte_tm_driver.h > > index 90114ff..c0ca916 100644 > > --- a/lib/librte_ethdev/rte_tm_driver.h > > +++ b/lib/librte_ethdev/rte_tm_driver.h > > @@ -71,6 +71,30 @@ typedef int > (*rte_tm_shared_wred_context_delete_t)( > > uint32_t shared_wred_context_id, > > struct rte_tm_error *error); > > > > +/** @internal Traffic manager TDROP profile add */ typedef int > > +(*rte_tm_tdrop_profile_add_t)(struct rte_eth_dev *dev, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_tdrop_params *profile, > > + struct rte_tm_error *error); > > + > > +/** @internal Traffic manager TDROP profile delete */ typedef int > > +(*rte_tm_tdrop_profile_delete_t)(struct rte_eth_dev *dev, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_error *error); > > + > > +/** @internal Traffic manager shared TDROP context add */ typedef int > > +(*rte_tm_shared_tdrop_context_add_update_t)( > > + struct rte_eth_dev *dev, > > + uint32_t shared_tdrop_context_id, > > + uint32_t tdrop_profile_id, > > + struct rte_tm_error *error); > > + > > +/** @internal Traffic manager shared TDROP context delete */ typedef > > +int (*rte_tm_shared_tdrop_context_delete_t)( > > + struct rte_eth_dev *dev, > > + uint32_t shared_tdrop_context_id, > > + struct rte_tm_error *error); > > + > > /** @internal Traffic manager shaper profile add */ typedef int > > (*rte_tm_shaper_profile_add_t)(struct rte_eth_dev *dev, > > uint32_t shaper_profile_id, > > @@ -230,6 +254,17 @@ struct rte_tm_ops { > > rte_tm_shared_wred_context_delete_t > > shared_wred_context_delete; > > > > + /** Traffic manager TDROP profile add */ > > + rte_tm_tdrop_profile_add_t tdrop_profile_add; > > + /** Traffic manager TDROP profile delete */ > > + rte_tm_tdrop_profile_delete_t tdrop_profile_delete; > > + /** Traffic manager shared TDROP context add/update */ > > + rte_tm_shared_tdrop_context_add_update_t > > + shared_tdrop_context_add_update; > > + /** Traffic manager shared TDROP context delete */ > > + rte_tm_shared_tdrop_context_delete_t > > + shared_tdrop_context_delete; > > + > > /** Traffic manager shaper profile add */ > > rte_tm_shaper_profile_add_t shaper_profile_add; > > /** Traffic manager shaper profile delete */ > > -- > > 1.8.3.1 > >