From: Jeremy Kerr <jk@codeconstruct.com.au>
To: wit_yuan <yuanzhaoming901030@126.com>
Cc: yuanzm2@lenovo.com, matt@codeconstruct.com.au,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net:mctp: split mctp hdr version to ver and rsvd
Date: Fri, 10 Apr 2026 08:13:48 +0800 [thread overview]
Message-ID: <ff147a3f0d27ef2aa6026cc86f9113d56a8c61ac.camel@codeconstruct.com.au> (raw)
In-Reply-To: <20260409125129.9210-1-yuanzhaoming901030@126.com>
Hi yuanxhaoming,
> 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
I would strongly prefer that we do not use C bitfields for a wire
format. The existing flags_seq_tag member contains three fields, which
we use with a couple of helpers to extract the flag, sequence number or
tag values - please follow that convention if we need changes here.
Also, this introduces a few subtle bugs in that we are no longer setting
the reserved bits to zero when preparing an outgoing TX packet header.
What is the underlying issue are you fixing here? Are you seeing a peer
that is sending us packets with bits set in the reserved field?
(if so, that would also be handy information to include in the commit
message)
> From: yuanzhaoming <yuanzm2@lenovo.com>
Is this the preferred format of your name? These are generally in
a full-name format, or a known identity. There's no particular issue
with what you're using there, if that's what you prefer.
Cheers,
Jeremy
next prev parent reply other threads:[~2026-04-10 0:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=ff147a3f0d27ef2aa6026cc86f9113d56a8c61ac.camel@codeconstruct.com.au \
--to=jk@codeconstruct.com.au \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeconstruct.com.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yuanzhaoming901030@126.com \
--cc=yuanzm2@lenovo.com \
/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