public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <stfomichev@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	sdf@fomichev.me, kuniyu@amazon.com
Subject: Re: [PATCH net-next] net: convert dev->rtnl_link_state to a bool
Date: Thu, 10 Apr 2025 08:45:27 -0700	[thread overview]
Message-ID: <Z_fnlxK0Ohj-Ky_1@mini-arch> (raw)
In-Reply-To: <20250410014246.780885-1-kuba@kernel.org>

On 04/09, Jakub Kicinski wrote:
> netdevice reg_state was split into two 16 bit enums back in 2010
> in commit a2835763e130 ("rtnetlink: handle rtnl_link netlink
> notifications manually"). Since the split the fields have been
> moved apart, and last year we converted reg_state to a normal
> u8 in commit 4d42b37def70 ("net: convert dev->reg_state to u8").
> 
> rtnl_link_state being a 16 bitfield makes no sense. Convert it
> to a single bool, it seems very unlikely after 15 years that
> we'll need more values in it.
> 
> We could drop dev->rtnl_link_ops from the conditions but feels
> like having it there more clearly points at the reason for this
> hack.

Acked-by: Stanislav Fomichev <sdf@fomichev.me>

But for me having rtnl_link_ops in the mix is still hard to read.
Might be more clear to rename rtnl_link_initializing to
suppress_rtnl_notify, make it false by default, and set to true 
from rtnl_create_link. Then reading conditions like the one below
will make more sense (imo):

	if (!dev->suppress_rtnl_notify)
  		rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U, GFP_KERNEL, 0, NULL);

(iow, reverse the conditional so false works for most non-ops devices)

      reply	other threads:[~2025-04-10 15:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10  1:42 [PATCH net-next] net: convert dev->rtnl_link_state to a bool Jakub Kicinski
2025-04-10 15:45 ` Stanislav Fomichev [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=Z_fnlxK0Ohj-Ky_1@mini-arch \
    --to=stfomichev@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /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