2021-05-20 15:24 (UTC+0100), Ferruh Yigit:
> On 3/3/2021 10:51 PM, Dmitry Kozlyuk wrote:
[...]
> > 
> > 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")
> >   
> 
> What is the problem with the workaround, why we can't live with it?
> 
> It requires an order in include files, right?

There's no problem except a tricky structure definition with fields that
violate DPDK coding rules. It works with any include order.

Will fix typos in v3, thanks.

Reply via email to