DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: "Thomas Monjalon" <thomas@monjalon.net>,
	"Bruce Richardson" <bruce.richardson@intel.com>, <dev@dpdk.org>,
	"Tyler Retzlaff" <roretzla@linux.microsoft.com>
Subject: Re: [PATCH v2 1/7] eal: add queue macro extensions from FreeBSD
Date: Thu, 13 Mar 2025 10:01:05 -0700	[thread overview]
Message-ID: <20250313100105.52f70995@hermes.local> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9FB12@smartserver.smartshare.dk>

On Thu, 13 Mar 2025 17:40:26 +0100
Morten Brørup <mb@smartsharesystems.com> wrote:

> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Thursday, 13 March 2025 17.25
> > 
> > On Thu, 13 Mar 2025 15:41:33 +0100
> > Morten Brørup <mb@smartsharesystems.com> wrote:
> >   
> > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > >
> > > > 13/03/2025 09:56, Bruce Richardson:  
> > > > > On Thu, Mar 13, 2025 at 09:00:09AM +0100, Morten Brørup wrote:  
> > > > > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > > > > > Sent: Thursday, 13 March 2025 00.02
> > > > > > >
> > > > > > > On Wed, 19 Feb 2025 15:55:17 +0100
> > > > > > > Thomas Monjalon <thomas@monjalon.net> wrote:
> > > > > > >  
> > > > > > > > 14/02/2025 18:20, Stephen Hemminger:  
> > > > > > > > > The Linux version of sys/queue.h is frozen at an older  
> > > > version  
> > > > > > > > > and is missing the _SAFE macro variants. Several drivers  
> > > > started  
> > > > > > > > > introducing the own workarounds for this. Should be  
> > handled  
> > > > in EAL.  
> > > > > > > > >
> > > > > > > > > Signed-off-by: Stephen Hemminger  
> > <stephen@networkplumber.org>  
> > > > > > > >
> > > > > > > > We may want to unify with  
> > lib/eal/windows/include/sys/queue.h  
> > > > > > > >
> > > > > > > >  
> > > > > > >
> > > > > > > Not sure, we have several options here:
> > > > > > >   1. Keep using Linux sys/queue.h and add enhancements in  
> > > > rte_queue.h  
> > > > > > >   2. Make rte_queue.h a copy of FreeBSD version of queue.h  
> > (that  
> > > > is  
> > > > > > > what Windows did)
> > > > > > >   3. Use the bsd version of queue.h.
> > > > > > >      On Debian/Ubuntu this in libbsd-dev package and referred  
> > to  
> > > > as  
> > > > > > > bsd/sys/queue.h
> > > > > > >
> > > > > > > I chose #1 as simplest. But all of these could work. #3 means  
> > > > DPDK has  
> > > > > > > least new
> > > > > > > code, but adds another dependency to the build.  
> > > > > >
> > > > > > +1 to #2:
> > > > > > If Linux sys/queue.h is frozen, and is a subset of FreeBSD  
> > queue.h,  
> > > > #2 would consolidate all the queue macros in one file.  
> > > > > > That seems easier to navigate (for a developer/reviewer looking  
> > at  
> > > > the macro definitions/implementations) than including sys/queue.h,
> > > > queue.h or lib/eal/windows/include/sys/queue.h depending on O/S,  
> > and  
> > > > then defining the missing macros in rte_queue.h.  
> > > > > > A comment at the top of the rte_queue.h file could mention that  
> > it  
> > > > is a copy of the FreeBSD queue.h file.  
> > > > > >
> > > > > > -1 to #3; it adds an unnecessary dependency.
> > > > > >  
> > > > > > >
> > > > > > > No matter what, should add to checkpatch to block any new  
> > files  
> > > > that  
> > > > > > > include sys/queue.h
> > > > > > > directly.  
> > > > > >
> > > > > > +1 to this.
> > > > > >  
> > > > >
> > > > > I agree with Morten, #2 looks the best option to me too.  
> > > >
> > > > It means we want to remove lib/eal/windows/include/sys/queue.h,  
> > right?  
> > >
> > > Correct.
> > > All queue macros are consolidated into rte_queue.h.
> > >  
> > 
> > I have been trying this, and it possible but there is some fallout.
> > If application includes <sys/queue.h> and other DPDK headers include
> > <rte_queue.h>
> > there are declaration conflicts. Ends up being a compilation failure.
> > Tedious, but not hard to fix all of DPDK to use rte_queue.h instead of
> > sys/queue.h
> > but what about user applications?  
> 
> Perhaps this could work:
> 
> If _SYS_QUEUE_H_ is defined in rte_queue.h, including <sys/queue.h> after <rte_queue.h> will be harmless.
> 
> If each macro in rte_queue.h is surrounded by #ifndef MACRONAME, including <rte_queue.h> after <sys/queue.h> will be harmless.
> Alternatively, surround a group of macros in rte_queue.h by #ifndef _SYS_QUEUE_H_.

