Skip to content

finagle a STREAMS rx buffer size for DLPI handles - #1204

Merged
rcgoodfellow merged 3 commits into
masterfrom
ry/STREAMS-rx-buffer-size
Sep 4, 2026
Merged

finagle a STREAMS rx buffer size for DLPI handles#1204
rcgoodfellow merged 3 commits into
masterfrom
ry/STREAMS-rx-buffer-size

Conversation

@rcgoodfellow

@rcgoodfellow rcgoodfellow commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

STREAMS uses a high water mark as a back pressure mechanism. When we hit the high water mark, messages are dropped until we drain to the low water mark. This essentially makes the high water mark a receive buffer size.

For TCP on the STREAMS path (i.e. TPI consumers), it appears that the high water mark is set to SO_RCVBUF which is 128000 bytes. However, for DLPI the high water mark is not set and it defaults to 5120. This meaans we hit the mark at the first jumbo frame and thrash from there.

It seems the only way to influence this outside the kernel is pushing a passthrough bufmod STREAMS module. So that's what we do here for the time being.

It looks like the CI failure is addressed by #1093

@sion42x

sion42x commented Aug 28, 2026

Copy link
Copy Markdown

Ran tests and a/b checks on 64KB vs 4MB. Softnpu hits "fast enough" that way, with uploads and recovery finish beating race conditions and completing successfully. A combination of #1200 and #1204 would be required for voxel to use propolis main. Hoping we can get all three in soon!


let mut offset = 1;
for de in &dir[msg.offset as usize..] {
for (offset, de) in (1..).zip(dir[msg.offset as usize..].iter()) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thsi is addressing a recent clippy complaint.

@rcgoodfellow
rcgoodfellow marked this pull request as ready for review August 28, 2026 18:33

@iximeow iximeow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abstractly i Get How It Could Work and i trust you to have tested that softnpu works better with this change, but i'll admit i don't understand the mechanics of why These Flags do the needful..

anyhow, as you might have seen in the other PRs here, the header-check failure is an unfortunate consequence of when the viona API changes got into stlouis vs the Propolis side not being in yet, so feel free to merge even though that check's failing.

Comment on lines +319 to +321
// Disable chunking, still keeps the water mark that was applied for the
// supplied chunk. Yes this is relying on implicit behavior. Good motivation
// to get off DLPI entirely.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured I dunno how this works and it'd be interesting to fish through, my best guess is that doing all this to push q_hiwat to be large enough to at least contain this chunk since we've set it SB_NO_DROPS preventing the kernel from just dropping it? in which case, presumably we can't somehow strqset(.., QHIWAT, idk?, 0x120000)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushing the bufmod streams module is purely for the side-effect of impacting the high water mark. I set SB_NO_DROPS based on the comment in uts/common/io/bufmod.c that says

SB_NO_DROPS - bufmod behaves transparently in flow control and propagates the blocked flow
conditions downstream.

With the idea being having the bufmod be a pure passthrough. Afaict strqset is only available in the kernel so this is the best I could come up with. The snoop program does the same trick to effectively get a decent size receive buffer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, as i was looking through kernel source and strqset looked vaguely like how i've seen ioctls get plumbed through, but i see now that it's under Kernel Functions for Drivers so that explains the interface and why it wouldn't be usable here. welp. thanks for the pointers 🫡

@rcgoodfellow

Copy link
Copy Markdown
Contributor Author

i trust you to have tested that softnpu works better with this change

Yep, with this change I'm able to push ~1.5 gbps through a softnpu port. Up from ~5 mbps.

@rcgoodfellow
rcgoodfellow merged commit 3408a2d into master Sep 4, 2026
13 of 14 checks passed
@rcgoodfellow
rcgoodfellow deleted the ry/STREAMS-rx-buffer-size branch September 4, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants