From: Kevin Traynor <ktraynor@redhat.com>
To: Bruce Richardson <bruce.richardson@intel.com>,
Olivier Matz <olivier.matz@6wind.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: DPDK Dev List <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] ether: mark ethernet addresses as being 2-byte aligned
Date: Thu, 16 May 2019 19:04:03 +0100 [thread overview]
Message-ID: <0435f920-2ba1-e827-6bf1-96ac81ee9dbc@redhat.com> (raw)
In-Reply-To: <20190516155457.4006-1-bruce.richardson@intel.com>
On 16/05/2019 16:54, Bruce Richardson wrote:
> When including the rte_ether.h header in applications with warnings
> enabled, a warning was given because of the assumption of 2-byte alignment
> of ethernet addresses when processing them.
>
> .../include/rte_ether.h:149:2: warning: converting a packed ‘const
> struct ether_addr’ pointer (alignment 1) to a ‘unaligned_uint16_t’
> {aka ‘const short unsigned int’} pointer (alignment 2) may result in
> an unaligned pointer value [-Waddress-of-packed-member]
> 149 | const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea;
> | ^~~~~
>
Hi - There was a couple of these warnings in telemetry that were not
squashed with the patch to disable the warning in 19.05. I was just
about send a patch to address that when I saw this one.
As your patch is aiming for a better solution, I won't send my patch for
master but I'll still send to stable.
> Since ethernet addresses should always be aligned on a two-byte boundary,
> we can just inform the compiler of this assumption to remove the warnings
> and allow us to always access the addresses using 16-bit operations.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>
> ---
>
> Although this is an ABI break, the network structures are all being renamed
> in this release, and a deprecation notice was previously posted for it.
> ---
> lib/librte_net/rte_ether.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
> index 3a87ff184..8090b7c01 100644
> --- a/lib/librte_net/rte_ether.h
> +++ b/lib/librte_net/rte_ether.h
> @@ -55,7 +55,8 @@ extern "C" {
> * See http://standards.ieee.org/regauth/groupmac/tutorial.html
> */
> struct ether_addr {
> - uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */
> + /** Addr bytes in tx order */
> + uint8_t addr_bytes[ETHER_ADDR_LEN] __rte_aligned(2);
> } __attribute__((__packed__));
>
> #define ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */
>
next prev parent reply other threads:[~2019-05-16 18:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 15:54 Bruce Richardson
2019-05-16 18:04 ` Kevin Traynor [this message]
2019-05-16 20:38 ` Bruce Richardson
2019-07-01 13:11 ` Olivier Matz
2019-07-01 13:38 ` Bruce Richardson
2019-07-01 14:14 ` Olivier Matz
2019-07-01 14:28 ` Bruce Richardson
[not found] ` <1e5856a8-108b-1f0c-6ce7-b7c9eafac658@sitilge.id.lv>
2020-02-05 13:45 ` Bruce Richardson
2020-02-09 19:32 ` Martins Eglitis
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=0435f920-2ba1-e827-6bf1-96ac81ee9dbc@redhat.com \
--to=ktraynor@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.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).