From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next-queue] fm10k: explain why we need __packed on some TLV structures
Date: Tue, 3 Nov 2015 13:47:55 -0800 [thread overview]
Message-ID: <56392B8B.4090208@gmail.com> (raw)
In-Reply-To: <1446579154-1112-1-git-send-email-jacob.e.keller@intel.com>
On 11/03/2015 11:32 AM, Jacob Keller wrote:
> Add an explanatory comment about the __packed attribute on these
> structures due to TLV data layout requirements.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> drivers/net/ethernet/intel/fm10k/fm10k_pf.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.h b/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
> index a8fc512a2416..661a4062b756 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
> @@ -74,6 +74,11 @@ enum fm10k_pf_tlv_attr_id_v1 {
> #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16
> #define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16
>
> +/* The following data structures are overlayed specifically to TLV mailbox
> + * messages, and must not have gaps between their values. They must line up
> + * correctly to the TLV definition.
> + */
> +
> struct fm10k_mac_update {
> __le32 mac_lower;
> __le16 mac_upper;
Really I don't think this tells the story of why the packed attribute is
needed. From what I can tell there aren't any holes in the structures
themselves. It looks like the issue is the padding on the end. From
what I can tell only the only message that really needs the packed
attribute it is the 1588 message because it uses __le64 values and as
such the actual size will vary by 4 bytes between 64b and 32b systems.
- Alex
next prev parent reply other threads:[~2015-11-03 21:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 19:32 [Intel-wired-lan] [next-queue] fm10k: explain why we need __packed on some TLV structures Jacob Keller
2015-11-03 21:47 ` Alexander Duyck [this message]
2015-11-03 21:55 ` Keller, Jacob E
2015-11-03 22:40 ` Alexander Duyck
2015-11-03 23:08 ` Keller, Jacob E
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=56392B8B.4090208@gmail.com \
--to=alexander.duyck@gmail.com \
--cc=intel-wired-lan@osuosl.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