From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id DD608A0096 for ; Mon, 3 Jun 2019 18:53:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 336581B9DA; Mon, 3 Jun 2019 18:51:39 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 6AAAB1B9CD for ; Mon, 3 Jun 2019 18:51:33 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x53GdwFK031513; Mon, 3 Jun 2019 09:51:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=qfOL69PVCU/793+Wq06Pu4MPyn2I260J64ST2c4+fRo=; b=B2WGW5wkutEQvyLAI749v9L8A3TkDua6xXXV4DJmUil5wCeOwXy+5kAKJlaiaNIi/Okw jXvGAvTy4j/hK3NaljlkLIZfM+L/RsXDMobAP4jimjghLGrLOA5k5V5/LqnwyxjskRZo oT2NfnVKj+WTf3dfDlPDbpFiGyWnCvdrcnT0plTL7JAMEMTE2rnYa8NnXi9vU7qEDz06 OtQCiQLp3FVYCrTrRdHxBzkexRORZzGx98LV0dROXzFFpf/DSPaUMOUkzzmWSArBkl6f biN8LklgI2a8D8TcugyYzmEZ6EvLrzE0QuGw1BzJFd0a79CA7wjFRCLtl9CFf4rHC3Bt oQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmh755-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 09:51:32 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 09:51:30 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 3 Jun 2019 09:51:30 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 23F753F7043; Mon, 3 Jun 2019 09:51:25 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , "Hemant Agrawal" , Nipun Gupta , "Harry van Haaren" , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Liang Ma , "Anoob Joseph" Date: Mon, 3 Jun 2019 22:19:24 +0530 Message-ID: <1559580584-5728-20-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559580584-5728-1-git-send-email-anoobj@marvell.com> References: <1559580584-5728-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-03_13:, , signatures=0 Subject: [dpdk-dev] [PATCH 19/39] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: Lukasz Bartosik --- lib/librte_eventdev/rte_eventdev_version.map | 2 ++ lib/librte_eventdev/rte_eventmode_helper.c | 51 +++++++++++++++++++++++++++- lib/librte_eventdev/rte_eventmode_helper.h | 26 +++++++++++++- 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 1199064..e156fa0 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -130,4 +130,6 @@ EXPERIMENTAL { rte_event_eth_rx_adapter_stats_get; rte_eventmode_helper_print_options_list; rte_eventmode_helper_print_options_description; + rte_eventmode_helper_parse_args; + rte_eventmode_helper_initialize_devs; }; diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index 38f1a2b..d1a569b 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 @@ -92,7 +93,7 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf) conf->eth_portmask = -1; } -struct rte_eventmode_helper_conf * +struct rte_eventmode_helper_conf * __rte_experimental rte_eventmode_helper_parse_args(int argc, char **argv) { int32_t opt, ret; @@ -152,3 +153,51 @@ rte_eventmode_helper_parse_args(int argc, char **argv) return NULL; } + +int32_t __rte_experimental +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 77e69d0..0eafed3 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.h +++ b/lib/librte_eventdev/rte_eventmode_helper.h @@ -62,9 +62,33 @@ rte_eventmode_helper_print_options_description(void); * @return * Configuration generated by parsing the event mode args. */ -struct rte_eventmode_helper_conf * +struct rte_eventmode_helper_conf * __rte_experimental 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_experimental +rte_eventmode_helper_initialize_devs( + struct rte_eventmode_helper_conf *mode_conf); + #ifdef __cplusplus } #endif -- 2.7.4