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
This commit is contained in:
Kevin Krakauer
2023-06-01 09:42:07 -07:00
committed by gVisor bot
parent c77d00a7ee
commit 16f76ac493
2 changed files with 24 additions and 1 deletions
+1 -1
View File
@@ -754,7 +754,7 @@ func (e *endpoint) GSOMaxSize() uint32 {
return e.gsoMaxSize
}
// SupportsHWGSO implements stack.GSOEndpoint.
// SupportedGSO implements stack.GSOEndpoint.
func (e *endpoint) SupportedGSO() stack.SupportedGSO {
return e.gsoKind
}
+23
View File
@@ -133,8 +133,15 @@ type Options struct {
// VirtioNetHeaderRequired if true, indicates that all outbound packets should have
// a virtio header and inbound packets should have a virtio header as well.
VirtioNetHeaderRequired bool
// GSOMaxSize is the maximum GSO packet size. It is zero if GSO is
// disabled. Note that only gVisor GSO is supported, not host GSO.
GSOMaxSize uint32
}
var _ stack.LinkEndpoint = (*endpoint)(nil)
var _ stack.GSOEndpoint = (*endpoint)(nil)
type endpoint struct {
// mtu (maximum transmission unit) is the maximum size of a packet.
// mtu is immutable.
@@ -160,6 +167,11 @@ type endpoint struct {
// hdrSize is immutable.
hdrSize uint32
// gSOMaxSize is the maximum GSO packet size. It is zero if GSO is
// disabled. Note that only gVisor GSO is supported, not host GSO.
// gsoMaxSize is immutable.
gsoMaxSize uint32
// virtioNetHeaderRequired if true indicates that a virtio header is expected
// in all inbound/outbound packets.
virtioNetHeaderRequired bool
@@ -202,6 +214,7 @@ func New(opts Options) (stack.LinkEndpoint, error) {
peerFD: opts.PeerFD,
onClosed: opts.OnClosed,
virtioNetHeaderRequired: opts.VirtioNetHeaderRequired,
gsoMaxSize: opts.GSOMaxSize,
}
if err := e.tx.init(opts.BufferSize, &opts.TX); err != nil {
@@ -480,3 +493,13 @@ func (e *endpoint) dispatchLoop(d stack.NetworkDispatcher) {
func (*endpoint) ARPHardwareType() header.ARPHardwareType {
return header.ARPHardwareEther
}
// GSOMaxSize implements stack.GSOEndpoint.
func (e *endpoint) GSOMaxSize() uint32 {
return e.gsoMaxSize
}
// SupportsGSO implements stack.GSOEndpoint.
func (e *endpoint) SupportedGSO() stack.SupportedGSO {
return stack.GvisorGSOSupported
}