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 E05E4A0096 for ; Mon, 3 Jun 2019 19:37:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A77F1BB46; Mon, 3 Jun 2019 19:36:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1AF781BB22 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 x53HKMDS027514; 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=sFiYolRb0K8OnlCI+NicO36G3VTnMtxdbgUruGMUtp0=; b=wr7xqcTAxRSpqBK6JudL53Qib9bBXKCsEjCOC/Hmzb5gCUv3KDj9uwYVLpMvdoAq36Du NaYv56Ody8CdGlpZuEukQhONJzGopW4cxoj/MXBhyuNFzwJFR7QuUucVafh+mmBnhg7S KOJ7otbAqeMInT7dmQm+uLxgiTHKh2RVk82rE9uyR02RhSQW0ZTNRKD+XjTUuBqXWD5L Yap/qYbFo0RvmOP9ij9cUjKBKI3aADsXBL/j8YaL8k9RSfNmqYE/gDz8b7A5PVV/lsQQ hvRGnXi6PEXkOXifn4qp5oFFX8KJnPa89jYMepsXYzz8Ahv8Fttfh4K+uI0OywYl5dxK hg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2sw79pr6vf-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:36:01 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:35:19 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 3 Jun 2019 10:35:19 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 4E7623F703F; Mon, 3 Jun 2019 10:35:15 -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:20 +0530 Message-ID: <1559583160-13944-21-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 20/39] eventdev: add eventdevice init for eventmode 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 routines to initialize event devs. The internal conf structure would be used to track device configuration. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- lib/librte_eventdev/rte_eventmode_helper.c | 131 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 16 ++- 2 files changed, 146 insertions(+), 1 deletion(-) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index d1a569b..bebcfb9 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -154,12 +155,134 @@ rte_eventmode_helper_parse_args(int argc, char **argv) return NULL; } +/* Setup eventmode devs */ + +static int +rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf) +{ + int ret = -1; + uint8_t i, j; + struct rte_event_dev_config eventdev_conf; + struct rte_event_dev_info evdev_default_conf; + struct rte_event_queue_conf eventq_conf = {0}; + struct eventdev_params *eventdev_config; + int nb_eventdev = em_conf->nb_eventdev; + int nb_eventqueue; + uint8_t eventdev_id; + + for (i = 0; i < nb_eventdev; i++) { + + /* Get eventdev config */ + eventdev_config = &(em_conf->eventdev_config[i]); + + /* Get event dev ID */ + eventdev_id = eventdev_config->eventdev_id; + + /* Get the number of queues */ + nb_eventqueue = eventdev_config->nb_eventqueue; + + /* One queue is reserved for the final stage (doing eth tx) */ + /* TODO handles only one Tx adapter. Fix this */ + nb_eventqueue += 1; + + /* Reset the default conf */ + memset(&evdev_default_conf, 0, + sizeof(struct rte_event_dev_info)); + + /* Get default conf of eventdev */ + ret = rte_event_dev_info_get(eventdev_id, &evdev_default_conf); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Error in getting event device info[devID:%d]", + eventdev_id); + return ret; + } + + memset(&eventdev_conf, 0, sizeof(struct rte_event_dev_config)); + eventdev_conf.nb_events_limit = + evdev_default_conf.max_num_events; + eventdev_conf.nb_event_queues = nb_eventqueue; + eventdev_conf.nb_event_ports = + eventdev_config->nb_eventport; + eventdev_conf.nb_event_queue_flows = + evdev_default_conf.max_event_queue_flows; + eventdev_conf.nb_event_port_dequeue_depth = + evdev_default_conf.max_event_port_dequeue_depth; + eventdev_conf.nb_event_port_enqueue_depth = + evdev_default_conf.max_event_port_enqueue_depth; + + /* Configure event device */ + ret = rte_event_dev_configure(eventdev_id, &eventdev_conf); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Error in configuring event device"); + return ret; + } + + /* Configure event queues */ + for (j = 0; j < nb_eventqueue; j++) { + + memset(&eventq_conf, 0, + sizeof(struct rte_event_queue_conf)); + + /* Read the requested conf */ + + /* Per event dev queues can be ATQ or SINGLE LINK */ + eventq_conf.event_queue_cfg = + eventdev_config->ev_queue_mode; + + /* Set schedule type as ATOMIC */ + eventq_conf.schedule_type = RTE_SCHED_TYPE_ATOMIC; + + /* Set max atomic flows to 1024 */ + eventq_conf.nb_atomic_flows = 1024; + eventq_conf.nb_atomic_order_sequences = 1024; + + /* Setup the queue */ + ret = rte_event_queue_setup(eventdev_id, j, + &eventq_conf); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Error in event queue setup"); + return ret; + } + } + + /* Configure event ports */ + for (j = 0; j < eventdev_config->nb_eventport; j++) { + ret = rte_event_port_setup(eventdev_id, j, NULL); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Error setting up event port"); + return ret; + } + } + } + + /* Start event devices */ + for (i = 0; i < nb_eventdev; i++) { + + /* Get eventdev config */ + eventdev_config = &(em_conf->eventdev_config[i]); + + ret = rte_event_dev_start(eventdev_config->eventdev_id); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Error in starting event device[devID: %d]", + eventdev_config->eventdev_id); + return ret; + } + } + return 0; +} + int32_t __rte_experimental rte_eventmode_helper_initialize_devs( struct rte_eventmode_helper_conf *mode_conf) { int ret; uint16_t portid; + struct eventmode_conf *em_conf; if (mode_conf == NULL) { RTE_EM_HLPR_LOG_ERR("Invalid conf"); @@ -174,6 +297,9 @@ rte_eventmode_helper_initialize_devs( return -1; } + /* Get eventmode conf */ + em_conf = (struct eventmode_conf *)(mode_conf->mode_params); + /* Stop eth devices before setting up adapter */ RTE_ETH_FOREACH_DEV(portid) { @@ -184,6 +310,11 @@ rte_eventmode_helper_initialize_devs( rte_eth_dev_stop(portid); } + /* Setup eventdev */ + ret = rte_eventmode_helper_initialize_eventdev(em_conf); + if (ret != 0) + return ret; + /* Start eth devices after setting up adapter */ RTE_ETH_FOREACH_DEV(portid) { diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h index 2ee7711..0b4ec59 100644 --- a/lib/librte_eventdev/rte_eventmode_helper_internal.h +++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h @@ -32,9 +32,23 @@ #define RTE_EM_HLPR_LOG_DEBUG(...) (void)0 #endif +/* Max event devices supported */ +#define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS + +/* Event dev params */ +struct eventdev_params { + uint8_t eventdev_id; + uint8_t nb_eventqueue; + uint8_t nb_eventport; + uint8_t ev_queue_mode; +}; + /* Eventmode conf data */ struct eventmode_conf { - uint64_t dummy; + int nb_eventdev; + /**< No of event devs */ + struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS]; + /**< Per event dev conf */ }; #endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */ -- 2.7.4