From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0057.outbound.protection.outlook.com [104.47.34.57]) by dpdk.org (Postfix) with ESMTP id D6BB22BA4 for ; Wed, 6 Sep 2017 09:16:04 +0200 (CEST) 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=wf02CE9tvAposeWjlWe+j4E9QiAXzH8wZ4RixmiC97k=; b=N+XScoK65e0LBHlfJLaM6MTSo7TwLBBgUieuL/gfOTBeYZBQV1in6X/z9MnAiYvsJuLfj4DTUahgQgTYgQ6TByGaoMlaCjTHgN8qCXz7eaOKJSl0u4HdkPND89G1aUOgb6nD7M1blDs9S0ZAdH2V8gNpCXrUjirN+gD83CcIr6o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Guduri.Prathyusha@cavium.com; Received: from prathyusha-Precision-Tower-5810.caveonetworks.com (111.93.218.67) by CY1PR0701MB2106.namprd07.prod.outlook.com (10.163.142.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Wed, 6 Sep 2017 07:16:01 +0000 From: Guduri Prathyusha To: harry.van.haaren@intel.com Cc: dev@dpdk.org, Guduri Prathyusha Date: Wed, 6 Sep 2017 12:45:41 +0530 Message-Id: <20170906071541.1922-1-gprathyusha@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BMXPR01CA0028.INDPRD01.PROD.OUTLOOK.COM (10.174.214.14) To CY1PR0701MB2106.namprd07.prod.outlook.com (10.163.142.156) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68384eb8-db74-4e61-921e-08d4f4f721f9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY1PR0701MB2106; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2106; 3:GbVHXz3azIyK911nTnzn6cqkXa3hERdM4YGv8LSVyn+lJXAb2JtdxO70bZ3YO6hPKOljZYDMQVLgay2IO6Hg6hskNZco17NCpe8ZPica/A0LhI4CNTHGTwjNIzk5sDORLFwW0INNjSoYEL/9SXCajxUL2mTaHTsLX5FBryXjh74mHDboy2GB9GS9pAr3f6CeHGgkpIX0gSX51AayLFSi+KU2BnRDWzw0c7zzMVt2U8PeCr2WVSQbXiwMs/WL25c+; 25:4UVcsp4jka2IiwbZSLP7OnQZ4FQUiSJy9ypT3blo3602sH8pTAB+fbNAK5oGBl/9KT9lYFgOUX/MWBYpIqXftgC3H4MSUyf4vL/RTqbdA6svG6VEwLI7svFNeFJlEykcHD6wvtvSr8FddUtYri1D46N88h2VIMepLuweICzP5ObnjmsU5gBkwBSDArQgKLjST4cyXKhmzA9fmPIHoeOSwDRIg810AgCCTZLA1q0DvuOCihCX7pbJxH0o/oTAMO84dl985pZSkzNs8nFfVOJpd2BDiOYGzQ9X2HAqiSLyZdXEbDnBrukdH74L27JS00qV+ArN56nZ6FOvKw6U8RmApg==; 31:XQLRVnt/aQC2+wBlFxxVX9fvjuoSU+2YFU7VOfzDpGi+qpFpg5YHm+yRz8BhHiWoLcs2QWU3+bqqmvwz49O7hOUH1IZdUDhXVqkFeOt8D9CH7w6exe8dO/vxI5aRZIUXRoxp2LD3jFaczDxMoXMMnPxJa5J3C0OgS6h1X878JaE/KkfcfqnKbS8D9/dR59Z8AJ2Y4kgyFI/X1SluFHcvauPLlhPv/t9Csm1LjKMHCLY= X-MS-TrafficTypeDiagnostic: CY1PR0701MB2106: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2106; 20:y55zAAUi44FsD1Tshx+fXJzokrpfSDveX3AZQ0JNyPjhYxugPvxDzCRbH4BOMuJRyUKr9jaWMpVbKZzrLuICcMNqgMn9FOBGKQVpRwOg+muyZbCdYRrj/mqYy79yDIupV6drBeakib2OP2dN056ma8Hsz9RKlK55czVKDKkmlOho7ucFjM7O8uk9U47g2J483sGYQDwxCRZBTvmliaO9EoFH4ktH1GESYiLTrnxvCWyDKa7HyoZT6sRCBAfAD0URWh5INwFYerKHH+/laiWKCwCpWIzMyReO5o39KtuO3RfLCZAqoJg9N6l1E/a/Y6fdOSfydfHifZdSrygCghvn03GHHsAOcJdgsqt2K5a8FybHYljI/ib4pTVhptHYpiJAzpNcENRa+jcIpkxHRdB4lXm9bXGODMIFZR6HC4Xu/Uhu//qBfHxoCqRkyKNmv3lUh/1fN4PsVkH/XRLqWGGeX/7gRmhQu8DUNfKRDRuc20TEHBKzwV7LS56cb1x4pwF2LMWhKTGefboVOXVOTZ76Dv7W5VrPQw8X2CphoaV+CohY/ENQNiyZpdsqY1W4UADUkP/G19y1ntpe5CwUYIM0mg+jVvJeAeOyxICQS1/gtlE=; 4:6fM+X892fTfPim5GZCBXUu0YR8L324QmXLDyg4bEe3sq3+qTx5wfqgS9bDnacEMU7gGcYqY9zd21q9/yyCY7QLCsrdVFIFDJV2uLZ/YMvmZlnhNAelLb34kLHYkurqDvZvWYuBu0VxgLjcXZ2fxlESTGcCmM3GOwQRHNMRK1hrm+qnQT78CuhTrjNM/wiZq7Im11QtQBdm3PLpvkh+SHovupcwUQAjbxrbUIyv/bStm6f18z8NnJ/tm4zNjGavnn X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123560025)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR0701MB2106; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR0701MB2106; X-Forefront-PRVS: 0422860ED4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(6506006)(50986999)(6916009)(966005)(1076002)(6116002)(50226002)(101416001)(42882006)(6486002)(36756003)(575784001)(3846002)(6666003)(2906002)(478600001)(66066001)(53936002)(2361001)(72206003)(53416004)(5003940100001)(105586002)(189998001)(25786009)(305945005)(107886003)(50466002)(69596002)(97736004)(47776003)(7736002)(2351001)(33646002)(4326008)(106356001)(110136004)(5009440100003)(48376002)(6512007)(68736007)(81166006)(42186005)(53376002)(81156014)(8676002)(8936002)(5660300001)(6306002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB2106; H:prathyusha-Precision-Tower-5810.caveonetworks.com; 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; CY1PR0701MB2106; 23:d4cq/P2Q+JZtCcy4Fm0ef//8aTvxGakMSd9OpGd?= =?us-ascii?Q?BqS4qaYnr0DgcoIkpA6cUxerZ/VI1sXsHwj5fdF0bGRWYQwbV2p5RYiIxMsE?= =?us-ascii?Q?OM6ArJ2zordzTDh4lJj7mvDfV8fEGc7fsJm5LNE3XcCsVFE4lL2ORLn//FxM?= =?us-ascii?Q?fsYI9lqDssnIJxr7OpPFhxhRzMzonfa6ajSzvUJzYjV5Oj7sdExSanRzwE85?= =?us-ascii?Q?3QeATF3YWp6RagR6E8b0tgqb+3Gh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Metadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2017 07:16:01.6122 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB2106 Subject: [dpdk-dev] [PATCH v2] service: fix service lcore stop function 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: Wed, 06 Sep 2017 07:16:05 -0000 lcore_states store the state of the lcore. Fixing the invalid dereference of lcore_states with service number Unit test case service_lcore_start_stop fails with the above fix. Service core was stopped without stopping the service. This commit fixes the test by adding negative and positive cases of stopping the service lcore before and after stopping the service respectively Fixes: 21698354c832 ("service: introduce service cores concept") Fixes: f038a81e1c56 ("service: add unit tests") Signed-off-by: Guduri Prathyusha --- This patch is based on [1] v2 changes: - Combined Patch 1/2 and 2/2 of v1 - Rebased to the future service core patches [1] [1] http://dpdk.org/dev/patchwork/patch/27684/ --- lib/librte_eal/common/rte_service.c | 4 ++-- test/test/test_service_cores.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index e7ed597d2..ae9a5263a 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -612,9 +612,9 @@ rte_service_lcore_stop(uint32_t lcore) return -EALREADY; uint32_t i; + uint64_t service_mask = lcore_states[lcore].service_mask; for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { - int32_t enabled = - lcore_states[i].service_mask & (UINT64_C(1) << i); + int32_t enabled = service_mask & (UINT64_C(1) << i); int32_t service_running = rte_service_runstate_get(i); int32_t only_core = rte_services[i].num_mapped_cores == 1; diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c index ddea7f0ba..ee8313ef6 100644 --- a/test/test/test_service_cores.c +++ b/test/test/test_service_cores.c @@ -576,6 +576,10 @@ service_lcore_start_stop(void) "Service core expected to poll service but it didn't"); /* core stop */ + TEST_ASSERT_EQUAL(-EBUSY, rte_service_lcore_stop(slcore_id), + "Service core running a service should return -EBUSY"); + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), + "Stopping valid service failed"); TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_stop(100000), "Invalid Service core stop should return -EINVAL"); TEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id), -- 2.14.1