All of lore.kernel.org
 help / color / mirror / Atom feed
From: gang.yan@linux.dev
To: "Matthieu Baerts" <matttbe@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next] mptcp: preserve MSG_EOR semantics in sendmsg path
Date: Tue, 31 Mar 2026 06:54:58 +0000	[thread overview]
Message-ID: <4e5dee5ddbad71843a3ff2cb463690324df18acf@linux.dev> (raw)
In-Reply-To: <8eb9b926-9402-41e7-9574-f2886f67d14e@kernel.org>

March 30, 2026 at 5:50 PM, "Matthieu Baerts" <matttbe@kernel.org mailto:matttbe@kernel.org?to=%22Matthieu%20Baerts%22%20%3Cmatttbe%40kernel.org%3E > wrote:


> 
> Hi Gang,
> 
> On 30/03/2026 10:19, gang.yan@linux.dev wrote:
> 
> > 
> > March 27, 2026 at 12:42 AM, "Matthieu Baerts" <matttbe@kernel.org mailto:matttbe@kernel.org?to=%22Matthieu%20Baerts%22%20%3Cmatttbe%40kernel.org%3E > wrote:
> >  
> >  
> > 
> > > 
> > > Hi Gang,
> > > 
> > >  Thank you for the new version.
> > > 
> > >  On 09/03/2026 03:54, Gang Yan wrote:
> > > 
> >  From: Gang Yan <yangang@kylinos.cn>
> >  
> >  Extend MPTCP's sendmsg handling to recognize and honor the MSG_EOR flag,
> >  which marks the end of a record for application-level message boundaries.
> >  
> >  Data fragments tagged with MSG_EOR are explicitly marked in the
> >  mptcp_data_frag structure and skb context to prevent unintended
> >  coalescing with subsequent data chunks. This ensures the intent of
> >  applications using MSG_EOR is preserved across MPTCP subflows,
> >  maintaining consistent message segmentation behavior.
> >  
> >  Signed-off-by: Gang Yan <yangang@kylinos.cn>
> >  ---
> >  
> >  Notes:
> >  - This patch incorporates feedback and suggestions from Paolo Abeni
> >  and Geliang Tang, including memory alignment optimizations for the
> >  mptcp_data_frag struct (shrinking overhead to u8 and using bitfield
> >  for eor to avoid size increase) and compile-time checks with BUILD_BUG_ON.
> > 
> > > 
> > > Please mention why you shrank "overhead" to a u8 (not to increase the
> > >  struct size), and why it is OK to do so (u16 not needed because ...) +
> > >  explaining the BUILD_BUG_ON().
> > > 
> >  
> >  The ‘u8’ is one of Paolo's suggestions[1]. I think 'u16' is not needed because:
> >  - 'offset = ALIGN(orig_offset, sizeof(long));'
> >  - 'dfrag->offset = offset - origin_offset + sizeof(struct mptcp_data_frag);',
> >  the max value of offset is 7, and sizeof(struct mptcp_data_frag)) is
> >  usually 40, so the overhead is 47, far less than 255.
> > 
> Thank you for the explanation. Can you then mention in the commit
> message that it is fine to reduce overhead to a 'u8', and add the above
> explanation, please?
> 
> If 'offset' max value is 7, it could also be reduced from a u16 to a u8
> then, no?

Hi, Matt:

Sorry, there was an error in the explanation. The maximum value of
(offset - origin_offset) is 7, so the 'offset' variable should use u16.

> 
> > 
> > Another suggestion from Paolo[1] is a build time check on the max 'overhead'
> >  value. So I use 'ALIGN(1, sizeof(long)) + sizeof(struct mptcp_data_frag)' to
> >  represent the max_val of 'overhead'.
> > 
> It might be good to add a comment here too, at least to explain that
> "ALIGN(1, sizeof(long))" represents 'offset' maximum size.

Good idea, I'll apply your suggestions in v2.

Thanks
Gang
> 
> > 
> > But Paolo also mention it's probably too conservative. WDYT?
> > 
> Maybe, but it doesn't hurt I suppose. As long as this check is clearly
> linked to different fields from the mptcp_data_frag structure → having a
> comment explaining that.
> 
> Cheers,
> Matt
> -- 
> Sponsored by the NGI0 Core fund.
>

      reply	other threads:[~2026-03-31  6:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  2:54 [PATCH mptcp-next] mptcp: preserve MSG_EOR semantics in sendmsg path Gang Yan
2026-03-09  4:07 ` MPTCP CI
2026-03-26 16:42 ` Matthieu Baerts
2026-03-30  8:19   ` gang.yan
2026-03-30  9:50     ` Matthieu Baerts
2026-03-31  6:54       ` gang.yan [this message]

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=4e5dee5ddbad71843a3ff2cb463690324df18acf@linux.dev \
    --to=gang.yan@linux.dev \
    --cc=matttbe@kernel.org \
    --cc=mptcp@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.