Most applications include system headers (ie. sys/queue.h) then DPDK headers (rte_queue.h)
> > 
> > Since that would be API break, best to put it off to 25.11.  
> 
> It might be impossible prohibiting user libraries from including <sys/queue.h>, especially if some 3rd party library includes <sys/queue.h> in the library's header file. The application developer would not want to modify the header files of 3rd party libraries.
> 

It is possible to bracket every macro with #ifdef to avoid collision
but gets messy.



  reply	other threads:[~2025-03-13 17:01 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 18:03 [RFC 0/7] Introduce FreeBSD macros for SAFE iteration Stephen Hemminger
2025-01-27 18:03 ` [RFC 1/7] eal: add queue macro extensions from FreeBSD Stephen Hemminger
2025-01-27 18:03 ` [RFC 2/7] net/qede: fix use after free Stephen Hemminger
2025-01-27 18:03 ` [RFC 3/7] bus/fslmc: " Stephen Hemminger
2025-01-27 18:03 ` [RFC 4/7] net/bnxt: " Stephen Hemminger
2025-01-27 19:25   ` Ajit Khaparde
2025-01-27 18:03 ` [RFC 5/7] net/iavf: replace local version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-01-27 18:04 ` [RFC 6/7] vhost: replace open coded TAILQ_FOREACH_SAFE Stephen Hemminger
2025-01-27 18:04 ` [RFC 7/7] raw/ifpga: use EAL version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-01-31  9:03   ` Xu, Rosen
2025-01-27 18:16 ` [RFC 0/7] Introduce FreeBSD macros for SAFE iteration Bruce Richardson
2025-01-27 18:43   ` Stephen Hemminger
2025-01-27 19:29     ` Morten Brørup
2025-01-27 23:14       ` Stephen Hemminger
2025-02-14 17:20 ` [PATCH v2 0/7] Introduce FOREACH_SAFE macros Stephen Hemminger
2025-02-14 17:20   ` [PATCH v2 1/7] eal: add queue macro extensions from FreeBSD Stephen Hemminger
2025-02-19 14:55     ` Thomas Monjalon
2025-02-21 23:05       ` Stephen Hemminger
2025-02-22  8:46         ` Thomas Monjalon
2025-03-12 23:02       ` Stephen Hemminger
2025-03-13  8:00         ` Morten Brørup
2025-03-13  8:56           ` Bruce Richardson
2025-03-13 14:35             ` Thomas Monjalon
2025-03-13 14:41               ` Morten Brørup
2025-03-13 16:24                 ` Stephen Hemminger
2025-03-13 16:40                   ` Morten Brørup
2025-03-13 17:01                     ` Stephen Hemminger [this message]
2025-02-14 17:20   ` [PATCH v2 2/7] net/qede: fix use after free Stephen Hemminger
2025-02-14 17:20   ` [PATCH v2 3/7] bus/fslmc: " Stephen Hemminger
2025-02-15 11:12     ` Hemant Agrawal
2025-02-14 17:20   ` [PATCH v2 4/7] net/bnxt: " Stephen Hemminger
2025-02-14 17:20   ` [PATCH v2 5/7] net/iavf: replace local version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-02-14 17:20   ` [PATCH v2 6/7] vhost: replace open coded TAILQ_FOREACH_SAFE Stephen Hemminger
2025-02-14 17:20   ` [PATCH v2 7/7] raw/ifpga: use EAL version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-02-15 15:44   ` [PATCH v2 0/7] Introduce FOREACH_SAFE macros Morten Brørup
2025-03-12 23:15 ` [PATCH v3 0/9] introduce common " Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 1/9] eal: add queue macro extensions from FreeBSD Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 2/9] net/qede: fix use after free Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 3/9] bus/fslmc: " Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 4/9] net/bnxt: " Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 5/9] net/iavf: replace local version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 6/9] vhost: replace open coded TAILQ_FOREACH_SAFE Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 7/9] raw/ifpga: use EAL version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 8/9] net/i40e: replace open coded version of LIST_FOREACH_SAFE Stephen Hemminger
2025-03-12 23:15   ` [PATCH v3 9/9] net/ice: " Stephen Hemminger

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=20250313100105.52f70995@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=roretzla@linux.microsoft.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).