From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70055.outbound.protection.outlook.com [40.107.7.55]) by dpdk.org (Postfix) with ESMTP id 60D6D1B119; Tue, 23 Oct 2018 12:04:11 +0200 (CEST) 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=1I1/gp05ITbNWr48u+k9oHhwW+5T/VNpGR7M5Gogq30=; b=iDXqLPUPqEeNGg5ibELbVLj8lt27Rmuum0yWQJhJygtHAuT8xY51sEDJbvE0bu2e1z4aVT/3d+kktwgFQH/J5fMOwQmGJ8v0WirSo7KCJP9PQBJYQv70+4oSAzxoQKGUJ69V+zfHjkdssctj8BhrBmbGYRBlBy+NBv1wnOkgMqc= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.186.150) by AM4PR05MB3380.eurprd05.prod.outlook.com (10.171.187.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Tue, 23 Oct 2018 10:04:10 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::477:2091:24b4:439f]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::477:2091:24b4:439f%4]) with mapi id 15.20.1250.028; Tue, 23 Oct 2018 10:04:10 +0000 From: Slava Ovsiienko To: Slava Ovsiienko CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v4 1/8] net/mlx5: fix flow counters creation Thread-Index: AQHUare+Bhz3uSeTjE63OIOzOnUQOA== Date: Tue, 23 Oct 2018 10:04:10 +0000 Message-ID: <1540289032-29628-2-git-send-email-viacheslavo@mellanox.com> References: <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> <1540289032-29628-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1540289032-29628-1-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0442.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::22) To AM4PR05MB3265.eurprd05.prod.outlook.com (2603:10a6:205:4::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3380; 6:RLnGhODNSn2S2gWPexSmMwJ6s00xvjiFd+fCJ/Ot4c3lZAKIffEN1bdzy4PU0i9BXtFnUGmImq4A3Tw6ForDIlRn+uD77W1fuM9L4DlA8RxHMYxRZC0Y0LI5u+khWWLtiWFAk4K2t016d449yTlRBIDjxmiXLZmavYyZVx2VywIvhAXYKsiLDnQFtTBf6Fw9uUKnrRQxq+balgsr33wd1BYz/TyNoO0KJglFoe14Pd4tSkvnOnysvUR4RNd/SnknxDqq7JoWxntkFcctBex0nax0HNinG1ezdcpMhTGRtc/yXcFJNE2zzrKOlP4uCyW3rUu2f2+bXLYhurFIFWb35XcwlI7Tw8X47eQ4QzcZoXFcPrzP0dGQu7xCcNciQ51jl3wWK7+HoGdHRW2m4e4WcQ232mcRZSpcINiBBtCRfm4S80lUAa8NV1SKIEOBU8agEXGLxnzT8/XXbCCAWSmYcg==; 5:YnqYTGOaRiQhKtwI5Kl+fk2K8SZQ52Fmgi3+Ky+oBqIRjE/Dddr4MBgAaOVeXaQ5mbmVqd3tWv0C5vPaphdakOQU9KwxMHPWtZvHlHFkGdnnumg+1izhIsKHOMpTXcAe/fmCJNfGvNKXvijfYCbDHCfl/COm5gJjzfXqiO2zr7A=; 7:u0C+8fT7WwhLc8V094c5IZGTIKg54ztJ2fIYdbltx4Cno0m3l3czIlRaHkMEghzVQ+otFKw9wF1BaRab+wsrdQy5c+uKWczF+jVaCuVpUf/tgJPBd9I/jwi04vmsKV3SQLX7KSxU9wylA8iqvZKlCO8L+IYcUfy6wwRnk0CLLlbWIEjI9FlSDQn1nzYLtK5OkWqsskPOJEiUzY4ZF2DBbCCMR3g6KtAmmxhUJrw7vfoKzfN13LxZugV5PBsU7v0K x-ms-office365-filtering-correlation-id: 5fe7f83a-467b-4f56-6359-08d638cee098 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3380; x-ms-traffictypediagnostic: AM4PR05MB3380: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3380; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3380; x-forefront-prvs: 0834BAF534 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(346002)(39860400002)(376002)(366004)(199004)(189003)(71200400001)(6512007)(2906002)(478600001)(5660300001)(446003)(2616005)(14454004)(53936002)(6436002)(37006003)(3846002)(81156014)(6862004)(54906003)(86362001)(36756003)(2900100001)(5250100002)(7736002)(305945005)(14444005)(6116002)(6486002)(105586002)(7049001)(316002)(97736004)(68736007)(71190400001)(52116002)(102836004)(4326008)(476003)(25786009)(450100002)(99286004)(66066001)(106356001)(8676002)(81166006)(256004)(76176011)(6506007)(386003)(486006)(11346002)(6200100001)(26005)(186003)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3380; H:AM4PR05MB3265.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-microsoft-antispam-message-info: y6Wx3pHDwivVkcfle6ZJZfF2Tooyp644nQqFIwHPfTFzIWYM7cHgNHmcsP5IoexWUslTxqSXxMuvhZufhmHfRK9CdGEd6x+RskvD/aP4TRflB2JOOdOAMtXfgFFRCNUhd1B/dnm2FGTgQd21AjWvzw5mFe3BYcpmAYs1Cdi5u1qvkvzoYRMoMoV4JGSr/Iutfs7GiufOMZj9vH5OeeudjrupAPZOqzheZRxyDuc/qqcx78XiIMPXrTgpXwqXz4+NMeWYzRX3aQn14OafzNgcJJA0SSrVx7ZWXWd2phzOM6YmjgvytgfsZc/nT9kyewn2dOJ01NKU/Plx35WyOXWieWyOwajFh8RmG8F0CGQk6mM= 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: 5fe7f83a-467b-4f56-6359-08d638cee098 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Oct 2018 10:04:10.5468 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3380 Subject: [dpdk-dev] [PATCH v4 1/8] net/mlx5: fix flow counters creation 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: Tue, 23 Oct 2018 10:04:11 -0000 The Flow counter creation function contains two problems: - Flow counter object in Verbs is not freed in case of memory allocation error. The call of counter Verbs object deallocating function is added to fix. - The initial value of reference counter is set to one in order to provide the correct counter object freeing in the flow_verbs_counter_release() function. The reference counter field should be initialized to one. Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_verbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flo= w_verbs.c index 4ae974b..6ddb13b 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -72,6 +72,7 @@ }), .hits =3D 0, .bytes =3D 0, + .ref_cnt =3D 1, }; =20 if (!tmpl.cs) { @@ -80,6 +81,7 @@ } cnt =3D rte_calloc(__func__, 1, sizeof(*cnt), 0); if (!cnt) { + claim_zero(mlx5_glue->destroy_counter_set(tmpl.cs)); rte_errno =3D ENOMEM; return NULL; } --=20 1.8.3.1