Check the header version on arrival and say what the error window actually spans
This commit is contained in:
@@ -11,6 +11,7 @@ const (
|
|||||||
ethHdrLen = 14
|
ethHdrLen = 14
|
||||||
hdrLen = 20
|
hdrLen = 20
|
||||||
hdrMagic = 0x43424c54
|
hdrMagic = 0x43424c54
|
||||||
|
hdrVer = 1
|
||||||
minFrame = ethHdrLen + hdrLen
|
minFrame = ethHdrLen + hdrLen
|
||||||
maxFrame = 9216
|
maxFrame = 9216
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ func headerCheck(h []byte) uint16 {
|
|||||||
func putHeader(buf []byte, patIdx int, stream uint16, seq uint64, payLen int) {
|
func putHeader(buf []byte, patIdx int, stream uint16, seq uint64, payLen int) {
|
||||||
h := buf[ethHdrLen:]
|
h := buf[ethHdrLen:]
|
||||||
binary.BigEndian.PutUint32(h[0:4], hdrMagic)
|
binary.BigEndian.PutUint32(h[0:4], hdrMagic)
|
||||||
h[4] = 1
|
h[4] = hdrVer
|
||||||
h[5] = byte(patIdx)
|
h[5] = byte(patIdx)
|
||||||
binary.BigEndian.PutUint16(h[6:8], stream)
|
binary.BigEndian.PutUint16(h[6:8], stream)
|
||||||
binary.BigEndian.PutUint64(h[8:16], seq)
|
binary.BigEndian.PutUint64(h[8:16], seq)
|
||||||
@@ -176,6 +177,11 @@ func parseHeader(buf []byte) (parsed, hdrStatus) {
|
|||||||
if binary.BigEndian.Uint16(h[hdrCheckOff:]) != headerCheck(h) {
|
if binary.BigEndian.Uint16(h[hdrCheckOff:]) != headerCheck(h) {
|
||||||
return p, hdrDamaged
|
return p, hdrDamaged
|
||||||
}
|
}
|
||||||
|
// Both halves are the same build, so the only way this differs is a checksum
|
||||||
|
// that happened to agree over damaged bytes.
|
||||||
|
if h[4] != hdrVer {
|
||||||
|
return p, hdrDamaged
|
||||||
|
}
|
||||||
p.patIdx = int(h[5])
|
p.patIdx = int(h[5])
|
||||||
p.stream = binary.BigEndian.Uint16(h[6:8])
|
p.stream = binary.BigEndian.Uint16(h[6:8])
|
||||||
p.seq = binary.BigEndian.Uint64(h[8:16])
|
p.seq = binary.BigEndian.Uint64(h[8:16])
|
||||||
|
|||||||
@@ -541,8 +541,8 @@ const (
|
|||||||
// Deliberately not tied to the refresh: letting a slow or blocked draw set
|
// Deliberately not tied to the refresh: letting a slow or blocked draw set
|
||||||
// the sampling clock would stretch the window it reports.
|
// the sampling clock would stretch the window it reports.
|
||||||
sampleInterval = 16 * time.Millisecond
|
sampleInterval = 16 * time.Millisecond
|
||||||
// How far back the shown errors reach and how many buckets the median runs
|
// How far back the shown errors reach. The rate is not taken from this ring
|
||||||
// over, so a step in the rate lands half this late.
|
// but from the receive buckets, which are keyed by the mac's clock.
|
||||||
rateWindowSpan = time.Second
|
rateWindowSpan = time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user