@@ -321,6 +321,21 @@ int sja1105_cls_flower_add(struct dsa_switch *ds, int port,
flow_action_for_each(i, act, &rule->action) {
switch (act->id) {
case FLOW_ACTION_POLICE:
+ if ((act->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ act->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ act->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (act->police.peakrate_bytes_ps ||
+ act->police.avrate || act->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (act->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack,
"QoS offload not support packets per second");
@@ -48,6 +48,21 @@ static int cxgb4_matchall_egress_validate(struct net_device *dev,
flow_action_for_each(i, entry, actions) {
switch (entry->id) {
case FLOW_ACTION_POLICE:
+ if ((entry->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ entry->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ entry->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (entry->police.peakrate_bytes_ps ||
+ entry->police.avrate || entry->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (entry->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack,
"QoS offload not support packets per second");
@@ -150,6 +165,22 @@ static int cxgb4_matchall_alloc_tc(struct net_device *dev,
flow_action_for_each(i, entry, &cls->rule->action)
if (entry->id == FLOW_ACTION_POLICE)
break;
+
+ if ((entry->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ entry->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ entry->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (entry->police.peakrate_bytes_ps ||
+ entry->police.avrate || entry->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (entry->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack,
"QoS offload not support packets per second");
@@ -1230,6 +1230,23 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv,
/* Flow meter and max frame size */
if (entryp) {
+ if ((entryp->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ entryp->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ entryp->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ err = -EOPNOTSUPP;
+ goto free_sfi;
+ }
+
+ if (entryp->police.peakrate_bytes_ps ||
+ entryp->police.avrate || entryp->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ err = -EOPNOTSUPP;
+ goto free_sfi;
+ }
+
if (entryp->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack, "QoS offload not support packets per second");
err = -EOPNOTSUPP;
@@ -212,6 +212,21 @@ static int otx2_tc_egress_matchall_install(struct otx2_nic *nic,
entry = &cls->rule->action.entries[0];
switch (entry->id) {
case FLOW_ACTION_POLICE:
+ if ((entry->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ entry->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ entry->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (entry->police.peakrate_bytes_ps ||
+ entry->police.avrate || entry->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (entry->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack, "QoS offload not support packets per second");
return -EOPNOTSUPP;
@@ -355,6 +370,21 @@ static int otx2_tc_parse_actions(struct otx2_nic *nic,
return -EOPNOTSUPP;
}
+ if ((act->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ act->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ act->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (act->police.peakrate_bytes_ps ||
+ act->police.avrate || act->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (act->police.rate_bytes_ps > 0) {
rate = act->police.rate_bytes_ps * 8;
burst = act->police.burst;
@@ -4197,6 +4197,21 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv,
flow_action_for_each(i, act, flow_action) {
switch (act->id) {
case FLOW_ACTION_POLICE:
+ if ((act->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ act->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ act->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (act->police.peakrate_bytes_ps ||
+ act->police.avrate || act->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (act->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack, "QoS offload not support packets per second");
return -EOPNOTSUPP;
@@ -191,6 +191,21 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
return -EOPNOTSUPP;
}
+ if ((act->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ act->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ act->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (act->police.peakrate_bytes_ps ||
+ act->police.avrate || act->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (act->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack, "QoS offload not support packets per second");
return -EOPNOTSUPP;
@@ -296,6 +296,22 @@ static int ocelot_flower_parse_action(struct ocelot *ocelot, int port,
"Last action must be GOTO");
return -EOPNOTSUPP;
}
+
+ if ((a->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ a->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ a->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (a->police.peakrate_bytes_ps ||
+ a->police.avrate || a->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (a->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack,
"QoS offload not support packets per second");
@@ -258,6 +258,21 @@ static int ocelot_setup_tc_cls_matchall(struct ocelot_port_private *priv,
return -EEXIST;
}
+ if ((action->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ action->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ action->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (action->police.peakrate_bytes_ps ||
+ action->police.avrate || action->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (action->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack,
"QoS offload not support packets per second");
@@ -132,6 +132,22 @@ nfp_flower_install_rate_limiter(struct nfp_app *app, struct net_device *netdev,
"unsupported offload: qos rate limit offload requires police action");
return -EOPNOTSUPP;
}
+
+ if ((action->police.notexceed.act_id != FLOW_ACTION_ACCEPT &&
+ action->police.notexceed.act_id != FLOW_ACTION_PIPE) ||
+ action->police.exceed.act_id != FLOW_ACTION_DROP) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when conform-exceed is not drop/pipe or drop/ok");
+ return -EOPNOTSUPP;
+ }
+
+ if (action->police.peakrate_bytes_ps ||
+ action->police.avrate || action->police.overhead) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Police action is not supported when peakrate/avrate/overhead is configured");
+ return -EOPNOTSUPP;
+ }
+
if (action->police.rate_bytes_ps > 0) {
if (bps_num++) {
NL_SET_ERR_MSG_MOD(extack,