mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
netstack: use bytes.Equal in GRO
bytes.Equal produces faster compiled code. PiperOrigin-RevId: 536778125
This commit is contained in:
committed by
gVisor bot
parent
9a2f1d041a
commit
d1148811c6
+3
-14
@@ -15,6 +15,7 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -181,14 +182,7 @@ func (gb *groBucket) findGROPacket6(pkt PacketBufferPtr, ipHdr header.IPv6, tcpH
|
||||
continue
|
||||
}
|
||||
// Unlike IPv4, IPv6 packets with extension headers can be coalesced.
|
||||
hdrsEqual := true
|
||||
for i := header.IPv6MinimumSize; i < len(ipHdr); i++ {
|
||||
if ipHdr[i] != groIPHdr[i] {
|
||||
hdrsEqual = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hdrsEqual {
|
||||
if !bytes.Equal(ipHdr[header.IPv6MinimumSize:], groIPHdr[header.IPv6MinimumSize:]) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -723,12 +717,7 @@ func shouldFlushTCP(groPkt *groPacket, tcpHdr header.TCP) bool {
|
||||
return true
|
||||
}
|
||||
// The options, including timestamps, must be identical.
|
||||
for i := header.TCPMinimumSize; i < int(dataOff); i++ {
|
||||
if tcpHdr[i] != groPkt.tcpHdr[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return !bytes.Equal(tcpHdr[header.TCPMinimumSize:], groPkt.tcpHdr[header.TCPMinimumSize:])
|
||||
}
|
||||
|
||||
func updateIPv4Hdr(ipHdrBytes []byte, newBytes int) {
|
||||
|
||||
Reference in New Issue
Block a user