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 34704A0096 for ; Mon, 3 Jun 2019 19:37:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 259AD1BB4F; Mon, 3 Jun 2019 19:36:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id A699C1B9CB for ; Mon, 3 Jun 2019 19:36:01 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x53HKMDR027514; Mon, 3 Jun 2019 10:36:01 -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=EJT2awsNyUuqlvP5c9tFYUuXxrfK3DlKCgWW0QaBrrsp64AkDX4b1LbYV5fOLhLyvoW0 8ChkLjfkXRmpKhj/Fq6m6W+IvakkUoAfYbBJA3wBMSNy0FSmZhluOEZYJO2omHMhlltF MMPYMBHgwUQ2PsRiqov0G5zcmStFlgmfDLMh6savmjTaMCERBCv80LSL6Xt7a+lc8sRj /8l1qIvQJAhs0VrE9QzEogWxZ3gUvTOdh3nEw1NnoNP5TSRmF2eyltuscdofKFQfA7l8 gEfZKcJldYXACwgY6pmEyvqzZEgqXZ6hL3Ctn1ykKF2spPPyGgYxTXGZC5pTb+pRYuOF XA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2sw79pr6vg-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:36:00 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:35:13 -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 10:35:13 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 555FA3F703F; Mon, 3 Jun 2019 10:35:09 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Anoob Joseph , Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , Hemant Agrawal , "Nipun Gupta" , Harry van Haaren , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Liang Ma Date: Mon, 3 Jun 2019 23:02:19 +0530 Message-ID: <1559583160-13944-20-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559583160-13944-1-git-send-email-anoobj@marvell.com> References: <1559583160-13944-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