[SRU][F:linux-bluefield][PATCH 6/7] flow_offload: reject configuration of packet-per-second policing in offload drivers

Bodong Wang bodong at nvidia.com
Tue Aug 3 19:16:08 UTC 2021


From: Baowen Zheng <baowen.zheng at corigine.com>

BugLink: https://bugs.launchpad.net/bugs/1938818

A follow-up patch will allow users to configures packet-per-second policing
in the software datapath. In preparation for this, teach all drivers that
support offload of the policer action to reject such configuration as
currently none of them support it.

Signed-off-by: Baowen Zheng <baowen.zheng at corigine.com>
Signed-off-by: Simon Horman <simon.horman at netronome.com>
Signed-off-by: Louis Peens <louis.peens at netronome.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(backported from commit 6a56e19902af01da447cd3104d5a6e8d01792ee1)
Signed-off-by: Bodong Wang <bodong at nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c      | 4 ++++
 drivers/net/ethernet/netronome/nfp/flower/qos_conf.c | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index a410a17..d29b300 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4341,6 +4341,10 @@ 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.rate_pkt_ps) {
+				NL_SET_ERR_MSG_MOD(extack, "QoS offload not support packets per second");
+				return -EOPNOTSUPP;
+			}
 			err = apply_police_params(priv, act->police.rate_bytes_ps, extack);
 			if (err)
 				return err;
diff --git a/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c b/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c
index a8c449e..87546d7 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c
@@ -104,6 +104,11 @@ struct nfp_police_stats_reply {
 		return -EOPNOTSUPP;
 	}
 
+	if (action->police.rate_pkt_ps) {
+		NL_SET_ERR_MSG_MOD(extack, "unsupported offload: qos rate limit offload not support packets per second");
+		return -EOPNOTSUPP;
+	}
+
 	rate = action->police.rate_bytes_ps;
 	burst = action->police.burst;
 	netdev_port_id = nfp_repr_get_port_id(netdev);
-- 
1.8.3.1




More information about the kernel-team mailing list