From 1e577c9e5fe49ee1b2a201ac926e7deeec19c76d Mon Sep 17 00:00:00 2001 From: Ophir Munk Date: Tue, 25 Aug 2020 09:31:11 +0000 Subject: [PATCH] net/mlx5: call meter detach only if DR is supported Flow metering is supported only in direct rules (DR). Currently the APIs of meter actions create and modify are under #ifdef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER, while detaching the meter action is executed unconditionally. This commit adds the same ifdef to API mlx5_flow_meter_detach(). This commit avoids compilation failure of non-Linux operating systems which do not support DR. Signed-off-by: Ophir Munk Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_meter.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index bf34687e5a..b36bc7bac3 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -1221,6 +1221,7 @@ error: void mlx5_flow_meter_detach(struct mlx5_flow_meter *fm) { +#ifdef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER MLX5_ASSERT(fm->ref_cnt); if (--fm->ref_cnt) return; @@ -1230,6 +1231,9 @@ mlx5_flow_meter_detach(struct mlx5_flow_meter *fm) fm->ingress = 0; fm->egress = 0; fm->transfer = 0; +#else + (void)fm; +#endif } /** -- 2.20.1