Bucket received frames by their mac receive stamp and read one bucket back
This commit is contained in:
@@ -114,6 +114,22 @@ func newMmsghdrs(bufs [][]byte) ([]mmsghdr, []unix.Iovec) {
|
||||
return hdrs, iovs
|
||||
}
|
||||
|
||||
// Room for one SCM_TIMESTAMPING and its three timespecs.
|
||||
const cmsgLen = 128
|
||||
|
||||
// Receive headers carry a control buffer each, so the mac's receive stamp comes
|
||||
// back alongside every frame.
|
||||
func newRxMmsghdrs(bufs [][]byte) ([]mmsghdr, [][]byte) {
|
||||
hdrs, _ := newMmsghdrs(bufs)
|
||||
oob := make([][]byte, len(bufs))
|
||||
for i := range bufs {
|
||||
oob[i] = make([]byte, cmsgLen)
|
||||
hdrs[i].hdr.Control = &oob[i][0]
|
||||
hdrs[i].hdr.Controllen = cmsgLen
|
||||
}
|
||||
return hdrs, oob
|
||||
}
|
||||
|
||||
func packetDrops(fd int) uint64 {
|
||||
st, err := unix.GetsockoptTpacketStats(fd, unix.SOL_PACKET, unix.PACKET_STATISTICS)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user