Hardware lock-in cleanup: ice RX counter set and by-driver map collapsed to the single ixgbe nicRxFields list (newNICPoller drops its redundant driver gate), checkCoalesce loses the try-tx-then-EINVAL fallback and sets rx-usecs shared with tx as the one path, ice-attributed comments neutralized, dead errs.total removed with its redundant test assertion; ice counter reference set recorded in docs/nics/e810; verified on hardware (20.00G, zero errors, ECD 41m)
This commit is contained in:
@@ -59,9 +59,7 @@ func rxRings(fd int, ifname string) (uint64, error) {
|
||||
return nfc.data, nil
|
||||
}
|
||||
|
||||
// Returns the installed rule locations and the total filter capacity. ice
|
||||
// only honours filters near the top of that range, which is why ethtool's own
|
||||
// rule manager allocates downwards from the end.
|
||||
// Returns the installed rule locations and the total filter capacity.
|
||||
func allRuleLocations(fd int, ifname string) ([]uint32, uint32, error) {
|
||||
cnt := ethtoolRxnfc{cmd: ethtoolGRXCLSRLCNT}
|
||||
if err := ethtoolCall(fd, ifname, unsafe.Pointer(&cnt)); err != nil {
|
||||
@@ -111,7 +109,8 @@ func deleteRule(fd int, ifname string, loc uint32) error {
|
||||
return ethtoolCall(fd, ifname, unsafe.Pointer(&nfc))
|
||||
}
|
||||
|
||||
// ice rejects RX_CLS_LOC_ANY, so the caller must supply a free location.
|
||||
// RX_CLS_LOC_ANY is not honoured here, so the caller supplies a free location,
|
||||
// allocated downward from the top to match ethtool's own rule manager.
|
||||
func insertEtherRule(fd int, ifname string, ethType uint16, queue uint64, loc uint32) error {
|
||||
nfc := ethtoolRxnfc{cmd: ethtoolSRXCLSRLINS}
|
||||
nfc.fs.flowType = etherFlow
|
||||
@@ -589,7 +588,10 @@ func checkLinkUp(fd int, ifname string) checkResult {
|
||||
return res
|
||||
}
|
||||
|
||||
func checkCoalesce(fd int, ifname string, rxUsecs, txUsecs uint32) checkResult {
|
||||
// ixgbe runs mixed rx/tx interrupt vectors — one moderation value per vector,
|
||||
// so rx-usecs covers both, a tx-specific value is rejected, and get reports
|
||||
// the tx side as zero.
|
||||
func checkCoalesce(fd int, ifname string, usecs uint32) checkResult {
|
||||
res := checkResult{item: ifname + " coalesce"}
|
||||
ec, err := getCoalesce(fd, ifname)
|
||||
if err != nil {
|
||||
@@ -597,49 +599,28 @@ func checkCoalesce(fd int, ifname string, rxUsecs, txUsecs uint32) checkResult {
|
||||
return res
|
||||
}
|
||||
desc := func(e ethtoolCoalesce) string {
|
||||
return fmt.Sprintf("adaptive rx=%d tx=%d rx-usecs=%d tx-usecs=%d",
|
||||
e.useAdaptiveRxCoalesce, e.useAdaptiveTxCoalesce, e.rxCoalesceUsecs, e.txCoalesceUsecs)
|
||||
return fmt.Sprintf("adaptive rx=%d tx=%d rx-usecs=%d shared with tx",
|
||||
e.useAdaptiveRxCoalesce, e.useAdaptiveTxCoalesce, e.rxCoalesceUsecs)
|
||||
}
|
||||
settled := func(e ethtoolCoalesce, tx uint32) bool {
|
||||
return e.useAdaptiveRxCoalesce == 0 && e.useAdaptiveTxCoalesce == 0 &&
|
||||
e.rxCoalesceUsecs == rxUsecs && e.txCoalesceUsecs == tx
|
||||
}
|
||||
if settled(ec, txUsecs) {
|
||||
if ec.useAdaptiveRxCoalesce == 0 && ec.useAdaptiveTxCoalesce == 0 &&
|
||||
ec.rxCoalesceUsecs == usecs && ec.txCoalesceUsecs == 0 {
|
||||
res.state = desc(ec)
|
||||
return res
|
||||
}
|
||||
was := desc(ec)
|
||||
set := func(tx uint32) error {
|
||||
s := ec
|
||||
s.cmd = unix.ETHTOOL_SCOALESCE
|
||||
s.useAdaptiveRxCoalesce = 0
|
||||
s.useAdaptiveTxCoalesce = 0
|
||||
s.rxCoalesceUsecs = rxUsecs
|
||||
s.txCoalesceUsecs = tx
|
||||
return ethtoolCall(fd, ifname, unsafe.Pointer(&s))
|
||||
}
|
||||
err = set(txUsecs)
|
||||
// A driver running mixed rx/tx vectors has one moderation value per
|
||||
// vector and rejects a tx-specific one: rx-usecs covers both, and get
|
||||
// reports the tx side as zero.
|
||||
if err == unix.EINVAL {
|
||||
if settled(ec, 0) {
|
||||
res.state = desc(ec) + " (tx shares rx)"
|
||||
return res
|
||||
}
|
||||
if err = set(0); err == nil {
|
||||
res.fixed = true
|
||||
res.state = fmt.Sprintf("was %s, now adaptive off rx-usecs=%d shared with tx", was, rxUsecs)
|
||||
return res
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
s := ec
|
||||
s.cmd = unix.ETHTOOL_SCOALESCE
|
||||
s.useAdaptiveRxCoalesce = 0
|
||||
s.useAdaptiveTxCoalesce = 0
|
||||
s.rxCoalesceUsecs = usecs
|
||||
s.txCoalesceUsecs = 0
|
||||
if err := ethtoolCall(fd, ifname, unsafe.Pointer(&s)); err != nil {
|
||||
res.err = err
|
||||
res.state = "could not set"
|
||||
return res
|
||||
}
|
||||
res.fixed = true
|
||||
res.state = fmt.Sprintf("was %s, now adaptive off rx-usecs=%d tx-usecs=%d", was, rxUsecs, txUsecs)
|
||||
res.state = fmt.Sprintf("was %s, now adaptive off rx-usecs=%d shared with tx", was, usecs)
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -753,7 +734,7 @@ func configureSystem(ifnames []string, ethertypes []uint16) []checkResult {
|
||||
// Ring changes reprogram the queues, so flow rules pointing at those
|
||||
// queues have to be installed afterwards.
|
||||
out = append(out, checkRings(fd, ifname, wantRxRing, wantTxRing))
|
||||
out = append(out, checkCoalesce(fd, ifname, wantCoalesceUsecs, wantCoalesceUsecs))
|
||||
out = append(out, checkCoalesce(fd, ifname, wantCoalesceUsecs))
|
||||
out = append(out, checkFlowRules(fd, ifname, ethertypes))
|
||||
}
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user