Commit 8e90c499 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: mscc: ocelot: drop port argument from qos_policer_conf_set

The "port" argument is used for nothing else except printing on the
error path. Print errors on behalf of the policer index, which is less
confusing anyway.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 09fd1e0d
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* Default policer order */ /* Default policer order */
#define POL_ORDER 0x1d3 /* Ocelot policer order: Serial (QoS -> Port -> VCAP) */ #define POL_ORDER 0x1d3 /* Ocelot policer order: Serial (QoS -> Port -> VCAP) */
int qos_policer_conf_set(struct ocelot *ocelot, int port, u32 pol_ix, int qos_policer_conf_set(struct ocelot *ocelot, u32 pol_ix,
struct qos_policer_conf *conf) struct qos_policer_conf *conf)
{ {
u32 cf = 0, cir_ena = 0, frm_mode = POL_MODE_LINERATE; u32 cf = 0, cir_ena = 0, frm_mode = POL_MODE_LINERATE;
...@@ -102,26 +102,30 @@ int qos_policer_conf_set(struct ocelot *ocelot, int port, u32 pol_ix, ...@@ -102,26 +102,30 @@ int qos_policer_conf_set(struct ocelot *ocelot, int port, u32 pol_ix,
/* Check limits */ /* Check limits */
if (pir > GENMASK(15, 0)) { if (pir > GENMASK(15, 0)) {
dev_err(ocelot->dev, "Invalid pir for port %d: %u (max %lu)\n", dev_err(ocelot->dev,
port, pir, GENMASK(15, 0)); "Invalid pir for policer %u: %u (max %lu)\n",
pol_ix, pir, GENMASK(15, 0));
return -EINVAL; return -EINVAL;
} }
if (cir > GENMASK(15, 0)) { if (cir > GENMASK(15, 0)) {
dev_err(ocelot->dev, "Invalid cir for port %d: %u (max %lu)\n", dev_err(ocelot->dev,
port, cir, GENMASK(15, 0)); "Invalid cir for policer %u: %u (max %lu)\n",
pol_ix, cir, GENMASK(15, 0));
return -EINVAL; return -EINVAL;
} }
if (pbs > pbs_max) { if (pbs > pbs_max) {
dev_err(ocelot->dev, "Invalid pbs for port %d: %u (max %u)\n", dev_err(ocelot->dev,
port, pbs, pbs_max); "Invalid pbs for policer %u: %u (max %u)\n",
pol_ix, pbs, pbs_max);
return -EINVAL; return -EINVAL;
} }
if (cbs > cbs_max) { if (cbs > cbs_max) {
dev_err(ocelot->dev, "Invalid cbs for port %d: %u (max %u)\n", dev_err(ocelot->dev,
port, cbs, cbs_max); "Invalid cbs for policer %u: %u (max %u)\n",
pol_ix, cbs, cbs_max);
return -EINVAL; return -EINVAL;
} }
...@@ -211,7 +215,7 @@ int ocelot_port_policer_add(struct ocelot *ocelot, int port, ...@@ -211,7 +215,7 @@ int ocelot_port_policer_add(struct ocelot *ocelot, int port,
dev_dbg(ocelot->dev, "%s: port %u pir %u kbps, pbs %u bytes\n", dev_dbg(ocelot->dev, "%s: port %u pir %u kbps, pbs %u bytes\n",
__func__, port, pp.pir, pp.pbs); __func__, port, pp.pir, pp.pbs);
err = qos_policer_conf_set(ocelot, port, POL_IX_PORT + port, &pp); err = qos_policer_conf_set(ocelot, POL_IX_PORT + port, &pp);
if (err) if (err)
return err; return err;
...@@ -235,7 +239,7 @@ int ocelot_port_policer_del(struct ocelot *ocelot, int port) ...@@ -235,7 +239,7 @@ int ocelot_port_policer_del(struct ocelot *ocelot, int port)
pp.mode = MSCC_QOS_RATE_MODE_DISABLED; pp.mode = MSCC_QOS_RATE_MODE_DISABLED;
err = qos_policer_conf_set(ocelot, port, POL_IX_PORT + port, &pp); err = qos_policer_conf_set(ocelot, POL_IX_PORT + port, &pp);
if (err) if (err)
return err; return err;
......
...@@ -31,7 +31,7 @@ struct qos_policer_conf { ...@@ -31,7 +31,7 @@ struct qos_policer_conf {
u8 ipg; /* Size of IPG when MSCC_QOS_RATE_MODE_LINE is chosen */ u8 ipg; /* Size of IPG when MSCC_QOS_RATE_MODE_LINE is chosen */
}; };
int qos_policer_conf_set(struct ocelot *ocelot, int port, u32 pol_ix, int qos_policer_conf_set(struct ocelot *ocelot, u32 pol_ix,
struct qos_policer_conf *conf); struct qos_policer_conf *conf);
int ocelot_policer_validate(const struct flow_action *action, int ocelot_policer_validate(const struct flow_action *action,
......
...@@ -914,7 +914,7 @@ int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix, ...@@ -914,7 +914,7 @@ int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix,
if (!tmp) if (!tmp)
return -ENOMEM; return -ENOMEM;
ret = qos_policer_conf_set(ocelot, 0, pol_ix, &pp); ret = qos_policer_conf_set(ocelot, pol_ix, &pp);
if (ret) { if (ret) {
kfree(tmp); kfree(tmp);
return ret; return ret;
...@@ -945,7 +945,7 @@ int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix) ...@@ -945,7 +945,7 @@ int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix)
if (z) { if (z) {
pp.mode = MSCC_QOS_RATE_MODE_DISABLED; pp.mode = MSCC_QOS_RATE_MODE_DISABLED;
return qos_policer_conf_set(ocelot, 0, pol_ix, &pp); return qos_policer_conf_set(ocelot, pol_ix, &pp);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment