Judge loss by arrival order and a deadline, one tx ring per stream
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
@@ -19,6 +21,7 @@ type txStats struct {
|
||||
type txWorker struct {
|
||||
fd int
|
||||
stream uint16
|
||||
cpu int
|
||||
spec *frameSpec
|
||||
batch int
|
||||
stats *txStats
|
||||
@@ -26,6 +29,16 @@ type txWorker struct {
|
||||
}
|
||||
|
||||
func (w *txWorker) run(done *atomic.Bool) {
|
||||
// XPS keys the hardware ring on the sending cpu, so the feeder lives on
|
||||
// its own cpu for the stream's own ring: wire order within the stream is
|
||||
// ring order, and one feeder stalling leaves the other stream's ring
|
||||
// draining.
|
||||
runtime.LockOSThread()
|
||||
var set unix.CPUSet
|
||||
set.Set(w.cpu)
|
||||
if err := unix.SchedSetaffinity(0, &set); err != nil {
|
||||
panic(fmt.Sprintf("pinning tx stream %d to cpu %d: %v", w.stream, w.cpu, err))
|
||||
}
|
||||
// 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)
|
||||
|
||||
Reference in New Issue
Block a user