162306a36Sopenharmony_ciAF_VSOCK test suite 262306a36Sopenharmony_ci------------------- 362306a36Sopenharmony_ciThese tests exercise net/vmw_vsock/ host<->guest sockets for VMware, KVM, and 462306a36Sopenharmony_ciHyper-V. 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciThe following tests are available: 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci * vsock_test - core AF_VSOCK socket functionality 962306a36Sopenharmony_ci * vsock_diag_test - vsock_diag.ko module for listing open sockets 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciThe following prerequisite steps are not automated and must be performed prior 1262306a36Sopenharmony_cito running tests: 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci1. Build the kernel, make headers_install, and build these tests. 1562306a36Sopenharmony_ci2. Install the kernel and tests on the host. 1662306a36Sopenharmony_ci3. Install the kernel and tests inside the guest. 1762306a36Sopenharmony_ci4. Boot the guest and ensure that the AF_VSOCK transport is enabled. 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciInvoke test binaries in both directions as follows: 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci # host=server, guest=client 2262306a36Sopenharmony_ci (host)# $TEST_BINARY --mode=server \ 2362306a36Sopenharmony_ci --control-port=1234 \ 2462306a36Sopenharmony_ci --peer-cid=3 2562306a36Sopenharmony_ci (guest)# $TEST_BINARY --mode=client \ 2662306a36Sopenharmony_ci --control-host=$HOST_IP \ 2762306a36Sopenharmony_ci --control-port=1234 \ 2862306a36Sopenharmony_ci --peer-cid=2 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci # host=client, guest=server 3162306a36Sopenharmony_ci (guest)# $TEST_BINARY --mode=server \ 3262306a36Sopenharmony_ci --control-port=1234 \ 3362306a36Sopenharmony_ci --peer-cid=2 3462306a36Sopenharmony_ci (host)# $TEST_BINARY --mode=client \ 3562306a36Sopenharmony_ci --control-port=$GUEST_IP \ 3662306a36Sopenharmony_ci --control-port=1234 \ 3762306a36Sopenharmony_ci --peer-cid=3 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_civsock_perf utility 4062306a36Sopenharmony_ci------------------- 4162306a36Sopenharmony_ci'vsock_perf' is a simple tool to measure vsock performance. It works in 4262306a36Sopenharmony_cisender/receiver modes: sender connect to peer at the specified port and 4362306a36Sopenharmony_cistarts data transmission to the receiver. After data processing is done, 4462306a36Sopenharmony_ciit prints several metrics(see below). 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciUsage: 4762306a36Sopenharmony_ci# run as sender 4862306a36Sopenharmony_ci# connect to CID 2, port 1234, send 1G of data, tx buf size is 1M 4962306a36Sopenharmony_ci./vsock_perf --sender 2 --port 1234 --bytes 1G --buf-size 1M 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciOutput: 5262306a36Sopenharmony_citx performance: A Gbits/s 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciOutput explanation: 5562306a36Sopenharmony_ciA is calculated as "number of bits to send" / "time in tx loop" 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci# run as receiver 5862306a36Sopenharmony_ci# listen port 1234, rx buf size is 1M, socket buf size is 1G, SO_RCVLOWAT is 64K 5962306a36Sopenharmony_ci./vsock_perf --port 1234 --buf-size 1M --vsk-size 1G --rcvlowat 64K 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciOutput: 6262306a36Sopenharmony_cirx performance: A Gbits/s 6362306a36Sopenharmony_citotal in 'read()': B sec 6462306a36Sopenharmony_ciPOLLIN wakeups: C 6562306a36Sopenharmony_ciaverage in 'read()': D ns 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ciOutput explanation: 6862306a36Sopenharmony_ciA is calculated as "number of received bits" / "time in rx loop". 6962306a36Sopenharmony_ciB is time, spent in 'read()' system call(excluding 'poll()') 7062306a36Sopenharmony_ciC is number of 'poll()' wake ups with POLLIN bit set. 7162306a36Sopenharmony_ciD is B / C, e.g. average amount of time, spent in single 'read()'. 72