diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-10-22 18:59:52 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-10-22 18:59:52 +0000 |
commit | 4bf4cd0e7a8be72bf467f7d580d0fd3242b3a645 (patch) | |
tree | d33823e595a186be5bf1cfd02d0e14b9cbba73d8 /pkg/tcpip/link/channel/channel.go | |
parent | 1e55a0ef32ae01e56ec07c660468039d2ab4288b (diff) | |
parent | 8720bd643ef37a693984baba83c37458f6691df1 (diff) |
Merge release-20190806.1-300-g8720bd6 (automated)
Diffstat (limited to 'pkg/tcpip/link/channel/channel.go')
-rwxr-xr-x | pkg/tcpip/link/channel/channel.go | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/pkg/tcpip/link/channel/channel.go b/pkg/tcpip/link/channel/channel.go index 95c6f0828..14f197a77 100755 --- a/pkg/tcpip/link/channel/channel.go +++ b/pkg/tcpip/link/channel/channel.go @@ -96,7 +96,7 @@ func (e *Endpoint) MTU() uint32 { func (e *Endpoint) Capabilities() stack.LinkEndpointCapabilities { caps := stack.LinkEndpointCapabilities(0) if e.GSO { - caps |= stack.CapabilityGSO + caps |= stack.CapabilityHardwareGSO } return caps } @@ -134,6 +134,33 @@ func (e *Endpoint) WritePacket(_ *stack.Route, gso *stack.GSO, hdr buffer.Prepen return nil } +// WritePackets stores outbound packets into the channel. +func (e *Endpoint) WritePackets(_ *stack.Route, gso *stack.GSO, hdrs []stack.PacketDescriptor, payload buffer.VectorisedView, protocol tcpip.NetworkProtocolNumber) (int, *tcpip.Error) { + payloadView := payload.ToView() + n := 0 +packetLoop: + for i := range hdrs { + hdr := &hdrs[i].Hdr + off := hdrs[i].Off + size := hdrs[i].Size + p := PacketInfo{ + Header: hdr.View(), + Proto: protocol, + Payload: buffer.NewViewFromBytes(payloadView[off : off+size]), + GSO: gso, + } + + select { + case e.C <- p: + n++ + default: + break packetLoop + } + } + + return n, nil +} + // WriteRawPacket implements stack.LinkEndpoint.WriteRawPacket. func (e *Endpoint) WriteRawPacket(packet buffer.VectorisedView) *tcpip.Error { p := PacketInfo{ |