From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Cc: emil.s.tantilov@intel.com, pmenzel@molgen.mpg.de,
intel-wired-lan@lists.osuosl.org, przemyslaw.kitszel@intel.com,
netdev@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2] idpf: avoid compiler padding in virtchnl2_ptype struct
Date: Mon, 8 Jan 2024 16:30:27 +0100 [thread overview]
Message-ID: <a55923ae-61be-4792-8717-a6e134fc3585@intel.com> (raw)
In-Reply-To: <20240105013232.44996-1-pavan.kumar.linga@intel.com>
From: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Date: Thu, 4 Jan 2024 17:32:32 -0800
> In the arm random config file, kconfig option 'CONFIG_AEABI' is
> disabled which results in adding the compiler flag '-mabi=apcs-gnu'.
> This causes the compiler to add padding in virtchnl2_ptype
> structure to align it to 8 bytes, resulting in the following
> size check failure:
[...]
> diff --git a/drivers/net/ethernet/intel/idpf/virtchnl2.h b/drivers/net/ethernet/intel/idpf/virtchnl2.h
> index 8dc83788972..dd750e6dcd0 100644
> --- a/drivers/net/ethernet/intel/idpf/virtchnl2.h
> +++ b/drivers/net/ethernet/intel/idpf/virtchnl2.h
> @@ -978,7 +978,7 @@ struct virtchnl2_ptype {
> u8 proto_id_count;
> __le16 pad;
> __le16 proto_id[];
> -};
> +} __packed;
Try using `__packed __aligned(sizeof(__le16))`
(or just `__packed __aligned(2)`) here. It may generate more optimized
code than just __packed, as the latter assumes the structure address in
the memory can be `2n + 1`, while it fact it's aligned to 2 bytes.
(another virtchnl2 design fail anyway :D)
> VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
>
> /**
Thanks,
Olek
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <pmenzel@molgen.mpg.de>,
<netdev@vger.kernel.org>, <przemyslaw.kitszel@intel.com>,
<emil.s.tantilov@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2] idpf: avoid compiler padding in virtchnl2_ptype struct
Date: Mon, 8 Jan 2024 16:30:27 +0100 [thread overview]
Message-ID: <a55923ae-61be-4792-8717-a6e134fc3585@intel.com> (raw)
In-Reply-To: <20240105013232.44996-1-pavan.kumar.linga@intel.com>
From: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Date: Thu, 4 Jan 2024 17:32:32 -0800
> In the arm random config file, kconfig option 'CONFIG_AEABI' is
> disabled which results in adding the compiler flag '-mabi=apcs-gnu'.
> This causes the compiler to add padding in virtchnl2_ptype
> structure to align it to 8 bytes, resulting in the following
> size check failure:
[...]
> diff --git a/drivers/net/ethernet/intel/idpf/virtchnl2.h b/drivers/net/ethernet/intel/idpf/virtchnl2.h
> index 8dc83788972..dd750e6dcd0 100644
> --- a/drivers/net/ethernet/intel/idpf/virtchnl2.h
> +++ b/drivers/net/ethernet/intel/idpf/virtchnl2.h
> @@ -978,7 +978,7 @@ struct virtchnl2_ptype {
> u8 proto_id_count;
> __le16 pad;
> __le16 proto_id[];
> -};
> +} __packed;
Try using `__packed __aligned(sizeof(__le16))`
(or just `__packed __aligned(2)`) here. It may generate more optimized
code than just __packed, as the latter assumes the structure address in
the memory can be `2n + 1`, while it fact it's aligned to 2 bytes.
(another virtchnl2 design fail anyway :D)
> VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
>
> /**
Thanks,
Olek
next prev parent reply other threads:[~2024-01-08 15:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 1:32 [Intel-wired-lan] [PATCH iwl-net v2] idpf: avoid compiler padding in virtchnl2_ptype struct Pavan Kumar Linga
2024-01-05 1:32 ` Pavan Kumar Linga
2024-01-05 21:13 ` [Intel-wired-lan] " Simon Horman
2024-01-05 21:13 ` Simon Horman
2024-01-08 15:30 ` Alexander Lobakin [this message]
2024-01-08 15:30 ` [Intel-wired-lan] " Alexander Lobakin
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=a55923ae-61be-4792-8717-a6e134fc3585@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=emil.s.tantilov@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=pavan.kumar.linga@intel.com \
--cc=pmenzel@molgen.mpg.de \
--cc=przemyslaw.kitszel@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.