From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 5F7815B26 for ; Mon, 18 Feb 2019 15:51:46 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1IEodPV017990; Mon, 18 Feb 2019 06:51:45 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=DVGXwss1PPQyIEGB1vEUaUg6GdWKEla0i8A3PUs7oiE=; b=CDDJdrP+cyciTKzgTn7NHuHecSOvG/NNEKL9KN4foYwKwK9YmN0756Jx6UiqkG8Cu56S rZ120birO5dnfwJQq6srIEdIO2/Xyva50i0yIcmTaUYf1VXyovv7u279zbxiOvhqJjEm StltyOC8WTeC8IY8C3V8PIOabTi0AiaIM6G6N+2e2SU6OiVcUqpxRE7PkX0JDL9Ytkss g4simslYtr9XJEnrAZ/Njc05mFtj/Yu5MIFkQBCxIACio0YOtRb0kj1dkulkNuZvVa7B kLb8CjyPu3+7S/DlkaPbxM9NpcXIfksT4frLg0/YSuyOQFVXIhnW8d3tFhXZs1LHvfl1 XQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2qpjwpwtxn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 18 Feb 2019 06:51:45 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 18 Feb 2019 06:51:39 -0800 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.57) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 18 Feb 2019 06:51:39 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DVGXwss1PPQyIEGB1vEUaUg6GdWKEla0i8A3PUs7oiE=; b=VfFNTMH/YaAWhW1OpxfiJqBtUBqDl91XioyngV4EoI9sRoFhL/dgwTol7poLJhgPigzB+9wzh0BNEL1u74qaCT7m38SL73bEfte4OrDpp/ACRlhb6fceFxcGS0GcS5p8RZt9T7DAZLtlKInxpSBJbhs2VXrbdPQnUM1qALWhyfA= Received: from BL0PR18MB2226.namprd18.prod.outlook.com (52.132.29.158) by BL0PR18MB2196.namprd18.prod.outlook.com (52.132.29.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Mon, 18 Feb 2019 14:51:38 +0000 Received: from BL0PR18MB2226.namprd18.prod.outlook.com ([fe80::ed6d:c09a:3de9:f242]) by BL0PR18MB2226.namprd18.prod.outlook.com ([fe80::ed6d:c09a:3de9:f242%5]) with mapi id 15.20.1622.018; Mon, 18 Feb 2019 14:51:38 +0000 From: Harman Kalra To: "david.hunt@intel.com" , "ferruh.yigit@linux.intel.com" CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , Harman Kalra Thread-Topic: [PATCH v2 2/2] distributor: imposing additional check on no of workers Thread-Index: AQHUx5lzyLRehXTDzkCJCdcMl2HZgQ== Date: Mon, 18 Feb 2019 14:51:38 +0000 Message-ID: <1550501471-4196-2-git-send-email-hkalra@marvell.com> References: <51f4c084-077c-0417-e242-c45d9ea4ffa2@linux.intel.com> <1550501471-4196-1-git-send-email-hkalra@marvell.com> In-Reply-To: <1550501471-4196-1-git-send-email-hkalra@marvell.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::27) To BL0PR18MB2226.namprd18.prod.outlook.com (2603:10b6:207:42::30) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 503d9197-b82a-419f-366f-08d695b095d1 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BL0PR18MB2196; x-ms-traffictypediagnostic: BL0PR18MB2196: x-microsoft-exchange-diagnostics: 1; BL0PR18MB2196; 20:M1FJegwinJZJC2KNFYPD3p+d/KQd3qTyveRqYw8ovq1RvBk7CuooUzDosIZrzCepUTc891zVRz2XqqiJ2OjZ/q3vHPzzgqRSAEqyKwu59dqdSRvXDz/hZMTCM7yvr9AIZDyIABxrWYaU358EZwUuFptHOMYYrje+wjCBZjg75SA= x-microsoft-antispam-prvs: x-forefront-prvs: 09525C61DB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(136003)(366004)(39850400004)(199004)(189003)(53936002)(486006)(102836004)(305945005)(66066001)(476003)(55236004)(107886003)(97736004)(6506007)(386003)(8936002)(316002)(478600001)(3846002)(6116002)(26005)(105586002)(50226002)(2501003)(446003)(8676002)(81166006)(81156014)(52116002)(99286004)(76176011)(86362001)(11346002)(14454004)(7736002)(2616005)(110136005)(54906003)(106356001)(186003)(2906002)(4326008)(5660300002)(6512007)(6436002)(6486002)(36756003)(68736007)(71190400001)(71200400001)(14444005)(256004)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR18MB2196; H:BL0PR18MB2226.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: IeKnnyB37M2lTr/D3nNKiKAO1l6l3EQadoS9nlyGzKMd1TocbOeLvrxxZDsUr6VcN1l1FMqx3o5oF/ncmp9RnVk/PD7WDeFtvlg9FB47xb+HX6RBmyGTgs6B0WPZfTWYbS14wp4XomZbOETFSaENOm8q2BqyfYazfrCzdYTME9nsxH/IxclzLxLuGXsDJVARgSjUFVl5MLOgN9meGfocednP3tM3qhiz22h51EIwjny/MtqPQufWrmt9eyZpnUUBYgscZ4xiB2l+E8xidIt9EqH/IsOZcHdHD9Ve9X0zopxagOEWf7O41jzJied1P8g0qnDZy2w+ijKYMVZIxOFu/vZgXpsfYItTValcKYVndVDMBHv50ocnQCitKbGWyiOV+jeFxEUdigu0ZfBO9zQWebRwEQ0aoCgegtL/spljGz4= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 503d9197-b82a-419f-366f-08d695b095d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Feb 2019 14:51:36.4521 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR18MB2196 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-18_11:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=890 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902180111 Subject: [dpdk-dev] [PATCH v2 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: Mon, 18 Feb 2019 14:51:46 -0000 no of workers should never exceed RTE_MAX_LCORE Signed-off-by: Harman Kalra --- lib/librte_distributor/rte_distributor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distribu= tor/rte_distributor.c index d50598377..043b8f3ae 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -595,6 +595,12 @@ rte_distributor_create_v1705(const char *name, 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 @@ rte_distributor_create_v1705(const char *name, 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 2.18.0