Re: [PATCH net v2 5/6] net/smc: order the urgent mark across the cursor wrap rollover
From: Bryam Vargas
Date: Thu Dec 03 2026 - 04:17:51 EST
On 01/12/26 1:48 pm, Sidraya Jayagond wrote:
> With a 16 KiB RMB, urg = {0, 0} and cons = {1, 16383}, this returns 1
> although the reader is 32767 bytes past the mark. It also ignores
> urg_state, so a connection that never got urgent data (urg_curs is
> zeroed) or has a stale mark can report at-mark.
[...]
> Could you fold this into v3?
Folded into 5/7 as you wrote it:
https://lore.kernel.org/all/20261203-b4-disp-ba1ad55e-v3-5-6834ff90c5d0@xxxxxxxxx/
I ran your case, no urgent data and 32767 bytes read: net and v2
return 1, v3 returns 0. A valid mark 32767 bytes behind the reader
gives the same. Both halves of the check are needed. Without the state
check, the 1 is back once the reader is on wrap 65535, and with
smc_curs_diff() kept, it is back for the mark behind the reader.
The urg_rx_skip_pend operand changes the result in one case I could
find: recv(MSG_OOB) with data in front of the urgent byte, then
SO_OOBINLINE switched on, then a read up to the byte. The state is
SMC_URG_READ, the skip is pending and the reader is one byte before
the mark. v3 returns 1 there, as net and TCP do; without that operand
it returns 0.
One answer changes, and I want you to see it. After recv(MSG_OOB) of
an urgent byte with nothing in front of it, SIOCATMARK now returns 0.
net returns 1 there, and so does TCP. Without 7/7 the state is
SMC_URG_READ and no skip is pending, so the check is false. With 7/7
the reader has skipped the byte and the distance is 0. If a reader
calls recv(MSG_OOB) first and then reads until SIOCATMARK returns 1,
it keeps reading. On net that reader stops, and the sender's next
send() stalls, which is the case 7/7 fixes.
SMC already returns 0 after a read that reaches the mark: it skips the
urgent byte at that read, TCP at the next one. Returning 1 after
recv(MSG_OOB) needs one more state. After that call the state is
SMC_URG_READ and the reader is at the mark, and a new connection,
SMC_URG_READ with both cursors zero, looks the same. I left that out
of v3; it is under "Not fixed here". Is 0 fine with you there, or do
you want it handled in this series?
> Cc: stable@xxxxxxxxxxxxxxx # depends on 2/6 and 4/6
Added, as 2/7 and 4/7.
Thanks,
Bryam
pw-bot: cr