From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0086.outbound.protection.outlook.com [104.47.42.86]) by dpdk.org (Postfix) with ESMTP id C0E991D057 for ; Fri, 8 Jun 2018 19:25:39 +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=SIFuu2a64h5mwSy0x2PLBcWrQJziXG0AM35HupNWaAs=; b=FarRjjUFqowkYWtz7K5XnHaFi/EtfJzQTyBdvgUHD6pkwB5jL6CQzTP4q0W5m3wgc4jvQpvqu9vz0YTS3aCuD56yP9LWV6Cf8Mt3tWjthauAPQEv02tx3m/8O2x3DBIdjbp1T7aF+mLaKmWW3UgKq03NeiejzRkWUX1UJh2bz+M= 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:34 +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:10 +0530 Message-Id: <1528478659-15859-12-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:kwz9hDay3hwiUm9nY/lhq2X7gfMDBwqtSt4RTbL0LqfbhIv3/8TIye9kTJ++jMFKeiB4FOouzaVLtpL47D8dqpPo+QjT5XhiToNdWM+nQKaC6uvBXBHl/83uFr54DYQhbvVJG1usU1XgtFve09RFLmG2p9tZZkKyyktpK1mSLS1hfpqiHKz0MtDfMNHFPvuH/0bhpF4aXRBnYS0SIOaVZ8w2r7Yd4CugmfKtSAkgL96N2lb7+VR9Dhw3h37Uboxb; 25:9rpGHHMQBSB5gpPSpW+tNgEss8PcPAVlQcHI7/PC+jBLqu2s9//2Vy17rnf5jpQyYRtJQJM+bJwkN82XrgelIhyGn2z3aAohK0nNmxMEfObYP5Ws6JFcb+29WhFMOERKqtbHZMtK+Z0LhnQDC2Dg3MHg11qcxpRwmgIxu4Puk5WkeGaW2A0Kv+uxPzt9dF38Qkt+cSnA0hrxYLREr68lANLoEkgzsAr+Z3tTdwIluw3++1yLKxY7Yz3iiY6lBFObW4gui2shAB8qNKiZppIA6dBlhq/0CI5RBvcgfb8+WexpkBdnrSEAMACLyINDkMZgF9JpJArD2LEdxPR0ND5Yqg==; 31:87n9Zn3h31zXc3eVngJpIvZA0OMwOciOXgMr/7EPdukHWo810XnSy3aqFISwI0NH39olULHC2t3VirsT62BxJJmnz2qaG4I7wWfM7cEpp3s2S8LbYXkW7MP7Ag5aOfbOlCDrIqiouAMz8fNMw4F5/4/K2udC76fsgafXACr3kaBfpSZaa+TqjtSkjpPdNhCoqIu//1TFG7R87qUAKlBpvEKeAs6jQGtj3vjdeQkmWaI= X-MS-TrafficTypeDiagnostic: DM6PR07MB4906: X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 20:C+hhUUtIu7TRPJbYvS/Et4ov4LXcQpOOReyUL3eWxD0/imYojvVNPBn9apYEqvqrdOoE8uT9ESk5bgHaHlZV9j80jbEB5vxx0qONDdsm6BHlMYcSetsFFbHrQyIznMKRTqEEGOb+mjlbEn9rqIK2k5Y97iuRi41bMuLYTv63il0oyy3X/6AICMeEo5dIhqNZyaBeTV5QcLyj7b0AhYqc3JkDb1PdJTbUOnpkV6deft+S2Sp8t0OsziFykmRep5NVgMYTqseZUx8dvuH7DtRfvp5QwmG/jiOmfvPlkezWSTf1attDDXEcd9UoaQuK1ZY3LVXMN7vLbo6ptvoBKd8pTbgWYx0DKvNuVJqQNuydnNKysrArZngzBaEZKu4qU+HIzQQyWwjh7WNjaSuJwCuvxAk15TSHoA2i0ZIdP8/0qMwhS6HIBjxOotzCZeXc1Ujj7X9oU+agp3KxTmQfKVYGeWlL1VBeA1Qc8+R9gXksv8fugLQooVprn7CwkchW2lckfGxoeks38wh1QnkA+h/B6STXmbSyNKNLeDGyKf7Iu3lcMRpt+0hwT9cb8w605B4cWkyPCrKVkD89xF0YIOmr0GUP1WjvxPD93+RCk4rPApg=; 4:kdQyhswlk6Sincgju76IoGLZ2Q513yX70PzMO9jeQeTnhMzyxc8hYorb0CTfvabdoPHxCd6gXpMp5IQ5n3pcLjQvbowcaf0zyGC7QP1mPC9q+MgOC6ZGi/+BiVrd3bzD4DURMiZy7e+xUSPGvwSaC4SfCDLyYoVXoMx8ZgRsRG4T9+nLTzGfrXibUJwzjOUuw4Psp0hEE5XIAJVzq7WYegrkWUQ62lhXxUmN5glkl6Bi7/mIm8uwlrVPiXQe3ovndiJviRmAB48H7YLRUkr2Cw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: 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)(81166006)(11346002)(44832011)(6506007)(386003)(486006)(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:jfpmYM2SzXPblg377XAaS+o5E4Woct9AOMCDjWy2T?= =?us-ascii?Q?2W9RoTbfo1ojtfCG7rUTimExPLbSW3f3pYnGs/2O87oK501ISSgwfo3M28dT?= =?us-ascii?Q?Z4L1/KyHcOq4Rg9uLCHoKBdQwWTtPh3be3Bborzsy8AFnnsnV40bH1uHIiyU?= =?us-ascii?Q?oPVVG5PWJhQkQDGRRZsjw/4f+a0UVzCMEAsyNrNDKdDehXYcT5h1yIvBQHCa?= =?us-ascii?Q?HJ/n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Npn/+F/edb0t4FqGYpu6okKmiBxPsqp96hRzgKBgwVy6K4AfDIgrHG7t2rlu3UKE7OJLxPPjPwhGPnMAclmjULec=; 24:1zvSe/tgF18V6sNsDsUeLo3toUMEqfB/dDrMaWbiUpBxuMvL95i5moDg+1iBpKq49BidMUFN3zli8zTbAgtO29zRyiNTHG7u8ULuaaqpReM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 7:mMMyXn8RSD9maSBl+5w8TtLOjQk/aHTFK9cWf2Ia7soGRDQg3yfxdL38HdT8fJ+PVdkZf8MxtBjjv19U7PglwT0jGTDIaxUbv3iHXzfOOlC240M90ASqDS+9uaeeuPVEc3m7se1CtCX6yPGJPBYh5Ik5xMk9Fazy2TzzWlV3oD4lkMS/XQ+F83feZFfXQgKpeDEtuMz4pCs71xiq9/5GnKUZrFdgmA1Gq5Hl96MWRh0VZnKkVmm3w8BaxaxKKJUm X-MS-Office365-Filtering-Correlation-Id: 0657dc78-671e-47f8-e2e4-08d5cd64d9ab X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:25:34.6543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0657dc78-671e-47f8-e2e4-08d5cd64d9ab 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 11/20] 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: , X-List-Received-Date: Fri, 08 Jun 2018 17:25:40 -0000 Adding rx adapter conf. The helper init routine would be initializing the rx adapter according to the conf. Signed-off-by: Anoob Joseph --- lib/librte_eventdev/rte_eventmode_helper.c | 122 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 27 +++++ 2 files changed, 149 insertions(+) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index 9f2d6de..aade9e1 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" @@ -357,6 +358,122 @@ 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 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.s1_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 event 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 adapter"); + return ret; + } + + /* + * 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->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_eventmode_helper_initialize_devs( struct rte_eventmode_helper_conf *mode_conf) @@ -401,6 +518,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 e9c1b4f..63b2fb5 100644 --- a/lib/librte_eventdev/rte_eventmode_helper_internal.h +++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h @@ -30,6 +30,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 @@ -45,12 +51,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 adapters */ + struct rx_adapter_conf adapter[EVENT_MODE_MAX_RX_ADAPTERS]; + /**< Adapter conf */ uint8_t nb_link; /**< No of links */ struct rte_eventmode_helper_event_link_info -- 2.7.4