Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: Jakub Kicinski <kuba@kernel.org>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Hangbin Liu <liuhangbin@kylinos.cn>
Subject: Re: [PATCH net-next 1/2] netdevsim: add link speed support
Date: Tue, 1 Sep 2026 16:23:51 +0800	[thread overview]
Message-ID: <apaLl13Saka4Sw1J@fedora> (raw)
In-Reply-To: <apZ3f3vm5sUrcyrZ@fedora>

On Tue, Sep 01, 2026 at 02:58:17PM +0800, Hangbin Liu wrote:
> On Mon, Aug 31, 2026 at 03:08:18PM -0700, Jakub Kicinski wrote:
> > On Mon, 31 Aug 2026 11:28:10 +0800 Hangbin Liu wrote:
> > > Add ethtool get/set_link_ksettings callbacks to netdevsim so the simulated
> > > link speed and duplex can be queried and configured from userspace.
> > > 
> > > Move NSIM_LINK_SPEED_MAX and NSIM_LINK_SPEED_UNIT from dev.c to netdevsim.h
> > > so they are available to both the devlink rate path and the new ethtool
> > > code. The set callback rejects speeds exceeding NSIM_LINK_SPEED_MAX.
> > > 
> > > The default link speed is set to SPEED_5000 with DUPLEX_FULL, matching the
> > > existing NSIM_LINK_SPEED_MAX definition.
> > 
> > This breaks TDC which uses netdevsim for taprio testing.
> 
> Sigh, I really didn't expect a speed feature could break the tc qdisc
> testing... I will check the reason.

OK, here is the reason. In taprio_set_picos_per_byte(), it init NIC speed to
SPEED_10. If the NIC doesn't support get_link_ksettings, the final calculated
picos_per_byte would be a extremely large number 800000. The later tc taprio
testing `tc qdisc ... sched-entry S 02 300` will always failed in
fill_sched_entry(), as min_duration is also a large number 48000.

After we supports get_link_ksettings for netdevsim, the speed is 5000 and
picos_per_byte will be init to 1600. The later min_duration checking in
fill_sched_entry() is 300 vs 96. So the tc qdisc command always return 0.

To fix the test, I think we should reduce the interval number. e.g.

diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
index cd19d05925e4..c3418bde9ad6 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
@@ -145,7 +145,7 @@
         "setup": [
             "echo \"1 1 8\" > /sys/bus/netdevsim/new_device"
         ],
-        "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 300 sched-entry S 02 1700 clockid CLOCK_TAI",
+        "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 30 sched-entry S 02 70 clockid CLOCK_TAI",
         "expExitCode": "2",
         "verifyCmd": "$TC qdisc show dev $ETH",
         "matchPattern": "qdisc taprio 1: root refcnt",

Thanks
Hangbin

  reply	other threads:[~2026-09-01  8:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  3:28 [PATCH net-next 0/2] netdevsim: add link speed support Hangbin Liu
2026-08-31  3:28 ` [PATCH net-next 1/2] " Hangbin Liu
2026-08-31 12:16   ` Andrew Lunn
2026-09-01  6:39     ` Hangbin Liu
2026-09-01 12:43       ` Andrew Lunn
2026-09-02  1:53         ` Hangbin Liu
2026-09-02 12:38           ` Andrew Lunn
2026-08-31 12:24   ` Andrew Lunn
2026-09-01  6:31     ` Hangbin Liu
2026-08-31 22:08   ` Jakub Kicinski
2026-09-01  6:58     ` Hangbin Liu
2026-09-01  8:23       ` Hangbin Liu [this message]
2026-09-01 14:21         ` Andrew Lunn
2026-09-02  2:01           ` Hangbin Liu
2026-09-02 12:49             ` Andrew Lunn
2026-09-01 14:18       ` Andrew Lunn
2026-08-31  3:28 ` [PATCH net-next 2/2] selftests: netdevsim: add speed testing Hangbin Liu
2026-08-31 22:06   ` Jakub Kicinski
2026-09-01  6:42     ` Hangbin Liu
2026-09-01 15:06       ` Jakub Kicinski
2026-09-02  2:04         ` Hangbin Liu

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=apaLl13Saka4Sw1J@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=vladimir.oltean@nxp.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