From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BD71A3168 for ; Wed, 16 Oct 2019 14:49:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBEDC1E959; Wed, 16 Oct 2019 14:49:58 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10043.outbound.protection.outlook.com [40.107.1.43]) by dpdk.org (Postfix) with ESMTP id 253761E946; Wed, 16 Oct 2019 14:49:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VkW5KsG3Y9iFeHfh1jhO5O2dgoJCrKIcW80BtrED2yUU1eq/CvJ6/HRSBjpEy5G5dKrIiyGKQ1SZCmn2PZ8KI+TDK09Jv4abbokk9ebnK3RNn2sPVILRKyv5nbWDbMXqSnOk23A9x+ndJ6Tx7GUGk2UtQtpFbeecT6Jf7VKbv2AQfiTnRa/93YFpmgH+1V+mjDzBYatiagbeAFg5B+5JduJ4lALAGE90iMmocKqQ17EQ5tCxBWXaY87DMjifiS+hgOc//HYjcaFLi2/NKyAaWOU2zvQk/44P5TpsgXRg7Cbdymo0h9oZ7Z5yQc/MZgKgxWxvmtWA+gSAicZWLW4p8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NBMg8gqwPZ1D/1Vqki5Beuco/nNeGiTAUkV3KIKX7Cg=; b=dVdPleAg6m6ezAoTPWaysr2P1lNHpI987eUGj1/hcKl0Fb1p2m+mdgJ/2iLtsXAMogLlL8YhF2ToY8fiijFKu5yoNjAVrXbhRbrOOFpFpuRGcqMU8AyjHobog+GxEvsO/HmgcoGEA8gXhhuv7KfarBdTqW1nPoRWlCo/ReRPc640Cbv/IWXrYWIvBkf/TU6voCAWAeJ4kon+62p2sgwFZf7l7SMfq4iHOefQdcM3y8wTy7yhVzICtRaXz5BEWb+zpqWkcEbXpBiTo2ibrg8k0bchtlZh0MFQm69hGxOJz8gaX4Et1KAcdoF8cJynGRaFPVfNVscsLQA7wzXImkcobg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NBMg8gqwPZ1D/1Vqki5Beuco/nNeGiTAUkV3KIKX7Cg=; b=HKxFB7Y+nCsfgiYn4VilTypTJuU20U3egGUo14BJPE2QGiVZdu5Zp6GUZOfsS916IbQfIv97moz7wtjeD9ft/SWTYmWjA8BVo+md+uNDFlQVHkuAuOlNRxdfUkNgpXepj2HGfWOqNPFYKz8Iz/eY47/HDrVpADB02JdpMlYkL/M= Received: from VE1PR04MB6639.eurprd04.prod.outlook.com (10.255.118.11) by VE1PR04MB6765.eurprd04.prod.outlook.com (20.179.235.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.22; Wed, 16 Oct 2019 12:49:56 +0000 Received: from VE1PR04MB6639.eurprd04.prod.outlook.com ([fe80::c045:5df2:ba1f:c3ee]) by VE1PR04MB6639.eurprd04.prod.outlook.com ([fe80::c045:5df2:ba1f:c3ee%5]) with mapi id 15.20.2347.023; Wed, 16 Oct 2019 12:49:56 +0000 From: Akhil Goyal To: Julien Meunier , Declan Doherty CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v3] cryptodev: fix check related to device id Thread-Index: AQHVhAt2q0tQGJJkykKYo7T24jomA6ddOCHA Date: Wed, 16 Oct 2019 12:49:56 +0000 Message-ID: References: <20190807083946.39309-1-julien.meunier@nokia.com> <20191016102111.57077-1-julien.meunier@nokia.com> In-Reply-To: <20191016102111.57077-1-julien.meunier@nokia.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=akhil.goyal@nxp.com; x-originating-ip: [92.120.1.65] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9fe98409-935d-4b12-9b18-08d7523758d7 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: VE1PR04MB6765: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0192E812EC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(346002)(376002)(136003)(39860400002)(396003)(199004)(189003)(86362001)(4326008)(102836004)(71200400001)(33656002)(81166006)(8676002)(25786009)(478600001)(74316002)(76116006)(81156014)(99286004)(2906002)(66556008)(66476007)(3846002)(64756008)(66446008)(66946007)(6116002)(256004)(8936002)(14444005)(6506007)(6246003)(4744005)(5660300002)(71190400001)(186003)(9686003)(54906003)(52536014)(316002)(296002)(6436002)(446003)(7736002)(305945005)(14454004)(55016002)(110136005)(229853002)(76176011)(11346002)(66066001)(486006)(26005)(7696005)(44832011)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR04MB6765; H:VE1PR04MB6639.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NmlBZiMFeYW3U+yvxjEpIAhSaLx1FKi1vtpXAO0NidxMnqLsmJ5kumdHFjv7ina/M7Mkopefd7wB3BjYXGvkv08CpPX9ul2PbLMZljTe/UZjJQX70RdosBkoLJcJlqFFrTX3U7wf0Q075nNT7Xyxg/SwwQxb1pXyQvejnZiR+8azIoOrilZrbb5tyWiEtxpjDdRRaozO1WlWhZ+hfP4An1LDaWzKcfXgECmevBBSJLnbukz0jzF6MnATktOXsoZXs1j5SFBGQPyTfDOwmTo9oCQPxHFk3WpMrnuDcp1Hz2ed9+vV2ypV0ZLQBckbdW09u10gp0IhVSLDz+0Ne2Hn3o9WpzdLWWmhHyWqlmbTYZXSFflQeDEyu2hi6tLa9yEYt3wpVG1MLaIyKZEIogYx47tBrcx0vKymXG17MUikJjo= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9fe98409-935d-4b12-9b18-08d7523758d7 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2019 12:49:56.2378 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: iXk2l47rdTcnxgZipkKEkomOTDPCajabv5w9X4eYoBLlihZoBOap7tY/pssWmpvttInAayma7Zu8p+5ZTROdrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6765 Subject: Re: [dpdk-dev] [PATCH v3] cryptodev: fix check related to device id 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" >=20 > Each cryptodev are indexed with dev_id in the global rte_crypto_devices > variable. nb_devs is incremented / decremented each time a cryptodev is > created / deleted. The goal of nb_devs was to prevent the user to get an > invalid dev_id. >=20 > Let's imagine DPDK has configured N cryptodevs. If the cryptodev=3D1 is > removed at runtime, the latest cryptodev N cannot be accessible, because > nb_devs=3DN-1 with the current implementaion. >=20 > In order to prevent this kind of behavior, let's remove the check with > nb_devs and iterate in all the rte_crypto_devices elements: if data is > not NULL, that means a valid cryptodev is available. >=20 > Also, remove max_devs field and use RTE_CRYPTO_MAX_DEVS in order to > unify the code. >=20 > Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto > devices") > Cc: stable@dpdk.org >=20 > Signed-off-by: Julien Meunier Acked-by: Akhil Goyal Applied to dpdk-next-crypto Thanks.