BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Taehee Yoo" <ap420073@gmail.com>
Cc: bpf@vger.kernel.org, dri-devel@lists.freedesktop.org,
	media-ci@linuxtv.org
Subject: Re: [RFC PATCH net-next 12/13] selftests: drivers/net: add knod tests
Date: Tue, 21 Jul 2026 07:18:00 +0000	[thread overview]
Message-ID: <20260721071801.527C91F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260719175857.4071636-13-ap420073@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The tests hardcode relative paths to in-tree pyynl scripts and YAML specs, which breaks when tests are run from an installed directory.
- [Medium] The map lookup script uses the GNU awk extension strtonum(), causing the test to unconditionally fail on systems using non-GNU awk (like mawk).
--

--- Patch [12]: [RFC PATCH net-next 12/13] selftests: drivers/net: add knod tests ---
commit 8c1df38ed71ba173e2fb3bc36bc8224d06cad0df
Author: Taehee Yoo <ap420073@gmail.com>

selftests: drivers/net: add knod tests

Add attach/detach and XDP offload selftests for knod, exercising the
genetlink control plane and the BPF data path over a knod-capable NIC.

> diff --git a/tools/testing/selftests/drivers/net/knod/lib.sh b/tools/testing/selftests/drivers/net/knod/lib.sh
> new file mode 100755
> index 0000000000000..d0d9b03f109dc
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/knod/lib.sh
> @@ -0,0 +1,181 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# lib.sh - KNOD XDP offload test utilities
> +#
> +# The KNOD control plane is the "knod" generic-netlink family; it is driven
> +# here through the in-tree ynl CLI (tools/net/ynl/pyynl/cli.py) so the tests
> +# need no dedicated user-space tool.
> +
> +KSRC=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../../.." && pwd)
> +readonly KNOD_YNL="$KSRC/tools/net/ynl/pyynl/cli.py"
> +readonly KNOD_SPEC="$KSRC/Documentation/netlink/specs/knod.yaml"

[Severity: Medium]
Will this hardcoded relative path cause the tests to fail when run from an
installed directory?

When tests are installed (e.g., via make install) and run out-of-tree, these
paths to cli.py and the YAML specs will likely be invalid since they are not
copied to the install directory by default.

[ ... ]

> +knod_map_lookup_u64() {
> +	local map_id=$1
> +	local key=$2
> +	local hex
> +
> +	hex=$(bpftool map lookup id "$map_id" \
> +	      key $key 0 0 0 2>/dev/null | \
> +	      grep -o 'value:.*' | sed 's/value: //')
> +	if [ -z "$hex" ]; then
> +		echo 0
> +		return
> +	fi
> +
> +	printf '%d' "$(echo "$hex" | awk '{
> +		v = 0;
> +		for (i = 8; i >= 1; i--)
> +			v = v * 256 + strtonum("0x" $i);
> +		printf "0x%x", v;
> +	}')"

[Severity: Medium]
Does the use of the strtonum() function break this script on systems using
non-GNU awk? 

The strtonum() function is a gawk-specific extension. On systems where the
default awk is mawk or BusyBox awk, this may fail with an undefined function
error, causing the extracted map value to evaluate to 0 and the test to
falsely fail.

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260719175857.4071636-1-ap420073@gmail.com?part=12

  reply	other threads:[~2026-07-21  7:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-19 17:58 [RFC PATCH net-next 00/13] net: knod: in-kernel network offload device Taehee Yoo
2026-07-19 17:58 ` [RFC PATCH net-next 01/13] net: knod: add uapi and core headers Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 02/13] net: devmem: extend memory provider for knod Taehee Yoo
2026-07-20 19:43   ` Mina Almasry
2026-07-21 16:15     ` Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 03/13] net: core: add XDP_MODE_HW offload hook " Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 04/13] net: knod: add offload device core and control plane Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 05/13] bpf: offload: allow PERCPU_ARRAY maps for offloaded programs Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 06/13] drm/amdkfd: prepare kfd core for the knod provider Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 07/13] drm/amdkfd: add knod provider core Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 08/13] drm/amdkfd: add GPU instruction emitter and disassembler Taehee Yoo
2026-07-20 20:05   ` Natalie Vock
2026-07-20 20:53     ` Andrew Lunn
2026-07-21 16:36       ` Hoyeon Lee
2026-07-19 17:58 ` [RFC PATCH net-next 09/13] drm/amdkfd: add BPF-to-GPU JIT offload Taehee Yoo
2026-07-19 17:58 ` [RFC PATCH net-next 10/13] net/mlx5e: add knod XDP offload support Taehee Yoo
2026-07-21  7:17   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 11/13] bnxt_en: " Taehee Yoo
2026-07-21  7:18   ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 12/13] selftests: drivers/net: add knod tests Taehee Yoo
2026-07-21  7:18   ` sashiko-bot [this message]
2026-07-19 17:58 ` [RFC PATCH net-next 13/13] drm/amdkfd: add IPsec full-packet offload Taehee Yoo
2026-07-21  7:18   ` sashiko-bot
2026-07-20 19:18 ` [RFC PATCH net-next 00/13] net: knod: in-kernel network offload device Mina Almasry
2026-07-21 15:17   ` Taehee Yoo

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=20260721071801.527C91F00A3F@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ap420073@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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