pre-fill the tx ring with bogus empty packets

This commit is contained in:
JackDoan
2025-12-18 15:18:19 -06:00
parent 726e282d0a
commit 111efc0779
7 changed files with 57 additions and 50 deletions

View File

@@ -87,17 +87,15 @@ func (p *UDPPacket) updateCtrl(ctrlLen int) {
if len(p.Control) == 0 {
return
}
cmsgs, err := unix.ParseSocketControlMessage(p.Control)
header, data, _ /*remain*/, err := unix.ParseOneSocketControlMessage(p.Control)
if err != nil {
return // oh well
}
for _, c := range cmsgs {
if c.Header.Level == unix.SOL_UDP && c.Header.Type == unix.UDP_GRO && len(c.Data) >= 2 {
p.wasSegmented = true
p.SegSize = int(binary.LittleEndian.Uint16(c.Data[:2]))
return
}
if header.Level == unix.SOL_UDP && header.Type == unix.UDP_GRO && len(data) >= 2 {
p.wasSegmented = true
p.SegSize = int(binary.LittleEndian.Uint16(data[:2]))
return
}
}