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 67B89A0096 for ; Mon, 3 Jun 2019 19:36:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DEBD81BB0B; Mon, 3 Jun 2019 19:35:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 7F3C41BACC for ; Mon, 3 Jun 2019 19:35:48 +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 x53HKaaU000839; Mon, 3 Jun 2019 10:35:47 -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=/yCCdWMB6S1nQe0skeb9bjD4JCQafAdQrIUMvM76vgo=; b=FiHZyz9k0vwJ46hobxtCTIWhAtSkhCCSP51Cnp3l+jiX05Vn7ckdEyAKTMFzu4NfBIaP 4NbqDWQkt0piIdB/TRJtWOe8/l7LTOeQ5vYHRFLqUXVdtj1YQwpNM6wEzqdmDGDKhH6b E+dmVXNy07CID+UGooMHHuKhWmqnHDjmgV3rpfKS7HidkT2085C+Q93pYcWUCVR9wwBm /tovGCYz3VLwV0kgusJMUJJEt5IP7sUILi1pVixlE58XO7zQuYr5/VTxFRK/MXkKDMzP IVs1EQwhW/C8ku0nT0gFqksqbkN4B7aR0b9ehwGOLaKgKNw71ESxaV/4fGW45I/JjBs5 NQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmhdmj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:35:47 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:35:47 -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:44 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 71ABE3F703F; Mon, 3 Jun 2019 10:35:39 -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:24 +0530 Message-ID: <1559583160-13944-25-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 24/39] eventdev: add Rx adapter init in 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 rx adapter conf. The helper init routine would be initializing the rx adapter according to the conf. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- lib/librte_eventdev/rte_eventmode_helper.c | 123 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 27 +++++ 2 files changed, 150 insertions(+) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index 8faa4ea..a57f837 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "rte_eventmode_helper_internal.h" @@ -326,6 +327,123 @@ rte_eventmode_helper_initialize_ethdev(struct eventmode_conf *em_conf) return 0; } +static int +rx_adapter_configure(struct eventmode_conf *em_conf, + struct rx_adapter_conf *adapter) +{ + int j; + int ret; + uint8_t eventdev_id; + uint32_t service_id; + struct adapter_connection_info *conn; + struct rte_event_port_conf port_conf = {0}; + struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0}; + struct rte_event_dev_info evdev_default_conf = {0}; + + /* Get event dev ID */ + eventdev_id = adapter->eventdev_id; + + /* Create rx_adapter */ + + /* Get default configuration of event dev */ + 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; + } + + /* Setup port conf */ + port_conf.new_event_threshold = 1200; + port_conf.dequeue_depth = + evdev_default_conf.max_event_port_dequeue_depth; + port_conf.enqueue_depth = + evdev_default_conf.max_event_port_enqueue_depth; + + /* Create Rx adapter */ + ret = rte_event_eth_rx_adapter_create(adapter->adapter_id, + adapter->eventdev_id, + &port_conf); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR("Error in rx adapter creation"); + return ret; + } + + /* Setup various connections in the adapter */ + + queue_conf.rx_queue_flags = + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID; + + for (j = 0; j < adapter->nb_connections; j++) { + /* Get connection */ + conn = &(adapter->conn[j]); + + /* Setup queue conf */ + queue_conf.ev.queue_id = conn->eventq_id; + queue_conf.ev.sched_type = em_conf->ext_params.sched_type; + + /* Set flow ID as ethdev ID */ + queue_conf.ev.flow_id = conn->ethdev_id; + + /* Add queue to the adapter */ + ret = rte_event_eth_rx_adapter_queue_add( + adapter->adapter_id, + conn->ethdev_id, + conn->ethdev_rx_qid, + &queue_conf); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Error in adding eth queue in Rx adapter"); + return ret; + } + } + + /* Get the service ID used by rx adapter */ + ret = rte_event_eth_rx_adapter_service_id_get(adapter->adapter_id, + &service_id); + if (ret != -ESRCH && ret != 0) { + RTE_EM_HLPR_LOG_ERR( + "Error getting service ID used by Rx adapter"); + return ret; + } + + /* + * TODO + * Rx core will invoke the service when required. The runstate check + * is not required. + * + */ + rte_service_set_runstate_mapped_check(service_id, 0); + + /* Start adapter */ + ret = rte_event_eth_rx_adapter_start(adapter->adapter_id); + if (ret) { + RTE_EM_HLPR_LOG_ERR("Error in starting rx adapter"); + return ret; + } + + return 0; +} + +static int +rte_eventmode_helper_initialize_rx_adapter(struct eventmode_conf *em_conf) +{ + int i, ret; + struct rx_adapter_conf *adapter; + + /* Configure rx adapters */ + for (i = 0; i < em_conf->nb_rx_adapter; i++) { + adapter = &(em_conf->rx_adapter[i]); + ret = rx_adapter_configure(em_conf, adapter); + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR("Rx adapter configuration failed"); + return ret; + } + } + return 0; +} + int32_t __rte_experimental rte_eventmode_helper_initialize_devs( struct rte_eventmode_helper_conf *mode_conf) @@ -370,6 +488,11 @@ rte_eventmode_helper_initialize_devs( if (ret != 0) return ret; + /* Setup Rx adapter */ + ret = rte_eventmode_helper_initialize_rx_adapter(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 2a6cd90..9c68605 100644 --- a/lib/librte_eventdev/rte_eventmode_helper_internal.h +++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h @@ -35,6 +35,12 @@ /* Max event devices supported */ #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS +/* Max Rx adapters supported */ +#define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS + +/* Max Rx adapter connections */ +#define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16 + /* Max event queues supported per event device */ #define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV @@ -50,12 +56,33 @@ struct eventdev_params { uint8_t ev_queue_mode; }; +/* Rx adapter connection info */ +struct adapter_connection_info { + uint8_t ethdev_id; + uint8_t eventq_id; + int32_t ethdev_rx_qid; +}; + +/* Rx adapter conf */ +struct rx_adapter_conf { + int32_t eventdev_id; + int32_t adapter_id; + uint32_t rx_core_id; + uint8_t nb_connections; + struct adapter_connection_info + conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER]; +}; + /* Eventmode conf data */ struct eventmode_conf { int nb_eventdev; /**< No of event devs */ struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS]; /**< Per event dev conf */ + uint8_t nb_rx_adapter; + /**< No of Rx adapters */ + struct rx_adapter_conf rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS]; + /**< Rx adapter conf */ uint8_t nb_link; /**< No of links */ struct rte_eventmode_helper_event_link_info -- 2.7.4