Message ID | 20210107172726.2420292-1-olteanv@gmail.com |
---|---|
Headers | show |
Series | Configuring congestion watermarks on ocelot switch using devlink-sb | expand |
> +static struct dsa_port *devlink_to_dsa_port(struct devlink_port *dlp) > +{ > + return container_of(dlp, struct dsa_port, devlink_port); > +} I wonder if this should be moved to include/net/dsa.h next to the other little helpers used to convert between devlink structures and DSA structures? > + > +static int dsa_devlink_sb_pool_get(struct devlink *dl, > + unsigned int sb_index, u16 pool_index, > + struct devlink_sb_pool_info *pool_info) > +{ > + struct dsa_devlink_priv *dl_priv = devlink_priv(dl); > + struct dsa_switch *ds = dl_priv->ds; dsa_devlink_to_ds() > + > + if (!ds->ops->devlink_sb_pool_get) > + return -EOPNOTSUPP; > + > + return ds->ops->devlink_sb_pool_get(ds, sb_index, pool_index, > + pool_info); > +} > + Andrew
On Fri, Jan 08, 2021 at 12:35:23AM +0100, Andrew Lunn wrote: > > +static struct dsa_port *devlink_to_dsa_port(struct devlink_port *dlp) > > +{ > > + return container_of(dlp, struct dsa_port, devlink_port); > > +} > > I wonder if this should be moved to include/net/dsa.h next to the > other little helpers used to convert between devlink structures and > DSA structures? I wrote this before your series for devlink regions. The way I'm using devlink_to_dsa_port, I guess I can just replace it with your dsa_devlink_port_to_port function.
From: Vladimir Oltean <vladimir.oltean@nxp.com> In some applications, it is important to create resource reservations in the Ethernet switches, to prevent background traffic, or deliberate attacks, from inducing denial of service into the high-priority traffic. These patches give the user some knobs to turn. The ocelot switches support per-port and per-port-tc reservations, on ingress and on egress. The resources that are monitored are packet buffers (in cells of 60 bytes each) and frame references. The frames that exceed the reservations can optionally consume from sharing watermarks which are not per-port but global across the switch. There are 10 sharing watermarks, 8 of them are per traffic class and 2 are per drop priority. I am configuring the hardware using the best of my knowledge, and mostly through trial and error. Same goes for devlink-sb integration. Feedback is welcome. Vladimir Oltean (10): net: mscc: ocelot: auto-detect packet buffer size and number of frame references net: mscc: ocelot: add ops for decoding watermark threshold and occupancy net: dsa: add ops for devlink-sb net: dsa: felix: reindent struct dsa_switch_ops net: dsa: felix: perform teardown in reverse order of setup net: mscc: ocelot: export NUM_TC constant from felix to common switch lib net: mscc: ocelot: delete unused ocelot_set_cpu_port prototype net: mscc: ocelot: register devlink ports net: mscc: ocelot: initialize watermarks to sane defaults net: mscc: ocelot: configure watermarks using devlink-sb drivers/net/dsa/ocelot/felix.c | 210 +++-- drivers/net/dsa/ocelot/felix.h | 2 - drivers/net/dsa/ocelot/felix_vsc9959.c | 23 +- drivers/net/dsa/ocelot/seville_vsc9953.c | 20 +- drivers/net/ethernet/mscc/Makefile | 3 +- drivers/net/ethernet/mscc/ocelot.c | 18 +- drivers/net/ethernet/mscc/ocelot.h | 8 +- drivers/net/ethernet/mscc/ocelot_devlink.c | 885 +++++++++++++++++++++ drivers/net/ethernet/mscc/ocelot_net.c | 282 ++++++- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 47 +- include/net/dsa.h | 34 + include/soc/mscc/ocelot.h | 54 +- include/soc/mscc/ocelot_qsys.h | 7 +- net/dsa/dsa2.c | 174 +++- 14 files changed, 1672 insertions(+), 95 deletions(-) create mode 100644 drivers/net/ethernet/mscc/ocelot_devlink.c