netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net 1/2] net: mrp: fix definitions of MRP test packets
Date: Wed, 23 Dec 2020 19:41:55 +0100	[thread overview]
Message-ID: <20201223184155.GT3107610@lunn.ch> (raw)
In-Reply-To: <20201223175910.2ipmowhcn63mqtqt@soft-dev3.localdomain>

> > @@ -96,7 +96,7 @@ struct br_mrp_ring_test_hdr {
> >         __be16 state;
> >         __be16 transitions;
> >         __be32 timestamp;
> > -};
> > +} __attribute__((__packed__));
> 
> Yes, I agree that this should be packed but it also needs to be 32 bit
> alligned, so extra 2 bytes are needed.

The full structure is:

struct br_mrp_ring_test_hdr {
	__be16 prio;	
	__u8 sa[ETH_ALEN];
	__be16 port_role;
	__be16 state;
	__be16 transitions;
	__be32 timestamp;
};

If i'm looking at this correctly, the byte offsets are:

0-1   prio
2-7   sa
8-9   port_role
10-11 state
12-13 transition

With packed you get

14-17 timestamp

which is not 32 bit aligned.

Do you mean the whole structure must be 32 bit aligned? We need to add
two reserved bytes to the end of the structure?

    Andrew

  reply	other threads:[~2020-12-23 18:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 14:45 [PATCH net 0/2] MRP without hardware offload? Rasmus Villemoes
2020-12-23 14:45 ` [PATCH net 1/2] net: mrp: fix definitions of MRP test packets Rasmus Villemoes
2020-12-23 17:59   ` Horatiu Vultur
2020-12-23 18:41     ` Andrew Lunn [this message]
2020-12-23 19:22       ` Horatiu Vultur
2020-12-28 22:24   ` Jakub Kicinski
2021-01-03 13:29     ` Horatiu Vultur
2021-01-19 15:42     ` Rasmus Villemoes
2021-01-19 17:45       ` Jakub Kicinski
2020-12-23 14:45 ` [PATCH net 2/2] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP Rasmus Villemoes
2020-12-28 22:26   ` Jakub Kicinski
2020-12-23 18:14 ` [PATCH net 0/2] MRP without hardware offload? Horatiu Vultur

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=20201223184155.GT3107610@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rasmus.villemoes@prevas.dk \
    /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).