DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Reshma Pattan <reshma.pattan@intel.com>
Cc: dev@dpdk.org, jerin.jacob@caviumnetworks.com,
	nikhil.rao@intel.com, thomas@monjalon.net,
	jasvinder.singh@intel.com, cristian.dumitrescu@intel.com
Subject: Re: [dpdk-dev] [PATCH v6 2/2] mbuf: implement generic format for sched field
Date: Thu, 20 Dec 2018 09:29:14 +0100	[thread overview]
Message-ID: <20181220082914.5hluj6nmn6s4rdrj@platinum> (raw)
In-Reply-To: <20181219154237.836-2-reshma.pattan@intel.com>

Hi Reshma,

Please find few minor comments below.

On Wed, Dec 19, 2018 at 03:42:37PM +0000, Reshma Pattan wrote:
> This patch implements the changes proposed in the deprecation
> notes [1][2].
> 
> librte_mbuf changes:
> The mbuf::hash::sched field is updated to support generic

I think it would be clearer to use mbuf->hash.sched (instead of ::).

> definition in line with the ethdev TM and MTR APIs. The new generic
> format contains: queue ID, traffic class, color.

I wonder if it wouldn't be worth specifying "traffic manager" and
"meter" instead of or in addition to TM and MTR.

[...]

> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -468,6 +468,17 @@ __extension__
>  typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
>                                 * with a single assignment */
>  
> +struct rte_mbuf_sched {
> +	uint32_t queue_id;   /**< Queue ID. */
> +	uint8_t traffic_class;
> +	/**< Traffic class ID. Traffic class 0
> +	 * is the highest priority traffic class.
> +	 */
> +	uint8_t color;
> +	/**< Color. @see enum rte_color.*/
> +	uint16_t reserved;   /**< Reserved. */
> +};
> +
>  /**
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
> @@ -574,14 +585,16 @@ struct rte_mbuf {
>  				 * on PKT_RX_FDIR_* flag in ol_flags.
>  				 */
>  			} fdir;	/**< Filter identifier if FDIR enabled */
> +			struct rte_mbuf_sched sched; /**< Hierarchical scheduler */


What about directly embedding the structure like the others? Since mbuf
is a very packed structure, I think it helps to show that rte_mbuf_sched
does not exceed the size of the union.

I mean something like this:

			struct rte_mbuf_sched {
				uint32_t queue_id;      /**< Queue ID. */
				uint8_t traffic_class;
				/**< Traffic class ID (0 = highest priority). */
				uint8_t color;
				/**< Color. @see enum rte_color. */
				uint16_t reserved;      /**< Reserved. */
			} sched;

I would require small changes, see below.

