netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Alexander Duyck <alexanderduyck@fb.com>,
	Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@nvidia.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Possible to use both dev_mc_sync and __dev_mc_sync?
Date: Mon, 21 Mar 2022 18:32:13 +0200	[thread overview]
Message-ID: <20220321163213.lrn5sk7m6grighbl@skbuf> (raw)

Hello,

Despite the similar names, the 2 functions above serve quite different
purposes, and as it happens, DSA needs to use both of them, each for its
own purpose.

static void dsa_slave_set_rx_mode(struct net_device *dev)
{
	struct net_device *master = dsa_slave_to_master(dev);
	struct dsa_port *dp = dsa_slave_to_port(dev);
	struct dsa_switch *ds = dp->ds;

	dev_mc_sync(master, dev); // DSA is a stacked device
	dev_uc_sync(master, dev);
	if (dsa_switch_supports_mc_filtering(ds))
		__dev_mc_sync(dev, dsa_slave_sync_mc, dsa_slave_unsync_mc); // DSA is also a hardware device
	if (dsa_switch_supports_uc_filtering(ds))
		__dev_uc_sync(dev, dsa_slave_sync_uc, dsa_slave_unsync_uc);
}

What I'm noticing is that some addresses, for example 33:33:00:00:00:01
(added by addrconf.c as in6addr_linklocal_allnodes) are synced to the
master via dev_mc_sync(), but not to hardware by __dev_mc_sync().

Superficially, this is because dev_mc_sync() -> __hw_addr_sync_one()
will increase ha->sync_cnt to a non-zero value. Then, when __dev_mc_sync()
-> __hw_addr_sync_dev() checks ha->sync_cnt, it sees that it has been
"already synced" (not really), so it doesn't call the "sync" method
(dsa_slave_sync_mc) for this ha.

However I don't understand the deep reasons and I am confused by the
members of struct netdev_hw_addr (synced vs sync_cnt vs refcount).
I can't tell if this was supposed to work, given that "sync address to
another device" is conceptually a different kind of sync than "sync
address to hardware", so I'm a bit surprised that they share the same
variables.

Any ideas?

             reply	other threads:[~2022-03-21 16:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 16:32 Vladimir Oltean [this message]
2022-03-21 18:37 ` Possible to use both dev_mc_sync and __dev_mc_sync? Alexander Duyck
2022-03-21 18:42   ` Vladimir Oltean
2022-03-21 18:45     ` Vladimir Oltean
2022-03-21 19:13       ` Alexander Duyck
2022-03-21 20:02         ` Jay Vosburgh

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=20220321163213.lrn5sk7m6grighbl@skbuf \
    --to=olteanv@gmail.com \
    --cc=alexanderduyck@fb.com \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).