From: Bruce Richardson <bruce.richardson@intel.com>
To: David Marchand <david.marchand@redhat.com>
Cc: "Morten Brørup" <mb@smartsharesystems.com>,
"Andre Muezerie" <andremue@linux.microsoft.com>,
dev@dpdk.org, "Robin Jarry" <rjarry@redhat.com>,
"Stephen Hemminger" <stephen@networkplumber.org>,
"Chengwen Feng" <fengchengwen@huawei.com>,
"Thomas Monjalon" <thomas@monjalon.net>
Subject: Re: [PATCH] net: fix IPv4 cksum simple function
Date: Tue, 5 Nov 2024 11:02:34 +0000 [thread overview]
Message-ID: <Zyn7SiyBgpC0773c@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <CAJFAV8yStgiBbe+Nkt9mC30r0+ZP64_kGuRHOzqd90RD2HXZyw@mail.gmail.com>
On Tue, Nov 05, 2024 at 11:49:52AM +0100, David Marchand wrote:
> On Tue, Nov 5, 2024 at 11:20 AM Morten Brørup <mb@smartsharesystems.com> wrote:
> > > But there is still the question of packed structures with MSVC.
> > > Tyler proposal seemed to rely on the current __rte_packed conventional
> > > position.
> > > https://patchwork.dpdk.org/project/dpdk/patch/1713225913-20792-2-git-
> > > send-email-roretzla@linux.microsoft.com/
> > > Note that I am not a fan of this push/pop stuff.
> > >
> > > Maybe Andre will find a better solution.
> >
> > If we cannot come up with a clean solution that looks like an attribute (like GCC), we should accept MSVC's style with push/pop and learn to live with it.
>
> Well, there is probably not many solutions.
> OVS does the same as what you suggest.
>
>
> >
> > Perhaps something like:
> >
> > #ifdef RTE_TOOLCHAIN_MSVC
> > #define __RTE_PACKED(...) \
> > __pragma(pack(push, 1)) \
> > __VA_ARGS__ \
> > __pragma(pack(pop))
> > #else
> > #define __RTE_PACKED(...) __VA_ARGS__ __attribute__((__packed__))
> > #endif
> >
> > This would also move the "packed" information to the top of the struct, making the code easier to read - i.e. easier to notice that the structure is packed when not hidden away at the end of the structure.
>
> __RTE_PACKED(struct __rte_aligned(2) rte_ipv4_hdr {
> ...
> });
>
> Agreed, looks better.
>
Not convinced it looks better myself. Rather than packing the structure,
can we instead put aligned(2) on the 32-bit fields inside it?
/Bruce
next prev parent reply other threads:[~2024-11-05 11:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 8:59 David Marchand
2024-11-05 9:09 ` Morten Brørup
2024-11-05 9:27 ` David Marchand
2024-11-05 10:20 ` Morten Brørup
2024-11-05 10:49 ` David Marchand
2024-11-05 11:02 ` Bruce Richardson [this message]
2024-11-05 11:06 ` Morten Brørup
2024-11-05 13:12 ` David Marchand
2024-11-05 9:37 ` Robin Jarry
2024-11-05 9:53 ` Morten Brørup
2024-11-06 20:22 ` David Marchand
2024-11-05 10:18 ` Bruce Richardson
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=Zyn7SiyBgpC0773c@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=andremue@linux.microsoft.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=rjarry@redhat.com \
--cc=stephen@networkplumber.org \
--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).