* [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management @ 2018-08-13 7:53 Rosen Xu 2018-08-13 19:23 ` Stephen Hemminger 2018-08-14 6:05 ` Jerin Jacob 0 siblings, 2 replies; 6+ messages in thread From: Rosen Xu @ 2018-08-13 7:53 UTC (permalink / raw) To: dev Cc: cristian.dumitrescu, wenzhuo.lu, jasvinder.singh, rosen.xu, ferruh.yigit 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. 2. Drop Threshold: water line of receive fifo to judge whether the current received packet dropped or enqueue. Signed-off-by: Rosen Xu <rosen.xu@intel.com> --- 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 = &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 = &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 = &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 = &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 context. The + * absence of a private TDROP context for the + * current leaf node is indicated by value + * RTE_TM_TDROP_PROFILE_ID_NONE. + */ + uint32_t tdrop_profile_id; + + /** User allocated array of shared TDROP context + * IDs. When set to NULL, it indicates that the + * current leaf node should not currently be + * part of any shared TDROP contexts. + */ + uint32_t *shared_tdrop_context_id; + + /** Number of elements in the + * *shared_tdrop_context_id* array. Only valid + * when *shared_tdrop_context_id* is non-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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management 2018-08-13 7:53 [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management Rosen Xu @ 2018-08-13 19:23 ` Stephen Hemminger 2018-08-14 6:05 ` Jerin Jacob 1 sibling, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2018-08-13 19:23 UTC (permalink / raw) To: Rosen Xu Cc: dev, cristian.dumitrescu, wenzhuo.lu, jasvinder.singh, ferruh.yigit On Mon, 13 Aug 2018 15:53:32 +0800 Rosen Xu <rosen.xu@intel.com> wrote: > @@ -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 { Be careful, adding a new enum in middle of list will potentially break ABI. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management 2018-08-13 7:53 [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management Rosen Xu 2018-08-13 19:23 ` Stephen Hemminger @ 2018-08-14 6:05 ` Jerin Jacob 2018-08-14 6:45 ` Xu, Rosen 1 sibling, 1 reply; 6+ messages in thread From: Jerin Jacob @ 2018-08-14 6:05 UTC (permalink / raw) To: Rosen Xu Cc: dev, cristian.dumitrescu, wenzhuo.lu, jasvinder.singh, ferruh.yigit, nithin.dabilpuram -----Original Message----- > Date: Mon, 13 Aug 2018 15:53:32 +0800 > From: Rosen Xu <rosen.xu@intel.com> > 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. If it is for Packet Rx, We should not add it in rte_tm, Right? 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) > 2. Drop Threshold: water line of receive fifo to judge whether the > current received packet dropped or enqueue. > > Signed-off-by: Rosen Xu <rosen.xu@intel.com> > --- > 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 = &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 = &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 = &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 = &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 context. The > + * absence of a private TDROP context for the > + * current leaf node is indicated by value > + * RTE_TM_TDROP_PROFILE_ID_NONE. > + */ > + uint32_t tdrop_profile_id; > + > + /** User allocated array of shared TDROP context > + * IDs. When set to NULL, it indicates that the > + * current leaf node should not currently be > + * part of any shared TDROP contexts. > + */ > + uint32_t *shared_tdrop_context_id; > + > + /** Number of elements in the > + * *shared_tdrop_context_id* array. Only valid > + * when *shared_tdrop_context_id* is non-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 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management 2018-08-14 6:05 ` Jerin Jacob @ 2018-08-14 6:45 ` Xu, Rosen 2018-08-16 0:56 ` Xu, Rosen 2018-08-16 8:54 ` Dumitrescu, Cristian 0 siblings, 2 replies; 6+ messages in thread From: Xu, Rosen @ 2018-08-14 6:45 UTC (permalink / raw) To: Jerin Jacob Cc: dev, Dumitrescu, Cristian, Lu, Wenzhuo, Singh, Jasvinder, Yigit, Ferruh, nithin.dabilpuram > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Tuesday, August 14, 2018 14:06 > To: Xu, Rosen <rosen.xu@intel.com> > Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Lu, > Wenzhuo <wenzhuo.lu@intel.com>; Singh, Jasvinder > <jasvinder.singh@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>; > nithin.dabilpuram@cavium.com > Subject: Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic > management > > -----Original Message----- > > Date: Mon, 13 Aug 2018 15:53:32 +0800 > > From: Rosen Xu <rosen.xu@intel.com> > > 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. > > 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, so 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 Drop, especially for FPGA IP, so I added new. > > > > 2. Drop Threshold: water line of receive fifo to judge whether the > > current received packet dropped or enqueue. > > > > Signed-off-by: Rosen Xu <rosen.xu@intel.com> > > --- > > 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 = &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 = &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 = &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 = &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 context. The > > + * absence of a private TDROP context for the > > + * current leaf node is indicated by value > > + * RTE_TM_TDROP_PROFILE_ID_NONE. > > + */ > > + uint32_t tdrop_profile_id; > > + > > + /** User allocated array of shared TDROP context > > + * IDs. When set to NULL, it indicates that the > > + * current leaf node should not currently be > > + * part of any shared TDROP contexts. > > + */ > > + uint32_t *shared_tdrop_context_id; > > + > > + /** Number of elements in the > > + * *shared_tdrop_context_id* array. Only valid > > + * when *shared_tdrop_context_id* is non-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 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management 2018-08-14 6:45 ` Xu, Rosen @ 2018-08-16 0:56 ` Xu, Rosen 2018-08-16 8:54 ` Dumitrescu, Cristian 1 sibling, 0 replies; 6+ messages in thread From: Xu, Rosen @ 2018-08-16 0:56 UTC (permalink / raw) To: 'Jerin Jacob' Cc: 'dev@dpdk.org', Dumitrescu, Cristian, Lu, Wenzhuo, Singh, Jasvinder, Yigit, Ferruh, 'nithin.dabilpuram@cavium.com' > -----Original Message----- > From: Xu, Rosen > Sent: Tuesday, August 14, 2018 14:45 > To: Jerin Jacob <jerin.jacob@caviumnetworks.com> > Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Lu, > Wenzhuo <wenzhuo.lu@intel.com>; Singh, Jasvinder > <jasvinder.singh@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>; > nithin.dabilpuram@cavium.com > Subject: RE: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic > management > > > > > -----Original Message----- > > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > > Sent: Tuesday, August 14, 2018 14:06 > > To: Xu, Rosen <rosen.xu@intel.com> > > Cc: dev@dpdk.org; Dumitrescu, Cristian > > <cristian.dumitrescu@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; > > Singh, Jasvinder <jasvinder.singh@intel.com>; Yigit, Ferruh > > <ferruh.yigit@intel.com>; nithin.dabilpuram@cavium.com > > Subject: Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic > > management > > > > -----Original Message----- > > > Date: Mon, 13 Aug 2018 15:53:32 +0800 > > > From: Rosen Xu <rosen.xu@intel.com> > > > 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. > > > > 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, so 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 Drop, > especially for FPGA IP, so I added new. Also RED and Tail Drop are different, they have some overlap on configuration. For configuration reusing, we can merge Tail Drop configuration with RED. But the size of queue threshold is very short, there's very commonly more than 4G DDR memory in NIC, so I will send another patch for it. > > > > > > > 2. Drop Threshold: water line of receive fifo to judge whether the > > > current received packet dropped or enqueue. > > > > > > Signed-off-by: Rosen Xu <rosen.xu@intel.com> > > > --- > > > 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 = &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 = &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 = &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 = &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 context. The > > > + * absence of a private TDROP context for the > > > + * current leaf node is indicated by value > > > + * RTE_TM_TDROP_PROFILE_ID_NONE. > > > + */ > > > + uint32_t tdrop_profile_id; > > > + > > > + /** User allocated array of shared TDROP context > > > + * IDs. When set to NULL, it indicates that the > > > + * current leaf node should not currently be > > > + * part of any shared TDROP contexts. > > > + */ > > > + uint32_t *shared_tdrop_context_id; > > > + > > > + /** Number of elements in the > > > + * *shared_tdrop_context_id* array. Only valid > > > + * when *shared_tdrop_context_id* is non-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 > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management 2018-08-14 6:45 ` Xu, Rosen 2018-08-16 0:56 ` Xu, Rosen @ 2018-08-16 8:54 ` Dumitrescu, Cristian 1 sibling, 0 replies; 6+ messages in thread From: Dumitrescu, Cristian @ 2018-08-16 8:54 UTC (permalink / raw) To: Xu, Rosen, Jerin Jacob Cc: dev, Lu, Wenzhuo, Singh, Jasvinder, Yigit, Ferruh, nithin.dabilpuram > -----Original Message----- > From: Xu, Rosen > Sent: Tuesday, August 14, 2018 7:45 AM > To: Jerin Jacob <jerin.jacob@caviumnetworks.com> > Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; > Lu, Wenzhuo <wenzhuo.lu@intel.com>; Singh, Jasvinder > <jasvinder.singh@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>; > nithin.dabilpuram@cavium.com > Subject: RE: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic > management > > > > > -----Original Message----- > > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > > Sent: Tuesday, August 14, 2018 14:06 > > To: Xu, Rosen <rosen.xu@intel.com> > > Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; > Lu, > > Wenzhuo <wenzhuo.lu@intel.com>; Singh, Jasvinder > > <jasvinder.singh@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>; > > nithin.dabilpuram@cavium.com > > Subject: Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic > > management > > > > -----Original Message----- > > > Date: Mon, 13 Aug 2018 15:53:32 +0800 > > > From: Rosen Xu <rosen.xu@intel.com> > > > 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. > > This scheme is a sort of WRED-lite, so Rosen and I decided to look at fitting the driver he's currently working on under the WRED scheme; we can take another look at this if any significant issues are to be found (unlikely). Regards, Cristian ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-16 8:54 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-08-13 7:53 [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management Rosen Xu 2018-08-13 19:23 ` Stephen Hemminger 2018-08-14 6:05 ` Jerin Jacob 2018-08-14 6:45 ` Xu, Rosen 2018-08-16 0:56 ` Xu, Rosen 2018-08-16 8:54 ` Dumitrescu, Cristian
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).