Netdev List
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Andy Roulin <aroulin@nvidia.com>, netdev@vger.kernel.org
Cc: stephen@networkplumber.org, bridge@lists.linux.dev,
	razor@blackwall.org, nikolay@nvidia.com, idosch@nvidia.com,
	petrm@nvidia.com, danieller@nvidia.com
Subject: Re: [PATCH iproute2-next] iplink: bridge: add stp_mode support
Date: Tue, 19 May 2026 19:23:06 -0600	[thread overview]
Message-ID: <2a7322e6-690b-4d3f-b675-231619ea87cf@kernel.org> (raw)
In-Reply-To: <20260518163647.1935156-1-aroulin@nvidia.com>

On 5/18/26 10:36 AM, Andy Roulin wrote:
> diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
> index df3264c3..d15221b2 100644
> --- a/ip/iplink_bridge.c
> +++ b/ip/iplink_bridge.c
> @@ -120,6 +122,20 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
>  				invarg("invalid stp_state", *argv);
>  
>  			addattr32(n, 1024, IFLA_BR_STP_STATE, val);
> +		} else if (strcmp(*argv, "stp_mode") == 0) {
> +			__u32 stp_mode;
> +
> +			NEXT_ARG();
> +			if (strcmp(*argv, "auto") == 0)
> +				stp_mode = BR_STP_MODE_AUTO;
> +			else if (strcmp(*argv, "user") == 0)
> +				stp_mode = BR_STP_MODE_USER;
> +			else if (strcmp(*argv, "kernel") == 0)
> +				stp_mode = BR_STP_MODE_KERNEL;
> +			else if (get_u32(&stp_mode, *argv, 0))
> +				invarg("invalid stp_mode", *argv);
> +
> +			addattr32(n, 1024, IFLA_BR_STP_MODE, stp_mode);
>  		} else if (matches(*argv, "priority") == 0) {
>  			__u16 prio;
>  
> @@ -512,6 +528,20 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
>  			   "stp_state %u ",
>  			   rta_getattr_u32(tb[IFLA_BR_STP_STATE]));
>  
> +	if (tb[IFLA_BR_STP_MODE]) {
> +		static const char *stp_modes[] = {
> +			"auto", "user", "kernel"
> +		};

Make this a single table used for both set and show.

> +		__u32 mode = rta_getattr_u32(tb[IFLA_BR_STP_MODE]);
> +
> +		if (mode < ARRAY_SIZE(stp_modes))
> +			print_string(PRINT_ANY, "stp_mode",
> +				     "stp_mode %s ", stp_modes[mode]);
> +		else
> +			print_uint(PRINT_ANY, "stp_mode",
> +				   "stp_mode %u ", mode);
> +	}
> +
>  	if (tb[IFLA_BR_PRIORITY])
>  		print_uint(PRINT_ANY,
>  			   "priority",


      parent reply	other threads:[~2026-05-20  1:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 16:36 [PATCH iproute2-next] iplink: bridge: add stp_mode support Andy Roulin
2026-05-18 22:10 ` Stephen Hemminger
2026-05-20  1:23 ` David Ahern [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=2a7322e6-690b-4d3f-b675-231619ea87cf@kernel.org \
    --to=dsahern@kernel.org \
    --cc=aroulin@nvidia.com \
    --cc=bridge@lists.linux.dev \
    --cc=danieller@nvidia.com \
    --cc=idosch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@nvidia.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    --cc=stephen@networkplumber.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