From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0069.outbound.protection.outlook.com [104.47.42.69]) by dpdk.org (Postfix) with ESMTP id 589B17D42 for ; Wed, 23 Aug 2017 13:17:39 +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=/6jRkTDpd1DOiNGunsQE9YaAig55iW8OjUZffeTPCaM=; b=mRQu9suCvueq1HtrcHEeLKrxb2OULzfwehCrsDF44hbHBOJWrLze5+s1oA/fzGTLCXXw8iDArA2p1oRZv5i2PwhL48Ot6pHEyqRmm7VyZYmcicBGKT0F06wPOBsOUJhJdwc95xOWz5l6yeObFkoPeokLckhGW/LfGUQfnwuxqhU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by BN6PR07MB3458.namprd07.prod.outlook.com (10.161.153.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.18; Wed, 23 Aug 2017 11:17:36 +0000 From: Pavan Nikhilesh To: harry.van.haaren@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Wed, 23 Aug 2017 16:46:52 +0530 Message-Id: <1503487012-20247-1-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0095.INDPRD01.PROD.OUTLOOK.COM (10.174.208.11) To BN6PR07MB3458.namprd07.prod.outlook.com (10.161.153.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b16b00b3-19ab-4def-91b0-08d4ea188faf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3458; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3458; 3:waPq6UgN1SveTRBkNQb6A1g5IbCVvky51KXSyRZ5DDnkcwgJYCLLY8jO+gSwzeu5L2Wyn0Sv2fQmqildq7+HGrhiR3a0B2vHcbbwmF/DareZZ2nJpU0QtJi/0cu/ViW7KgfGK57k+oD+AtasVT0c4qP8Pp+41A2lhPtDTfit3uvWvTVqRHJMr2wufcYnHvdxLd3TmzSgzycTwaJ0CGJDAkUpX+yx7qqku6ntHMZszqf4GUEg+ZNT8MlndaLWpQCg; 25:+lPqnPFgrHQEbP5SRqM92RSoC2p97NT9QDIPyXphRJ32oeTCHQnBixG6RuhzWa2TWURisgRvRcE4aiaci77+GNY2yQhPyKtIYAbH6aCRjVCvrxlQIVqQfFm0riH3w9r6zfTfyWelCwvUHPEa7MsPi0fj/tBzWOkKBW2Su3Bl6SPuFX6rTv0t/0q/3BHBLgdqdcaTH+A5ueH0nyyrJmoosg7+PrrlxydKopmzMdyQiAIUFThTS/6/0FXUcj7p5FzZ2Xs2ABAaTXe+PMcgSZPlfaeq1h3Vov6V/11H442NhLcE54lDUim3cGhvwOrRwRJqUO29sjdx1AXervKicoAVHg==; 31:ojuxYNqFejbrlHru4RtniA7SEhlJYpe0rleLFh1CVyCUq01g0V7c11uMqdwWCogKlWkdso4rTn44Su+edJyJRV2EIXzZRd2HYn/AZ4PFStZTKHGt0QlR/Yi1j6BFqG/3LBC1c1ruV8yCvj2wgv3+dy/oUdepw7pihK/ZRa70cwqnw1Gzhed7UUCqO4bj+EhQGovrJ8BrtQM3X1BgQbbaHeWVr9r6RD+QG94UNvb9eZ0= X-MS-TrafficTypeDiagnostic: BN6PR07MB3458: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3458; 20:RcJ/2e1wR1ldlyryDyuKOPs5H+6MtaIwx103TIw00pfQWd85XeFve301uVS3+oZ9o2dy4U+DRZwmEfz0PsXGTdzdmK+Q3GEeZ5tz9+kQq2e1n4XnjKRAeBrBSa+cKR3qLDMelg+XbmR+uQ3RqN/HcKGmQVoRouKHMo4/GCKX2tOCK9B83wWFN73Iapuyf4sep7Fe3+XnskY9gfyXv03atYiNCL5uWKA+d3OYBquZYzmTR4qG4AY0wdrmCKOFG3O4NNsKtjCErr3h4XEadztaFT+ET7lrdLGhpR4I9pUNPlAxrHsXuWRwNGVHIjEwOzjWTnjivBEcqH9B/LpSG/C9xSa7DjM/+mg9CTRmsPqChfNMZBtpNgfxFeI4DXUobgliDfh9eD8+2ypJ0/I6PGf5oaq+bjTdiEwMyCVd0H64jTZmn8Wt/AuX2bl8H+dyO901SSwi4vaKfuhzeawiis1Ol+uppmITDMwKghuorMv2/rU7t463+CWu5vQCaMX/LPUds2FN6ejieoLkVPMtSx312Rhl/XDWRMXg43pNfbtFWNtuFXelX8yBwr+b65Lt3hqldRIG7NIhhu8/wUT3OxNluqKIaqF3Ka8R1r+GmKHEOUI=; 4:Xptl+oZvVi21aLX+pajqHm1SEOlxmMGW6hDwX8MWVqpUMmrasYHrJ++YiXJMD3Xab81GTq/XpcHLrRryh5hpFYMZ0LTeFv1Q7YwoR696q9YkUYhelwtZU40UU5dobY63ya1YPH6kPiMfY6KJTyBaxPJza4XpbXH3EaAy7z7VCwFDNszx/6vs+27tmE3P1NbKe5ZcQ5KjJQoYhEnAzOCRMGNTg6GiL+Pbnx7wkPM1OospHZmLsUaiRO22lKrmcdEt 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)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3458; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3458; X-Forefront-PRVS: 040866B734 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(189002)(199003)(50466002)(48376002)(3846002)(33646002)(6916009)(42186005)(5003940100001)(25786009)(6116002)(42882006)(105586002)(4326008)(68736007)(36756003)(110136004)(53416004)(97736004)(50986999)(66066001)(107886003)(72206003)(53936002)(106356001)(2361001)(6512007)(47776003)(6666003)(5009440100003)(2351001)(101416001)(305945005)(7736002)(2906002)(478600001)(7350300001)(81166006)(81156014)(6486002)(189998001)(5660300001)(8676002)(50226002)(69596002)(6506006)(81973001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3458; H:PBHAGAVATULA-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; BN6PR07MB3458; 23:TeZDhxKh8DJHsKEQB6OuYIh8nlae+Kv+fd1QTqxiL?= =?us-ascii?Q?5g5JbgahH3Tfr0ESUaZnI5ytUbPqPix+Q6WGIWXr2wwQnVjaqzw50lEeYApQ?= =?us-ascii?Q?MErpEQOnhE4Ts/GKffiek6ExfCZXhzaQyx3uEjELLB12S7XcxAEFJcLIwkM9?= =?us-ascii?Q?m4gtK87KyRpklHdE9lcb6s/JUsEDjCDJTnw6hDjvgdkhW4zOapa6AiKnUonH?= =?us-ascii?Q?z1+jjIRLaCLbaZxB1BSeQUhPP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1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2017 11:17:36.5126 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3458 Subject: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API 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, 23 Aug 2017 11:17:40 -0000 This new API returns the number of services that are running on a specific service core. It allows an application to decide which service core to run a new service on. Signed-off-by: Pavan Nikhilesh --- lib/librte_eal/common/include/rte_service.h | 12 ++++++++++++ lib/librte_eal/common/rte_service.c | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h index 7c6f738..5f0904f 100644 --- a/lib/librte_eal/common/include/rte_service.h +++ b/lib/librte_eal/common/include/rte_service.h @@ -374,6 +374,18 @@ int32_t rte_service_lcore_list(uint32_t array[], uint32_t n); * @warning * @b EXPERIMENTAL: this API may change without prior notice * + * Get the numer of services running on the supplied lcore. + * + * @param Lcore Id of the service core. + * @retval >=0 Number of services registered to this core. + * @retval -EINVAL The provided lcore is not a service core. + */ +int32_t rte_service_lcore_count_services(uint32_t lcore); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * * Dumps any information available about the service. If service is NULL, * dumps info for all services. */ diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index 7efb76d..ddaed22 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -397,6 +397,17 @@ rte_service_lcore_list(uint32_t array[], uint32_t n) } int32_t +rte_service_lcore_count_services(uint32_t lcore) +{ + struct core_state *cs = &lcore_states[lcore]; + + if (!cs->is_service_core) + return -EINVAL; + + return __builtin_popcountll(cs->service_mask); +} + +int32_t rte_service_start_with_defaults(void) { /* create a default mapping from cores to services, then start the -- 2.7.4