DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v2] app/testpmd: add explicit link autonegotiation control
Date: Mon, 9 Nov 2026 09:45:48 -0800	[thread overview]
Message-ID: <20261109094548.3c431c50@phoenix.local> (raw)
In-Reply-To: <20261109155935.1054994-1-bruce.richardson@intel.com>

On Mon,  9 Nov 2026 15:59:35 +0000
Bruce Richardson <bruce.richardson@intel.com> wrote:

> When a particular speed was specified for a port in testpmd, the flags
> passed to the underlying API call always included the
> RTE_ETH_LINK_SPEED_FIXED flag. This flag is not a mandatory part of the
> bitmap when setting speeds, and is used to disable autonegotiation.
> It's possible to have a link report only a single speed while
> still have negotiation enabled, so testpmd needs to be extended to
> support setting a speed both with and without the flag.
> 
> This patch does so by adding optional "autoneg on|off" setting after
> speed and duplex settings specified by the user. This new option adjusts
> the presence or absence of the FIXED speed bit in the ethdev
> configuration structure "rte_eth_conf.link_speeds" bitmap. For backward
> compatibility, the default value is "autoneg off" for fixed speeds if
> not specified, meaning that the RTE_ETH_LINK_SPEED_FIXED flag is set on
> the speed value by default.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> V2:
> * changed syntax to more closely match that of ethtool, adding
>   autoneg on|off at the end of the command.
> * increased compatibility by ensuring that when no autoneg value is
>   specified, a numeric speed sets the fixed flag (autoneg off), while an
>   "auto" speed keeps autoneg on.
> ---

Looked ok to me, but AI decided that it was pickier than me.

Review: [PATCH v2] app/testpmd: add explicit link autonegotiation control

Applied on 26.11-rc2, testpmd builds with -Dwerror=true. Parser
behaviour checked against lib/cmdline: the 7-token and 9-token
instances share a prefix, but match_inst() rejects the short
instance when trailing tokens remain, so there is no ambiguity.
Semantics match rte_ethdev.h (FIXED is bit 0, AUTONEG is 0).

Warning
-------

link_speed_fixed_bit() returns a uint32_t bit, but both callers
immediately reduce it to bool:

	link_speed_fixed_bit(res->value1, autoneg) != 0, &link_speed) < 0)

Make it a predicate and drop the "!= 0" at both call sites:

	static bool
	link_speed_is_fixed(const char *speed, const char *autoneg)
	{
		if (autoneg == NULL)
			return strcmp(speed, "auto") != 0;

		return strcmp(autoneg, "off") == 0;
	}

	if (parse_and_check_speed_duplex(res->value1, res->value2,
			link_speed_is_fixed(res->value1, autoneg), &link_speed) < 0)

Info
----

testpmd_funcs.rst: "NOTE: Combining ``auto`` speed with ``autoneg
off`` is an error." is plain text. The file uses the ``.. note::``
directive everywhere else (17 instances); use it here too.

Review-Result: WARNING

  reply	other threads:[~2026-11-09 17:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 15:50 [PATCH] app/test-pmd: add explicit parameter for fixed link speeds Bruce Richardson
2026-11-04 12:29 ` Stephen Hemminger
2026-11-04 13:39   ` Bruce Richardson
2026-11-09 15:59 ` [PATCH v2] app/testpmd: add explicit link autonegotiation control Bruce Richardson
2026-11-09 17:45   ` Stephen Hemminger [this message]
2026-11-10 12:16 ` [PATCH v3] " Bruce Richardson
2026-11-10 16:59   ` Stephen Hemminger

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=20261109094548.3c431c50@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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