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 82877A0096 for ; Mon, 3 Jun 2019 19:37:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7CD581BB32; Mon, 3 Jun 2019 19:36:06 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 540B01BAFB for ; Mon, 3 Jun 2019 19:35:59 +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 x53HKk5X027666; Mon, 3 Jun 2019 10:35:58 -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=mqFH9jwa4UgiJO3RuXBKAlgl3tpQdYQYegotFIqWy3c=; b=eFipBK1D0HNCMVJEaHyBLiqz2/gJesVqTrYipX6zp1Ho9u8LL2Q1cGkgDTuzyYfcINNx QtJ6o/IjUlMNOV5yjE7Uad0xc7UD5q5yka/kTHeDNagQIFJTtvTEEPfy+CMrFqCne8LF vxOvB0Mu4J8HjNzW127PrEvesOjQ6gham/XX7/FCSTPYxdae9zFNwPu/PsI+ri+Z3aq2 U17T3GQ8iK1YyoPo/e/PqYEVIBSuXQ9LA4ooy+Ql2g9ARkt58LqK9/MMUShVOjQy9hHe prxiYx/KZKvOe7Ey6fBOvikXRc/Bj/XrtqfzjKc3xyY1zoC0VdWrkg2WeHBImY0UsrZu ww== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2sw79pr70c-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:35:58 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:35:56 -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:56 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 9B17A3F703F; Mon, 3 Jun 2019 10:35:51 -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:26 +0530 Message-ID: <1559583160-13944-27-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 26/39] eventdev: add default conf for event devs field in conf 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" Generate a default conf for event devs, if it's not specified in the conf. This routine will check the available event devices and it's properties and sets the conf accordingly. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- lib/librte_eventdev/rte_eventmode_helper.c | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index 4dbb94a..1729561 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -179,6 +179,63 @@ rte_eventmode_validate_user_params(struct eventmode_conf *em_conf) } static int +rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf) +{ + int i, ret; + int nb_eventdev; + struct eventdev_params *eventdev_config; + struct rte_event_dev_info dev_info; + + /* Get the number of event devices */ + nb_eventdev = rte_event_dev_count(); + + if (nb_eventdev == 0) { + RTE_EM_HLPR_LOG_ERR("No event devices detected"); + return -1; + } + + for (i = 0; i < nb_eventdev; i++) { + + /* Get the event dev conf */ + eventdev_config = &(em_conf->eventdev_config[i]); + + /* Read event device info */ + ret = rte_event_dev_info_get(i, &dev_info); + + if (ret < 0) { + RTE_EM_HLPR_LOG_ERR( + "Failed reading event device info (err:%d)", + ret); + return ret; + } + + /* Check if enough ports are available */ + if (dev_info.max_event_ports < 2) { + RTE_EM_HLPR_LOG_ERR("Not enough ports available"); + return -1; + } + + /* Save number of queues & ports available */ + eventdev_config->eventdev_id = i; + eventdev_config->nb_eventqueue = dev_info.max_event_queues; + eventdev_config->nb_eventport = dev_info.max_event_ports; + eventdev_config->ev_queue_mode = + RTE_EVENT_QUEUE_CFG_SINGLE_LINK; + + /* One port is required for eth Rx adapter */ + eventdev_config->nb_eventport -= 1; + + /* One port is reserved for eth Tx adapter */ + eventdev_config->nb_eventport -= 1; + + /* Update the number of eventdevs */ + em_conf->nb_eventdev++; + } + + return 0; +} + +static int rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) { int ret; @@ -188,6 +245,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) if (ret != 0) return ret; + /* + * See if event devs are specified. Else probe the event devices + * and initialize the conf with all ports & queues available + */ + if (em_conf->nb_eventdev == 0) { + ret = rte_eventmode_helper_set_default_conf_eventdev(em_conf); + if (ret != 0) + return ret; + } + return 0; } -- 2.7.4