Flow entites behavior on port restart
cover Flow entites behavior on port restart
From: Dmitry Kozlyuk <[email protected]>
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using ethdev info. Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/
Dmitry Kozlyuk (5):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
doc/guides/prog_guide/rte_flow.rst | 21 +++ drivers/net/mlx5/linux/mlx5_os.c | 5 - drivers/net/mlx5/mlx5_devx.c | 204 +++++++++++++++++--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 292 ++++++++++++++++++++++++++--- drivers/net/mlx5/mlx5_flow.h | 6 + drivers/net/mlx5/mlx5_flow_dv.c | 103 ++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +------- drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 + lib/ethdev/rte_ethdev.h | 8 + 12 files changed, 696 insertions(+), 134 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/5 ethdev: add capability to keep flow rules on restart
From: Dmitry Kozlyuk <[email protected]>
Currently, it is 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 is proposed for PMDs to advertise this capability if supported using a new flag.
If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues.
--- doc/guides/prog_guide/rte_flow.rst | 9 +++++++++ lib/ethdev/rte_ethdev.h | 2 ++ 2 files changed, 11 insertions(+)
doc/guides/prog_guide/rte_flow.rst +9 -0
@@ -87,6 +87,15 @@ 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. +By default flow rules are implicitly destroyed when the device is stopped. +If the device advertises ``RTE_DEV_CAPA_FLOW_RULE_KEEP``, flow rules persist +across device stop and start with possible reconfiguration in between. +Some configuration changes may be incompatible with existing flow rules, +in this case ``rte_eth_dev_configure()`` or ``rte_eth_rx/tx_queue_setup()`` +will fail. At this point PMD developers are encouraged to log errors identical +to the ones that would be emitted by ``rte_flow_create()`` if the new +configuration was active. + The following sections cover: - **Attributes** (represented by ``struct rte_flow_attr``): properties of a
lib/ethdev/rte_ethdev.h +2 -0
@@ -1478,6 +1478,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 keeps flow rules across restart and reconfiguration. */ +#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004/**@}*/ /*
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH 1/5] ethdev: add capability to keep flow rules on restart
Hi Dmitry,
Quoted 25 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Tuesday, October 5, 2021 3:52 AM
Subject: [PATCH 1/5] ethdev: add capability to keep flow rules on restartFrom: Dmitry Kozlyuk <[email protected]>
Currently, it is 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 is proposed for PMDs to advertise this capability if supported using a new flag.If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error.
This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues.
Quoted 2 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
Thanks,
Ori
Somnath Kotur
Acked-byRe: [dpdk-dev] [PATCH 1/5] ethdev: add capability to keep flow rules on restart
Quoted 28 lines · Ori Kam
Hi Dmitry,
Quoted 25 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Tuesday, October 5, 2021 3:52 AM
Subject: [PATCH 1/5] ethdev: add capability to keep flow rules on restartFrom: Dmitry Kozlyuk <[email protected]>
Currently, it is 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 is proposed for PMDs to advertise this capability if supported using a new flag.If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error.
This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
Acked-by Ori Kam <[email protected]>Thanks,
Ori
Re: [dpdk-dev] [PATCH 1/5] ethdev: add capability to keep flow rules on restart
In reply to [email protected]Quoted 21 lines · On Mon, Oct 4, 2021 at 5:52 PM <[email protected]> wrote:
From: Dmitry Kozlyuk <[email protected]>
Currently, it is 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 is proposed for PMDs to advertise this capability if supported using a new flag.
If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues.
Quoted 1 line
Signed-off-by Dmitry Kozlyuk <[email protected]>
PATCH 2/5 ethdev: add capability to keep shared objects on restart
In reply to [email protected]From: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage of it. This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
--- doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++ lib/ethdev/rte_ethdev.h | 6 ++++++ 2 files changed, 18 insertions(+)
doc/guides/prog_guide/rte_flow.rst +12 -0
@@ -2794,6 +2794,18 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +By default indirect actions are destroyed when the device is stopped. +If the device advertises ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP``, +indirect actions persist across the device stop and start with possible +reconfiguration in between. Some configuration changes may be incompatible +with existing indirect actions, in this case ``rte_eth_dev_configure()`` and/or +``rte_eth_rx/tx_queue_setup()`` will fail. At this point PMD developers +are encouraged to log errors identical to the ones that would be emitted by +``rte_flow_action_handle_create()`` if the new configuration was active. +Even if this capability is advertised, there may be kinds of indirect actions +that the device cannot keep. They are implicitly destroyed at device stop. +PMD developers must document such kinds of actions if applicable. + .. _table_rte_flow_action_handle: .. table:: INDIRECT
lib/ethdev/rte_ethdev.h +6 -0
@@ -1480,6 +1480,12 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002/** Device keeps flow rules across restart and reconfiguration. */ #define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004 +/** +* Device keeps objects that are shared between flow rules, +* e.g. indirect actions, across restart and reconfiguration. +* For a specific PMD this may not be applicable to certain action types. +*/ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008/**@}*/ /*
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Hi Dmitry,
Quoted 39 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Tuesday, October 5, 2021 3:52 AM
To: [email protected]
Cc: Dmitry Kozlyuk <[email protected]>; Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH 2/5] ethdev: add capability to keep shared objects on restartFrom: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it.
It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage of it.
This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error.
This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 2 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
Thanks,
Ori
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
In reply to [email protected]This thread continues discussions on previous versions to keep everything in the thread with final patches:
[1]: http://inbox.dpdk.org/dev/[email protected]/
[2]: http://inbox.dpdk.org/dev/DM8PR12MB5400997CCEC9169AC5AE0C89D6EA9@DM8PR12MB5400.namprd12.prod.outlook.com/
Please see below.
Quoted 40 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: 5 октября 2021 г. 3:52
To: [email protected]
Cc: Dmitry Kozlyuk <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH 2/5] ethdev: add capability to keep shared objects on restartFrom: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it.
It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage of it. This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]
Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before port start it will be kept after port stop."
Andrew: "It does not sound like a solution. May be I simply don't know
target usecase."
What Ori suggests (offline discussion summary): Suppose an application wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls rte_flow_action_handle_create() or rte_flow_create() before rte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.
If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefined anyway.
3. PMD patches will need update that can be done by RC2.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 93 lines
-----Original Message-----
From: Dmitry Kozlyuk
Sent: 13 октября 2021 г. 11:33
To: [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: RE: [PATCH 2/5] ethdev: add capability to keep shared objects on restartThis thread continues discussions on previous versions to keep everything in the thread with final patches:
[1]: http://inbox.dpdk.org/dev/d5673b58-5aa6-ca35-5b60-
[email protected]/
[2]:
http://inbox.dpdk.org/dev/DM8PR12MB5400997CCEC9169AC5AE0C89D6EA9@DM8PR12MB
5400.namprd12.prod.outlook.com/Please see below.
Quoted 41 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: 5 октября 2021 г. 3:52
To: [email protected]
Cc: Dmitry Kozlyuk <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH 2/5] ethdev: add capability to keep shared objects on restartFrom: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage of it. This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before port start it will be kept after port stop."
Andrew: "It does not sound like a solution. May be I simply don't know target usecase."What Ori suggests (offline discussion summary): Suppose an application wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls
rte_flow_action_handle_create()orrte_flow_create()beforerte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.
Quoted 5 lines
If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefined anyway.
3. PMD patches will need update that can be done by RC2.
Andrew, what do you think?
If you agree, do we need to include transfer bit into "kind"? I'd like to conclude before RC1 and can update the docs quickly.
I've seen the proposition to advertise capability
to create flow rules before device start as a flag.
I don't think it conflicts with Ori's suggestion because the flag doesn't imply that _any_ rule can be created, neither does it say about indirect actions.
On the other hand, if PMD can create a flow object (rule, etc.) when the device is not started, it is logical to assume that after the device is stopped it can move existing flow objects to the same state as when the device was not started, then restore when it is started again.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 103 lines · Dmitry Kozlyuk
Quoted 93 lines
-----Original Message-----
From: Dmitry Kozlyuk
Sent: 13 октября 2021 г. 11:33
To: [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: RE: [PATCH 2/5] ethdev: add capability to keep shared objects on restartThis thread continues discussions on previous versions to keep everything in the thread with final patches:
[1]: http://inbox.dpdk.org/dev/d5673b58-5aa6-ca35-5b60-
[email protected]/
[2]:
http://inbox.dpdk.org/dev/DM8PR12MB5400997CCEC9169AC5AE0C89D6EA9@DM8PR12MB
5400.namprd12.prod.outlook.com/Please see below.
Quoted 41 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: 5 октября 2021 г. 3:52
To: [email protected]
Cc: Dmitry Kozlyuk <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH 2/5] ethdev: add capability to keep shared objects on restartFrom: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage of it. This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before port start it will be kept after port stop."
Andrew: "It does not sound like a solution. May be I simply don't know target usecase."What Ori suggests (offline discussion summary): Suppose an application wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls
rte_flow_action_handle_create()orrte_flow_create()beforerte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.Quoted 5 lines
If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefined anyway.
3. PMD patches will need update that can be done by RC2.Andrew, what do you think?
If you agree, do we need to include transfer bit into "kind"? I'd like to conclude before RC1 and can update the docs quickly.
Quoted 11 lines
I've seen the proposition to advertise capability
to create flow rules before device start as a flag.
I don't think it conflicts with Ori's suggestion because the flag doesn't imply that _any_ rule can be created, neither does it say about indirect actions.
On the other hand, if PMD can create a flow object (rule, etc.) when the device is not started, it is logical to assume that after the device is stopped it can move existing flow objects to the same state as when the device was not started, then restore when it is started again.
Dmitry, thanks for the explanations. Ori's idea makes sense to me now. The problem is to document it properly. We must define rules to check it. Which bits in the check request matter and how application should make a choice of rule to try. Which status code should be returned by the PMD to clearly say that addition in started state is not supported and, therefore, preserving across restart is not supported. Must the device be configured before an attempt to check it? Should transfer and non-transfer rules/indirect actions be checked separately?
Andrew.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 83 lines
[...]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
From: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take
advantage of it.
Quoted 52 lines
Quoted 42 lines
Quoted 12 lines
This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before port start it will be kept after port stop."
Andrew: "It does not sound like a solution. May be I simply don't know target usecase."What Ori suggests (offline discussion summary): Suppose an application wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls
rte_flow_action_handle_create()orrte_flow_create()beforerte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.Quoted 5 lines
If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefined anyway.
3. PMD patches will need update that can be done by RC2.Andrew, what do you think?
If you agree, do we need to include transfer bit into "kind"? I'd like to conclude before RC1 and can update the docs quickly.Quoted 10 lines
I've seen the proposition to advertise capability to create flow rules before device start as a flag.
I don't think it conflicts with Ori's suggestion because the flag doesn't imply that _any_ rule can be created, neither does it say about indirect actions.
On the other hand, if PMD can create a flow object (rule, etc.) when the device is not started, it is logical to assume that after the device is stopped it can move existing flow objects to the same state as when the device was not started, then restore when it is started again.
Quoted 4 lines
Dmitry, thanks for the explanations. Ori's idea makes sense to me now. The problem is to document it properly. We must define rules to check it. Which bits in the check request matter and how application should make a choice of rule to try.
This is a generalization of the last question about the transfer bit. I call the bits that matter a "kind". As I see it:
rule kind = seq. of item types + seq. of action types indirect action kind = action type
As Ori mentioned, for mlx5 PMD transfer bit doesn't affect object persistence. If you or other PMD maintainers think it may be relevant, no problem, because PMDs like mlx5 will just ignore it when checking. Then it will be:
rule kind = seq. of item types + seq. of action types + attr. transfer bit indirect action kind = action type + indirect action conf. transfer bit
Including the transfer bit seems to be a safe choice from DPDK point of view, but obviously it can force applications to do up to twice as many checks.
The application needs to construct a valid flow configuration that is (1) valid and (2) has the kind the application is interested in. It is worth noting that these checks are not about resource consumption, i.e. it is sufficient to test an indirect RSS with one queue to be confident that indirect RSS with any number of queues are preserved.
Quoted 3 lines
Which status code should be returned by the PMD to clearly say that addition in started state is not supported and, therefore, preserving across restart is not supported.
I suggest a new DPDK-specific value in rte_errno.h.
Quoted 1 line
Must the device be configured before an attempt to check it?
Yes, because flow objects created by these checks are as good as any others and AFAIK no PMD supports rte_flow calls before configuration is done.
Quoted 1 line
Should transfer and non-transfer rules/indirect actions be checked separately?
See above.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 116 lines · Dmitry Kozlyuk
Quoted 83 lines
[...]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
From: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take
advantage of it.
Quoted 52 lines
Quoted 42 lines
Quoted 12 lines
This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before port start it will be kept after port stop."
Andrew: "It does not sound like a solution. May be I simply don't know target usecase."What Ori suggests (offline discussion summary): Suppose an application wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls
rte_flow_action_handle_create()orrte_flow_create()beforerte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.Quoted 5 lines
If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefined anyway.
3. PMD patches will need update that can be done by RC2.Andrew, what do you think?
If you agree, do we need to include transfer bit into "kind"? I'd like to conclude before RC1 and can update the docs quickly.Quoted 10 lines
I've seen the proposition to advertise capability to create flow rules before device start as a flag.
I don't think it conflicts with Ori's suggestion because the flag doesn't imply that _any_ rule can be created, neither does it say about indirect actions.
On the other hand, if PMD can create a flow object (rule, etc.) when the device is not started, it is logical to assume that after the device is stopped it can move existing flow objects to the same state as when the device was not started, then restore when it is started again.Quoted 4 lines
Dmitry, thanks for the explanations. Ori's idea makes sense to me now. The problem is to document it properly. We must define rules to check it. Which bits in the check request matter and how application should make a choice of rule to try.
This is a generalization of the last question about the transfer bit. I call the bits that matter a "kind". As I see it:
rule kind = seq. of item types + seq. of action types indirect action kind = action type
As Ori mentioned, for mlx5 PMD transfer bit doesn't affect object persistence. If you or other PMD maintainers think it may be relevant, no problem, because PMDs like mlx5 will just ignore it when checking. Then it will be:
rule kind = seq. of item types + seq. of action types + attr. transfer bit indirect action kind = action type + indirect action conf. transfer bit
Including the transfer bit seems to be a safe choice from DPDK point of view, but obviously it can force applications to do up to twice as many checks.
The application needs to construct a valid flow configuration that is (1) valid and (2) has the kind the application is interested in. It is worth noting that these checks are not about resource consumption, i.e. it is sufficient to test an indirect RSS with one queue to be confident that indirect RSS with any number of queues are preserved.
Quoted 3 lines
Which status code should be returned by the PMD to clearly say that addition in started state is not supported and, therefore, preserving across restart is not supported.
I suggest a new DPDK-specific value in
rte_errno.h.
Quoted 9 lines
Quoted 1 line
Must the device be configured before an attempt to check it?
Yes, because flow objects created by these checks are as good as any others and AFAIK no PMD supports
rte_flowcalls before configuration is done.Quoted 1 line
Should transfer and non-transfer rules/indirect actions be checked separately?
See above.
Please, try to put it into the patch for documentation and I'll review the result. All my above questions should be answered in the documentation.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
In reply to Dmitry KozlyukQuoted 62 lines · Dmitry Kozlyuk
This thread continues discussions on previous versions to keep everything in the thread with final patches:
[1]: http://inbox.dpdk.org/dev/[email protected]/
[2]: http://inbox.dpdk.org/dev/DM8PR12MB5400997CCEC9169AC5AE0C89D6EA9@DM8PR12MB5400.namprd12.prod.outlook.com/Please see below.
Quoted 40 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: 5 октября 2021 г. 3:52
To: [email protected]
Cc: Dmitry Kozlyuk <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH 2/5] ethdev: add capability to keep shared objects on restartFrom: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it.
It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage of it. This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before port start it will be kept after port stop."
Andrew: "It does not sound like a solution. May be I simply don't know
target usecase."
Quoted 7 lines
What Ori suggests (offline discussion summary): Suppose an application wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls
rte_flow_action_handle_create()orrte_flow_create()beforerte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefined anyway.
3. PMD patches will need update that can be done by RC2.
Hi Dmitry,
Are you planning to update drivers yourself on -rc2?
Or do you mean PMD maintainers should update themselves, if so do they know about it?
If the ethdev layer is updated in a way to impact the drivers, it should be either:
- all drivers updated with a change
or
- give PMDs time to implement it on their own time, meanwhile they can report their support status by a flag
We had multiple sample of second case in the past but it is harder for this case.
For this case what about having three states:
- FLOW_RULE_KEEP
- FLOW_RULE_DESTROY
- FLOW_RULE_UNKNOWN
And set 'FLOW_RULE_UNKNOWN' for all drivers, to simulate current status, until driver is updated.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 122 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 14 октября 2021 г. 16:47
To: Dmitry Kozlyuk <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objects on restartExternal email: Use caution opening links or attachments
Quoted 41 lines · Dmitry Kozlyuk
This thread continues discussions on previous versions to keep everything in the thread with final patches:
[1]:
http://inbox.dpdk.org/dev/d5673b58-5aa6-ca35-5b60-d938e56cfee1@oktetla
bs.ru/
[2]:
http://inbox.dpdk.org/dev/DM8PR12MB5400997CCEC9169AC5AE0C89D6EA9@DM8PR
12MB5400.namprd12.prod.outlook.com/Please see below.
Quoted 29 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: 5 октября 2021 г. 3:52
To: [email protected]
Cc: Dmitry Kozlyuk <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH 2/5] ethdev: add capability to keep shared objects on restartFrom: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage
of it.
Quoted 16 lines
Quoted 12 lines
This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]Quoted 7 lines
Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before
port start it will be kept after port stop."
Quoted 4 lines
Andrew: "It does not sound like a solution. May be I simply don't know target usecase."
What Ori suggests (offline discussion summary): Suppose an application
wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls
rte_flow_action_handle_create()orrte_flow_create()beforerte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.Quoted 4 lines
If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefinedanyway.
Quoted 2 lines
3. PMD patches will need update that can be done by RC2.
Hi Dmitry,
Are you planning to update drivers yourself on -rc2?
Or do you mean PMD maintainers should update themselves, if so do they know about it?If the ethdev layer is updated in a way to impact the drivers, it should be either:
- all drivers updated with a change
or
- give PMDs time to implement it on their own time, meanwhile they can report their support status by a flagWe had multiple sample of second case in the past but it is harder for this case.
Quoted 7 lines
For this case what about having three states:
-FLOW_RULE_KEEP
-FLOW_RULE_DESTROY
-FLOW_RULE_UNKNOWNAnd set '
FLOW_RULE_UNKNOWN' for all drivers, to simulate current status, until driver is updated.
Hi Ferruh,
Indirect actions are only implemented by mlx5 PMD, the patches will be in RC2.
If we don't use the flag as per the latest suggestion, nothing needs to be done for other PMDs.
Flag can as well be kept with the following semantics:
0 => indirect actions are flushed on device stop 1 => at least some indirect actions are kept,
application should check types it's interested in
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".
Here's what I understood from the code, assuming there are no bugs Like allowing to stop the port and keep dangling flow handles:
bnxt flush bonding depends cnxk can't figure out cxgbe keep dpaa2 keep e1000 keep enic flush failsafe depends hinic flush hns3 keep i40e keep iavf keep ice keep igc keep ipn3ke keep ixgbe keep mlx4 keep mlx5 flush mvpp2 keep octeontx2 can't figure out qede keep sfc flush softnic flush tap keep txgbe keep
Currently one flag would be sufficient to describe PMD behavior:
they either keep or flush the flow rules.
If there are indeed no exceptions, which maintainers should confirm, I can add flag reporting myself.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 10 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves, but if it provides a response, it can't be "I don't know what I do".Here's what I understood from the code, assuming there are no bugs Like allowing to stop the port and keep dangling flow handles:
bnxt flush
[...]
N.B.: This part is about flow rules. For indirect actions it is clear.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
In reply to Dmitry KozlyukQuoted 132 lines · Dmitry Kozlyuk
Quoted 122 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 14 октября 2021 г. 16:47
To: Dmitry Kozlyuk <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objects on restartExternal email: Use caution opening links or attachments
Quoted 41 lines · Dmitry Kozlyuk
This thread continues discussions on previous versions to keep everything in the thread with final patches:
[1]:
http://inbox.dpdk.org/dev/d5673b58-5aa6-ca35-5b60-d938e56cfee1@oktetla
bs.ru/
[2]:
http://inbox.dpdk.org/dev/DM8PR12MB5400997CCEC9169AC5AE0C89D6EA9@DM8PR
12MB5400.namprd12.prod.outlook.com/Please see below.
Quoted 29 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: 5 октября 2021 г. 3:52
To: [email protected]
Cc: Dmitry Kozlyuk <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH 2/5] ethdev: add capability to keep shared objects on restartFrom: Dmitry Kozlyuk <[email protected]>
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed.In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
It may happen that in the future a PMD acquires support for a type of shared objects that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use objects of the problematic type can still take advantage
of it.
Quoted 16 lines
Quoted 12 lines
This is why PMDs are allowed to keep only a subset of shared objects provided that the vendor mandatorily documents it.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
Quoted 3 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>---
[...]Quoted 7 lines
Current pain point is that capability bits may be insufficient and a programmatic way is desired to check which types of objects can be kept across restart, instead of documenting the limitations.
I support one of previous Ori's suggestions and want to clarify it [1]:
Ori: "Another way is to assume that if the action was created before
port start it will be kept after port stop."
Quoted 4 lines
Andrew: "It does not sound like a solution. May be I simply don't know target usecase."
What Ori suggests (offline discussion summary): Suppose an application
wants to check whether a shared object (indirect action) or a flow rule of a particular kind. It calls
rte_flow_action_handle_create()orrte_flow_create()beforerte_eth_dev_start(). If it succeeds, 1) it means objects of this type can be kept across restart, 2) it's a normal object created that will work after the port is started. This is logical, because if the PMD can keep some kind of objects when the port is stopped, it is likely to be able to create them when the port is not started. It is subject to discussion if "object kind" means only "type" or "type + transfer bit" combination; for mlx5 PMD it doesn't matter. One minor drawback is that applications can only do the test when the port is stopped, but it seems likely that the test really needs to be done at startup anyway.Quoted 4 lines
If this is acceptable:
1. Capability bits are not needed anymore.
2. ethdev patches can be accepted in RC1, present behavior is undefinedanyway.
Quoted 2 lines
3. PMD patches will need update that can be done by RC2.
Hi Dmitry,
Are you planning to update drivers yourself on -rc2?
Or do you mean PMD maintainers should update themselves, if so do they know about it?If the ethdev layer is updated in a way to impact the drivers, it should be either:
- all drivers updated with a change
or
- give PMDs time to implement it on their own time, meanwhile they can report their support status by a flagWe had multiple sample of second case in the past but it is harder for this case.
Quoted 7 lines
For this case what about having three states:
-FLOW_RULE_KEEP
-FLOW_RULE_DESTROY
-FLOW_RULE_UNKNOWNAnd set '
FLOW_RULE_UNKNOWN' for all drivers, to simulate current status, until driver is updated.Hi Ferruh,
Quoted 9 lines
Indirect actions are only implemented by mlx5 PMD, the patches will be in RC2.
If we don't use the flag as per the latest suggestion, nothing needs to be done for other PMDs.
Flag can as well be kept with the following semantics:
0 => indirect actions are flushed on device stop 1 => at least some indirect actions are kept,
application should check types it's interested in
My concerns is related to the 'flow rules', not indirect actions, the patch mentions capability is for both of them.
Quoted 5 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".
I agree 'unknown' state is not ideal, but my intentions is prevent drivers that not implemented this new feature report wrong capability.
Without capability, application already doesn't know how underlying PMD behaves, so this is by default 'unknown' state.
I suggest keeping that state until driver explicitly updates its state to the correct value.
But having below list is good, if you will update all drivers than no need to have the 'unknown' state, but updating drivers may require driver maintainers ack which can take some time.
Can you please clarify what is you plan according PMDs, will you update them all, or will you only update mlx5 in -rc2?
And what is the exact plan for the -rc2 that you mention?
Quoted 34 lines
Here's what I understood from the code, assuming there are no bugs Like allowing to stop the port and keep dangling flow handles:
bnxt flush bonding depends cnxk can't figure out cxgbe keep dpaa2 keep e1000 keep enic flush failsafe depends hinic flush hns3 keep i40e keep iavf keep ice keep igc keep ipn3ke keep ixgbe keep mlx4 keep mlx5 flush mvpp2 keep octeontx2 can't figure out qede keep sfc flush softnic flush tap keep txgbe keepCurrently one flag would be sufficient to describe PMD behavior:
they either keep or flush the flow rules.
If there are indeed no exceptions, which maintainers should confirm, I can add flag reporting myself.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 9 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
[...]Quoted 5 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".
Quoted 7 lines
I agree 'unknown' state is not ideal, but my intentions is prevent drivers that not implemented this new feature report wrong capability.
Without capability, application already doesn't know how underlying PMD behaves, so this is by default 'unknown' state.
I suggest keeping that state until driver explicitly updates its state to the correct value.
My concern is that when all the drivers are changed to report a proper capability, UNKNOWN remains in the API meaning "there's a bug in DPDK".
Instead of UNKNOWN response we can declare that rte_flow_flush() must be called unless the application wants to keep the rules and has made sure it's possible, or the behavior is undefined. (Can be viewed as "UNKNOWN by default", but is simpler.) This way neither UNKNOWN state is needed,
nor the bit saying the flow rules are flushed.
Here is why, let's consider KEEP and FLUSH combinations:
(1) FLUSH=0, KEEP=0 is equivalent to UNKNOWN, i.e. the application must explicitly flush the rules itself in order to get deterministic behavior.
(2) FLUSH=1, KEEP=0 means PMD flushes all rules on the device stop.
(3) FLUSH=0, KEEP=1 means PMD can keep at least some rules, exact support must be checked with rte_flow_create() when the device is stopped.
(4) FLUSH=1, KEEP=1 is forbidden.
If the application doesn't need the PMD to keep flow rules,
it can as well flush them always before the device stop regardless of whether the driver does it automatically or not. It's even simpler and probably as efficient. Testpmd does this. If the application wants to take advantage of rule-keeping ability, it just tests the KEEP bit. If it is unset that's the previous case, application should call rte_flow_flush() before the device stop to be sure. Otherwise, the application can test capability to keep flow rule kinds it is interested in (see my reply to Andrew).
Result: no changes to PMDs are _immediately_ needed when such behavior is documented. They can start advertising it whenever they like, it's not even an RC2 task. Currently applications that relied on certain behavior are non-portable anyway.
Quoted 3 lines
But having below list is good, if you will update all drivers than no need to have the 'unknown' state, but updating drivers may require driver maintainers ack which can take some time.
If you agree with what I suggest above, there will be no urgency. The list can be used to notify maintainers that they can enhance their PMD user experience whenever they like.
Quoted 3 lines
Can you please clarify what is you plan according PMDs, will you update them all, or will you only update mlx5 in -rc2?
And what is the exact plan for the -rc2 that you mention?
mlx5 PMD will be updated with the patches from this series. Regarding indirect actions: no other PMD needs an update. Regarding flow rules: if the above suggestion is accepted, no PMDs need to be updated urgently.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 12 lines · Dmitry Kozlyuk
Quoted 12 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
[...]Quoted 5 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".I agree 'unknown' state is not ideal, but my intentions is prevent drivers that not implemented this new feature report wrong capability.
Quoted 8 lines
Quoted 4 lines
Without capability, application already doesn't know how underlying PMD behaves, so this is by default 'unknown' state.
I suggest keeping that state until driver explicitly updates its state to the correct value.My concern is that when all the drivers are changed to report a proper capability, UNKNOWN remains in the API meaning "there's a bug in DPDK".
When all drivers are changed, of course we can remove the 'unknown' flag.
Quoted 8 lines
Instead of UNKNOWN response we can declare that
rte_flow_flush()must be called unless the application wants to keep the rules and has made sure it's possible, or the behavior is undefined. (Can be viewed as "UNKNOWN by default", but is simpler.) This way neither UNKNOWN state is needed,
nor the bit saying the flow rules are flushed.
Here is why, let's consider KEEP and FLUSH combinations:
Quoted 9 lines
(1) FLUSH=0, KEEP=0 is equivalent to UNKNOWN, i.e. the application must explicitly flush the rules itself in order to get deterministic behavior.
(2) FLUSH=1, KEEP=0 means PMD flushes all rules on the device stop.
(3) FLUSH=0, KEEP=1 means PMD can keep at least some rules, exact support must be checked withrte_flow_create()when the device is stopped.
(4) FLUSH=1, KEEP=1 is forbidden.
What is 'FLUSH' here? Are you proposing a new capability?
Quoted 10 lines
If the application doesn't need the PMD to keep flow rules,
it can as well flush them always before the device stop regardless of whether the driver does it automatically or not. It's even simpler and probably as efficient. Testpmd does this. If the application wants to take advantage of rule-keeping ability, it just tests the KEEP bit. If it is unset that's the previous case, application should callrte_flow_flush()before the device stop to be sure. Otherwise, the application can test capability to keep flow rule kinds it is interested in (see my reply to Andrew).
Overall this is an optimization, application can workaround without this capability.
If driver doesn't set KEEP capability, it is not clear what does it mean, driver doesn't keep rules or driver is not updated yet. I suggest to update comment to clarify the meaning of the missing KEEP flag.
And unless we have two explicit status flags application can never be sure that driver doesn't keep rules after stop. I am don't know if application wants to know this.
Other concern is how PMD maintainers will know that there is something to update here, I am sure many driver maintainers won't even be aware of this, your patch doesn't even cc them. Your approach feels like you are thinking only single PMD and ignore rest.
My intention was to have a way to follow drivers that is not updated, by marking them with UNKNOWN flag. But this also doesn't work with new drivers, they may forget setting capability.
What about following:
1) Clarify KEEP flag meaning:
having KEEP: flow rules are kept after stop
missing KEEP: unknown behavior
2) Mark all PMDs with useless flag:dev_capa &= ~KEEP
Maintainer can remove or update this later, and we can easily track it.
Quoted 22 lines
Result: no changes to PMDs are _immediately_ needed when such behavior is documented. They can start advertising it whenever they like, it's not even an RC2 task. Currently applications that relied on certain behavior are non-portable anyway.
Quoted 3 lines
But having below list is good, if you will update all drivers than no need to have the 'unknown' state, but updating drivers may require driver maintainers ack which can take some time.
If you agree with what I suggest above, there will be no urgency. The list can be used to notify maintainers that they can enhance their PMD user experience whenever they like.
Quoted 3 lines
Can you please clarify what is you plan according PMDs, will you update them all, or will you only update mlx5 in -rc2?
And what is the exact plan for the -rc2 that you mention?mlx5 PMD will be updated with the patches from this series. Regarding indirect actions: no other PMD needs an update. Regarding flow rules: if the above suggestion is accepted, no PMDs need to be updated urgently.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 94 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 15 октября 2021 г. 19:27
To: Dmitry Kozlyuk <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objects on restartExternal email: Use caution opening links or attachments
Quoted 12 lines · Dmitry Kozlyuk
Quoted 12 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
[...]Quoted 5 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".I agree 'unknown' state is not ideal, but my intentions is prevent drivers that not implemented this new feature report wrong capability.
Quoted 8 lines
Quoted 4 lines
Without capability, application already doesn't know how underlying PMD behaves, so this is by default 'unknown' state.
I suggest keeping that state until driver explicitly updates its state to the correct value.My concern is that when all the drivers are changed to report a proper capability, UNKNOWN remains in the API meaning "there's a bug in DPDK".
When all drivers are changed, of course we can remove the 'unknown' flag.
Quoted 8 lines
Instead of UNKNOWN response we can declare that
rte_flow_flush()must be called unless the application wants to keep the rules and has made sure it's possible, or the behavior is undefined. (Can be viewed as "UNKNOWN by default", but is simpler.) This way neither UNKNOWN state is needed,
nor the bit saying the flow rules are flushed.
Here is why, let's consider KEEP and FLUSH combinations:Quoted 6 lines
(1) FLUSH=0, KEEP=0 is equivalent to UNKNOWN, i.e. the application must explicitly flush the rules itself in order to get deterministic behavior.
(2) FLUSH=1, KEEP=0 means PMD flushes all rules on the device stop.
(3) FLUSH=0, KEEP=1 means PMD can keep at least some rules, exact support must be checked with
rte_flow_create()Quoted 3 lines
when the device is stopped.
(4) FLUSH=1, KEEP=1 is forbidden.What is 'FLUSH' here? Are you proposing a new capability?
Quoted 7 lines
If the application doesn't need the PMD to keep flow rules, it can as well flush them always before the device stop regardless of whether the driver does it automatically or not. It's even simpler and probably as efficient. Testpmd does this. If the application wants to take advantage of rule-keeping ability, it just tests the KEEP bit. If it is unset that's the previous case, application should call
rte_flow_flush()before the device stop to besure.
Quoted 3 lines
Otherwise, the application can test capability to keep flow rule kinds it is interested in (see my reply to Andrew).
Overall this is an optimization, application can workaround without this capability.
If driver doesn't set KEEP capability, it is not clear what does it mean, driver doesn't keep rules or driver is not updated yet. I suggest to update comment to clarify the meaning of the missing KEEP flag.
And unless we have two explicit status flags application can never be sure that driver doesn't keep rules after stop. I am don't know if application wants to know this.
Other concern is how PMD maintainers will know that there is something to update here, I am sure many driver maintainers won't even be aware of this, your patch doesn't even cc them. Your approach feels like you are thinking only single PMD and ignore rest.
My intention was to have a way to follow drivers that is not updated, by marking them with UNKNOWN flag. But this also doesn't work with new drivers, they may forget setting capability.
Quoted 8 lines
What about following:
1) Clarify KEEP flag meaning:
having KEEP: flow rules are kept after stop
missing KEEP: unknown behavior2) Mark all PMDs with useless flag:
dev_capa&= ~KEEP
Maintainer can remove or update this later, and we can easily track it.
Item 1) is almost what I did in v2. The difference (or clarification) is that if the bit is set, it doesn't mean that all rules are kept.
It allows the PMD to not support keeping some kinds of rules. Please see the doc update about how the kind is defined
and how the application can test what is unsupported.
This complication is needed so that if a PMD cannot keep some exotic kind of rules, it is not forced to remove the capability completely,
blocking optimizations even if the application doesn't use problematic rule kinds. It makes the capability future-proof.
The second flag (FLUSH) would not be of much help.
Consider it is not set, but the PMD can keep some kinds of rules. The application still needs to test all the kinds it needs. But it needs to do the same if the KEEP bit is set.
Only if it is set the application can skip the tests and rte_flow_flush(), but these optimizations are small compared to keeping the rules itself.
Item 2) needs not to be done, because the absence of the bit is *the* useless value:
it means the unspecified same behavior as it is presently.
It is worth noting that currently any application that relies on the PMD to keep or flush the rules is non-portable, because PMD is allowed to do anything. To get a reliable behavior application must explicitly clear the rules.
Regarding you concern about maintainers forgetting to update PMDs, I think there are better task-tracking tools then constants in the code (the authors of golang's context.TODO may disagree :)
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 127 lines · Dmitry Kozlyuk
Quoted 94 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 15 октября 2021 г. 19:27
To: Dmitry Kozlyuk <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objects on restartExternal email: Use caution opening links or attachments
Quoted 12 lines · Dmitry Kozlyuk
Quoted 12 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
[...]Quoted 5 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".I agree 'unknown' state is not ideal, but my intentions is prevent drivers that not implemented this new feature report wrong capability.
Quoted 8 lines
Quoted 4 lines
Without capability, application already doesn't know how underlying PMD behaves, so this is by default 'unknown' state.
I suggest keeping that state until driver explicitly updates its state to the correct value.My concern is that when all the drivers are changed to report a proper capability, UNKNOWN remains in the API meaning "there's a bug in DPDK".
When all drivers are changed, of course we can remove the 'unknown' flag.
Quoted 8 lines
Instead of UNKNOWN response we can declare that
rte_flow_flush()must be called unless the application wants to keep the rules and has made sure it's possible, or the behavior is undefined. (Can be viewed as "UNKNOWN by default", but is simpler.) This way neither UNKNOWN state is needed,
nor the bit saying the flow rules are flushed.
Here is why, let's consider KEEP and FLUSH combinations:Quoted 6 lines
(1) FLUSH=0, KEEP=0 is equivalent to UNKNOWN, i.e. the application must explicitly flush the rules itself in order to get deterministic behavior.
(2) FLUSH=1, KEEP=0 means PMD flushes all rules on the device stop.
(3) FLUSH=0, KEEP=1 means PMD can keep at least some rules, exact support must be checked with
rte_flow_create()Quoted 3 lines
when the device is stopped.
(4) FLUSH=1, KEEP=1 is forbidden.What is 'FLUSH' here? Are you proposing a new capability?
Quoted 7 lines
If the application doesn't need the PMD to keep flow rules, it can as well flush them always before the device stop regardless of whether the driver does it automatically or not. It's even simpler and probably as efficient. Testpmd does this. If the application wants to take advantage of rule-keeping ability, it just tests the KEEP bit. If it is unset that's the previous case, application should call
rte_flow_flush()before the device stop to besure.
Quoted 3 lines
Otherwise, the application can test capability to keep flow rule kinds it is interested in (see my reply to Andrew).
Overall this is an optimization, application can workaround without this capability.
If driver doesn't set KEEP capability, it is not clear what does it mean, driver doesn't keep rules or driver is not updated yet. I suggest to update comment to clarify the meaning of the missing KEEP flag.
And unless we have two explicit status flags application can never be sure that driver doesn't keep rules after stop. I am don't know if application wants to know this.
Other concern is how PMD maintainers will know that there is something to update here, I am sure many driver maintainers won't even be aware of this, your patch doesn't even cc them. Your approach feels like you are thinking only single PMD and ignore rest.
My intention was to have a way to follow drivers that is not updated, by marking them with UNKNOWN flag. But this also doesn't work with new drivers, they may forget setting capability.
Quoted 8 lines
What about following:
1) Clarify KEEP flag meaning:
having KEEP: flow rules are kept after stop
missing KEEP: unknown behavior2) Mark all PMDs with useless flag:
dev_capa&= ~KEEP
Maintainer can remove or update this later, and we can easily track it.Item 1) is almost what I did in v2. The difference (or clarification) is that if the bit is set, it doesn't mean that all rules are kept.
It allows the PMD to not support keeping some kinds of rules. Please see the doc update about how the kind is defined
and how the application can test what is unsupported.This complication is needed so that if a PMD cannot keep some exotic kind of rules, it is not forced to remove the capability completely,
blocking optimizations even if the application doesn't use problematic rule kinds. It makes the capability future-proof.The second flag (FLUSH) would not be of much help.
Consider it is not set, but the PMD can keep some kinds of rules. The application still needs to test all the kinds it needs. But it needs to do the same if the KEEP bit is set.
Only if it is set the application can skip the tests andrte_flow_flush(), but these optimizations are small compared to keeping the rules itself.Item 2) needs not to be done, because the absence of the bit is *the* useless value:
it means the unspecified same behavior as it is presently.
It is worth noting that currently any application that relies on the PMD to keep or flush the rules is non-portable, because PMD is allowed to do anything. To get a reliable behavior application must explicitly clear the rules.
Quoted 4 lines
Regarding you concern about maintainers forgetting to update PMDs, I think there are better task-tracking tools then constants in the code (the authors of golang's context.TODO may disagree :)
Hi Dmitry,
This is a valid concern, and adding code to the drivers proved that it works.
There are multiple authors updating the ethdev layer and expecting PMD maintainers will do required changes. For your case you are updating the PMD you concern but how other PMD maintainers will even be aware that there is something to change in their PMD?
By your change you are putting some responsibility to other maintainers, without even cc'ing them. And it is for sure they are not reading all emails in the mail list, they can't.
Task-tracking is an option, it the past I tried to upstream some todo doc for PMDs. But I can see the additional maintenance cost to trace features from a central point, comparing the distributing it to PMDS (adding code to PMDs).
I think best method is whoever doing the ethdev layer do the relevant change in the PMDs, but has the obvious problem that not able to know enough about the PMDs to update them.
We have used the following option, and it worked in the past:
- When an ethdev feature require change in PMDs, ehtdev supports both new and old method
- PMDs set a flag by default to request old method, so there is no update in the PMD default behavior
- When PMD does the required changes, it removes the flag
- This lets me (or other maintainer), to trace the update status and ping relevant maintainers
- When all PMDs updated, ethdev support for old method removed
- This method allows PMD maintainers do the change on their own time
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 188 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 18 октября 2021 г. 11:42
To: Dmitry Kozlyuk <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>
Cc: Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objects on restartExternal email: Use caution opening links or attachments
Quoted 4 lines · Dmitry Kozlyuk
Quoted 4 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 15 октября 2021 г. 19:27
To: Dmitry Kozlyuk <[email protected]>; [email protected]; AndrewRybchenko
Quoted 6 lines
Quoted 6 lines
<[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objectson
Quoted 9 lines
Quoted 9 lines
restart
External email: Use caution opening links or attachments
Quoted 3 lines · Dmitry Kozlyuk
Quoted 3 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
[...]Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".I agree 'unknown' state is not ideal, but my intentions is prevent drivers that not implemented this new feature report wrong
capability.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Without capability, application already doesn't know how underlying PMD behaves, so this is by default 'unknown' state.
I suggest keeping that state until driver explicitly updates itsstate
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
to the correct value.
My concern is that when all the drivers are changed to report a proper capability, UNKNOWN remains in the API meaning "there's a bug in
DPDK".
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
When all drivers are changed, of course we can remove the 'unknown'
flag.
Quoted 29 lines
Quoted 29 lines
Quoted 9 lines
Instead of UNKNOWN response we can declare that
rte_flow_flush()must be called unless the application wants to keep the rules and has made sure it's possible, or the behavior is undefined. (Can be viewed as "UNKNOWN by default", but is simpler.) This way neither UNKNOWN state is needed,
nor the bit saying the flow rules are flushed.
Here is why, let's consider KEEP and FLUSH combinations:Quoted 6 lines
(1) FLUSH=0, KEEP=0 is equivalent to UNKNOWN, i.e. the application must explicitly flush the rules itself in order to get deterministic behavior.
(2) FLUSH=1, KEEP=0 means PMD flushes all rules on the device stop.
(3) FLUSH=0, KEEP=1 means PMD can keep at least some rules, exact support must be checked with
rte_flow_create()Quoted 3 lines
when the device is stopped.
(4) FLUSH=1, KEEP=1 is forbidden.What is 'FLUSH' here? Are you proposing a new capability?
Quoted 7 lines
If the application doesn't need the PMD to keep flow rules, it can as well flush them always before the device stop regardless of whether the driver does it automatically or not. It's even simpler and probably as efficient. Testpmd does this. If the application wants to take advantage of rule-keeping ability, it just tests the KEEP bit. If it is unset that's the previous case, application should call
rte_flow_flush()before the device stop to beQuoted 6 lines
Quoted 6 lines
sure.
Quoted 3 lines
Otherwise, the application can test capability to keep flow rule kinds it is interested in (see my reply to Andrew).
Overall this is an optimization, application can workaround without
this
Quoted 7 lines
Quoted 7 lines
capability.
If driver doesn't set KEEP capability, it is not clear what does it mean, driver doesn't keep rules or driver is not updated yet. I suggest to update comment to clarify the meaning of the missing KEEP flag.
Quoted 6 lines
Quoted 6 lines
And unless we have two explicit status flags application can never be sure that driver doesn't keep rules after stop. I am don't know if application wants to know this.
Other concern is how PMD maintainers will know that there is something to update here, I am sure many driver maintainers won't even be aware
of
Quoted 13 lines
Quoted 13 lines
this, your patch doesn't even cc them. Your approach feels like you are thinking only single PMD and ignore rest.
My intention was to have a way to follow drivers that is not updated, by marking them with UNKNOWN flag. But this also doesn't work with new drivers, they may forget setting capability.
What about following:
1) Clarify KEEP flag meaning:
having KEEP: flow rules are kept after stop
missing KEEP: unknown behaviorQuoted 5 lines
Quoted 3 lines
2) Mark all PMDs with useless flag:
dev_capa&= ~KEEP
Maintainer can remove or update this later, and we can easily track it.Item 1) is almost what I did in v2. The difference (or clarification) is
that
Quoted 6 lines
if the bit is set, it doesn't mean that all rules are kept. It allows the PMD to not support keeping some kinds of rules. Please see the doc update about how the kind is defined and how the application can test what is unsupported.
This complication is needed so that if a PMD cannot keep some exotic
kind of rules,
Quoted 2 lines
it is not forced to remove the capability completely, blocking optimizations even if the application doesn't use problematic
rule kinds.
Quoted 7 lines
It makes the capability future-proof.
The second flag (FLUSH) would not be of much help. Consider it is not set, but the PMD can keep some kinds of rules. The application still needs to test all the kinds it needs. But it needs to do the same if the KEEP bit is set. Only if it is set the application can skip the tests and
rte_flow_flush(),Quoted 3 lines
but these optimizations are small compared to keeping the rules itself.
Item 2) needs not to be done, because the absence of the bit is *the*
useless value:
Quoted 3 lines
it means the unspecified same behavior as it is presently. It is worth noting that currently any application that relies on the PMD to keep or flush the rules is non-portable, because PMD is allowed to do
anything.
Quoted 6 lines
To get a reliable behavior application must explicitly clear the rules.
Regarding you concern about maintainers forgetting to update PMDs, I think there are better task-tracking tools then constants in the code (the authors of golang's context.TODO may disagree :)
Hi Dmitry,
This is a valid concern, and adding code to the drivers proved that it works.
There are multiple authors updating the ethdev layer and expecting PMD maintainers will do required changes. For your case you are updating the PMD
you concern but how other PMD maintainers will even be aware that there is something to change in their PMD?
By your change you are putting some responsibility to other maintainers, without even cc'ing them. And it is for sure they are not reading all emails
in the mail list, they can't.Task-tracking is an option, it the past I tried to upstream some todo doc for PMDs. But I can see the additional maintenance cost to trace features from a central point, comparing the distributing it to PMDS (adding code to PMDs).
I think best method is whoever doing the ethdev layer do the relevant change
in the PMDs, but has the obvious problem that not able to know enough about
the PMDs to update them.
Quoted 10 lines
We have used the following option, and it worked in the past:
- When an ethdev feature require change in PMDs, ehtdev supports both new and old method
- PMDs set a flag by default to request old method, so there is no update in the PMD default behavior
- When PMD does the required changes, it removes the flag
- This lets me (or other maintainer), to trace the update status and ping relevant maintainers
- When all PMDs updated, ethdev support for old method removed
- This method allows PMD maintainers do the change on their own time
Hi Ferruh,
Thanks for sharing the experience.
You suggest updating PMDs with an explicit reset of this bit, despite that it will be zero anyway, to attract maintainers' attention. From user's perspective it will be all the same: KEEP bit reset, not a special value saying the PMD is not updated
that we would need to deprecate and remove later.
If this understanding is correct, then for sure I can add a patch updating the relevant PMDs.
Re: [dpdk-dev] [PATCH 2/5] ethdev: add capability to keep shared objects on restart
Quoted 199 lines · Dmitry Kozlyuk
Quoted 188 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 18 октября 2021 г. 11:42
To: Dmitry Kozlyuk <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>
Cc: Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objects on restartExternal email: Use caution opening links or attachments
Quoted 4 lines · Dmitry Kozlyuk
Quoted 4 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 15 октября 2021 г. 19:27
To: Dmitry Kozlyuk <[email protected]>; [email protected]; AndrewRybchenko
Quoted 6 lines
Quoted 6 lines
<[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Qi Zhang <[email protected]>; [email protected]; Maxime Coquelin <[email protected]>
Subject: Re: [PATCH 2/5] ethdev: add capability to keep shared objectson
Quoted 9 lines
Quoted 9 lines
restart
External email: Use caution opening links or attachments
Quoted 3 lines · Dmitry Kozlyuk
Quoted 3 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
[...]Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Introducing UNKNOWN state seems wrong to me.
What should an application do when it is reported?
Now there's just no way to learn how the PMD behaves,
but if it provides a response, it can't be "I don't know what I do".I agree 'unknown' state is not ideal, but my intentions is prevent drivers that not implemented this new feature report wrong
capability.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Without capability, application already doesn't know how underlying PMD behaves, so this is by default 'unknown' state.
I suggest keeping that state until driver explicitly updates itsstate
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
to the correct value.
My concern is that when all the drivers are changed to report a proper capability, UNKNOWN remains in the API meaning "there's a bug in
DPDK".
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
When all drivers are changed, of course we can remove the 'unknown'
flag.
Quoted 29 lines
Quoted 29 lines
Quoted 9 lines
Instead of UNKNOWN response we can declare that
rte_flow_flush()must be called unless the application wants to keep the rules and has made sure it's possible, or the behavior is undefined. (Can be viewed as "UNKNOWN by default", but is simpler.) This way neither UNKNOWN state is needed,
nor the bit saying the flow rules are flushed.
Here is why, let's consider KEEP and FLUSH combinations:Quoted 6 lines
(1) FLUSH=0, KEEP=0 is equivalent to UNKNOWN, i.e. the application must explicitly flush the rules itself in order to get deterministic behavior.
(2) FLUSH=1, KEEP=0 means PMD flushes all rules on the device stop.
(3) FLUSH=0, KEEP=1 means PMD can keep at least some rules, exact support must be checked with
rte_flow_create()Quoted 3 lines
when the device is stopped.
(4) FLUSH=1, KEEP=1 is forbidden.What is 'FLUSH' here? Are you proposing a new capability?
Quoted 7 lines
If the application doesn't need the PMD to keep flow rules, it can as well flush them always before the device stop regardless of whether the driver does it automatically or not. It's even simpler and probably as efficient. Testpmd does this. If the application wants to take advantage of rule-keeping ability, it just tests the KEEP bit. If it is unset that's the previous case, application should call
rte_flow_flush()before the device stop to beQuoted 6 lines
Quoted 6 lines
sure.
Quoted 3 lines
Otherwise, the application can test capability to keep flow rule kinds it is interested in (see my reply to Andrew).
Overall this is an optimization, application can workaround without
this
Quoted 7 lines
Quoted 7 lines
capability.
If driver doesn't set KEEP capability, it is not clear what does it mean, driver doesn't keep rules or driver is not updated yet. I suggest to update comment to clarify the meaning of the missing KEEP flag.
Quoted 6 lines
Quoted 6 lines
And unless we have two explicit status flags application can never be sure that driver doesn't keep rules after stop. I am don't know if application wants to know this.
Other concern is how PMD maintainers will know that there is something to update here, I am sure many driver maintainers won't even be aware
of
Quoted 13 lines
Quoted 13 lines
this, your patch doesn't even cc them. Your approach feels like you are thinking only single PMD and ignore rest.
My intention was to have a way to follow drivers that is not updated, by marking them with UNKNOWN flag. But this also doesn't work with new drivers, they may forget setting capability.
What about following:
1) Clarify KEEP flag meaning:
having KEEP: flow rules are kept after stop
missing KEEP: unknown behaviorQuoted 5 lines
Quoted 3 lines
2) Mark all PMDs with useless flag:
dev_capa&= ~KEEP
Maintainer can remove or update this later, and we can easily track it.Item 1) is almost what I did in v2. The difference (or clarification) is
that
Quoted 6 lines
if the bit is set, it doesn't mean that all rules are kept. It allows the PMD to not support keeping some kinds of rules. Please see the doc update about how the kind is defined and how the application can test what is unsupported.
This complication is needed so that if a PMD cannot keep some exotic
kind of rules,
Quoted 2 lines
it is not forced to remove the capability completely, blocking optimizations even if the application doesn't use problematic
rule kinds.
Quoted 7 lines
It makes the capability future-proof.
The second flag (FLUSH) would not be of much help. Consider it is not set, but the PMD can keep some kinds of rules. The application still needs to test all the kinds it needs. But it needs to do the same if the KEEP bit is set. Only if it is set the application can skip the tests and
rte_flow_flush(),Quoted 3 lines
but these optimizations are small compared to keeping the rules itself.
Item 2) needs not to be done, because the absence of the bit is *the*
useless value:
Quoted 3 lines
it means the unspecified same behavior as it is presently. It is worth noting that currently any application that relies on the PMD to keep or flush the rules is non-portable, because PMD is allowed to do
anything.
Quoted 6 lines
To get a reliable behavior application must explicitly clear the rules.
Regarding you concern about maintainers forgetting to update PMDs, I think there are better task-tracking tools then constants in the code (the authors of golang's context.TODO may disagree :)
Hi Dmitry,
This is a valid concern, and adding code to the drivers proved that it works.
There are multiple authors updating the ethdev layer and expecting PMD maintainers will do required changes. For your case you are updating the PMD
you concern but how other PMD maintainers will even be aware that there is something to change in their PMD?
By your change you are putting some responsibility to other maintainers, without even cc'ing them. And it is for sure they are not reading all emails
in the mail list, they can't.Task-tracking is an option, it the past I tried to upstream some todo doc for PMDs. But I can see the additional maintenance cost to trace features from a central point, comparing the distributing it to PMDS (adding code to PMDs).
I think best method is whoever doing the ethdev layer do the relevant change
in the PMDs, but has the obvious problem that not able to know enough about
the PMDs to update them.Quoted 10 lines
We have used the following option, and it worked in the past:
- When an ethdev feature require change in PMDs, ehtdev supports both new and old method
- PMDs set a flag by default to request old method, so there is no update in the PMD default behavior
- When PMD does the required changes, it removes the flag
- This lets me (or other maintainer), to trace the update status and ping relevant maintainers
- When all PMDs updated, ethdev support for old method removed
- This method allows PMD maintainers do the change on their own time
Quoted 5 lines
Hi Ferruh,
Thanks for sharing the experience.
You suggest updating PMDs with an explicit reset of this bit, despite that it will be zero anyway, to attract maintainers' attention.
ack, but please with a brief comment to clarify intention.
Quoted 3 lines
From user's perspective it will be all the same: KEEP bit reset,
not a special value saying the PMD is not updated
that we would need to deprecate and remove later.
ack, only it needs to be clear for application that PMD not advertising KEEP flag means behavior is undefined, it does NOT mean PMD flush rules. Which you already said updated like this in v2, but I am just stressing it.
Quoted 3 lines
If this understanding is correct, then for sure I can add a patch updating the relevant PMDs.
PATCH 3/5 net/mlx5: discover max flow priority using DevX
In reply to [email protected]From: Dmitry Kozlyuk <[email protected]>
Maximum available flow priority was discovered using Verbs API regardless of the selected flow engine. This required some Verbs objects to be initialized in order to use DevX engine. Make priority discovery an engine method and implement it for DevX using its API.
--- drivers/net/mlx5/linux/mlx5_os.c | 1 - drivers/net/mlx5/mlx5_flow.c | 98 +++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 4 ++ drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +++------------------ 5 files changed, 215 insertions(+), 68 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -1
@@ -1830,7 +1830,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->drop_queue.hrxq =mlx5_drop_action_create (eth_dev);if (!priv->drop_queue.hrxq) goto error; -/* Supported Verbs flow priority number detection. */ err =mlx5_flow_discover_priorities (eth_dev);if (err <0 ) { err = -err;
drivers/net/mlx5/mlx5_flow.c +98 -0
101 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -1226,6 +1226,9 @@ typedef int (*mlx5_flow_create_def_policy_t) (struct rte_eth_dev *dev);typedef void (*mlx5_flow_destroy_def_policy_t ) (struct rte_eth_dev *dev); +typedef int (*mlx5_flow_discover_priorities_t ) + (struct rte_eth_dev *dev, +const uint16_t *vprio,int vprio_n);struct mlx5_flow_driver_ops {mlx5_flow_validate_t validate;
@@ -1260,6 +1263,7 @@ struct mlx5_flow_driver_ops {mlx5_flow_action_update_t action_update;mlx5_flow_action_query_t action_query;mlx5_flow_sync_domain_t sync_domain; +mlx5_flow_discover_priorities_t discover_priorities; };/* mlx5_flow.c */
drivers/net/mlx5/mlx5_flow_dv.c +103 -0
115 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_verbs.c +10 -67
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 4/5 net/mlx5: create drop queue using DevX
In reply to [email protected]From: Dmitry Kozlyuk <[email protected]>
Drop queue creation and destruction were not implemented for DevX flow engine and Verbs engine methods were used as a workaround. Implement these methods for DevX so that there is a valid queue ID that can be used regardless of queue configuration via API.
--- drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 204 ++++++++++++++++++++++++++----- 2 files changed, 176 insertions(+), 32 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -4
@@ -1790,10 +1790,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, }if (config->devx && config->dv_flow_en && config->dest_tir) { priv->obj_ops = devx_obj_ops; - priv->obj_ops.drop_action_create = - ibv_obj_ops.drop_action_create; - priv->obj_ops.drop_action_destroy = - ibv_obj_ops.drop_action_destroy;#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET priv->obj_ops.txq_obj_modify = ibv_obj_ops.txq_obj_modify;#else
drivers/net/mlx5/mlx5_devx.c +176 -28
294 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 5/5 net/mlx5: preserve indirect actions on restart
In reply to [email protected]From: Dmitry Kozlyuk <[email protected]>
MLX5 PMD uses reference counting to manage RX queue resources. After port stop shared RSS actions kept references to RX queues, preventing resource release. As a result, internal PMD mempool for such queues had been exhausted after a number of port restarts. Diagnostic message from rte_eth_dev_start():
Rx queue allocation failed: Cannot allocate memory
Dereference RX queues used by indirect actions on port stop (detach) and restore references on port start (attach) in order to allow RX queue resource release, but keep indirect RSS across the port restart. Replace queue IDs in HW by drop queue ID on detach and restore actual queue IDs on attach.
As a result, MLX5 PMD is able to keep all its indirect actions across port restart. Advertise this capability to the ethdev layer.
--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 194 ++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 ++ 6 files changed, 276 insertions(+), 34 deletions(-)
drivers/net/mlx5/mlx5_ethdev.c +1 -0
@@ -325,6 +325,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->reta_size = priv->reta_idx_n ? priv->reta_idx_n : config->ind_table_max_size; info->hash_key_size =MLX5_RSS_HASH_KEY_LEN ; + info->dev_capa =RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP ; info->speed_capa = priv->link_speed_capa; info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK ;mlx5_set_default_params (dev, info);
drivers/net/mlx5/mlx5_flow.c +171 -23
218 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1574,6 +1574,8 @@ void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev, struct mlx5_flow_meter_policy *mtr_policy);int mlx5_flow_dv_discover_counter_offset_support (struct rte_eth_dev *dev);int mlx5_flow_discover_dr_action_support (struct rte_eth_dev *dev); +int mlx5_action_handle_attach (struct rte_eth_dev *dev); +int mlx5_action_handle_detach (struct rte_eth_dev *dev);int mlx5_action_handle_flush (struct rte_eth_dev *dev);void mlx5_release_tunnel_hub (struct mlx5_dev_ctx_shared *sh,uint16_t port_id);int mlx5_alloc_tunnel_hub (struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/mlx5_rx.h +4 -0
@@ -222,6 +222,10 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); +int mlx5_ind_table_obj_attach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl); +int mlx5_ind_table_obj_detach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl);struct mlx5_list_entry *mlx5_hrxq_create_cb (void *tool_ctx,void *cb_ctx);int mlx5_hrxq_match_cb (void *tool_ctx,struct mlx5_list_entry *entry,void *cb_ctx);
drivers/net/mlx5/mlx5_rxq.c +88 -11
118 lines not on this page · raw message
drivers/net/mlx5/mlx5_trigger.c +10 -0
@@ -14,6 +14,7 @@#include <mlx5_malloc.h> #include "mlx5.h" +#include "mlx5_flow.h" #include "mlx5_mr.h" #include "mlx5_rx.h" #include "mlx5_tx.h"
@@ -1113,6 +1114,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)mlx5_rxq_timestamp_set (dev);/* Set a mask and offset of scheduling on timestamp into Tx queues. */ mlx5_txq_dynf_timestamp_set (dev); +/* Attach indirection table objects detached on port stop. */ + ret =mlx5_action_handle_attach (dev); +if (ret) { +DRV_LOG (ERR , +"port %u failed to attach indirect actions: %s" , + dev->data->port_id,rte_strerror (rte_errno)); + goto error; + }/* * In non-cached mode, it only needs to start the default mreg copy * action and no flow created by application exists anymore.
@@ -1185,6 +1194,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)/* All RX queue flags will be cleared in the flush interface. */ mlx5_flow_list_flush (dev,MLX5_FLOW_TYPE_GEN , true);mlx5_flow_meter_rxq_flush (dev); +mlx5_action_handle_detach (dev);mlx5_rx_intr_vec_disable (dev); priv->sh->port[priv->dev_port -1 ].ih_port_id =RTE_MAX_ETHPORTS ; priv->sh->port[priv->dev_port -1 ].devx_ih_port_id =RTE_MAX_ETHPORTS ;
Signature · 1 line
2.25.1
v2 cover Flow entites behavior on port restart
In reply to [email protected]It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and rte_flow calls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/
Dmitry Kozlyuk (5):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
doc/guides/prog_guide/rte_flow.rst | 51 +++++ drivers/net/mlx5/linux/mlx5_os.c | 5 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++++++--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 292 ++++++++++++++++++++++++++--- drivers/net/mlx5/mlx5_flow.h | 6 + drivers/net/mlx5/mlx5_flow_dv.c | 103 ++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +------- drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 + lib/ethdev/rte_ethdev.h | 10 + lib/ethdev/rte_flow.h | 1 + 13 files changed, 733 insertions(+), 137 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/5 ethdev: add capability to keep flow rules on restart
Currently, it is 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, which together comprise the rule kind.
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, which is now explicitly stated. Declare that the application can test for persitence of flow rules of a particular kind by attempting to create a rule of that kind 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.
If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues.
--- doc/guides/prog_guide/rte_flow.rst | 27 +++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 35 insertions(+)
doc/guides/prog_guide/rte_flow.rst +27 -0
@@ -87,6 +87,33 @@ 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. +By default it is unspecified if the flow rules persist after the device stop. +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised, +then rules must be explicitly flushed before stopping the device +if the application needs to ensure they are removed. +If it is advertised, this means the PMD can keep at least some rules +across the device stop and start with possible reconfiguration in between. +However, it may be only supported for some kinds of rules. +The kind is a combination of the following rule properties: + +- the sequence of item types; +- the sequence of action types; +- the value of the transfer attribute. + +To test if a particular kind of rules is kept, the application must try +to create a valid rule of that kind when the device is stopped +(after it has been configured or started previously). +If it succeeds, all rules of the same kind are kept at the device stop. +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules of this kind are flushed when the device is stopped. +Rules of a kept kind that are created when the device is stopped, including +the rules created for the test, will be kept after the device is started. +Some configuration changes may be incompatible with existing rules. +In this case ``rte_eth_dev_configure()``, ``rte_eth_rx/tx_queue_setup()``, +and/or ``rte_eth_dev_start()`` will fail with a log message from the PMD that +should be similar to the one that would be emitted by ``rte_flow_create()`` +if an attempt was made to create the offending rule with the new configuration. + The following sections cover: - **Attributes** (represented by ``struct rte_flow_attr``): properties of a
lib/ethdev/rte_ethdev.h +7 -0
@@ -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/**@}*/ /*
lib/ethdev/rte_flow.h +1 -0
@@ -3344,6 +3344,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. */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restart
Quoted 10 lines · Dmitry Kozlyuk
Currently, it is 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, which together comprise the rule kind.
Quoted 6 lines
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, which is now explicitly stated. Declare that the application can test for persitence of flow rules of a particular kind by attempting to create a rule of that kind when the device is stopped and checking for the specific error.
stopped -> configured but not yet started
Quoted 1 line
This is logical because if the PMD can to create the flow rule
can to -> can
Quoted 25 lines
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.
If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues.
Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 27 +++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 35 insertions(+)doc/guides/prog_guide/rte_flow.rst +0
-0
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 90
Quoted 4 lines
doc/guides/prog_guide/rte_flow.rst +1
-0@@ -87,6 +87,33 @@ 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. +By default it is unspecified if the flow rules persist after the device stop.
or can be created before the first device start
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised, +then rules must be explicitly flushed before stopping the device +if the application needs to ensure they are removed. +If it is advertised, this means the PMD can keep at least some rules +across the device stop and start with possible reconfiguration in between. +However, it may be only supported for some kinds of rules. +The kind is a combination of the following rule properties: + +- the sequence of item types; +- the sequence of action types;
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 110
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+- the value of the transfer attribute. + +To test if a particular kind of rules is kept, the application must try +to create a valid rule of that kind when the device is stopped +(after it has been configured or started previously). +If it succeeds, all rules of the same kind are kept at the device stop. +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules of this kind are flushed when the device is stopped. +Rules of a kept kind that are created when the device is stopped, including +the rules created for the test, will be kept after the device is started.
It must be defined what application should expect for not tested rule kinds.
For me about check sounds extremely complicated and hardly doable. Yes, some applications know kinds of rule it would like to create, but some, like OvS, do not. Please, correct me if I'm wrong. OvS knows which types of actions and even possible combinations of actions (harder, but still possible) it would like to install. But all possible combinations of items together with all possible combinations of actions could be very-very big.
May be I still misunderstand the above idea.
Quoted 47 lines
doc/guides/prog_guide/rte_flow.rst +6
-0+Some configuration changes may be incompatible with existing rules. +In this case ``rte_eth_dev_configure()``, ``rte_eth_rx/tx_queue_setup()``, +and/or ``rte_eth_dev_start()`` will fail with a log message from the PMD that +should be similar to the one that would be emitted by ``rte_flow_create()`` +if an attempt was made to create the offending rule with the new configuration. + The following sections cover: - **Attributes** (represented by ``struct rte_flow_attr``): properties of alib/ethdev/rte_ethdev.h +7
-0@@ -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/**@}*/ /* lib/ethdev/rte_flow.h +1
-0@@ -3344,6 +3344,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. */ };/**
Re: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restart
Quoted 9 lines
Quoted 7 lines
[...]
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, which is now explicitly stated. Declare that the application can test for persitence of flow rules of a particular kind by attempting to create a rule of that kind when the device is stopped and checking for the specific error.stopped -> configured but not yet started
Correct, fixed in v3.
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/doc/guides/prog_guide/rte_flow.rstdoc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must
Quoted 4 lines
index
2b42d5ec8c..b0ced4209b100644doc/guides/prog_guide/rte_flow.rst +0
-0@@ -87,6 +87,33 @@ To avoid resource leaks on the PMD side, handles mustbe explicitly
Quoted 8 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 87
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +0
-0destroyed by the application before releasing associated resources suchas
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly
Quoted 3 lines
doc/guides/prog_guide/rte_flow.rst +1
-0queues and ports. +By default it is unspecified if the flow rules persist after the devicestop.
or can be created before the first device start
Correct, fixed in v3.
Quoted 37 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly
Quoted 6 lines
doc/guides/prog_guide/rte_flow.rst +5
-0+If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised, +then rules must be explicitly flushed before stopping the device +if the application needs to ensure they are removed. +If it is advertised, this means the PMD can keep at least some rules +across the device stop and start with possible reconfiguration inbetween.
Quoted 4 lines
doc/guides/prog_guide/rte_flow.rst +4
-0+However, it may be only supported for some kinds of rules. +The kind is a combination of the following rule properties: + +- the sequence of item types;doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+- the sequence of action types; +- the value of the transfer attribute. + +To test if a particular kind of rules is kept, the application must try +to create a valid rule of that kind when the device is stopped +(after it has been configured or started previously). +If it succeeds, all rules of the same kind are kept at the device stop. +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules of this kind are flushed when the device is stopped. +Rules of a kept kind that are created when the device is stopped,including
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 110
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +1
-0+the rules created for the test, will be kept after the device isstarted.
It must be defined what application should expect for not tested rule kinds.
For me about check sounds extremely complicated and hardly doable. Yes, some applications know kinds of rule it would like to create, but some, like OvS, do not. Please, correct me if I'm wrong. OvS knows which types of actions and even possible combinations of actions (harder, but still possible) it would like to install. But all possible combinations of items together with all possible combinations of actions could be very-very big.
Quoted 1 line
May be I still misunderstand the above idea.
This is a very valid concern.
After an offline consideration me and Ori concluded
that an item/action type + transfer bit ("a feature") is enough. That is, if some feature cannot be kept, no rules using it can be kept.
Re: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restart
In reply to Dmitry KozlyukQuoted 33 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Dmitry Kozlyuk
Sent: Saturday, October 16, 2021 12:18 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restartCurrently, it is 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, which together comprise the rule kind.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, which is now explicitly stated.
Declare that the application can test for persitence of flow rules of a particular kind by attempting to create a rule of that kind 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.
Quoted 4 lines
If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error.
This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid.
What if a PMD does not flush rules during start /stop cycle, but just want to simply flush rules during dev_config? Is it reasonable to take above as an typical implementation to avoid all the complexity for handling the conflicts?
1. queues are destroyed and re-created with a different number which may impact "to queue" action.
2. hash key may be overwritten which impact RSS result.
3. offload flags changes may impact data path selection which cause mark action does not work.
....
Quoted 90 lines
example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues.
Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 27 +++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 35 insertions(+)doc/guides/prog_guide/rte_flow.rst +0
-0@@ -87,6 +87,33 @@ To avoid resource leaks on the PMD side, handles mustbe explicitly destroyed by the application before releasing associated resources such as queues and ports.
doc/guides/prog_guide/rte_flow.rst +26
-0+By default it is unspecified if the flow rules persist after the device stop. +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised, then rules +must be explicitly flushed before stopping the device if the +application needs to ensure they are removed. +If it is advertised, this means the PMD can keep at least some rules +across the device stop and start with possible reconfiguration in between. +However, it may be only supported for some kinds of rules. +The kind is a combination of the following rule properties: + +- the sequence of item types; +- the sequence of action types; +- the value of the transfer attribute. + +To test if a particular kind of rules is kept, the application must try +to create a valid rule of that kind when the device is stopped (after +it has been configured or started previously). +If it succeeds, all rules of the same kind are kept at the device stop. +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, rules +of this kind are flushed when the device is stopped. +Rules of a kept kind that are created when the device is stopped, +including the rules created for the test, will be kept after the device is started. +Some configuration changes may be incompatible with existing rules. +In this case ``rte_eth_dev_configure()``, +``rte_eth_rx/tx_queue_setup()``, and/or ``rte_eth_dev_start()`` will +fail with a log message from the PMD that should be similar to the one +that would be emitted by ``rte_flow_create()`` if an attempt was made tocreate the offending rule with the new configuration. +
The following sections cover:- **Attributes** (represented by ``struct rte_flow_attr``): properties of a diff
--gita/lib/ethdev/rte_ethdev.hb/lib/ethdev/rte_ethdev.hindex6d80514ba7..a0b388bb25100644lib/ethdev/rte_ethdev.h +5
-0@@ -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_SETUP0x00000001
/** Device supports Tx queue setup after device started. */ #defineRTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP0x00000002lib/ethdev/rte_ethdev.h +2
-0+/** Device supports keeping flow rules across restart. */ #define +RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004/**@}*/ /* lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0
-0
a89945061a..aa0182d021100644lib/ethdev/rte_flow.h +1
-1@@ -3344,6 +3344,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. */ };/** -- 2.25.1
Re: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restart
Quoted 68 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: 18 октября 2021 г. 16:06
To: Dmitry Kozlyuk <[email protected]>; [email protected]
Cc: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restartExternal email: Use caution opening links or attachments
Quoted 8 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Dmitry Kozlyuk
Sent: Saturday, October 16, 2021 12:18 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flowrules
Quoted 3 lines
on restart
Currently, it is not specified what happens to the flow rules when the
device is
Quoted 2 lines
stopped, possibly reconfigured, then started.
If flow rules were kept, it could be convenient for applicationdevelopers,
Quoted 3 lines
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
Quoted 2 lines
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
Quoted 3 lines
attributes transfer bit, which together comprise the rule kind.
Add a device capability bit for PMDs that can keep at least some of the
flow
Quoted 1 line
rules across restart. Without this capability behavior is still
unspecified, which
Quoted 2 lines
is now explicitly stated.
Declare that the application can test for persitence of flow rules of aparticular
Quoted 1 line
kind by attempting to create a rule of that kind when the device is
stopped
Quoted 2 lines
and checking for the specific error.
This is logical because if the PMD can to create the flow rule when thedevice
Quoted 1 line
is not started and use it after the start happens, it is natural that it
can move
Quoted 1 line
its internal flow rule object to the same state when the device is
stopped and
Quoted 3 lines
restore the state when the device is started.
If the device is being reconfigured in a way that is incompatible with
existing
Quoted 2 lines
flow rules, PMD is required to report an error.
This is mandatory, because flow API does not supply users withcapabilities, so
Quoted 1 line
this is the only way for a user to learn that configuration is invalid.
What if a PMD does not flush rules during start /stop cycle, but just want to simply flush rules during
dev_config?
Is it reasonable to take above as an typical implementation to avoid all the complexity for handling the conflicts?
Quoted 6 lines
1. queues are destroyed and re-created with a different number which may impact "to queue" action.
2. hash key may be overwritten which impact RSS result.
3. offload flags changes may impact data path selection which cause mark action does not work.
....
Hello Qi,
Yes, it sounds reasonable that rules do need not to persist across reconfiguration. Unlike indirect actions, they are too numerous for PMD to track and check. I'm not sure rte_eth_dev_configure() should be specified to implicitly flush them. Some PMDs may wish to preserve the rules even then in the future,
so we don't want applications to rely on configure flushing the rules. It can be specified that applications should flush the rules themselves before.
Re: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restart
Quoted 98 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Tuesday, October 19, 2021 6:51 AM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restartQuoted 77 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: 18 октября 2021 г. 16:06
To: Dmitry Kozlyuk <[email protected]>; [email protected]
Cc: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flow rules on restartExternal email: Use caution opening links or attachments
Quoted 9 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Dmitry Kozlyuk
Sent: Saturday, October 16, 2021 12:18 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [dpdk-dev] [PATCH v2 1/5] ethdev: add capability to keep flowrules
Quoted 4 lines
on restart
Currently, it is not specified what happens to the flow rules when the
device is
Quoted 2 lines
stopped, possibly reconfigured, then started.
If flow rules were kept, it could be convenient for applicationdevelopers,
Quoted 4 lines
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
Quoted 3 lines
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
Quoted 4 lines
attributes transfer bit, which together comprise the rule kind.
Add a device capability bit for PMDs that can keep at least some of the
flow
Quoted 1 line
rules across restart. Without this capability behavior is still
unspecified, which
Quoted 3 lines
is now explicitly stated.
Declare that the application can test for persitence of flow rules of aparticular
Quoted 1 line
kind by attempting to create a rule of that kind when the device is
stopped
Quoted 3 lines
and checking for the specific error.
This is logical because if the PMD can to create the flow rule when thedevice
Quoted 2 lines
is not started and use it after the start happens, it is natural that it
can move
Quoted 1 line
its internal flow rule object to the same state when the device is
stopped and
Quoted 4 lines
restore the state when the device is started.
If the device is being reconfigured in a way that is incompatible with
existing
Quoted 2 lines
flow rules, PMD is required to report an error.
This is mandatory, because flow API does not supply users withcapabilities, so
Quoted 1 line
this is the only way for a user to learn that configuration is invalid.
What if a PMD does not flush rules during start /stop cycle, but just want to simply flush rules during
dev_config?
Is it reasonable to take above as an typical implementation to avoid all the complexity for handling the conflicts?Quoted 6 lines
1. queues are destroyed and re-created with a different number which may impact "to queue" action.
2. hash key may be overwritten which impact RSS result.
3. offload flags changes may impact data path selection which cause mark action does not work.
....Hello Qi,
Quoted 8 lines
Yes, it sounds reasonable that rules do need not to persist across reconfiguration.
Unlike indirect actions, they are too numerous for PMD to track and check. I'm not surerte_eth_dev_configure()should be specified to implicitly flush them.
Some PMDs may wish to preserve the rules even then in the future, so we don't want applications to rely on configure flushing the rules. It can be specified that applications should flush the rules themselves before.
OK, I'm trying to figure out how to set this "keep" capability for a PMD that don't want application to re-create rules after dev_stop, but still want rules be flushed before reconfigure. I think the answer is it should expose the "keep" capability and simply return error in dev_configure if any rules exists, thanks
PATCH v2 2/5 ethdev: add capability to keep shared objects on restart
In reply to Dmitry Kozlyukrte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. Also the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.
Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, but now it is stated explicitly.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
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 shared object to the same state when the device is stopped and restore the state when the device is started.
If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.
--- doc/guides/prog_guide/rte_flow.rst | 24 ++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 27 insertions(+)
doc/guides/prog_guide/rte_flow.rst +24 -0
@@ -2812,6 +2812,30 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +By default it is unspecified if indirect actions persist after the device stop. +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +then indirect actions must be explicitly destroyed before stopping the device +if the application needs to ensure they are removed. +If it is advertised, this means the PMD can keep at least some indirect actions +across device stop and start with possible reconfiguration in between. +However, it may be only supported for certain kinds of indirect actions. +The kind is a combination of the action type and the value of its transfer bit. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is stopped (after it has been configured or started previously). +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +indirect actions of this kind are flushed when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. +Some configuration changes may be incompatible with existing indirect actions. +In this case ``rte_eth_dev_configure()``, ``rte_eth_rx/tx_queue_setup()``, +and/or ``rte_eth_dev_start()`` will fail with a log message from the PMD that +should be similar to the one that would be emitted +by ``rte_flow_action_handle_create()`` if an attempt was made +to create the offending rule with the new configuration. + .. _table_rte_flow_action_handle: .. table:: INDIRECT
lib/ethdev/rte_ethdev.h +3 -0
@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start().
@@ -1452,6 +1453,8 @@ struct rte_eth_conf {#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 +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008/**@}*/ /*
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 2/5] ethdev: add capability to keep shared objects on restart
Hi Dmitry
Quoted 46 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Friday, October 15, 2021 7:18 PM
To: [email protected]
Subject: [PATCH v2 2/5] ethdev: add capability to keep shared objects on restart
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it.
Also the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, but now it is stated explicitly. In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
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 shared object to the same state when the device is stopped and restore the state when the device is started.If the device is being reconfigured in a way that is incompatible with an existing shared objects, PMD is required to report an error.
This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it.Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 24 ++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 27 insertions(+)doc/guides/prog_guide/rte_flow.rst +0
-0@@ -2812,6 +2812,30 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by``rte_flow_action_handle_query()``.
doc/guides/prog_guide/rte_flow.rst
Quoted 4 lines
doc/guides/prog_guide/rte_flow.rst +4
-0+By default it is unspecified if indirect actions persist after the device stop. +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, then +indirect actions must be explicitly destroyed before stopping the +device if the application needs to ensure they are removed.
I don't understand the above line, if indirect actions must be explicitly destroyed what does it means "if the application needs to ensure?)
I think it should say just like now, application should destroy all shared objects before stopping. If application doesn't call the destroy the state of the action is undefined.
Quoted 44 lines
doc/guides/prog_guide/rte_flow.rst +20
-0+If it is advertised, this means the PMD can keep at least some indirect +actions across device stop and start with possible reconfiguration in between. +However, it may be only supported for certain kinds of indirect actions. +The kind is a combination of the action type and the value of its transfer bit. +To test if a particular kind of indirect actions is kept, the +application must try to create a valid indirect action of that kind +when the device is stopped (after it has been configured or started previously). +If it succeeds, all indirect actions of the same kind are kept when the +device is stopped. +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +indirect actions of this kind are flushed when the device is stopped. +Indirect actions of a kept kind that are created when the device is +stopped, including the ones created for the test, will be kept after the device start. +Some configuration changes may be incompatible with existing indirect actions. +In this case ``rte_eth_dev_configure()``, +``rte_eth_rx/tx_queue_setup()``, and/or ``rte_eth_dev_start()`` will +fail with a log message from the PMD that should be similar to the one +that would be emitted by ``rte_flow_action_handle_create()`` if an +attempt was made to create the offending rule with the new configuration. + .. _table_rte_flow_action_handle: .. table:: INDIRECTlib/ethdev/rte_ethdev.h +1
-0@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start(). @@ -1452,6 +1453,8 @@ struct rte_eth_conf { #define
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP0x00000002
/** Device supports keeping flow rules across restart. */ #defineRTE_ETH_DEV_CAPA_FLOW_RULE_KEEP0x00000004lib/ethdev/rte_ethdev.h +2
-1+/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008/**@}*/ /* --
Quoted 1 line
2.25.1
Best,
Ori
Re: [dpdk-dev] [PATCH v2 2/5] ethdev: add capability to keep shared objects on restart
Quoted 14 lines
[...]
Quoted 1 line
+By default it is unspecified if indirect actions persist after the
device stop.
Review
Quoted 3 lines
(quoted diff) +3
-0+If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, then +indirect actions must be explicitly destroyed before stopping the +device if the application needs to ensure they are removed.I don't understand the above line, if indirect actions must be explicitly destroyed
what does it means "if the application needs to ensure?)
I think it should say just like now, application should destroy all shared objects before
stopping. If application doesn't call the destroy the state of the action is undefined.
I had in mind that some applications don't care, because they only stop the port before closing it. Would the following be more explicit?
"If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, the state of indirect actions after the device stop is undefined. Application must destroy all indirect actions before stopping the port if it intends to start it later, or unwanted indirect actions can remain."
Re: [dpdk-dev] [PATCH v2 2/5] ethdev: add capability to keep shared objects on restart
Hi Dmitry.
Quoted 18 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Sunday, October 17, 2021 12:15 PM
Subject: RE: [PATCH v2 2/5] ethdev: add capability to keep shared objects on restartQuoted 12 lines
[...]
Quoted 1 line
+By default it is unspecified if indirect actions persist after the
device stop.
Review
Quoted 3 lines
(quoted diff) +3
-0+If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +then indirect actions must be explicitly destroyed before stopping +the device if the application needs to ensure they are removed.I don't understand the above line, if indirect actions must be explicitly destroyed what does it means "if the application needs to ensure?) I think it should say just like now, application should destroy all shared objects before stopping. If application doesn't call the destroy the state of the action is undefined.
Quoted 7 lines
I had in mind that some applications don't care, because they only stop the port before closing it. Would the following be more explicit?
"If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, the state of indirect actions after the device stop is undefined.
Application must destroy all indirect actions before stopping the port if it intends to start it later, or unwanted indirect actions can remain."
Sounds better, but I would also add something like this: if PMD doesn''t report keep, application should release resource before stopping / closing the port otherwise resource leak may happen.
This should also be in the flows patch.
Best,
Ori
PATCH v2 3/5 net/mlx5: discover max flow priority using DevX
In reply to Dmitry KozlyukMaximum available flow priority was discovered using Verbs API regardless of the selected flow engine. This required some Verbs objects to be initialized in order to use DevX engine. Make priority discovery an engine method and implement it for DevX using its API.
--- drivers/net/mlx5/linux/mlx5_os.c | 1 - drivers/net/mlx5/mlx5_flow.c | 98 +++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 4 ++ drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +++------------------ 5 files changed, 215 insertions(+), 68 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -1
@@ -1830,7 +1830,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->drop_queue.hrxq =mlx5_drop_action_create (eth_dev);if (!priv->drop_queue.hrxq) goto error; -/* Supported Verbs flow priority number detection. */ err =mlx5_flow_discover_priorities (eth_dev);if (err <0 ) { err = -err;
drivers/net/mlx5/mlx5_flow.c +98 -0
101 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -1226,6 +1226,9 @@ typedef int (*mlx5_flow_create_def_policy_t) (struct rte_eth_dev *dev);typedef void (*mlx5_flow_destroy_def_policy_t ) (struct rte_eth_dev *dev); +typedef int (*mlx5_flow_discover_priorities_t ) + (struct rte_eth_dev *dev, +const uint16_t *vprio,int vprio_n);struct mlx5_flow_driver_ops {mlx5_flow_validate_t validate;
@@ -1260,6 +1263,7 @@ struct mlx5_flow_driver_ops {mlx5_flow_action_update_t action_update;mlx5_flow_action_query_t action_query;mlx5_flow_sync_domain_t sync_domain; +mlx5_flow_discover_priorities_t discover_priorities; };/* mlx5_flow.c */
drivers/net/mlx5/mlx5_flow_dv.c +103 -0
115 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_verbs.c +10 -67
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 4/5 net/mlx5: create drop queue using DevX
In reply to Dmitry KozlyukDrop queue creation and destruction were not implemented for DevX flow engine and Verbs engine methods were used as a workaround. Implement these methods for DevX so that there is a valid queue ID that can be used regardless of queue configuration via API.
--- drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++++++++++++++----- 2 files changed, 180 insertions(+), 35 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -4
@@ -1790,10 +1790,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, }if (config->devx && config->dv_flow_en && config->dest_tir) { priv->obj_ops = devx_obj_ops; - priv->obj_ops.drop_action_create = - ibv_obj_ops.drop_action_create; - priv->obj_ops.drop_action_destroy = - ibv_obj_ops.drop_action_destroy;#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET priv->obj_ops.txq_obj_modify = ibv_obj_ops.txq_obj_modify;#else
drivers/net/mlx5/mlx5_devx.c +180 -31
309 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 5/5 net/mlx5: preserve indirect actions on restart
In reply to Dmitry KozlyukMLX5 PMD uses reference counting to manage RX queue resources. After port stop shared RSS actions kept references to RX queues, preventing resource release. As a result, internal PMD mempool for such queues had been exhausted after a number of port restarts. Diagnostic message from rte_eth_dev_start():
Rx queue allocation failed: Cannot allocate memory
Dereference RX queues used by indirect actions on port stop (detach) and restore references on port start (attach) in order to allow RX queue resource release, but keep indirect RSS across the port restart. Replace queue IDs in HW by drop queue ID on detach and restore actual queue IDs on attach.
When the port is stopped, create indirect RSS in the detached state. As a result, MLX5 PMD is able to keep all its indirect actions across port restart. Advertise this capability.
--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 194 ++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 ++ 6 files changed, 276 insertions(+), 34 deletions(-)
drivers/net/mlx5/mlx5_ethdev.c +1 -0
@@ -321,6 +321,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->rx_offload_capa = (mlx5_get_rx_port_offloads () | info->rx_queue_offload_capa); info->tx_offload_capa =mlx5_get_tx_port_offloads (dev); + info->dev_capa =RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP ; info->if_index =mlx5_ifindex (dev); info->reta_size = priv->reta_idx_n ? priv->reta_idx_n : config->ind_table_max_size;
drivers/net/mlx5/mlx5_flow.c +171 -23
218 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1574,6 +1574,8 @@ void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev, struct mlx5_flow_meter_policy *mtr_policy);int mlx5_flow_dv_discover_counter_offset_support (struct rte_eth_dev *dev);int mlx5_flow_discover_dr_action_support (struct rte_eth_dev *dev); +int mlx5_action_handle_attach (struct rte_eth_dev *dev); +int mlx5_action_handle_detach (struct rte_eth_dev *dev);int mlx5_action_handle_flush (struct rte_eth_dev *dev);void mlx5_release_tunnel_hub (struct mlx5_dev_ctx_shared *sh,uint16_t port_id);int mlx5_alloc_tunnel_hub (struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/mlx5_rx.h +4 -0
@@ -222,6 +222,10 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); +int mlx5_ind_table_obj_attach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl); +int mlx5_ind_table_obj_detach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl);struct mlx5_list_entry *mlx5_hrxq_create_cb (void *tool_ctx,void *cb_ctx);int mlx5_hrxq_match_cb (void *tool_ctx,struct mlx5_list_entry *entry,void *cb_ctx);
drivers/net/mlx5/mlx5_rxq.c +88 -11
118 lines not on this page · raw message
drivers/net/mlx5/mlx5_trigger.c +10 -0
@@ -14,6 +14,7 @@#include <mlx5_malloc.h> #include "mlx5.h" +#include "mlx5_flow.h" #include "mlx5_mr.h" #include "mlx5_rx.h" #include "mlx5_tx.h"
@@ -1113,6 +1114,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)mlx5_rxq_timestamp_set (dev);/* Set a mask and offset of scheduling on timestamp into Tx queues. */ mlx5_txq_dynf_timestamp_set (dev); +/* Attach indirection table objects detached on port stop. */ + ret =mlx5_action_handle_attach (dev); +if (ret) { +DRV_LOG (ERR , +"port %u failed to attach indirect actions: %s" , + dev->data->port_id,rte_strerror (rte_errno)); + goto error; + }/* * In non-cached mode, it only needs to start the default mreg copy * action and no flow created by application exists anymore.
@@ -1185,6 +1194,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)/* All RX queue flags will be cleared in the flush interface. */ mlx5_flow_list_flush (dev,MLX5_FLOW_TYPE_GEN , true);mlx5_flow_meter_rxq_flush (dev); +mlx5_action_handle_detach (dev);mlx5_rx_intr_vec_disable (dev); priv->sh->port[priv->dev_port -1 ].ih_port_id =RTE_MAX_ETHPORTS ; priv->sh->port[priv->dev_port -1 ].devx_ih_port_id =RTE_MAX_ETHPORTS ;
Signature · 1 line
2.25.1
v3 cover Flow entites behavior on port restart
In reply to Dmitry KozlyukIt is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and rte_flow calls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/
v3: 1. Add a patch 3/6 to update all PMDs that implement rte_flow
with an explicit reset of the new capability (Ferruh).
2. Change how the support of keeping particular kinds of flow rules is determined, improve wording (Andrew).
3. Do not require keeping rules and indirect actions across reconfiguration (Qi Zhang).
4. Improve wording (Ori).
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
doc/guides/prog_guide/rte_flow.rst | 49 ++++ drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 + drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 + drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mlx5/linux/mlx5_os.c | 5 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 292 ++++++++++++++++++++++-- drivers/net/mlx5/mlx5_flow.h | 6 + drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +------ drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 +++++++- drivers/net/mlx5/mlx5_trigger.c | 10 + drivers/net/mvpp2/mrvl_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + lib/ethdev/rte_ethdev.h | 10 + lib/ethdev/rte_flow.h | 1 + 39 files changed, 762 insertions(+), 137 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/6 ethdev: add capability to keep flow rules on restart
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 persitence 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.
--- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 33 insertions(+)
doc/guides/prog_guide/rte_flow.rst +25 -0
@@ -87,6 +87,31 @@ 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. +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 an item or action type and a value of the transfer bit +is called a rule feature. +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 stopped +(after it has been configured or started previously). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules using this feature are flushed when the device is stopped. +If it suceeds, 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
lib/ethdev/rte_ethdev.h +7 -0
@@ -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/**@}*/ /*
lib/ethdev/rte_flow.h +1 -0
@@ -3344,6 +3344,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. */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart
Hi Dmitry,
Quoted 111 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Dmitry Kozlyuk
Sent: Tuesday, October 19, 2021 3:37 PM
To: [email protected]
Cc: Qi Zhang <[email protected]>; Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restartPreviously, 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 persitence 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 <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 33 insertions(+)doc/guides/prog_guide/rte_flow.rst +0
-0@@ -87,6 +87,31 @@ To avoid resource leaks on the PMD side, handles must be explicitly destroyedby the application before releasing associated resources such as queues and ports.
doc/guides/prog_guide/rte_flow.rst +25
-0+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 an item or action type and a value of the transfer bit +is called a rule feature. +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 +stopped (after it has been configured or started previously). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, rules +using this feature are flushed when the device is stopped. +If it suceeds, 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.hb/lib/ethdev/rte_ethdev.hindex6d80514ba7..a0b388bb25100644lib/ethdev/rte_ethdev.h +5
-0@@ -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_SETUP0x00000001
/** Device supports Tx queue setup after device started. */ #defineRTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP0x00000002lib/ethdev/rte_ethdev.h +2
-0+/** Device supports keeping flow rules across restart. */ #define +RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004/**@}*/ /* lib/ethdev/rte_flow.h +1
-1@@ -3344,6 +3344,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. */ };/** --
Quoted 1 line
2.25.1
Best,
Ori
Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart
In reply to Dmitry Kozlyukdoc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 92
Quoted 11 lines · Dmitry Kozlyuk
doc/guides/prog_guide/rte_flow.rst +3
-0@@ -87,6 +87,31 @@ 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. +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.
So flag means two things:
1) rules cannot be created until the device is started for the first time
2) rules cannot be kept when the device is stopped
Can't be a case one is true but other is not? I was thinking flag is only for (2).
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 100
Quoted 8 lines
doc/guides/prog_guide/rte_flow.rst +8
-0+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.
If there are any remaining rules, should we fail the ``rte_eth_dev_configure()``, or is it allowed PMD to flush the rules itself?
As far as I know some Intel PMDs flush remaining rules in configure itself without failing, @Qi can correct me if I am wrong.
Quoted 4 lines
doc/guides/prog_guide/rte_flow.rst +4
-0+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 an item or action type and a value of the transfer bit +is called a rule feature.
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 114
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+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 stopped +(after it has been configured or started previously). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules using this feature are flushed when the device is stopped. +If it suceeds, 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. +
I understand the intention, but I don't know if this is true for all devices. Can't there be a case that driver can't create rule when it is stopped, but it can keep the rules after stop. Or other-way around, driver can create rule when it is stopped, but can't keep rule after stop.
I am feeling we are missing comments from different vendors if this logic works for them.
Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart
Quoted 33 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 19 октября 2021 г. 19:39
To: Dmitry Kozlyuk <[email protected]>; [email protected]; Qi Zhang <[email protected]>
Cc: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: Re: [PATCH v3 1/6] ethdev: add capability to keep flow rules on restartExternal email: Use caution opening links or attachments
Review
Quoted 1 line · Dmitry Kozlyuk
(quoted diff) +0
-0
b/doc/guides/prog_guide/rte_flow.rstdoc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must
Quoted 4 lines
index
2b42d5ec8c..ff67b211e3100644doc/guides/prog_guide/rte_flow.rst +0
-0@@ -87,6 +87,31 @@ To avoid resource leaks on the PMD side, handles mustbe explicitly
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 87
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +0
-0destroyed by the application before releasing associated resourcessuch as
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 92
Quoted 5 lines
doc/guides/prog_guide/rte_flow.rst +3
-0queues and 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.So flag means two things:
1) rules cannot be created until the device is started for the first time
2) rules cannot be kept when the device is stopped
Quoted 2 lines
Can't be a case one is true but other is not? I was thinking flag is only for (2).
It theoretically can, but it doesn't seem feasible to separate these capabilities:
a) Suppose a PMD can create rules before the device is started. They are in some special state when they are not applied to the traffic. When the device is started, these rules begin being applied. When the device is stopped, what would make the PMD unable to move the rules back to the detached state they were before the start? And then attach them back?
b) Suppose a PMD can keep the rules between stop and start. It must be able to move them to the detached stated described above on the device stop and attach them back when it is started again. What would prevent the PMD to create rules in a detached state before the device is started for the first time?
That's what I had in mind before,
and now it is just stated explicitly per Andrew's suggestion:
https://inbox.dpdk.org/dev/[email protected]
Quoted 14 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 94
Quoted 2 lines
doc/guides/prog_guide/rte_flow.rst +2
-0+However, PMD also does not flush them automatically on stop, +so the application must call ``rte_flow_flush()`` or``rte_flow_destroy()``
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 100
Quoted 6 lines
doc/guides/prog_guide/rte_flow.rst +6
-0+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.If there are any remaining rules, should we fail the ``rte_eth_dev_configure()``,
or is it allowed PMD to flush the rules itself?
Quoted 2 lines
As far as I know some Intel PMDs flush remaining rules in configure itself without failing, @Qi can correct me if I am wrong.
Implicit flush is non-orthogonal API,
which only makes sense if it gives some performance benefit.
Quoted 6 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly
Quoted 5 lines
doc/guides/prog_guide/rte_flow.rst +5
-0+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 an item or action type and a value of the transfer bit +is called a rule feature. +To test if rules with a particular feature are kept, the applicationmust try
Quoted 15 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 114
Quoted 9 lines
doc/guides/prog_guide/rte_flow.rst +9
-0+to create a valid rule using this feature when the device is stopped +(after it has been configured or started previously). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules using this feature are flushed when the device is stopped. +If it suceeds, 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. +I understand the intention, but I don't know if this is true for all devices.
Can't there be a case that driver can't create rule when it is stopped, but it can keep the rules after stop. Or other-way around, driver can create rule when it is stopped, but can't keep rule after stop.
Isn't it the same consideration as the first comment? If so, it's about the ability to have a rule in a detached state given its features.
Quoted 2 lines
I am feeling we are missing comments from different vendors if this logic works for them.
Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart
In reply to Dmitry KozlyukQuoted 11 lines · Dmitry Kozlyuk
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).
Quoted 5 lines
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 persitence of rules using
persitence -> persistence
Quoted 35 lines
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 <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 33 insertions(+)doc/guides/prog_guide/rte_flow.rst +5
-0@@ -87,6 +87,31 @@ 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. +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()``
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 104
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+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 an item or action type and a value of the transfer bit +is called a rule feature.
As I said before a combination is very hard to test and unfriendly to applications. Do we really need to make it that complex?
Which PMDs are going to support it? Which cases will really be distinguished and will have different support (keep or not)?
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 107
Quoted 3 lines
doc/guides/prog_guide/rte_flow.rst +3
-0+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 stopped +(after it has been configured or started previously).
Sorry, it hardly makes sense. Does it suggest an application to:
1. configure
2. start
3. stop
4. check/create flow rules
5. start again
as a regular start sequence instead of just configure+start. IMHO, it must be possible to check just after configure without start. Otherwise it looks really bad.
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 109
Quoted 2 lines
doc/guides/prog_guide/rte_flow.rst +2
-0+If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules using this feature are flushed when the device is stopped.
Which entity does flush it?
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 110
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +1
-0+If it suceeds, such rules will be kept when the device is stopped,
suceeds -> succeeds
kept and functional? I.e. transfer rules still route traffic to other ports which could be up and running.
Quoted 7 lines
doc/guides/prog_guide/rte_flow.rst +4
-0+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
Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart
Quoted 74 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: 20 октября 2021 г. 13:40
To: Dmitry Kozlyuk <[email protected]>; [email protected]
Cc: Qi Zhang <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v3 1/6] ethdev: add capability to keep flow rules on restartExternal email: Use caution opening links or attachments
Quoted 11 lines · Dmitry Kozlyuk
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).
Quoted 5 lines
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 persitence of rules usingpersitence -> persistence
Quoted 15 lines
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.
Review
Quoted 8 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 33 insertions(+)(quoted diff) +0
-0
b/doc/guides/prog_guide/rte_flow.rstdoc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must
Quoted 4 lines
index
2b42d5ec8c..ff67b211e3100644doc/guides/prog_guide/rte_flow.rst +0
-0@@ -87,6 +87,31 @@ To avoid resource leaks on the PMD side, handles mustbe explicitly
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 87
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +0
-0destroyed by the application before releasing associated resources suchas
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly
Quoted 7 lines
doc/guides/prog_guide/rte_flow.rst +5
-0queues and 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()``
Quoted 14 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 104
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+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 an item or action type and a value of the transfer bit +is called a rule feature.As I said before a combination is very hard to test and unfriendly to applications. Do we really need to make it that complex?
Maybe the wording is not explicit enough,
but it exactly attempts to address your previous comment. In v3, applications don't need to check for a full combination of item types, actions types, and a transfer bit value. Instead, they only need to check for a combination
of one type (of an item or an action) with a transfer bit value. There is an example below in the text.
Quoted 5 lines
Which PMDs are going to support it? Which cases will really be distinguished and will have different support (keep or not)?
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 105
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +1
-0+To test if rules with a particular feature are kept, the applicationmust try
Quoted 13 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 107
Quoted 2 lines
doc/guides/prog_guide/rte_flow.rst +2
-0+to create a valid rule using this feature when the device is stopped +(after it has been configured or started previously).Sorry, it hardly makes sense. Does it suggest an application to:
1. configure
2. start
3. stop
4. check/create flow rules
5. start again
as a regular start sequence instead of just configure+start. IMHO, it must be possible to check just after configure without start. Otherwise it looks really bad.
Of course, the following sequence is meant:
1. Configure
2. Try to create flow rules with needed features, check for RTE_FLOW_ERROR_TYPE_STATE.
If and only if the test rules are not needed, destroy them.
3. Start
The sequence you outlined is also possible, but it is not necessary. It may even be useful, for example, if an application is switching the workload and has a new set of rule features to check.
Quoted 5 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 109
Quoted 3 lines
doc/guides/prog_guide/rte_flow.rst +2
-0+If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules using this feature are flushed when the device is stopped.Which entity does flush it?
PMD does.
Overall approach is as follows:
no capability => no guarantees, the application must manage the entities itself; have capability => PMD manages the entities, only it may be unable to keep some.
Quoted 6 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 110
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +1
-0+If it suceeds, such rules will be kept when the device is stopped,suceeds -> succeeds
kept and functional? I.e. transfer rules still route traffic to other ports which could be up and running.
Unless you or anyone object, it's kept, but non-functional, because the semantic of port stop is to stop traffic processing. A transfer rule can mention any port, but I think it should be controlled via the one that created it.
In any case, this must be stated explicitly in v4.
Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart
Hi Dmitry,
Quoted 138 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Wednesday, October 20, 2021 2:40 PM
Subject: RE: [PATCH v3 1/6] ethdev: add capability to keep flow rules on restartQuoted 72 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: 20 октября 2021 г. 13:40
To: Dmitry Kozlyuk <[email protected]>; [email protected]
Cc: Qi Zhang <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v3 1/6] ethdev: add capability to keep flow rules on restartExternal email: Use caution opening links or attachments
Quoted 11 lines · Dmitry Kozlyuk
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).
Quoted 5 lines
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 persitence of rules usingpersitence -> persistence
Quoted 15 lines
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.
Review
Quoted 8 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 33 insertions(+)(quoted diff) +0
-0
b/doc/guides/prog_guide/rte_flow.rstdoc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must
Quoted 4 lines
index
2b42d5ec8c..ff67b211e3100644doc/guides/prog_guide/rte_flow.rst +0
-0@@ -87,6 +87,31 @@ To avoid resource leaks on the PMD side, handles mustbe explicitly
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 87
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +0
-0destroyed by the application before releasing associated resources suchas
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly
Quoted 7 lines
doc/guides/prog_guide/rte_flow.rst +5
-0queues and 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()``
Quoted 14 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 104
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+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 an item or action type and a value of the transfer bit +is called a rule feature.As I said before a combination is very hard to test and unfriendly to applications. Do we really need to make it that complex?
Maybe the wording is not explicit enough,
but it exactly attempts to address your previous comment. In v3, applications don't need to check for a full combination of item types, actions types, and a transfer bit value. Instead, they only need to check for a combination
of one type (of an item or an action) with a transfer bit value. There is an example below in the text.Quoted 5 lines
Which PMDs are going to support it? Which cases will really be distinguished and will have different support (keep or not)?
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must · line 105
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +1
-0+To test if rules with a particular feature are kept, the applicationmust try
Quoted 13 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 107
Quoted 2 lines
doc/guides/prog_guide/rte_flow.rst +2
-0+to create a valid rule using this feature when the device is stopped +(after it has been configured or started previously).Sorry, it hardly makes sense. Does it suggest an application to:
1. configure
2. start
3. stop
4. check/create flow rules
5. start again
as a regular start sequence instead of just configure+start. IMHO, it must be possible to check just after configure without start. Otherwise it looks really bad.Of course, the following sequence is meant:
1. Configure
2. Try to create flow rules with needed features, check forRTE_FLOW_ERROR_TYPE_STATE.
If and only if the test rules are not needed, destroy them.
3. StartThe sequence you outlined is also possible, but it is not necessary. It may even be useful, for example, if an application is switching the workload and has a new set of rule features to check.
Quoted 5 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 109
Quoted 3 lines
doc/guides/prog_guide/rte_flow.rst +2
-0+If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules using this feature are flushed when the device is stopped.Which entity does flush it?
Quoted 5 lines
PMD does.
Overall approach is as follows:
no capability => no guarantees, the application must manage the entities itself; have capability => PMD manages the entities, only it may be unable to keep some.
I don't think it should be the PMD responsibility.
it is always the application,
if PMD returns ``RTE_FLOW_ERROR_TYPE_STATE`` it means that the application must destroy the rules before stop.
Since the PMD said it can't keep the flows it may mean that he can't track them so it can't remove them.
Quoted 4 lines
Quoted 4 lines
doc/guides/prog_guide/rte_flow.rst To avoid resource leaks on the PMD side, handles must be explicitly · line 110
Quoted 1 line
doc/guides/prog_guide/rte_flow.rst +1
-0+If it suceeds, such rules will be kept when the device is stopped,suceeds -> succeeds
Quoted 8 lines
Quoted 2 lines
kept and functional? I.e. transfer rules still route traffic to other ports which could be up and running.
Unless you or anyone object, it's kept, but non-functional, because the semantic of port stop is to stop traffic processing. A transfer rule can mention any port, but I think it should be controlled via the one that created it.
In any case, this must be stated explicitly in v4.
Best,
Ori
PATCH v3 2/6 ethdev: add capability to keep shared objects on restart
In reply to Dmitry Kozlyukrte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.
Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.
Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.
--- doc/guides/prog_guide/rte_flow.rst | 24 ++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 27 insertions(+)
doc/guides/prog_guide/rte_flow.rst +24 -0
@@ -2810,6 +2810,30 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions 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_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, +this means that the PMD can keep at least some indirect actions +across device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain, +so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is stopped (after it has been configured or started previously). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +indirect actions of this kind are flushed when the device is stopped. +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECT
lib/ethdev/rte_ethdev.h +3 -0
@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start().
@@ -1452,6 +1453,8 @@ struct rte_eth_conf {#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 +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008/**@}*/ /*
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 2/6] ethdev: add capability to keep shared objects on restart
Quoted 97 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Tuesday, October 19, 2021 3:37 PM
To: [email protected]
Cc: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH v3 2/6] ethdev: add capability to keep shared objects on restart
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped and started again.
It is natural for some indirect actions, like counter, to be persistent.
Keeping others at least saves application time and complexity.
However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.Indirect action persistence across a reconfigurations is not required.
In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 24 ++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 27 insertions(+)doc/guides/prog_guide/rte_flow.rst +0
-0@@ -2810,6 +2810,30 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by``rte_flow_action_handle_query()``.
doc/guides/prog_guide/rte_flow.rst +24
-0+If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions 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_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, this +means that the PMD can keep at least some indirect actions across +device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions +remain, so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +To test if a particular kind of indirect actions is kept, the +application must try to create a valid indirect action of that kind +when the device is stopped (after it has been configured or started previously). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +indirect actions of this kind are flushed when the device is stopped. +If it succeeds, all indirect actions of the same kind are kept when the +device is stopped. +Indirect actions of a kept kind that are created when the device is +stopped, including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECTlib/ethdev/rte_ethdev.h +1
-0@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start(). @@ -1452,6 +1453,8 @@ struct rte_eth_conf { #define
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP0x00000002
/** Device supports keeping flow rules across restart. */ #defineRTE_ETH_DEV_CAPA_FLOW_RULE_KEEP0x00000004lib/ethdev/rte_ethdev.h +2
-1+/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008/**@}*/ /* --
Quoted 1 line
2.25.1
Best,
Ori
PATCH v3 3/6 net: advertise no support for keeping flow rules
In reply to Dmitry KozlyukWhen RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP capability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supporting rte_flow API in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.
For RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP similar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.
--- drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 ++ drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 ++ drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 ++ drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 ++ drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mvpp2/mrvl_ethdev.c | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + 26 files changed, 31 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +1 -0
@@ -1009,6 +1009,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->speed_capa =bnxt_get_speed_capabilities (bp); dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_thresh = {
drivers/net/bnxt/bnxt_reps.c +1 -0
@@ -525,6 +525,7 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->max_tx_queues = max_rx_rings; dev_info->reta_size =bnxt_rss_hash_tbl_size (parent_bp); dev_info->hash_key_size =40 ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;/* MTU specifics */ dev_info->min_mtu =RTE_ETHER_MIN_MTU ;
drivers/net/cnxk/cnxk_ethdev_ops.c +1 -0
@@ -68,6 +68,7 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->speed_capa = dev->speed_capa; devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/cxgbe/cxgbe_ethdev.c +2 -0
@@ -131,6 +131,8 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->max_vfs = adapter->params.arch.vfcount; device_info->max_vmdq_pools =0 ;/* XXX: For now no support for VMDQ */ + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + device_info->rx_queue_offload_capa =0UL ; device_info->rx_offload_capa =CXGBE_RX_OFFLOADS ;
drivers/net/dpaa2/dpaa2_ethdev.c +1 -0
@@ -255,6 +255,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa =ETH_LINK_SPEED_1G |ETH_LINK_SPEED_2_5G |ETH_LINK_SPEED_10G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->max_hash_mac_addrs =0 ; dev_info->max_vfs =0 ;
drivers/net/e1000/em_ethdev.c +2 -0
@@ -1108,6 +1108,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)ETH_LINK_SPEED_100M_HD |ETH_LINK_SPEED_100M |ETH_LINK_SPEED_1G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; +/* Preferred queue parameters */ dev_info->default_rxportconf.nb_queues =1 ; dev_info->default_txportconf.nb_queues =1 ;
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -2178,6 +2178,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_queue_offload_capa =igb_get_tx_queue_offloads_capa (dev); dev_info->tx_offload_capa =igb_get_tx_port_offloads_capa (dev) | dev_info->tx_queue_offload_capa; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;switch (hw->mac.type) {case e1000_82575:
drivers/net/enic/enic_ethdev.c +1 -0
@@ -469,6 +469,7 @@ static int enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_offload_capa = enic->rx_offload_capa; device_info->tx_offload_capa = enic->tx_offload_capa; device_info->tx_queue_offload_capa = enic->tx_queue_offload_capa; + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; device_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_free_thresh =ENIC_DEFAULT_RX_FREE_THRESH };
drivers/net/failsafe/failsafe_ops.c +1 -0
@@ -1222,6 +1222,7 @@ fs_dev_infos_get(struct rte_eth_dev *dev, infos->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + infos->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {struct rte_eth_dev_info sub_info;
drivers/net/hinic/hinic_pmd_ethdev.c +2 -0
@@ -752,6 +752,8 @@ hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)DEV_TX_OFFLOAD_TCP_TSO |DEV_TX_OFFLOAD_MULTI_SEGS ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->hash_key_size =HINIC_RSS_KEY_SIZE ; info->reta_size =HINIC_RSS_INDIR_SIZE ; info->flow_type_rss_offloads =HINIC_RSS_OFFLOAD_ALL ;
drivers/net/hns3/hns3_ethdev.c +1 -0
@@ -2752,6 +2752,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_indep_txrx_supported (hw)) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (hns3_dev_ptp_supported (hw)) info->rx_offload_capa |=DEV_RX_OFFLOAD_TIMESTAMP ;
drivers/net/hns3/hns3_ethdev_vf.c +1 -0
@@ -994,6 +994,7 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_indep_txrx_supported (hw)) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; info->rx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =HNS3_MAX_RING_DESC ,
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -3747,6 +3747,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX +1 ) *sizeof (uint32_t );
drivers/net/i40e/i40e_vf_representor.c +2 -0
@@ -35,6 +35,8 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,/* get dev info for the vdev */ dev_info->device = ethdev->device; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + dev_info->max_rx_queues = ethdev->data->nb_rx_queues; dev_info->max_tx_queues = ethdev->data->nb_tx_queues;
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -959,6 +959,7 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->reta_size = vf->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =IAVF_RSS_OFFLOAD_ALL ; dev_info->max_mac_addrs =IAVF_NUM_MACADDR_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =DEV_RX_OFFLOAD_VLAN_STRIP | DEV_RX_OFFLOAD_QINQ_STRIP |
drivers/net/ice/ice_dcf_ethdev.c +1 -0
@@ -676,6 +676,7 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, dev_info->hash_key_size = hw->vf_res->rss_key_size; dev_info->reta_size = hw->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =ICE_RSS_OFFLOAD_ALL ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
drivers/net/igc/igc_ethdev.c +1 -0
@@ -1488,6 +1488,7 @@ eth_igc_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize =256 ;/* See BSIZE field of RCTL register. */ dev_info->max_rx_pktlen =MAX_RX_JUMBO_FRAME_SIZE ; dev_info->max_mac_addrs = hw->mac.rar_entry_count; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =IGC_RX_OFFLOAD_ALL ; dev_info->tx_offload_capa =IGC_TX_OFFLOAD_ALL ; dev_info->rx_queue_offload_capa =DEV_RX_OFFLOAD_VLAN_STRIP ;
drivers/net/ipn3ke/ipn3ke_representor.c +1 -0
@@ -97,6 +97,7 @@ ipn3ke_rpst_dev_infos_get(struct rte_eth_dev *ethdev, dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->switch_info.name = ethdev->device->name; dev_info->switch_info.domain_id = rpst->switch_domain_id;
drivers/net/mvpp2/mrvl_ethdev.c +2 -0
@@ -1718,6 +1718,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev, {struct mrvl_priv *priv = dev->data->dev_private; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->speed_capa =ETH_LINK_SPEED_10M |ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G |
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -0
@@ -611,6 +611,7 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/qede/qede_ethdev.c +1 -0
@@ -1373,6 +1373,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->max_rx_pktlen = (uint32_t )ETH_TX_MAX_NON_LSO_PKT_LEN ; dev_info->rx_desc_lim = qede_rx_desc_lim; dev_info->tx_desc_lim = qede_tx_desc_lim; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (IS_PF (edev)) dev_info->max_rx_queues = (uint16_t)RTE_MIN(
drivers/net/sfc/sfc_ethdev.c +1 -0
@@ -183,6 +183,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (mae->status ==SFC_MAE_STATUS_SUPPORTED ) { dev_info->switch_info.name = dev->device->driver->name;
drivers/net/softnic/rte_eth_softnic.c +1 -0
@@ -93,6 +93,7 @@ pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, dev_info->max_rx_pktlen =UINT32_MAX ; dev_info->max_rx_queues =UINT16_MAX ; dev_info->max_tx_queues =UINT16_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/tap/rte_eth_tap.c +1 -0
@@ -1006,6 +1006,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)* functions together and not in partial combinations */ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -2613,6 +2613,7 @@ txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =ETH_64_POOLS ; dev_info->vmdq_queue_num = dev_info->max_rx_queues; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
drivers/net/txgbe/txgbe_ethdev_vf.c +1 -0
@@ -487,6 +487,7 @@ txgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->max_hash_mac_addrs =TXGBE_VMDQ_NUM_UC_MAC ; dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =ETH_64_POOLS ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 3/6] net: advertise no support for keeping flow rules
Quoted 16 lines · Dmitry Kozlyuk
When
RTE_ETH_DEV_CAPA_FLOW_RULE_KEEPcapability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supportingrte_flowAPI in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.For
RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEPsimilar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.Suggested-by Ferruh Yigit <[email protected]>Signed-off-by Dmitry Kozlyuk <[email protected]>
[snip]
drivers/net/bnxt/bnxt_ethdev.c static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, · line 1012
Quoted 9 lines
drivers/net/bnxt/bnxt_ethdev.c +1
-0@@ -1009,6 +1009,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->speed_capa =bnxt_get_speed_capabilities (bp); dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;
Sorry, but here and everywhere below I see no point to cleanup the bit explicitly when it is not actually set.
[snip]
Re: [dpdk-dev] [PATCH v3 3/6] net: advertise no support for keeping flow rules
Quoted 12 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/net/bnxt/bnxt_ethdev.cdrivers/net/bnxt/bnxt_ethdev.c static int bnxt_dev_info_get_op(struct rte_eth_dev
Quoted 4 lines
index
aa7e7fdc85..1a6e0128ff100644drivers/net/bnxt/bnxt_ethdev.c +0
-0@@ -1009,6 +1009,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev
*eth_dev,drivers/net/bnxt/bnxt_ethdev.c static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, · line 1012
Quoted 4 lines
drivers/net/bnxt/bnxt_ethdev.c +1
-0dev_info->speed_capa =bnxt_get_speed_capabilities (bp); dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;
Quoted 4 lines
Sorry, but here and everywhere below I see no point to cleanup the bit explicitly when it is not actually set.
[snip]
(removed maintainers from CC)
As Ferruh explained, this line serves as a TODO item for maintainers to either remove the useless line or to support the capability and advertise it. If deemed unnecessary in the end, this patch can be safely dropped.
PATCH v3 4/6 net/mlx5: discover max flow priority using DevX
In reply to Dmitry KozlyukMaximum available flow priority was discovered using Verbs API regardless of the selected flow engine. This required some Verbs objects to be initialized in order to use DevX engine. Make priority discovery an engine method and implement it for DevX using its API.
--- drivers/net/mlx5/linux/mlx5_os.c | 1 - drivers/net/mlx5/mlx5_flow.c | 98 +++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 4 ++ drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +++------------------ 5 files changed, 215 insertions(+), 68 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -1
@@ -1830,7 +1830,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->drop_queue.hrxq =mlx5_drop_action_create (eth_dev);if (!priv->drop_queue.hrxq) goto error; -/* Supported Verbs flow priority number detection. */ err =mlx5_flow_discover_priorities (eth_dev);if (err <0 ) { err = -err;
drivers/net/mlx5/mlx5_flow.c +98 -0
101 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -1226,6 +1226,9 @@ typedef int (*mlx5_flow_create_def_policy_t) (struct rte_eth_dev *dev);typedef void (*mlx5_flow_destroy_def_policy_t ) (struct rte_eth_dev *dev); +typedef int (*mlx5_flow_discover_priorities_t ) + (struct rte_eth_dev *dev, +const uint16_t *vprio,int vprio_n);struct mlx5_flow_driver_ops {mlx5_flow_validate_t validate;
@@ -1260,6 +1263,7 @@ struct mlx5_flow_driver_ops {mlx5_flow_action_update_t action_update;mlx5_flow_action_query_t action_query;mlx5_flow_sync_domain_t sync_domain; +mlx5_flow_discover_priorities_t discover_priorities; };/* mlx5_flow.c */
drivers/net/mlx5/mlx5_flow_dv.c +103 -0
115 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_verbs.c +10 -67
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 5/6 net/mlx5: create drop queue using DevX
In reply to Dmitry KozlyukDrop queue creation and destruction were not implemented for DevX flow engine and Verbs engine methods were used as a workaround. Implement these methods for DevX so that there is a valid queue ID that can be used regardless of queue configuration via API.
--- drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++++++++++++++----- 2 files changed, 180 insertions(+), 35 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -4
@@ -1790,10 +1790,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, }if (config->devx && config->dv_flow_en && config->dest_tir) { priv->obj_ops = devx_obj_ops; - priv->obj_ops.drop_action_create = - ibv_obj_ops.drop_action_create; - priv->obj_ops.drop_action_destroy = - ibv_obj_ops.drop_action_destroy;#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET priv->obj_ops.txq_obj_modify = ibv_obj_ops.txq_obj_modify;#else
drivers/net/mlx5/mlx5_devx.c +180 -31
309 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 6/6 net/mlx5: preserve indirect actions on restart
In reply to Dmitry KozlyukMLX5 PMD uses reference counting to manage RX queue resources. After port stop shared RSS actions kept references to RX queues, preventing resource release. As a result, internal PMD mempool for such queues had been exhausted after a number of port restarts. Diagnostic message from rte_eth_dev_start():
Rx queue allocation failed: Cannot allocate memory
Dereference RX queues used by indirect actions on port stop (detach) and restore references on port start (attach) in order to allow RX queue resource release, but keep indirect RSS across the port restart. Replace queue IDs in HW by drop queue ID on detach and restore actual queue IDs on attach.
When the port is stopped, create indirect RSS in the detached state. As a result, MLX5 PMD is able to keep all its indirect actions across port restart. Advertise this capability.
--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 194 ++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 ++ 6 files changed, 276 insertions(+), 34 deletions(-)
drivers/net/mlx5/mlx5_ethdev.c +1 -0
@@ -321,6 +321,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->rx_offload_capa = (mlx5_get_rx_port_offloads () | info->rx_queue_offload_capa); info->tx_offload_capa =mlx5_get_tx_port_offloads (dev); + info->dev_capa =RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP ; info->if_index =mlx5_ifindex (dev); info->reta_size = priv->reta_idx_n ? priv->reta_idx_n : config->ind_table_max_size;
drivers/net/mlx5/mlx5_flow.c +171 -23
218 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1574,6 +1574,8 @@ void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev, struct mlx5_flow_meter_policy *mtr_policy);int mlx5_flow_dv_discover_counter_offset_support (struct rte_eth_dev *dev);int mlx5_flow_discover_dr_action_support (struct rte_eth_dev *dev); +int mlx5_action_handle_attach (struct rte_eth_dev *dev); +int mlx5_action_handle_detach (struct rte_eth_dev *dev);int mlx5_action_handle_flush (struct rte_eth_dev *dev);void mlx5_release_tunnel_hub (struct mlx5_dev_ctx_shared *sh,uint16_t port_id);int mlx5_alloc_tunnel_hub (struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/mlx5_rx.h +4 -0
@@ -222,6 +222,10 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); +int mlx5_ind_table_obj_attach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl); +int mlx5_ind_table_obj_detach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl);struct mlx5_list_entry *mlx5_hrxq_create_cb (void *tool_ctx,void *cb_ctx);int mlx5_hrxq_match_cb (void *tool_ctx,struct mlx5_list_entry *entry,void *cb_ctx);
drivers/net/mlx5/mlx5_rxq.c +88 -11
118 lines not on this page · raw message
drivers/net/mlx5/mlx5_trigger.c +10 -0
@@ -14,6 +14,7 @@#include <mlx5_malloc.h> #include "mlx5.h" +#include "mlx5_flow.h" #include "mlx5_mr.h" #include "mlx5_rx.h" #include "mlx5_tx.h"
@@ -1113,6 +1114,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)mlx5_rxq_timestamp_set (dev);/* Set a mask and offset of scheduling on timestamp into Tx queues. */ mlx5_txq_dynf_timestamp_set (dev); +/* Attach indirection table objects detached on port stop. */ + ret =mlx5_action_handle_attach (dev); +if (ret) { +DRV_LOG (ERR , +"port %u failed to attach indirect actions: %s" , + dev->data->port_id,rte_strerror (rte_errno)); + goto error; + }/* * In non-cached mode, it only needs to start the default mreg copy * action and no flow created by application exists anymore.
@@ -1185,6 +1194,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)/* All RX queue flags will be cleared in the flush interface. */ mlx5_flow_list_flush (dev,MLX5_FLOW_TYPE_GEN , true);mlx5_flow_meter_rxq_flush (dev); +mlx5_action_handle_detach (dev);mlx5_rx_intr_vec_disable (dev); priv->sh->port[priv->dev_port -1 ].ih_port_id =RTE_MAX_ETHPORTS ; priv->sh->port[priv->dev_port -1 ].devx_ih_port_id =RTE_MAX_ETHPORTS ;
Signature · 1 line
2.25.1
Quoted 13 lines · Dmitry Kozlyuk
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and
rte_flowcalls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Quoted 3 lines
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/
Is there real usecase for keeping flow rules or indirect actions?
Why does application want to restart port?
Quoted 26 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: 20 октября 2021 г. 13:12
To: Dmitry Kozlyuk <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 0/6] Flow entites behavior on port restartExternal email: Use caution opening links or attachments
Quoted 7 lines · Dmitry Kozlyuk
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Quoted 8 lines
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and
rte_flowcalls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.Prior discussions:
1) http://inbox.dpdk.org/dev/20210727073121.895620-1-
Quoted 7 lines
Quoted 1 line
Is there real usecase for keeping flow rules or indirect actions?
Why does application want to restart port?
Sorry, I don't know of real use cases that would already use this feature. But on the other hand, there was no well-defined API to enable such apps. I can imagine apps adding queues (if their setup after the start is unsupported) and enabling offloads when available resources or traffic pattern changes, e.g. a DDoS attack starts and checksum calculation now wastes cycles on garbage.
For indirect actions, as patch 2/6 mentions, persistent semantics are either natural (counters, meters) or just convenient. Working around with shifts for counters or tolerances for meters is possible of course, but it increases application state to manage.
For rules,
1. It is worth noting that an app can create many of them
before stopping a port, like a rule for each connection.
Saving the application from tracking them in such case is a big advantage. If they cannot be restored before the port is started again, there will be a time gap when the traffic is flowing, but no rules process it. This alone could be covered by a distinct capability proposed earlier [1].
2. However, nowadays, there are apps that create rules on their datapath. If rules are kept, such apps can reconfigure ports without
either loosing the rules or having to track them very fast.
As it is explained in the comments to patch 1/6 and 2/6,
now that rules can exist when the port is not stated,
it is logical that they need not be destroyed when the port is stopped.
[1]: http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
v4 cover Flow entites behavior on port restart
In reply to Dmitry KozlyukIt is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keeping rte_flow entities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and rte_flow calls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/
v4: 1. Fix rebase conflicts (CI).
2. State rule behavior when a port is not started or stopped (Ori).
3. Improve wording on rule features, add examples (Andrew).
4. State that rules/actions that cannot be kept while other can be must be destroyed by the application (Andrew/Ori).
5. Add rationale to the cover letter (Andrew).
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
doc/guides/prog_guide/rte_flow.rst | 57 +++++ drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 + drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 + drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mlx5/linux/mlx5_os.c | 5 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 292 ++++++++++++++++++++++-- drivers/net/mlx5/mlx5_flow.h | 6 + drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +------ drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 +++++++- drivers/net/mlx5/mlx5_trigger.c | 10 + drivers/net/mvpp2/mrvl_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + lib/ethdev/rte_ethdev.h | 10 + lib/ethdev/rte_flow.h | 1 + 39 files changed, 770 insertions(+), 137 deletions(-)
Signature · 1 line
2.25.1
PATCH v4 1/6 ethdev: add capability to keep flow rules on restart
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.
--- 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(+)
doc/guides/prog_guide/rte_flow.rst +31 -0
@@ -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
lib/ethdev/rte_ethdev.h +7 -0
@@ -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/**@}*/ /*
lib/ethdev/rte_flow.h +1 -0
@@ -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. */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart
Hi Dmitry,
Quoted 126 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Dmitry Kozlyuk
Sent: Thursday, October 21, 2021 9:35 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restartPreviously, 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 <[email protected]>--- 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(+)doc/guides/prog_guide/rte_flow.rst +31
-0@@ -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 alib/ethdev/rte_ethdev.h +7
-0@@ -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/**@}*/ /* lib/ethdev/rte_flow.h +1
-1@@ -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. */ };/** --
Quoted 1 line
2.25.1
Best,
Ori
Re: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart
In reply to Dmitry KozlyukQuoted 26 lines · Dmitry Kozlyuk
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.
Quoted 7 lines
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 <[email protected]>
Re: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart
In reply to Dmitry KozlyukQuoted 25 lines · Dmitry Kozlyuk
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.
Quoted 7 lines
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 <[email protected]>
with some review notes below
Quoted 65 lines
--- 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(+)doc/guides/prog_guide/rte_flow.rst +31
-0@@ -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 alib/ethdev/rte_ethdev.h +5
-0@@ -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(). *
lib/ethdev/rte_ethdev.h struct rte_eth_conf { · line 1454
Quoted 5 lines
lib/ethdev/rte_ethdev.h +2
-0@@ -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.
Quoted 16 lines
lib/ethdev/rte_ethdev.h +0
-0/**@}*/ /* lib/ethdev/rte_flow.h +1
-0@@ -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. */ };/**
Re: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart
Quoted 10 lines
lib/ethdev/rte_ethdev.h struct rte_eth_conf { · line 1454
Quoted 6 lines
lib/ethdev/rte_ethdev.h +2
-0@@ -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 usingRTE_BIT32()in next-net
Quoted 4 lines
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.rstdocumentation as well.
It seems constants are not usually marked as experimental, but I will add warnings to rte_flow.rst anyway.
PATCH v4 2/6 ethdev: add capability to keep shared objects on restart
In reply to Dmitry Kozlyukrte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.
Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.
Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.
--- doc/guides/prog_guide/rte_flow.rst | 26 ++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 29 insertions(+)
doc/guides/prog_guide/rte_flow.rst +26 -0
@@ -2965,6 +2965,32 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions 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_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, +this means that the PMD can keep at least some indirect actions +across device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain, +so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +For example: an indirect counter with the transfer bit reset. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is not started (either before the first start of after a stop). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +application must destroy all indirect actions of this kind +before stopping the device. +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECT
lib/ethdev/rte_ethdev.h +3 -0
@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start().
@@ -1452,6 +1453,8 @@ struct rte_eth_conf {#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 +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008/**@}*/ /*
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v4 2/6] ethdev: add capability to keep shared objects on restart
Hi Dmitry,
Quoted 101 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Thursday, October 21, 2021 9:35 AM
Subject: [PATCH v4 2/6] ethdev: add capability to keep shared objects on restart
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 26 ++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 29 insertions(+)doc/guides/prog_guide/rte_flow.rst +26
-0@@ -2965,6 +2965,32 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions 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_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, +this means that the PMD can keep at least some indirect actions +across device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain, +so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +For example: an indirect counter with the transfer bit reset. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is not started (either before the first start of after a stop). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +application must destroy all indirect actions of this kind +before stopping the device. +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECTlib/ethdev/rte_ethdev.h +3
-1@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start(). @@ -1452,6 +1453,8 @@ struct rte_eth_conf {#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 +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008/**@}*/ /* --
Quoted 1 line
2.25.1
Best,
Ori
Re: [dpdk-dev] [PATCH v4 2/6] ethdev: add capability to keep shared objects on restart
In reply to Dmitry KozlyukQuoted 27 lines · Dmitry Kozlyuk
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.
Quoted 6 lines
Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.Signed-off-by Dmitry Kozlyuk <[email protected]>
Quoted 1 line
Re: [dpdk-dev] [PATCH v4 2/6] ethdev: add capability to keep shared objects on restart
In reply to Dmitry KozlyukQuoted 26 lines · Dmitry Kozlyuk
rte_flow_action_handle_create()did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.
Quoted 6 lines
Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.Signed-off-by Dmitry Kozlyuk <[email protected]>
with below review notes processed
Quoted 55 lines
--- doc/guides/prog_guide/rte_flow.rst | 26 ++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 29 insertions(+)doc/guides/prog_guide/rte_flow.rst +26
-0@@ -2965,6 +2965,32 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions 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_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, +this means that the PMD can keep at least some indirect actions +across device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain, +so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +For example: an indirect counter with the transfer bit reset. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is not started (either before the first start of after a stop). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +application must destroy all indirect actions of this kind +before stopping the device. +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECTlib/ethdev/rte_ethdev.h +1
-0@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start().
lib/ethdev/rte_ethdev.h struct rte_eth_conf { · line 1457
Quoted 5 lines
lib/ethdev/rte_ethdev.h +2
-0@@ -1452,6 +1453,8 @@ struct rte_eth_conf {#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 +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008
RTE_BIT32(3) plus experimental markup
Quoted 4 lines
lib/ethdev/rte_ethdev.h +0
-0/**@}*/ /*
PATCH v4 3/6 net: advertise no support for keeping flow rules
In reply to Dmitry KozlyukWhen RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP capability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supporting rte_flow API in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.
For RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP similar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.
--- drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 ++ drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 ++ drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 ++ drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 ++ drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mvpp2/mrvl_ethdev.c | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + 26 files changed, 31 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +1 -0
@@ -1008,6 +1008,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->speed_capa =bnxt_get_speed_capabilities (bp); dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_thresh = {
drivers/net/bnxt/bnxt_reps.c +1 -0
@@ -526,6 +526,7 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->max_tx_queues = max_rx_rings; dev_info->reta_size =bnxt_rss_hash_tbl_size (parent_bp); dev_info->hash_key_size =40 ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;/* MTU specifics */ dev_info->min_mtu =RTE_ETHER_MIN_MTU ;
drivers/net/cnxk/cnxk_ethdev_ops.c +1 -0
@@ -68,6 +68,7 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->speed_capa = dev->speed_capa; devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/cxgbe/cxgbe_ethdev.c +2 -0
@@ -131,6 +131,8 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->max_vfs = adapter->params.arch.vfcount; device_info->max_vmdq_pools =0 ;/* XXX: For now no support for VMDQ */ + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + device_info->rx_queue_offload_capa =0UL ; device_info->rx_offload_capa =CXGBE_RX_OFFLOADS ;
drivers/net/dpaa2/dpaa2_ethdev.c +1 -0
@@ -254,6 +254,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa =ETH_LINK_SPEED_1G |ETH_LINK_SPEED_2_5G |ETH_LINK_SPEED_10G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->max_hash_mac_addrs =0 ; dev_info->max_vfs =0 ;
drivers/net/e1000/em_ethdev.c +2 -0
@@ -1106,6 +1106,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)ETH_LINK_SPEED_100M_HD |ETH_LINK_SPEED_100M |ETH_LINK_SPEED_1G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; +/* Preferred queue parameters */ dev_info->default_rxportconf.nb_queues =1 ; dev_info->default_txportconf.nb_queues =1 ;
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -2174,6 +2174,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_queue_offload_capa =igb_get_tx_queue_offloads_capa (dev); dev_info->tx_offload_capa =igb_get_tx_port_offloads_capa (dev) | dev_info->tx_queue_offload_capa; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;switch (hw->mac.type) {case e1000_82575:
drivers/net/enic/enic_ethdev.c +1 -0
@@ -469,6 +469,7 @@ static int enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_offload_capa = enic->rx_offload_capa; device_info->tx_offload_capa = enic->tx_offload_capa; device_info->tx_queue_offload_capa = enic->tx_queue_offload_capa; + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; device_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_free_thresh =ENIC_DEFAULT_RX_FREE_THRESH };
drivers/net/failsafe/failsafe_ops.c +1 -0
@@ -1220,6 +1220,7 @@ fs_dev_infos_get(struct rte_eth_dev *dev, infos->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + infos->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {struct rte_eth_dev_info sub_info;
drivers/net/hinic/hinic_pmd_ethdev.c +2 -0
@@ -751,6 +751,8 @@ hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)DEV_TX_OFFLOAD_TCP_TSO |DEV_TX_OFFLOAD_MULTI_SEGS ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->hash_key_size =HINIC_RSS_KEY_SIZE ; info->reta_size =HINIC_RSS_INDIR_SIZE ; info->flow_type_rss_offloads =HINIC_RSS_OFFLOAD_ALL ;
drivers/net/hns3/hns3_ethdev.c +1 -0
@@ -2707,6 +2707,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_get_support (hw,INDEP_TXRX )) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (hns3_dev_get_support (hw,PTP )) info->rx_offload_capa |=DEV_RX_OFFLOAD_TIMESTAMP ;
drivers/net/hns3/hns3_ethdev_vf.c +1 -0
@@ -965,6 +965,7 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_get_support (hw,INDEP_TXRX )) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; info->rx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =HNS3_MAX_RING_DESC ,
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -3751,6 +3751,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX +1 ) *sizeof (uint32_t );
drivers/net/i40e/i40e_vf_representor.c +2 -0
@@ -35,6 +35,8 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,/* get dev info for the vdev */ dev_info->device = ethdev->device; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + dev_info->max_rx_queues = ethdev->data->nb_rx_queues; dev_info->max_tx_queues = ethdev->data->nb_tx_queues;
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -960,6 +960,7 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->reta_size = vf->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =IAVF_RSS_OFFLOAD_ALL ; dev_info->max_mac_addrs =IAVF_NUM_MACADDR_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =DEV_RX_OFFLOAD_VLAN_STRIP | DEV_RX_OFFLOAD_QINQ_STRIP |
drivers/net/ice/ice_dcf_ethdev.c +1 -0
@@ -673,6 +673,7 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, dev_info->hash_key_size = hw->vf_res->rss_key_size; dev_info->reta_size = hw->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =ICE_RSS_OFFLOAD_ALL ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
drivers/net/igc/igc_ethdev.c +1 -0
@@ -1480,6 +1480,7 @@ eth_igc_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize =256 ;/* See BSIZE field of RCTL register. */ dev_info->max_rx_pktlen =MAX_RX_JUMBO_FRAME_SIZE ; dev_info->max_mac_addrs = hw->mac.rar_entry_count; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =IGC_RX_OFFLOAD_ALL ; dev_info->tx_offload_capa =IGC_TX_OFFLOAD_ALL ; dev_info->rx_queue_offload_capa =DEV_RX_OFFLOAD_VLAN_STRIP ;
drivers/net/ipn3ke/ipn3ke_representor.c +1 -0
@@ -96,6 +96,7 @@ ipn3ke_rpst_dev_infos_get(struct rte_eth_dev *ethdev, dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->switch_info.name = ethdev->device->name; dev_info->switch_info.domain_id = rpst->switch_domain_id;
drivers/net/mvpp2/mrvl_ethdev.c +2 -0
@@ -1709,6 +1709,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev, {struct mrvl_priv *priv = dev->data->dev_private; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->speed_capa =ETH_LINK_SPEED_10M |ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G |
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -0
@@ -583,6 +583,7 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/qede/qede_ethdev.c +1 -0
@@ -1367,6 +1367,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->max_rx_pktlen = (uint32_t )ETH_TX_MAX_NON_LSO_PKT_LEN ; dev_info->rx_desc_lim = qede_rx_desc_lim; dev_info->tx_desc_lim = qede_tx_desc_lim; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (IS_PF (edev)) dev_info->max_rx_queues = (uint16_t)RTE_MIN(
drivers/net/sfc/sfc_ethdev.c +1 -0
@@ -186,6 +186,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (mae->status ==SFC_MAE_STATUS_SUPPORTED || mae->status ==SFC_MAE_STATUS_ADMIN ) {
drivers/net/softnic/rte_eth_softnic.c +1 -0
@@ -93,6 +93,7 @@ pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, dev_info->max_rx_pktlen =UINT32_MAX ; dev_info->max_rx_queues =UINT16_MAX ; dev_info->max_tx_queues =UINT16_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/tap/rte_eth_tap.c +1 -0
@@ -1006,6 +1006,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)* functions together and not in partial combinations */ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -2603,6 +2603,7 @@ txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =ETH_64_POOLS ; dev_info->vmdq_queue_num = dev_info->max_rx_queues; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
drivers/net/txgbe/txgbe_ethdev_vf.c +1 -0
@@ -487,6 +487,7 @@ txgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->max_hash_mac_addrs =TXGBE_VMDQ_NUM_UC_MAC ; dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =ETH_64_POOLS ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v4 3/6] net: advertise no support for keeping flow rules
Quoted 9 lines · Dmitry Kozlyuk
When
RTE_ETH_DEV_CAPA_FLOW_RULE_KEEPcapability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supportingrte_flowAPI in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.
Quoted 8 lines
For
RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEPsimilar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.Suggested-by Ferruh Yigit <[email protected]>Signed-off-by Dmitry Kozlyuk <[email protected]>
Re: [dpdk-dev] [PATCH v4 3/6] net: advertise no support for keeping flow rules
Quoted 17 lines · On Thu, 21 Oct 2021, 23:56 Ajit Khaparde, <[email protected]> wrote:
Quoted 15 lines · Dmitry Kozlyuk
When
RTE_ETH_DEV_CAPA_FLOW_RULE_KEEPcapability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supportingrte_flowAPI in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.For
RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEPsimilar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.
Quoted 4 lines
Quoted 2 lines
Suggested-by Ferruh Yigit <[email protected]>Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Ajit Khaparde <[email protected]>
Acked-by: Somnath Kotur
<[email protected]>
Quoted 1 line
Re: [dpdk-dev] [PATCH v4 3/6] net: advertise no support for keeping flow rules
In reply to Dmitry KozlyukQuoted 3 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Thursday, October 21, 2021 3:35 PM
[...]
Quoted 16 lines
Subject: [PATCH v4 3/6] net: advertise no support for keeping flow rules
When
RTE_ETH_DEV_CAPA_FLOW_RULE_KEEPcapability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supportingrte_flowAPI in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.For
RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEPsimilar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.
Quoted 3 lines
Suggested-by Ferruh Yigit <[email protected]>Signed-off-by Dmitry Kozlyuk <[email protected]>---
For net/enic,
-Hyong
Re: [dpdk-dev] [PATCH v4 3/6] net: advertise no support for keeping flow rules
In reply to Dmitry KozlyukQuoted 8 lines · Dmitry Kozlyuk
When
RTE_ETH_DEV_CAPA_FLOW_RULE_KEEPcapability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supportingrte_flowAPI in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.
Quoted 8 lines
For
RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEPsimilar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.Suggested-by Ferruh Yigit <[email protected]>Signed-off-by Dmitry Kozlyuk <[email protected]>
I'm sorry, but I still think that the patch is confusing. No strong opinion, but personally I'd go without it.
Re: [dpdk-dev] [PATCH v4 3/6] net: advertise no support for keeping flow rules
Quoted 15 lines · Andrew Rybchenko
Quoted 14 lines · Dmitry Kozlyuk
When
RTE_ETH_DEV_CAPA_FLOW_RULE_KEEPcapability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supportingrte_flowAPI in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.For
RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEPsimilar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.
Quoted 5 lines
Quoted 2 lines
Suggested-by Ferruh Yigit <[email protected]>Signed-off-by Dmitry Kozlyuk <[email protected]>I'm sorry, but I still think that the patch is confusing. No strong opinion, but personally I'd go without it.
It is confusing alright to add a flag that has no impact.
But again my concern is some PMDs maintainers not being aware of this new capability flag that has an impact in the user application. See the level of comments to the patch from PMD maintainers.
This way gives a visibility to both PMD maintainers that some action is required, and gives visibility to application developers and maintainers to track the support. By time the should go away.
Updating ethdev without updating all drivers is hard to manage.
PATCH v4 4/6 net/mlx5: discover max flow priority using DevX
In reply to Dmitry KozlyukMaximum available flow priority was discovered using Verbs API regardless of the selected flow engine. This required some Verbs objects to be initialized in order to use DevX engine. Make priority discovery an engine method and implement it for DevX using its API.
--- drivers/net/mlx5/linux/mlx5_os.c | 1 - drivers/net/mlx5/mlx5_flow.c | 98 +++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 4 ++ drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +++------------------ 5 files changed, 215 insertions(+), 68 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -1
@@ -1849,7 +1849,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->drop_queue.hrxq =mlx5_drop_action_create (eth_dev);if (!priv->drop_queue.hrxq) goto error; -/* Supported Verbs flow priority number detection. */ err =mlx5_flow_discover_priorities (eth_dev);if (err <0 ) { err = -err;
drivers/net/mlx5/mlx5_flow.c +98 -0
101 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -1226,6 +1226,9 @@ typedef int (*mlx5_flow_create_def_policy_t) (struct rte_eth_dev *dev);typedef void (*mlx5_flow_destroy_def_policy_t ) (struct rte_eth_dev *dev); +typedef int (*mlx5_flow_discover_priorities_t ) + (struct rte_eth_dev *dev, +const uint16_t *vprio,int vprio_n);struct mlx5_flow_driver_ops {mlx5_flow_validate_t validate;
@@ -1260,6 +1263,7 @@ struct mlx5_flow_driver_ops {mlx5_flow_action_update_t action_update;mlx5_flow_action_query_t action_query;mlx5_flow_sync_domain_t sync_domain; +mlx5_flow_discover_priorities_t discover_priorities; };/* mlx5_flow.c */
drivers/net/mlx5/mlx5_flow_dv.c +103 -0
115 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_verbs.c +10 -67
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 5/6 net/mlx5: create drop queue using DevX
In reply to Dmitry KozlyukDrop queue creation and destruction were not implemented for DevX flow engine and Verbs engine methods were used as a workaround. Implement these methods for DevX so that there is a valid queue ID that can be used regardless of queue configuration via API.
--- drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++++++++++++++----- 2 files changed, 180 insertions(+), 35 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -4
@@ -1809,10 +1809,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, }if (config->devx && config->dv_flow_en && config->dest_tir) { priv->obj_ops = devx_obj_ops; - priv->obj_ops.drop_action_create = - ibv_obj_ops.drop_action_create; - priv->obj_ops.drop_action_destroy = - ibv_obj_ops.drop_action_destroy;#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET priv->obj_ops.txq_obj_modify = ibv_obj_ops.txq_obj_modify;#else
drivers/net/mlx5/mlx5_devx.c +180 -31
309 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 6/6 net/mlx5: preserve indirect actions on restart
In reply to Dmitry KozlyukMLX5 PMD uses reference counting to manage RX queue resources. After port stop shared RSS actions kept references to RX queues, preventing resource release. As a result, internal PMD mempool for such queues had been exhausted after a number of port restarts. Diagnostic message from rte_eth_dev_start():
Rx queue allocation failed: Cannot allocate memory
Dereference RX queues used by indirect actions on port stop (detach) and restore references on port start (attach) in order to allow RX queue resource release, but keep indirect RSS across the port restart. Replace queue IDs in HW by drop queue ID on detach and restore actual queue IDs on attach.
When the port is stopped, create indirect RSS in the detached state. As a result, MLX5 PMD is able to keep all its indirect actions across port restart. Advertise this capability.
--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 194 ++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 ++ 6 files changed, 276 insertions(+), 34 deletions(-)
drivers/net/mlx5/mlx5_ethdev.c +1 -0
@@ -321,6 +321,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->rx_offload_capa = (mlx5_get_rx_port_offloads () | info->rx_queue_offload_capa); info->tx_offload_capa =mlx5_get_tx_port_offloads (dev); + info->dev_capa =RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP ; info->if_index =mlx5_ifindex (dev); info->reta_size = priv->reta_idx_n ? priv->reta_idx_n : config->ind_table_max_size;
drivers/net/mlx5/mlx5_flow.c +171 -23
218 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1574,6 +1574,8 @@ void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev, struct mlx5_flow_meter_policy *mtr_policy);int mlx5_flow_dv_discover_counter_offset_support (struct rte_eth_dev *dev);int mlx5_flow_discover_dr_action_support (struct rte_eth_dev *dev); +int mlx5_action_handle_attach (struct rte_eth_dev *dev); +int mlx5_action_handle_detach (struct rte_eth_dev *dev);int mlx5_action_handle_flush (struct rte_eth_dev *dev);void mlx5_release_tunnel_hub (struct mlx5_dev_ctx_shared *sh,uint16_t port_id);int mlx5_alloc_tunnel_hub (struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/mlx5_rx.h +4 -0
@@ -222,6 +222,10 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); +int mlx5_ind_table_obj_attach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl); +int mlx5_ind_table_obj_detach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl);struct mlx5_list_entry *mlx5_hrxq_create_cb (void *tool_ctx,void *cb_ctx);int mlx5_hrxq_match_cb (void *tool_ctx,struct mlx5_list_entry *entry,void *cb_ctx);
drivers/net/mlx5/mlx5_rxq.c +88 -11
118 lines not on this page · raw message
drivers/net/mlx5/mlx5_trigger.c +10 -0
@@ -14,6 +14,7 @@#include <mlx5_malloc.h> #include "mlx5.h" +#include "mlx5_flow.h" #include "mlx5_mr.h" #include "mlx5_rx.h" #include "mlx5_tx.h"
@@ -1161,6 +1162,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)mlx5_rxq_timestamp_set (dev);/* Set a mask and offset of scheduling on timestamp into Tx queues. */ mlx5_txq_dynf_timestamp_set (dev); +/* Attach indirection table objects detached on port stop. */ + ret =mlx5_action_handle_attach (dev); +if (ret) { +DRV_LOG (ERR , +"port %u failed to attach indirect actions: %s" , + dev->data->port_id,rte_strerror (rte_errno)); + goto error; + }/* * In non-cached mode, it only needs to start the default mreg copy * action and no flow created by application exists anymore.
@@ -1238,6 +1247,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)/* All RX queue flags will be cleared in the flush interface. */ mlx5_flow_list_flush (dev,MLX5_FLOW_TYPE_GEN , true);mlx5_flow_meter_rxq_flush (dev); +mlx5_action_handle_detach (dev);mlx5_rx_intr_vec_disable (dev); priv->sh->port[priv->dev_port -1 ].ih_port_id =RTE_MAX_ETHPORTS ; priv->sh->port[priv->dev_port -1 ].devx_ih_port_id =RTE_MAX_ETHPORTS ;
Signature · 1 line
2.25.1
Quoted 37 lines · Dmitry Kozlyuk
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keepingrte_flowentities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and
rte_flowcalls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/v4: 1. Fix rebase conflicts (CI).
2. State rule behavior when a port is not started or stopped (Ori).
3. Improve wording on rule features, add examples (Andrew).
4. State that rules/actions that cannot be kept while other can be must be destroyed by the application (Andrew/Ori).
5. Add rationale to the cover letter (Andrew).
Quoted 8 lines
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
Requesting review from PMD maintainers.
Since this patch tries to define behavior on keeping/flushing flow rules after port stop/start/configure, better to get more feedback from various vendors, please review/comment on patch so that we can get it for -rc2.
If there is no comment the patch can go in as it is for -rc2.
Thanks,
ferruh
Quoted 47 lines · Ferruh Yigit
Quoted 37 lines · Dmitry Kozlyuk
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keepingrte_flowentities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and
rte_flowcalls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/v4: 1. Fix rebase conflicts (CI).
2. State rule behavior when a port is not started or stopped (Ori).
3. Improve wording on rule features, add examples (Andrew).
4. State that rules/actions that cannot be kept while other can be must be destroyed by the application (Andrew/Ori).
5. Add rationale to the cover letter (Andrew).Quoted 8 lines
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
Quoted 8 lines
Requesting review from PMD maintainers.
Since this patch tries to define behavior on keeping/flushing flow rules after port stop/start/configure, better to get more feedback from various vendors, please review/comment on patch so that we can get it for -rc2.
If there is no comment the patch can go in as it is for -rc2.
Last review call before merge.
Quoted 37 lines · Dmitry Kozlyuk
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keepingrte_flowentities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and
rte_flowcalls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/v4: 1. Fix rebase conflicts (CI).
2. State rule behavior when a port is not started or stopped (Ori).
3. Improve wording on rule features, add examples (Andrew).
4. State that rules/actions that cannot be kept while other can be must be destroyed by the application (Andrew/Ori).
5. Add rationale to the cover letter (Andrew).
Quoted 8 lines
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
Hi Dmitry,
Can you please rebase this set on latest next-net? There are some changes both in ethdev and mlx5.
v5 cover Flow entites behavior on port restart
In reply to Dmitry KozlyukIt is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keeping rte_flow entities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and rte_flow calls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/
v5:
1. Fix rebase conflicts.
2. Add warnings about experimental status (Andrew).
v4: 1. Fix rebase conflicts (CI).
2. State rule behavior when a port is not started or stopped (Ori).
3. Improve wording on rule features, add examples (Andrew).
4. State that rules/actions that cannot be kept while other can be must be destroyed by the application (Andrew/Ori).
5. Add rationale to the cover letter (Andrew).
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
doc/guides/prog_guide/rte_flow.rst | 67 ++++++ drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 + drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 + drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mlx5/linux/mlx5_os.c | 5 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 292 ++++++++++++++++++++++-- drivers/net/mlx5/mlx5_flow.h | 6 + drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 74 +----- drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 +++++++- drivers/net/mlx5/mlx5_trigger.c | 10 + drivers/net/mvpp2/mrvl_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + lib/ethdev/rte_ethdev.h | 10 + lib/ethdev/rte_flow.h | 1 + 39 files changed, 781 insertions(+), 133 deletions(-)
Signature · 1 line
2.25.1
PATCH v5 1/6 ethdev: add capability to keep flow rules on restart
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.
--- doc/guides/prog_guide/rte_flow.rst | 36 ++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 ++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 44 insertions(+)
doc/guides/prog_guide/rte_flow.rst +36 -0
@@ -87,6 +87,42 @@ 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. +.. warning:: + + The following description of rule persistence is an experimental behavior + that may change without a prior notice. + +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
lib/ethdev/rte_ethdev.h +7 -0
@@ -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(). *
@@ -1691,6 +1696,8 @@ struct rte_eth_conf {* mbuf->port field. */ #define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2) +/** Device supports keeping flow rules across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3)/**@}*/ /*
lib/ethdev/rte_flow.h +1 -0
@@ -3748,6 +3748,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. */ };/**
Signature · 1 line
2.25.1
PATCH v5 2/6 ethdev: add capability to keep shared objects on restart
In reply to Dmitry Kozlyukrte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.
Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.
Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.
--- doc/guides/prog_guide/rte_flow.rst | 31 ++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 34 insertions(+)
doc/guides/prog_guide/rte_flow.rst +31 -0
@@ -2995,6 +2995,37 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +.. warning:: + + The following description of indirect action persistence + is an experimental behavior that may change without a prior notice. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions 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_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, +this means that the PMD can keep at least some indirect actions +across device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain, +so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +For example: an indirect counter with the transfer bit reset. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is not started (either before the first start of after a stop). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +application must destroy all indirect actions of this kind +before stopping the device. +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECT
lib/ethdev/rte_ethdev.h +3 -0
@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start().
@@ -1698,6 +1699,8 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2)/** Device supports keeping flow rules across restart. */ #define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3) +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP RTE_BIT64(4)/**@}*/ /*
Signature · 1 line
2.25.1
PATCH v5 3/6 net: advertise no support for keeping flow rules
In reply to Dmitry KozlyukWhen RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP capability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supporting rte_flow API in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.
For RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP similar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.
--- drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 ++ drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 ++ drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 ++ drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 ++ drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mvpp2/mrvl_ethdev.c | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + 26 files changed, 31 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +1 -0
@@ -1006,6 +1006,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->speed_capa =bnxt_get_speed_capabilities (bp); dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_thresh = {
drivers/net/bnxt/bnxt_reps.c +1 -0
@@ -526,6 +526,7 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->max_tx_queues = max_rx_rings; dev_info->reta_size =bnxt_rss_hash_tbl_size (parent_bp); dev_info->hash_key_size =40 ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;/* MTU specifics */ dev_info->min_mtu =RTE_ETHER_MIN_MTU ;
drivers/net/cnxk/cnxk_ethdev_ops.c +1 -0
@@ -68,6 +68,7 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->speed_capa = dev->speed_capa; devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/cxgbe/cxgbe_ethdev.c +2 -0
@@ -131,6 +131,8 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->max_vfs = adapter->params.arch.vfcount; device_info->max_vmdq_pools =0 ;/* XXX: For now no support for VMDQ */ + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + device_info->rx_queue_offload_capa =0UL ; device_info->rx_offload_capa =CXGBE_RX_OFFLOADS ;
drivers/net/dpaa2/dpaa2_ethdev.c +1 -0
@@ -254,6 +254,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa =RTE_ETH_LINK_SPEED_1G |RTE_ETH_LINK_SPEED_2_5G |RTE_ETH_LINK_SPEED_10G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->max_hash_mac_addrs =0 ; dev_info->max_vfs =0 ;
drivers/net/e1000/em_ethdev.c +2 -0
@@ -1101,6 +1101,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)RTE_ETH_LINK_SPEED_100M_HD |RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; +/* Preferred queue parameters */ dev_info->default_rxportconf.nb_queues =1 ; dev_info->default_txportconf.nb_queues =1 ;
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -2168,6 +2168,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_queue_offload_capa =igb_get_tx_queue_offloads_capa (dev); dev_info->tx_offload_capa =igb_get_tx_port_offloads_capa (dev) | dev_info->tx_queue_offload_capa; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;switch (hw->mac.type) {case e1000_82575:
drivers/net/enic/enic_ethdev.c +1 -0
@@ -469,6 +469,7 @@ static int enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_offload_capa = enic->rx_offload_capa; device_info->tx_offload_capa = enic->tx_offload_capa; device_info->tx_queue_offload_capa = enic->tx_queue_offload_capa; + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; device_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_free_thresh =ENIC_DEFAULT_RX_FREE_THRESH };
drivers/net/failsafe/failsafe_ops.c +1 -0
@@ -1227,6 +1227,7 @@ fs_dev_infos_get(struct rte_eth_dev *dev, infos->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + infos->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {struct rte_eth_dev_info sub_info;
drivers/net/hinic/hinic_pmd_ethdev.c +2 -0
@@ -751,6 +751,8 @@ hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)RTE_ETH_TX_OFFLOAD_TCP_TSO |RTE_ETH_TX_OFFLOAD_MULTI_SEGS ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->hash_key_size =HINIC_RSS_KEY_SIZE ; info->reta_size =HINIC_RSS_INDIR_SIZE ; info->flow_type_rss_offloads =HINIC_RSS_OFFLOAD_ALL ;
drivers/net/hns3/hns3_ethdev.c +1 -0
@@ -2707,6 +2707,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_get_support (hw,INDEP_TXRX )) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (hns3_dev_get_support (hw,PTP )) info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TIMESTAMP ;
drivers/net/hns3/hns3_ethdev_vf.c +1 -0
@@ -965,6 +965,7 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_get_support (hw,INDEP_TXRX )) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; info->rx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =HNS3_MAX_RING_DESC ,
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -3750,6 +3750,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX +1 ) *sizeof (uint32_t );
drivers/net/i40e/i40e_vf_representor.c +2 -0
@@ -35,6 +35,8 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,/* get dev info for the vdev */ dev_info->device = ethdev->device; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + dev_info->max_rx_queues = ethdev->data->nb_rx_queues; dev_info->max_tx_queues = ethdev->data->nb_tx_queues;
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -943,6 +943,7 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->reta_size = vf->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =IAVF_RSS_OFFLOAD_ALL ; dev_info->max_mac_addrs =IAVF_NUM_MACADDR_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =RTE_ETH_RX_OFFLOAD_VLAN_STRIP | RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
drivers/net/ice/ice_dcf_ethdev.c +1 -0
@@ -663,6 +663,7 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, dev_info->hash_key_size = hw->vf_res->rss_key_size; dev_info->reta_size = hw->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =ICE_RSS_OFFLOAD_ALL ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
drivers/net/igc/igc_ethdev.c +1 -0
@@ -1477,6 +1477,7 @@ eth_igc_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize =256 ;/* See BSIZE field of RCTL register. */ dev_info->max_rx_pktlen =MAX_RX_JUMBO_FRAME_SIZE ; dev_info->max_mac_addrs = hw->mac.rar_entry_count; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =IGC_RX_OFFLOAD_ALL ; dev_info->tx_offload_capa =IGC_TX_OFFLOAD_ALL ; dev_info->rx_queue_offload_capa =RTE_ETH_RX_OFFLOAD_VLAN_STRIP ;
drivers/net/ipn3ke/ipn3ke_representor.c +1 -0
@@ -96,6 +96,7 @@ ipn3ke_rpst_dev_infos_get(struct rte_eth_dev *ethdev, dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->switch_info.name = ethdev->device->name; dev_info->switch_info.domain_id = rpst->switch_domain_id;
drivers/net/mvpp2/mrvl_ethdev.c +2 -0
@@ -1709,6 +1709,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev, {struct mrvl_priv *priv = dev->data->dev_private; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->speed_capa =RTE_ETH_LINK_SPEED_10M |RTE_ETH_LINK_SPEED_100M | RTE_ETH_LINK_SPEED_1G |
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -0
@@ -583,6 +583,7 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/qede/qede_ethdev.c +1 -0
@@ -1367,6 +1367,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->max_rx_pktlen = (uint32_t )ETH_TX_MAX_NON_LSO_PKT_LEN ; dev_info->rx_desc_lim = qede_rx_desc_lim; dev_info->tx_desc_lim = qede_tx_desc_lim; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (IS_PF (edev)) dev_info->max_rx_queues = (uint16_t)RTE_MIN(
drivers/net/sfc/sfc_ethdev.c +1 -0
@@ -186,6 +186,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (mae->status ==SFC_MAE_STATUS_SUPPORTED || mae->status ==SFC_MAE_STATUS_ADMIN ) {
drivers/net/softnic/rte_eth_softnic.c +1 -0
@@ -93,6 +93,7 @@ pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, dev_info->max_rx_pktlen =UINT32_MAX ; dev_info->max_rx_queues =UINT16_MAX ; dev_info->max_tx_queues =UINT16_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/tap/rte_eth_tap.c +1 -0
@@ -1006,6 +1006,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)* functions together and not in partial combinations */ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -2597,6 +2597,7 @@ txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =RTE_ETH_64_POOLS ; dev_info->vmdq_queue_num = dev_info->max_rx_queues; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
drivers/net/txgbe/txgbe_ethdev_vf.c +1 -0
@@ -487,6 +487,7 @@ txgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->max_hash_mac_addrs =TXGBE_VMDQ_NUM_UC_MAC ; dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =RTE_ETH_64_POOLS ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
Signature · 1 line
2.25.1
PATCH v5 4/6 net/mlx5: discover max flow priority using DevX
In reply to Dmitry KozlyukMaximum available flow priority was discovered using Verbs API regardless of the selected flow engine. This required some Verbs objects to be initialized in order to use DevX engine. Make priority discovery an engine method and implement it for DevX using its API.
--- drivers/net/mlx5/linux/mlx5_os.c | 1 - drivers/net/mlx5/mlx5_flow.c | 98 +++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 4 ++ drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 74 +++------------------ 5 files changed, 216 insertions(+), 64 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -1
@@ -1720,7 +1720,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->drop_queue.hrxq =mlx5_drop_action_create (eth_dev);if (!priv->drop_queue.hrxq) goto error; -/* Supported Verbs flow priority number detection. */ err =mlx5_flow_discover_priorities (eth_dev);if (err <0 ) { err = -err;
drivers/net/mlx5/mlx5_flow.c +98 -0
101 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -1229,6 +1229,9 @@ typedef int (*mlx5_flow_create_def_policy_t) (struct rte_eth_dev *dev);typedef void (*mlx5_flow_destroy_def_policy_t ) (struct rte_eth_dev *dev); +typedef int (*mlx5_flow_discover_priorities_t ) + (struct rte_eth_dev *dev, +const uint16_t *vprio,int vprio_n);struct mlx5_flow_driver_ops {mlx5_flow_validate_t validate;
@@ -1263,6 +1266,7 @@ struct mlx5_flow_driver_ops {mlx5_flow_action_update_t action_update;mlx5_flow_action_query_t action_query;mlx5_flow_sync_domain_t sync_domain; +mlx5_flow_discover_priorities_t discover_priorities; };/* mlx5_flow.c */
drivers/net/mlx5/mlx5_flow_dv.c +103 -0
115 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_verbs.c +11 -63
122 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v5 5/6 net/mlx5: create drop queue using DevX
In reply to Dmitry KozlyukDrop queue creation and destruction were not implemented for DevX flow engine and Verbs engine methods were used as a workaround. Implement these methods for DevX so that there is a valid queue ID that can be used regardless of queue configuration via API.
--- drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++++++++++++++----- 2 files changed, 180 insertions(+), 35 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -4
@@ -1685,10 +1685,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, }if (sh->devx && config->dv_flow_en && config->dest_tir) { priv->obj_ops = devx_obj_ops; - priv->obj_ops.drop_action_create = - ibv_obj_ops.drop_action_create; - priv->obj_ops.drop_action_destroy = - ibv_obj_ops.drop_action_destroy;mlx5_queue_counter_id_prepare (eth_dev); priv->obj_ops.lb_dummy_queue_create = mlx5_rxq_ibv_obj_dummy_lb_create;
drivers/net/mlx5/mlx5_devx.c +180 -31
310 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v5 6/6 net/mlx5: preserve indirect actions on restart
In reply to Dmitry KozlyukMLX5 PMD uses reference counting to manage RX queue resources. After port stop shared RSS actions kept references to RX queues, preventing resource release. As a result, internal PMD mempool for such queues had been exhausted after a number of port restarts. Diagnostic message from rte_eth_dev_start():
Rx queue allocation failed: Cannot allocate memory
Dereference RX queues used by indirect actions on port stop (detach) and restore references on port start (attach) in order to allow RX queue resource release, but keep indirect RSS across the port restart. Replace queue IDs in HW by drop queue ID on detach and restore actual queue IDs on attach.
When the port is stopped, create indirect RSS in the detached state. As a result, MLX5 PMD is able to keep all its indirect actions across port restart. Advertise this capability.
--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 194 ++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 ++ 6 files changed, 276 insertions(+), 34 deletions(-)
drivers/net/mlx5/mlx5_ethdev.c +1 -0
@@ -321,6 +321,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->rx_offload_capa = (mlx5_get_rx_port_offloads () | info->rx_queue_offload_capa); info->tx_offload_capa =mlx5_get_tx_port_offloads (dev); + info->dev_capa =RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP ; info->if_index =mlx5_ifindex (dev); info->reta_size = priv->reta_idx_n ? priv->reta_idx_n : config->ind_table_max_size;
drivers/net/mlx5/mlx5_flow.c +171 -23
218 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1577,6 +1577,8 @@ void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev, struct mlx5_flow_meter_policy *mtr_policy);int mlx5_flow_dv_discover_counter_offset_support (struct rte_eth_dev *dev);int mlx5_flow_discover_dr_action_support (struct rte_eth_dev *dev); +int mlx5_action_handle_attach (struct rte_eth_dev *dev); +int mlx5_action_handle_detach (struct rte_eth_dev *dev);int mlx5_action_handle_flush (struct rte_eth_dev *dev);void mlx5_release_tunnel_hub (struct mlx5_dev_ctx_shared *sh,uint16_t port_id);int mlx5_alloc_tunnel_hub (struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/mlx5_rx.h +4 -0
@@ -211,6 +211,10 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); +int mlx5_ind_table_obj_attach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl); +int mlx5_ind_table_obj_detach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl);struct mlx5_list_entry *mlx5_hrxq_create_cb (void *tool_ctx,void *cb_ctx);int mlx5_hrxq_match_cb (void *tool_ctx,struct mlx5_list_entry *entry,void *cb_ctx);
drivers/net/mlx5/mlx5_rxq.c +88 -11
118 lines not on this page · raw message
drivers/net/mlx5/mlx5_trigger.c +10 -0
@@ -14,6 +14,7 @@#include <mlx5_malloc.h> #include "mlx5.h" +#include "mlx5_flow.h" #include "mlx5_rx.h" #include "mlx5_tx.h" #include "mlx5_utils.h"
@@ -1162,6 +1163,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)mlx5_rxq_timestamp_set (dev);/* Set a mask and offset of scheduling on timestamp into Tx queues. */ mlx5_txq_dynf_timestamp_set (dev); +/* Attach indirection table objects detached on port stop. */ + ret =mlx5_action_handle_attach (dev); +if (ret) { +DRV_LOG (ERR , +"port %u failed to attach indirect actions: %s" , + dev->data->port_id,rte_strerror (rte_errno)); + goto error; + }/* * In non-cached mode, it only needs to start the default mreg copy * action and no flow created by application exists anymore.
@@ -1239,6 +1248,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)/* All RX queue flags will be cleared in the flush interface. */ mlx5_flow_list_flush (dev,MLX5_FLOW_TYPE_GEN , true);mlx5_flow_meter_rxq_flush (dev); +mlx5_action_handle_detach (dev);mlx5_rx_intr_vec_disable (dev); priv->sh->port[priv->dev_port -1 ].ih_port_id =RTE_MAX_ETHPORTS ; priv->sh->port[priv->dev_port -1 ].devx_ih_port_id =RTE_MAX_ETHPORTS ;
Signature · 1 line
2.25.1
Quoted 26 lines · Dmitry Kozlyuk
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keepingrte_flowentities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and
rte_flowcalls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Quoted 6 lines
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/v5:
1. Fix rebase conflicts.
I am still getting conflicts. Did you rebase it on top of next-net?
Quoted 2 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
[...]
Quoted 4 lines
Quoted 2 lines
v5:
1. Fix rebase conflicts.I am still getting conflicts. Did you rebase it on top of next-net?
Sorry, I was rebasing onto main instead of next-net. Sent v6 rebased onto:
commit 87f4496c74e644d4466233315b2497e7b1acca6d (next-net/main)
Author: Lior Margalit <[email protected]> Date: Mon Nov 1 08:38:41 2021 +0200
net/mlx5: fix RSS expansion of ETH item with EtherType
v6 cover Flow entites behavior on port restart
In reply to Dmitry KozlyukIt is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keeping rte_flow entities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.
It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and rte_flow calls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.
Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/
v6:
Rebase on next-net commit 87f4496c74e6 and fix conflicts.
v5:
1. Fix rebase conflicts.
2. Add warnings about experimental status (Andrew).
v4: 1. Fix rebase conflicts (CI).
2. State rule behavior when a port is not started or stopped (Ori).
3. Improve wording on rule features, add examples (Andrew).
4. State that rules/actions that cannot be kept while other can be must be destroyed by the application (Andrew/Ori).
5. Add rationale to the cover letter (Andrew).
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
doc/guides/prog_guide/rte_flow.rst | 67 ++++++ drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 + drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 + drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 292 ++++++++++++++++++++++-- drivers/net/mlx5/mlx5_flow.h | 6 + drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 74 +----- drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 +++++++- drivers/net/mlx5/mlx5_trigger.c | 10 + drivers/net/mvpp2/mrvl_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + lib/ethdev/rte_ethdev.h | 10 + lib/ethdev/rte_flow.h | 1 + 39 files changed, 781 insertions(+), 132 deletions(-)
Signature · 1 line
2.25.1
PATCH v6 1/6 ethdev: add capability to keep flow rules on restart
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.
--- doc/guides/prog_guide/rte_flow.rst | 36 ++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 ++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 44 insertions(+)
doc/guides/prog_guide/rte_flow.rst +36 -0
@@ -87,6 +87,42 @@ 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. +.. warning:: + + The following description of rule persistence is an experimental behavior + that may change without a prior notice. + +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
lib/ethdev/rte_ethdev.h +7 -0
@@ -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(). *
@@ -1691,6 +1696,8 @@ struct rte_eth_conf {* mbuf->port field. */ #define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2) +/** Device supports keeping flow rules across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3)/**@}*/ /*
lib/ethdev/rte_flow.h +1 -0
@@ -3748,6 +3748,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. */ };/**
Signature · 1 line
2.25.1
PATCH v6 2/6 ethdev: add capability to keep shared objects on restart
In reply to Dmitry Kozlyukrte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration.
Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name.
Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type.
This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started.
Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.
--- doc/guides/prog_guide/rte_flow.rst | 31 ++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 34 insertions(+)
doc/guides/prog_guide/rte_flow.rst +31 -0
@@ -2995,6 +2995,37 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +.. warning:: + + The following description of indirect action persistence + is an experimental behavior that may change without a prior notice. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions 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_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, +this means that the PMD can keep at least some indirect actions +across device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain, +so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +For example: an indirect counter with the transfer bit reset. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is not started (either before the first start of after a stop). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +application must destroy all indirect actions of this kind +before stopping the device. +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECT
lib/ethdev/rte_ethdev.h +3 -0
@@ -94,6 +94,7 @@* depending on the device capabilities: * * - flow rules +* - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start().
@@ -1698,6 +1699,8 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2)/** Device supports keeping flow rules across restart. */ #define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3) +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP RTE_BIT64(4)/**@}*/ /*
Signature · 1 line
2.25.1
PATCH v6 3/6 net: advertise no support for keeping flow rules
In reply to Dmitry KozlyukWhen RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP capability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supporting rte_flow API in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability.
For RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP similar action is not performed,
because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability.
--- drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 ++ drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 ++ drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 ++ drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 ++ drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mvpp2/mrvl_ethdev.c | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + 26 files changed, 31 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +1 -0
@@ -1000,6 +1000,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->speed_capa =bnxt_get_speed_capabilities (bp); dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_thresh = {
drivers/net/bnxt/bnxt_reps.c +1 -0
@@ -546,6 +546,7 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->max_tx_queues = max_rx_rings; dev_info->reta_size =bnxt_rss_hash_tbl_size (parent_bp); dev_info->hash_key_size =40 ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;/* MTU specifics */ dev_info->min_mtu =RTE_ETHER_MIN_MTU ;
drivers/net/cnxk/cnxk_ethdev_ops.c +1 -0
@@ -68,6 +68,7 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->speed_capa = dev->speed_capa; devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/cxgbe/cxgbe_ethdev.c +2 -0
@@ -131,6 +131,8 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->max_vfs = adapter->params.arch.vfcount; device_info->max_vmdq_pools =0 ;/* XXX: For now no support for VMDQ */ + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + device_info->rx_queue_offload_capa =0UL ; device_info->rx_offload_capa =CXGBE_RX_OFFLOADS ;
drivers/net/dpaa2/dpaa2_ethdev.c +1 -0
@@ -254,6 +254,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa =RTE_ETH_LINK_SPEED_1G |RTE_ETH_LINK_SPEED_2_5G |RTE_ETH_LINK_SPEED_10G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->max_hash_mac_addrs =0 ; dev_info->max_vfs =0 ;
drivers/net/e1000/em_ethdev.c +2 -0
@@ -1101,6 +1101,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)RTE_ETH_LINK_SPEED_100M_HD |RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; +/* Preferred queue parameters */ dev_info->default_rxportconf.nb_queues =1 ; dev_info->default_txportconf.nb_queues =1 ;
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -2168,6 +2168,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_queue_offload_capa =igb_get_tx_queue_offloads_capa (dev); dev_info->tx_offload_capa =igb_get_tx_port_offloads_capa (dev) | dev_info->tx_queue_offload_capa; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;switch (hw->mac.type) {case e1000_82575:
drivers/net/enic/enic_ethdev.c +1 -0
@@ -469,6 +469,7 @@ static int enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_offload_capa = enic->rx_offload_capa; device_info->tx_offload_capa = enic->tx_offload_capa; device_info->tx_queue_offload_capa = enic->tx_queue_offload_capa; + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; device_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_free_thresh =ENIC_DEFAULT_RX_FREE_THRESH };
drivers/net/failsafe/failsafe_ops.c +1 -0
@@ -1227,6 +1227,7 @@ fs_dev_infos_get(struct rte_eth_dev *dev, infos->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + infos->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {struct rte_eth_dev_info sub_info;
drivers/net/hinic/hinic_pmd_ethdev.c +2 -0
@@ -751,6 +751,8 @@ hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)RTE_ETH_TX_OFFLOAD_TCP_TSO |RTE_ETH_TX_OFFLOAD_MULTI_SEGS ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->hash_key_size =HINIC_RSS_KEY_SIZE ; info->reta_size =HINIC_RSS_INDIR_SIZE ; info->flow_type_rss_offloads =HINIC_RSS_OFFLOAD_ALL ;
drivers/net/hns3/hns3_ethdev.c +1 -0
@@ -2598,6 +2598,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_get_support (hw,INDEP_TXRX )) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (hns3_dev_get_support (hw,PTP )) info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TIMESTAMP ;
drivers/net/hns3/hns3_ethdev_vf.c +1 -0
@@ -699,6 +699,7 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)if (hns3_dev_get_support (hw,INDEP_TXRX )) info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; info->rx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =HNS3_MAX_RING_DESC ,
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -3750,6 +3750,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX +1 ) *sizeof (uint32_t );
drivers/net/i40e/i40e_vf_representor.c +2 -0
@@ -35,6 +35,8 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,/* get dev info for the vdev */ dev_info->device = ethdev->device; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + dev_info->max_rx_queues = ethdev->data->nb_rx_queues; dev_info->max_tx_queues = ethdev->data->nb_tx_queues;
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -1057,6 +1057,7 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->reta_size = vf->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =IAVF_RSS_OFFLOAD_ALL ; dev_info->max_mac_addrs =IAVF_NUM_MACADDR_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =RTE_ETH_RX_OFFLOAD_VLAN_STRIP | RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
drivers/net/ice/ice_dcf_ethdev.c +1 -0
@@ -663,6 +663,7 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, dev_info->hash_key_size = hw->vf_res->rss_key_size; dev_info->reta_size = hw->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads =ICE_RSS_OFFLOAD_ALL ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
drivers/net/igc/igc_ethdev.c +1 -0
@@ -1477,6 +1477,7 @@ eth_igc_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize =256 ;/* See BSIZE field of RCTL register. */ dev_info->max_rx_pktlen =MAX_RX_JUMBO_FRAME_SIZE ; dev_info->max_mac_addrs = hw->mac.rar_entry_count; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_offload_capa =IGC_RX_OFFLOAD_ALL ; dev_info->tx_offload_capa =IGC_TX_OFFLOAD_ALL ; dev_info->rx_queue_offload_capa =RTE_ETH_RX_OFFLOAD_VLAN_STRIP ;
drivers/net/ipn3ke/ipn3ke_representor.c +1 -0
@@ -96,6 +96,7 @@ ipn3ke_rpst_dev_infos_get(struct rte_eth_dev *ethdev, dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->switch_info.name = ethdev->device->name; dev_info->switch_info.domain_id = rpst->switch_domain_id;
drivers/net/mvpp2/mrvl_ethdev.c +2 -0
@@ -1709,6 +1709,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev, {struct mrvl_priv *priv = dev->data->dev_private; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; + info->speed_capa =RTE_ETH_LINK_SPEED_10M |RTE_ETH_LINK_SPEED_100M | RTE_ETH_LINK_SPEED_1G |
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -0
@@ -583,6 +583,7 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/qede/qede_ethdev.c +1 -0
@@ -1367,6 +1367,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->max_rx_pktlen = (uint32_t )ETH_TX_MAX_NON_LSO_PKT_LEN ; dev_info->rx_desc_lim = qede_rx_desc_lim; dev_info->tx_desc_lim = qede_tx_desc_lim; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (IS_PF (edev)) dev_info->max_rx_queues = (uint16_t)RTE_MIN(
drivers/net/sfc/sfc_ethdev.c +1 -0
@@ -186,6 +186,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa =RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;if (mae->status ==SFC_MAE_STATUS_SUPPORTED || mae->status ==SFC_MAE_STATUS_ADMIN ) {
drivers/net/softnic/rte_eth_softnic.c +1 -0
@@ -93,6 +93,7 @@ pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, dev_info->max_rx_pktlen =UINT32_MAX ; dev_info->max_rx_queues =UINT16_MAX ; dev_info->max_tx_queues =UINT16_MAX ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/tap/rte_eth_tap.c +1 -0
@@ -1006,6 +1006,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)* functions together and not in partial combinations */ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ;return 0 ; }
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -2597,6 +2597,7 @@ txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =RTE_ETH_64_POOLS ; dev_info->vmdq_queue_num = dev_info->max_rx_queues; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
drivers/net/txgbe/txgbe_ethdev_vf.c +1 -0
@@ -487,6 +487,7 @@ txgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->max_hash_mac_addrs =TXGBE_VMDQ_NUM_UC_MAC ; dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools =RTE_ETH_64_POOLS ; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP ; dev_info->rx_queue_offload_capa =txgbe_get_rx_queue_offloads (dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads (dev) | dev_info->rx_queue_offload_capa);
Signature · 1 line
2.25.1
PATCH v6 4/6 net/mlx5: discover max flow priority using DevX
In reply to Dmitry KozlyukMaximum available flow priority was discovered using Verbs API regardless of the selected flow engine. This required some Verbs objects to be initialized in order to use DevX engine. Make priority discovery an engine method and implement it for DevX using its API.
--- drivers/net/mlx5/mlx5_flow.c | 98 +++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 4 ++ drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 74 +++------------------ 4 files changed, 216 insertions(+), 63 deletions(-)
drivers/net/mlx5/mlx5_flow.c +98 -0
@@ -9700,3 +9700,101 @@ mlx5_flow_expand_rss_adjust_node(const struct rte_flow_item *pattern, }return node; } + +/* Map of Verbs to Flow priority with 8 Verbs priorities. */ +static const uint32_t priority_map_3[][MLX5_PRIORITY_MAP_MAX ] = { + {0 ,1 ,2 }, {2 ,3 ,4 }, {5 ,6 ,7 }, +}; + +/* Map of Verbs to Flow priority with 16 Verbs priorities. */ +static const uint32_t priority_map_5[][MLX5_PRIORITY_MAP_MAX ] = { + {0 ,1 ,2 }, {3 ,4 ,5 }, {6 ,7 ,8 }, + {9 ,10 ,11 }, {12 ,13 ,14 }, +}; + +/** +* Discover the number of available flow priorities. +* +* @param dev +* Ethernet device. +* +* @return +* On success, number of available flow priorities. +* On failure, a negative errno-style code and rte_errno is set. +*/ +int +mlx5_flow_discover_priorities (struct rte_eth_dev *dev) +{ +static const uint16_t vprio[] = {8 ,16 }; +const struct mlx5_priv *priv = dev->data->dev_private; +const struct mlx5_flow_driver_ops *fops; +enum mlx5_flow_drv_type type; +int ret; + + type =mlx5_flow_os_get_type (); +if (type ==MLX5_FLOW_TYPE_MAX ) { + type =MLX5_FLOW_TYPE_VERBS ; +if (priv->sh->devx && priv->config.dv_flow_en) + type =MLX5_FLOW_TYPE_DV ; + } + fops =flow_get_drv_ops (type); +if (fops->discover_priorities ==NULL ) { +DRV_LOG (ERR ,"Priority discovery not supported" ); + rte_errno =ENOTSUP ; +return -rte_errno; + } + ret = fops->discover_priorities (dev, vprio,RTE_DIM (vprio)); +if (ret <0 ) +return ret; +switch (ret) { +case 8 : + ret =RTE_DIM (priority_map_3); +break ; +case 16 : + ret =RTE_DIM (priority_map_5); +break ; +default : + rte_errno =ENOTSUP ; +DRV_LOG (ERR , +"port %u maximum priority: %d expected 8/16" , + dev->data->port_id, ret); +return -rte_errno; + } +DRV_LOG (INFO ,"port %u supported flow priorities:" +" 0-%d for ingress or egress root table," +" 0-%d for non-root table or transfer root table." , + dev->data->port_id, ret -2 , +MLX5_NON_ROOT_FLOW_MAX_PRIO -1 ); +return ret; +} + +/** +* Adjust flow priority based on the highest layer and the request priority. +* +* @param[in] dev +* Pointer to the Ethernet device structure. +* @param[in] priority +* The rule base priority. +* @param[in] subpriority +* The priority based on the items. +* +* @return +* The new priority. +*/ +uint32_t +mlx5_flow_adjust_priority (struct rte_eth_dev *dev,int32_t priority, +uint32_t subpriority) +{ +uint32_t res =0 ; +struct mlx5_priv *priv = dev->data->dev_private; + +switch (priv->sh->flow_max_priority) { +case RTE_DIM (priority_map_3): + res = priority_map_3[priority][subpriority]; +break ; +case RTE_DIM (priority_map_5): + res = priority_map_5[priority][subpriority]; +break ; + } +return res; +}
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -1232,6 +1232,9 @@ typedef int (*mlx5_flow_create_def_policy_t) (struct rte_eth_dev *dev);typedef void (*mlx5_flow_destroy_def_policy_t ) (struct rte_eth_dev *dev); +typedef int (*mlx5_flow_discover_priorities_t ) + (struct rte_eth_dev *dev, +const uint16_t *vprio,int vprio_n);struct mlx5_flow_driver_ops {mlx5_flow_validate_t validate;
@@ -1266,6 +1269,7 @@ struct mlx5_flow_driver_ops {mlx5_flow_action_update_t action_update;mlx5_flow_action_query_t action_query;mlx5_flow_sync_domain_t sync_domain; +mlx5_flow_discover_priorities_t discover_priorities; };/* mlx5_flow.c */
drivers/net/mlx5/mlx5_flow_dv.c +103 -0
115 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_verbs.c +11 -63
122 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v6 5/6 net/mlx5: create drop queue using DevX
In reply to Dmitry KozlyukDrop queue creation and destruction were not implemented for DevX flow engine and Verbs engine methods were used as a workaround. Implement these methods for DevX so that there is a valid queue ID that can be used regardless of queue configuration via API.
--- drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++++++++++++++----- 2 files changed, 180 insertions(+), 35 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -4
@@ -1690,10 +1690,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, }if (sh->devx && config->dv_flow_en && config->dest_tir) { priv->obj_ops = devx_obj_ops; - priv->obj_ops.drop_action_create = - ibv_obj_ops.drop_action_create; - priv->obj_ops.drop_action_destroy = - ibv_obj_ops.drop_action_destroy;mlx5_queue_counter_id_prepare (eth_dev); priv->obj_ops.lb_dummy_queue_create = mlx5_rxq_ibv_obj_dummy_lb_create;
drivers/net/mlx5/mlx5_devx.c +180 -31
310 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v6 6/6 net/mlx5: preserve indirect actions on restart
In reply to Dmitry KozlyukMLX5 PMD uses reference counting to manage RX queue resources. After port stop shared RSS actions kept references to RX queues, preventing resource release. As a result, internal PMD mempool for such queues had been exhausted after a number of port restarts. Diagnostic message from rte_eth_dev_start():
Rx queue allocation failed: Cannot allocate memory
Dereference RX queues used by indirect actions on port stop (detach) and restore references on port start (attach) in order to allow RX queue resource release, but keep indirect RSS across the port restart. Replace queue IDs in HW by drop queue ID on detach and restore actual queue IDs on attach.
When the port is stopped, create indirect RSS in the detached state. As a result, MLX5 PMD is able to keep all its indirect actions across port restart. Advertise this capability.
--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 194 ++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 ++ 6 files changed, 276 insertions(+), 34 deletions(-)
drivers/net/mlx5/mlx5_ethdev.c +1 -0
@@ -321,6 +321,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->rx_offload_capa = (mlx5_get_rx_port_offloads () | info->rx_queue_offload_capa); info->tx_offload_capa =mlx5_get_tx_port_offloads (dev); + info->dev_capa =RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP ; info->if_index =mlx5_ifindex (dev); info->reta_size = priv->reta_idx_n ? priv->reta_idx_n : config->ind_table_max_size;
drivers/net/mlx5/mlx5_flow.c +171 -23
218 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1582,6 +1582,8 @@ void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev, struct mlx5_flow_meter_policy *mtr_policy);int mlx5_flow_dv_discover_counter_offset_support (struct rte_eth_dev *dev);int mlx5_flow_discover_dr_action_support (struct rte_eth_dev *dev); +int mlx5_action_handle_attach (struct rte_eth_dev *dev); +int mlx5_action_handle_detach (struct rte_eth_dev *dev);int mlx5_action_handle_flush (struct rte_eth_dev *dev);void mlx5_release_tunnel_hub (struct mlx5_dev_ctx_shared *sh,uint16_t port_id);int mlx5_alloc_tunnel_hub (struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/mlx5_rx.h +4 -0
@@ -211,6 +211,10 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); +int mlx5_ind_table_obj_attach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl); +int mlx5_ind_table_obj_detach (struct rte_eth_dev *dev, +struct mlx5_ind_table_obj *ind_tbl);struct mlx5_list_entry *mlx5_hrxq_create_cb (void *tool_ctx,void *cb_ctx);int mlx5_hrxq_match_cb (void *tool_ctx,struct mlx5_list_entry *entry,void *cb_ctx);
drivers/net/mlx5/mlx5_rxq.c +88 -11
118 lines not on this page · raw message
drivers/net/mlx5/mlx5_trigger.c +10 -0
@@ -14,6 +14,7 @@#include <mlx5_malloc.h> #include "mlx5.h" +#include "mlx5_flow.h" #include "mlx5_rx.h" #include "mlx5_tx.h" #include "mlx5_utils.h"
@@ -1162,6 +1163,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)mlx5_rxq_timestamp_set (dev);/* Set a mask and offset of scheduling on timestamp into Tx queues. */ mlx5_txq_dynf_timestamp_set (dev); +/* Attach indirection table objects detached on port stop. */ + ret =mlx5_action_handle_attach (dev); +if (ret) { +DRV_LOG (ERR , +"port %u failed to attach indirect actions: %s" , + dev->data->port_id,rte_strerror (rte_errno)); + goto error; + }/* * In non-cached mode, it only needs to start the default mreg copy * action and no flow created by application exists anymore.
@@ -1239,6 +1248,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)/* All RX queue flags will be cleared in the flush interface. */ mlx5_flow_list_flush (dev,MLX5_FLOW_TYPE_GEN , true);mlx5_flow_meter_rxq_flush (dev); +mlx5_action_handle_detach (dev);mlx5_rx_intr_vec_disable (dev); priv->sh->port[priv->dev_port -1 ].ih_port_id =RTE_MAX_ETHPORTS ; priv->sh->port[priv->dev_port -1 ].devx_ih_port_id =RTE_MAX_ETHPORTS ;
Signature · 1 line
2.25.1
Quoted 43 lines · Dmitry Kozlyuk
It is unspecified whether flow rules and indirect actions are kept when a port is stopped, possibly reconfigured, and started again. Vendors approach the topic differently, e.g. mlx5 and i40e PMD disagree in whether flow rules can be kept, and mlx5 PMD would keep indirect actions. In the end, applications are greatly affected by whatever contract there is and need to know it.
Applications may wish to restart the port to reconfigure it, e.g. switch offloads or even modify queues.
Keepingrte_flowentities enables application improvements:
1. Since keeping the rules across restart comes with the ability to create rules before the device is started. This allows to have all the rules created at the moment of start, so that there is no time frame when traffic is coming already, but the rules are not yet created (restored).
2. When a rule or an indirect action has some associated state, such as a counter, application saves the need to keep additional state in order to cope with information loss if such an entity would be destroyed.It is proposed to advertise capabilities of keeping flow rules and indirect actions (as a special case of shared object) using a combination of ethdev info and
rte_flowcalls.
Then a bug is fixed in mlx5 PMD that prevented indirect RSS action from being kept, and the driver starts advertising the new capability.Prior discussions:
1) http://inbox.dpdk.org/dev/[email protected]/
2) http://inbox.dpdk.org/dev/[email protected]/v6:
Rebase on next-net commit87f4496c74e6and fix conflicts.
v5:
1. Fix rebase conflicts.
2. Add warnings about experimental status (Andrew).
v4: 1. Fix rebase conflicts (CI).
2. State rule behavior when a port is not started or stopped (Ori).
3. Improve wording on rule features, add examples (Andrew).
4. State that rules/actions that cannot be kept while other can be must be destroyed by the application (Andrew/Ori).
5. Add rationale to the cover letter (Andrew).
Quoted 8 lines
Dmitry Kozlyuk (6):
ethdev: add capability to keep flow rules on restart
ethdev: add capability to keep shared objects on restart
net: advertise no support for keeping flow rules net/mlx5: discover max flow priority using DevX net/mlx5: create drop queue using DevX net/mlx5: preserve indirect actions on restart
Series applied to dpdk-next-net/main, thanks.