tree: 2f236d83dcb3538460f0074a1898fa229f40c069 [path history] [tgz]
  1. BUILD.gn
  2. OWNERS
  3. README.md
  4. bench/
  5. config/
  6. connectivity/
  7. dhcp/
  8. dns/
  9. docs/
  10. fidlconv/
  11. filter/
  12. fuchsia_inspect_inspect.go
  13. fuchsia_inspect_inspect_test.go
  14. fuchsia_net_dhcp.go
  15. fuchsia_net_name_dns_server_watcher.go
  16. fuchsia_net_name_dns_server_watcher_test.go
  17. fuchsia_net_name_lookup_admin.go
  18. fuchsia_net_name_lookup_admin_test.go
  19. fuchsia_net_namelookup.go
  20. fuchsia_net_namelookup_test.go
  21. fuchsia_net_stack.go
  22. fuchsia_net_stack_test.go
  23. fuchsia_posix_socket.go
  24. ifconfig/
  25. link/
  26. main.go
  27. meta/
  28. ndp.go
  29. ndp_test.go
  30. netstack.go
  31. netstack_service.go
  32. netstack_service_impl_test.go
  33. netstack_service_test/
  34. netstack_test.go
  35. packetbuffer/
  36. routes/
  37. socket_conv.go
  38. socket_encode.go
  39. tests/
  40. util/
src/connectivity/network/netstack/README.md

Netstack

Netstack is a userspace TCP/IP network stack and interfaces with zircon network drivers. Netstack serves as a back-end for fdio socket API.

 +-----------+           +-----------+
 | FIDL app  |           | POSIX app |
 +--+--------+           +-----+-----+
    |                          |
    |                          |
    |                          |
    |                          |
    |                          |
    |                          |
    |   +----------------------v---------+
    |   |         BSD socket API         |
    |   |  (//zircon/system/ulib/fdio)   |
    |   +---------+----------------------+
    |             |
 +--v-------------v----------------------+
 |            netstack                   |
 | (//src/connectivity/network/netstack) |
 +----------------+----------------------+
                  |
 +----------------v-----------------+
 |         Ethernet driver          |
 | (//zircon/system/udev/ethernet)  |
 +----------------------------------+

Benchmarking

netstack microbenchmarks are in package netstack/bench; they can be run via the target netstack_bench_test.

To run the benchmarks and obtain profiling data:

REALM=bench
PROFILE_PATH=/data/r/sys/r/$REALM/fuchsia.com:netstack_gotests:0#meta:netstack_bench_test.cmx/profile
fx build netstack_gotests \
  && fx test -o -R=$REALM netstack_bench_test \
  && fx scp "[$(fx get-device-addr)]:$PROFILE_PATH" out/profile \
  && go tool pprof -http=:8080 out/profile

Example output (astro):

goos: fuchsia
goarch: arm64
pkg: netstack/bench
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=2048-4                  190443              6513 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=1024-4                  247176              4831 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=512-4                   326691              3842 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=256-4                   364168              3426 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=128-4                   394536              3282 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=64-4                    405102              3218 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=32-4                    423908              2967 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=16-4                    424617              2931 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=8-4                     386036              2935 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=4-4                     404241              2990 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=2-4                     371358              2887 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadDisabled/len(payload)=1-4                     431478              2889 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=2048-4                   461614              2766 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=1024-4                   417296              2924 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=512-4                    474790              2814 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=256-4                    453231              2832 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=128-4                    472670              2835 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=64-4                     469988              2894 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=32-4                     490627              2614 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=16-4                     485992              2753 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=8-4                      492573              2798 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=4-4                      487836              2923 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=2-4                      434959              2658 ns/op             112 B/op          3 allocs/op
BenchmarkWritePacket/checksumOffloadEnabled/len(payload)=1-4                      490470              3010 ns/op             112 B/op          3 allocs/op