public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net:mctp: split mctp hdr version to ver and rsvd
@ 2026-04-09 12:51 wit_yuan
  2026-04-10  0:13 ` Jeremy Kerr
  0 siblings, 1 reply; 5+ messages in thread
From: wit_yuan @ 2026-04-09 12:51 UTC (permalink / raw)
  To: jk
  Cc: yuanzhaoming901030, yuanzm2, matt, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel

From: yuanzhaoming <yuanzm2@lenovo.com>

from spec dsp0236_1.2.1.pdf page 26, the mctp header contains the
RSVD(4bit) and Hdr version(4 bit).

mctp_pkttype_receive invoke mctp_hdr, and get mh->ver whole byte 
compare the MCTP_VER_MIN, MCTP_VER_MAX. the reserver bits may be
by misleading used.

Signed-off-by: yuanzhaoming <yuanzm2@lenovo.com>
---
 include/net/mctp.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/net/mctp.h b/include/net/mctp.h
index e1e0a69afdce..80cc9c63f6ba 100644
--- a/include/net/mctp.h
+++ b/include/net/mctp.h
@@ -14,10 +14,17 @@
 #include <linux/netdevice.h>
 #include <net/net_namespace.h>
 #include <net/sock.h>
+#include <asm/byteorder.h>
 
 /* MCTP packet definitions */
 struct mctp_hdr {
-	u8	ver;
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+	u8	ver:4, rsvd: 4;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+	u8	rsvd:4, ver: 4;
+#else
+#error	"Please fix <asm/byteorder.h>"
+#endif
 	u8	dest;
 	u8	src;
 	u8	flags_seq_tag;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-10  7:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 12:51 [PATCH] net:mctp: split mctp hdr version to ver and rsvd wit_yuan
2026-04-10  0:13 ` Jeremy Kerr
2026-04-10  6:17   ` wit_yuan
2026-04-10  6:17     ` [PATCH next-next v2] net:mctp: fix setting mctp hdr ver reserved field cause data dropped wit_yuan
2026-04-10  7:05       ` Jeremy Kerr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox