All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Russell King - ARM Linux admin <linux@armlinux.org.uk>,
	Antoine Tenart <antoine.tenart@bootlin.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	"Allan W. Nielsen" <allan.nielsen@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Alexandru Marginean <alexandru.marginean@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	"Madalin Bucur (OSS)" <madalin.bucur@oss.nxp.com>,
	radu-andrei.bulie@nxp.com, fido_max@inbox.ru
Subject: Re: [PATCH net-next 06/11] net: dsa: ocelot: create a template for the DSA tags on xmit
Date: Fri, 29 May 2020 22:31:09 +0300	[thread overview]
Message-ID: <CA+h21hqpiV1sp3+tXVuQoy95bXQ5DD6nvEKK1Mw72TutdoX-Bg@mail.gmail.com> (raw)
In-Reply-To: <20200528145058.GA840827@lunn.ch>

Hi Andrew,

On Thu, 28 May 2020 at 17:51, Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Thu, May 28, 2020 at 02:41:08AM +0300, Vladimir Oltean wrote:
> > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> > With this patch we try to kill 2 birds with 1 stone.
> >
> > First of all, some switches that use tag_ocelot.c don't have the exact
> > same bitfield layout for the DSA tags. The destination ports field is
> > different for Seville VSC9953 for example. So the choices are to either
> > duplicate tag_ocelot.c into a new tag_seville.c (sub-optimal) or somehow
> > take into account a supposed ocelot->dest_ports_offset when packing this
> > field into the DSA injection header (again not ideal).
> >
> > Secondly, tag_ocelot.c already needs to memset a 128-bit area to zero
> > and call some packing() functions of dubious performance in the
> > fastpath. And most of the values it needs to pack are pretty much
> > constant (BYPASS=1, SRC_PORT=CPU, DEST=port index). So it would be good
> > if we could improve that.
> >
> > The proposed solution is to allocate a memory area per port at probe
> > time, initialize that with the statically defined bits as per chip
> > hardware revision, and just perform a simpler memcpy in the fastpath.
>
> Hi Vladimir
>
> We try to keep the taggers independent of the DSA drivers. I think
> tag_ocelot.c is the only one that breaks this.
>
> tag drivers are kernel modules. They have all the options of a kernel
> module, such as init and exit functions. You could create these
> templates in the module init function, and clean them up in the exit
> function. You can also register multiple taggers in one
> driver. tag_brcm.c does this as an example. So you can have a Seville
> tagger which uses different templates to ocelot.
>
>        Andrew

I don't particularly like that tag_brcm.c is riddled with #if /
#endif, they make it difficult to follow.

And if I allocate/free the xmit template in the
dsa_tag_driver_module_init / dsa_tag_driver_module_exit, how can I
reach the pointer to the correct per-switch-per-port template in the
ocelot_xmit function?

Please note that ocelot_xmit is already stateful, and it _needs_ to be
stateful: for 1588, it saves and increments the TX timestamp ID which
will be matched to the data that is received in felix_irq_handler.

And sja1105 also breaks the tagger/driver separation, and in even
"worse" ways - see sja1105_xmit_tpid which transmits a different frame
depending on which state the driver is in; also sja1105_decode_subvlan
which on RX looks up a table populated by the driver.

Generally speaking, I don't see any good reason why keeping the tagger
and the driver separated should be a design goal, especially when the
hotpath depends on stateful information (and the tagging driver can't
do anything at all without a backing switch driver anyway). Separation
could be done only in the simplest of cases, but as more advanced
features are necessary (not arguing that the template I'm adding here
is "advanced" stuff), this becomes practically impossible. Please also
see this tag_ocelot.c patch which needs to take the classified VLAN
from the DSA tag, or not, depending on the VLAN awareness state of the
port:
https://patchwork.ozlabs.org/project/netdev/patch/20200506074900.28529-7-xiaoliang.yang_1@nxp.com/

Thanks,
-Vladimir

  reply	other threads:[~2020-05-29 19:31 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 23:41 [PATCH net-next 00/11] New DSA driver for VSC9953 Seville switch Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 01/11] regmap: add helper for per-port regfield initialization Vladimir Oltean
2020-05-27 23:46   ` Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 02/11] net: mscc: ocelot: unexport ocelot_probe_port Vladimir Oltean
2020-05-28 16:21   ` Jakub Kicinski
2020-05-28 16:35     ` Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 03/11] net: mscc: ocelot: convert port registers to regmap Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 04/11] soc/mscc: ocelot: add MII registers description Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 05/11] net: mscc: ocelot: convert QSYS_SWITCH_PORT_MODE and SYS_PORT_MODE to regfields Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 06/11] net: dsa: ocelot: create a template for the DSA tags on xmit Vladimir Oltean
2020-05-28 14:50   ` Andrew Lunn
2020-05-29 19:31     ` Vladimir Oltean [this message]
2020-05-27 23:41 ` [PATCH net-next 07/11] net: mscc: ocelot: split writes to pause frame enable bit and to thresholds Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 08/11] net: mscc: ocelot: disable flow control on NPI interface Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 09/11] net: mscc: ocelot: convert SYS_PAUSE_CFG register access to regfield Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 10/11] net: mscc: ocelot: extend watermark encoding function Vladimir Oltean
2020-05-27 23:41 ` [PATCH net-next 11/11] net: dsa: ocelot: introduce driver for Seville VSC9953 switch Vladimir Oltean
2020-05-28 16:21   ` Jakub Kicinski
2020-05-28 16:51     ` Vladimir Oltean
2020-05-28 21:56   ` Andrew Lunn
2020-05-28 22:09     ` Vladimir Oltean
2020-05-29  8:14       ` Alexandre Belloni
2020-05-29  8:30         ` Vladimir Oltean
2020-05-29  9:03           ` Alexandre Belloni
2020-05-29 15:42             ` Vladimir Oltean
2020-05-29 17:20               ` Alexandre Belloni
2020-05-29 16:51 ` [PATCH net-next 00/11] New DSA driver for VSC9953 Seville switch Mark Brown
2020-05-29 16:59   ` Mark Brown
2020-05-29 17:28     ` Vladimir Oltean
2020-05-29 17:34       ` Mark Brown
2020-05-29 17:49         ` Vladimir Oltean

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=CA+h21hqpiV1sp3+tXVuQoy95bXQ5DD6nvEKK1Mw72TutdoX-Bg@mail.gmail.com \
    --to=olteanv@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandru.marginean@nxp.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=antoine.tenart@bootlin.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=fido_max@inbox.ru \
    --cc=horatiu.vultur@microchip.com \
    --cc=linux@armlinux.org.uk \
    --cc=madalin.bucur@oss.nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=radu-andrei.bulie@nxp.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.