From patchwork Thu Aug 20 14:28:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ophir Munk X-Patchwork-Id: 75861 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E5A99A04AC; Mon, 24 Aug 2020 09:34:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4308C1BECB; Mon, 24 Aug 2020 09:34:29 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 748661C0D4 for ; Thu, 20 Aug 2020 16:29:02 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from ophirmu@mellanox.com) with SMTP; 20 Aug 2020 17:28:56 +0300 Received: from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 07KESun2016006; Thu, 20 Aug 2020 17:28:56 +0300 From: Ophir Munk To: dev@dpdk.org Cc: Raslan Darawsheh , Ophir Munk , Matan Azrad Date: Thu, 20 Aug 2020 14:28:29 +0000 Message-Id: <20200820142834.2984-8-ophirmu@mellanox.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20200820142834.2984-1-ophirmu@mellanox.com> References: <20200820142834.2984-1-ophirmu@mellanox.com> X-Mailman-Approved-At: Mon, 24 Aug 2020 09:34:27 +0200 Subject: [dpdk-dev] [PATCH v1 08/13] net/mlx5: call meter detach only if DR is supported X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 bf34687..b36bc7b 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -1221,6 +1221,7 @@ mlx5_flow_meter_attach(struct mlx5_priv *priv, uint32_t meter_id, 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 } /**