MPTCP Linux Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v12 1/7] mptcp: use local variable tp in sendmsg_frag
Date: Mon, 30 Nov 2026 06:29:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-240480@kernel.org> (raw)
In-Reply-To: <5ea9abd443e8c9a73c094ce92610200f438a7a58.1796019473.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mptcp: incomplete conversion to local variable tp in
  mptcp_sendmsg_frag()
--

commit e1a0fc5eae2c7cc5e3f3690ee2878f7fadb4d91b
Author: Geliang Tang <geliang@kernel.org>

mptcp: use local variable tp in sendmsg_frag

This commit introduces a local variable tp for tcp_sk(ssk) in
mptcp_sendmsg_frag() and replaces repeated tcp_sk(ssk) calls with it.

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index b9c6e5a615c8b..58cb11b25253d 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1456,6 +1456,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
>  	u64 data_seq = dfrag->data_seq + info->sent;
>  	int offset = dfrag->offset + info->sent;
>  	struct mptcp_sock *msk = mptcp_sk(sk);
> +	struct tcp_sock *tp = tcp_sk(ssk);
>  	bool zero_window_probe = false;
>  	struct mptcp_ext *mpext = NULL;
>  	bool can_coalesce = false;
> @@ -1505,14 +1506,14 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
>  		mpext = mptcp_get_ext(skb);
>  		if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) {
>  			TCP_SKB_CB(skb)->eor = 1;
> -			tcp_mark_push(tcp_sk(ssk), skb);
> +			tcp_mark_push(tp, skb);
>  			goto alloc_skb;
>  		}
>  
>  		i = skb_shinfo(skb)->nr_frags;
>  		can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset);
>  		if (!can_coalesce && i >= READ_ONCE(net_hotdata.sysctl_max_skb_frags)) {
> -			tcp_mark_push(tcp_sk(ssk), skb);
> +			tcp_mark_push(tp, skb);
>  			goto alloc_skb;
>  		}
>  
> @@ -1590,7 +1591,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
>  	skb->truesize += copy;
>  	sk_wmem_queued_add(ssk, copy);
>  	sk_mem_charge(ssk, copy);
> -	WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy);
> +	WRITE_ONCE(tp->write_seq, tp->write_seq + copy);
>  	TCP_SKB_CB(skb)->end_seq += copy;
>  	tcp_skb_pcount_set(skb, 0);
>  

[Severity: Low]
This isn't a bug, but two other tcp_sk(ssk) calls remain in
mptcp_sendmsg_frag() and could also use tp:

net/mptcp/protocol.c:mptcp_sendmsg_frag() {
    ...
	if (unlikely(before64(data_seq, msk->snd_nxt) &&
		     !test_bit(MPTCP_JOINED, &msk->flags) &&
		     after(tcp_sk(ssk)->snd_una, subflow->opt_ack_seq))) {
    ...
	if (unlikely(before64(data_seq, msk->snd_nxt))) {
		mptcp_subflow_ctx(ssk)->old_data_end = tcp_sk(ssk)->write_seq;
		mptcp_subflow_ctx(ssk)->old_data_pending = 1;
	}
    ...
}

Converting those as well would avoid the remaining tcp_sk(ssk) evaluations
(including the redundant WARN_ON() check under CONFIG_DEBUG_NET).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796019473.git.tanggeliang@kylinos.cn?part=1

  reply	other threads:[~2026-11-30  6:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  6:25 [PATCH mptcp-next v12 0/7] mptcp: add MSG_ZEROCOPY support Geliang Tang
2026-11-30  6:25 ` [PATCH mptcp-next v12 1/7] mptcp: use local variable tp in sendmsg_frag Geliang Tang
2026-11-30  6:29   ` sashiko-bot [this message]
2026-11-30  6:25 ` [PATCH mptcp-next v12 2/7] mptcp: remove redundant orig_offset in carve_data_frag Geliang Tang
2026-11-30  6:25 ` [PATCH mptcp-next v12 3/7] mptcp: add MSG_ZEROCOPY support Geliang Tang
2026-11-30  6:56   ` sashiko-bot
2026-11-30  6:25 ` [PATCH mptcp-next v12 4/7] mptcp: handle SO_ZEROCOPY in setsockopt Geliang Tang
2026-11-30  6:25 ` [PATCH mptcp-next v12 5/7] Documentation: msg_zerocopy: add MPTCP support Geliang Tang
2026-11-30  6:25 ` [PATCH mptcp-next v12 6/7] selftests: net: " Geliang Tang
2026-11-30  6:25 ` [PATCH mptcp-next v12 7/7] selftests: mptcp: cover msg_zerocopy test Geliang Tang
2026-11-30  6:40   ` sashiko-bot
2026-11-30  7:30 ` [PATCH mptcp-next v12 0/7] mptcp: add MSG_ZEROCOPY support MPTCP CI

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=sashiko-outbox-240480@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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