netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>
Subject: Re: What is the purpose of dev->gflags?
Date: Mon, 11 Apr 2022 19:20:16 +0300	[thread overview]
Message-ID: <20220411162016.sau3gertosgr6mtu@skbuf> (raw)
In-Reply-To: <41a58ead-9a14-c061-ee12-42050605deff@6wind.com>

On Mon, Apr 11, 2022 at 06:10:49PM +0200, Nicolas Dichtel wrote:
> 
> Le 11/04/2022 à 17:49, Vladimir Oltean a écrit :
> > On Mon, Apr 11, 2022 at 05:43:01PM +0200, Nicolas Dichtel wrote:
> >>
> >> Le 11/04/2022 à 17:33, Vladimir Oltean a écrit :
> >> [snip]
> >>> Would you agree that the __dev_set_allmulti() -> __dev_notify_flags()
> >>> call path is dead code? If it is, is there any problem it should be
> >>> addressing which it isn't, or can we just delete it?
> >> I probably miss your point, why is it dead code?
> > 
> > Because __dev_set_allmulti() doesn't update dev->gflags, it means
> > dev->gflags == old_gflags. In turn, it means dev->gflags ^ old_gflags,
> > passed to "gchanges" of __dev_notify_flags(), is 0.
> I didn't take any assumptions on dev->gflags because two functions are called
> with dev as parameter (dev_change_rx_flags() and dev_set_rx_mode()).

You mean ops->ndo_change_rx_flags() or ops->ndo_set_rx_mode() are
expected to update dev->gflags?

> Even if __dev_notify_flags() is called with 0 for the last arg, it calls
> notifiers. Thus, this is not "dead code".

The relevant "changes" (dev->flags & old_flags) of the net_device which
may have changed from __dev_set_allmulti() are masked out from
call_netdevice_notifiers(), are they not?

	if (changes & IFF_UP) {
		/* doesn't apply */
	}

	if (dev->flags & IFF_UP &&
	    (changes & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | IFF_VOLATILE))) {
	               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	               these changes are masked out

  reply	other threads:[~2022-04-11 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 18:30 What is the purpose of dev->gflags? Vladimir Oltean
2022-04-08 18:50 ` Jakub Kicinski
2022-04-08 19:17   ` Vladimir Oltean
2022-04-11 15:26     ` Nicolas Dichtel
2022-04-11 15:33       ` Vladimir Oltean
2022-04-11 15:43         ` Nicolas Dichtel
2022-04-11 15:49           ` Vladimir Oltean
2022-04-11 16:10             ` Nicolas Dichtel
2022-04-11 16:20               ` Vladimir Oltean [this message]
2022-04-11 16:27                 ` Nicolas Dichtel
2022-04-11 16:50                   ` Vladimir Oltean
2022-04-12 15:57                     ` Nicolas Dichtel

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=20220411162016.sau3gertosgr6mtu@skbuf \
    --to=olteanv@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --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).