199 Commits
Author SHA1 Message Date
Lucas ManningandgVisor bot ddaa99e5d4 Ignore the length field when processing the experiment extension header.
Reported-by: syzbot+9970c3c1f330bc544966@syzkaller.appspotmail.com
PiperOrigin-RevId: 703588249
2024-12-06 12:57:06 -08:00
Lucas ManningandgVisor bot cd70b0a4c0 Add support for the experiment option header in IPv6.
PiperOrigin-RevId: 702771719
2024-12-04 10:25:30 -08:00
Lucas ManningandgVisor bot 078be62712 Add support for setting the experiment option header in IPv4.
PiperOrigin-RevId: 702486039
2024-12-03 15:21:54 -08:00
Andrei VaginandgVisor bot 3546fab741 netstack: choose route by longest prefix
It has to return the most specific route.

PiperOrigin-RevId: 647421535
2024-06-27 13:12:45 -07:00
Lucas ManningandgVisor bot a67dd10623 Automated rollback of changelist 630263974
PiperOrigin-RevId: 633277180
2024-05-13 11:33:19 -07:00
Jing ChenandgVisor bot cf5c4c9cbf Replace reflect.DeepEqual with [slices/maps].Equal.
They are faster on slice/map comparisons.

PiperOrigin-RevId: 633080355
2024-05-12 21:20:18 -07:00
Nicolas LacasseandgVisor bot f67e10cf38 Automated rollback of changelist 629815554
PiperOrigin-RevId: 630263974
2024-05-02 21:02:05 -07:00
Andrei Vagin af92292ac8 Fix typos 2024-05-02 11:09:16 -07:00
Lucas ManningandgVisor bot 19c7ca8c3b Add fdbased processor goroutines.
Results from iperf microbenchmark:
```
name                                                    old speed                       new speed                       delta
IperfOneConnection/operation.Upload-16                                    226GB/s ± 1%                    240GB/s ± 2%   +6.44%  (p=0.008 n=5+5)
IperfOneConnection/operation.Download-16                                  330GB/s ± 3%                    350GB/s ± 2%   +6.12%  (p=0.016 n=5+4)
IperfManyConnections/operation.Upload/parallel.4-16                       617GB/s ± 2%                    644GB/s ± 1%   +4.43%  (p=0.016 n=5+4)
IperfManyConnections/operation.Download/parallel.4-16                     302GB/s ± 1%                    337GB/s ± 3%  +11.85%  (p=0.008 n=5+5)
IperfManyConnections/operation.Upload/parallel.16-16                      702GB/s ± 3%                    640GB/s ± 4%   -8.82%  (p=0.008 n=5+5)
IperfManyConnections/operation.Download/parallel.16-16                    267GB/s ± 1%                    305GB/s ± 1%  +14.17%  (p=0.008 n=5+5)
IperfManyConnections/operation.Upload/parallel.64-16                      486GB/s ± 7%                    655GB/s ± 1%  +34.88%  (p=0.008 n=5+5)
IperfManyConnections/operation.Download/parallel.64-16                    181GB/s ± 1%                    215GB/s ± 1%  +18.78%  (p=0.008 n=5+5)
```

PiperOrigin-RevId: 629815554
2024-05-01 13:18:13 -07:00
dongjinlong ba02461e12 chore: remove repetitive words in comments
Signed-off-by: dongjinlong <dongjinlong@outlook.com>
2024-03-26 19:57:40 +08: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
Peter JohnstonandgVisor bot ccc3c2cbd2 Skip incremental checksum update for unmodified fields
This is important for correctness, because the current incremental checksum
update routine does not work correctly when the field is set to the same value.
See this equation from RFC 1071:

    C   - one's complement sum of old header
    C'  - one's complement sum of new header
    m   - old value of a 16-bit field
    m'  - new value of a 16-bit field

    C' = C + (-m) + m' = C + (m' - m)

Assuming m is a 16-bit field, when m == m', then (m' - m) == (m + ~m) will
always equal -0, or 0xFFFF in one's complement arithmetic, rather than 0x0000.
The additive identity is typically 0, but since -0 has a different
representation, it is *not* an identity and therefore the equation produces a
different value.

PiperOrigin-RevId: 610963455
2024-02-27 20:29:26 -08:00
Lucas ManningandgVisor bot c7c534826e Set TCPTotalHeaderMaximumSize to 160.
Adding extra padding to this value seems to improve performance on gVNIC
hardware. When TCPTotalHeaderMaximumSize is <140, 10MB PUT commands start
randomly taking 10x as long as they normally do.

Fixes #9816

