From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10087.outbound.protection.outlook.com [40.107.1.87]) by dpdk.org (Postfix) with ESMTP id 1DD051B396; Thu, 3 Jan 2019 16:06:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F6lV2XQolRqnQcsPgX6GgGiMHcvuwtycqplZDgMCC8g=; b=JMteVH6jC66FHU8ezt1aLtgK8+7b22Nz71jZX4WxhDLbs2G03A/URCtuYxywui2b4yndXYRSlw6Pb+ocorLZmR0jgz0JCBRztM1pYOJNaKMoWRx9Eyhkae0vvkwgJjlInIlrnkg7fzXG07DvRpxJTbMsRiJqC+9YqONQrjGEG54= Received: from AM0PR05MB4435.eurprd05.prod.outlook.com (52.134.92.20) by AM0PR05MB4194.eurprd05.prod.outlook.com (52.134.90.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.7; Thu, 3 Jan 2019 15:06:36 +0000 Received: from AM0PR05MB4435.eurprd05.prod.outlook.com ([fe80::c860:9e3d:3158:8ea]) by AM0PR05MB4435.eurprd05.prod.outlook.com ([fe80::c860:9e3d:3158:8ea%4]) with mapi id 15.20.1495.005; Thu, 3 Jan 2019 15:06:36 +0000 From: Mordechay Haimovsky To: "dev@dpdk.org" CC: Mordechay Haimovsky , "stable@dpdk.org" Thread-Topic: [PATCH v4 1/3] net/mlx5: fix shared counter allocation logic Thread-Index: AQHUo3XrbWFmD7QVWE+TK6Kgij9UjA== Date: Thu, 3 Jan 2019 15:06:36 +0000 Message-ID: <1546527981-23028-2-git-send-email-motih@mellanox.com> References: <1546422185-30813-4-git-send-email-motih@mellanox.com> In-Reply-To: <1546422185-30813-4-git-send-email-motih@mellanox.com> Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0219.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::15) To AM0PR05MB4435.eurprd05.prod.outlook.com (2603:10a6:208:5a::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.7.1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR05MB4194; 6:YkOSrQ+zlcwa5sRG3NiTaf2b28O9lC4CiQw4uXYNRxTdI2TMSGWu5qGyv0O8tfkPkINHOVHFar6V9MEtMI6Axc+Ho2kYlSeoAdqTQ9g17tAlCuPMGfQyQtP5x0WlRbdIevkP3DMBB7LmvBcVFgOLsYAH3sZy+JwZ71pdhox0WhJxMnAePsQnjYOW/4enZekzYUALEVaI9YtCil8oq23yd+LwkPMyLfGGTQGZfE6HxFj84uiNyGGvONovi3IvgxLcTvrRqWHvjabSm9NR5rAzuSeMLCMH2pDY/+/HJr+xBXip+2vdn3OOP7+0BGvnnLlzVFxEmzdOEc/KfYZ7I3L4CPiwytn2kSup2STbkgt5ogB9auSqiaHYiDyUBvtugCfxsj/F5U2Ra2N+4evwbH3T+H2EvWprx37OgRYxVqP8VhdPvptuGDOx3Sh6q3NjTWLWgMRhKnEq74TNLiqt2tKdNQ==; 5:08eW5RB89AKLKic9gvxTeFGKWa7CuLv7QpnTXi1WwJZL9AFKP38hHy+FyPWeHPrat45mOi4uWJiOPopyCFdQ/l4/3RdaJu+ZQKrpq3p8FNqFkIttl567GHT4c9c1uTb1IGygZKoIfeMfAixOdYrl8ddxKmqnS0moIQy7iaorgRjFufZefXmalQgfW1JZwStPofPhzbVU8bB9+QgSLg1oDA==; 7:6mmad/PcN6//mxuRS54ZOrTFwDG1RHZ8fVUAN6eDWBPusC6mCbK+vg8huSsUHDe9fFJ7N4w6DM5MArrw2YStBPirBr6g6eundgaNZ7f8mU3O9wZlRnlewVwYO4nDJdOZOa2AMeZwRvssnXQqd6geHw== x-ms-office365-filtering-correlation-id: 4721a5fa-509b-48f3-f1bf-08d6718d0df5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4194; x-ms-traffictypediagnostic: AM0PR05MB4194: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3231475)(944501520)(52105112)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM0PR05MB4194; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4194; x-forefront-prvs: 0906E83A25 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(366004)(136003)(346002)(39860400002)(189003)(199004)(6916009)(446003)(2616005)(54906003)(316002)(186003)(5660300001)(6116002)(3846002)(71190400001)(71200400001)(2351001)(36756003)(478600001)(450100002)(11346002)(476003)(68736007)(99286004)(25786009)(66066001)(6506007)(2501003)(102836004)(2906002)(26005)(386003)(97736004)(4326008)(8676002)(53936002)(52116002)(6512007)(81156014)(486006)(106356001)(305945005)(105586002)(7736002)(256004)(6436002)(5640700003)(76176011)(86362001)(50226002)(6486002)(8936002)(81166006)(1730700003)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4194; H:AM0PR05MB4435.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: HIm2qfyEB7ANZTpoOaQjARa6pxH+w2pO5deHQEtqSiFB16VnqUsV54Y0ypbSE1I2ULn5eI9zeJpezlq2llF0PfeOM0EyO4+j0hYpjXpB1B5hD4WzW9z1wgCVkPkvnzFY0ZiUNWuSsPavQzU1P/pSrhkWCjM8iNCqF/gT5vgr4rztX6QSpAFHtC/2kNO+8c0T0vw+OpiXHdZn8bV5sYVxai5LDpgly4+voYxroYJI3AbwlfzYciv8JH8IxfFwTfJhO9vzMTxDvAO9uM5QbPvRoxz/g3S4e01P4H/Rdo7vaVY//n4R39dl5bNmW1HIPGQ1 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4721a5fa-509b-48f3-f1bf-08d6718d0df5 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2019 15:06:35.4270 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4194 Subject: [dpdk-dev] [PATCH v4 1/3] net/mlx5: fix shared counter allocation logic 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: , X-List-Received-Date: Thu, 03 Jan 2019 15:06:37 -0000 This commit fixes the logic for searching and allocating a shared counter in mlx5_flow_verbs. Now only the shared counters in the counters list are checked for a match and not all the counters as before. Fixes: 84c406e74524 ("net/mlx5: add flow translate function") Cc: stable@dpdk.org Signed-off-by: Moti Haimovsky --- v2: * Modified commit header --- 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