[dpdk-dev] [RFC] ethdev: add tail drop API for traffic management

Xu, Rosen rosen.xu at intel.com
Thu Aug 16 02:56:48 CEST 2018



> -----Original Message-----
> From: Xu, Rosen
> Sent: Tuesday, August 14, 2018 14:45
> To: Jerin Jacob <jerin.jacob at caviumnetworks.com>
> Cc: dev at dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu at intel.com>; Lu,
> Wenzhuo <wenzhuo.lu at intel.com>; Singh, Jasvinder
> <jasvinder.singh at intel.com>; Yigit, Ferruh <ferruh.yigit at intel.com>;
> nithin.dabilpuram at cavium.com
> Subject: RE: [dpdk-dev] [RFC] ethdev: add tail drop API for traffic
> management
> 
> 
> 
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerin.jacob at caviumnetworks.com]
> > Sent: Tuesday, August 14, 2018 14:06
> > To: Xu, Rosen <rosen.xu at intel.com>
> > Cc: dev at dpdk.org; Dumitrescu, Cristian
> > <cristian.dumitrescu at intel.com>; Lu, Wenzhuo <wenzhuo.lu at intel.com>;
> > Singh, Jasvinder <jasvinder.singh at intel.com>; Yigit, Ferruh
> > <ferruh.yigit at intel.com>; nithin.dabilpuram at 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 at intel.com>
> > > To: dev at dpdk.org
> > > CC: cristian.dumitrescu at intel.com, wenzhuo.lu at intel.com,
> > > jasvinder.singh at intel.com, rosen.xu at intel.com,
> > > ferruh.yigit at 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 at 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
> > >


More information about the dev mailing list