Thread (11 messages) 11 messages, 6 authors, 2021-04-09

RE: [PATCH v3 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)

From: Dexuan Cui <decui@microsoft.com>
Date: 2021-04-09 00:48:15
Also in: linux-hyperv, lkml

From: David Miller <davem@davemloft.net>
Sent: Thursday, April 8, 2021 5:41 PM
quoted
...
In the driver code, all the structs/unions marked by __packed are used to
talk with the hardware, so I think __packed is necessary here?
It actually isan't in many cases, check with and without the __packed directive
and see if anything chasnges.
Will do.
quoted
Do you think if it's better if we remove all the __packed, and add
static_assert(sizeof(struct XXX) == YYY) instead? e.g.
@@ -105,7 +105,8 @@ struct gdma_msg_hdr {
        u16 msg_version;
        u16 hwc_msg_id;
        u32 msg_size;
-} __packed;
+};
+static_assert(sizeof(struct gdma_msg_hdr) == 16);
This won't make sure the structure member offsets are what you expect.

I think you'll have to go through the structures one-by-one by hand to
figure out which ones really require the __packed attribute and which do not.
Got it. Let me see if I can remove all the __packed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help