From: Thomas Monjalon <thomas@monjalon.net>
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
Fiona Trahe <fiona.trahe@intel.com>, Khoa To <khot@microsoft.com>,
Ray Kinsella <mdr@ashroe.eu>,
"andrew.rybchenko@oktetlabs.ru" <andrew.rybchenko@oktetlabs.ru>,
"olivier.matz@6wind.com" <olivier.matz@6wind.com>,
"navasile@linux.microsoft.com" <navasile@linux.microsoft.com>,
"pallavi.kadam@intel.com" <pallavi.kadam@intel.com>,
"ranjit.menon@intel.com" <ranjit.menon@intel.com>,
"bruce.richardson@intel.com" <bruce.richardson@intel.com>,
"stephen@networkplumber.org" <stephen@networkplumber.org>,
Akhil Goyal <gakhil@marvell.com>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v4] doc: announce API changes for Windows compatibility
Date: Mon, 02 Aug 2021 19:46:11 +0200 [thread overview]
Message-ID: <10505026.IfYnoXH78b@thomas> (raw)
In-Reply-To: <CO6PR18MB4484F301F91721CCB7227B96D8EF9@CO6PR18MB4484.namprd18.prod.outlook.com>
02/08/2021 15:48, Akhil Goyal:
> > 2021-08-02 12:45 (UTC+0000), Akhil Goyal:
> > > > 21/07/2021 21:55, Dmitry Kozlyuk:
> > > > > Windows headers define `s_addr`, `min`, and `max` as macros.
> > > > > If DPDK headers are included after Windows ones, DPDK structure
> > > > > definitions containing fields with these names get broken (example 1),
> > > > > as well as any usage of such fields (example 2). If DPDK headers
> > > > > undefined these macros, it could break consumer code (example 3).
> > > > > It is proposed to rename structure fields in DPDK, because Win32
> > headers
> > > > > are used more widely than DPDK, as a general-purpose platform
> > compared
> > > > > to domain-specific kit, and are harder to fix because of that.
> > > > > Exact new names are left for further discussion.
> > > > >
> > > > > Example 1:
> > > > >
> > > > > /* in DPDK public header included after windows.h */
> > > > > struct rte_type {
> > > > > int min; /* ERROR: `min` is a macro */
> > > > > };
> > > > >
> > > > > Example 2:
> > > > >
> > > > > #include <rte_ether.h>
> > > > > #include <winsock2.h>
> > > > > struct rte_ether_hdr eh;
> > > > > eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */
> > > > >
> > > > > Example 3:
> > > > >
> > > > > #include <winsock2.h>
> > > > > #include <rte_ether.h>
> > > > > struct in_addr addr;
> > > > > addr.s_addr = 0; /* ERROR: there is no `s_addr` field,
> > > > > and `s_addr` macro is undefined by DPDK. */
> > > > >
> > > > > Commit 6c068dbd9fea ("net: work around s_addr macro on Windows")
> > > > > modified definition of `struct rte_ether_hdr` to avoid the issue.
> > > > > However, the workaround assumes `#define s_addr S_addr.S_un`
> > > > > in Windows headers, which is not a part of official API.
> > > > > It also complicates the definition of `struct rte_ether_hdr`.
> > > > >
> > > > > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > > > > Acked-by: Khoa To <khot@microsoft.com>
[...]
> > > > Acked-by: Thomas Monjalon <thomas@monjalon.net>
> > > >
> > > Can we have a local variable named as min/max?
> > > If not, then I believe it is not a good idea.
> >
> > Yes, except for inline functions in public headers.
> > The only problematic one I know of is this (rte_lru_x86.h):
> >
> > static inline int
> > f_lru_pos(uint64_t lru_list)
> > {
> > __m128i lst = _mm_set_epi64x((uint64_t)-1, lru_list);
> > __m128i min = _mm_minpos_epu16(lst); /* <<< */
> > return _mm_extract_epi16(min, 1);
> > }
> >
> > Fixing it breaks neither API nor ABI, thus no explicit deprecation notice.
> OK,
> Acked-by: Akhil Goyal <gakhil@marvell.com>
Applied, thanks.
next prev parent reply other threads:[~2021-08-02 17:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 22:51 [dpdk-dev] [PATCH] doc: announce renaming of rte_ether_hdr fields Dmitry Kozlyuk
2021-03-03 23:54 ` Stephen Hemminger
2021-03-04 7:09 ` Dmitry Kozlyuk
2021-05-20 14:28 ` Ferruh Yigit
2021-03-10 23:54 ` [dpdk-dev] [PATCH v2] doc: announce API changes for Windows compatibility Dmitry Kozlyuk
2021-03-11 16:19 ` John Alexander
2021-03-11 17:01 ` Dmitry Kozlyuk
2021-03-11 17:08 ` Tyler Retzlaff
2021-03-16 10:37 ` Thomas Monjalon
2021-05-20 18:42 ` [dpdk-dev] [PATCH v3] " Dmitry Kozlyuk
2021-05-20 18:59 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-05-20 19:31 ` Dmitry Kozlyuk
2021-05-20 20:17 ` Akhil Goyal
2021-06-09 15:52 ` Dmitry Kozlyuk
2021-06-23 15:14 ` Dmitry Kozlyuk
2021-06-17 14:27 ` Tyler Retzlaff
2021-07-21 19:55 ` [dpdk-dev] " Dmitry Kozlyuk
2021-07-21 19:55 ` [dpdk-dev] [PATCH v4] " Dmitry Kozlyuk
2021-08-02 12:13 ` Thomas Monjalon
2021-08-02 12:45 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-02 13:00 ` Dmitry Kozlyuk
2021-08-02 13:48 ` Akhil Goyal
2021-08-02 14:57 ` Tal Shnaiderman
2021-08-02 17:46 ` Thomas Monjalon [this message]
2021-05-20 14:24 ` [dpdk-dev] [PATCH] doc: announce renaming of rte_ether_hdr fields Ferruh Yigit
2021-05-20 15:06 ` Dmitry Kozlyuk
2021-05-20 15:27 ` Ferruh Yigit
2021-05-20 15:50 ` Dmitry Kozlyuk
2021-05-20 16:04 ` Ferruh Yigit
2021-05-20 16:16 ` Dmitry Kozlyuk
2021-05-20 16:25 ` Ferruh Yigit
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=10505026.IfYnoXH78b@thomas \
--to=thomas@monjalon.net \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=ferruh.yigit@intel.com \
--cc=fiona.trahe@intel.com \
--cc=gakhil@marvell.com \
--cc=khot@microsoft.com \
--cc=mdr@ashroe.eu \
--cc=navasile@linux.microsoft.com \
--cc=olivier.matz@6wind.com \
--cc=pallavi.kadam@intel.com \
--cc=ranjit.menon@intel.com \
--cc=stephen@networkplumber.org \
/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).