From patchwork Mon May 11 11:09:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wisam Jaddo X-Patchwork-Id: 70076 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C5185A00C5; Mon, 11 May 2020 13:10:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 56D881D147; Mon, 11 May 2020 13:09:34 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2065.outbound.protection.outlook.com [40.107.21.65]) by dpdk.org (Postfix) with ESMTP id E91B01C2A0 for ; Mon, 11 May 2020 13:09:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VHDqb7BD3dAVk23ankpM342mSwIHzSD1JUIcw3tdD84sd/yekzv++hrPmCxxp5FpTMzy4DAk1sj57faCaI+CkEFBcbLOBy6LF88JP59TbScXqQxwmNVUJcHlUIoUkWWXxwzGY8Zugordr5hmFXJsHEp+i3dWHJz/rwzxqvN4crtV+GDYA21QK4ysnb3pbEXpXMGPtc9jc64DrzexV94mUGphng8Ivt4zKOvJpC8n4ZEAIsgxfHMDfOslrl9ZmM3D9dFNHrcZlst6fArEJsfHu2/yaYZdTn13VaDI9ieaBr4wQdejwVCdyjGl1Yav4nOuB05v1lqof/FMAXe8yoZyOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iv3zPGgWA+dl+K5sQ5TI+AMO78Lau1mH+Gldt4iNTec=; b=MRo++V3rIPP4mpQEITkHpWThRSCxHpW6p7S9WO+d0dW9mnsE5mKFTtJCyZNaSeWTFidY58Yq32HeRxTo/ByXmUJg67CczqfllJaOwbcqjI2oEgDYIG2iN6Eh6ozVb3YtNBbEV0NHwWwPgHu68mXLyNB36cXo3xUrs+UxAtsVm+vTPIl4Uyl4Td7x4o9ZAvDNwLiKv3vtbd0jLWYPTygneLnWqCaQE2WACwEnWjTQaC0pxNCOpSWOhSaFnfHg/tGfrOo3BujeSZle5cTourVlNFCvWlWmk0lUUhgigwNwKnOWR9AlIKq90F8SOpY16IEqH8TH33MpNkBcd4IK2Da3pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iv3zPGgWA+dl+K5sQ5TI+AMO78Lau1mH+Gldt4iNTec=; b=iJkQd1kPoGwdnHpycT6MLV/En16P6uuBgERz/DgxDtTjUYbVnffXDw+eOWij1x0juoVJEQA1urKvMUWfXLPiFzun9p+r484fWykOsT/c754bZ2lB22DGvUU5BtMT4mTCEKfXz5/FLUAz6dqribICthalkfcy2A8l2AZlT+tq9oY= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR05MB5891.eurprd05.prod.outlook.com (2603:10a6:208:133::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.33; Mon, 11 May 2020 11:09:29 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc%6]) with mapi id 15.20.2958.035; Mon, 11 May 2020 11:09:29 +0000 From: Wisam Jaddo To: dev@dpdk.org, jackmin@mellanox.com, thomas@monjalon.net, jerinjacobk@gmail.com, ajit.khaparde@broadcom.com, arybchenko@solarflare.com Date: Mon, 11 May 2020 11:09:08 +0000 Message-Id: <20200511110912.11535-2-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511110912.11535-1-wisamm@mellanox.com> References: <20200506123627.22340-2-wisamm@mellanox.com> <20200511110912.11535-1-wisamm@mellanox.com> X-ClientProxiedBy: PR3P192CA0058.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:57::33) To AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR3P192CA0058.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:57::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.29 via Frontend Transport; Mon, 11 May 2020 11:09:29 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d3c34486-9e37-4298-7806-08d7f59bc68f X-MS-TrafficTypeDiagnostic: AM0PR05MB5891:|AM0PR05MB5891: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:270; X-Forefront-PRVS: 04004D94E2 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OXAU8nkEHLgTAsYG0MxkT11S9lqU065ALqts06lKxRY+KSFI6nFlkJib3bozDFniZRoQzbuNsjFDdh992PlAoJgaCAPAGN+/SvfH3V4+bwIRXnwIqidd6KFBSJcz268+pm6jtgQooBgeyFegqNhLIgfYRcSHnlxno1ZeVhLyFh3yoBkK4oG4XHMOABYFe0abDgqLUf/Qm4sC5sKdLHhhfwa3UJxATBXUXtZrNj3Dky0dYmYIhyrw5Bpemeod8Xc+LLx6ksjiLpHsaxuxMJOZeXJ1wvrX0Al3B3p/6XPf1cvdO82UXNrMxvRn2X/YgVPP+DCijK63OYgHcoUkmYqhWcxamHKiXPKtzT9/ttnj9OQZlXN6lMly3bDq4FIJDa0rze0zv5bVreSWMdUTPOtIS7vUtXVibcRVVKn9LFXvyz2rp4R7edZY/1YrGr6iazbBhaRt+0PD0AjCpxwlwqlHpB0avqNR1+g1WM9Xl/QWYBQQVauP2Oa/cM25NsXqoGpMRmU74+zlZSxQfOH80A5mgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6610.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(136003)(39860400002)(396003)(366004)(346002)(33430700001)(66556008)(36756003)(30864003)(478600001)(5660300002)(1076003)(33440700001)(316002)(6666004)(8886007)(2906002)(8936002)(55016002)(86362001)(66476007)(8676002)(66946007)(52116002)(26005)(2616005)(956004)(16526019)(186003)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2ywNhc32XJZkF23O6H9TdW6S3heIQrbEM/2AIfFVIOSsuJDJ/SsuxVYJkrmUf3G7mC1OjH7Ivtb3EwZN94aqMGnksCGqHgGIEruE2pEUZpXfCUrsGvvil+NRdQFAw4qZrLfF2bnt9BZCnnqcFoecuTQ8TxPyVvYJFcdd1EsX4BZgLSx0QHJPrwhmBZBl/rT4C0qouR0rDNpfBAVk802VWQ4x/y44t0gXRWM8dCmr/AH9Nd0MxSpI9WvU5aqwO5RZy5MWIX30sNwJowJvDla/YXUBxiDiXGN6+nYkB5sOPL8inhR10LYi2vOIkse51S5VGINoOc4Z756TyJCSl2v6WZpY5pyMYtMVdEYXjT1YObXhLHnO68h1jAXlsoBJiGX3UcEMJ9jPA5UYxwFV/Jvk3lqHBKtmCQx1ecjNMzeSyfye11VtxmAmFINCVpo1ECv4NMl8N9I3bnArC9T6oH3t5wpNDb+QtCEF7ekpu66y2NI= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3c34486-9e37-4298-7806-08d7f59bc68f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2020 11:09:29.8790 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m1A9i9IiLR38UAyraCt8pgEaU7EsG2KQzUl5h2jwNsQnNxDL0e58q45B+SE58FviZ34a7XOk0htMWIXiAgO3iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5891 Subject: [dpdk-dev] [PATCH v6 1/5] app/flow-perf: add flow performance skeleton 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add flow performance application skeleton. Signed-off-by: Wisam Jaddo Reviewed-By: Andrew Rybchenko --- MAINTAINERS | 5 + app/Makefile | 1 + app/meson.build | 1 + app/test-flow-perf/Makefile | 23 +++ app/test-flow-perf/config.h | 14 ++ app/test-flow-perf/main.c | 194 +++++++++++++++++++++++++ app/test-flow-perf/meson.build | 8 + config/common_base | 5 + doc/guides/rel_notes/release_20_05.rst | 4 + doc/guides/tools/flow-perf.rst | 44 ++++++ doc/guides/tools/index.rst | 1 + 11 files changed, 300 insertions(+) create mode 100644 app/test-flow-perf/Makefile create mode 100644 app/test-flow-perf/config.h create mode 100644 app/test-flow-perf/main.c create mode 100644 app/test-flow-perf/meson.build create mode 100644 doc/guides/tools/flow-perf.rst diff --git a/MAINTAINERS b/MAINTAINERS index e05c80504..7d678e15d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1506,6 +1506,11 @@ T: git://dpdk.org/next/dpdk-next-net F: app/test-pmd/ F: doc/guides/testpmd_app_ug/ +Flow performance tool +M: Wisam Jaddo +F: app/test-flow-perf +F: doc/guides/flow-perf.rst + Compression performance test application T: git://dpdk.org/next/dpdk-next-crypto F: app/test-compress-perf/ diff --git a/app/Makefile b/app/Makefile index 823771c5f..0392a7de0 100644 --- a/app/Makefile +++ b/app/Makefile @@ -10,6 +10,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += pdump DIRS-$(CONFIG_RTE_LIBRTE_ACL) += test-acl DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test-cmdline DIRS-$(CONFIG_RTE_LIBRTE_FIB) += test-fib +DIRS-$(CONFIG_RTE_TEST_FLOW_PERF) += test-flow-perf DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test-pipeline DIRS-$(CONFIG_RTE_LIBRTE_IPSEC) += test-sad diff --git a/app/meson.build b/app/meson.build index 0f7fe9464..408676b06 100644 --- a/app/meson.build +++ b/app/meson.build @@ -15,6 +15,7 @@ apps = [ 'test-crypto-perf', 'test-eventdev', 'test-fib', + 'test-flow-perf', 'test-pipeline', 'test-pmd', 'test-sad'] diff --git a/app/test-flow-perf/Makefile b/app/test-flow-perf/Makefile new file mode 100644 index 000000000..db043c17a --- /dev/null +++ b/app/test-flow-perf/Makefile @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2020 Mellanox Technologies, Ltd + +include $(RTE_SDK)/mk/rte.vars.mk + +ifeq ($(CONFIG_RTE_TEST_FLOW_PERF),y) + +# +# library name +# +APP = dpdk-test-flow-perf + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +# +# all source are stored in SRCS-y +# +SRCS-y += main.c + +include $(RTE_SDK)/mk/rte.app.mk + +endif diff --git a/app/test-flow-perf/config.h b/app/test-flow-perf/config.h new file mode 100644 index 000000000..cf41e0345 --- /dev/null +++ b/app/test-flow-perf/config.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Claus + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#define GET_RSS_HF() (ETH_RSS_IP | ETH_RSS_TCP) + +/* Configuration */ +#define RXQ_NUM 4 +#define TXQ_NUM 4 +#define TOTAL_MBUF_NUM 32000 +#define MBUF_SIZE 2048 +#define MBUF_CACHE_SIZE 512 +#define NR_RXD 256 +#define NR_TXD 256 diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c new file mode 100644 index 000000000..8659870af --- /dev/null +++ b/app/test-flow-perf/main.c @@ -0,0 +1,194 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + * + * This file contain the application main file + * This application provides the user the ability to test the + * insertion rate for specific rte_flow rule under stress state ~4M rule/ + * + * Then it will also provide packet per second measurement after installing + * all rules, the user may send traffic to test the PPS that match the rules + * after all rules are installed, to check performance or functionality after + * the stress. + * + * The flows insertion will go for all ports first, then it will print the + * results, after that the application will go into forwarding packets mode + * it will start receiving traffic if any and then forwarding it back and + * gives packet per second measurement. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "config.h" + +static uint32_t nb_lcores; +static struct rte_mempool *mbuf_mp; + +static void +usage(char *progname) +{ + printf("\nusage: %s\n", progname); +} + +static void +args_parse(int argc, char **argv) +{ + char **argvopt; + int opt; + int opt_idx; + static struct option lgopts[] = { + /* Control */ + { "help", 0, 0, 0 }, + }; + + argvopt = argv; + + while ((opt = getopt_long(argc, argvopt, "", + lgopts, &opt_idx)) != EOF) { + switch (opt) { + case 0: + if (strcmp(lgopts[opt_idx].name, "help") == 0) { + usage(argv[0]); + rte_exit(EXIT_SUCCESS, "Displayed help\n"); + } + break; + default: + fprintf(stderr, "Invalid option: %s\n", argv[optind]); + usage(argv[0]); + rte_exit(EXIT_SUCCESS, "Invalid option\n"); + break; + } + } +} + +static void +init_port(void) +{ + int ret; + uint16_t std_queue; + uint16_t port_id; + uint16_t nr_ports; + struct rte_eth_conf port_conf = { + .rx_adv_conf = { + .rss_conf.rss_hf = + GET_RSS_HF(), + } + }; + struct rte_eth_txconf txq_conf; + struct rte_eth_rxconf rxq_conf; + struct rte_eth_dev_info dev_info; + + nr_ports = rte_eth_dev_count_avail(); + if (nr_ports == 0) + rte_exit(EXIT_FAILURE, "Error: no port detected\n"); + + mbuf_mp = rte_pktmbuf_pool_create("mbuf_pool", + TOTAL_MBUF_NUM, MBUF_CACHE_SIZE, + 0, MBUF_SIZE, + rte_socket_id()); + if (mbuf_mp == NULL) + rte_exit(EXIT_FAILURE, "Error: can't init mbuf pool\n"); + + for (port_id = 0; port_id < nr_ports; port_id++) { + ret = rte_eth_dev_info_get(port_id, &dev_info); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "Error during getting device" + " (port %u) info: %s\n", + port_id, strerror(-ret)); + + port_conf.txmode.offloads &= dev_info.tx_offload_capa; + port_conf.rxmode.offloads &= dev_info.rx_offload_capa; + + printf(":: initializing port: %d\n", port_id); + + ret = rte_eth_dev_configure(port_id, RXQ_NUM, + TXQ_NUM, &port_conf); + if (ret < 0) + rte_exit(EXIT_FAILURE, + ":: cannot configure device: err=%d, port=%u\n", + ret, port_id); + + rxq_conf = dev_info.default_rxconf; + for (std_queue = 0; std_queue < RXQ_NUM; std_queue++) { + ret = rte_eth_rx_queue_setup(port_id, std_queue, NR_RXD, + rte_eth_dev_socket_id(port_id), + &rxq_conf, + mbuf_mp); + if (ret < 0) + rte_exit(EXIT_FAILURE, + ":: Rx queue setup failed: err=%d, port=%u\n", + ret, port_id); + } + + txq_conf = dev_info.default_txconf; + for (std_queue = 0; std_queue < TXQ_NUM; std_queue++) { + ret = rte_eth_tx_queue_setup(port_id, std_queue, NR_TXD, + rte_eth_dev_socket_id(port_id), + &txq_conf); + if (ret < 0) + rte_exit(EXIT_FAILURE, + ":: Tx queue setup failed: err=%d, port=%u\n", + ret, port_id); + } + + /* Catch all packets from traffic generator. */ + ret = rte_eth_promiscuous_enable(port_id); + if (ret != 0) + rte_exit(EXIT_FAILURE, + ":: promiscuous mode enable failed: err=%s, port=%u\n", + rte_strerror(-ret), port_id); + + ret = rte_eth_dev_start(port_id); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_dev_start:err=%d, port=%u\n", + ret, port_id); + + printf(":: initializing port: %d done\n", port_id); + } +} + +int +main(int argc, char **argv) +{ + int ret; + uint16_t port; + struct rte_flow_error error; + + ret = rte_eal_init(argc, argv); + if (ret < 0) + rte_exit(EXIT_FAILURE, "EAL init failed\n"); + + argc -= ret; + argv += ret; + if (argc > 1) + args_parse(argc, argv); + + init_port(); + + nb_lcores = rte_lcore_count(); + if (nb_lcores <= 1) + rte_exit(EXIT_FAILURE, "This app needs at least two cores\n"); + + RTE_ETH_FOREACH_DEV(port) { + rte_flow_flush(port, &error); + rte_eth_dev_stop(port); + rte_eth_dev_close(port); + } + return 0; +} diff --git a/app/test-flow-perf/meson.build b/app/test-flow-perf/meson.build new file mode 100644 index 000000000..25711378f --- /dev/null +++ b/app/test-flow-perf/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Mellanox Technologies, Ltd + +sources = files( + 'main.c', +) + +deps += ['ethdev'] diff --git a/config/common_base b/config/common_base index 14000ba07..b2edd5267 100644 --- a/config/common_base +++ b/config/common_base @@ -1105,6 +1105,11 @@ CONFIG_RTE_TEST_PMD=y CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n +# +# Compile the rte flow perf application +# +CONFIG_RTE_TEST_FLOW_PERF=y + # # Compile the bbdev test application # diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index b124c3f28..7abcae3aa 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -212,6 +212,10 @@ New Features * Added IPsec inbound load-distribution support for ipsec-secgw application using NIC load distribution feature(Flow Director). +* **Added flow performance application.** + + Add new application to test rte_flow performance. + Removed Items ------------- diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst new file mode 100644 index 000000000..49eb450ae --- /dev/null +++ b/doc/guides/tools/flow-perf.rst @@ -0,0 +1,44 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2020 Mellanox Technologies, Ltd + +Flow performance tool +===================== + +Application for rte_flow performance testing. + + +Compiling the Application +========================= + +The ``test-flow-perf`` application is compiled as part of the main compilation +of the DPDK libraries and tools. + +Refer to the DPDK Getting Started Guides for details. + + +Running the Application +======================= + +EAL Command-line Options +------------------------ + +Please refer to :doc:`EAL parameters (Linux) <../linux_gsg/linux_eal_parameters>` +or :doc:`EAL parameters (FreeBSD) <../freebsd_gsg/freebsd_eal_parameters>` for +a list of available EAL command-line options. + + +Flow performance Options +------------------------ + +The following are the command-line options for the flow performance application. +They must be separated from the EAL options, shown in the previous section, +with a ``--`` separator: + +.. code-block:: console + + sudo ./dpdk-test-flow-perf -n 4 -w 08:00.0 -- + +The command line options are: + +* ``--help`` + Display a help message and quit. diff --git a/doc/guides/tools/index.rst b/doc/guides/tools/index.rst index 782b30864..7279daebc 100644 --- a/doc/guides/tools/index.rst +++ b/doc/guides/tools/index.rst @@ -16,3 +16,4 @@ DPDK Tools User Guides cryptoperf comp_perf testeventdev + flow-perf