From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0065.outbound.protection.outlook.com [104.47.42.65]) by dpdk.org (Postfix) with ESMTP id 3511D1D019 for ; Fri, 8 Jun 2018 19:25:21 +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:X-MS-Exchange-SenderADCheck; bh=u2ESl+xT/ze0qlz35kvNkKAvz31jJE8LDyjCz3EVjuA=; b=VXRm94bCdwlQe9rdSRXT4oYOtAADcyDuthRdM6Nkcgt4niTWPW8pOwUhaSI88DghhlNmY7A3mJLX5efYfRwfY2EJCn7FM1Nn2/+8NzNCrFzXcH965XPFMamJrYiwARrHcyU23kuaGFVcj0usg0MDNYe3+GxW+X4h/a1Ugvuapvg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2) by DM6PR07MB4906.namprd07.prod.outlook.com (2603:10b6:5:a3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.17; Fri, 8 Jun 2018 17:25:17 +0000 From: Anoob Joseph To: Bruce Richardson , Jerin Jacob , Pablo de Lara Cc: Anoob Joseph , Hemant Agrawal , Narayana Prasad , Nikhil Rao , Pavan Nikhilesh , Sunil Kumar Kori , dev@dpdk.org Date: Fri, 8 Jun 2018 22:54:05 +0530 Message-Id: <1528478659-15859-7-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528478659-15859-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528478659-15859-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BM1PR0101CA0050.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::12) To DM6PR07MB4906.namprd07.prod.outlook.com (2603:10b6:5:a3::11) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM6PR07MB4906; X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 3:K/Wjy/TYAeaRv+XMsrCkDgXvayXuPZJYC5i4LaYQhZ/Wq8r8BerM3MmF0N3jA7f6PNW6fbDJtngiqEmpOz+9NomzAiXXK9GXr2nI5N/HalQah58dzz1PVe1IQqwhB556Q5a2lTLHm0wLoXz+IB4AhYvm1tk7hOUto1OBNi4igDMn32t1mZ0aozH/WXQ+C6MN6gSKKem5Rrq7MKG2Nxo2AsJ81hzOwvDRDIsMC/cCr1+3IfjewfhBsZuZzC/CmGfv; 25:wcJ+ZdViEZmlHBLjIA+Z7M4HxJ51Qzy8DRricHcmFvMCQTLxObAizpt3FaiBNJwA7D3zXjUgmKmklJ93g6cUO0SMYI/J1sU4sJQQkvOOXW3FpH5mPzBxA5kzoOInwgWXJDztKceunKC90fmIo74w0rEnl/nuHwTTfMmP0m0kXLStqewtufhWNBEazInU1t0R3gk4vCPipiMIchdef8sG3QiA1JbO6lZkI4p+RVAhq5xlZxq5iAPqWvtiRxlyrKLSzY5rEkhZGHEYC6IMthfZ7JYNlfV6W3hXYRF8/vF8RB4h1orPKWe5Ib92ulYMruLtJQGYfHrQwADn1UGrZKbTEA==; 31:m4SfeF/EKEFIAo/vCOabv7EXRXCq6z5vHEptwaDFQQf7FOzMliBlGEqq4EA8CMXrCORNbZ6ENv2LHch7O1gDSRtUvPkn7/PBzGqVAmvnspQYnXjbmOc5jkAtdT3wR3HMbgz/8yRjmVCYpvKg3fsGiYpdySAkUcrCoo/eBCcyfjEbkGj1Me4lAApkWLw7v+x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UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM6PR07MB4906; BCL:0; PCL:0; RULEID:; SRVR:DM6PR07MB4906; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(366004)(376002)(396003)(39380400002)(189003)(199004)(186003)(16526019)(5660300001)(26005)(42882007)(55236004)(66066001)(47776003)(68736007)(6666003)(305945005)(2906002)(8676002)(7736002)(8936002)(36756003)(52116002)(2616005)(956004)(476003)(446003)(50226002)(575784001)(81166006)(11346002)(44832011)(6506007)(386003)(486006)(59450400001)(76176011)(51416003)(48376002)(50466002)(97736004)(316002)(6512007)(25786009)(53936002)(6486002)(81156014)(4326008)(3846002)(6116002)(16586007)(54906003)(110136005)(105586002)(106356001)(72206003)(478600001)(8656006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR07MB4906; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR07MB4906; 23:oJcXSJmCz4m1lPodldimauAN+abJfgW9vEpuyFIzN?= =?us-ascii?Q?7LbOJS6xj5Ja037UNYZE8tgLoluwtVeARjyWbMXcFX0hYVU/b7TeOuFxCiC5?= =?us-ascii?Q?KGqA5aGvvfMkK2kpksMpEY6PB4GGPotIsUT+QiORJRQgefwtTsshXqjOI8sa?= =?us-ascii?Q?oDuYETbbRD5uvaLlYYMADQ4if21POkVybIvegAV1Z2kmn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XydyTt98S0zOxxtI3oh8zXt2+e+C5ratlvmdlZJHxOj89S5znd8Vc7EywhvK31oB3fXzTCxdkPRjRRKYS9klK2Rkvr7a/RgEDDbxIQ4CCCXDR0Y1FmOIhU/1d7AXtNhC3n4=; 24:kN6FD4DlHbsXhpFF3qLa4jMR4dIEzLL6mN70fW2yxkFXJGjKkghugnJXj0sCFOvbimeJxf/sCcGMiEpk7XefuWHPrNwhaOQLFwyEO4jA/uo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 7:TkPAyvz67b83t+Nags1Gxwdxl62fWYm4R7V7QVaUZ5wGQNr45/FoaohktnOyATGcEJPr/5EjErQF2/iUXL1zNo2QFIEvebI0h/klPE7wJTE9RGkpEP5sjGkXNuhHAFUkTis4Z2HldTvSZdg8FvDw/sp5LoA5/9K4csf/Vj+RPXaInV3fvSe83xjxZgzDaf1mAUttiVihkhei/fo70/spUdwozAQ/bTmgsebmcbgou9VuxH1vxWUN/QwSf6qZPNsl X-MS-Office365-Filtering-Correlation-Id: 45765c95-5bb1-4b6b-7c6e-08d5cd64cf49 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:25:17.2791 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45765c95-5bb1-4b6b-7c6e-08d5cd64cf49 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4906 Subject: [dpdk-dev] [PATCH 06/20] eventdev: add common initialize routine for eventmode devs 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: Fri, 08 Jun 2018 17:25:21 -0000 Adding framework for common initialization routine for event mode. Event mode would involve initialization of multiple devices, like eventdev, ethdev etc and this routine would be the placeholder for all initialization to come in. Signed-off-by: Anoob Joseph --- lib/librte_eventdev/rte_eventmode_helper.c | 49 ++++++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 25 +++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index ec014a6..f2c2b78 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -3,6 +3,7 @@ */ #include +#include #include #include @@ -152,3 +153,51 @@ rte_eventmode_helper_parse_args(int argc, char **argv) return NULL; } + +int32_t +rte_eventmode_helper_initialize_devs( + struct rte_eventmode_helper_conf *mode_conf) +{ + int ret; + uint16_t portid; + + if (mode_conf == NULL) { + RTE_EM_HLPR_LOG_ERR("Invalid conf"); + return -1; + } + + if (mode_conf->mode != RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT) + return 0; + + if (mode_conf->mode_params == NULL) { + RTE_EM_HLPR_LOG_ERR("Invalid mode params"); + return -1; + } + + /* Stop eth devices before setting up adapter */ + RTE_ETH_FOREACH_DEV(portid) { + + /* Use only the ports enabled */ + if ((mode_conf->eth_portmask & (1 << portid)) == 0) + continue; + + rte_eth_dev_stop(portid); + } + + /* Start eth devices after setting up adapter */ + RTE_ETH_FOREACH_DEV(portid) { + + /* Use only the ports enabled */ + if ((mode_conf->eth_portmask & (1 << portid)) == 0) + continue; + + ret = rte_eth_dev_start(portid); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Error starting eth dev %d", portid); + return -1; + } + } + + return 0; +} diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h index 7500f0c..e1e8a3b 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.h +++ b/lib/librte_eventdev/rte_eventmode_helper.h @@ -60,4 +60,29 @@ rte_eventmode_helper_print_options_description(void); struct rte_eventmode_helper_conf * rte_eventmode_helper_parse_args(int argc, char **argv); +/* Helper functions for initialization, & launching workers */ + +/** + * Initialize event mode devices + * + * Application could call this function to get the event device, eth device + * and eth rx adapter initialized according to the conf populated using the + * command line args. + * + * Application is expected to initialize the eth device and then the eventmode + * helper subsystem will stop & start eth device according to it's requirement. + * So call to this function should be done after the eth device is successfully + * initialized. + * + * @param mode_conf + * Configuration of the mode in which app is doing packet handling + * @return + * - 0 on success. + * - (<0) on failure. + */ +int32_t +rte_eventmode_helper_initialize_devs( + struct rte_eventmode_helper_conf *mode_conf); + + #endif /* _RTE_EVENTMODE_HELPER_H_ */ -- 2.7.4