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