DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Wisam Jaddo <wisamm@mellanox.com>, <dev@dpdk.org>,
	<jackmin@mellanox.com>,  <thomas@monjalon.net>,
	<jerinjacobk@gmail.com>, <gerlitz.or@gmail.com>, <l.yan@epfl.ch>,
	<ajit.khaparde@broadcom.com>
Subject: Re: [dpdk-dev] [PATCH v5 1/5] app/flow-perf: add flow performance skeleton
Date: Wed, 6 May 2020 17:25:51 +0300	[thread overview]
Message-ID: <54556a1d-b30a-8032-eca9-8d84c7036f00@solarflare.com> (raw)
In-Reply-To: <20200506123627.22340-2-wisamm@mellanox.com>

On 5/6/20 3:36 PM, Wisam Jaddo wrote:
> Add flow performance application skeleton.
> 
> Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
> ---

[snip]

> diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
> new file mode 100644
> index 000000000..7a924cdb7
> --- /dev/null
> +++ b/app/test-flow-perf/main.c
> @@ -0,0 +1,200 @@
> +/* 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 <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <stdint.h>
> +#include <inttypes.h>
> +#include <stdarg.h>
> +#include <errno.h>
> +#include <getopt.h>
> +#include <signal.h>
> +#include <stdbool.h>
> +#include <sys/time.h>
> +
> +#include <rte_malloc.h>
> +#include <rte_mempool.h>
> +#include <rte_mbuf.h>
> +#include <rte_ethdev.h>
> +#include <rte_flow.h>
> +
> +#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")) {

DPDK coding style recommends to compare vs 0 instead of logical
not.

> +				usage(argv[0]);
> +				rte_exit(EXIT_SUCCESS, "Displayed help\n");
> +			}
> +			break;
> +		default:
> +			printf("Invalid option: %s\n", argv[optind]);

Again, sorry if I missed reply: Why error is not logged to
stderr?

> +			usage(argv[0]);
> +			rte_exit(EXIT_SUCCESS, "Invalid option\n");
> +			break;
> +		}
> +	}
> +}
> +
> +static void
> +init_port(void)
> +{
> +	int ret;
> +	uint16_t i;
> +	uint16_t port_id;
> +	uint16_t nr_ports;
> +	struct rte_eth_conf port_conf = {
> +		.rx_adv_conf = {
> +			.rss_conf.rss_hf =
> +				ETH_RSS_IP  |
> +				ETH_RSS_TCP,
> +		}
> +	};
> +	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;
> +		rxq_conf.offloads = port_conf.rxmode.offloads;


As far as I know there is no necessity to repeat port offlaod
on queue level. So, the line is not necesary.

> +
> +		for (i = 0; i < RXQ_NUM; i++) {
> +			ret = rte_eth_rx_queue_setup(port_id, i, 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;
> +		txq_conf.offloads = port_conf.txmode.offloads;

As far as I know there is no necessity to repeat port offlaod
on queue level. So, the line is not necesary.

> +
> +		for (i = 0; i < TXQ_NUM; i++) {
> +			ret = rte_eth_tx_queue_setup(port_id, i, 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;
> +}

[snip]

> diff --git a/config/common_base b/config/common_base
> index 14000ba07..b2edd5267 100644
> diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst
> index b124c3f28..258b1e03e 100644
> --- a/doc/guides/rel_notes/release_20_05.rst
> +++ b/doc/guides/rel_notes/release_20_05.rst
> @@ -212,6 +212,16 @@ 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.
> +
> +  Application features:
> +  * Measure rte_flow insertion rate.
> +  * Measure rte_flow deletion rate.
> +  * Dump rte_flow memory consumption.
> +  * Measure packet per second forwarding.

I think above lines should be added in appropriate patches
which really do it.

> +
>  
>  Removed Items
>  -------------

[snip]


  reply	other threads:[~2020-05-06 14:26 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 13:46 [dpdk-dev] [RFC] app/test-flow-perf: add rte_flow perf app Wisam Jaddo
2020-03-20  6:49 ` Jerin Jacob
2020-03-20 11:51   ` Thomas Monjalon
2020-03-20 12:18     ` Jerin Jacob
2020-03-23  9:53       ` Wisam Monther
2020-03-23 11:15         ` Jerin Jacob
2020-03-23 11:41           ` Wisam Monther
2020-03-23 13:00             ` Thomas Monjalon
2020-03-23 13:09               ` Wisam Monther
2020-04-09 15:42 ` [dpdk-dev] [PATCH 1/5] app/test-flow-perf: add flow performance skeleton Wisam Jaddo
2020-04-09 15:42   ` [dpdk-dev] [PATCH 2/5] app/test-flow-perf: add insertion rate calculation Wisam Jaddo
2020-04-17  2:07     ` Xiaoyu Min
2020-04-28  8:25       ` Wisam Monther
2020-04-09 15:42   ` [dpdk-dev] [PATCH 3/5] app/test-flow-perf: add deletion " Wisam Jaddo
2020-04-17  2:07     ` Xiaoyu Min
2020-04-28  8:25       ` Wisam Monther
2020-04-09 15:42   ` [dpdk-dev] [PATCH 4/5] app/test-flow-perf: add memory dump to app Wisam Jaddo
2020-04-17  2:08     ` Xiaoyu Min
2020-04-28  8:25       ` Wisam Monther
2020-04-09 15:42   ` [dpdk-dev] [PATCH 5/5] app/test-flow-perf: add packet forwarding support Wisam Jaddo
2020-04-17  2:09     ` Xiaoyu Min
2020-04-28  8:26       ` Wisam Monther
2020-04-28 14:09     ` Or Gerlitz
2020-04-29  9:49       ` Wisam Monther
2020-04-16 15:12   ` [dpdk-dev] [PATCH 1/5] app/test-flow-perf: add flow performance skeleton Wisam Monther
2020-04-17  2:05     ` Xiaoyu Min
2020-04-28  8:22       ` Wisam Monther
2020-04-30  7:08   ` [dpdk-dev] [PATCH v2 0/5] *** Introduce flow perf application *** Wisam Jaddo
2020-04-30  7:08     ` [dpdk-dev] [PATCH v2 1/5] app/test-flow-perf: add flow performance skeleton Wisam Jaddo
2020-04-30  9:32       ` [dpdk-dev] [PATCH v3 0/5] *** Introduce flow perf application *** Wisam Jaddo
2020-04-30  9:32         ` [dpdk-dev] [PATCH v3 1/5] app/test-flow-perf: add flow performance skeleton Wisam Jaddo
2020-04-30 10:33           ` [dpdk-dev] [PATCH v4 0/5] Introduce flow perf application Wisam Jaddo
2020-04-30 10:33             ` [dpdk-dev] [PATCH v4 1/5] app/test-flow-perf: add flow performance skeleton Wisam Jaddo
2020-04-30 11:59               ` Xiaoyu Min
2020-05-04 10:16               ` Andrew Rybchenko
2020-05-05 10:45                 ` Wisam Monther
2020-05-05 11:05                   ` Thomas Monjalon
2020-05-05 10:47                 ` Wisam Monther
2020-05-06  2:49                 ` Ajit Khaparde
2020-05-06  7:32                   ` Wisam Monther
2020-05-06  8:48                     ` Andrew Rybchenko
2020-05-06  8:51                       ` Wisam Monther
2020-05-06  8:54                         ` Andrew Rybchenko
2020-05-06 12:36               ` [dpdk-dev] [PATCH v5 0/5] Introduce flow perf application Wisam Jaddo
2020-05-06 12:36                 ` [dpdk-dev] [PATCH v5 1/5] app/flow-perf: add flow performance skeleton Wisam Jaddo
2020-05-06 14:25                   ` Andrew Rybchenko [this message]
2020-05-06 17:07                     ` Wisam Monther
2020-05-06 17:15                       ` Andrew Rybchenko
2020-05-11 11:08                   ` [dpdk-dev] [PATCH v6 0/5] Introduce flow perf application Wisam Jaddo
2020-05-11 11:08                     ` [dpdk-dev] [PATCH v6 1/5] app/flow-perf: add flow performance skeleton Wisam Jaddo
2020-06-04 13:34                       ` [dpdk-dev] [PATCH v7 0/5] Introduce flow perf application Wisam Jaddo
2020-06-04 13:34                         ` [dpdk-dev] [PATCH v7 1/5] app/flow-perf: add flow performance skeleton Wisam Jaddo
2020-06-04 13:34                         ` [dpdk-dev] [PATCH v7 2/5] app/flow-perf: add insertion rate calculation Wisam Jaddo
2020-06-25  7:04                           ` Wisam Monther
2020-06-04 13:35                         ` [dpdk-dev] [PATCH v7 3/5] app/flow-perf: add deletion " Wisam Jaddo
2020-06-04 13:35                         ` [dpdk-dev] [PATCH v7 4/5] app/flow-perf: add memory dump to app Wisam Jaddo
2020-06-04 13:35                         ` [dpdk-dev] [PATCH v7 5/5] app/flow-perf: add packet forwarding support Wisam Jaddo
2020-06-29 14:15                         ` [dpdk-dev] [PATCH v7 0/5] Introduce flow perf application Thomas Monjalon
2020-05-11 11:08                     ` [dpdk-dev] [PATCH v6 2/5] app/flow-perf: add insertion rate calculation Wisam Jaddo
2020-05-11 11:08                     ` [dpdk-dev] [PATCH v6 3/5] app/flow-perf: add deletion " Wisam Jaddo
2020-05-11 11:08                     ` [dpdk-dev] [PATCH v6 4/5] app/flow-perf: add memory dump to app Wisam Jaddo
2020-05-11 11:08                     ` [dpdk-dev] [PATCH v6 5/5] app/flow-perf: add packet forwarding support Wisam Jaddo
2020-05-11 11:09                   ` [dpdk-dev] [PATCH v6 0/5] Introduce flow perf application Wisam Jaddo
2020-05-11 11:09                     ` [dpdk-dev] [PATCH v6 1/5] app/flow-perf: add flow performance skeleton Wisam Jaddo
2020-05-11 12:04                       ` Andrew Rybchenko
2020-05-11 11:09                     ` [dpdk-dev] [PATCH v6 2/5] app/flow-perf: add insertion rate calculation Wisam Jaddo
2020-05-11 12:05                       ` Andrew Rybchenko
2020-05-12 10:34                         ` Wisam Monther
2020-05-12 11:07                           ` Andrew Rybchenko
2020-06-02 12:43                             ` Wisam Monther
2020-05-11 11:09                     ` [dpdk-dev] [PATCH v6 3/5] app/flow-perf: add deletion " Wisam Jaddo
2020-05-11 11:09                     ` [dpdk-dev] [PATCH v6 4/5] app/flow-perf: add memory dump to app Wisam Jaddo
2020-05-11 11:09                     ` [dpdk-dev] [PATCH v6 5/5] app/flow-perf: add packet forwarding support Wisam Jaddo
2020-05-06 12:36                 ` [dpdk-dev] [PATCH v5 2/5] app/flow-perf: add insertion rate calculation Wisam Jaddo
2020-05-06 15:23                   ` Andrew Rybchenko
2020-05-07 12:38                     ` Wisam Monther
2020-05-06 12:36                 ` [dpdk-dev] [PATCH v5 3/5] app/flow-perf: add deletion " Wisam Jaddo
2020-05-06 12:36                 ` [dpdk-dev] [PATCH v5 4/5] app/flow-perf: add memory dump to app Wisam Jaddo
2020-05-06 12:36                 ` [dpdk-dev] [PATCH v5 5/5] app/flow-perf: add packet forwarding support Wisam Jaddo
2020-05-06 12:50                 ` [dpdk-dev] [PATCH v5 0/5] Introduce flow perf application Thomas Monjalon
2020-04-30 10:33             ` [dpdk-dev] [PATCH v4 2/5] app/test-flow-perf: add insertion rate calculation Wisam Jaddo
2020-04-30 12:00               ` Xiaoyu Min
2020-05-04 12:01               ` Andrew Rybchenko
2020-05-06  4:00               ` Ajit Khaparde
2020-05-06 12:33                 ` Wisam Monther
2020-04-30 10:33             ` [dpdk-dev] [PATCH v4 3/5] app/test-flow-perf: add deletion " Wisam Jaddo
2020-04-30 12:02               ` Xiaoyu Min
2020-04-30 10:33             ` [dpdk-dev] [PATCH v4 4/5] app/test-flow-perf: add memory dump to app Wisam Jaddo
2020-04-30 12:03               ` Xiaoyu Min
2020-05-06  4:10               ` Ajit Khaparde
2020-04-30 10:33             ` [dpdk-dev] [PATCH v4 5/5] app/test-flow-perf: add packet forwarding support Wisam Jaddo
2020-04-30 12:05               ` Xiaoyu Min
2020-05-04  7:12             ` [dpdk-dev] [PATCH v4 0/5] Introduce flow perf application Thomas Monjalon
2020-04-30  9:32         ` [dpdk-dev] [PATCH v3 2/5] app/test-flow-perf: add insertion rate calculation Wisam Jaddo
2020-04-30  9:32         ` [dpdk-dev] [PATCH v3 3/5] app/test-flow-perf: add deletion " Wisam Jaddo
2020-04-30  9:32         ` [dpdk-dev] [PATCH v3 4/5] app/test-flow-perf: add memory dump to app Wisam Jaddo
2020-04-30  9:32         ` [dpdk-dev] [PATCH v3 5/5] app/test-flow-perf: add packet forwarding support Wisam Jaddo
2020-04-30  7:08     ` [dpdk-dev] [PATCH v2 2/5] app/test-flow-perf: add insertion rate calculation Wisam Jaddo
2020-04-30  7:08     ` [dpdk-dev] [PATCH v2 3/5] app/test-flow-perf: add deletion " Wisam Jaddo
2020-04-30  7:08     ` [dpdk-dev] [PATCH v2 4/5] app/test-flow-perf: add memory dump to app Wisam Jaddo
2020-04-30  7:08     ` [dpdk-dev] [PATCH v2 5/5] app/test-flow-perf: add packet forwarding support Wisam Jaddo
2020-05-06  3:00   ` [dpdk-dev] [PATCH 1/5] app/test-flow-perf: add flow performance skeleton Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54556a1d-b30a-8032-eca9-8d84c7036f00@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=gerlitz.or@gmail.com \
    --cc=jackmin@mellanox.com \
    --cc=jerinjacobk@gmail.com \
    --cc=l.yan@epfl.ch \
    --cc=thomas@monjalon.net \
    --cc=wisamm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).