From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0044.outbound.protection.outlook.com [104.47.40.44]) by dpdk.org (Postfix) with ESMTP id 56A432BDF for ; Fri, 31 Mar 2017 21:36:59 +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; bh=gEb5gm+wpg/sirZfzQt9ZVMtY7ra/Fi5Vc0EmTUiECU=; b=W4q8+X3BciO2ikVcnNsFiCtMcpGlvp8NKGBgMlwUUuFeLTQyrqxsJcsz7vMFZ2LU6SiN1hnLOf/NkybzlB7frFHgP2qaPYSMqGiUwbgXdCZraudyrwkO4ufeeJ+UyjD5s34KGrtfddQprF/DKcXJQWJ2J36gNDSkera74dUzIn0= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (14.140.2.178) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14; Fri, 31 Mar 2017 19:36:54 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Sat, 1 Apr 2017 01:04:47 +0530 Message-Id: <1490988905-12584-21-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1490988905-12584-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1488562101-6658-1-git-send-email-jerin.jacob@caviumnetworks.com> <1490988905-12584-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MAXPR01CA0058.INDPRD01.PROD.OUTLOOK.COM (10.164.146.158) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: 73265dc5-46f2-4cc1-9e3d-08d4786d4b5d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 3:XbjxFe/vQMM5xSa/oUjJiJseOBK2XGXB4oM+QnM8GuQm2fE9xLaBHMJtAyEc3Yo+mGiG7b6XTm6VpPWV2cQj99T2Gj6CYs4TisrY6gy9jKxWjBkG6881thLHRnocZ9LVVoo9aSDNt+44Gmtq8z1/KgsZ77nLgBeo70qDj5Kzl8/BeiBgfUHdVX6LF00AQKr94IHy1JBKncXvPF3HpmQtAKc9tqi8sPs0qLOXWj3H8J12skTJxFmZbK9fKvlfQl5xXxaaLphu71o6DZNfoBPYPL/zY7nJFtVt5rdOi9dWKUltGz4Wo87y207Hp9hBteUb9vx13d+V3FwCkHl4HLf0JQ==; 25:rIADrUpJOV+ksj3wA7NbJvEZvuipatOXtEGMjZIgyVnc6CnHxGhPWIau6GP08bjBWfWY1EYQF2TVYe6PEodnV9JqDAwfY9UXOIupC4K367F9jO+L8w1fI/rJibxBG4bkwsDkZnY6Q2exT1P5YJnpcoEBxJPDYlOX6SFKlEI7x+LEC2kzkIBVHHOrQBDRbFtjBy7OCLJQKo1i39dc/KUnmN8jQnDXrsh+7hYEXRM/R+N5JwebskbIF/dEV+LZTsSJs1S71hQbA3FIuZj1aX+w1NGceTb6qjYuIADePgVlMk9fxyVFxtRsJm+C3ttPK0Nn2WCgybl9lu904YJy6ilc45BpLtjO8zWOPnOcYsZir+/ttNwNBg6si3Rks7FVTanZg08PupsK81TYaBlLuIfLTQlkIEY0eK52cNnVeBpyEhm5lx1ePrMEiC+8iF/yFUIlc4PYLydqyiu3KQp0xHdcEA== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 31:U6G294AQMFtViyJY/VPbS5HqnTvNWmXuFdn4bsqMQchpm0yDFcUhVGKEIP22BPysATuRvM/LWWQVnVoOKEoUzbQ8IfHFmV7IrXe4kZQMlmE2SeNPlCZr74OXFJ1Agqor3fDnK3KM5ZsH/IQVGlSjZTfzTrHOiD5dXDNP2LRhLa5iIAHXSwVezKlAXeZv+3+dSqWZJkyOI53QDd9atpww2obvkp/mcGHfjJrVlp/fSuQw6MwDVz91ymMUXglwo1/x; 20:LFfVr1CS9f+R62TOGusmszMsBWrON3ilSpObnv7lgi64zuunAqiF1LINMqbPnfvex2Weh+OEOB97QtJ8liHoWx3J+5vYwiNdhiewihiJnBxs1vlJ6ERl38bY2VMbYRk0pHli6HI5wcLkB8U4GYej9QXeYMI6nli9d30KvYSlcWhlsoag6TLvW6i137soq9NFF/8i1Iga5OMwpVfVkQ2GtMPUhAbbCSdWqrZDkY01ZmWcVrg9yND6NpgFz2QA3FYmZzjF0zzKSa9zbQuuKGKAZgLcQeBXkrjEOWu6VTcaZUozJn7R97wxjW5KyO5Bhd2sX0d5JFzh935oZg58Sx19iG4SJch32MyrpY4yEorvqi8pTGwfjQTR0860dm1ujjx1A2KMbx3N34mDfSX6cK6EEohsRMSYL3iuOeDrY72jSVVMk03kg0zSRFlS0ffjePVvCDQioOre+LCyaevKF62/Qg6P9jFRB7qZkITI3HMpvyszBM9aOLpch49nSetaeAQCEI+H78ZxgLOeOO7v/v6SrfHlJ9wwHhKlps8TQXJ1igFhzJQ4ZYfStb2jlhe8jrWz/nm158Z+BdDN270uuOabpvGoykRrL4rAu4eZJqDeyZQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3002001)(6041248)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123564025)(6072148); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:iVD5rJUcotQVExh4nCzjB/QUAxbhHqitOm4O08b8X4qlI6Ytb/eMoWMvDMNa6KGoLmqgWVwOSbJPMvhrahvPk2wWvWFna7xEoBEL0jg1aehi68Be93a83n0Sko9NoiP/6wX8Z9DWEJa84p7RXhHxDvQPhbrdVmlw+A4rSZJtFxHFkWbf6BQzy6KrF9jxCRWVJOALoVVSf0SnfE4TovvLibTZuLMhbKaacWD8/bqxT1N6IEa3RNdc5+RNRK5i+WGwOvCodOQtpwGICLiYvNNosk2tPRo7Xv8aWx4z1ukNv0Y0xj1xkQIjSDWZ6ZQoVH4HSSwoI8mx6sFAnN2YARC3DjmDuyih/ylh6H1Z7ccUyWv8YoFJaaMk8dOqb3JEW7RQ5nRb4/R7O8BK9QoWEvgw5GULxnYFRvk86aUvF4Uz/nhvt6ITePHXyuuoR4lfBZpwHii7T7S7WmsOn0N+5Lv1wsQCEr96RqHE309fQFEyHcxp/rHdwhiZhgU3Lk51AD7iwESTK2W/eBlowrwIZx9MeCclKIhrQ19de24S4K6WgIPFNbUPT+XHndK5V2hiBmOEU8yNcN9+32b2ZQAJoqvdcspePwULVZw4NCN44cyY1GNcnqYKDszuVjUUR/II6aEwt7d/UJx6kmvHLped5n0VU0mjqlcD833IrDJBQgjjI4Yn0fJzIJi5N/oCOs8OkR2UoRQmY+ABIJlw03WPC1fCPMrs44coqkEQMJlC+DQAj94DdYe8tQCOrQojR4tB5mKP X-Forefront-PRVS: 02638D901B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39450400003)(39410400002)(39400400002)(39850400002)(39840400002)(38730400002)(8676002)(107886003)(110136004)(50466002)(189998001)(305945005)(6506006)(36756003)(50226002)(25786009)(48376002)(6666003)(8656002)(6486002)(7736002)(2950100002)(5660300001)(53936002)(81156014)(81166006)(3846002)(42882006)(6916009)(6116002)(6512007)(42186005)(33646002)(2361001)(2351001)(76176999)(50986999)(5003940100001)(47776003)(2906002)(5009440100003)(4326008)(66066001)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.localdomain; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:eSnxiawfcRNB8xpsZyGGjIYWhJAYgACUv8UYNkE?= =?us-ascii?Q?xNKjYLXJ2oBpH7f4WdsfI++9tfYHpTW/dTgOMwvCSPioh5vuPkTz+UhkBSPS?= =?us-ascii?Q?1flgYtesq2LQeREyj6RrO1PAf/bV1KLmrucB1GsP4kV6fclHhJBv54WqmITB?= =?us-ascii?Q?iHYgwOUAd59OC8iFipokQaYpKLW64p2lWI5IKUx3wP0ze4TyEVXoCRVrzS9I?= =?us-ascii?Q?s+YRIBnGCKd2uQx7pCHlRKmivJTDAVBq1z+G15afe8+2Vw+6qsvC+g8+a1wr?= =?us-ascii?Q?a9KE+POJIfpCqRkQawS8BGXII/6WNMc5iCsmxbOy2eamWbTXfgUa6VDq30lF?= =?us-ascii?Q?ji7S+SCMrN99V9+RKK46xXSQF9ohX+DpS21+kgy7nq/g+yD+RL7vDa3Avoz1?= =?us-ascii?Q?E9SX9LNvEU2rAjsh8hEHLThp9Sn8C3ZDW3u1fsM9k2jB7FUFkeFsk4CO4UKR?= =?us-ascii?Q?VkcqDQLGx5UyFQsbCY0vZ7bzJqNsKOpiCisp5fwmhBIOIo7u/yu7RZJQh6dC?= =?us-ascii?Q?qi63mPttO5Ma/+t7eX7onWB15PxJ6VPK+B7uIzr3vEwItJhmXZ1e4sBQA7qs?= =?us-ascii?Q?btNzfmTr6l2RBm468CsGMvAudfVtXJRutkGRRoHxk9L1hxibNGsYXkO/rr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g1xOQr/vZY5VAsuY/at3qLfldZzA4pkJV8ckJSCbqezVOVkBB4JCjgwMyrw8K086CUag==; 5:kryBO+YY5s1euK1WkWpEr5qUZpMuc76A/8ToPpa7zJyZpUdNCb9CRoaFQdKOf5WEdNAw74n7wjJcnj2Yj9FokB3lkdfnrYu9WB1we3VxwVZH54FjiWaDfNf3gX8ombD6v8T6YOuzPYIS/ofMjEcRrnp1bXmDKgx4uHsph4xXQSs=; 24:hQEIuMRHRDzttAJxqNIhx2K//Z/WxdkVlDcYr2f60W3DWI/m+sJ0dgz4272DrKyvdKl4ygTIK5I4pDCW7fYHaA6H/MiVsr5p0Rd6WP1bidM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 7:q2utBM49LEDq1jo7WdWXf+wvskn9inhH1lfN91ptaLiajVwlt4jKwh3MpE7DtfGRa1+8TMFA1P+So+FeaADYHB78noikhmQuKeurlXD12mFv3vJK09Pn6ZA0UX+zhXNPcSZvpekhb2oHaGZTWLMMJivQnAjsfLqxidq4Bh98ekbvV3dcFOviNtcHFnxbKfX8I1OQTX0r22Ruzs/gPned67/Zb0FNYIQfI3dkaAB8akmzdaaR4lfy/Zjx/a+4MJww4Rdp8NLtvY5YjhVaztxwjySCw63tF5bPRd4vVBrc9TBvQ8y5knELwjg4BHV4r0NmyDpePyykNEFUSaFNS5YT8g== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 19:36:54.3526 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v2 20/38] test/test: octeontx unit test case setup and teardown 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, 31 Mar 2017 19:37:00 -0000 Each test case expected to run as standalone. On setup, configure the device in requested mode and start the device. On tear down, close the device and free the allocated resources Signed-off-by: Jerin Jacob Acked-by: Harry van Haaren --- test/test/test_eventdev_octeontx.c | 122 +++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c index 9744961..e28880b 100644 --- a/test/test/test_eventdev_octeontx.c +++ b/test/test/test_eventdev_octeontx.c @@ -52,6 +52,7 @@ #define MAX_EVENTS (16 * 1024) static int evdev; +static struct rte_mempool *eventdev_test_mempool; static int testsuite_setup(void) @@ -82,6 +83,127 @@ testsuite_teardown(void) rte_event_dev_close(evdev); } +static inline void +devconf_set_default_sane_values(struct rte_event_dev_config *dev_conf, + struct rte_event_dev_info *info) +{ + memset(dev_conf, 0, sizeof(struct rte_event_dev_config)); + dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns; + dev_conf->nb_event_ports = info->max_event_ports; + dev_conf->nb_event_queues = info->max_event_queues; + dev_conf->nb_event_queue_flows = info->max_event_queue_flows; + dev_conf->nb_event_port_dequeue_depth = + info->max_event_port_dequeue_depth; + dev_conf->nb_event_port_enqueue_depth = + info->max_event_port_enqueue_depth; + dev_conf->nb_event_port_enqueue_depth = + info->max_event_port_enqueue_depth; + dev_conf->nb_events_limit = + info->max_num_events; +} + +enum { + TEST_EVENTDEV_SETUP_DEFAULT, + TEST_EVENTDEV_SETUP_PRIORITY, + TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT, +}; + +static inline int +_eventdev_setup(int mode) +{ + int i, ret; + struct rte_event_dev_config dev_conf; + struct rte_event_dev_info info; + const char *pool_name = "evdev_octeontx_test_pool"; + + /* Create and destrory pool for each test case to make it standalone */ + eventdev_test_mempool = rte_pktmbuf_pool_create(pool_name, + MAX_EVENTS, + 0 /*MBUF_CACHE_SIZE*/, + 0, + 512, /* Use very small mbufs */ + rte_socket_id()); + if (!eventdev_test_mempool) { + printf("ERROR creating mempool\n"); + return TEST_FAILED; + } + + ret = rte_event_dev_info_get(evdev, &info); + TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, + "max_num_events=%d < max_events=%d", + info.max_num_events, MAX_EVENTS); + + devconf_set_default_sane_values(&dev_conf, &info); + if (mode == TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT) + dev_conf.event_dev_cfg |= RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT; + + ret = rte_event_dev_configure(evdev, &dev_conf); + TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); + + if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { + /* Configure event queues(0 to n) with + * RTE_EVENT_DEV_PRIORITY_HIGHEST to + * RTE_EVENT_DEV_PRIORITY_LOWEST + */ + uint8_t step = (RTE_EVENT_DEV_PRIORITY_LOWEST + 1) / + rte_event_queue_count(evdev); + for (i = 0; i < rte_event_queue_count(evdev); i++) { + struct rte_event_queue_conf queue_conf; + + ret = rte_event_queue_default_conf_get(evdev, i, + &queue_conf); + TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); + queue_conf.priority = i * step; + ret = rte_event_queue_setup(evdev, i, &queue_conf); + TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + } + + } else { + /* Configure event queues with default priority */ + for (i = 0; i < rte_event_queue_count(evdev); i++) { + ret = rte_event_queue_setup(evdev, i, NULL); + TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + } + } + /* Configure event ports */ + for (i = 0; i < rte_event_port_count(evdev); i++) { + ret = rte_event_port_setup(evdev, i, NULL); + TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); + ret = rte_event_port_link(evdev, i, NULL, NULL, 0); + TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", i); + } + + ret = rte_event_dev_start(evdev); + TEST_ASSERT_SUCCESS(ret, "Failed to start device"); + + return TEST_SUCCESS; +} + +static inline int +eventdev_setup(void) +{ + return _eventdev_setup(TEST_EVENTDEV_SETUP_DEFAULT); +} + +static inline int +eventdev_setup_priority(void) +{ + return _eventdev_setup(TEST_EVENTDEV_SETUP_PRIORITY); +} + +static inline int +eventdev_setup_dequeue_timeout(void) +{ + return _eventdev_setup(TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT); +} + +static inline void +eventdev_teardown(void) +{ + rte_event_dev_stop(evdev); + rte_mempool_free(eventdev_test_mempool); +} static struct unit_test_suite eventdev_octeontx_testsuite = { .suite_name = "eventdev octeontx unit test suite", -- 2.5.5