DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: William Tu <u9012063@gmail.com>
Cc: dev@dpdk.org, nick.connolly@mayadata.io
Subject: Re: [dpdk-dev] [PATCH v7] eal: remove sys/queue.h from public headers.
Date: Fri, 20 Aug 2021 02:29:03 +0300	[thread overview]
Message-ID: <20210820022903.50d75750@sovereign> (raw)
In-Reply-To: <20210818232632.7068-1-u9012063@gmail.com>

2021-08-18 23:26 (UTC+0000), William Tu:
[...]
> diff --git a/lib/eal/linux/include/rte_os.h b/lib/eal/linux/include/rte_os.h
> index 1618b4df22..ce5b0aed52 100644
> --- a/lib/eal/linux/include/rte_os.h
> +++ b/lib/eal/linux/include/rte_os.h
> @@ -11,6 +11,21 @@
>   */
>  
>  #include <sched.h>
> +#include <sys/queue.h>
> +
> +/* These macros are compatible with system's sys/queue.h. */
> +#define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type)
> +#define RTE_TAILQ_ENTRY(type) TAILQ_ENTRY(type)
> +#define RTE_TAILQ_FOREACH(var, head, field) TAILQ_FOREACH(var, head, field)
> +#define RTE_TAILQ_FOREACH_SAFE(var, head, field, tvar) \
> +	for ((var) = TAILQ_FIRST((head)); \
> +	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
> +	    (var) = (tvar))

I made a comment to v5 and you were going to fix it, maybe it got lost?

	Why duplicate this in rte_os.h (documentation lost, BTW) and add #ifdef?
	RTE_TAILQ_FOREACH_SAFE is not needed in headers, it can be left
	[in rte_tailq.h].

The important part is duplication in rte_os.h for each platform
and the loss of documentation. I see you already removed #ifdef.

> +#define RTE_TAILQ_FIRST(head) TAILQ_FIRST(head)
> +#define RTE_TAILQ_NEXT(elem, field) TAILQ_NEXT(elem, field)
> +#define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type)
> +#define RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type)
> +
>  
>  #ifdef CPU_SETSIZE /* may require _GNU_SOURCE */
>  typedef cpu_set_t rte_cpuset_t;
> diff --git a/lib/eal/windows/eal_alarm.c b/lib/eal/windows/eal_alarm.c
> index e5dc54efb8..103c1f909d 100644
> --- a/lib/eal/windows/eal_alarm.c
> +++ b/lib/eal/windows/eal_alarm.c
> @@ -4,6 +4,7 @@
>  
>  #include <stdatomic.h>
>  #include <stdbool.h>
> +#include <sys/queue.h>
>  
>  #include <rte_alarm.h>
>  #include <rte_spinlock.h>
> diff --git a/lib/eal/windows/include/rte_os.h b/lib/eal/windows/include/rte_os.h
> index 66c711d458..0cbe1dbc1e 100644
> --- a/lib/eal/windows/include/rte_os.h
> +++ b/lib/eal/windows/include/rte_os.h
> @@ -18,6 +18,37 @@
>  extern "C" {
>  #endif
>  
> +/* These macros are compatible with bundled sys/queue.h. */
> +#define RTE_TAILQ_HEAD(name, type) \
> +struct name { \
> +	struct type *tqh_first; /* first element */ \
> +	struct type **tqh_last; /* addr of last next element */ \
> +}
> +#define RTE_TAILQ_ENTRY(type) \
> +struct { \
> +	struct type *tqe_next; /* next element */ \
> +	struct type **tqe_prev; /* address of previous next element */ \
> +}
> +#define RTE_TAILQ_FOREACH(var, head, field) \
> +	for ((var) = RTE_TAILQ_FIRST((head)); \
> +	    (var); \
> +	    (var) = RTE_TAILQ_NEXT((var), field))
> +#define RTE_TAILQ_FOREACH_SAFE(var, head, field, tvar) \
> +	for ((var) = TAILQ_FIRST((head)); \
> +	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
> +	    (var) = (tvar))
> +#define RTE_TAILQ_FIRST(head) ((head)->tqh_first)
> +#define RTE_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
> +#define RTE_STAILQ_HEAD(name, type) \
> +struct name { \
> +	struct type *stqh_first;/* first element */ \
> +	struct type **stqh_last;/* addr of last next element */ \
> +}
> +#define RTE_STAILQ_ENTRY(type) \
> +struct { \
> +	struct type *stqe_next; /* next element */ \
> +}
> +

Please drop the inline comments.
They duplicate what's already in sys/queue.h
and we're not going to maintain them.

  reply	other threads:[~2021-08-19 23:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 20:46 [dpdk-dev] [PATCHv2] include: fix sys/queue.h William Tu
2021-08-11 15:50 ` Dmitry Kozlyuk
2021-08-11 18:13   ` William Tu
2021-08-12 20:05 ` [dpdk-dev] [PATCHv3] " William Tu
2021-08-12 21:58   ` Dmitry Kozlyuk
2021-08-13  1:02   ` [dpdk-dev] [PATCHv4] eal: remove sys/queue.h from public headers William Tu
2021-08-13  1:11     ` Stephen Hemminger
2021-08-13  1:36       ` William Tu
2021-08-13  3:36     ` [dpdk-dev] [PATCHv5] " William Tu
2021-08-13 18:59       ` Dmitry Kozlyuk
2021-08-14  2:31         ` William Tu
2021-08-14  2:51       ` [dpdk-dev] [PATCH v6] " William Tu
2021-08-17 22:06         ` Dmitry Kozlyuk
2021-08-18 23:26         ` [dpdk-dev] [PATCH v7] " William Tu
2021-08-19 23:29           ` Dmitry Kozlyuk [this message]
2021-08-23 12:34             ` William Tu
2021-08-23 13:03           ` [dpdk-dev] [PATCH v8] " William Tu
2021-08-23 19:14             ` Dmitry Kozlyuk
2021-08-24 16:11               ` William Tu
2021-08-24 16:21             ` [dpdk-dev] [PATCH v9] " William Tu
2021-09-20 20:11               ` Narcisa Ana Maria Vasile
2021-09-30 22:16                 ` William Tu
2021-10-01  7:27                   ` David Marchand
2021-10-01  9:36                     ` Dmitry Kozlyuk
2021-10-01  9:51                       ` Dmitry Kozlyuk
2021-10-01  9:55                         ` David Marchand
2021-10-01 10:12                           ` Bruce Richardson
2021-10-01 10:34                 ` Thomas Monjalon

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=20210820022903.50d75750@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=nick.connolly@mayadata.io \
    --cc=u9012063@gmail.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).