DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Rosen Xu <rosen.xu@intel.com>
Cc: dev@dpdk.org, cristian.dumitrescu@intel.com,
	wenzhuo.lu@intel.com, jasvinder.singh@intel.com,
	ferruh.yigit@intel.com, nithin.dabilpuram@cavium.com
Subject: Re: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic management
Date: Tue, 14 Aug 2018 11:35:30 +0530	[thread overview]
Message-ID: <20180814060528.GA21200@jerin> (raw)
In-Reply-To: <1534146812-120570-1-git-send-email-rosen.xu@intel.com>

-----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
> 

  parent reply	other threads:[~2018-08-14  6:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13  7:53 Rosen Xu
2018-08-13 19:23 ` Stephen Hemminger
2018-08-14  6:05 ` Jerin Jacob [this message]
2018-08-14  6:45   ` Xu, Rosen
2018-08-16  0:56     ` Xu, Rosen
2018-08-16  8:54     ` Dumitrescu, Cristian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180814060528.GA21200@jerin \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jasvinder.singh@intel.com \
    --cc=nithin.dabilpuram@cavium.com \
    --cc=rosen.xu@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).