Judge loss by arrival order and a deadline, one tx ring per stream

This commit is contained in:
flamingcow
2026-08-31 14:33:09 -07:00
parent 06fa759b1a
commit 7fa48da73c
12 changed files with 220 additions and 254 deletions
+3 -8
View File
@@ -116,7 +116,6 @@ type rxWorker struct {
spec *frameSpec
stats *rxStats
loss *lossWindow
masked *atomic.Bool
ready *sync.WaitGroup
}
@@ -133,10 +132,6 @@ func (w *rxWorker) run(done *atomic.Bool) {
w.ready.Done()
for !done.Load() {
// The worker just counts; the mask gate above decides what a masked
// tick's counts are worth. One flag load covers the batch for the loss
// window, whose gap charges outlive the tick they happened in.
masked := w.masked.Load()
n, err := recvmmsg(w.fd, hdrs, unix.MSG_WAITFORONE)
if n <= 0 {
if err != nil && err != unix.EAGAIN && err != unix.EINTR {
@@ -161,12 +156,12 @@ func (w *rxWorker) run(done *atomic.Bool) {
bytes += uint64(len(buf))
// The ethertype this socket is bound to already says which stream the
// frame belongs to, so a header naming another one is damaged, as is a
// sequence number the sender never reached.
if p.stream != w.stream || !w.loss.observe(p.seq, masked) {
// frame belongs to, so a header naming another one is damaged.
if p.stream != w.stream {
w.stats.badHdr.Add(1)
continue
}
w.loss.observe(p.seq)
want, ok := w.spec.expectedCRC(p.patIdx, p.payLen)
if !ok {