Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vladimir Oltean and committed by
Jakub Kicinski
8e90c499 09fd1e0d

+18 -14
+15 -11
drivers/net/ethernet/mscc/ocelot_police.c
··· 20 20 /* Default policer order */ 21 21 #define POL_ORDER 0x1d3 /* Ocelot policer order: Serial (QoS -> Port -> VCAP) */ 22 22 23 - int qos_policer_conf_set(struct ocelot *ocelot, int port, u32 pol_ix, 23 + int qos_policer_conf_set(struct ocelot *ocelot, u32 pol_ix, 24 24 struct qos_policer_conf *conf) 25 25 { 26 26 u32 cf = 0, cir_ena = 0, frm_mode = POL_MODE_LINERATE; ··· 102 102 103 103 /* Check limits */ 104 104 if (pir > GENMASK(15, 0)) { 105 - dev_err(ocelot->dev, "Invalid pir for port %d: %u (max %lu)\n", 106 - port, pir, GENMASK(15, 0)); 105 + dev_err(ocelot->dev, 106 + "Invalid pir for policer %u: %u (max %lu)\n", 107 + pol_ix, pir, GENMASK(15, 0)); 107 108 return -EINVAL; 108 109 } 109 110 110 111 if (cir > GENMASK(15, 0)) { 111 - dev_err(ocelot->dev, "Invalid cir for port %d: %u (max %lu)\n", 112 - port, cir, GENMASK(15, 0)); 112 + dev_err(ocelot->dev, 113 + "Invalid cir for policer %u: %u (max %lu)\n", 114 + pol_ix, cir, GENMASK(15, 0)); 113 115 return -EINVAL; 114 116 } 115 117 116 118 if (pbs > pbs_max) { 117 - dev_err(ocelot->dev, "Invalid pbs for port %d: %u (max %u)\n", 118 - port, pbs, pbs_max); 119 + dev_err(ocelot->dev, 120 + "Invalid pbs for policer %u: %u (max %u)\n", 121 + pol_ix, pbs, pbs_max); 119 122 return -EINVAL; 120 123 } 121 124 122 125 if (cbs > cbs_max) { 123 - dev_err(ocelot->dev, "Invalid cbs for port %d: %u (max %u)\n", 124 - port, cbs, cbs_max); 126 + dev_err(ocelot->dev, 127 + "Invalid cbs for policer %u: %u (max %u)\n", 128 + pol_ix, cbs, cbs_max); 125 129 return -EINVAL; 126 130 } 127 131 ··· 215 211 dev_dbg(ocelot->dev, "%s: port %u pir %u kbps, pbs %u bytes\n", 216 212 __func__, port, pp.pir, pp.pbs); 217 213 218 - err = qos_policer_conf_set(ocelot, port, POL_IX_PORT + port, &pp); 214 + err = qos_policer_conf_set(ocelot, POL_IX_PORT + port, &pp); 219 215 if (err) 220 216 return err; 221 217 ··· 239 235 240 236 pp.mode = MSCC_QOS_RATE_MODE_DISABLED; 241 237 242 - err = qos_policer_conf_set(ocelot, port, POL_IX_PORT + port, &pp); 238 + err = qos_policer_conf_set(ocelot, POL_IX_PORT + port, &pp); 243 239 if (err) 244 240 return err; 245 241
+1 -1
drivers/net/ethernet/mscc/ocelot_police.h
··· 31 31 u8 ipg; /* Size of IPG when MSCC_QOS_RATE_MODE_LINE is chosen */ 32 32 }; 33 33 34 - int qos_policer_conf_set(struct ocelot *ocelot, int port, u32 pol_ix, 34 + int qos_policer_conf_set(struct ocelot *ocelot, u32 pol_ix, 35 35 struct qos_policer_conf *conf); 36 36 37 37 int ocelot_policer_validate(const struct flow_action *action,
+2 -2
drivers/net/ethernet/mscc/ocelot_vcap.c
··· 914 914 if (!tmp) 915 915 return -ENOMEM; 916 916 917 - ret = qos_policer_conf_set(ocelot, 0, pol_ix, &pp); 917 + ret = qos_policer_conf_set(ocelot, pol_ix, &pp); 918 918 if (ret) { 919 919 kfree(tmp); 920 920 return ret; ··· 945 945 946 946 if (z) { 947 947 pp.mode = MSCC_QOS_RATE_MODE_DISABLED; 948 - return qos_policer_conf_set(ocelot, 0, pol_ix, &pp); 948 + return qos_policer_conf_set(ocelot, pol_ix, &pp); 949 949 } 950 950 951 951 return 0;