Skip to content

RFC mptcp: rework poll+nospace handling

Florian Westphal mptcp 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mptcp: split mptcp_clean_una functionnet/mptcp/protocol.c+20 -140 replies
2/3mptcp: rework poll+nospace handlingnet/mptcp/protocol.c net/mptcp/protocol.h net/mptcp/subflow.c+74 -375 replies
3/3mptcp: try to clean data inplace if possiblenet/mptcp/protocol.c+22 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [MPTCP] [RFC mptcp-next 0/3] mptcp: rework poll+nospace handling

A while back I had a discussion with Paolo on how mptcp handles the 'is mptcp socket writeable' handling in the sendmsg path, rather than the poll one.

There are only two cases:
1. Blocking IO, where userspace calls send/read.
In this scenario, maintaining the MPTCP_SEND_SPACE bit in sendmsg path is useless extra work -- userspace will block at send time if no more wmem is available.

2. Nonblocking IO.
If userspace calls sendmsg without checking poll first, it has to cope with -EAGAIN.
If userspace does call poll first, then mptcp can do the 'is mptcp socket writeable' check in mptcp_poll.

Consequently, patch #2 removes ssk_check_wmem(). A similar test is added to mptcp_poll().

Furthermore, the MPTCP_SEND_SPACE bit has its meaning inverted and gets renamed to MPTCP_NOSPACE. Its only function is to let the mptcp_data_acked() path know if the mptcp worker needs to be scheduled or not.

IOW, when sendmsg path is going to sleep, or when poll path finds socket isn't writeable, this bit makes sure that the next data ack will wake userspace.

For the unlikely case that the mptcp socket is writeable but subflow sockets are not, this will still enable tcp-level callbacks via the SOCK_NOSPACE machinery.

Sending as RFC for now as I'm not sure others consider this approach better or easier to follow then what we currently have.

First patch might be useful in its own right even if #2 is rejected.