30 Commits
Author SHA1 Message Date
Andrei VaginandgVisor bot e2e84bf5ba tcpip/link: use lockdep mutexes
PiperOrigin-RevId: 692004573
2024-10-31 18:56:13 -07:00
Nayana BidariandgVisor bot ee34fd3b9d Mark more structs in netstack as savable.
PiperOrigin-RevId: 663780274
2024-08-16 10:47:24 -07:00
Andrei VaginandgVisor bot b488752cba netstack: implement RTM_SETLINK/IFLA_NET_NS_FD
IFLA_NET_NS_FD specifies a file descriptor that refers to a network namespace.

PiperOrigin-RevId: 648882826
2024-07-02 16:49:27 -07:00
Etienne PerotandgVisor bot d59375d82e Break //pkg/tcpip/link/rawfile's dep on //pkg/tcpip & move it to //pkg.
`//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
2024-06-29 05:11:53 -07:00
Jing ChenandgVisor bot 8ef3239b0b Add SetMTU to change the mtu of device.
The method will be primarily used with RTM_[NEW|SET]LINK when IFLA_MTU
is present.

PiperOrigin-RevId: 646264847
2024-06-24 16:58:13 -07:00
Jing ChenandgVisor bot 14c6ef6d52 Lock the mutex when reading a LinkAddress.
PiperOrigin-RevId: 645543579
2024-06-21 17:17:10 -07:00
Jing ChenandgVisor bot 2c5c7869d9 Add SetLinkAddress method to NetworkLinkEndpoint interface.
The method will be primarily used by IFLA_ADDRESS.

PiperOrigin-RevId: 642492748
2024-06-11 21:40:39 -07:00
Kevin KrakauerandgVisor bot 5b4fbd06d8 netstack: remove PacketBufferPtr
PacketBufferPtr is leftover from a dead experiment. Just use *PacketBuffer.

PiperOrigin-RevId: 611531815
2024-02-29 11:10:38 -08:00
Ghanan GowripalanandgVisor bot a7d4a785b5 Set LinkHeader for pkts sent by raw packet socket
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
2023-06-21 13:41:22 -07:00
Kevin KrakauerandgVisor bot 89d6bf18c8 have gVisor use renamed buffer package
PiperOrigin-RevId: 537209194
2023-06-01 21:27:49 -07:00
Kevin KrakauerandgVisor bot c3da0e4f0d Automated rollback of changelist 531020857
PiperOrigin-RevId: 532863869
2023-05-17 12:09:12 -07:00
Kevin KrakauerandgVisor bot d207727b3a netstack: replace slice-based PacketBufferList with linked list
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
2023-05-10 15:43:59 -07:00
Kevin KrakauerandgVisor bot 4eca206fa4 netstack: introduce PacketBufferPtr
PiperOrigin-RevId: 479437464
2022-10-06 16:16:54 -07:00
Lucas ManningandgVisor bot 3404bfa49a Refactor sharedmem tx.transmit to use bufferv2.
This reduces the amount of garbage produced by the methods.

PiperOrigin-RevId: 471141815
2022-08-30 18:41:00 -07:00
Lucas ManningandgVisor bot 1f2b30d70c Refactor netstack to use bufferv2 instead of buffer.
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
2022-07-21 13:09:31 -07:00
Kevin KrakauerandgVisor bot 657b52920d netstack: replace PacketBufferList with slices
This has no impact on performance. It is in preparation for ticket references
(see final CL in the diffbase chain).

PiperOrigin-RevId: 450976957
2022-05-25 11:45:42 -07:00
Lucas ManningandgVisor bot 04edcf5e6c Replace VectorisedView in link endpoints with pkg/buffer.Buffer.
PiperOrigin-RevId: 447562596
2022-05-09 14:22:08 -07:00
Kevin KrakauerandgVisor bot ef9e8d9131 netstack: switch from sync/atomic to atomicbitops for 32 bit values
PiperOrigin-RevId: 444446109
2022-04-25 20:41:26 -07:00
Bhasker HariharanandgVisor bot f461bb7b64 Fix MTU advertised by sharedmem to exclude header size.
PiperOrigin-RevId: 430986440
2022-02-25 11:11:01 -08:00
Ghanan GowripalanandgVisor bot f54fcc6e11 Drop LinkEndpoint.WriteRawPacket
PiperOrigin-RevId: 424490855
2022-01-26 18:33:55 -08:00
Ghanan GowripalanandgVisor bot ed2f45ace3 Populate link header from packet buffer fields
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
2022-01-26 16:10:03 -08:00
Ghanan GowripalanandgVisor bot ad021f48c0 Add link-layer headers in nic
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
2022-01-26 14:30:36 -08:00
Ghanan GowripalanandgVisor bot abd993f608 Don't pass link addresses in rx path
...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
2022-01-26 13:24:35 -08:00
Ghanan GowripalanandgVisor bot 196baa62ca Don't pass route info and net proto to write fns
...as the packet buffer already holds that information.

Updates #3810.
Fixes #6537.

PiperOrigin-RevId: 421898143
2022-01-14 13:23:22 -08:00
Bhasker HariharanandgVisor bot c06c9deb1c Add support for virtio net headers in sharedmem endpoint.
PiperOrigin-RevId: 416221825
2021-12-13 23:39:05 -08:00