From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Ansuel Smith <ansuelsmth@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [RFC PATCH v2 net-next 0/4] DSA master state tracking
Date: Fri, 10 Dec 2021 19:27:24 +0000 [thread overview]
Message-ID: <20211210192723.noa3hb2vso6t7zju@skbuf> (raw)
In-Reply-To: <61b3a621.1c69fb81.b4bf5.8dd2@mx.google.com>
On Fri, Dec 10, 2021 at 08:10:21PM +0100, Ansuel Smith wrote:
> > Ok I added more tracing and packet are received to the tagger right
> > after the log from ipv6 "link becomes ready". That log just check if the
> > interface is up and if it does have a valid sched.
> > I notice after link becomes ready we have a CHANGE event for eth0. That
> > should be the correct way to understand when the cpu port is actually
> > usable.
> > (just to make it clear before the link becomes ready no packet is
> > received to the tagger and the completion timeouts)
> >
> > --
> > Ansuel
>
> Sorry for the triple message spam... I have a solution. It seems packet
> are processed as soon as dev_activate is called (so a qdisk is assigned)
> By adding another bool like master_oper_ready and
>
> void dsa_tree_master_oper_state_ready(struct dsa_switch_tree *dst,
> struct net_device *master,
> bool up);
>
> static void dsa_tree_master_state_change(struct dsa_switch_tree *dst,
> struct net_device *master)
> {
> struct dsa_notifier_master_state_info info;
> struct dsa_port *cpu_dp = master->dsa_ptr;
>
> info.master = master;
> info.operational = cpu_dp->master_admin_up && cpu_dp->master_oper_up && cpu_dp->master_oper_ready;
>
> dsa_tree_notify(dst, DSA_NOTIFIER_MASTER_STATE_CHANGE, &info);
> }
>
> void dsa_tree_master_oper_state_ready(struct dsa_switch_tree *dst,
> struct net_device *master,
> bool up)
> {
> struct dsa_port *cpu_dp = master->dsa_ptr;
> bool notify = false;
>
> if ((cpu_dp->master_oper_ready && cpu_dp->master_oper_ready) !=
> (cpu_dp->master_oper_ready && up))
> notify = true;
>
> cpu_dp->master_oper_ready = up;
>
> if (notify)
> dsa_tree_master_state_change(dst, master);
> }
>
> In slave.c at the NETDEV_CHANGE event the additional
> dsa_tree_master_oper_state_ready(dst, dev, dev_ingress_queue(dev));
> we have no timeout function. I just tested this and it works right away.
>
> Think we need this additional check to make sure the tagger can finally
> accept packet from the switch.
>
> With this added I think this is ready.
Why ingress_queue?
I was looking at dev_activate() too, especially since net/ipv6/addrconf.c uses:
/* Check if link is ready: is it up and is a valid qdisc available */
static inline bool addrconf_link_ready(const struct net_device *dev)
{
return netif_oper_up(dev) && !qdisc_tx_is_noop(dev);
}
and you can see that qdisc_tx_is_noop() checks for the qdisc on TX
queues, not ingress qdisc (which makes more sense anyway).
Anyway the reason why I didn't say anything about this is because I
don't yet understand how it is supposed to work. Specifically:
rtnl_lock
dev_open()
-> __dev_open()
-> dev->flags |= IFF_UP;
-> dev_activate()
-> transition_one_qdisc()
-> call_netdevice_notifiers(NETDEV_UP, dev);
rtnl_unlock
so the qdisc should have already transitioned by the time NETDEV_UP is
emitted.
and since we already require a NETDEV_UP to have occurred, or dev->flags
to contain IFF_UP, I simply don't understand the following
(a) why would the qdisc be noop when we catch NETDEV_UP
(b) who calls netdev_state_change() (or __dev_notify_flags ?!) after the
qdisc changes on a TX queue? If no one, then I'm not sure how we can
reliably check for the state of the qdisc if we aren't notified
about changes to it.
next prev parent reply other threads:[~2021-12-10 19:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 17:39 [RFC PATCH v2 net-next 0/4] DSA master state tracking Vladimir Oltean
2021-12-09 17:39 ` [RFC PATCH v2 net-next 1/4] net: dsa: provide switch operations for tracking the master state Vladimir Oltean
2021-12-10 20:10 ` Vladimir Oltean
2021-12-09 17:39 ` [RFC PATCH v2 net-next 2/4] net: dsa: stop updating master MTU from master.c Vladimir Oltean
2021-12-09 17:39 ` [RFC PATCH v2 net-next 3/4] net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown} Vladimir Oltean
2021-12-10 20:17 ` Vladimir Oltean
2021-12-09 17:39 ` [RFC PATCH v2 net-next 4/4] net: dsa: replay master state events in dsa_tree_{setup,teardown}_master Vladimir Oltean
2021-12-10 20:22 ` Vladimir Oltean
2021-12-10 3:37 ` [RFC PATCH v2 net-next 0/4] DSA master state tracking Ansuel Smith
2021-12-10 17:02 ` Vladimir Oltean
2021-12-10 17:10 ` Ansuel Smith
2021-12-10 17:15 ` Vladimir Oltean
2021-12-10 17:29 ` Ansuel Smith
2021-12-10 18:04 ` Ansuel Smith
2021-12-10 19:10 ` Ansuel Smith
2021-12-10 19:27 ` Vladimir Oltean [this message]
2021-12-10 19:45 ` Ansuel Smith
2021-12-10 19:54 ` Vladimir Oltean
2021-12-10 20:02 ` Ansuel Smith
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=20211210192723.noa3hb2vso6t7zju@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.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