From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0072.outbound.protection.outlook.com [104.47.41.72]) by dpdk.org (Postfix) with ESMTP id 50A7D11F5 for ; Tue, 29 Aug 2017 13:00:32 +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=2pY9P6My5rgvGMxDhh6sH2mAedmQgmklu7mZORrwT3w=; b=axKmDgVo5vLgCoeTCNtBCGlFh8yGtTbcjVGz88o+hpzfysRMujkK5tHfJk351Ky9DcsaeNOwE0rmXCfSSETt530J0OrUH+fRUbMVMVZBlEDmiUr26/WOlc19xG9LEutqHMZZw5LEwNA+CLW4pRGpxcPRHBx90BqERiurfqAPnrA= 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.1385.9; Tue, 29 Aug 2017 11:00:27 +0000 From: Pavan Nikhilesh To: harry.van.haaren@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 29 Aug 2017 16:30:05 +0530 Message-Id: <1504004405-22532-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: BMXPR01CA0012.INDPRD01.PROD.OUTLOOK.COM (10.174.214.150) To BN6PR07MB3458.namprd07.prod.outlook.com (10.161.153.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e2b772ec-624a-499f-7411-08d4eecd2932 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:qCW0e04qcg6ukTCU9F+ti3d89cMVJYR8SYS1ES3FnsamCjKJGG7TXXLu5h1SjU4FOv44uvJFJOpHB/JF8/3n48LKxKBhNi+BOJaqTrR6zxyBaxtNC70dPUxgb8vNGvGv3n8NfNfvVUhD4lHbwzDaQbMSA4Jjvz9nlWPSMqW+yBmC5p6uYl5zxU+SF7yERisuYOYIAU8Hg2BHfyKYWktKTDFiJfmtMNgbR/umYg+dSsL2imt0sYoTilMUACjSJGHR; 25:IqO6sVi4lKG/7r7gBFH+nAvFZSsn5traulSPrWEEToz9pMQvnWIMp0LBGPfFWE9NgEVh4LPU7CaXJGavnxRxN6eNNXtwqTgoYqQemvICdug7BMfO5x1rv+USJ/wUoD+ji/98L2iIotz0Sxca4csYCJ37fY8OWpvF2wKfFjpj5irpodbW53qvrGzxkFNh88by/B1+LyXY/lSYw6Ia40bmRxDTrsCY+rCQmvfKyV9TEJykMMMdVOTmNvabxFvgxfxb7n/SuKExcEg25AoqPk880F6EyCA9HsDLDn4Fzw4LOocfu9YXtcDlV+Uun8hbcf2GtMxUpSJvAmYDvX4yCekW4w==; 31:OAVzQa5S6o+5Zxi2bOqgQtBgpJDFHIMuU2s/+9gKvlHJo3gQbVH4NFy4FurCkcxiMyWAIA6svxbqV0OHk5Q2amUSJf2dZDVuvujTVQb4j4exN396JmeRW6jo7cqd/drQGH0aRvASX027Ovw4MYBs/00vyL4QnBr9mNUcLM3wYAYnItmsBr7ic6CoMRsvQnerqli7m5bVnVOiznMQOLH1OS68SxVkw9Hz868D54lv+hM= X-MS-TrafficTypeDiagnostic: BN6PR07MB3458: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3458; 20:l6QKud79Jgsia3w7nETjTflqKoD0u/TviqwU5yEpj5Jbmv4/tzf136IAWwTn46V+UVqZWqbMATUWhx6iVlaBThYG9qYqtq+ry96au2UFpbgZ3lEccwa7vbmn8uVh9cOErTx7srsiILybyxAsQU4jMbXcpVkpOrTPu1+ETLd5tjWjBDHMbdjFtajx96bceGm9ee+juExCMMXPZMaeIFoODbjHAGaAoHejyRNC49DenGTzcjQr0BLz+IMNcqeoyUFYJnnmSHn39WgenBRdAhWDb0RFASVkDN5W+iB0eJbeP+HrODqu2OIlJIzYOUEXg2b9Dpt1MLnom8s9wylu/nOqiRhELF4RQuY3fy43TdeaH7iGKuLjRsZQZ25hnSyQ7qqGlQtXN+plC8O4e0WBZrrniEURh5BdyKtEfbUln3S1abO/SichknlhQOZxT8GMNUxr4q6+KO0+Rrkm23zwF2D0bw8BFqt5GOqg0A9Gjd5TSm67aQDqn4NsAugQ/2cjL9DBEVSFQ2AW4PAtkJztXXAtWQcc3XZFcKMHPAnnkLfCIc8u4l1MGFuk+s+1DHghcixc3d5XHfRhbO+LIkhZAHNzuUVqGklwY/oZsgqFrYkdoU4=; 4:hi7cpROKqPX1checRPkGsfUPjtxlovm48dc4CL8gGLxrbvd/vyR96cx7+J5sAM+Slb9jxaoOwslIWN9dfoQESkOBLgSWwEh9tzALPMiG3j993MkGTaBBqf3Xg0tDSw7kP2o2TXtbPbV96mbOU4mDDoinR2bRgI6cXxR0zQf5ButJesU9NaiQfyxG8AbA/wS9vYHpM9HtvBAVXc4vI+bTuxe7v6crhuFybIPeyYRz/1YJWvD78PQseoBhedqXgIIj 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)(8121501046)(5005006)(93006095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123560025)(20161123558100)(20161123555025)(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: 0414DF926F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(199003)(189002)(110136004)(50226002)(4326008)(2351001)(36756003)(2361001)(50466002)(2906002)(8676002)(97736004)(81156014)(107886003)(81166006)(5003940100001)(50986999)(189998001)(53936002)(25786009)(6512007)(5660300001)(7736002)(6666003)(6916009)(42882006)(101416001)(6506006)(305945005)(33646002)(47776003)(68736007)(66066001)(5009440100003)(3846002)(105586002)(106356001)(6116002)(48376002)(53416004)(7350300001)(6486002)(42186005)(72206003)(69596002)(478600001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3458; H:PBHAGAVATULA-LT.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; BN6PR07MB3458; 23:9/iQ/a9UEYZ5sqP6TVcupD1RBAyJYUqejBmHitjIe?= =?us-ascii?Q?iJmq0Eqr3eKeTQNo0CoT6LZDummXiWY45m+nnJnYB0Q2VSrfmZc6gRDkkofT?= =?us-ascii?Q?lnwdPrRWkHxslMPJAKHeEqm0PNih/zVXfJQSb5vCo7LEm6ewBoTVGAGEnMmr?= =?us-ascii?Q?Vg8VFuhZfBpP5oTkIfpH0qIjR238x4FfdJD/Rw6D1IROiMepFvCmLnb8SiE/?= =?us-ascii?Q?cbKPEQnWW7VXV0tHO54lQNPqsuPtXgqNDb8HTQzrCNEkN0GfgSm1L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aWHiU2MN2A+GCTtrU3v7eCpYiRf0jd7pO6YQlN?= =?us-ascii?Q?g70O3OhywlA8orKBi+7lcvRwEYaYd6N0XSz?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3458; 6:ffMfdVRj3s25QCRHO1g3SIx4oQzHlwfkXCWoty9fyU5VMclqKl9OmHGlsGzJf47VAO01VMNjo7G4//6frUQTzbhp0u4syEnU+APYrWE3gO64H1FVvD5V1RNlojUk6LoOdn1Gk/4pV1hS07j38QTE15Wicsk1foNO8cBKERiBNRawa/+6/eqvk3aPWsSHVI70ptSpPubY6CH5U8fXSRa9KnGWARE1/J+rIrxdgC4XFqHKL3QPmdcB6JfwgiVhM+S+Lo/jWqxW0yNmsWzuitvrqCEmetsQTJ+I07Wdst+aLDnQRaMpCAGpq39qaeuYDOMMDaQw+CNP3ZTs9R+u81X87A==; 5:4+n5VZ8Do6LKqVqhXymSSyrbxotua/BeuI7y6Irgkofh6XXLrWN35FsjH4rlxmrlqelUMsplYLhxZ7O+ih2lE0tcLtoO3mgwmvg32CvyQRp1oD3rneIdnptEl4aKKllgO4UWKiA+aMVJ5bynyWlFcg==; 24:BGjuRAidFYHSEtGqpLOYBTQBwIohgYNDqHLQ9DI3W1OZ5lUtjvJ34vejVflWx4mdi0RiYdKT9ARmHCIBYY5qgP08f8Z011VZWTjIQ1y5GZw=; 7:Xx5/1MnBHpu4mGUdJvfohNyEz1lr37dOUAltB/ug0rgZQqcYzrcnklF2kvMWN9Tqq2ZiLbGcT6/0BOD4lbAvygRsfPItNXMq8YeFE+yl6/v3gyniROpY+jVuPFQzpkc0bQ8SnVJjidIip/uXZIegpBPo3CnG3SqCUxKXscSQNMSzEpB/lpupSiW8gF4s6+JCH6ybbfpn4oyOhMqakWBaB73z1rjjUYoi4Vr6kJKXsY8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2017 11:00:27.9211 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3458 Subject: [dpdk-dev] [PATCH v3] service: add API for service count per lcore 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, 29 Aug 2017 11:00:32 -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 --- v3 changes: - fix compilation issues with .map files v2 changes: - reword the commit title according to the check-git-log.sh - modify return types - add function to .map file lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/include/rte_service.h | 13 +++++++++++++ lib/librte_eal/common/rte_service.c | 13 +++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 4 files changed, 28 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index aac6fd7..79e7d31 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -222,6 +222,7 @@ EXPERIMENTAL { rte_service_is_running; rte_service_lcore_add; rte_service_lcore_count; + rte_service_lcore_count_services; rte_service_lcore_del; rte_service_lcore_list; rte_service_lcore_reset_all; diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h index 7c6f738..9537ae5 100644 --- a/lib/librte_eal/common/include/rte_service.h +++ b/lib/librte_eal/common/include/rte_service.h @@ -374,6 +374,19 @@ 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 Invalid lcore provided + * @retval -ENOTSUP 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..616bad3 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -397,6 +397,19 @@ rte_service_lcore_list(uint32_t array[], uint32_t n) } int32_t +rte_service_lcore_count_services(uint32_t lcore) +{ + if (lcore >= RTE_MAX_LCORE) + return -EINVAL; + + struct core_state *cs = &lcore_states[lcore]; + if (!cs->is_service_core) + return -ENOTSUP; + + 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 diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 3a8f154..468c706 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -227,6 +227,7 @@ EXPERIMENTAL { rte_service_is_running; rte_service_lcore_add; rte_service_lcore_count; + rte_service_lcore_count_services; rte_service_lcore_del; rte_service_lcore_list; rte_service_lcore_reset_all; -- 2.7.4