DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@nvidia.com>
To: Haifei Luo <haifeil@nvidia.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Slava Ovsiienko <viacheslavo@nvidia.com>,
	Raslan Darawsheh <rasland@nvidia.com>,
	"Xueming(Steven) Li" <xuemingl@nvidia.com>,
	Haifei Luo <haifeil@nvidia.com>,
	Xiaoyun Li <xiaoyun.li@intel.com>, Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	NBU-Contact-Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [dpdk-dev] [PATCH v2 1/5] ethdev: modify rte API for single flow dump
Date: Mon, 12 Apr 2021 19:33:02 +0000	[thread overview]
Message-ID: <DM6PR12MB49871036154C19B063B7A0B5D6709@DM6PR12MB4987.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1617775762-171898-2-git-send-email-haifeil@nvidia.com>

Hi Haifei,

> -----Original Message-----
> From: Haifei Luo <haifeil@nvidia.com>
> Sent: Wednesday, April 7, 2021 9:09 AM
> <andrew.rybchenko@oktetlabs.ru>
> Subject: [PATCH v2 1/5] ethdev: modify rte API for single flow dump
> 
> Previous implementations support dump all the flows. Add new arg
> rte_flow in rte_flow_dev_dump to dump one flow.
> 
> Signed-off-by: Haifei Luo <haifeil@nvidia.com>
> ---
>  app/test-pmd/config.c                |  2 +-
>  doc/guides/nics/mlx5.rst             |  9 ++++++---
>  doc/guides/prog_guide/rte_flow.rst   | 24 ++++++++++++++++++++++++
>  drivers/net/mlx5/linux/mlx5_socket.c |  2 +-
>  drivers/net/mlx5/mlx5.h              |  4 ++--
>  drivers/net/mlx5/mlx5_flow.c         |  9 ++++++---
>  drivers/net/octeontx2/otx2_flow.c    |  9 ++++++++-
>  lib/librte_ethdev/rte_flow.c         |  5 +++--
>  lib/librte_ethdev/rte_flow.h         |  5 ++++-
>  lib/librte_ethdev/rte_flow_driver.h  |  1 +
>  10 files changed, 56 insertions(+), 14 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index ef0b978..2bfa8fa 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1931,7 +1931,7 @@ struct rte_flow_shared_action *
>  			return -errno;
>  		}
>  	}
> -	ret = rte_flow_dev_dump(port_id, file, &error);
> +	ret = rte_flow_dev_dump(port_id, NULL, file, &error);
>  	if (ret) {
>  		port_flow_complain(&error);
>  		printf("Failed to dump flow: %s\n", strerror(-ret));
> diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
> index 8703435..17e6ada 100644
> --- a/doc/guides/nics/mlx5.rst
> +++ b/doc/guides/nics/mlx5.rst
> @@ -1829,13 +1829,16 @@ all flows with assistance of external tools.
> 
>     .. code-block:: console
> 
> -       testpmd> flow dump <port> <output_file>
> +       To dump all flows:
> +       testpmd> flow dump <port> all <output_file>
> +       and dump one flow:
> +       testpmd> flow dump <port> rule <rule_id> <output_file>
> 
>     - call rte_flow_dev_dump api:
> 
>     .. code-block:: console
> 
> -       rte_flow_dev_dump(port, file, NULL);
> +       rte_flow_dev_dump(port, flow, file, NULL);
> 
>  #. Dump human-readable flows from raw file:
> 
> @@ -1843,4 +1846,4 @@ all flows with assistance of external tools.
> 
>     .. code-block:: console
> 
> -       mlx_steering_dump.py -f <output_file>
> +       mlx_steering_dump.py -f <output_file> -flowptr <flow_ptr>
> diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> index aec2ba1..3bff7c3 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -3018,6 +3018,30 @@ Return values:
> 
>  - 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
> 
> +Dump
> +~~~~~
> +
> +Dump information for all or one flows.
> +
> +.. code-block:: c
> +
> +   int
> +   rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
> +                     FILE *file,
> +                     struct rte_flow_error *error);
> +
> +Arguments:
> +
> +- ``port_id``: port identifier of Ethernet device.
> +- ``flow``: flow rule handle to dump. NULL to dump all.
> +- ``file``: a pointer to a file for output
> +- ``error``: perform verbose error reporting if not NULL. PMDs initialize
> +  this structure in case of error only.
> +
> +Return values:
> +
> +- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
> +
>  Query
>  ~~~~~
> 
> diff --git a/drivers/net/mlx5/linux/mlx5_socket.c
> b/drivers/net/mlx5/linux/mlx5_socket.c
> index b1f41bc..6e354f4 100644
> --- a/drivers/net/mlx5/linux/mlx5_socket.c
> +++ b/drivers/net/mlx5/linux/mlx5_socket.c
> @@ -84,7 +84,7 @@
>  	}
>  	/* Dump flow. */
>  	dev = &rte_eth_devices[port_id];
> -	ret = mlx5_flow_dev_dump(dev, file, NULL);
> +	ret = mlx5_flow_dev_dump(dev, NULL, file, NULL);
>  	/* Set-up the ancillary data and reply. */
>  	msg.msg_controllen = 0;
>  	msg.msg_control = NULL;
> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
> index 6faba4f..d0b7908 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -1245,8 +1245,8 @@ void mlx5_flow_async_pool_query_handle(struct
> mlx5_dev_ctx_shared *sh,
>  void mlx5_counter_free(struct rte_eth_dev *dev, uint32_t cnt);
>  int mlx5_counter_query(struct rte_eth_dev *dev, uint32_t cnt,
>  		       bool clear, uint64_t *pkts, uint64_t *bytes);
> -int mlx5_flow_dev_dump(struct rte_eth_dev *dev, FILE *file,
> -		       struct rte_flow_error *error);
> +int mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow,
> +			FILE *file, struct rte_flow_error *error);
>  void mlx5_flow_rxq_dynf_metadata_set(struct rte_eth_dev *dev);
>  int mlx5_flow_get_aged_flows(struct rte_eth_dev *dev, void **contexts,
>  			uint32_t nb_contexts, struct rte_flow_error *error);
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index c347f81..bce6ab2 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -7170,7 +7170,7 @@ struct mlx5_meter_domains_infos *
>   *   0 on success, a nagative value otherwise.
>   */
>  int
> -mlx5_flow_dev_dump(struct rte_eth_dev *dev,
> +mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow_idx,
>  		   FILE *file,
>  		   struct rte_flow_error *error __rte_unused)
>  {
> @@ -7182,8 +7182,11 @@ struct mlx5_meter_domains_infos *
>  			return -errno;
>  		return -ENOTSUP;
>  	}
> -	return mlx5_devx_cmd_flow_dump(sh->fdb_domain, sh->rx_domain,
> -				       sh->tx_domain, file);
> +
> +	if (!flow_idx)
> +		return mlx5_devx_cmd_flow_dump(sh->fdb_domain,
> +				sh->rx_domain, sh->tx_domain, file);
> +	return -ENOTSUP;
>  }
> 
>  /**
> diff --git a/drivers/net/octeontx2/otx2_flow.c
> b/drivers/net/octeontx2/otx2_flow.c
> index 14ac9bc..1c90d75 100644
> --- a/drivers/net/octeontx2/otx2_flow.c
> +++ b/drivers/net/octeontx2/otx2_flow.c
> @@ -807,7 +807,7 @@
> 
>  static int
>  otx2_flow_dev_dump(struct rte_eth_dev *dev,
> -		  FILE *file,
> +		  struct rte_flow *flow, FILE *file,
>  		  struct rte_flow_error *error)
>  {
>  	struct otx2_eth_dev *hw = dev->data->dev_private;
> @@ -822,6 +822,13 @@
>  				   "Invalid file");
>  		return -EINVAL;
>  	}
> +	if (flow != NULL) {
> +		rte_flow_error_set(error, EINVAL,
> +				   RTE_FLOW_ERROR_TYPE_HANDLE,
> +				   NULL,
> +				   "Invalid argument");
> +		return -EINVAL;
> +	}
> 
>  	max_prio = hw->npc_flow.flow_max_priority;
> 
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index e07e617..7241f00 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -1027,7 +1027,8 @@ enum rte_flow_conv_item_spec_type {
>  }
> 
>  int
> -rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error *error)
> +rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
> +			FILE *file, struct rte_flow_error *error)
>  {
>  	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
>  	const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
> @@ -1037,7 +1038,7 @@ enum rte_flow_conv_item_spec_type {
>  		return -rte_errno;
>  	if (likely(!!ops->dev_dump)) {
>  		fts_enter(dev);
> -		ret = ops->dev_dump(dev, file, error);
> +		ret = ops->dev_dump(dev, flow, file, error);
>  		fts_exit(dev);
>  		return flow_err(port_id, ret, error);
>  	}
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 6cc5713..a763af5 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -3232,6 +3232,8 @@ enum rte_flow_conv_op {
>   *
>   * @param[in] port_id
>   *    The port identifier of the Ethernet device.
> + * @param[in] flow
> + *   The pointer of rte flow.
>   * @param[in] file
>   *   A pointer to a file for output.
>   * @param[out] error
> @@ -3242,7 +3244,8 @@ enum rte_flow_conv_op {
>   */
>  __rte_experimental
>  int
> -rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error *error);
> +rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
> +		FILE *file, struct rte_flow_error *error);
> 
>  /**
>   * Check if mbuf dynamic field for metadata is registered.
> diff --git a/lib/librte_ethdev/rte_flow_driver.h
> b/lib/librte_ethdev/rte_flow_driver.h
> index da594d9..6ae1f8c 100644
> --- a/lib/librte_ethdev/rte_flow_driver.h
> +++ b/lib/librte_ethdev/rte_flow_driver.h
> @@ -75,6 +75,7 @@ struct rte_flow_ops {
>  	/** See rte_flow_dev_dump(). */
>  	int (*dev_dump)
>  		(struct rte_eth_dev *dev,
> +		 struct rte_flow *flow,
>  		 FILE *file,
>  		 struct rte_flow_error *error);
>  	/** See rte_flow_get_aged_flows() */
> --
> 1.8.3.1

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

  reply	other threads:[~2021-04-12 19:33 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  8:15 [dpdk-dev] [PATCH 0/4] *** Support for one flow dump *** Haifei Luo
2021-03-09  8:15 ` [dpdk-dev] [PATCH 1/4] ethdev: add rte API for single flow dump Haifei Luo
2021-03-10  0:39   ` Stephen Hemminger
2021-03-10  7:05   ` Ori Kam
2021-03-09  8:15 ` [dpdk-dev] [PATCH 2/4] app/testpmd: add CLIs for single flow dump feature Haifei Luo
2021-03-09  8:15 ` [dpdk-dev] [PATCH 3/4] common/mlx5: add mlx5 APIs " Haifei Luo
2021-03-09  8:15 ` [dpdk-dev] [PATCH 4/4] net/mlx5: " Haifei Luo
2021-04-07  6:09 ` [dpdk-dev] [PATCH v2 0/5] support single flow dump Haifei Luo
2021-04-07  6:09   ` [dpdk-dev] [PATCH v2 1/5] ethdev: modify rte API for " Haifei Luo
2021-04-12 19:33     ` Ori Kam [this message]
2021-04-13  4:38     ` Ajit Khaparde
2021-04-07  6:09   ` [dpdk-dev] [PATCH v2 2/5] app/testpmd: add CLIs for single flow dump feature Haifei Luo
2021-04-13 16:36     ` Ajit Khaparde
2021-04-07  6:09   ` [dpdk-dev] [PATCH v2 3/5] common/mlx5: add mlx5 APIs " Haifei Luo
2021-04-12  7:32     ` Slava Ovsiienko
2021-04-13 16:44     ` Kinsella, Ray
2021-04-14  2:40       ` Haifei Luo
2021-04-14  6:21         ` David Marchand
2021-04-14  6:23           ` Haifei Luo
2021-04-07  6:09   ` [dpdk-dev] [PATCH v2 4/5] net/mlx5: " Haifei Luo
2021-04-12  7:29     ` Slava Ovsiienko
2021-04-12  7:37     ` Slava Ovsiienko
2021-04-13  1:29       ` Haifei Luo
2021-04-13  7:22         ` Haifei Luo
2021-04-13  7:39           ` Slava Ovsiienko
2021-04-07  6:09   ` [dpdk-dev] [PATCH v2 5/5] doc: add single flow dump to guides Haifei Luo
2021-04-14  6:13 ` [dpdk-dev] [PATCH v3 0/3] support single flow dump Haifei Luo
2021-04-14  6:13   ` [dpdk-dev] [PATCH v3 1/3] ethdev: modify rte API for " Haifei Luo
2021-04-14  6:13   ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: add CLIs for single flow dump feature Haifei Luo
2021-04-14  6:13   ` [dpdk-dev] [PATCH v3 3/3] doc: add single flow dump to guides Haifei Luo
2021-04-14  8:23     ` Ferruh Yigit
2021-04-14  8:25       ` Haifei Luo
2021-04-14 10:00       ` Haifei Luo
2021-04-14  8:41 ` [dpdk-dev] [PATCH v4 0/3] support single flow dump Haifei Luo
2021-04-14  8:41   ` [dpdk-dev] [PATCH v4 1/3] ethdev: modify rte API for " Haifei Luo
2021-04-14  8:57     ` Thomas Monjalon
2021-04-14  9:10       ` Haifei Luo
2021-04-14  9:01     ` Thomas Monjalon
2021-04-14  9:07       ` Haifei Luo
2021-04-14  9:31         ` Thomas Monjalon
2021-04-14  8:41   ` [dpdk-dev] [PATCH v4 2/3] app/testpmd: add CLIs for single flow dump feature Haifei Luo
2021-04-14  8:41   ` [dpdk-dev] [PATCH v4 3/3] doc: add single flow dump to guides Haifei Luo
2021-04-14  9:15     ` Ferruh Yigit
2021-04-14  9:51 ` [dpdk-dev] [PATCH v5 0/3] support single flow dump Haifei Luo
2021-04-14  9:51   ` [dpdk-dev] [PATCH v5 1/3] ethdev: dump single flow rule Haifei Luo
2021-04-14 10:33     ` Thomas Monjalon
2021-04-14 10:37       ` Haifei Luo
2021-04-14  9:51   ` [dpdk-dev] [PATCH v5 2/3] app/testpmd: add CLIs for single flow dump feature Haifei Luo
2021-04-14  9:51   ` [dpdk-dev] [PATCH v5 3/3] doc: add single flow dump to guides Haifei Luo
2021-04-14 10:19 ` [dpdk-dev] [PATCH v6 0/2] single flow dump Haifei Luo
2021-04-14 10:19   ` [dpdk-dev] [PATCH v6 1/2] ethdev: dump single flow rule Haifei Luo
2021-04-14 10:20   ` [dpdk-dev] [PATCH v6 2/2] app/testpmd: add CLIs for single flow dump feature Haifei Luo
2021-04-14 11:26   ` [dpdk-dev] [PATCH v6 0/2] single flow dump Ferruh Yigit

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=DM6PR12MB49871036154C19B063B7A0B5D6709@DM6PR12MB4987.namprd12.prod.outlook.com \
    --to=orika@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=haifeil@nvidia.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=matan@nvidia.com \
    --cc=ndabilpuram@marvell.com \
    --cc=rasland@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    --cc=xiaoyun.li@intel.com \
    --cc=xuemingl@nvidia.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).