OSDN Git Service

net: mscc: ocelot: add ops for decoding watermark threshold and occupancy
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 15 Jan 2021 02:11:12 +0000 (04:11 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 16 Jan 2021 04:02:34 +0000 (20:02 -0800)
commit703b762190e643bf46a048ebe99504b14d71449c
treed378d88772977df7f7f7e42b516b21e1f1b67dbe
parentf6fe01d6fa24dd3c89996ad82780872441e86bfa
net: mscc: ocelot: add ops for decoding watermark threshold and occupancy

We'll need to read back the watermark thresholds and occupancy from
hardware (for devlink-sb integration), not only to write them as we did
so far in ocelot_port_set_maxlen. So introduce 2 new functions in struct
ocelot_ops, similar to wm_enc, and implement them for the 3 supported
mscc_ocelot switches.

Remove the INUSE and MAXUSE unpacking helpers for the QSYS_RES_STAT
register, because that doesn't scale with the number of switches that
mscc_ocelot supports now. They have different bit widths for the
watermarks, and we need function pointers to abstract that difference
away.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/dsa/ocelot/seville_vsc9953.c
drivers/net/ethernet/mscc/ocelot_vsc7514.c
include/soc/mscc/ocelot.h
include/soc/mscc/ocelot_qsys.h