>  			struct {
> -				uint32_t lo;
> -				uint32_t hi;
> +				uint32_t reserved1;
> +				uint16_t reserved2;
> +				uint16_t txq;
>  				/**< The event eth Tx adapter uses this field
>  				 * to store Tx queue id.
>  				 * @see rte_event_eth_tx_adapter_txq_set()
>  				 */
> -			} sched;          /**< Hierarchical scheduler */
> +			} txadapter; /**< Eventdev ethdev Tx adapter */
>  			/**< User defined tags. See rte_distributor_process() */
>  			uint32_t usr;
>  		} hash;                   /**< hash information */
> @@ -2289,6 +2302,106 @@ rte_pktmbuf_linearize(struct rte_mbuf *mbuf)
>   */
>  void rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len);
>  
> +/**
> + * Get the value of mbuf sched queue_id field.
> + */
> +static inline uint32_t
> +rte_mbuf_sched_queue_get(const struct rte_mbuf *m)
> +{
> +	return m->hash.sched.queue_id;
> +}
> +
> +/**
> + * Get the value of mbuf sched traffic_class field.
> + */
> +static inline uint8_t
> +rte_mbuf_sched_traffic_class_get(const struct rte_mbuf *m)
> +{
> +	return m->hash.sched.traffic_class;
> +}
> +
> +/**
> + * Get the value of mbuf sched color field.
> + */
> +static inline uint8_t
> +rte_mbuf_sched_color_get(const struct rte_mbuf *m)
> +{
> +	return m->hash.sched.color;
> +}
> +
> +/**
> + * Get the values of mbuf sched queue_id, traffic_class and color.

missing an empty comment line here.

> + * @param m
> + *   Mbuf to read
> + * @param queue_id
> + *  Returns the queue id
> + * @param traffic_class
> + *  Returns the traffic class id
> + * @param color
> + *  Returns the colour id
> + */
> +static inline void
> +rte_mbuf_sched_get(const struct rte_mbuf *m, uint32_t *queue_id,
> +			uint8_t *traffic_class,
> +			uint8_t *color)
> +{
> +	struct rte_mbuf_sched sched = m->hash.sched;
> +
> +	*queue_id = sched.queue_id;
> +	*traffic_class = sched.traffic_class;
> +	*color = sched.color;

I don't think there is a need to have an additional local copy.

*queue_id = m->hash.sched.queue_id;
*traffic_class = m->hash.sched.traffic_class;
*color = m->hash.sched.color;


> +}
> +
> +/**
> + * Set the mbuf sched queue_id to the defined value.
> + */
> +static inline void
> +rte_mbuf_sched_queue_set(struct rte_mbuf *m, uint32_t queue_id)
> +{
> +	m->hash.sched.queue_id = queue_id;
> +}
> +
> +/**
> + * Set the mbuf sched traffic_class id to the defined value.
> + */
> +static inline void
> +rte_mbuf_sched_traffic_class_set(struct rte_mbuf *m, uint8_t traffic_class)
> +{
> +	m->hash.sched.traffic_class = traffic_class;
> +}
> +
> +/**
> + * Set the mbuf sched color id to the defined value.
> + */
> +static inline void
> +rte_mbuf_sched_color_set(struct rte_mbuf *m, uint8_t color)
> +{
> +	m->hash.sched.color = color;
> +}
> +
> +/**
> + * Set the mbuf sched queue_id, traffic_class and color.

empty comment missing

> + * @param m
> + *   Mbuf to set
> + * @param queue_id
> + *  Queue id value to be set
> + * @param traffic_class
> + *  Traffic class id value to be set
> + * @param color
> + *  Color id to be set
> + */
> +static inline void
> +rte_mbuf_sched_set(struct rte_mbuf *m, uint32_t queue_id,
> +			uint8_t traffic_class,
> +			uint8_t color)
> +{
> +	m->hash.sched = (struct rte_mbuf_sched){
> +				.queue_id = queue_id,
> +				.traffic_class = traffic_class,
> +				.color = color,
> +			};

Why not this?

m->hash.sched.queue_id = queue_id;
m->hash.sched.traffic_class = traffic_class;
m->hash.sched.color = color;


Apart from this, the mbuf part looks ok to me.

Thanks,
Olivier

  parent reply	other threads:[~2018-12-20  8:29 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 16:54 [dpdk-dev] [PATCH] " Jasvinder Singh
2018-11-26 11:37 ` Dumitrescu, Cristian
2018-11-29 10:42   ` Singh, Jasvinder
2018-12-04 17:39     ` Dumitrescu, Cristian
2018-12-05 12:22       ` Singh, Jasvinder
2018-12-01 14:22 ` Jerin Jacob
2018-12-05 11:15   ` Singh, Jasvinder
2018-12-10 17:49   ` Dumitrescu, Cristian
2018-12-07 14:31 ` [dpdk-dev] [PATCH v2 1/3] " Reshma Pattan
2018-12-11 19:02   ` Dumitrescu, Cristian
2018-12-12 18:17   ` Dumitrescu, Cristian
2018-12-13  8:51   ` Rao, Nikhil
2018-12-13 18:08   ` [dpdk-dev] [PATCH v3 1/2] eal: add new rte color definition Reshma Pattan
2018-12-13 18:08     ` [dpdk-dev] [PATCH v3 2/2] mbuf: implement generic format for sched field Reshma Pattan
2018-12-14 22:52       ` Dumitrescu, Cristian
2018-12-20  8:32         ` Olivier Matz
2018-12-20 11:19           ` Dumitrescu, Cristian
2018-12-14 22:19     ` [dpdk-dev] [PATCH v3 1/2] eal: add new rte color definition Dumitrescu, Cristian
2018-12-17 20:35     ` Thomas Monjalon
2018-12-18 15:40     ` [dpdk-dev] [PATCH v4 1/2] meter: " Reshma Pattan
2018-12-18 15:40       ` [dpdk-dev] [PATCH v4 2/2] mbuf: implement generic format for sched field Reshma Pattan
2018-12-19 15:34       ` [dpdk-dev] [PATCH v5 1/2] meter: add new rte color definition Reshma Pattan
2018-12-19 15:34         ` [dpdk-dev] [PATCH v5 2/2] mbuf: implement generic format for sched field Reshma Pattan
2018-12-19 15:42         ` [dpdk-dev] [PATCH v6 1/2] meter: add new rte color definition Reshma Pattan
2018-12-19 15:42           ` [dpdk-dev] [PATCH v6 2/2] mbuf: implement generic format for sched field Reshma Pattan
2018-12-19 18:14             ` Ananyev, Konstantin
2018-12-20  8:29             ` Olivier Matz [this message]
2018-12-20 11:28               ` Dumitrescu, Cristian
2018-12-20 12:41                 ` Olivier Matz
2018-12-20 12:16           ` [dpdk-dev] [PATCH v7 1/2] meter: add new rte color definition Reshma Pattan
2018-12-20 12:16             ` [dpdk-dev] [PATCH v7 2/2] mbuf: implement generic format for sched field Reshma Pattan
2018-12-20 12:43               ` Olivier Matz
2018-12-20 19:11                 ` Dumitrescu, Cristian
2018-12-20 14:55               ` Rao, Nikhil
2019-01-15 22:37               ` Stephen Hemminger
2019-01-16  9:19                 ` Pattan, Reshma
2019-01-16  9:33                   ` Dumitrescu, Cristian
2019-01-16 10:09                     ` Singh, Jasvinder
2019-01-15 23:11               ` Stephen Hemminger
2019-01-16  8:41                 ` Thomas Monjalon
2018-12-07 14:31 ` [dpdk-dev] [PATCH v2 2/3] eal: add new rte color definition Reshma Pattan
2018-12-10 18:24   ` Dumitrescu, Cristian
2018-12-14 23:35   ` Ananyev, Konstantin
2018-12-15  0:16     ` Dumitrescu, Cristian
2018-12-17 11:21       ` Ananyev, Konstantin
2018-12-17 17:15         ` Pattan, Reshma
2018-12-17 18:51           ` Dumitrescu, Cristian
2018-12-17 23:11             ` Thomas Monjalon
2018-12-18 10:30               ` Dumitrescu, Cristian
2018-12-18 11:18               ` Dumitrescu, Cristian
2018-12-18 12:38                 ` Thomas Monjalon
2018-12-18 13:19                   ` Dumitrescu, Cristian
2018-12-18 13:39                     ` Thomas Monjalon
2018-12-18 17:07                       ` Ananyev, Konstantin
2018-12-18 19:34                         ` Dumitrescu, Cristian
2018-12-18 20:19                           ` Thomas Monjalon
2018-12-19 10:47                             ` Dumitrescu, Cristian
2018-12-19 10:50                               ` Thomas Monjalon
2018-12-19 10:52                             ` Ananyev, Konstantin
2018-12-19 10:49                           ` Ananyev, Konstantin
2018-12-19 11:04                             ` Dumitrescu, Cristian
2018-12-18 10:15             ` Ananyev, Konstantin
2018-12-18 10:25               ` Pattan, Reshma
2018-12-18 10:38                 ` Ananyev, Konstantin
2018-12-18 10:41                   ` Pattan, Reshma
2018-12-18 10:52                     ` Singh, Jasvinder
2018-12-18 12:10                       ` Ananyev, Konstantin
2018-12-15 14:15     ` Mattias Rönnblom
2018-12-17  7:27       ` Pattan, Reshma
2018-12-17  9:41       ` Dumitrescu, Cristian
2018-12-17 19:36         ` Mattias Rönnblom
2018-12-17 23:24           ` Ferruh Yigit
2018-12-07 14:31 ` [dpdk-dev] [PATCH v2 3/3] doc: add deprecation notice to remove rte meter color Reshma Pattan
2018-12-11 14:58   ` 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=20181220082914.5hluj6nmn6s4rdrj@platinum \
    --to=olivier.matz@6wind.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nikhil.rao@intel.com \
    --cc=reshma.pattan@intel.com \
    --cc=thomas@monjalon.net \
    /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).