From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0062.outbound.protection.outlook.com [104.47.41.62]) by dpdk.org (Postfix) with ESMTP id 6CE7D1B1A4 for ; Tue, 16 Jan 2018 16:18: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=O0eZ7WqsnJj5mhjtSsOAwiZZDBWJy5emH4aEh6yqt9U=; b=HjxKKI87gV4Lo4FV45WFzuG75DM4rSpN9GLS+EjNR+F8bQRroIE+pGAY4+llADssaxeYLggr6yPmuYlbXQriD29i0rehSEWogVFhNz5yqzS8Xz4sRvnnIzVem+IB32G0pRv5XwzaE/swjkwbH2wVhWUxw/aO84+pv7zlzvDRsy8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (111.93.218.67) by MWHPR07MB3469.namprd07.prod.outlook.com (10.164.192.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Tue, 16 Jan 2018 15:18:26 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.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, 16 Jan 2018 20:47:20 +0530 Message-Id: <20180116151728.566-5-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180116151728.566-1-pbhagavatula@caviumnetworks.com> References: <20171130072406.15605-1-pbhagavatula@caviumnetworks.com> <20180116151728.566-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MWHPR21CA0059.namprd21.prod.outlook.com (10.172.93.149) To MWHPR07MB3469.namprd07.prod.outlook.com (10.164.192.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75e50828-265e-426a-43ae-08d55cf46581 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:MWHPR07MB3469; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3469; 3:oFvqQDuCrp4Cba2vOhQSvwWtPcsRM23TBL9jO+Fom3+tj0UnsnRcVmNCsIEDGsJ7fhxYvtd7OUwYZnQGInJViOWdUxvALFYRUSowZPOrqAjm8s2d8DW5ATPiqdUbO+hEip19wzRRAzuQG904Z1jxLZtkB4g8PJClhTH1YKFjNiRZCpGuA+DDsRHcJrtIkrtHqvzkfJKJ2kj2ZBeIoygL4yDCwgR3oaaXWb1vYGuuqaP2JnTfdxsthYS15iYH8+pM; 25:LDzwOq1uFsrE6UOFfvyPAbf8qB6RijXs+5EyYAp79EUDVXJD31CmUzO+eG35iMxcV2G278y4BSMsL76xXmS+NU70Ih1Y0cxsdgHH6B4BL33pkk8ofz/8wQ5UoTb23hcTLre88FWOhKLyQAsVtWD7vQe3GPCHC4z3d7ro515wkP3s5Muvje2WIIQdeahpDH0fALQHa2wMxO74ImB55VH8PYsALQoR5Lrw/AH8OlQLkcc9onCKqTm2eKqFw/XavsUhFElf9gkxMc77ZG2ZTf6VOSm4RA0h9Iby1p8PxnkabLdi+BAu1KscMJGwPp8VZz7HAoaroIxR/03bfUoxT364TQ==; 31:2uDyX78mWN1iM3RA+mJC2GuEHLXfV1VMbI3fxdcnYiiWTqcOuwbEjsK0bp+iz/IncajlqkC48ikMD/CbrInLpUBbbDPqI6tHMnyZ7U1XGS277E4gmCOJ0DrOgjrUyFMWjB+i0Z35fqjAX1GsGHe8+XoaQJQJHvIqn4LDJ6P2Ru7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Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(3231023)(944501161)(93006095)(10201501046)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:MWHPR07MB3469; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR07MB3469; X-Forefront-PRVS: 0554B1F54F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(376002)(39380400002)(39860400002)(51234002)(199004)(189003)(2950100002)(4326008)(42882006)(5009440100003)(6666003)(107886003)(25786009)(68736007)(16526018)(72206003)(478600001)(316002)(5660300001)(16586007)(26005)(50226002)(53936002)(7736002)(305945005)(36756003)(53416004)(6116002)(81166006)(8656006)(69596002)(8676002)(6512007)(81156014)(8936002)(97736004)(386003)(6506007)(50466002)(66066001)(76176011)(59450400001)(52116002)(51416003)(2906002)(47776003)(48376002)(106356001)(3846002)(1076002)(105586002)(6486002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3469; H:Pavan-LT.caveonetworks.com; 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; MWHPR07MB3469; 23:f3OPWb0sxuq95KUfRQUnTQv2ZFC6aU02HYkMFSmAw?= =?us-ascii?Q?EbO0CH16aAN/thdJ7GPz8I1ehkj4RvRMGy40yBxBPIqGHQuYsKP2bJPNumiV?= =?us-ascii?Q?rFaPPkFwGduJff7rY5zcXeadSNW9Djp1DVwKf20opA4RLVS77f4NPG+9+f0f?= =?us-ascii?Q?KrAXIIewg0A/fzaxpH+Y03PrJ9Lr361XoN/6CKCEszxN7OjGL+GtIBIE0u/m?= =?us-ascii?Q?uBuoiJYn3rXfLUD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feCL4/AnYccsQNsPPwXOvkWJFAaVSJetXlcZ9O7qCW/tp4nwpLhlx+2oXYkq9Q2I050YvrX49MYuLmvKA76WA+wtd18v9kdL0PX72ej9OR0rGRwbFAQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 15:18:26.3944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 75e50828-265e-426a-43ae-08d55cf46581 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3469 Subject: [dpdk-dev] [PATCH v5 05/14] app/eventdev: add pipeline 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: Tue, 16 Jan 2018 15:18:31 -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 | 91 ++++++++++++++++++++++++++++++++ app/test-eventdev/test_pipeline_common.h | 3 ++ 2 files changed, 94 insertions(+) diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index 45e0652b8..c20815c25 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -89,6 +89,97 @@ 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_rxconf rx_conf; + struct rte_eth_conf port_conf = { + .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, + .max_rx_pkt_len = ETHER_MAX_LEN, + .offloads = DEV_RX_OFFLOAD_CRC_STRIP, + .ignore_offload_bitfield = 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); + rx_conf = dev_info.default_rxconf; + rx_conf.offloads = port_conf.rxmode.offloads; + + 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(), &rx_conf, 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; + 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 6e43eea2b..d8ab797bb 100644 --- a/app/test-eventdev/test_pipeline_common.h +++ b/app/test-eventdev/test_pipeline_common.h @@ -54,9 +54,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