public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vishwanath Seshagiri <vishs@meta.com>
Cc: "Jason Wang" <jasowang@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, "David Wei" <dw@davidwei.uk>,
	"Matteo Croce" <technoboy85@gmail.com>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	netdev@vger.kernel.org, virtualization@lists.linux.dev,
	linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH net-next v4 2/2] selftests: virtio_net: add buffer circulation test
Date: Thu, 5 Feb 2026 01:24:37 -0500	[thread overview]
Message-ID: <20260205012145-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20260204193617.1200752-3-vishs@meta.com>

On Wed, Feb 04, 2026 at 11:36:17AM -0800, Vishwanath Seshagiri wrote:
> Add iperf3-based test to verify RX buffer handling under load.
> Optionally logs page_pool tracepoints when available.

but it doesn't verify/validate them - it's just a generic throughput
test. so what is the value add here?


> Signed-off-by: Vishwanath Seshagiri <vishs@meta.com>
> ---
>  .../drivers/net/virtio_net/basic_features.sh  | 86 +++++++++++++++++++
>  1 file changed, 86 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..fa98505c4674 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]}
>  
> +IPERF_SERVER_PID=""
> +
>  h1_create()
>  {
>  	simple_if_init $h1 $H1_IPV4/24 $H1_IPV6/64
> @@ -83,6 +86,84 @@ f_mac_test()
>  	log_test "$test_name"
>  }
>  
> +buffer_circulation_test()
> +{
> +	RET=0
> +	local test_name="buffer circulation"
> +	local tracefs="/sys/kernel/tracing"
> +
> +	if ! check_command iperf3; then
> +		log_test_skip "$test_name" "iperf3 not installed"
> +		return 0
> +	fi
> +
> +	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
> +
> +	local port=$(shuf -i 49152-65535 -n 1)
> +
> +	iperf3 -s -1 --bind-dev "$h2" -p "$port" &>/dev/null &
> +	IPERF_SERVER_PID=$!
> +	sleep 1
> +
> +	if ! kill -0 "$IPERF_SERVER_PID" 2>/dev/null; then
> +		IPERF_SERVER_PID=""
> +		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 "$port" -t 5 >/dev/null 2>&1
> +	local iperf_ret=$?
> +
> +	if [ -n "$IPERF_SERVER_PID" ]; then
> +		kill "$IPERF_SERVER_PID" 2>/dev/null || true
> +		wait "$IPERF_SERVER_PID" 2>/dev/null || true
> +		IPERF_SERVER_PID=""
> +	fi
> +
> +	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
> @@ -113,6 +194,11 @@ setup_cleanup()
>  
>  cleanup()
>  {
> +	if [ -n "$IPERF_SERVER_PID" ]; then
> +		kill "$IPERF_SERVER_PID" 2>/dev/null || true
> +		wait "$IPERF_SERVER_PID" 2>/dev/null || true
> +	fi
> +
>  	pre_cleanup
>  	setup_cleanup
>  }
> -- 
> 2.47.3


      parent reply	other threads:[~2026-02-05  6:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 19:36 [PATCH net-next v4 0/2] virtio_net: add page_pool support Vishwanath Seshagiri
2026-02-04 19:36 ` [PATCH net-next v4 1/2] virtio_net: add page_pool support for buffer allocation Vishwanath Seshagiri
2026-02-05  3:54   ` Jason Wang
2026-02-05  5:30   ` Michael S. Tsirkin
2026-02-05  6:34     ` Vishwanath Seshagiri
2026-02-05  6:40       ` Michael S. Tsirkin
2026-02-05 18:48         ` Vishwanath Seshagiri
2026-02-04 19:36 ` [PATCH net-next v4 2/2] selftests: virtio_net: add buffer circulation test Vishwanath Seshagiri
2026-02-05  4:12   ` Jason Wang
2026-02-05  5:13     ` Vishwanath Seshagiri
2026-02-05  5:25   ` Jakub Kicinski
2026-02-05  6:24     ` Vishwanath Seshagiri
2026-02-05  6:24   ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260205012145-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jasowang@redhat.com \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=technoboy85@gmail.com \
    --cc=virtualization@lists.linux.dev \
    --cc=vishs@meta.com \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox