From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0046.outbound.protection.outlook.com [104.47.42.46]) by dpdk.org (Postfix) with ESMTP id CA4561D021 for ; Fri, 8 Jun 2018 19:25:24 +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=XXgsd+/apug1H7GwN2aHnpPrb34prGa0exDU+EWJi+I=; b=Xuu5fAGuTJbn5q759dEL3vU9qPqwuk/UhlhmrEQCFxlnYM68/m/lyDacjQECSIgwe+N8H6XmdXgo4a0oi05YCHym7lh16xzNtZMYn90TpH6bInwP77FdBGDfpmFkuDGPWQBLzXwOSCPDdd3wWxTkJ5IiIBXEa7I50UfE5KcxiZ0= 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:20 +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:06 +0530 Message-Id: <1528478659-15859-8-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:FMGLVnEq4E0JyMb2I0teH8KSYcKgk/zvHj8l9beDU/iGX7KcqXiZD3vlyHSH2ZOxW8eKbPWXI4ycBkV2Kk7hAJwgRgPWCtmLaBf4ZX7Tr8z3kDC9kQH5ccsZ9h0C7Kok6ZiQQqpa50n9qvsWAWlKw/qWfbDj/9AMkG7PclPmLd9tm3SYivKHD+wE7MSOgoZesyx0TsLEHzIuZEkmKCIFfstH+bT1afv18HGwEh55Sgjo4H1vo04pJ6mIkc1pgRtc; 25:bupnlL9XEUgfeLjc2lO/UAbIS8hveVroFKPKJmX8xaavdOTo7wjyTBrLWpUuZXfBHFRQoJLoCgx0VKj0pqDZSTpRAhW2izRqd5KfNMVyY+J+OPZAqJdA/QdCWvLgmrOFA7b0XTIRMRotRjh6gLQTyd39uN5i6R6B9CfEQLIDk1SIMPwSLzAqcICMdvirlmIxQd3JZNkES4ReEDHgScf298qVDza+Q/Aq239y8hmeIKaqR8jxMzIHj7KrnPGaRUOTPdguq9BZADhLXuh9Blioxl0VbkU41zYpfQG22eHqa4x1ldxN0H0ZKkceo5g81myDo2mhBHG4u58UijV0StFwGA==; 31:eJluaomNsMCWiSD1vOb9/62HJbCR97/ztrpmW/CnxkbBkPSQX5ovRBfPzW1EHGpX4o9fkRCkNGYOXc50qIZnAhxBbFIzQp4d45AAlV4InsXOaXyu14dRvPJAcMApUfcznbd+TZp2IA8NEn13wenpkHPzwM11vKQmkemgZu3G723BdZQwQrwH2AXJKjKO82olrocsYS8yyrCaafX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enderADCheck: 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)(59450400001)(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:NB5pyOifGWMQi3SXzWvkrCKn0tPm7wDjcyflAB4Vr?= =?us-ascii?Q?4vQ4iB2HCjwn6bK02+28htEzBp520TGBG/LGMDAj/O5WqQXWLqL6ucyq+rzu?= =?us-ascii?Q?alJVLJsg7tJelvSuzd6UZcmWwHPZNpShvzmRHI3qzakW1H/Cn7q8OcDYVDqC?= =?us-ascii?Q?xwUdDLyLRwHXuHmYjn9lFxkoRIZJ/f82ryYAMsRGMRXYGKMSmCz2l9IEQ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6JG3U1NxybtMTRv4wVIzvuWJR1dpDLSEfQ13pjdy40DpWi0il7tqrg4lCII0nIHiowfD768RBcPMkIoJ99vSmRMpNT3FLbAcAb5rBWZjkbbPPOSP0TDhmd5uQ5ZUwIv9E=; 24:2OvX+D8lBLHck0f2hVapWPKJLXq3xhEcMp/q2x0dAui4FhZwBqS5P2PJSWeMz8kCv0dcLi6KV+QXM/JjgWY90UmiB04aafN2jIezFW20lCQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 7:e+bzgWmQmZsemHMXtjEV0SWDMdsqvOSRcUrg3BM/IVMs+BIx0yVsse/Z/JJMrhpAFHMWFCMB/rPO3IVhPXIwUo2iS+Sd8pFSvxLtPunsPMR/TtdOgFold5xpiV3RMuPn9jb9gV8jaUEAu7H9vsWVvDR81WZG5m8p7TgiUC/cDbKEbIYX8/Qztm7CrvHeaWcJ/NDrBpCSb2W36+Rkar9UNsomCeIONj+8hX8UzAgyQuJsAyAE4imKzgdFUU50tUfs X-MS-Office365-Filtering-Correlation-Id: dccd5a83-9853-4f1f-f08d-08d5cd64d142 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:25:20.5760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dccd5a83-9853-4f1f-f08d-08d5cd64d142 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 07/20] 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: , X-List-Received-Date: Fri, 08 Jun 2018 17:25:25 -0000 Adding routines to initialize event devs. The internal conf structure would be used to track device configuration. Signed-off-by: Anoob Joseph --- lib/librte_eventdev/rte_eventmode_helper.c | 129 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 16 ++- 2 files changed, 144 insertions(+), 1 deletion(-) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index f2c2b78..e55d4aa 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,132 @@ 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 required for the final stage (doing eth tx) */ + 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 = 4096; + 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_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 +295,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 +308,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 134ddd3..4cd5ac4 100644 --- a/lib/librte_eventdev/rte_eventmode_helper_internal.h +++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h @@ -27,9 +27,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