tree: 5d32df43b0233afc9f71a9ae53ca592bf5ecaf4f [path history] [tgz]
  1. bench/
  2. dhcp/
  3. dns/
  4. docs/
  5. fidlconv/
  6. filter/
  7. inspect/
  8. link/
  9. meta/
  10. pprof/
  11. routes/
  12. routetypes/
  13. stub/
  14. sync/
  15. testutil/
  16. time/
  17. tracing/
  18. udp_serde/
  19. util/
  20. BUILD.gn
  21. errors.go
  22. fuchsia_inspect_inspect.go
  23. fuchsia_inspect_inspect_test.go
  24. fuchsia_net_debug.go
  25. fuchsia_net_interfaces.go
  26. fuchsia_net_interfaces_admin.go
  27. fuchsia_net_interfaces_admin_test.go
  28. fuchsia_net_interfaces_test.go
  29. fuchsia_net_multicast_admin.go
  30. fuchsia_net_multicast_admin_ipv4.go
  31. fuchsia_net_multicast_admin_ipv6.go
  32. fuchsia_net_name_dns_server_watcher.go
  33. fuchsia_net_name_dns_server_watcher_test.go
  34. fuchsia_net_neighbor.go
  35. fuchsia_net_neighbor_test.go
  36. fuchsia_net_root.go
  37. fuchsia_net_routes.go
  38. fuchsia_net_routes_admin.go
  39. fuchsia_net_routes_test.go
  40. fuchsia_net_stack.go
  41. fuchsia_net_stack_test.go
  42. fuchsia_posix_socket.go
  43. fuchsia_posix_socket_test.go
  44. INSPECT.md
  45. inspect_persist.go
  46. inspect_persist_test.go
  47. main.go
  48. ndp.go
  49. ndp_test.go
  50. netstack.go
  51. netstack_test.go
  52. noop_endpoint_test.go
  53. README.md
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         |
        |   |  (//sdk/lib/fdio)              |
        |   +---------+----------------------+
        |             |
     +--v-------------v----------------------+
     |            netstack                   |
     | (//src/connectivity/network/netstack) |
     +----------------+----------------------+
                      |
     +----------------v-----------------+
     |         Ethernet driver          |
     | (//zircon/system/udev/ethernet)  |
     +----------------------------------+

Benchmarking

To run the benchmarks and obtain profiling data:

    fx test -o netstack-bench-gotests -- --test.run - --test.bench - \
      && ffx test run --output-directory out/profile fuchsia-pkg://fuchsia.com/netstack-bench-gotests#meta/netstack-bench-gotests.cm \
      && fx go tool pprof -http=:8080 out/profile/artifact-0/custom-0/netstack_bench_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

Cobalt Stats

Netstack uses Sampler to forward Inspect diagnostics data to the Cobalt telemetry system. See the Sampler configuration for how Inspect counters map to Cobalt metrics and how often Inspect is polled; and the Cobalt configuration for the reports defined for each metric.