@@ -133,8 +133,15 @@ type Options struct {
133
133
// VirtioNetHeaderRequired if true, indicates that all outbound packets should have
134
134
// a virtio header and inbound packets should have a virtio header as well.
135
135
VirtioNetHeaderRequired bool
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
+ GSOMaxSize uint32
136
140
}
137
141
142
+ var _ stack.LinkEndpoint = (* endpoint )(nil )
143
+ var _ stack.GSOEndpoint = (* endpoint )(nil )
144
+
138
145
type endpoint struct {
139
146
// mtu (maximum transmission unit) is the maximum size of a packet.
140
147
// mtu is immutable.
@@ -160,6 +167,11 @@ type endpoint struct {
160
167
// hdrSize is immutable.
161
168
hdrSize uint32
162
169
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
+ gsoMaxSize uint32
174
+
163
175
// virtioNetHeaderRequired if true indicates that a virtio header is expected
164
176
// in all inbound/outbound packets.
165
177
virtioNetHeaderRequired bool
@@ -202,6 +214,7 @@ func New(opts Options) (stack.LinkEndpoint, error) {
202
214
peerFD : opts .PeerFD ,
203
215
onClosed : opts .OnClosed ,
204
216
virtioNetHeaderRequired : opts .VirtioNetHeaderRequired ,
217
+ gsoMaxSize : opts .GSOMaxSize ,
205
218
}
206
219
207
220
if err := e .tx .init (opts .BufferSize , & opts .TX ); err != nil {
@@ -480,3 +493,13 @@ func (e *endpoint) dispatchLoop(d stack.NetworkDispatcher) {
480
493
func (* endpoint ) ARPHardwareType () header.ARPHardwareType {
481
494
return header .ARPHardwareEther
482
495
}
496
+
497
+ // GSOMaxSize implements stack.GSOEndpoint.
498
+ func (e * endpoint ) GSOMaxSize () uint32 {
499
+ return e .gsoMaxSize
500
+ }
501
+
502
+ // SupportsGSO implements stack.GSOEndpoint.
503
+ func (e * endpoint ) SupportedGSO () stack.SupportedGSO {
504
+ return stack .GvisorGSOSupported
505
+ }
0 commit comments