mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Properly account for all lower level headers when setting GSO limit.
Tested on gVNIC VM, PUT 10MB to GCS (3 run mean): ``` --gso=false: 1.05s --gso=true: 0.45s ``` Fixes #9816 PiperOrigin-RevId: 597304748
This commit is contained in:
committed by
gVisor bot
parent
9e364f4c23
commit
94e83c674e
@@ -46,6 +46,9 @@ const (
|
||||
// EthernetMinimumSize is the minimum size of a valid ethernet frame.
|
||||
EthernetMinimumSize = 14
|
||||
|
||||
// EthernetMaximumSize is the maximum size of a valid ethernet frame.
|
||||
EthernetMaximumSize = 18
|
||||
|
||||
// EthernetAddressSize is the size, in bytes, of an ethernet address.
|
||||
EthernetAddressSize = 6
|
||||
|
||||
|
||||
@@ -216,6 +216,11 @@ const (
|
||||
// TCPHeaderMaximumSize is the maximum header size of a TCP packet.
|
||||
TCPHeaderMaximumSize = TCPMinimumSize + TCPOptionsMaximumSize
|
||||
|
||||
// TCPTotalHeaderMaximumSize is the maximum size of headers from all layers in
|
||||
// a TCP packet. This will need to be updated if we decide to support more
|
||||
// layer 2 protocols or features like IP tunneling.
|
||||
TCPTotalHeaderMaximumSize = TCPHeaderMaximumSize + IPv4MaximumHeaderSize + EthernetMaximumSize
|
||||
|
||||
// TCPProtocolNumber is TCP's transport protocol number.
|
||||
TCPProtocolNumber tcpip.TransportProtocolNumber = 6
|
||||
|
||||
|
||||
@@ -953,7 +953,7 @@ func (s *sender) postXmit(dataSent bool, shouldScheduleProbe bool) {
|
||||
func (s *sender) sendData() {
|
||||
limit := s.MaxPayloadSize
|
||||
if s.gso {
|
||||
limit = int(s.ep.gso.MaxSize - header.TCPHeaderMaximumSize)
|
||||
limit = int(s.ep.gso.MaxSize - header.TCPTotalHeaderMaximumSize - 1)
|
||||
}
|
||||
end := s.SndUna.Add(s.SndWnd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user