Measure cable length from hardware transmit and receive timestamps

This commit is contained in:
flamingcow
2026-07-25 22:38:52 -07:00
parent 09411aebdf
commit 1b322bb32b
6 changed files with 454 additions and 18 deletions
+4 -2
View File
@@ -196,7 +196,8 @@ func checkFlowRules(fd int, ifname string, ethertypes []uint16) checkResult {
return res
}
type ethtoolIfreq struct {
// The ifreq shape used by every ioctl that passes its payload by pointer.
type dataIfreq struct {
name [unix.IFNAMSIZ]byte
data unsafe.Pointer
_ [16]byte
@@ -283,7 +284,7 @@ func (r checkResult) detail() string {
}
func ethtoolCall(fd int, ifname string, data unsafe.Pointer) error {
var ifr ethtoolIfreq
var ifr dataIfreq
if len(ifname) >= unix.IFNAMSIZ {
return fmt.Errorf("interface name %q too long", ifname)
}
@@ -482,6 +483,7 @@ func configureSystem(ifnames []string, ethertypes []uint16) []checkResult {
}
out = append(out, checkCarrier(ifname, carrierWait))
out = append(out, checkCoalesce(fd, ifname, wantCoalesceUsecs, wantCoalesceUsecs))
out = append(out, checkTimestamping(fd, ifname))
out = append(out, checkFlowRules(fd, ifname, ethertypes))
}
return out