[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220321132829.71fe30d5@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 21 Mar 2022 13:28:29 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: netdev@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>,
Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Richard Cochran <richardcochran@...il.com>
Subject: Re: [RFC PATCH net-next] net: create a NETDEV_ETH_IOCTL notifier
for DSA to reject PTP on DSA master
On Fri, 18 Mar 2022 00:50:35 +0200 Vladimir Oltean wrote:
> The fact that PTP 2-step TX timestamping is deeply broken on DSA
> switches if the master also timestamps the same packets is well
> documented by commit f685e609a301 ("net: dsa: Deny PTP on master if
> switch supports it"). We attempt to help the users avoid shooting
> themselves in the foot by making DSA reject the timestamping ioctls on
> an interface that is a DSA master, and the switch tree beneath it
> contains switches which are aware of PTP.
>
> The only problem is that there isn't an established way of intercepting
> ndo_eth_ioctl calls, so DSA creates avoidable burden upon the network
> stack by creating a struct dsa_netdevice_ops with overlaid function
> pointers that are manually checked from the relevant call sites. There
> used to be 2 such dsa_netdevice_ops, but now, ndo_eth_ioctl is the only
> one left.
Remind me - are the DSA CPU-side interfaces linked as lower devices
of the ports?
> In fact, the underlying reason which is prompting me to make this change
> is that I'd like to hide as many DSA data structures from public API as
> I can. But struct net_device :: dsa_ptr is a struct dsa_port (which is a
> huge structure), and I'd like to create a smaller structure. I'd like
> struct dsa_netdevice_ops to not be a part of this, so this is how the
> need to delete it arose.
Isn't it enough to move the implementation to a C source instead
of having it be a static inline?
> The established way for unrelated modules to react on a net device event
> is via netdevice notifiers. These have the advantage of loose coupling,
> i.e. they work even when DSA is built as module, without resorting to
> static inline functions (which cannot offer the desired data structure
> encapsulation).
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
> I'd mostly like to take this opportunity to raise a discussion about how
> to handle this. It's clear that calling the notifier chain is less
> efficient than having some dev->dsa_ptr checks, but I'm not sure if the
> ndo_eth_ioctl can tolerate the extra performance hit at the expense of
> some code cleanliness.
>
> Of course, what would be great is if we didn't have the limitation to
> begin with, but the effort to add UAPI for multiple TX timestamps per
> packet isn't proportional to the stated goal here, which is to hide some
> DSA data structures.
Was there a reason we haven't converted the timestamping to ndos?
Just a matter of finding someone with enough cycles to go thru all
the drivers?
Powered by blists - more mailing lists