[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201223184155.GT3107610@lunn.ch>
Date: Wed, 23 Dec 2020 19:41:55 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Horatiu Vultur <horatiu.vultur@...rochip.com>
Cc: Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net 1/2] net: mrp: fix definitions of MRP test packets
> > @@ -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
Powered by blists - more mailing lists