From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0080.outbound.protection.outlook.com [104.47.34.80]) by dpdk.org (Postfix) with ESMTP id D0B2E1B162 for ; Thu, 21 Sep 2017 12:59:58 +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=nSTvB39ka8/hkv7afxb14nKlWuhEX6nqeRmTKzb/jFg=; b=agBKQUjgd6/6HrOoB9Y7A5wa51pbbxmObfyKVj/TYcfvoG8odwa/vVcd7c+1rCo8RoCc7MupwkF/7stDD0agsNRAcOEF807fTTKoUSdKZIwiyq91ruqRXmAq2pJQP+CdTWs1duaWv9/1h5x32WaVxIAnHH4IOoOfcTVRtCa5m50= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by MWHPR07MB3471.namprd07.prod.outlook.com (10.164.192.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 21 Sep 2017 10:59:55 +0000 From: Pavan Nikhilesh To: harry.van.haaren@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, Pavan Bhagavatula Date: Thu, 21 Sep 2017 16:29:17 +0530 Message-Id: <1505991557-17136-1-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505984291-18702-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1505984291-18702-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To MWHPR07MB3471.namprd07.prod.outlook.com (10.164.192.22) X-MS-Office365-Filtering-Correlation-Id: afa29b5c-ccbd-4160-b3ac-08d500dfe540 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:MWHPR07MB3471; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 3:SbQZMu9X2NRkrh1h2jo839Y7BaBiaEZZu83Twh5WGC4Q3zo6I+5Dxi9r1gwJX/uNZV/IgRmXIa3jX+CSxhLIPsFduda+Wag1p1Ytwfhom9wuCEFnMMTrqjh6OHkrqbK1a2H/VfN3F96D/iPAhj288+X5on4AG2oBXWS1GEw81nCDLFhRFBPFkxFeXjGrDpA2JH7E/229FH7Wb1gWm7IQUlllgulz7KDKJGN6Mh3FWXJOohq1FAWM+aSiWIvOXC21; 25:U3EefOUwTwBmXODJzmNIq60f8HFqbGeSBJGxG6sXsMBB04lA7ztuNlFmRUq69s1O2QFqJQiGqfZJG3oH+UGhFSXBSJbi3J9FJAGdO8wIqA2w8xbFtWan/DVBLHv902FTy78JLZQn/E4Qm1HL8hDjH2BDzEpYwH1pXdgXxt1jNw3ByfgAlNGEImN0CAQxDo56bKlY0GCtXJbDJnyj+EtDB3M90P63HT9bI/naFTM50Avbv63Ydlr/G1S+H4Id/obHbauKxjhNW1mfSFYC6kGbZJwR6R972o6bH+NQgNqkL2W/TzWSbVOP3S2tPnMXvUzKLkOMTaowCIphfciP9iIbSA==; 31:2W4KuLYCE1E3kU/5Cf1pGtAQ/F6pnRuoJrQdZzlfvXc+miowd6reKGfk0mTQRa0HpqA9x8K+pbE6J0ZAWOP96KtSwhQ6lg41pPbOfSxTsa/1NSUCOZrIRkRPMBhvRLxVowg0CHul0MyYM2qk+mm5k4mxVzOOcg69FkO4YLAB5ACuWQ0Dkh3rtRb/gcn2PozAUmAaHmo//PLj4+IwCukLAvuieXn3Naf3yI8i2KDY2SY= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR07MB3471: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 20:UyjmIfhomQ7aLjvKwDCrl61ZlFUuNaVUa3dw5MDUW2YwJHUtsTtH8XCMNX3JLNgSxTxIJNoSHiur1b+1qYlmpTWDEexoawbAr6tzFDM+AsvvVs02xhaPY8gU4X9Vz59nJp6N3XkpSW957H2nwLjyppD7mZ0HS1bSutGr5okS2fjXdYjZYwUnAkJ+nd7D+u15RSCkSb5J61Ki46huLewSGy6VROM8Yx3BjmFXxGazNsCtE0fN74NQFIbfpNwXryYvzD7v9xzqOGaExZ6mPw/JppzG/77RR3RpTuhEm+GA0zCh6VV/dFu2A0kognnVQUnP0i6e8vvpJ3XDsNLOvRNWLAYVzx572Xs0B03vO2dRuy6SwP4f4w1zZC1Xzy9RnZbFoEkgUVHZUQFkTUW0S4I37+JrsXQMQVk611jLrP94C8gZ8NBqWnO6nk0IibhkQUD3R4Za5ZvJ6OIay0fjowmofZpzIhHgC6qGSqpn1NrFVDnqSOzgOjSc6mNjUPL7P7G47gz4up/Xxj7V54d/uxydwMLxQJaU2xGSuXQdIvolNp1+ZV7MWwY+myCZj54vdtGoWPVD1oOAwcHS/qDMsOB/AHyf5ZVw9NHFRViNktQM5tw=; 4:8QtRxj08a7kU1288837+l06/M2extQdlgVCccPLICORXZyCeD7EtSr7PO3aPdQauvglmxQqxlmISal5t66IA8GVPS8ITjMy76ePKnw9cnGI34c2D68Y2LVHSqjub+Ogs4HFBYoI7YfLGuBsEp6P8BpF4823RWt/CasTXPhDJs5Nbvj9GfAmrhqjLTkfzd4yqCw1pE+gg90h3DQx2bi8oj+PXj/A/kC9O4oLtv5pJGaXx0vxXTQBsUo7g4B/V8J662nk18Zl6R17/2WclPdWYlvhUmwdmnNUd40Mz2oLSVI0= X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(20161123555025)(20161123558100)(20161123560025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR07MB3471; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR07MB3471; X-Forefront-PRVS: 04371797A5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(199003)(189002)(72206003)(8676002)(53416004)(107886003)(47776003)(69596002)(4326008)(81166006)(81156014)(8936002)(305945005)(36756003)(50226002)(478600001)(6506006)(6666003)(5009440100003)(6486002)(575784001)(6512007)(97736004)(2906002)(189998001)(25786009)(33646002)(48376002)(106356001)(42882006)(2950100002)(7736002)(50466002)(105586002)(53936002)(3846002)(101416001)(6116002)(50986999)(68736007)(5003940100001)(66066001)(316002)(76176999)(5660300001)(16526017)(16586007)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3471; 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; MWHPR07MB3471; 23:/LNQFCC9lV7hcju8L8xA/nG51JVXGhFr8hIiaLj7o?= =?us-ascii?Q?dk1TqH2nQv1PgtG7OkPp+aDOMyh3LW5VyqhJjstzf5nFwn3MRUAZWVhexEmh?= =?us-ascii?Q?ECmsCHw8pN0nkvF7EB1lejJqBaVtM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FGsfELWn31lN342HddxSBncPfLMErL2kS3PrHoa1Tl78ZlkJz9ck4COHQi1OvgwptFzJuzE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2017 10:59:55.3441 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3471 Subject: [dpdk-dev] [PATCH v3] eal: add function to check lcore role 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: Thu, 21 Sep 2017 11:00:00 -0000 From: Pavan Bhagavatula This function can be used to check the role of a specific lcore. Signed-off-by: Pavan Nikhilesh Acked-by: Harry van Haaren --- v3 changes: - moved changes to eal_common_thread.c - addressed coding style issues v2 changes: - removed ack due to significant changes in patch - addressed review comments - modified commit title and message lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +++++++ lib/librte_eal/common/eal_common_thread.c | 14 ++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 14 ++++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 4 files changed, 42 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..19f75d9 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -237,3 +237,10 @@ EXPERIMENTAL { rte_service_unregister; } DPDK_17.08; + +DPDK_17.11 { + global: + + rte_lcore_has_role; + +} DPDK_17.08; diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c index 2405e93..55e9696 100644 --- a/lib/librte_eal/common/eal_common_thread.c +++ b/lib/librte_eal/common/eal_common_thread.c @@ -53,6 +53,20 @@ unsigned rte_socket_id(void) return RTE_PER_LCORE(_socket_id); } +int +rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role) +{ + struct rte_config *cfg = rte_eal_get_configuration(); + + if (lcore_id >= RTE_MAX_LCORE) + return -EINVAL; + + if (cfg->lcore_role[lcore_id] == role) + return 0; + + return -EINVAL; +} + int eal_cpuset_socket_id(rte_cpuset_t *cpusetp) { unsigned cpu = 0; diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 50e0d0f..c89e6ba 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -262,6 +262,20 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp); */ int rte_thread_setname(pthread_t id, const char *name); +/** + * Test if the core supplied has a specific role + * + * @param lcore_id + * The identifier of the lcore, which MUST be between 0 and + * RTE_MAX_LCORE-1. + * @param role + * The role to be checked against. + * @return + * On success, return 0; otherwise return a negative value. + */ +int +rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 3a8f154..60c2fbc 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -242,3 +242,10 @@ EXPERIMENTAL { rte_service_unregister; } DPDK_17.08; + +DPDK_17.11 { + global: + + rte_lcore_has_role; + +} DPDK_17.08; -- 2.7.4