From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Dmitry Kozlyuk <dkozlyuk@nvidia.com>, dev@dpdk.org
Cc: Ori Kam <orika@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>,
Ferruh Yigit <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart
Date: Mon, 1 Nov 2021 18:02:43 +0300 [thread overview]
Message-ID: <5cd151fd-b39d-3cd4-39e4-36f4726300aa@oktetlabs.ru> (raw)
In-Reply-To: <20211021063503.3632732-2-dkozlyuk@nvidia.com>
On 10/21/21 9:34 AM, Dmitry Kozlyuk wrote:
> Previously, it was not specified what happens to the flow rules
> when the device is stopped, possibly reconfigured, then started.
> If flow rules were kept, it could be convenient for application
> developers, because they wouldn't need to save and restore them.
> However, due to the number of flows and possible creation rate it is
> impractical to save all flow rules in DPDK layer. This means that flow
> rules persistence really depends on whether PMD and HW can implement it
> efficiently. It can also be limited by the rule item and action types,
> and its attributes transfer bit (a combination of an item/action type
> and a value of the transfer bit is called a ruel feature).
>
> Add a device capability bit for PMDs that can keep at least some
> of the flow rules across restart. Without this capability behavior
> is still unspecified and it is declared that the application must
> flush the rules before stopping the device.
> Allow the application to test for persistence of rules using
> a particular feature by attempting to create a flow rule
> using that feature when the device is stopped
> and checking for the specific error.
> This is logical because if the PMD can to create the flow rule
> when the device is not started and use it after the start happens,
> it is natural that it can move its internal flow rule object
> to the same state when the device is stopped and restore the state
> when the device is started.
>
> Rule persistence across a reconfigurations is not required,
> because tracking all the rules and configuration-dependent resources
> they use may be infeasible. In case a PMD cannot keep the rules
> across reconfiguration, it is allowed just to report an error.
> Application must then flush the rules before attempting it.
>
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
with some review notes below
> ---
> doc/guides/prog_guide/rte_flow.rst | 31 ++++++++++++++++++++++++++++++
> lib/ethdev/rte_ethdev.h | 7 +++++++
> lib/ethdev/rte_flow.h | 1 +
> 3 files changed, 39 insertions(+)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index aeba374182..9beaae3df3 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -87,6 +87,37 @@ To avoid resource leaks on the PMD side, handles must be explicitly
> destroyed by the application before releasing associated resources such as
> queues and ports.
>
> +When the device is stopped, its rules do not process the traffic.
> +In particular, transfer rules created using some device
> +stop affecting the traffic even if they refer to different ports.
> +
> +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised,
> +rules cannot be created until the device is started for the first time
> +and cannot be kept when the device is stopped.
> +However, PMD also does not flush them automatically on stop,
> +so the application must call ``rte_flow_flush()`` or ``rte_flow_destroy()``
> +before stopping the device to ensure no rules remain.
> +
> +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is advertised, this means
> +the PMD can keep at least some rules across the device stop and start.
> +However, ``rte_eth_dev_configure()`` may fail if any rules remain,
> +so the application must flush them before attempting a reconfiguration.
> +Keeping may be unsupported for some types of rule items and actions,
> +as well as depending on the value of flow attributes transfer bit.
> +A combination of a single an item or action type
> +and a value of the transfer bit is called a rule feature.
> +For example: a COUNT action with the transfer bit set.
> +To test if rules with a particular feature are kept, the application must try
> +to create a valid rule using this feature when the device is not started
> +(either before the first start or after a stop).
> +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``,
> +all rules using this feature must be flushed by the application
> +before stopping the device.
> +If it succeeds, such rules will be kept when the device is stopped,
> +provided they do not use other features that are not supported.
> +Rules that are created when the device is stopped, including the rules
> +created for the test, will be kept after the device is started.
> +
> The following sections cover:
>
> - **Attributes** (represented by ``struct rte_flow_attr``): properties of a
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 014270d316..9cf23fecce 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -90,6 +90,11 @@
> * - flow director filtering mode (but not filtering rules)
> * - NIC queue statistics mappings
> *
> + * The following configuration may be retained or not
> + * depending on the device capabilities:
> + *
> + * - flow rules
> + *
> * Any other configuration will not be stored and will need to be re-entered
> * before a call to rte_eth_dev_start().
> *
> @@ -1445,6 +1450,8 @@ struct rte_eth_conf {
> #define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001
> /** Device supports Tx queue setup after device started. */
> #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002
> +/** Device supports keeping flow rules across restart. */
> +#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004
RTE_BIT64(2) since previous two are already defined using RTE_BIT32()
in next-net
Don't we need an experimental markup in the documentation to
make it possible to refine the future in the nearest future
without API breakage? If yes, it must be mentioned in the
rte_flow.rst documentation as well.
> /**@}*/
>
> /*
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index 2b6efeef8c..16ef33819b 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -3676,6 +3676,7 @@ enum rte_flow_error_type {
> RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
> RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
> RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
> + RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */
> };
>
> /**
>
next prev parent reply other threads:[~2021-11-01 15:02 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 0:52 [dpdk-dev] [PATCH 0/5] Flow entites behavior on port restart dkozlyuk
2021-10-05 0:52 ` [dpdk-dev] [PATCH 1/5] ethdev: add capability to keep flow rules on restart dkozlyuk
2021-10-06 6:15 ` Ori Kam
2021-10-06 6:55 ` Somnath Kotur
2021-10-06 17:15 ` Ajit Khaparde
2021-10-05 0:52 ` [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects " dkozlyuk
2021-10-06 6:16 ` Ori Kam
2021-10-13 8:32 ` Dmitry Kozlyuk
2021-10-14 13:46 ` Ferruh Yigit
2021-10-14 21:45 ` Dmitry Kozlyuk
2021-10-14 21:48 ` Dmitry Kozlyuk
2021-10-15 11:46 ` Ferruh Yigit
2021-10-15 12:35 ` Dmitry Kozlyuk
2021-10-15 16:26 ` Ferruh Yigit
2021-10-16 20:32 ` Dmitry Kozlyuk
2021-10-18 8:42 ` Ferruh Yigit
2021-10-18 11:13 ` Dmitry Kozlyuk
2021-10-18 11:59 ` Ferruh Yigit
2021-10-14 14:14 ` Dmitry Kozlyuk
2021-10-15 8:26 ` Andrew Rybchenko
2021-10-15 9:04 ` Dmitry Kozlyuk
2021-10-15 9:36 ` Andrew Rybchenko
2021-10-05 0:52 ` [dpdk-dev] [PATCH 3/5] net/mlx5: discover max flow priority using DevX dkozlyuk
2021-10-05 0:52 ` [dpdk-dev] [PATCH 4/5] net/mlx5: create drop queue " dkozlyuk
2021-10-05 0:52 ` [dpdk-dev] [PATCH 5/5] net/mlx5: preserve indirect actions on restart dkozlyuk
2021-10-15 16:18 ` [dpdk-dev] [PATCH v2 0/5] Flow entites behavior on port restart Dmitry Kozlyuk
2021-10-15 16:18 ` [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restart Dmitry Kozlyuk
2021-10-18 8:56 ` Andrew Rybchenko
2021-10-19 12:38 ` Dmitry Kozlyuk
2021-10-18 13:06 ` Zhang, Qi Z
2021-10-18 22:51 ` Dmitry Kozlyuk
2021-10-19 1:00 ` Zhang, Qi Z
2021-10-15 16:18 ` [dpdk-dev] [PATCH v2 2/5] ethdev: add capability to keep shared objects " Dmitry Kozlyuk
2021-10-17 8:10 ` Ori Kam
2021-10-17 9:14 ` Dmitry Kozlyuk
2021-10-17 9:45 ` Ori Kam
2021-10-15 16:18 ` [dpdk-dev] [PATCH v2 3/5] net/mlx5: discover max flow priority using DevX Dmitry Kozlyuk
2021-10-15 16:18 ` [dpdk-dev] [PATCH v2 4/5] net/mlx5: create drop queue " Dmitry Kozlyuk
2021-10-15 16:18 ` [dpdk-dev] [PATCH v2 5/5] net/mlx5: preserve indirect actions on restart Dmitry Kozlyuk
2021-10-19 12:37 ` [dpdk-dev] [PATCH v3 0/6] Flow entites behavior on port restart Dmitry Kozlyuk
2021-10-19 12:37 ` [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart Dmitry Kozlyuk
2021-10-19 15:22 ` Ori Kam
2021-10-19 16:38 ` Ferruh Yigit
2021-10-19 17:13 ` Dmitry Kozlyuk
2021-10-20 10:39 ` Andrew Rybchenko
2021-10-20 11:40 ` Dmitry Kozlyuk
2021-10-20 13:40 ` Ori Kam
2021-10-19 12:37 ` [dpdk-dev] [PATCH v3 2/6] ethdev: add capability to keep shared objects " Dmitry Kozlyuk
2021-10-19 15:22 ` Ori Kam
2021-10-19 12:37 ` [dpdk-dev] [PATCH v3 3/6] net: advertise no support for keeping flow rules Dmitry Kozlyuk
2021-10-20 10:08 ` Andrew Rybchenko
2021-10-20 22:20 ` Dmitry Kozlyuk
2021-10-19 12:37 ` [dpdk-dev] [PATCH v3 4/6] net/mlx5: discover max flow priority using DevX Dmitry Kozlyuk
2021-10-19 12:37 ` [dpdk-dev] [PATCH v3 5/6] net/mlx5: create drop queue " Dmitry Kozlyuk
2021-10-19 12:37 ` [dpdk-dev] [PATCH v3 6/6] net/mlx5: preserve indirect actions on restart Dmitry Kozlyuk
2021-10-20 10:12 ` [dpdk-dev] [PATCH v3 0/6] Flow entites behavior on port restart Andrew Rybchenko
2021-10-20 13:21 ` Dmitry Kozlyuk
2021-10-21 6:34 ` [dpdk-dev] [PATCH v4 " Dmitry Kozlyuk
2021-10-21 6:34 ` [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart Dmitry Kozlyuk
2021-10-21 7:36 ` Ori Kam
2021-10-28 18:33 ` Ajit Khaparde
2021-11-01 15:02 ` Andrew Rybchenko [this message]
2021-11-01 15:56 ` Dmitry Kozlyuk
2021-10-21 6:34 ` [dpdk-dev] [PATCH v4 2/6] ethdev: add capability to keep shared objects " Dmitry Kozlyuk
2021-10-21 7:37 ` Ori Kam
2021-10-21 18:28 ` Ajit Khaparde
2021-11-01 15:04 ` Andrew Rybchenko
2021-10-21 6:35 ` [dpdk-dev] [PATCH v4 3/6] net: advertise no support for keeping flow rules Dmitry Kozlyuk
2021-10-21 18:26 ` Ajit Khaparde
2021-10-22 1:38 ` Somnath Kotur
2021-10-27 7:11 ` Hyong Youb Kim (hyonkim)
2021-11-01 15:06 ` Andrew Rybchenko
2021-11-01 16:59 ` Ferruh Yigit
2021-10-21 6:35 ` [dpdk-dev] [PATCH v4 4/6] net/mlx5: discover max flow priority using DevX Dmitry Kozlyuk
2021-10-21 6:35 ` [dpdk-dev] [PATCH v4 5/6] net/mlx5: create drop queue " Dmitry Kozlyuk
2021-10-21 6:35 ` [dpdk-dev] [PATCH v4 6/6] net/mlx5: preserve indirect actions on restart Dmitry Kozlyuk
2021-10-26 11:46 ` [dpdk-dev] [PATCH v4 0/6] Flow entites behavior on port restart Ferruh Yigit
2021-11-01 13:43 ` Ferruh Yigit
2021-11-02 13:49 ` Ferruh Yigit
2021-11-02 13:54 ` [dpdk-dev] [PATCH v5 " Dmitry Kozlyuk
2021-11-02 13:54 ` [dpdk-dev] [PATCH v5 1/6] ethdev: add capability to keep flow rules on restart Dmitry Kozlyuk
2021-11-02 13:54 ` [dpdk-dev] [PATCH v5 2/6] ethdev: add capability to keep shared objects " Dmitry Kozlyuk
2021-11-02 13:54 ` [dpdk-dev] [PATCH v5 3/6] net: advertise no support for keeping flow rules Dmitry Kozlyuk
2021-11-02 13:54 ` [dpdk-dev] [PATCH v5 4/6] net/mlx5: discover max flow priority using DevX Dmitry Kozlyuk
2021-11-02 13:54 ` [dpdk-dev] [PATCH v5 5/6] net/mlx5: create drop queue " Dmitry Kozlyuk
2021-11-02 13:54 ` [dpdk-dev] [PATCH v5 6/6] net/mlx5: preserve indirect actions on restart Dmitry Kozlyuk
2021-11-02 14:23 ` [dpdk-dev] [PATCH v5 0/6] Flow entites behavior on port restart Ferruh Yigit
2021-11-02 17:02 ` Dmitry Kozlyuk
2021-11-02 17:01 ` [dpdk-dev] [PATCH v6 " Dmitry Kozlyuk
2021-11-02 17:01 ` [dpdk-dev] [PATCH v6 1/6] ethdev: add capability to keep flow rules on restart Dmitry Kozlyuk
2021-11-02 17:01 ` [dpdk-dev] [PATCH v6 2/6] ethdev: add capability to keep shared objects " Dmitry Kozlyuk
2021-11-02 17:01 ` [dpdk-dev] [PATCH v6 3/6] net: advertise no support for keeping flow rules Dmitry Kozlyuk
2021-11-02 17:01 ` [dpdk-dev] [PATCH v6 4/6] net/mlx5: discover max flow priority using DevX Dmitry Kozlyuk
2021-11-02 17:01 ` [dpdk-dev] [PATCH v6 5/6] net/mlx5: create drop queue " Dmitry Kozlyuk
2021-11-02 17:01 ` [dpdk-dev] [PATCH v6 6/6] net/mlx5: preserve indirect actions on restart Dmitry Kozlyuk
2021-11-02 18:02 ` [dpdk-dev] [PATCH v6 0/6] Flow entites behavior on port restart 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=5cd151fd-b39d-3cd4-39e4-36f4726300aa@oktetlabs.ru \
--to=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=dkozlyuk@nvidia.com \
--cc=ferruh.yigit@intel.com \
--cc=orika@nvidia.com \
--cc=thomas@monjalon.net \
/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).