Cycle every payload pattern per packet and always run both directions

This commit is contained in:
flamingcow
2026-07-25 23:03:31 -07:00
parent 0f16edfe61
commit e77574712d
8 changed files with 75 additions and 104 deletions
+7 -2
View File
@@ -24,10 +24,14 @@ type txWorker struct {
}
func (w *txWorker) run(done *atomic.Bool) {
// The batch is not a multiple of the pattern count, so the pairing of pattern
// to size rotates every pass rather than settling into a fixed one.
bufs := make([][]byte, w.batch)
pats := make([]int, w.batch)
for i := range bufs {
bufs[i] = make([]byte, w.spec.maxSize)
w.spec.prefill(bufs[i])
pats[i] = i % len(patterns)
w.spec.prefill(bufs[i], pats[i])
}
hdrs, iovs := newMmsghdrs(bufs)
sizes := make([]int, w.batch)
@@ -44,7 +48,8 @@ func (w *txWorker) run(done *atomic.Bool) {
si = 0
}
sizes[i] = size
putHeader(bufs[i], w.spec.patIdx, w.stream, seq+uint64(i), size-minFrame, w.spec.crcFor[size])
putHeader(bufs[i], pats[i], w.stream, seq+uint64(i), size-minFrame,
w.spec.crcFor[pats[i]][size])
iovs[i].Len = uint64(size)
}