netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fernando Fernandez Mancera <fmancera@suse.de>
To: "Ján Václav" <jvaclav@redhat.com>, "Jakub Kicinski" <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2 net-next] net/hsr: add protocol version to fill_info output
Date: Wed, 24 Sep 2025 14:01:24 +0200	[thread overview]
Message-ID: <d7bf939b-040c-49da-8769-0f230d5dcb51@suse.de> (raw)
In-Reply-To: <CAEQfnk3Ft4ke3UXS60WMYH8M6WsLgH=D=7zXmkcr3tx0cdiR_g@mail.gmail.com>

On 9/24/25 1:21 PM, Ján Václav wrote:
> On Wed, Sep 24, 2025 at 2:06 AM Jakub Kicinski <kuba@kernel.org> wrote:
>>
>> On Mon, 22 Sep 2025 11:37:45 +0200 Jan Vaclav wrote:
>>>        if (hsr->prot_version == PRP_V1)
>>>                proto = HSR_PROTOCOL_PRP;
>>> +     if (nla_put_u8(skb, IFLA_HSR_VERSION, hsr->prot_version))
>>> +             goto nla_put_failure;
>>
>> Looks like configuration path does not allow setting version if proto
>> is PRP. Should we add an else before the if? since previous if is
>> checking for PRP already
>>
> 
> The way HSR configuration is currently handled seems very confusing to
> me, because it allows setting the protocol version, but for PRP_V1
> only as a byproduct of setting the protocol to PRP. If you configure
> an interface with (proto = PRP, version = PRP_V1), it will fail, which
> seems wrong to me, considering this is the end result of configuring
> only with proto = PRP anyways.
> 

IMO, that is a good point.

> I think the best solution would be to introduce another change that
> allows explicitly setting the version to PRP_V1 if the protocol is set
> to PRP.
> 

I think it would be nice to unify the logic inside the else statement 
when parsing IFLA_HSR_VERSION and the later check for HSR_PROTOCOL_PRP. 
It could be simplified while supporting PRP_V1 explicitly set when PRP 
protocol is set.

Which also makes me wonder, should the enum hsr_version be exposed as 
UAPI? Currently it is under include/linux/if_hsr.h. But then, the naming 
should be something like "HSR_VERSION_HSR_0" or similar.

  reply	other threads:[~2025-09-24 12:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22  9:37 [PATCH v2 net-next] net/hsr: add protocol version to fill_info output Jan Vaclav
2025-09-23  7:22 ` Simon Horman
2025-09-24  0:06 ` Jakub Kicinski
2025-09-24 11:21   ` Ján Václav
2025-09-24 12:01     ` Fernando Fernandez Mancera [this message]
2025-09-24 23:40     ` Jakub Kicinski
2025-09-25  8:37       ` Fernando Fernandez Mancera
2025-09-26  2:00         ` Jakub Kicinski
2025-09-26  9:33           ` Fernando Fernandez Mancera

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=d7bf939b-040c-49da-8769-0f230d5dcb51@suse.de \
    --to=fmancera@suse.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jvaclav@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).