Skip to content

Commit

Permalink
router: serialize directly into packet buffers (#4654)
Browse files Browse the repository at this point in the history
In every case where the router modified packets it would serialize
updated headers to a temporary buffer and then copy that to the packet
buffer.

To avoid this extra copy, replaced gopacket.serializeBuffer with a
custom implementation that writes to a given buffer. In this case, the
packet's raw buffer.

There is one remaining copy for some SCMP messages because we have to
move the existing packet to the payload. This too could be avoided but
that's for another PR; it would require to leave headroom in received
packets.

The performance impact is very small since, on the critical path, it
just avoids copying a scion hdr per packet, but it is a simplification.
It also pays back the copy added by a previous simplification of the BFD
code. As such...

Contributes to #4593
  • Loading branch information
jiceatscion authored Nov 29, 2024
1 parent a118737 commit 3c8e30f
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 86 deletions.
1 change: 1 addition & 0 deletions router/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ go_library(
"dataplane.go",
"fnv1aCheap.go",
"metrics.go",
"serialize_proxy.go",
"svc.go",
],
importpath = "github.com/scionproto/scion/router",
Expand Down
Loading

0 comments on commit 3c8e30f

Please sign in to comment.