mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Populate EgressRoute, GSO, Netproto for batch writes
We loop over the list of packets anyways so setting these aren't expensive. Now that they are populated only by the link endpoint that uses them, TCP does not need to. PiperOrigin-RevId: 352090853
This commit is contained in:
committed by
gVisor bot
parent
c7fc4a5d66
commit
55c7fe48d2
@@ -43,7 +43,7 @@ func (e *endpoint) WritePacket(r *stack.Route, gso *stack.GSO, protocol tcpip.Ne
|
||||
// WritePackets implements stack.LinkEndpoint.WritePackets.
|
||||
func (e *endpoint) WritePackets(r *stack.Route, gso *stack.GSO, pkts stack.PacketBufferList, proto tcpip.NetworkProtocolNumber) (int, *tcpip.Error) {
|
||||
for pkt := pkts.Front(); pkt != nil; pkt = pkt.Next() {
|
||||
e.Endpoint.DeliverOutboundPacket(pkt.EgressRoute.RemoteLinkAddress(), pkt.EgressRoute.LocalLinkAddress, pkt.NetworkProtocolNumber, pkt)
|
||||
e.Endpoint.DeliverOutboundPacket(r.RemoteLinkAddress(), r.LocalLinkAddress, pkt.NetworkProtocolNumber, pkt)
|
||||
}
|
||||
|
||||
return e.Endpoint.WritePackets(r, gso, pkts, proto)
|
||||
|
||||
@@ -166,15 +166,12 @@ func (e *endpoint) WritePacket(r *stack.Route, gso *stack.GSO, protocol tcpip.Ne
|
||||
}
|
||||
|
||||
// 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(_ *stack.Route, _ *stack.GSO, pkts stack.PacketBufferList, _ tcpip.NetworkProtocolNumber) (int, *tcpip.Error) {
|
||||
func (e *endpoint) WritePackets(r *stack.Route, 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) {
|
||||
|
||||
@@ -784,9 +784,6 @@ func sendTCPBatch(r *stack.Route, tf tcpFields, data buffer.VectorisedView, gso
|
||||
})
|
||||
pkt.Hash = tf.txHash
|
||||
pkt.Owner = owner
|
||||
pkt.EgressRoute = r
|
||||
pkt.GSOOptions = gso
|
||||
pkt.NetworkProtocolNumber = r.NetProto
|
||||
data.ReadToVV(&pkt.Data, packetSize)
|
||||
buildTCPHdr(r, tf, pkt, gso)
|
||||
tf.seq = tf.seq.Add(seqnum.Size(packetSize))
|
||||
|
||||
Reference in New Issue
Block a user