Thread (5 messages) flat view 5 messages, 4 authors, 2021-10-26

Re: [PATCH net-next v6] mctp: Implement extended addressing

From: Jeremy Kerr <jk@codeconstruct.com.au>
Date: 2021-10-26 11:34:36

Hi David,
quoted
+struct sockaddr_mctp_ext {
+       struct sockaddr_mctp    smctp_base;
+       int                     smctp_ifindex;
+       __u8                    smctp_halen;
+       __u8                    __smctp_pad0[3];
+       __u8                    smctp_haddr[MAX_ADDR_LEN];
+};
You'd be better off 8-byte aligning smctp_haddr.
I also suspect that always copying the 32 bytes will be faster
and generate less code than the memset() + memcpy().
The padding here is more to avoid layout variations between ABIs
rather than performance.

The largest current hardware address size that we need (for the i2c
transport) is... 1 byte. If we were to implement the PCIe VDM binding
for MCTP that'd then be the largest, now at 2 bytes. If anyone's crazy
enough to do MCTP over ethernet, we're still only at 6.

So, we'll be a long way off needing to optimise for 8-byte aligned
accesses here; I don't think the extra padding would be worth it.

Cheers,


Jeremy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help