`//pkg/tcpip/link/rawfile` is a package to deal with raw socket and file FDs.
It is not only used for Netstack, but rather just generally useful raw file
manipulation stuff.
This change removes the Unix-error-to-`//pkg/tcpip`-error translation step
from its functions; this is now the responsibility of its callers. Callers
within Netstack now do the translation by themselves; the translation
function is moved to `//pkg/tcpip`.
This allows the `//pkg/tcpip/link/rawfile` package to not depend on
`//pkg/tcpip`, which in turn means the `//pkg/eventfd` package
(which depends on `rawfile`) no longer transitively depends on
`//pkg/tcpip`, which in turns means the `//pkg/unet` package (which
depends on `//pkg/eventfd`) no longer transitively depends on
`//pkg/tcpip`, which in turns means that the `//pkg/eventchannel`
package (which depends on `//pkg/unet`) no longer transitively
depends on `//pkg/tcpip`, which in turns means that the `//pkg/metric`
package (which depends on `//pkg/eventchannel`) no longer transitively
depends on `//pkg/tcpip`, which finally means that the `//pkg/metric`
package can be used within `//pkg/tcpip`. \o/
This changes does not make it use it, it just moves `rawfile`.
PiperOrigin-RevId: 647943618
Previously, when a packet was sent from a raw packet socket, the packet
buffer's link header was left unpopulated and the link header was only
found in the packet buffer's payload. This breaks the expectations of
LinkEndpoints which expect the link layer header to always be populated
when the link requires a header.
PiperOrigin-RevId: 542349445
This is effectively a rollback of cl/450976957. The original motivation never
panned out, and it's easier to work with the lists. They also are easier to
avoid allocations with.
PiperOrigin-RevId: 531020857
This change has significant performance implications. bufferv2 is reference
counted and pooled, which alleviates heap/GC pressure. Below are the results
from running the iperf benchmark.
HEAD:
BenchmarkIperf/operation.Upload-16 1552 ns/op 46.6GiB total allocations
BenchmarkIperf/operation.Download-16 1114 ns/op 68.6GiB total allocations
w/ change:
BenchmarkIperf/operation.Upload-16 1139 ns/op (-27%) 1.41GiB total allocations (-97%)
BenchmarkIperf/operation.Download-16 753.2 ns/op (-33%) 706MiB total allocations (-99%)
PiperOrigin-RevId: 462453185
The arguments passed to LinkEndpoint.AddHeader are all available in
the packet buffer so just get the values from the packet buffer.
PiperOrigin-RevId: 424463821
This removes the need for the stack to add a link header out-of-line the
write path when delivering outbound packets to a packet socket.
PiperOrigin-RevId: 424444109
...as they are not used in all cases expect in the packet endpoint
which can get the link address directly from the link header.
PiperOrigin-RevId: 424427195