From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0076.outbound.protection.outlook.com [104.47.42.76]) by dpdk.org (Postfix) with ESMTP id A29691D070 for ; Fri, 8 Jun 2018 19:25:45 +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=TbcNoYF21oraiz/77gJzW3FgxLq9Xm8MLLLfXQK1Vfw=; b=CJBOZCeYoy68qFEeTEoYxOyHk3Nj5p/v2O+1PYp/ERXelOL9ZAZCRQDCNuQMN/yq936hQ9go0yd9qOFXMwZVyo63SBLBE4LmGDumvXwOSGLK7mCYj2BD35CWpCbDBBm/sPimCy5eR87CR29Axn4upS2pM3fbHkoZ6nnUCVSqNNo= 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:41 +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:12 +0530 Message-Id: <1528478659-15859-14-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:Yig608qiJYmhT/8GonDySmZDWyPkWrXFi5lBWiWP57unc0w460yejqJ+k5KBN0fymb+7L8TWf6g8MRi2ATy+1amPU76yRUi7O511b8Hv0lny1NlNrF7YJKPw2VqUuTIN1xv0DtrZTMG6nvZSj7E4wzmTyhHacTfNRTV8jQzgpgnA8rGgRSa4wVm2gZHYlYK5yQ7KigFONlQ4GckaDO+EuDIYWPIk8PG7Bd5qrrEV7H+FYBr6F1mvbuchLEF3yV01; 25:lVgzwOmLQ6m2cSst1egRLIJbuGdUjjWrP7Xn6GcXkKt2n0avdpOCx0xV+oJquJFhu6E8BJSjY/hw2W9ic2L5MmMzvOEk5vAZFTCQ4QI2hMbBYjgvaYYx/BugB3HbPeC7xEhocvQTmDv5tQWMKBIpmWfH0WAcU12pxjLx/KuogTLfAAILA87oBegyDpQbrUdj7SdzzAbir1J3cwskfVLc731vKFoU10YIZAZdCX/Hwg8VCBZTpoXAX1Yx+3EB5smYA7V1itL6s53Fn9ZPt9P2uFhqTqS8Ii+16HNnooJjp9PRpFdNfNuikLFORk+jxspF1HhiSlid8Z1ALN76AVlVpw==; 31:qCdSO7vmCAAprVXmv3NUHDKu2iZkFCtrrGcj/hf/eS/PcUpRlL8kndDr3tBjlg4s6M1mx3ZrTTwHb5QdfZPLpS5XYRX25FLDdeBzx1MuOUJCntpJv4caM+33c/1z6UksEnm+m5bjnGxqP0RxFdf8/wHjnGqYdnQNfobfPYct3dKRHfos4CNhVOTFWpLODudw/FCLq+2sLJfHYCe904BrkjeUrzXcydoHeQNcFLdbvsw= X-MS-TrafficTypeDiagnostic: DM6PR07MB4906: X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 20:GQc47PrXz31yFyqnYkDo+2Q8OXwYbl581cjd0JS7tKauYvcqpj5RW0Ypb2MfO57slvNi44TtFwk9i6b1+GteN0fB1pqaR8xNBUGw3GVgBysL/INbSZC0GWPgQ4LSr90Ii+5ofON90TQ6t7JhDShuxe5IJ5FkEueTDNMUBbMHPxeQ28sSc4ei7VSNiiinaD7cUU238tvgSfHMC6wTnzMVG6FvO1rKCsVB97zYsrL+PwhtwHoKmC9Di3sYbhR6y2tGqOBDeHowOfYOR7Y7Q03s/UDjLNHp5WHf1iM7KgyzYN7cB0ICcIwcgCcSvIPe7SnLo1LIx138b8rSpDEjmnaXIzR6UL1be2TAcFyvzhPd0GeNDle1sgF4bTv5SLOz0guAKfN+6BfTvmHWGKiKqyG3nuMVdONTq3wvpMQSo6gpHxBWaz+9IEx7leJ8xjb0Agb0mW+K6MYrUvzfYln0nlGd5r1p8B8JztdajTGP7QHaYgWRzw3u1hYN6XdvilEKV0AIxELVmoZ8t/JPaOokj6l88zWCHc11pCiQxWoeD76LeocYcWk6kEQ/J5NbWIo6kikOB+/XzFa28HSTQI1coBGSvNIKKwqBoT1LdzwJQ54rEVc=; 4:HZq5H+GF1iBhTIBQSqR0k3aXjNZV+qvn++IvM30KDAWu1g1EnCobDW8YM6l6z4fwCN2KYqEV8bOYZuyK00gtCkXKVYXRYZpHnQ2SQHJSOnQVsw77TxKUBYNPa6EQrwV8VBGGeewdY1v4Rnz2IOV5r4Ao5PB0ICqO2hMFdHtWc3JkHv3NFHxIEGhPdJEWuDka9Te7EqeOq3UNR4L/gRX8XVwBHJn2LzAD4o9jkUl+/p+TVltkCgy+VD6QgK+RtI5zyJQPBsO5Nl4HbFYEnIT54w== 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)(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:qiHo6DReWJ+lWDRFTLy/VccIHejr/B1iRWSnQWzgd?= =?us-ascii?Q?/3uQSfFDWJJKZrzeOfSylvXGRCURama4lgigSpfZNQgIgfNW5EOdyuUMqYn2?= =?us-ascii?Q?BkVjl9wx7a14/ROEooJAxRDeIL5flz5FR7fvfxRyu500pyI+Mx0JPYDznBMt?= =?us-ascii?Q?pXlB2dtkUyujj3VgNACB+NNddeAt+perAE5znTIAt4OelgVnIlqV6s9kuGww?= =?us-ascii?Q?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W87a9Ongi7f65ZO25JcfQp9+5jbvpxNPSNCRu5gLedzffozhufbpDYwf53XCl/JwzW9iLfVuPpCw8JosNrwYckGktoS+J4bYR55IMyKdiL0pE=; 24:m6cdCMTITGbRlPiUOVBQztcMf55UVdhnpCudLlxwQP/q8/3JPbmcXSGUhk9UkU08WfE/6jmQMlGN9tRULbzXNTz8phYnN55HJYRhBOjx/c4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 7:OoAyiAHo+Yv17FTxRYLlAFJFuEjX4oTqsUpDSkyqgb2M5FGpRoa2qLvo4PsIM1ZgsMAnDuBLrgLQcmrA2auRCAB+Sa5vlsFFmB6ylcv6hy0J4UksQUFpiEKTSDlF+mAButYUBbKa99nVxDXXJ8Mjm2VipDkXfQWwX+nqsz13W/+o4KPiPR9Od26wjZMlr74eDu7WmVJ96fUGe8fV9mgLY5mIBy04WhJNdnPmbiTtVLKFok+VwcUJ4hFRWZH3TNUA X-MS-Office365-Filtering-Correlation-Id: bfe43352-0979-4fcb-3f14-08d5cd64ddd3 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:25:41.6544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bfe43352-0979-4fcb-3f14-08d5cd64ddd3 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 13/20] 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: , X-List-Received-Date: Fri, 08 Jun 2018 17:25:46 -0000 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 --- 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 8dbbd1a..4d6888c 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -196,6 +196,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 queue is reserved for the final ethernet tx stage */ + eventdev_config->nb_eventqueue -= 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; @@ -205,6 +262,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