[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260128171144-mutt-send-email-mst@kernel.org>
Date: Wed, 28 Jan 2026 17:12:43 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Vishwanath Seshagiri <vishs@...a.com>
Cc: Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio Pérez <eperezma@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
David Wei <dw@...idwei.uk>, netdev@...r.kernel.org,
virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 net-next 2/2] selftests: virtio_net: add buffer
circulation test
On Wed, Jan 28, 2026 at 01:20:31PM -0800, Vishwanath Seshagiri wrote:
> Add iperf3-based test to verify RX buffer handling under load.
> Optionally logs page_pool tracepoints when available.
>
> Signed-off-by: Vishwanath Seshagiri <vishs@...a.com>
> ---
> .../drivers/net/virtio_net/basic_features.sh | 70 +++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> diff --git a/tools/testing/selftests/drivers/net/virtio_net/basic_features.sh b/tools/testing/selftests/drivers/net/virtio_net/basic_features.sh
> index cf8cf816ed48..c2c8023d2b92 100755
> --- a/tools/testing/selftests/drivers/net/virtio_net/basic_features.sh
> +++ b/tools/testing/selftests/drivers/net/virtio_net/basic_features.sh
> @@ -6,6 +6,7 @@
> ALL_TESTS="
> initial_ping_test
> f_mac_test
> + buffer_circulation_test
> "
>
> source virtio_net_common.sh
> @@ -16,6 +17,8 @@ source "$lib_dir"/../../../net/forwarding/lib.sh
> h1=${NETIFS[p1]}
> h2=${NETIFS[p2]}
>
> +require_command iperf3
> +
> h1_create()
> {
> simple_if_init $h1 $H1_IPV4/24 $H1_IPV6/64
> @@ -83,6 +86,73 @@ f_mac_test()
> log_test "$test_name"
> }
>
> +buffer_circulation_test()
> +{
> + RET=0
> + local test_name="buffer circulation"
> + local tracefs="/sys/kernel/tracing"
> +
> + setup_cleanup
> + setup_prepare
> +
> + ping -c 1 -I $h1 $H2_IPV4 >/dev/null
> + if [ $? -ne 0 ]; then
> + check_err 1 "Ping failed"
> + log_test "$test_name"
> + return
> + fi
> +
> + local rx_start=$(cat /sys/class/net/$h2/statistics/rx_packets)
> + local tx_start=$(cat /sys/class/net/$h1/statistics/tx_packets)
> +
> + if [ -d "$tracefs/events/page_pool" ]; then
> + echo > "$tracefs/trace"
> + echo 1 > "$tracefs/events/page_pool/enable"
> + fi
> +
> + iperf3 -s --bind-dev $h2 -p 5201 &>/dev/null &
> + local server_pid=$!
> + sleep 1
> +
> + if ! kill -0 $server_pid 2>/dev/null; then
> + if [ -d "$tracefs/events/page_pool" ]; then
> + echo 0 > "$tracefs/events/page_pool/enable"
> + fi
> + check_err 1 "iperf3 server died"
> + log_test "$test_name"
> + return
> + fi
> +
> + iperf3 -c $H2_IPV4 --bind-dev $h1 -p 5201 -t 5 >/dev/null 2>&1
is using hard coded ports like this fine?
running several in parallel will fail ...
> + local iperf_ret=$?
> +
> + kill $server_pid 2>/dev/null || true
> + wait $server_pid 2>/dev/null || true
> +
> + if [ -d "$tracefs/events/page_pool" ]; then
> + echo 0 > "$tracefs/events/page_pool/enable"
> + local trace="$tracefs/trace"
> + local hold=$(grep -c "page_pool_state_hold" "$trace" 2>/dev/null)
> + local release=$(grep -c "page_pool_state_release" "$trace" 2>/dev/null)
> + log_info "page_pool events: hold=${hold:-0}, release=${release:-0}"
> + fi
> +
> + local rx_end=$(cat /sys/class/net/$h2/statistics/rx_packets)
> + local tx_end=$(cat /sys/class/net/$h1/statistics/tx_packets)
> + local rx_delta=$((rx_end - rx_start))
> + local tx_delta=$((tx_end - tx_start))
> +
> + log_info "Circulated TX:$tx_delta RX:$rx_delta"
> +
> + if [ $iperf_ret -ne 0 ]; then
> + check_err 1 "iperf3 failed"
> + elif [ "$rx_delta" -lt 10000 ]; then
> + check_err 1 "Too few packets: $rx_delta"
> + fi
> +
> + log_test "$test_name"
> +}
> +
> setup_prepare()
> {
> virtio_device_rebind $h1
> --
> 2.47.3
Powered by blists - more mailing lists