net/mlx5: connection tracking changes
cover net/mlx5: connection tracking changes
Patches 1 and 2 contain fixes for existing implementation of connection tracking flow actions.
Patch 3 adds support for sharing connection tracking flow actions between ports when ports' flow engines are configured with RTE_FLOW_PORT_FLAG_SHARE_INDIRECT flag set.
Patch 4 is based on the previous one and removes the limitation on number of ports when connection tracking flow actions are used with HW Steering flow engine.
Dariusz Sosnowski (3):
net/mlx5: fix conntrack action handle representation net/mlx5: fix connection tracking action validation net/mlx5: remove port from conntrack handle representation
Suanming Mou (1):
net/mlx5: add cross port CT object sharing
doc/guides/nics/mlx5.rst | 4 +- doc/guides/rel_notes/release_24_03.rst | 3 + drivers/net/mlx5/mlx5_flow.h | 20 ++- drivers/net/mlx5/mlx5_flow_dv.c | 9 ++ drivers/net/mlx5/mlx5_flow_hw.c | 182 +++++++++++++------------ 5 files changed, 126 insertions(+), 92 deletions(-)
--
2.25.1
PATCH 1/4 net/mlx5: fix conntrack action handle representation
In mlx5 PMD, handles to indirect connection tracking flow actions are encoded in 32-bit unsigned integers as follows:
- Bits 31-29 - indirect action type.
- Bits 28-25 - port on which connection tracking action was created.
- Bits 24-0 - index of connection tracking object.
Macro defining a bit shift for owner part in this representation was incorrectly defined as 22. This patch fixes that, as well as aligns documented limitations.
--- doc/guides/nics/mlx5.rst | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -739,8 +739,8 @@ Limitations - Cannot co-exist with ASO meter, ASO age action in a single flow rule. - Flow rules insertion rate and memory consumption need more optimization. - - 256 ports maximum. - - 4M connections maximum with ``dv_flow_en`` 1 mode. 16M with ``dv_flow_en`` 2. + - 16 ports maximum. + - 32M connections maximum. - Multi-thread flow insertion:
drivers/net/mlx5/mlx5_flow.h +1 -1
@@ -77,7 +77,7 @@ enum mlx5_indirect_type {/* Now, the maximal ports will be supported is 16, action number is 32M. */ #define MLX5_INDIRECT_ACT_CT_MAX_PORT 0x10 -#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 22 +#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 25#define MLX5_INDIRECT_ACT_CT_OWNER_MASK (MLX5_INDIRECT_ACT_CT_MAX_PORT - 1)/* 29-31: type, 25-28: owner port, 0-24: index */
--
2.25.1
PATCH 2/4 net/mlx5: fix connection tracking action validation
In reply to Dariusz SosnowskiIn mlx5 PMD, handles to indirect connection tracking flow actions are encoded as 32-bit unsigned integers, where port ID is stored in bits 28-25. Because of this, connection tracking flow actions cannot be created on ports with IDs higher than 15. This patch adds missing validation.
--- drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++++ drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++ 2 files changed, 16 insertions(+)
drivers/net/mlx5/mlx5_flow_dv.c +9 -0
@@ -13861,6 +13861,13 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev,return rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"Connection is not supported" ); +if (dev->data->port_id >=MLX5_INDIRECT_ACT_CT_MAX_PORT ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"CT supports port indexes up to " +RTE_STR (MLX5_ACTION_CTX_CT_MAX_PORT )); +return 0 ; + } idx =flow_dv_aso_ct_alloc (dev, error);if (!idx) return rte_flow_error_set(error, rte_errno,
@@ -16558,6 +16565,8 @@ flow_dv_action_create(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_CONNTRACK : ret =flow_dv_translate_create_conntrack (dev, action->conf, err); +if (!ret) +break ; idx =MLX5_INDIRECT_ACT_CT_GEN_IDX (PORT_ID (priv), ret);break ;default :
drivers/net/mlx5/mlx5_flow_hw.c +7 -0
@@ -10048,6 +10048,13 @@ flow_hw_conntrack_create(struct rte_eth_dev *dev, uint32_t queue, "CT is not enabled");return 0 ; } +if (dev->data->port_id >=MLX5_INDIRECT_ACT_CT_MAX_PORT ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"CT supports port indexes up to " +RTE_STR (MLX5_ACTION_CTX_CT_MAX_PORT )); +return 0 ; + } ct =mlx5_ipool_zmalloc (pool->cts, &ct_idx);if (!ct) { rte_flow_error_set(error, rte_errno,
--
2.25.1
PATCH 3/4 net/mlx5: add cross port CT object sharing
In reply to Dariusz SosnowskiFrom: Suanming Mou <[email protected]>
This commit adds cross port CT object sharing.
Shared CT object shares the same DevX objects, but allocate port's own action locally. Once the CT object is shared between two flows in different ports, the two flows use their own local action with the same offset index.
The shared CT object can only be created/updated/queried/destroyed by host port.
--- doc/guides/rel_notes/release_24_03.rst | 3 + drivers/net/mlx5/mlx5_flow_hw.c | 145 ++++++++++++++----------- 2 files changed, 86 insertions(+), 62 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -133,6 +133,9 @@ New Features * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action. * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action. + * Added support for sharing indirect action objects of type ``RTE_FLOW_ACTION_TYPE_CONNTRACK`` + with HW steering flow engine. + Removed Items -------------
drivers/net/mlx5/mlx5_flow_hw.c +83 -62
231 lines not on this page · raw message
--
2.25.1
PATCH 4/4 net/mlx5: remove port from conntrack handle representation
In reply to Dariusz SosnowskiThis patch removes the owner port index from integer representation of indirect action handle in mlx5 PMD for conntrack flow actions.
This index is not needed when HW Steering flow engine is enabled, because either:
- port references its own indirect actions or,
- port references indirect actions of the host port when sharing indirect actions was configured.
In both cases it is explicitly known which port owns the action. Port index, included in action handle, introduced unnecessary limitation and caused undefined behavior issues when application used more than supported number of ports.
This patch removes the port index from indirect conntrack action handle representation when HW steering flow engine is used.
It does not affect SW Steering flow engine.
--- drivers/net/mlx5/mlx5_flow.h | 18 +++++++++++--- drivers/net/mlx5/mlx5_flow_hw.c | 44 +++++++++++---------------------- 2 files changed, 28 insertions(+), 34 deletions(-)
drivers/net/mlx5/mlx5_flow.h +14 -4
@@ -80,7 +80,12 @@ enum mlx5_indirect_type {#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 25#define MLX5_INDIRECT_ACT_CT_OWNER_MASK (MLX5_INDIRECT_ACT_CT_MAX_PORT - 1) -/* 29-31: type, 25-28: owner port, 0-24: index */ +/* +* When SW steering flow engine is used, the CT action handles are encoded in a following way: +* - bits 31:29 - type +* - bits 28:25 - port index of the action owner +* - bits 24:0 - action index +*/ #define MLX5_INDIRECT_ACT_CT_GEN_IDX (owner, index) \ ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | \ (((owner) & MLX5_INDIRECT_ACT_CT_OWNER_MASK) << \
@@ -93,9 +98,14 @@ enum mlx5_indirect_type {#define MLX5_INDIRECT_ACT_CT_GET_IDX (index) \ ((index) & ((1 << MLX5_INDIRECT_ACT_CT_OWNER_SHIFT) - 1)) -#define MLX5_ACTION_CTX_CT_GET_IDX MLX5_INDIRECT_ACT_CT_GET_IDX -#define MLX5_ACTION_CTX_CT_GET_OWNER MLX5_INDIRECT_ACT_CT_GET_OWNER -#define MLX5_ACTION_CTX_CT_GEN_IDX MLX5_INDIRECT_ACT_CT_GEN_IDX +/* +* When HW steering flow engine is used, the CT action handles are encoded in a following way: +* - bits 31:29 - type +* - bits 28:0 - action index +*/ +#define MLX5_INDIRECT_ACT_HWS_CT_GEN_IDX (index) \ + ((struct rte_flow_action_handle *)(uintptr_t) \ + ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | (index)))enum mlx5_indirect_list_type {MLX5_INDIRECT_ACTION_LIST_TYPE_ERR =0 ,
drivers/net/mlx5/mlx5_flow_hw.c +14 -30
152 lines not on this page · raw message
--
2.25.1
v2 cover net/mlx5: connection tracking changes
In reply to Dariusz SosnowskiPatches 1 and 2 contain fixes for existing implementation of connection tracking flow actions.
Patch 3 adds support for sharing connection tracking flow actions between ports when ports' flow engines are configured with RTE_FLOW_PORT_FLAG_SHARE_INDIRECT flag set.
Patch 4 is based on the previous one and removes the limitation on number of ports when connection tracking flow actions are used with HW Steering flow engine.
v2:
- Rebased on top of v24.03-rc1
- Updated mlx5 docs.
Dariusz Sosnowski (3):
net/mlx5: fix conntrack action handle representation net/mlx5: fix connection tracking action validation net/mlx5: remove port from conntrack handle representation
Suanming Mou (1):
net/mlx5: add cross port CT object sharing
doc/guides/nics/mlx5.rst | 4 +- doc/guides/rel_notes/release_24_03.rst | 2 + drivers/net/mlx5/mlx5_flow.h | 20 ++- drivers/net/mlx5/mlx5_flow_dv.c | 9 ++ drivers/net/mlx5/mlx5_flow_hw.c | 182 +++++++++++++------------ 5 files changed, 125 insertions(+), 92 deletions(-)
--
2.34.1
PATCH v2 1/4 net/mlx5: fix conntrack action handle representation
In mlx5 PMD, handles to indirect connection tracking flow actions are encoded in 32-bit unsigned integers as follows:
- Bits 31-29 - indirect action type.
- Bits 28-25 - port on which connection tracking action was created.
- Bits 24-0 - index of connection tracking object.
Macro defining a bit shift for owner part in this representation was incorrectly defined as 22. This patch fixes that, as well as aligns documented limitations.
--- doc/guides/nics/mlx5.rst | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -783,8 +783,8 @@ Limitations - Cannot co-exist with ASO meter, ASO age action in a single flow rule. - Flow rules insertion rate and memory consumption need more optimization. - - 256 ports maximum. - - 4M connections maximum with ``dv_flow_en`` 1 mode. 16M with ``dv_flow_en`` 2. + - 16 ports maximum. + - 32M connections maximum. - Multi-thread flow insertion:
drivers/net/mlx5/mlx5_flow.h +1 -1
@@ -77,7 +77,7 @@ enum mlx5_indirect_type {/* Now, the maximal ports will be supported is 16, action number is 32M. */ #define MLX5_INDIRECT_ACT_CT_MAX_PORT 0x10 -#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 22 +#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 25#define MLX5_INDIRECT_ACT_CT_OWNER_MASK (MLX5_INDIRECT_ACT_CT_MAX_PORT - 1)/* 29-31: type, 25-28: owner port, 0-24: index */
Signature · 1 line
2.34.1
PATCH v2 2/4 net/mlx5: fix connection tracking action validation
In reply to Dariusz SosnowskiIn mlx5 PMD, handles to indirect connection tracking flow actions are encoded as 32-bit unsigned integers, where port ID is stored in bits 28-25. Because of this, connection tracking flow actions cannot be created on ports with IDs higher than 15. This patch adds missing validation.
--- drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++++ drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++ 2 files changed, 16 insertions(+)
drivers/net/mlx5/mlx5_flow_dv.c +9 -0
@@ -13861,6 +13861,13 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev,return rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"Connection is not supported" ); +if (dev->data->port_id >=MLX5_INDIRECT_ACT_CT_MAX_PORT ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"CT supports port indexes up to " +RTE_STR (MLX5_ACTION_CTX_CT_MAX_PORT )); +return 0 ; + } idx =flow_dv_aso_ct_alloc (dev, error);if (!idx) return rte_flow_error_set(error, rte_errno,
@@ -16558,6 +16565,8 @@ flow_dv_action_create(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_CONNTRACK : ret =flow_dv_translate_create_conntrack (dev, action->conf, err); +if (!ret) +break ; idx =MLX5_INDIRECT_ACT_CT_GEN_IDX (PORT_ID (priv), ret);break ;default :
drivers/net/mlx5/mlx5_flow_hw.c +7 -0
@@ -10048,6 +10048,13 @@ flow_hw_conntrack_create(struct rte_eth_dev *dev, uint32_t queue, "CT is not enabled");return 0 ; } +if (dev->data->port_id >=MLX5_INDIRECT_ACT_CT_MAX_PORT ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"CT supports port indexes up to " +RTE_STR (MLX5_ACTION_CTX_CT_MAX_PORT )); +return 0 ; + } ct =mlx5_ipool_zmalloc (pool->cts, &ct_idx);if (!ct) { rte_flow_error_set(error, rte_errno,
Signature · 1 line
2.34.1
PATCH v2 3/4 net/mlx5: add cross port CT object sharing
In reply to Dariusz SosnowskiFrom: Suanming Mou <[email protected]>
This commit adds cross port CT object sharing.
Shared CT object shares the same DevX objects, but allocate port's own action locally. Once the CT object is shared between two flows in different ports, the two flows use their own local action with the same offset index.
The shared CT object can only be created/updated/queried/destroyed by host port.
--- doc/guides/rel_notes/release_24_03.rst | 2 + drivers/net/mlx5/mlx5_flow_hw.c | 145 ++++++++++++++----------- 2 files changed, 85 insertions(+), 62 deletions(-)
doc/guides/rel_notes/release_24_03.rst +2 -0
@@ -130,6 +130,8 @@ New Features * Added support for matching a random value. * Added support for comparing result between packet fields or value. * Added support for accumulating value of field into another one. + * Added support for sharing indirect action objects of type ``RTE_FLOW_ACTION_TYPE_CONNTRACK`` + with HW steering flow engine. * **Updated Marvell cnxk crypto driver.**
drivers/net/mlx5/mlx5_flow_hw.c +83 -62
231 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 4/4 net/mlx5: remove port from conntrack handle representation
In reply to Dariusz SosnowskiThis patch removes the owner port index from integer representation of indirect action handle in mlx5 PMD for conntrack flow actions.
This index is not needed when HW Steering flow engine is enabled, because either:
- port references its own indirect actions or,
- port references indirect actions of the host port when sharing indirect actions was configured.
In both cases it is explicitly known which port owns the action. Port index, included in action handle, introduced unnecessary limitation and caused undefined behavior issues when application used more than supported number of ports.
This patch removes the port index from indirect conntrack action handle representation when HW steering flow engine is used.
It does not affect SW Steering flow engine.
--- doc/guides/nics/mlx5.rst | 2 +- drivers/net/mlx5/mlx5_flow.h | 18 +++++++++++--- drivers/net/mlx5/mlx5_flow_hw.c | 44 +++++++++++---------------------- 3 files changed, 29 insertions(+), 35 deletions(-)
doc/guides/nics/mlx5.rst +1 -1
@@ -783,7 +783,7 @@ Limitations - Cannot co-exist with ASO meter, ASO age action in a single flow rule. - Flow rules insertion rate and memory consumption need more optimization. - - 16 ports maximum. + - 16 ports maximum (with ``dv_flow_en=1``). - 32M connections maximum. - Multi-thread flow insertion:
drivers/net/mlx5/mlx5_flow.h +14 -4
@@ -80,7 +80,12 @@ enum mlx5_indirect_type {#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 25#define MLX5_INDIRECT_ACT_CT_OWNER_MASK (MLX5_INDIRECT_ACT_CT_MAX_PORT - 1) -/* 29-31: type, 25-28: owner port, 0-24: index */ +/* +* When SW steering flow engine is used, the CT action handles are encoded in a following way: +* - bits 31:29 - type +* - bits 28:25 - port index of the action owner +* - bits 24:0 - action index +*/ #define MLX5_INDIRECT_ACT_CT_GEN_IDX (owner, index) \ ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | \ (((owner) & MLX5_INDIRECT_ACT_CT_OWNER_MASK) << \
@@ -93,9 +98,14 @@ enum mlx5_indirect_type {#define MLX5_INDIRECT_ACT_CT_GET_IDX (index) \ ((index) & ((1 << MLX5_INDIRECT_ACT_CT_OWNER_SHIFT) - 1)) -#define MLX5_ACTION_CTX_CT_GET_IDX MLX5_INDIRECT_ACT_CT_GET_IDX -#define MLX5_ACTION_CTX_CT_GET_OWNER MLX5_INDIRECT_ACT_CT_GET_OWNER -#define MLX5_ACTION_CTX_CT_GEN_IDX MLX5_INDIRECT_ACT_CT_GEN_IDX +/* +* When HW steering flow engine is used, the CT action handles are encoded in a following way: +* - bits 31:29 - type +* - bits 28:0 - action index +*/ +#define MLX5_INDIRECT_ACT_HWS_CT_GEN_IDX (index) \ + ((struct rte_flow_action_handle *)(uintptr_t) \ + ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | (index)))enum mlx5_indirect_list_type {MLX5_INDIRECT_ACTION_LIST_TYPE_ERR =0 ,
drivers/net/mlx5/mlx5_flow_hw.c +14 -30
152 lines not on this page · raw message
Signature · 1 line
2.34.1
v3 cover net/mlx5: connection tracking changes
In reply to Dariusz SosnowskiPatches 1 and 2 contain fixes for existing implementation of connection tracking flow actions.
Patch 3 adds support for sharing connection tracking flow actions between ports when ports' flow engines are configured with RTE_FLOW_PORT_FLAG_SHARE_INDIRECT flag set.
Patch 4 is based on the previous one and removes the limitation on number of ports when connection tracking flow actions are used with HW Steering flow engine.
Depends-on: series-31246 ("net/mlx5: move meter init functions")
v3:
- Rebased.
- Added Depends-on tag.
v2:
- Rebased on top of v24.03-rc1
- Updated mlx5 docs.
Dariusz Sosnowski (3):
net/mlx5: fix conntrack action handle representation net/mlx5: fix connection tracking action validation net/mlx5: remove port from conntrack handle representation
Suanming Mou (1):
net/mlx5: add cross port CT object sharing
doc/guides/nics/mlx5.rst | 4 +- doc/guides/rel_notes/release_24_03.rst | 2 + drivers/net/mlx5/mlx5_flow.h | 20 ++- drivers/net/mlx5/mlx5_flow_dv.c | 9 ++ drivers/net/mlx5/mlx5_flow_hw.c | 180 +++++++++++++------------ 5 files changed, 123 insertions(+), 92 deletions(-)
--
2.25.1
PATCH v3 1/4 net/mlx5: fix conntrack action handle representation
In mlx5 PMD, handles to indirect connection tracking flow actions are encoded in 32-bit unsigned integers as follows:
- Bits 31-29 - indirect action type.
- Bits 28-25 - port on which connection tracking action was created.
- Bits 24-0 - index of connection tracking object.
Macro defining a bit shift for owner part in this representation was incorrectly defined as 22. This patch fixes that, as well as aligns documented limitations.
--- doc/guides/nics/mlx5.rst | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -815,8 +815,8 @@ Limitations - Cannot co-exist with ASO meter, ASO age action in a single flow rule. - Flow rules insertion rate and memory consumption need more optimization. - - 256 ports maximum. - - 4M connections maximum with ``dv_flow_en`` 1 mode. 16M with ``dv_flow_en`` 2. + - 16 ports maximum. + - 32M connections maximum. - Multi-thread flow insertion:
drivers/net/mlx5/mlx5_flow.h +1 -1
@@ -77,7 +77,7 @@ enum mlx5_indirect_type {/* Now, the maximal ports will be supported is 16, action number is 32M. */ #define MLX5_INDIRECT_ACT_CT_MAX_PORT 0x10 -#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 22 +#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 25#define MLX5_INDIRECT_ACT_CT_OWNER_MASK (MLX5_INDIRECT_ACT_CT_MAX_PORT - 1)/* 29-31: type, 25-28: owner port, 0-24: index */
Signature · 1 line
2.25.1
PATCH v3 2/4 net/mlx5: fix connection tracking action validation
In reply to Dariusz SosnowskiIn mlx5 PMD, handles to indirect connection tracking flow actions are encoded as 32-bit unsigned integers, where port ID is stored in bits 28-25. Because of this, connection tracking flow actions cannot be created on ports with IDs higher than 15. This patch adds missing validation.
--- drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++++ drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++ 2 files changed, 16 insertions(+)
drivers/net/mlx5/mlx5_flow_dv.c +9 -0
@@ -13889,6 +13889,13 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev,return rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"Connection is not supported" ); +if (dev->data->port_id >=MLX5_INDIRECT_ACT_CT_MAX_PORT ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"CT supports port indexes up to " +RTE_STR (MLX5_ACTION_CTX_CT_MAX_PORT )); +return 0 ; + } idx =flow_dv_aso_ct_alloc (dev, error);if (!idx) return rte_flow_error_set(error, rte_errno,
@@ -16586,6 +16593,8 @@ flow_dv_action_create(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_CONNTRACK : ret =flow_dv_translate_create_conntrack (dev, action->conf, err); +if (!ret) +break ; idx =MLX5_INDIRECT_ACT_CT_GEN_IDX (PORT_ID (priv), ret);break ;default :
drivers/net/mlx5/mlx5_flow_hw.c +7 -0
@@ -10344,6 +10344,13 @@ flow_hw_conntrack_create(struct rte_eth_dev *dev, uint32_t queue, "CT is not enabled");return 0 ; } +if (dev->data->port_id >=MLX5_INDIRECT_ACT_CT_MAX_PORT ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"CT supports port indexes up to " +RTE_STR (MLX5_ACTION_CTX_CT_MAX_PORT )); +return 0 ; + } ct =mlx5_ipool_zmalloc (pool->cts, &ct_idx);if (!ct) { rte_flow_error_set(error, rte_errno,
Signature · 1 line
2.25.1
PATCH v3 3/4 net/mlx5: add cross port CT object sharing
In reply to Dariusz SosnowskiFrom: Suanming Mou <[email protected]>
This commit adds cross port CT object sharing.
Shared CT object shares the same DevX objects, but allocate port's own action locally. Once the CT object is shared between two flows in different ports, the two flows use their own local action with the same offset index.
The shared CT object can only be created/updated/queried/destroyed by host port.
--- doc/guides/rel_notes/release_24_03.rst | 2 + drivers/net/mlx5/mlx5_flow_hw.c | 143 ++++++++++++++----------- 2 files changed, 83 insertions(+), 62 deletions(-)
doc/guides/rel_notes/release_24_03.rst +2 -0
@@ -135,6 +135,8 @@ New Features * Added support for copy inner fields in HWS flow engine. * Added support for sharing indirect action objects of type ``RTE_FLOW_ACTION_TYPE_METER_MARK`` in HWS flow engine. + * Added support for sharing indirect action objects of type ``RTE_FLOW_ACTION_TYPE_CONNTRACK`` + with HW steering flow engine. * **Updated Marvell cnxk crypto driver.**
drivers/net/mlx5/mlx5_flow_hw.c +81 -62
230 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 4/4 net/mlx5: remove port from conntrack handle representation
In reply to Dariusz SosnowskiThis patch removes the owner port index from integer representation of indirect action handle in mlx5 PMD for conntrack flow actions.
This index is not needed when HW Steering flow engine is enabled, because either:
- port references its own indirect actions or,
- port references indirect actions of the host port when sharing indirect actions was configured.
In both cases it is explicitly known which port owns the action. Port index, included in action handle, introduced unnecessary limitation and caused undefined behavior issues when application used more than supported number of ports.
This patch removes the port index from indirect conntrack action handle representation when HW steering flow engine is used.
It does not affect SW Steering flow engine.
--- doc/guides/nics/mlx5.rst | 2 +- drivers/net/mlx5/mlx5_flow.h | 18 +++++++++++--- drivers/net/mlx5/mlx5_flow_hw.c | 44 +++++++++++---------------------- 3 files changed, 29 insertions(+), 35 deletions(-)
doc/guides/nics/mlx5.rst +1 -1
@@ -815,7 +815,7 @@ Limitations - Cannot co-exist with ASO meter, ASO age action in a single flow rule. - Flow rules insertion rate and memory consumption need more optimization. - - 16 ports maximum. + - 16 ports maximum (with ``dv_flow_en=1``). - 32M connections maximum. - Multi-thread flow insertion:
drivers/net/mlx5/mlx5_flow.h +14 -4
@@ -80,7 +80,12 @@ enum mlx5_indirect_type {#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 25#define MLX5_INDIRECT_ACT_CT_OWNER_MASK (MLX5_INDIRECT_ACT_CT_MAX_PORT - 1) -/* 29-31: type, 25-28: owner port, 0-24: index */ +/* +* When SW steering flow engine is used, the CT action handles are encoded in a following way: +* - bits 31:29 - type +* - bits 28:25 - port index of the action owner +* - bits 24:0 - action index +*/ #define MLX5_INDIRECT_ACT_CT_GEN_IDX (owner, index) \ ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | \ (((owner) & MLX5_INDIRECT_ACT_CT_OWNER_MASK) << \
@@ -93,9 +98,14 @@ enum mlx5_indirect_type {#define MLX5_INDIRECT_ACT_CT_GET_IDX (index) \ ((index) & ((1 << MLX5_INDIRECT_ACT_CT_OWNER_SHIFT) - 1)) -#define MLX5_ACTION_CTX_CT_GET_IDX MLX5_INDIRECT_ACT_CT_GET_IDX -#define MLX5_ACTION_CTX_CT_GET_OWNER MLX5_INDIRECT_ACT_CT_GET_OWNER -#define MLX5_ACTION_CTX_CT_GEN_IDX MLX5_INDIRECT_ACT_CT_GEN_IDX +/* +* When HW steering flow engine is used, the CT action handles are encoded in a following way: +* - bits 31:29 - type +* - bits 28:0 - action index +*/ +#define MLX5_INDIRECT_ACT_HWS_CT_GEN_IDX (index) \ + ((struct rte_flow_action_handle *)(uintptr_t) \ + ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | (index)))enum mlx5_indirect_list_type {MLX5_INDIRECT_ACTION_LIST_TYPE_ERR =0 ,
drivers/net/mlx5/mlx5_flow_hw.c +14 -30
152 lines not on this page · raw message
Signature · 1 line
2.25.1
Hi,
Quoted 45 lines
-----Original Message-----
From: Dariusz Sosnowski <[email protected]>
Sent: Tuesday, February 27, 2024 3:52 PM
To: Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]
Subject: [PATCH v3 0/4] net/mlx5: connection tracking changesPatches 1 and 2 contain fixes for existing implementation of connection tracking flow actions.
Patch 3 adds support for sharing connection tracking flow actions between ports when ports' flow engines are configured with
RTE_FLOW_PORT_FLAG_SHARE_INDIRECTflag set.Patch 4 is based on the previous one and removes the limitation on number of ports when connection tracking flow actions are used with HW Steering flow engine.
Depends-on: series-31246 ("net/mlx5: move meter init functions")
v3:
- Rebased.
- Added Depends-on tag.v2:
- Rebased on top of v24.03-rc1
- Updated mlx5 docs.Dariusz Sosnowski (3):
net/mlx5: fix conntrack action handle representation net/mlx5: fix connection tracking action validation net/mlx5: remove port from conntrack handle representationSuanming Mou (1):
net/mlx5: add cross port CT object sharingdoc/guides/nics/mlx5.rst | 4 +- doc/guides/rel_notes/release_24_03.rst | 2 + drivers/net/mlx5/mlx5_flow.h | 20 ++- drivers/net/mlx5/mlx5_flow_dv.c | 9 ++ drivers/net/mlx5/mlx5_flow_hw.c | 180 +++++++++++++------------ 5 files changed, 123 insertions(+), 92 deletions(-)
Quoted 2 lines
--
2.25.1
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh