Skip to content

Commit 3454667

Browse files
v3.0: xdp: tx_loop: change MAX_TIMEOUTS to 1 (backport of #8775) (#8780)
xdp: tx_loop: change MAX_TIMEOUTS to 1 (#8775) Once upon a time we used to spin without sleeping, and we flushed batches after 500 empty spins on the receive channel. Then we added sleeping to save CPU but kept MAX_TIMEOUTS too high. When load is relatively low - like during banking - this can lead to a non-full batch to be held for up to 500ms, which can cause slots to be skipped. Fix by bringing MAX_TIMEOUTS to 1 which means that during banking we'll hold shreds for up to 1ms. (cherry picked from commit f1f797e) Co-authored-by: Alessandro Decina <[email protected]>
1 parent 57843a0 commit 3454667

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xdp/src/tx_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn tx_loop<T: AsRef<[u8]>, A: AsRef<[SocketAddr]>>(
118118
// How long we sleep waiting to receive shreds from the channel.
119119
const RECV_TIMEOUT: Duration = Duration::from_nanos(1000);
120120

121-
const MAX_TIMEOUTS: usize = 500;
121+
const MAX_TIMEOUTS: usize = 1;
122122

123123
// We try to collect _at least_ BATCH_SIZE packets before queueing into the NIC. This is to
124124
// avoid introducing too much per-packet overhead and giving the NIC time to complete work

0 commit comments

Comments
 (0)