[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190504164404.GB21656@t480s.localdomain>
Date: Sat, 4 May 2019 16:44:04 -0400
From: Vivien Didelot <vivien.didelot@...il.com>
To: Vladimir Oltean <olteanv@...il.com>
Cc: f.fainelli@...il.com, andrew@...n.ch, davem@...emloft.net,
netdev@...r.kernel.org, Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH net-next v2 1/9] net: dsa: Call driver's setup callback
after setting up its switchdev notifier
On Sat, 4 May 2019 16:59:11 +0300, Vladimir Oltean <olteanv@...il.com> wrote:
> This allows the driver to perform some manipulations of its own during
> setup, using generic switchdev calls. Having the notifiers registered at
> setup time is important because otherwise any switchdev transaction
> emitted during this time would be ignored (dispatched to an empty call
> chain).
>
> One current usage scenario is for the driver to request DSA to set up
> 802.1Q based switch tagging for its ports.
>
> There is no danger for the driver setup code to start racing now with
> switchdev events emitted from the network stack (such as bridge core)
> even if the notifier is registered earlier. This is because the network
> stack needs a net_device as a vehicle to perform switchdev operations,
> and the slave net_devices are registered later than the core driver
> setup anyway (ds->ops->setup in dsa_switch_setup vs dsa_port_setup).
>
> Luckily DSA doesn't need a net_device to carry out switchdev callbacks,
> and therefore drivers shouldn't assume either that net_devices are
> available at the time their switchdev callbacks get invoked.
>
> Signed-off-by: Vladimir Oltean <olteanv@...il.com>
> Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
Reviewed-by: Vivien Didelot <vivien.didelot@...il.com>
Powered by blists - more mailing lists