Skip to content

Commit 16f76ac

Browse files
kevinGCgvisor-bot
authored andcommitted
sharedmem: mark as GSO-compatible
Really, any LinkWriter is compatible with gVisor GSO: there's nothing special to be done. Anything with a WritePackets method is good to go. PiperOrigin-RevId: 537048401
1 parent c77d00a commit 16f76ac

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

pkg/tcpip/link/fdbased/endpoint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ func (e *endpoint) GSOMaxSize() uint32 {
754754
returne.gsoMaxSize
755755
}
756756

757-
// SupportsHWGSO implements stack.GSOEndpoint.
757+
// SupportedGSO implements stack.GSOEndpoint.
758758
func (e*endpoint) SupportedGSO() stack.SupportedGSO {
759759
returne.gsoKind
760760
}

pkg/tcpip/link/sharedmem/sharedmem.go

+23
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,15 @@ type Options struct {
133133
// VirtioNetHeaderRequired if true, indicates that all outbound packets should have
134134
// a virtio header and inbound packets should have a virtio header as well.
135135
VirtioNetHeaderRequiredbool
136+
137+
// GSOMaxSize is the maximum GSO packet size. It is zero if GSO is
138+
// disabled. Note that only gVisor GSO is supported, not host GSO.
139+
GSOMaxSizeuint32
136140
}
137141

142+
var_ stack.LinkEndpoint= (*endpoint)(nil)
143+
var_ stack.GSOEndpoint= (*endpoint)(nil)
144+
138145
typeendpointstruct {
139146
// mtu (maximum transmission unit) is the maximum size of a packet.
140147
// mtu is immutable.
@@ -160,6 +167,11 @@ type endpoint struct {
160167
// hdrSize is immutable.
161168
hdrSizeuint32
162169

170+
// gSOMaxSize is the maximum GSO packet size. It is zero if GSO is
171+
// disabled. Note that only gVisor GSO is supported, not host GSO.
172+
// gsoMaxSize is immutable.
173+
gsoMaxSizeuint32
174+
163175
// virtioNetHeaderRequired if true indicates that a virtio header is expected
164176
// in all inbound/outbound packets.
165177
virtioNetHeaderRequiredbool
@@ -202,6 +214,7 @@ func New(opts Options) (stack.LinkEndpoint, error) {
202214
peerFD: opts.PeerFD,
203215
onClosed: opts.OnClosed,
204216
virtioNetHeaderRequired: opts.VirtioNetHeaderRequired,
217+
gsoMaxSize: opts.GSOMaxSize,
205218
}
206219

207220
iferr:=e.tx.init(opts.BufferSize, &opts.TX); err!=nil {
@@ -480,3 +493,13 @@ func (e *endpoint) dispatchLoop(d stack.NetworkDispatcher) {
480493
func (*endpoint) ARPHardwareType() header.ARPHardwareType {
481494
returnheader.ARPHardwareEther
482495
}
496+
497+
// GSOMaxSize implements stack.GSOEndpoint.
498+
func (e*endpoint) GSOMaxSize() uint32 {
499+
returne.gsoMaxSize
500+
}
501+
502+
// SupportsGSO implements stack.GSOEndpoint.
503+
func (e*endpoint) SupportedGSO() stack.SupportedGSO {
504+
returnstack.GvisorGSOSupported
505+
}

0 commit comments

Comments
 (0)
close