From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0044.outbound.protection.outlook.com [104.47.37.44]) by dpdk.org (Postfix) with ESMTP id 2DDC129CF for ; Mon, 18 Dec 2017 22:45:08 +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=L62qzqcVwcMncb0BNYcAuPAdwtA8VLbhQJWG6BVty2M=; b=ocadF2X5Di6AfYska8hikC2zVvzQhs4mmqELL0wrNIxOt8AVRQkqZ3oH+GjIRt0uazqswmO6ioAoHcv0ueAjcjCVpEWoVlGI2FXx6u9HqorViG7vtc0OchdmgfYJZjZqy1TakbAxggQO+4iIFl3qZ0eJTvavXjWfQMyAn8xKRW4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by DM5PR07MB3467.namprd07.prod.outlook.com (10.164.153.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Mon, 18 Dec 2017 21:45:01 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, bruce.richardson@intel.com, harry.van.haaren@intel.com, gage.eads@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, liang.j.ma@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 19 Dec 2017 03:13:58 +0530 Message-Id: <20171218214405.26763-5-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171218214405.26763-1-pbhagavatula@caviumnetworks.com> References: <20171130072406.15605-1-pbhagavatula@caviumnetworks.com> <20171218214405.26763-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: HK2PR02CA0163.apcprd02.prod.outlook.com (10.171.30.23) To DM5PR07MB3467.namprd07.prod.outlook.com (10.164.153.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0728874c-777d-4cd1-f542-08d5466099a6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307); SRVR:DM5PR07MB3467; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3467; 3:yles/vsB8KCwP2jew3nWl47+/JPr8OUtgWZGrmmXWSQiis7zMrKnEiTn+jMwiB1bwHOVuyKAErDQb0zl9PSX0ePyc+dFE4x0hGoIxMDxt1Tq3V02Lj7XrnnxzOU7oWvwqySmgvRxglosz/epzAqtQ5wpMh58a/ejA9OSzvUlmfkWsuCyLFScg5En2LRhJLudZqf2C6z4EDpataLAVmy51Hyw5x+Y9CFRsDO7IoofldpT4xuhJWfRCyQCF/lTdK/e; 25:I1/XzEJfcrSomUvZ/LtJHGz7NN/f4QYguTk6Wu7yGDprot7qRsFIp7ZeiOgXW2COAq/JepJW/Tz0uGShLe3jI55erFwxLIr5bJOoW6dNwFTBkiJeABc4kwFjsYX11+5l5A5G2aAmIOdWwAmE+0HPkg7ROs/HlwPYRJdEzPMfM25bVg/S01OzxJW9AU00gG++Cv57c5MBOrjvzVQNvwpgKC5vSCNYTXcN8NU3BZqgOMLqdkI2/3cXwNHGTVi0GA6jdnx/jdaDxG1OO4r4TPqEXj2PfmFClg9JgdUntSbo5dZ1cJb2Q/zqF/ir49Yw7szp9D/pEhAdcEToVBe2hYRUZw==; 31:AXhqG8ZBa12TO+2FqakVUIjwpaFkbTP7l5E1rwiWVwFDatsQfg6704YSES2MJji60K08uUmCqR0LviWD2MxJ2bRQ6dJHqsyeZWfaJVIy0pDbt1L06B56SFZtkQaQIXRQBCoi65KlYFqTMlrj+/aHdkMfTknowmfIxL+rnODakqZwIDflglM9iclpKFMhkBH1qWSeMu0gnGF2jTJpYoPPQvNnonmdOuYj4L/pJUdghRA= X-MS-TrafficTypeDiagnostic: DM5PR07MB3467: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3467; 20:err45vR3NPV4DoHGB1rRIE+Z9eV6khqtAXwIB7MVH4P335yk9/WYHGX6aA53nCHH2ta1FIrPnp0Mft5Mf27tOcSFiRmsCm2Td2PgM9i1NpyDNJ5JzYwvJhPLP9yeSMIOdiRGzd9spMso7v4FBEbQRANOXeEDaK6f1nKAavgIfsG2rZw2thvQeMQv25B0dtJbY0QhUz0s+Ig1mGrV9+6tG0Zwv8DX2anOs8xfCp9XDe18iJqJet1kKmyeMbm4t/QCmgstTdY4+Ex+ttk7m921AGFunzjdDz8U71Yef+MV5NhIzPQcBOE8ZwW2xcCFLTJPx3ceh6sp4prwRtPDixygbHm8UD4sKD7EN0jeNEZRvapbrHGxQOxfqNy0BFBmFABykMwddmt5tyjVUijLbOuoLBLR8X9582dl6MhzUnGh1QjzL5rQGKjecpWvc+1nih7gZIo8SOnzZbymN/Zt4vPwCo8Cy8ZrRo0XZ2zMTdbVzsBoonFGG/3D+MhAqLg2pOMn03Ess7bFu0MD0aP5AoG8GTUvhzoAOkNR7huIgeOgcImnRbKfnF9PFMDTwXxH8mPgXeyJg8QM1x6qy7qO10HUK3iD/kweeK+04I/78F/IU28=; 4:GRwcb9j/2f4RnHRUqTkQmr+Sr59hA2bkxewXVPdchkTa8ZV6i99af+L3inagZ4IkN8bIFsWnkjfJJtvH/6+tsZgXYHksY4x9g85sjrFS1Q8zVJkhKnRFN2Rka/ezlFWIo8SGtePU2Bs+yGoUXABmdR4aGcj3vJjRnzn4fQVNd1SywRN34/dr6UjMpApCo5nLUSgQBr1+yVvi//sZWh4m4x9++Kw9S04fIspjVEVbFxylqqLRo83H989nbUAuMF3EsA8fsbaM0GLKPnOHV6Hk5w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3002001)(3231023)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(6072148)(201708071742011); SRVR:DM5PR07MB3467; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR07MB3467; X-Forefront-PRVS: 0525BB0ADF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(366004)(376002)(39860400002)(346002)(51234002)(199004)(189003)(4326008)(2906002)(53936002)(305945005)(25786009)(1076002)(8936002)(50226002)(16526018)(6506007)(386003)(68736007)(52116002)(478600001)(51416003)(48376002)(5009440100003)(3846002)(6116002)(72206003)(36756003)(6486002)(107886003)(8676002)(5660300001)(106356001)(105586002)(8656006)(2950100002)(42882006)(6512007)(6666003)(59450400001)(16586007)(7736002)(66066001)(47776003)(76176011)(50466002)(81166006)(81156014)(316002)(97736004)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3467; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3467; 23:6VTnGfx//SBxFfyMnY3kOg8dlcG02jC281T67vPKi?= =?us-ascii?Q?Cii988b11Al4rCO66+e9ZpWp7rXZ0H7Zbt+RQiP7KmRkK7J14UqaFji4FslA?= =?us-ascii?Q?DWxju1qChBgpx0h8xncfwWkWRghinxM3lGX4a8Sd4O59zwKwOxflO/ECmU8U?= =?us-ascii?Q?vSkis05QK+JX539l4rDbZHZGfZ+ETbYv38QAhO6Bmpn0C3HAaLcHoWEiANxe?= =?us-ascii?Q?wPCA4AhANQ0gIe6sA1uoeL4c/FavgSifX20t48i8+cASHkF3ML9cKezN5EBl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7EDvXEwKxz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2017 21:45:01.6143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0728874c-777d-4cd1-f542-08d5466099a6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3467 Subject: [dpdk-dev] [PATCH v2 05/12] app/eventdev: add perf ethport setup and destroy 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: Mon, 18 Dec 2017 21:45:08 -0000 Add common ethdev port setup and destroy along with event dev destroy. Signed-off-by: Pavan Nikhilesh --- app/test-eventdev/test_pipeline_common.c | 98 ++++++++++++++++++++++++++++++++ app/test-eventdev/test_pipeline_common.h | 3 + 2 files changed, 101 insertions(+) diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index d2ffcbe08..eb3ab6d44 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -116,6 +116,104 @@ pipeline_opt_check(struct evt_options *opt, uint64_t nb_queues) return 0; } +#define NB_RX_DESC 128 +#define NB_TX_DESC 512 +int +pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt) +{ + int i; + uint8_t nb_queues = 1; + uint8_t mt_state = 0; + struct test_pipeline *t = evt_test_priv(test); + struct rte_eth_conf port_conf = { + .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, + .max_rx_pkt_len = ETHER_MAX_LEN, + .split_hdr_size = 0, + .header_split = 0, + .hw_ip_checksum = 0, + .hw_vlan_filter = 0, + .hw_vlan_strip = 0, + .hw_vlan_extend = 0, + .jumbo_frame = 0, + .hw_strip_crc = 1, + }, + .rx_adv_conf = { + .rss_conf = { + .rss_key = NULL, + .rss_hf = ETH_RSS_IP, + }, + }, + }; + + RTE_SET_USED(opt); + if (!rte_eth_dev_count()) { + evt_err("No ethernet ports found.\n"); + return -ENODEV; + } + + for (i = 0; i < rte_eth_dev_count(); i++) { + struct rte_eth_dev_info dev_info; + + memset(&dev_info, 0, sizeof(struct rte_eth_dev_info)); + rte_eth_dev_info_get(i, &dev_info); + mt_state = !(dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_MT_LOCKFREE); + + if (rte_eth_dev_configure(i, nb_queues, nb_queues, + &port_conf) + < 0) { + evt_err("Failed to configure eth port [%d]\n", i); + return -EINVAL; + } + + if (rte_eth_rx_queue_setup(i, 0, NB_RX_DESC, + rte_socket_id(), NULL, t->pool) < 0) { + evt_err("Failed to setup eth port [%d] rx_queue: %d.\n", + i, 0); + return -EINVAL; + } + if (rte_eth_tx_queue_setup(i, 0, NB_TX_DESC, + rte_socket_id(), NULL) < 0) { + evt_err("Failed to setup eth port [%d] tx_queue: %d.\n", + i, 0); + return -EINVAL; + } + + t->mt_unsafe |= mt_state; + t->tx_buf[i] = + rte_malloc(NULL, RTE_ETH_TX_BUFFER_SIZE(BURST_SIZE), 0); + if (t->tx_buf[i] == NULL) + rte_panic("Unable to allocate Tx buffer memory."); + rte_eth_promiscuous_enable(i); + } + + return 0; +} + +void +pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt) +{ + int i; + RTE_SET_USED(test); + RTE_SET_USED(opt); + + for (i = 0; i < rte_eth_dev_count(); i++) { + rte_event_eth_rx_adapter_stop(i); + rte_eth_dev_stop(i); + rte_eth_dev_close(i); + } +} + +void +pipeline_eventdev_destroy(struct evt_test *test, struct evt_options *opt) +{ + RTE_SET_USED(test); + + rte_event_dev_stop(opt->dev_id); + rte_event_dev_close(opt->dev_id); +} + int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt) { diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h index e709a1000..204033a01 100644 --- a/app/test-eventdev/test_pipeline_common.h +++ b/app/test-eventdev/test_pipeline_common.h @@ -81,9 +81,12 @@ struct test_pipeline { int pipeline_test_result(struct evt_test *test, struct evt_options *opt); int pipeline_opt_check(struct evt_options *opt, uint64_t nb_queues); int pipeline_test_setup(struct evt_test *test, struct evt_options *opt); +int pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt); int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt); void pipeline_opt_dump(struct evt_options *opt, uint8_t nb_queues); void pipeline_test_destroy(struct evt_test *test, struct evt_options *opt); +void pipeline_eventdev_destroy(struct evt_test *test, struct evt_options *opt); +void pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt); void pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt); #endif /* _TEST_PIPELINE_COMMON_ */ -- 2.14.1