From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev,
linux-kernel@vger.kernel.org,
"Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
Gang Yan <yangang@kylinos.cn>
Subject: [PATCH net-next 1/5] mptcp: reduce 'overhead' from u16 to u8
Date: Fri, 03 Apr 2026 13:29:27 +0200 [thread overview]
Message-ID: <20260403-net-next-mptcp-msg_eor-misc-v1-1-b0b33bea3fed@kernel.org> (raw)
In-Reply-To: <20260403-net-next-mptcp-msg_eor-misc-v1-0-b0b33bea3fed@kernel.org>
From: Gang Yan <yangang@kylinos.cn>
The 'overhead' in struct mptcp_data_frag can safely use u8, as it
represents 'alignment + sizeof(mptcp_data_frag)'. With a maximum
alignment of 7('ALIGN(1, sizeof(long)) - 1'), the overhead is at most
47, well below U8_MAX and validated with BUILD_BUG_ON().
This patch also adds a field named 'unused' for further extensions.
Signed-off-by: Gang Yan <yangang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/protocol.c | 6 ++++++
net/mptcp/protocol.h | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 239fb9e75c7c..79315e575d07 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4616,6 +4616,12 @@ void __init mptcp_proto_init(void)
inet_register_protosw(&mptcp_protosw);
BUILD_BUG_ON(sizeof(struct mptcp_skb_cb) > sizeof_field(struct sk_buff, cb));
+
+ /* struct mptcp_data_frag: 'overhead' corresponds to the alignment
+ * (ALIGN(1, sizeof(long)) - 1, so 8-1) + the struct's size
+ */
+ BUILD_BUG_ON(ALIGN(1, sizeof(long)) - 1 + sizeof(struct mptcp_data_frag)
+ > U8_MAX);
}
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 0bd1ee860316..02031007100b 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -263,7 +263,8 @@ struct mptcp_data_frag {
u64 data_seq;
u16 data_len;
u16 offset;
- u16 overhead;
+ u8 overhead;
+ u8 __unused;
u16 already_sent;
struct page *page;
};
--
2.53.0
next prev parent reply other threads:[~2026-04-03 11:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 11:29 [PATCH net-next 0/5] mptcp: support MSG_EOR and small cleanups Matthieu Baerts (NGI0)
2026-04-03 11:29 ` Matthieu Baerts (NGI0) [this message]
2026-04-03 11:29 ` [PATCH net-next 2/5] mptcp: preserve MSG_EOR semantics in sendmsg path Matthieu Baerts (NGI0)
2026-04-03 11:29 ` [PATCH net-next 3/5] tcp: add recv_should_stop helper Matthieu Baerts (NGI0)
2026-04-03 11:29 ` [PATCH net-next 4/5] mptcp: pm: in-kernel: remove mptcp_pm_has_addr_attr_id Matthieu Baerts (NGI0)
2026-04-03 14:19 ` Matthieu Baerts
2026-04-03 11:29 ` [PATCH net-next 5/5] selftests: mptcp: join: recreate signal endp with same ID Matthieu Baerts (NGI0)
2026-04-07 2:20 ` [PATCH net-next 0/5] mptcp: support MSG_EOR and small cleanups patchwork-bot+netdevbpf
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=20260403-net-next-mptcp-msg_eor-misc-v1-1-b0b33bea3fed@kernel.org \
--to=matttbe@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yangang@kylinos.cn \
/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