From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40072.outbound.protection.outlook.com [40.107.4.72]) by dpdk.org (Postfix) with ESMTP id D8CC31B1FB; Wed, 2 Jan 2019 10:43:19 +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=gplm/X29aSOSpIBZEFEmbAfwalB6XaE+4AXmiGfZXtAN7tUb3JlDmD1qTC8hPQXuJEcOKSigR6iVzlLbVtE5Ko9x2kfd26U/EzvGVH58jAabTzXdkbPsgSbwy6ZhFvTfWaOaO6qyO15bF1oJwGJCPpW4ZTfkV/BQ7yEHPUTZ4bU= Received: from DB7PR05MB4444.eurprd05.prod.outlook.com (52.134.109.21) by DB7PR05MB5415.eurprd05.prod.outlook.com (20.177.123.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Wed, 2 Jan 2019 09:43:19 +0000 Received: from DB7PR05MB4444.eurprd05.prod.outlook.com ([fe80::6d18:42b9:26fe:ea2f]) by DB7PR05MB4444.eurprd05.prod.outlook.com ([fe80::6d18:42b9:26fe:ea2f%2]) with mapi id 15.20.1495.005; Wed, 2 Jan 2019 09:43:19 +0000 From: Mordechay Haimovsky To: "dev@dpdk.org" CC: Mordechay Haimovsky , "stable@dpdk.org" Thread-Topic: [PATCH v3 1/3] net/mlx5: fix shared counter allocation logic Thread-Index: AQHUon+XWaXPEY/1AU+qlVt237u0OQ== Date: Wed, 2 Jan 2019 09:43:19 +0000 Message-ID: <1546422185-30813-2-git-send-email-motih@mellanox.com> References: <1545949196-3355-4-git-send-email-motih@mellanox.com> In-Reply-To: <1545949196-3355-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: LO2P265CA0218.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::14) To DB7PR05MB4444.eurprd05.prod.outlook.com (2603:10a6:5:1b::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB5415; 6:TFVGiw/n3kEUE5R1in/T2FvBi/6x/kolwR/ZKNXb7IUBd1GgYvDtZlyph40cPy4jywJNnWrIussnl0iLIQMZS5QapwzdmxahOpnVpm2/scj7BWuFv/CF29OXTVLIuW7frSnzZBdb/dgpGJNIuMfcIOMUmWSEoFxRz4r7IuxZNi4M/DucrlIzuo1QGDifX5xghft80SyryNdz97YKR1krTovjdzvKnjudm4IljwM5Zq+Jkp4jHAqMDhii+QDMYYwcgs8pOyIMggTfxHZCRlm3uXvajCaU9nhtsE+Ve2vMXAM2AI0gXwsVAeXroOu3Y1tdwibXIfgklwGRANDN2moU/N5gx9tMkO3DsRD2b8DOC7ssERZrxlGGFHy3JLTjn/7ovQ0rUwbrBIjcKWHkMorVn91vnrH4cjEst3RLkrrg8ybVoVUlaZbKidQXK9hrWua3NXdXKzwcLEWXlZVZlJ9BiQ==; 5:wxyzRcOEUVu7D5pmj+AYI3JgmnH/nmNMkEnp57W4de32gzC7n2B8bY2XVT2gx4RyLAvE2jcsPrIrKBuwh9dVnWBwvurd/V9JC3Z4GRInmD7aFKfqc98xZuyjn/Vqa5oIR5vmEqVptKUs7dJ79+CgofReTiJ9J6A4ZWZna77oaNvakGmGeVodcZF5kjib4E6iiKYQLJaxKmJS3n7nT1ALfg==; 7:+NpfkMVPKsSh7NR9Ra5EvzyFGog69ckXb7nt9wS1DEN8sCYe9Y8JdoJkXE0AzH1mgK0epv+b5yIjMFsas0mbCkIOH/NQ2yLCnq8nf7X/lWFBqF47vvAo5sVrsKLKehIMSezWm4tldEDPqVv6OHJJGA== x-ms-office365-filtering-correlation-id: 3e092210-be2a-4475-dced-08d67096b9f2 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:DB7PR05MB5415; x-ms-traffictypediagnostic: DB7PR05MB5415: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(93006095)(93001095)(3231475)(944501520)(52105112)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB5415; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB5415; x-forefront-prvs: 0905A6B2C7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(136003)(366004)(346002)(199004)(189003)(476003)(8676002)(6436002)(81156014)(8936002)(6116002)(3846002)(14454004)(2351001)(68736007)(6486002)(2906002)(5640700003)(81166006)(450100002)(4326008)(7736002)(305945005)(25786009)(1730700003)(6512007)(5660300001)(53936002)(6916009)(66066001)(99286004)(2501003)(36756003)(478600001)(86362001)(316002)(54906003)(256004)(386003)(6506007)(105586002)(26005)(102836004)(71200400001)(97736004)(106356001)(76176011)(52116002)(446003)(2616005)(11346002)(186003)(71190400001)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5415; H:DB7PR05MB4444.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: QlJJI/tJhKx3QAxQ3r1GB6Gg4U3b+gYKFZdS/L4BTIgkBkIIzuu2zodXcpFxbfZt0Z5mJ4nzn4H9h5Yodt6dcFjcgdB9a9I8Kd+6T873j/AKrinSLZqcIUTepa1zcE3U2y2HPvubYo4Sauhtzh2/RAxYCTRU7ZHOyEtyT5NcqSXq4KGF7hRh6VTluynJjjP2GT38+Zi1cHGtlDHZ+nKIWm3mst+pe4mrUpw0Vqa0hTQ089lWha0PV+9e/K1xLXQQPjUFVD/Tg+hMSfgNgbRljwDJasXPFuOMgu/yG0q8QXnADI02TKdRJ48/6qrui1Iz 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: 3e092210-be2a-4475-dced-08d67096b9f2 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2019 09:43:19.0673 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5415 Subject: [dpdk-dev] [PATCH v3 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: Wed, 02 Jan 2019 09:43:20 -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