From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0052.outbound.protection.outlook.com [104.47.36.52]) by dpdk.org (Postfix) with ESMTP id 5A5441B1A9; Tue, 9 Jan 2018 10:41:43 +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; bh=Dzvmv8ZiWzeQbn/ydVROQf6SE9uPRAMY5PdRo5f2BxY=; b=S/lhR6WaEzeMaA0rbz98tl3NLs0Lsmghtl/R9GxNsY6Y+m6ufvzKdI6z9pGpfnf5tK7lS0/Wz4tYx3TIn52QQhRi1Re5Kf0agjxWTheYPX1NQXhq8ZXAomANjeH+k38fcMLreT7gNs0zpfS8BNfSqvuXWYS8z81DqX6iOYrDNzk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (103.16.71.47) by CY4PR07MB3464.namprd07.prod.outlook.com (10.171.252.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Tue, 9 Jan 2018 09:41:40 +0000 From: Pavan Nikhilesh To: harry.van.haaren@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh , stable@dpdk.org Date: Tue, 9 Jan 2018 15:10:41 +0530 Message-Id: <20180109094041.5148-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [103.16.71.47] X-ClientProxiedBy: SG2PR0601CA0003.apcprd06.prod.outlook.com (10.170.128.13) To CY4PR07MB3464.namprd07.prod.outlook.com (10.171.252.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7ec4bfa4-cff1-4e10-eaa3-08d55745302d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY4PR07MB3464; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3464; 3:ot+AJL3On8D7HvSUdJNjc0fxU0xEd0vox2Pr9KmzGvBLUs/7YB2n0UlJNQp2SgprtKkCj2+DMRXAd8j8/BjvaTCb1wQaj7UbRE61GxwPJzNjwj66PqZOG5g5M75s7CTUCHkQRCPImRucodpPXvowLTvE1plJy1qukRf64pg7VTSXgyU2MI+OHl92F1Gm7z4hE46yukO13iJcCy2iXDeW0CAsKPWywnCYGiIBXszoMfZxAaNy+8kFxS7sPPVPWieG; 25:XPDXuR61y5LI4YGsRBY+WB8Y/E/025kRImEnAHcCv+jHFrSTKIK6faOeEkxuxHZiyfWMNJL4IPqJMYKpAt+SOQWWUUwyor+e3KaFBegcvfmC1OQQ0oj8/eMkICRUs5Lei51KCNQ7pB0v7tAaKh7ZhX/iBH/KEVle3qdZ/bPxrel4VqnSF04rCugTaFpHmcv4uf+hOxg0MSEBtRA/Vdq5SafMaebmZWrJslPTcqP9jNuV/O520LfcMPIt3IJd3onIPDFs0Vc68ylTd8NNX2fpHjPfdUjwczu0xFR3xlzN+1VclQ+2KqtQTd2esTw9DaaGCzr67zlWDdUcbU8orFkLOQ==; 31:c1OY3Lueo/H99FDlDF3iZYzpP0xOIyYW9KzRA+XhZblq4HrcjHoVW0w/KQy/VwX8mXOI2cFFhoiIG1vJxvDvhjhUDb2sFV6UyAjKwEacyckrcX8qH3cmYAjolrgLtWFxsKupZRZtsUKnqU46we7yDql5rLmxQ/utMx9opMDCPIYzhmd76/gI492GaNdw+AaYap+zyB4gsB5SGMQfU7qkoa2bEhIHJJDo0dtBFEBWoqI= X-MS-TrafficTypeDiagnostic: CY4PR07MB3464: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3464; 20:yXDnluJDECkXPucTpBPkvw3cQENQnAixwByrLuacW9ACogiivOn4OH9IRWmilRTAt9WaB0QEet3LISGLiHvtPBhq6kQxHkmBYHI2p0S17DU1Mzv9XidtA+JVLoHcCFZuArHdvQ83Qc/UYcRBEiF86ObZ77MzIi8NKppy5xz9ZPRP3SUa8f+G05Hvkq6C2ZFPH7fXPG3ZiVGBHSbFW6L9yBRLcoT3T0BGyeYF74edaH78VQMnMghCylaj4EWH/l8oHSwhvU2DzxG6vBQwu0RLkk/AxBc2OKYM1RMDIjrs67Osi8HnZpSv0fEjaLkLXIDaAQPhA4WskqvEkaFWGvCB3Dlh/qMfT4Pqs6Tdxly3doFctQ4KaHtNW/fxgPXKfTFq/CUgBe1dG675P3S6InUcRwVm2Yupm6tfsAIbL/NYxkxrP8906hDfC3yDv8nci34IXqJMwSKrG9H8Zkdknb8FEPRh89SUqaqqpMsAJjUpvzI/evdIi8i8RhtYie6gWRQjo8byYnxc3GaxkdMoIUrEngUHJDsvhi4QrEasQgXQoP4OBQBf5MW8Ia18Ejb1Tj6klF0v+U/OeHPMy4ahlPSJjSNwfhH9Y2tKGoaAKFJ0Ew8=; 4:2M+Hem0EwHbtmyK+2h+GN1LUOcTCGwnXXZuv9gy0ztpE3qHPWYSAPX6XZStu69dcdLYWrBbRK3bVTWRI/GkCqCkyx4SHgiVDff6M8Nmv9+/Nn/lHxIC+BHOCNev1SRPKNnLxoDWQwrzTyCHw4okg933RqCEGhBeLucL8BuB24OPsDS0bjMMRWPIXVOHtPyAKNrViPubdhaOWISllrmu19Os06rH2uZTKT8+8+KAcgXZCSh3b+TM7wfYd+gwcyVGDhsSv/PhEQ811+J7nnsAhVg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(3231023)(944501075)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:CY4PR07MB3464; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR07MB3464; X-Forefront-PRVS: 0547116B72 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(376002)(366004)(39380400002)(346002)(39860400002)(199004)(189003)(52116002)(48376002)(81166006)(2361001)(305945005)(2351001)(6916009)(8936002)(7736002)(106356001)(42882006)(6512007)(3846002)(81156014)(50466002)(105586002)(5660300001)(478600001)(4326008)(68736007)(6116002)(36756003)(16526018)(72206003)(1076002)(53936002)(6506007)(386003)(97736004)(2906002)(47776003)(8676002)(59450400001)(25786009)(6486002)(66066001)(50226002)(316002)(51416003)(16586007)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3464; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3464; 23:6dg2uNvb0TUPTV7IAc9Tw0/V/erwO8SNmjam3HzGn?= =?us-ascii?Q?pQG2bWkyU6koGNr5JG5HwJZXbWbMi1ChQ1JHZ59cd8aFfHhLYbG1OXw5zCdd?= =?us-ascii?Q?PFZ0xsUFhSmgGqYbd/HgAC1vad2xnGvZMQG4T9WmhduCo0DbVlb1hbfKR45W?= =?us-ascii?Q?el0KPhHkqNwt/g9sWgzt0139njt+YbqKkyL9AvIxYRzcGQj46jKFMqW09iGe?= =?us-ascii?Q?dAAAJiIUTG1LFApSI7Ajgj8ZLwZ4VDpOnd0sBwwd7TU3+oCTRuUw07tsYmNS?= =?us-ascii?Q?H0U2oAT5B4RBBRuEdvbhVCy79jz7KYzn2Ukol6OmU4mk3bgJw/qN5jKPWWdN?= =?us-ascii?Q?WvEK2IS2dFeJgXWidnmriC02+o2DK2Gzzapc8SHybO+tvdX0/97iv9biQoKd?= =?us-ascii?Q?V4tGKn7ZY0LrfgLd/pga2/AfM6GhAtf/1nlqBmqe3LlKPs+kEd+gaNbfq2/d?= =?us-ascii?Q?JskHdlluTOJIS/JpNqZCbx8wie+Vimkf9sTsGBJVwv/u+jzQRywX+t5knVUt?= =?us-ascii?Q?9pkkXAXZiM6/27zMYcIiWWf7MKaSko6B3QPCZRTjOeoOEW6P1gv9VvqKYel4?= =?us-ascii?Q?AJVd0XTd5T2imBR7tJ51XUCY2x8q2tA4qV1gdx7uAbFsM8W/b2cvnOq+0A+U?= =?us-ascii?Q?x1qxhqjV79QKodfTHqApMlCTmeLvA9YbG4JZepBjMibz9DAplueYyBSMYHwh?= =?us-ascii?Q?pPLhIiz4r4UEjSt+zkM4zxgsTRyjCjtzKPTc+MYOqMASYzNjJGTyc10KtjSd?= =?us-ascii?Q?Mi60BH+7RRBAbJCKUv6i+j2SNTrF3wpjpZGTNTfq1dgTQ1tqih1QjaOhlCer?= =?us-ascii?Q?43+Y+E7EpbkJ8U8w75gCtnyMIbAsAODm+fdbP5BHG79274K3M5tsKNZa1dSP?= =?us-ascii?Q?hvtSDI8lYJrQhryAXH7ukgfNVzvdi8IVABHqHOLwqHvq2iPYtaEm6tp+LfXB?= =?us-ascii?Q?MzlQagR1qax1bRkEMmLKxuvslf+alh/+74QSphHXK23M63vECX6KaeNQVGoX?= =?us-ascii?Q?iRxMc+tcjpuwPGd/kq6InDQ+w6883vNIW5vUomjfYd7uIjww/EdktZ830lAg?= =?us-ascii?Q?krzsw2G8wuDFTMEXe5uANHZ9NwECXW0IRFWIlRz+zZfC4TKTl0j5CGwpb8jQ?= =?us-ascii?Q?VdFEIvUTw+kTim02dfK+GT3giNR0plY?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3464; 6:1cxudqGgTlZWwquKsH81NwySjBD2sijOQckXaLqPJMkeDYTH17jV41iz/+RslSJY2Gy7wUhUs5y/CE8/a2xul0Bd4n9pvp51TPGvYQM6hATflPqXGlpuGVXl8vTBn4hz09kpzbdS4Vp4J2fgHesFLooIbtAPGN8shb2jhtt63IinF01ERpXeFlE3ehuUEpu2DQHKUzq4MNVKyqAzox4zrf1rqHiBQKb7tjJFFSmuNgeewVf1SLQVbXMstwq2zb+TbNO7UcpJK2mQuGqg+YGM9XsX1HYvU6GC9xQReksAfbK8wpxDNHERM0PbR6Dd38ex3SYZP+PsEQEjp7RtL5LCzOzCWPkVI6nkElMY2saN6/w=; 5:qHfziuy9XVOHcbGbeMwvc8mXlIlechaXopFtFm3G15rPXTqYak1TjEiibBgUF3UoEKnpXXbL8B6UaVjEmC/AVFN3NscTm2YqbhbM1z6zhdGc/WBo74lh7D3wP3JbgKqksAHkPGvLfYnvCzyXpuZ54CvqiFehPfqn5REMuA0vvck=; 24:Sq9P9GP1v3QS40X2W0fyeOgkk9wzEL4cnQgWwagiCgHeh3HC5vNqnH5+FAaSsfD2S/Rt8aFPs/KMC6UqM88pO39b9n9uo3+UK7USlkWoG0g=; 7:OuaqsNI3Yx14zzPnlDrNFwfS6FZGrE8arebYZ1nfM2AHhwsSDPBiIKGFa78l1GdwlNeMa6FwphDsP2c96G2D497k3HTwv2B7JJz9pN2K+wjAAmeRNn97d0FtFZy5LzQ2hnd8dtc9I9KBx6uI20cpxsR0LQ7/UI/C7Ibltex7ydd0Uv+jCx+IbdAZ7G1nS/jPttwC3MD7R0u79WvKJ0vRaaz2+/edE96IbZOipabxRUcx7tzTfDk3VIxGt3vYULoX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 09:41:40.1406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ec4bfa4-cff1-4e10-eaa3-08d55745302d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3464 Subject: [dpdk-dev] [PATCH] service: fix number mapped cores count 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, 09 Jan 2018 09:41:43 -0000 When adding service the number of mapped cores should only be incremented when the core is not already a service core or vice versa. Fixes: 21698354c832 ("service: introduce service cores concept") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh --- lib/librte_eal/common/rte_service.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index 2d12d0201..d9138b677 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -545,10 +545,14 @@ service_update(struct rte_service_spec *service, uint32_t lcore, uint64_t sid_mask = UINT64_C(1) << sid; if (set) { - if (*set) { + uint64_t lcore_mapped = lcore_states[lcore].service_mask & + sid_mask; + + if (*set && !lcore_mapped) { lcore_states[lcore].service_mask |= sid_mask; rte_atomic32_inc(&rte_services[sid].num_mapped_cores); - } else { + } + if (!*set && lcore_mapped) { lcore_states[lcore].service_mask &= ~(sid_mask); rte_atomic32_dec(&rte_services[sid].num_mapped_cores); } -- 2.14.1