DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] doc: announce renaming of rte_ether_hdr fields
@ 2021-03-03 22:51 Dmitry Kozlyuk
  2021-03-03 23:54 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-03 22:51 UTC (permalink / raw)
  To: dev
  Cc: Ferruh Yigit, Pallavi Kadam, Dmitry Malloy,
	Narcisa Ana Maria Vasile, Dmitry Kozlyuk, Ray Kinsella,
	Neil Horman

It is proposed to rename fields of `struct rte_ether_hdr`,
`s_addr` tp `src_addr` and `d_addr` to `dst_addr`,
due to the clash with system macro on Windows.
Until remaining is done in 21.11, a workaround can be used.

Windows Sockets headers contain `#define s_addr S_un.S_addr`, which
conflicts with `s_addr` field of `struct rte_ether_hdr`. Undefining
this macro in <rte_ether.h> is breaking some usages of DPDK
and Windows headers in one file.

Example 1:

    #include <winsock2.h>
    #include <rte_ether.h>
    struct in_addr addr;
    /* addr.s_addr = 0;     ERROR: s_addr undefined by DPDK */

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 */

It is not mandatory to rename `d_addr`, this is for consistency only.
Naming in `rte_ether_hdr` will also resemble `rte_ipv4/6_hdr`.

Workaround is to define `struct rte_ether_hdr` in such a away that
it can be used with or without `s_addr` macro (as defined on Windows)
This can be done for Windows only or for all platforms to save space.

    #pragma push_macro("s_addr")
    #ifdef s_addr
    #undef s_addr
    #endif

    struct rte_ether_hdr {
        struct rte_ether_addr d_addr; /**< Destination address. */
        RTE_STD_C11
        union {
            struct rte_ether_addr s_addr; /**< Source address. */
            struct {
                struct rte_ether_addr S_un;
                /**< MUST NOT be used directly, only via s_addr */
            } S_addr;
            /*< MUST NOT be used directly, only via s_addr */
        };
        uint16_t ether_type; /**< Frame type. */
    } __rte_aligned(2);

    #pragma pop_macro("s_addr")

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 doc/guides/rel_notes/deprecation.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 82c1a90a3..f7be10543 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -125,3 +125,7 @@ Deprecation Notices
 * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific
   content. On Linux and FreeBSD, supported prior to DPDK 20.11,
   original structure will be kept until DPDK 21.11.
+
+* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure
+  will be renamed to ``src_addr`` and ``dst_addr`` respectively in DPDK 20.11
+  in order to avoid conflict with Windows Sockets headers.
-- 
2.29.2


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2021-08-02 17:46 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).