From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770050.outbound.protection.outlook.com [40.107.77.50]) by dpdk.org (Postfix) with ESMTP id 9018B1B4FB for ; Thu, 29 Nov 2018 16:09:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Px/iDniAU9Jlv+DLurjEujDgEA9aC4tXSnp/57cghpM=; b=Y4NYcMMnFFwpCKvmOyA234YtsEtR8CTgCFmnvNdYI0Np/+g/TutHiq+esf1BRxERfD6joFreDRVcKxPUikxGA8cWl9WN1Ku31y1hQJqGdhUA70R4BnIJOQfQVGl18nGNIj9m8nZ63VZ4N6zwjXXJFeKM6nVhMGil6JQyItrJGPM= Received: from SN6PR07MB5023.namprd07.prod.outlook.com (52.135.121.77) by SN6PR07MB4848.namprd07.prod.outlook.com (52.135.74.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.20; Thu, 29 Nov 2018 15:09:16 +0000 Received: from SN6PR07MB5023.namprd07.prod.outlook.com ([fe80::394d:a08e:f006:7c23]) by SN6PR07MB5023.namprd07.prod.outlook.com ([fe80::394d:a08e:f006:7c23%3]) with mapi id 15.20.1382.017; Thu, 29 Nov 2018 15:09:16 +0000 From: Harman Kalra To: "bruce.richardson@intel.com" , "david.hunt@intel.com" CC: "dev@dpdk.org" , "Jacob, Jerin" , "Kalra, Harman" Thread-Topic: [PATCH 2/2] distributor: imposing additional check on no of workers Thread-Index: AQHUh/V+Ax6WeHhVgUmULxR/bl2ctg== Date: Thu, 29 Nov 2018 15:09:16 +0000 Message-ID: <1543504135-137867-2-git-send-email-harman.kalra@caviumnetworks.com> References: <1543504135-137867-1-git-send-email-harman.kalra@caviumnetworks.com> In-Reply-To: <1543504135-137867-1-git-send-email-harman.kalra@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0044.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::30) To SN6PR07MB5023.namprd07.prod.outlook.com (2603:10b6:805:ad::13) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Harman.Kalra@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; SN6PR07MB4848; 6:LJpGRGpzQ3zXrEQhdJXgxwoHaBP4qtANXcTWJJGdFyX5kVU3VAPtzXWVJqrxaL8OxZgNgWmVvATiLkXU2BXO9m+iaaLfAK94S+VHGvIJkdxy2Bac/pV9tH6btWPEBJYXmV0Ht4yXxJSJOAInfOM+XXr50jXpv6GpkAM6kRLty5eqP6T7W6ES+QUy7GwHvpJXxlyHGz7jDbeHGY9M4E4Zx707SUk/qnMCHa9Q7128Si+AIX8CJR1vktMRm4iBauoGpVR/zF6dgNGgVbsVexgH0gxbQ+WteriElbiNKxqFRD60RFgUXdDSRvHNI6Hy9As+xQ4l0QQQLB9Dp6yBbfKNLP5uibZhkNNRmMe5KQlX9jvmhtPUV9jUCofaKM0YspLXjS8ZkYrE8zxgILKwcrGxz3A969pJ3HIvYByrbfL1tR5rGtys+6uMzJwUWDIBun4oFcjm2GZyCj3kZsalJWXkdQ==; 5:e9K2QlN9xcpHYtNd3CBuP1QOO4c5el7U3CdFgCGv+Rjexkd/bYwhGWrIf3zYoeqRQj/EWE282UgzKRlddALiEE006LZF72SM1E1txBrHV2fKP070bZYtSr8tmNLX2g6l9pcRH9ulWzm4k6ZrbOKeM9lGefND5LRCJYtvszs+7YM=; 7:Aed7Zr6D1b5omnlZ51Agomuc3e5Y+Op9bskEfy6rtKnADwVFcd/6Chk7ILrQGa0gOPSV8DZDpz6l3N88VVIvpNnv3iFfnKqbRw38lgJQ2/NBterdGPBAbfpOLecxtYOqNGy/V7aBke92kQr7VReZsA== x-ms-office365-filtering-correlation-id: 810a8143-1ff2-4f41-0532-08d6560ca11e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4848; x-ms-traffictypediagnostic: SN6PR07MB4848: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231453)(999002)(944501410)(52105112)(3002001)(10201501046)(93006095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:SN6PR07MB4848; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4848; x-forefront-prvs: 0871917CDA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(136003)(396003)(39860400002)(199004)(189003)(446003)(42882007)(99286004)(52116002)(26005)(4326008)(81166006)(68736007)(6512007)(8936002)(8676002)(2501003)(186003)(81156014)(3846002)(2906002)(97736004)(256004)(14444005)(6116002)(7736002)(305945005)(76176011)(55236004)(386003)(102836004)(71190400001)(6506007)(71200400001)(2616005)(36756003)(6486002)(72206003)(107886003)(5660300001)(106356001)(478600001)(54906003)(110136005)(476003)(11346002)(316002)(66066001)(105586002)(53936002)(25786009)(486006)(14454004)(6436002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4848; H:SN6PR07MB5023.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ANyZ52ila+WoBwsewjY4+QXoDHLaW17rt8428sdI+78Cte7YGTP7/OdD5uUPh8VDQOYEMPjDmNh8kjmf4P5x5Ik94+Uugm/gmH7I6Lt0uX+frOxxkzE33amjuc5qn7W9mydsDCQp4WUYatzm8obiaCMSaVmw4goyuq3Lv9CF8ijbv1aoQdmUyTrvwPkzae9QDbBEPe61V32gQGqvKfw5/YvWWD/gBWqr/3pA2IWmKqpfyH4PCUr1OhdYzQhD1A0dNLDv73IE4lFBsxAoEog/qVlvThMKLbRcHd0qLajP3JhZElmllVl5+eqh3IMERishqR7yxEmTOYQ6ykjvvIwlm+B3II092cXUEbWcb14DtuY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 810a8143-1ff2-4f41-0532-08d6560ca11e X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2018 15:09:16.7668 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4848 Subject: [dpdk-dev] [PATCH 2/2] distributor: imposing additional check on no of workers 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, 29 Nov 2018 15:09:18 -0000 From: Harman Kalra No of workers should never exceed RTE_MAX_LCORE. RTE_DIST_ALG_SINGLE also require no of workers check. Signed-off-by: Harman Kalra --- lib/librte_distributor/rte_distributor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git lib/librte_distributor/rte_distributor.c lib/librte_distributor/= rte_distributor.c index d505983..043b8f3 100644 --- lib/librte_distributor/rte_distributor.c +++ lib/librte_distributor/rte_distributor.c @@ -595,6 +595,12 @@ struct rte_distributor * RTE_BUILD_BUG_ON((sizeof(*d) & RTE_CACHE_LINE_MASK) !=3D 0); RTE_BUILD_BUG_ON((RTE_DISTRIB_MAX_WORKERS & 7) !=3D 0); =20 + if (name =3D=3D NULL || num_workers >=3D + (unsigned int)RTE_MIN(RTE_DISTRIB_MAX_WORKERS, RTE_MAX_LCORE)) { + rte_errno =3D EINVAL; + return NULL; + } + if (alg_type =3D=3D RTE_DIST_ALG_SINGLE) { d =3D malloc(sizeof(struct rte_distributor)); if (d =3D=3D NULL) { @@ -612,11 +618,6 @@ struct rte_distributor * return d; } =20 - if (name =3D=3D NULL || num_workers >=3D RTE_DISTRIB_MAX_WORKERS) { - rte_errno =3D EINVAL; - return NULL; - } - snprintf(mz_name, sizeof(mz_name), RTE_DISTRIB_PREFIX"%s", name); mz =3D rte_memzone_reserve(mz_name, sizeof(*d), socket_id, NO_FLAGS); if (mz =3D=3D NULL) { --=20 1.8.3.1