diff mbox series

[net-next,v2,09/12] flow_offload: introduce "delayed" HW stats type and allow it in mlx5

Message ID 20200228172505.14386-10-jiri@resnulli.us
State Changes Requested
Delegated to: David Miller
Headers show
Series net: allow user specify TC action HW stats type | expand

Commit Message

Jiri Pirko Feb. 28, 2020, 5:25 p.m. UTC
From: Jiri Pirko <jiri@mellanox.com>

Introduce new type for delayed HW stats and allow the value in
mlx5 offload.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
v1->v2:
- moved to action
- fixed c&p error in patch description
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 6 ++++--
 include/net/flow_offload.h                      | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 9a8da84e88c9..81242ed4f0ca 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2886,7 +2886,8 @@  static int parse_tc_nic_actions(struct mlx5e_priv *priv,
 		return -EOPNOTSUPP;
 
 	act = flow_action_first_entry_get(flow_action);
-	if (act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_ANY) {
+	if (act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_ANY &&
+	    act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_DELAYED) {
 		NL_SET_ERR_MSG_MOD(extack, "Unsupported HW stats type");
 		return -EOPNOTSUPP;
 	}
@@ -3347,7 +3348,8 @@  static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 		return -EOPNOTSUPP;
 
 	act = flow_action_first_entry_get(flow_action);
-	if (act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_ANY) {
+	if (act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_ANY &&
+	    act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_DELAYED) {
 		NL_SET_ERR_MSG_MOD(extack, "Unsupported HW stats type");
 		return -EOPNOTSUPP;
 	}
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 7f0e2a20078f..79a0fda9b7bd 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -158,6 +158,7 @@  enum flow_action_mangle_base {
 enum flow_action_hw_stats_type {
 	FLOW_ACTION_HW_STATS_TYPE_ANY,
 	FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE,
+	FLOW_ACTION_HW_STATS_TYPE_DELAYED,
 };
 
 typedef void (*action_destr)(void *priv);