Vladimir Oltean
2021-May-04 23:04 UTC
[Bridge] [RFC net-next 6/9] net: dsa: Forward offloading
On Wed, May 05, 2021 at 12:12:15AM +0200, Tobias Waldekranz wrote:> > and you create a dependency between the tagger and the switch driver > > which was supposed by design to not exist. > > Sure, but _why_ should it not exist? Many fields in the tag can only be > correctly generated/interpreted in combination with knowledge of the > current configuration, which is the driver's domain. The dependency is > already there, etched in silicon.I'm a bit more of a pragmatic person, it's not so much that I think that Lennert Buytenhek's original DSA design from 2008 was the holy grail and that we should do everything we can to preserve it intact. Far from it. But I actually like having the option to inject a DSA-tagged packet using Spirent TestCenter and measure IP forwarding between dsa_loop "switch" ports (actually a one-armed router is what it is). I also like, as a reviewer, to be able to test, if I want to, how a tail tagger behaves even if I don't own a switch with tail tagging. And this separation between the switch driver and the tag protocol driver makes that possible, just see it as a nice perk which we don't want to lose. As for more advanced features, like "the hardware requires me to invent a unique number based on a rolling counter, call it a TX timestamp ID, put it in the DSA header, then when transmission is done, an IRQ will be raised, and I need to match that TX timestamp that just became available to me, which is identifiable via the timestamp ID that I put in the DSA header, with the original skb", of course you can't do that without communication between the tagger and the driver itself, unless you make the tagger handle interrupts (and then there's the whole issue that the tagging protocol driver needs to be instantiated per switch, if it's going to be stateful), or the switch driver send packets. As a general rule of thumb, just don't break dsa_loop and we should be fine. For example, yes, PTP requires driver <-> tagger communication, but PTP timestamping is also not enabled by default, and guarded by an ioctl which dsa_loop doesn't implement. So the tagger can never trigger faulty code, dereferencing a ds->priv pointer which it thinks is "struct mv88e6xxx_chip" but is actually "struct dsa_loop_priv".
Tobias Waldekranz
2021-May-05 09:01 UTC
[Bridge] [RFC net-next 6/9] net: dsa: Forward offloading
On Wed, May 05, 2021 at 02:04, Vladimir Oltean <olteanv at gmail.com> wrote:> On Wed, May 05, 2021 at 12:12:15AM +0200, Tobias Waldekranz wrote: >> > and you create a dependency between the tagger and the switch driver >> > which was supposed by design to not exist. >> >> Sure, but _why_ should it not exist? Many fields in the tag can only be >> correctly generated/interpreted in combination with knowledge of the >> current configuration, which is the driver's domain. The dependency is >> already there, etched in silicon. > > I'm a bit more of a pragmatic person,Excuse me sir, I believe you left your dagger IN MY HEART :)> it's not so much that I think that > Lennert Buytenhek's original DSA design from 2008 was the holy grail and > that we should do everything we can to preserve it intact. Far from it. > But I actually like having the option to inject a DSA-tagged packet > using Spirent TestCenter and measure IP forwarding between dsa_loop > "switch" ports (actually a one-armed router is what it is). I also like, > as a reviewer, to be able to test, if I want to, how a tail tagger > behaves even if I don't own a switch with tail tagging. And this > separation between the switch driver and the tag protocol driver makes > that possible, just see it as a nice perk which we don't want to lose.Completely understandable. I was trying to extrapolate where we will end up with this separation as we add more and more features and couple the tagger closer to the driver, and see if the current architecture was still the optimal one. Trying to be ...pragmatic, if you will.> As for more advanced features, like "the hardware requires me to invent > a unique number based on a rolling counter, call it a TX timestamp ID, > put it in the DSA header, then when transmission is done, an IRQ will be > raised, and I need to match that TX timestamp that just became available > to me, which is identifiable via the timestamp ID that I put in the DSA > header, with the original skb", of course you can't do that without > communication between the tagger and the driver itself, unless you make > the tagger handle interrupts (and then there's the whole issue that the > tagging protocol driver needs to be instantiated per switch, if it's > going to be stateful), or the switch driver send packets. As a general > rule of thumb, just don't break dsa_loop and we should be fine. For > example, yes, PTP requires driver <-> tagger communication, but PTP > timestamping is also not enabled by default, and guarded by an ioctl > which dsa_loop doesn't implement. So the tagger can never trigger faulty > code, dereferencing a ds->priv pointer which it thinks is "struct > mv88e6xxx_chip" but is actually "struct dsa_loop_priv".This should also hold for forward offloading, since dsa_loop would not implement .ndo_dfwd_{add,del}_station. Alright, include/linux/dsa/mv88e6xxx.h here I come!