Mask measure blips end to end and show a running median cable length
This commit is contained in:
@@ -45,8 +45,9 @@ const (
|
||||
// Covers the handler's documented 2 s freeze during 10GBASE-T training.
|
||||
bcmStatusTimeout = 3 * time.Second
|
||||
|
||||
ecdPoll = 200 * time.Millisecond
|
||||
ecdDeadline = 50 * time.Second
|
||||
ecdPoll = 200 * time.Millisecond
|
||||
ecdArmDeadline = 2 * time.Second
|
||||
ecdDeadline = 50 * time.Second
|
||||
)
|
||||
|
||||
type bcm struct {
|
||||
@@ -272,6 +273,24 @@ func (b *bcm) cableDiag() (res ecdResult, err error) {
|
||||
if err = b.mdioWrite(bcmMMDVendor, bcmRegECDCtrl, ctrl&^0xF400|0x8400); err != nil {
|
||||
return
|
||||
}
|
||||
// A diag takes seconds against a 200 ms poll, so busy must be seen set
|
||||
// before clear means finished; accepting an early clear reads the
|
||||
// result of a diag that never armed, which is an instant all-zero
|
||||
// "success" while restartAN still tears the link down.
|
||||
arm := time.Now().Add(ecdArmDeadline)
|
||||
for {
|
||||
if ctrl, err = b.mdioRead(bcmMMDVendor, bcmRegECDCtrl); err != nil {
|
||||
return
|
||||
}
|
||||
if ctrl&0x0800 != 0 {
|
||||
break
|
||||
}
|
||||
if time.Now().After(arm) {
|
||||
err = fmt.Errorf("%s: cable diag never armed within %s", b.ifname, ecdArmDeadline)
|
||||
return
|
||||
}
|
||||
time.Sleep(ecdPoll)
|
||||
}
|
||||
deadline := time.Now().Add(ecdDeadline)
|
||||
for {
|
||||
if ctrl, err = b.mdioRead(bcmMMDVendor, bcmRegECDCtrl); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user