From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0084.outbound.protection.outlook.com [104.47.36.84]) by dpdk.org (Postfix) with ESMTP id D55641B192 for ; Thu, 21 Sep 2017 10:58:48 +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=ckRX9nUWDuX9Eandr14MXYuMYjC0WGgMXGu+9GPshE8=; b=BmZkqduITC2P96wLy5VaYFXHHuZPf6CqW8EXgpi7qbUGr61G5ZO4zXE7K6wLYdYNgvVrMQcrAFo+E3IbTRdHQUvPE2tUsPYU2JL0J62LMcj74QUJH1DBk2xT3coIxXnXk/H6sNESXzvpAt4aRnhnF7TmHJfFs7FsvG0qCHN9Wos= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by BN6PR07MB3460.namprd07.prod.outlook.com (10.161.153.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Thu, 21 Sep 2017 08:58:44 +0000 From: Pavan Nikhilesh To: harry.van.haaren@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, Pavan Bhagavatula Date: Thu, 21 Sep 2017 14:28:11 +0530 Message-Id: <1505984291-18702-1-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503501027-11046-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1503501027-11046-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0112.INDPRD01.PROD.OUTLOOK.COM (10.174.144.28) To BN6PR07MB3460.namprd07.prod.outlook.com (10.161.153.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 834cc086-c4a2-4427-c1d6-08d500cef7ba X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3460; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3460; 3:e9oMSaZcJAIFf9Y/boG1l4l4v0YHatpcjm0MFlxKt/AR7QhUt7yEVSjLXTWGh19klpKCyU4CL+/qd18jRzTvw0/C8tZIZ4Y+7pz9hQ7Np7iiCRIcx/Bqqtg4woZoTUqzr+aktm/Yr/Dtdip1QNfFXCrNTL5UGCDuHHaEJOzlR68sMR/KnXp3/Z167BdytWYphq8+kqwJlVnu4kMWZI50DdIbEnD78+ZDRit5cU51WWywkbqtFsXCnvQBhnW1x5UP; 25:A7inmO2Tqza0WYNSn7RKGstC1ArcUoQwo0vMCGP14kQM6v7uJ5lLf+mouIeCf+kv/i5sscZT17wl7uEtB01gCuQP8LC3uDm4Q0Ya4QjFQByREmUYSvpYv9n+y0x5Y+A9xE45D5h1t3D6uMcY1sp7ghPM2nVUt/ZkANyjcBwRVwB8CXhQOZyByGYACP6u5ejJOe0eNL/EwSpNC2c1rlY8mkkU4wTK2Dq05z+65PFLMviicMoNg567fqhjqEz5LnXKHlqPUbwwXDM/43FUGYOtMOebiL+Ryr9U69/MxgSy0+VND7+duDCpbEhu+1UxzuMbATns72Fl7DS+alNvoq9ihw==; 31:tK7r3sW6OqpZZY3AVi2oVNrFF0BHxjz+meht4Hph1NmUkV2oF2mspMmwZTcQF+1dQLNHEKV+Ayf2dXpMA6fMTBp9AFdJW3Qh4MFZM//KQ/2rM21QDm/r3ht1K5VNXOyRC5+EiICEXYL66p+a5v46RSThkK5/FA23Lt4LT5WUBQQAq9H3tHzNPuoYd1Ei/y58E6Pq9Ia7ZV+mS54nCR5lgxloDdvBQuAmRSdxxE8STFo= X-MS-TrafficTypeDiagnostic: BN6PR07MB3460: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3460; 20:EOvURHjW848JvxaUk9IB9Jxz1YDjA0TxTYc/3UrFSsgmw3VivP1pV/k/06Mqncp6Pd5ggsnxiiSjPxi6bliUKFBakv8veUAZj9nZw9T30ols/vDj0/f9MS7zJDt3jNwnPYpRL+HAhMkpdYCk+5wjQSnT0mFQGbFs45t5Ydv9GFGs1J+JjWEA+lAl7kGZYwl9bJjHftuoXFHLrd0pNN+chRmiBYbLoZkGn3joWRxZD7FwMnxTIOMLBjaBseJShJmJilIWqNJ259F1DRf7RqWkj0kSOriToSwIejd0151e9FpWPyTgbH6jSExBkJEy/TRNtXjpmU2iJ/iuXyZtkmxaba+A+mN8Hg6ZYhwoQZocGRcW/Ev8MkZeWITtKHpxObguNZ9rj1h6EPZhcOOnVQAMYPxgb5k2X3/fp4rVJXwWd9ydEokfDoNXR3xNXIEe5sb7z0CucGtsv/6Gu4SnZGQcGMRUZatl7agZM7V83wkjpoWqpFrcwlifHYFyri+6jyUknUB+9FEuM/H4djUT/2fqP5285MlRDDTip1qk/SUpgpb9pyG3ES8IAnThuYjtFT94GecJ9ZrdXrapS+DBp0GwJxptpWWJJp6utIFxgCJD3ZA=; 4:e+stLykP+q8L+i1Oes32M464DR4JwIDacaQnzJi2UQO5A+agiGzKC13EbSCKs/auxo4nIbpLl+JVHM8+ZU5dK+xVXVN+1oZOiVRnKmFBp9cC5GeHGtHSq0TokZE0QEEp3f6A/4M8cmX2dfrP4XIWdG67GSB0u+HYM9qyZPxwy3BJUSgdP5gR7Kw3qF41CTlIzx1WjZO+W1T2O73f61Xkt9SS1KP93QQvmamokRpTQLGV31GlKd0bJbn5dG9Q8oVM 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)(93006095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123558100)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3460; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3460; X-Forefront-PRVS: 04371797A5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(199003)(189002)(5003940100001)(189998001)(81166006)(81156014)(8676002)(68736007)(5660300001)(8936002)(72206003)(16586007)(16526017)(107886003)(4326008)(5009440100003)(316002)(575784001)(50226002)(47776003)(50466002)(2906002)(66066001)(48376002)(105586002)(33646002)(36756003)(25786009)(69596002)(76176999)(305945005)(53936002)(50986999)(478600001)(7736002)(101416001)(6506006)(97736004)(6486002)(6512007)(3846002)(6116002)(42882006)(106356001)(2950100002)(53416004)(6666003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3460; 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; BN6PR07MB3460; 23:NTCK0SYrXI0BtRnN61SVPAomOVtEMxyOen0IRg4kY?= =?us-ascii?Q?Dg2nZotIYHOyjFEZCPXJ2lTkPYpN7iPPz+PRJXrOyZJ9i50pOgmeA4M6JQmQ?= =?us-ascii?Q?OFiqUv+WfRBPlrxsY0fRKhLylAC/iim1hKfddcBmWNBFByMOdaL/6gNN4tJ8?= =?us-asc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qxbDFr/aw5FKWAY7G6sl+oXwF6C8nZ/lC0TiRlw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2017 08:58:44.9142 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3460 Subject: [dpdk-dev] [PATCH v2] 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 08:58:49 -0000 From: Pavan Bhagavatula This function can be used to check the role of a specific lcore. Signed-off-by: Pavan Nikhilesh --- v2 changs: - removed ack due to significant changes in patch - addressed review comments - modified commit title and message lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/bsdapp/eal/rte_eal_version.map | 6 +++ lib/librte_eal/common/include/rte_lcore.h | 14 +++++++ lib/librte_eal/common/rte_lcore.c | 49 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/linuxapp/eal/rte_eal_version.map | 6 +++ 6 files changed, 77 insertions(+) create mode 100644 lib/librte_eal/common/rte_lcore.c diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile index 005019e..f1263fc 100644 --- a/lib/librte_eal/bsdapp/eal/Makefile +++ b/lib/librte_eal/bsdapp/eal/Makefile @@ -88,6 +88,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_elem.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_heap.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_keepalive.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_service.c +SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_lcore.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index aac6fd7..3be3287 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -237,3 +237,9 @@ 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/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 50e0d0f..777208d 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 lcore_id, enum rte_lcore_role_t role); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/rte_lcore.c b/lib/librte_eal/common/rte_lcore.c new file mode 100644 index 0000000..66c03f4 --- /dev/null +++ b/lib/librte_eal/common/rte_lcore.c @@ -0,0 +1,49 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium, Inc. 2017. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + + +int +rte_lcore_has_role(unsigned 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; +} diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 90bca4d..9596acb 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -100,6 +100,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_elem.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_heap.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_keepalive.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_service.c +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_lcore.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_cpuflags.c diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 3a8f154..7304a34 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -242,3 +242,9 @@ EXPERIMENTAL { rte_service_unregister; } DPDK_17.08; + +DPDK_17.11 { + global: + + rte_lcore_has_role; +} DPDK_17.08; -- 2.7.4