summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2021-01-21 14:08:20 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-21 14:10:37 -0800
commit0ca4cf769840afa7c44477d75d9f780540c01fcd (patch)
tree913ad548260139ccb1bc8ba28434b2a4d58a5ce9 /pkg/tcpip/link
parent1005a8849173c84f12f4a86b32fb170ab9149082 (diff)
Populate EgressRoute, GSO, Netproto in NIC
fdbased and qdisc layers expect these fields to already be populated before being reached. PiperOrigin-RevId: 353099492
Diffstat (limited to 'pkg/tcpip/link')
-rw-r--r--pkg/tcpip/link/qdisc/fifo/endpoint.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/tcpip/link/qdisc/fifo/endpoint.go b/pkg/tcpip/link/qdisc/fifo/endpoint.go
index 87035b034..03efba606 100644
--- a/pkg/tcpip/link/qdisc/fifo/endpoint.go
+++ b/pkg/tcpip/link/qdisc/fifo/endpoint.go
@@ -165,12 +165,15 @@ func (e *endpoint) WritePacket(r stack.RouteInfo, gso *stack.GSO, protocol tcpip
}
// WritePackets implements stack.LinkEndpoint.WritePackets.
+//
+// Being a batch API, each packet in pkts should have the following
+// fields populated:
+// - pkt.EgressRoute
+// - pkt.GSOOptions
+// - pkt.NetworkProtocolNumber
func (e *endpoint) WritePackets(r stack.RouteInfo, gso *stack.GSO, pkts stack.PacketBufferList, protocol tcpip.NetworkProtocolNumber) (int, *tcpip.Error) {
enqueued := 0
for pkt := pkts.Front(); pkt != nil; {
- pkt.EgressRoute = r
- pkt.GSOOptions = gso
- pkt.NetworkProtocolNumber = protocol
d := e.dispatchers[int(pkt.Hash)%len(e.dispatchers)]
nxt := pkt.Next()
if !d.q.enqueue(pkt) {