From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mordechay Haimovsky Subject: [PATCH v1 1/3] net/mlx5: modify shared counter allocation logic Date: Tue, 25 Dec 2018 14:38:43 +0000 Message-ID: <1545748697-3385-2-git-send-email-motih@mellanox.com> References: <1545748697-3385-1-git-send-email-motih@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Mordechay Haimovsky To: "dev@dpdk.org" Return-path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20050.outbound.protection.outlook.com [40.107.2.50]) by dpdk.org (Postfix) with ESMTP id B961F1B201 for ; Tue, 25 Dec 2018 15:38:43 +0100 (CET) In-Reply-To: <1545748697-3385-1-git-send-email-motih@mellanox.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit modifies the logic for searching an allocating a shared counter in mlx5_flow_verbs. modifies commit 84c406e74524 ("net/mlx5: add flow translate function") Signed-off-by: Moti Haimovsky --- drivers/net/mlx5/mlx5_flow_verbs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flo= w_verbs.c index 81ec59d..409e1cd 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -121,13 +121,13 @@ struct mlx5_flow_counter *cnt; int ret; =20 - LIST_FOREACH(cnt, &priv->flow_counters, next) { - if (!cnt->shared || cnt->shared !=3D shared) - continue; - if (cnt->id !=3D id) - continue; - cnt->ref_cnt++; - return cnt; + if (shared) { + LIST_FOREACH(cnt, &priv->flow_counters, next) { + if (cnt->shared && cnt->id =3D=3D id) { + cnt->ref_cnt++; + return cnt; + } + } } cnt =3D rte_calloc(__func__, 1, sizeof(*cnt), 0); if (!cnt) { --=20 1.8.3.1