PiperOrigin-RevId: 598024702
2024-01-12 18:56:38 -08:00
Lucas ManningandgVisor bot 94e83c674e Properly account for all lower level headers when setting GSO limit.
Tested on gVNIC VM, PUT 10MB to GCS (3 run mean):
```
--gso=false: 1.05s
--gso=true: 0.45s
```

Fixes #9816

PiperOrigin-RevId: 597304748
2024-01-10 11:20:09 -08:00
Etienne PerotandgVisor bot 4b925cc1cd Use clear on a few more slices.
This is similar to pull request #9749.

PiperOrigin-RevId: 586512951
2023-11-29 18:55:37 -08:00
prof awk 4d30f2c9ef use new clear builtin to clear bufs 2023-11-27 19:43:25 +02:00
Andrei Vagin 5f4abad306 Fix a few typos
It is an idea of running codespell as part of our presubmit checks.
Before enabling it for new changes, let's fix what it has found.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-25 12:13:42 -07:00
Kevin KrakauerandgVisor bot 91b023d95c netstack: faster checksum
This is a roll-forward of cl/540620826. The differences are:

- Added Tony's test that showed breakage on ARM64
- Fixed the 64-bit non-AMD64 checksum implementation
  - Handles odd buffers correctly
  - Doesn't call the unrolled checksum impl anymore
  - Re-ordered calculateChecksum to reduce indentation

Otherwise this is the same CL. The only changes are in checksum_test.go and
checksum_noasm_unsafe.go.

PiperOrigin-RevId: 547890206
2023-07-13 12:51:44 -07:00
Kevin KrakauerandgVisor bot 675161f228 Automated rollback of changelist 540620826
PiperOrigin-RevId: 544208554
2023-06-28 17:48:08 -07:00
Kevin KrakauerandgVisor bot 6c0f22c66e netstack: faster checksum
tcp_benchmark shows we spend significant time checksumming -- after Syscall,
checksumming is the most time-consuming function.

AMD64 gets a 77% faster checksum via assmebly implementation.

Other 64bit machines get a new checksum function, which runs 38% faster than
current checksumming on my machine and 34% faster on an ARM test machine.

tcp_benchmark is pretty noisy here, but generally shows a 2-5% decrease in CPU
usage or a small boost to throughput:

```
                                              │ /tmp/old.log │            /tmp/new.log             │
                                              │     Mb/s     │     Mb/s      vs base               │
TCP/role=server/host-gso=false/host-gro=false    142.0 ± 28%    154.5 ± 24%       ~ (p=0.459 n=40)
TCP/role=client/host-gso=false/host-gro=false   1.794k ±  1%   1.840k ±  1%  +2.59% (p=0.000 n=40)
geomean                                          504.7          533.2        +5.65%

                                              │ /tmp/old.log │            /tmp/new.log             │
                                              │   cpu-time   │   cpu-time    vs base               │
TCP/role=server/host-gso=false/host-gro=false   244.0m ± 25%   256.3m ± 21%       ~ (p=0.529 n=40)
TCP/role=client/host-gso=false/host-gro=false    2.251 ±  1%    2.242 ±  1%       ~ (p=0.079 n=40)
geomean                                         741.1m         758.1m        +2.30%
```

So it seems checksumming is not the bottleneck in tcp_benchmark. This may be
different in other environments, especially those where we cannot rely on host
receive checksum offload.

PiperOrigin-RevId: 540620826
2023-06-15 10:27:46 -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 792ebbff8e netstack: make tcpip.Address hold a []byte
tcp_benchmark throughput increase 2-3%, but allocations go down (25% in the
download benchmark, only 2% in the upload path).

PiperOrigin-RevId: 532523146
2023-05-16 11:40:49 -07:00
Kevin KrakauerandgVisor bot 64268c8483 netstack: make tcpip.Address an opaque type
The important change here is in tcpip/tcpip.go, where tcpip.Address is defined.
The rest is updating uses of tcpip.Address.

This is preparation for netip.Addr or []byte based addresses, which should save
us a bunch of allocations. Currently, we allocate every time we want to, say,
get a tcpip.Address from a header. This is because the header is a byte slice,
but Address is a string. Strings are immutable, so Go allocates and copies.

PiperOrigin-RevId: 532284732
2023-05-15 18:07:03 -07:00
Kevin KrakauerandgVisor bot 37a308744b gro: IPv6
Opted for separate code paths rather than over-fitting to interfaces when
there're only 2 supported network protocols and 1 transport protocol.

The performance improvement is more modest than IPv4, I'm guessing due to the
process of parsing extension headers. As with IPv4, we'd benefit from parsing
only once and saving header state.

PiperOrigin-RevId: 513928270
2023-03-04 00:44:34 -08:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00