From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0067.outbound.protection.outlook.com [104.47.33.67]) by dpdk.org (Postfix) with ESMTP id 4B763FAF6 for ; Fri, 3 Mar 2017 18:30:30 +0100 (CET) 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=b5isIOK12ngspx1f/W2P2ec8YIza/xy1RSH5l/+kCMg=; b=ItyBvERq+zu09FLlhqmclxDfvMtNazGfSE94kRpI5qXgXgWEVuJCNuN/zHoidVsb7y4UaNZZMuiX329+64rZyeYHPO9N3z8G4Dk4ZzmvcKxpnlwNUmv8z1+HJQPRLqwQDkODSgCY6NvAOGLqauhaCJ/MhPiASSTZGi8aZUZzRQ4= 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.localdomain (14.140.2.178) by BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Fri, 3 Mar 2017 17:30:25 +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: Fri, 3 Mar 2017 22:58:05 +0530 Message-Id: <1488562101-6658-24-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1488562101-6658-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1488562101-6658-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: BMXPR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.174.214.159) To BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) X-MS-Office365-Filtering-Correlation-Id: bc1bcdbc-e2f6-4bd3-358b-08d4625afc9f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 3:UYLEYXjs3Fww4m/h8x7n5PKKKvdK5+Agep+H18rocs9OxNXtDYY43+fPT9HXDm82nZChwzSKzwiBOdMy+kzfmxa2/cKgPRppm6eiRa00AbRyJUxrSq7if93gXeyZrWaKXYefSBN52zxE4K/WAyvDsqnY6OeqoMXB7uxZ+KutI+wtSvInCx68GssgWI4H1qgdm5N3fONsRjpXNhiwabUQIzcoJXiNZSyLSBQ9ErEeBk+RCeQee++2y5a+1Gkhes0y1a3PeQdWILtR4JF2O9UpqA==; 25:qc1aN5Jw3QnBNf6Qd0hqy7ja5UWG1y6ZGosxcsKaUfW5G25pVXwZMLyXUBQqWEv1IaCmoGkxPxaVFlWqHp8gHK+WnHojOwDZZBQPnakGDm242ANONdE327cPDg77c8D4wduiGeXqlgI3P9b5pVyfiOkI6Ea/TXh9c8wIufxKzb1XUNm1Du73NrB0lQTxDB7j+Xw8JsTtKl1Oue4rOc7ADjbbZ2ORZ/FQpsE5MArJvW8/27bcvreyflMcMmdPeFw4v4psIEFunq3RnuQMDFmuBPUrkFDR9hu3KL8bhPEP+Enz5lSkSVNbzsU6g9X5mZj53EI6lkCYg8/rtPJr230cpUbEk7zfq8vixCjujhoXqv4WQvNQ7j6JxTqIi4+7iTx+1Vclbz29a4Jmyceu4Pg5dlgWkOdT6EiPzXe/zYlYhFw8IeEcM3lBEdf7eCQO3bLJz5hsEQyhPN5F4+Lwame/ng== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 31:ac0DC7fwQKKBawrvyZTaBI/noP6Di9wLafZUF8uDX+Je/hhst/ye9/3gu24YGGQBmK632N581+A+6WLvg45h8J1kK6+tqrjDBAwvpttFjTntjvXlRGo2pgzpDBstCCJOvDg//F5epAMrF7B7YwvRdObFq2YqhmNX/T3nhEF9BQRknt8OBuO2C/7no2/mQzvmi6ZHRESQk/8TftwbgEmWZLVnaQQVtY4t913eXt+/9+c=; 20:e9PA837h7wlrbycABPODlMhUkjKzdmsDedytW1Do9A/oOE7ZGWQgJLe1zI1Fb1Zw+UIlgDP0P1b9M+OvGIChGi7jbNtzXZ9zOVVdiXlO0z/T+JMlm7O1B4H/gFDrJzaTx3ER8faT7x5kiruSBkKxJnhjiS89vWnXchIjCpDa/dHGlA3f/TSEx92zN8nDsVedMuNo13TDvxN6IEMPTnX4NQuejyrHt55LUclx50rC0GUS//Q6Kg/Autm/OOEAb3nHRZsa/CrK/0qjLCu02R7oNhNTumu8ow4enapt3ZA1YNVgtgLGlhJlObGTw8Snn7RGXtLmButfbWUZGDqxOdPHmX/AUgln1mPVtcS49gHl5Xukvav+7OMY3yistFu1mlIG1h/K1BP+yYxh24d2xHAGINRLjHTtR2BZuDx1rKkJmSzFS8FDvzvb4KMMl4/sPVXojlb5MqmAKX6P2IJqrvKKJ/ivw1mzQ+qVSibNUhnn5lNgiK3q0Oj3P0bTLIndYiQpjcGqIpccWtZKBl4K1P2W6QlfBerZd7hOgXlvoNNLQX9yJX0u0BbJIoX9Q0S5hb7lRHCSOOJGcdfy5yEJUSfUuhiOqRqQfc3o5Pucs6aLLDM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123558025)(20161123564025)(6072148); SRVR:BN3PR0701MB1719; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 4:KAgPTsCOLihNNpEmgDJ7+AJzynKc0A389gDZLZWSIvrr7BYvF6QMz4o0utvE/RXGQ6ka4/i1VXJj/BoCLFI1ZCe4WAMmUTqmks5QbiCGBlns/exMAy+fpGe+nyK2hFARtPZe1PUFouWJHDJlnp6aFCUXonXIHJKo98Kw0I65KhWBsxGkrsP2bNMPSfYx9wb28EztFbF2SLp5vJY8++pHlR1ezS/L+2hVITJ+9ZmSm17IVuKKDG9/6OsDLmaeHPLk8YrGERg8sio8kK07QoASjdz4VL3zYPg9hNvPTyJbg64bT0Y8daDqEYgQqSYctCgcEh36LfEM2K0RTx+W2UmgIOTpaeUab9tJ8Q5qe65+5s/+qHo1LJRQiwurYmvucV39PyLLwDMrju3UVp5N1TYuGfVSgWeLKqz03AqUY9zLfxVX76iL5LYoSUMzDhoOCQLzA2I+kTDz3NOEcev7L9RIFljaUpQFfxrSFL1M75wyiyciP3o6zt6RjmXbj/GXicAPcrFTRuQEcaFDnfRMFA6JlQy9Ruck8NVaOE0bJ6I3duyTmu/aOFEKqGEHvNkMSMVnAWQescOASzDRxjDYeAn9AJbTTnW40RHcpTMUxA6aUi8= X-Forefront-PRVS: 0235CBE7D0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(3846002)(50986999)(6116002)(36756003)(81166006)(6512007)(97736004)(2361001)(2351001)(6506006)(5660300001)(42186005)(50226002)(8676002)(6666003)(106356001)(8656002)(2950100002)(2906002)(25786008)(47776003)(6486002)(76176999)(33646002)(7736002)(107886003)(42882006)(66066001)(110136004)(4326008)(38730400002)(6916009)(305945005)(48376002)(92566002)(5009440100003)(5003940100001)(50466002)(189998001)(53936002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1719; H:localhost.localdomain.localdomain; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701M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ascii?Q?rdi2Tr24x3dlAO/z0JOy6+Kq0Cpf3uh65/7YZ+TXDbqzSMu0oon4Ua/58aV7?= =?us-ascii?Q?kRqPH6dpeRTzbzCKtriUew7UCDOJjMdnJ3C2uc7VCMyTqMISmAISlCovoQWG?= =?us-ascii?Q?fFUb8fUXFaZgk/w7LXes4y74hejphHUwuNTusk5Vh05zu7LSh/QUdBeBWDs6?= =?us-ascii?Q?bKymhBunRhtOC+zZwwQwaCzsct1tAIqW1k30NafxgMI1yoRSK507GPRREnnA?= =?us-ascii?Q?8gPuoAUrblj19PevBWRs9wnp0DujPQSSU?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 6:TFZarfujcg8XMPY/lfA0KcWQG7XOKz9VLkk47y4iM+xY3VXn5PG0vc9oqTHHuZCvvP+KaxdCwBWk4X6/z7FQHd7mOFg0dNpo8Vh22uxKaLZdeNrEgaP+uDUOUtx58dk8VpCm55TDYRy8UgAxxrJCV8fMuN3b8/MUsw/oIjYvKiID1AoIgxL5BsoeNxNYC/cbOvshcg9AeY1ZxusNhJomi5924tuTQhU8RFMgffvys4oaQgUdfFRYBCwd5vXcBYzYHThdfGpcRbm9szKqX/fOLrCqix++b6ApUHijIGy+5Ee3/YTlfnTjic1FthkuXfHAijrBQ7JQNw/3ViqzVyMnlkHoSfc3lEWs8LK99kel7jasJ7KdmMgb3LbdswM4avcfhw3a2KI7Pincn877yaboqA==; 5:f11HlkiDOkBspl9XukA6mmLTPcXrjcpYIEHw6k+PM3r2oW/ofGZXT6RmubNI8H743xMyIIfjj03miDY09vVmfpenCE818LlN5tAES3r0p4y4zNxvuV0QhkRmGVAcbjNv5aw2Fd3vBz78JX4/pjA1RQ==; 24:CLvkj/UNsiqUddPy5TcN5NOn22d/p1ymY1DfuditX5a2XRhuX3iWQN78kcMSYp1Kx0ArSqYlV0vZLW3ZbQ5dcqR+JJV2aaO/9SczMWV7jOc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 7:uep0pdRNyBe1dyivTO3u3lZZrHfeGWlqUqmEOI5BDOF6fZosrij6QWWKa2E4n9jspsdOvW4Dn1AGTELvQDAkCSrzCTvwDRipJDrVOlS/SgPLHaF6YdcaA9LQ2gVRp11q1eyylVSQYIhuoVSTQhebH1lpKsLJ9DQOo1UJc4cDnLJtEb/VPGE0B5VNVWmTTTeEzn8JpUzzYAPz+d87tr+NK5JhZuhLjhG9wKqDo4eM+cF3q28mdhoWfBRUVfXfMUnVMN5v/UUES7ccvWvVPncprY9tCKuh2LwJ++0tnOyxb+DwvlDQGn5ssD6awO12O8SfaU/ZXMsC3uH+0ejXgcD1Kw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 17:30:25.7827 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1719 Subject: [dpdk-dev] [PATCH 23/39] app/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, 03 Mar 2017 17:30:30 -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 --- app/test/test_eventdev_octeontx.c | 122 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/app/test/test_eventdev_octeontx.c b/app/test/test_eventdev_octeontx.c index 9744961..e28880b 100644 --- a/app/test/test_eventdev_octeontx.c +++ b/app/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