* [PATCH 1/4] net/mlx5: fix conntrack action handle representation
[not found] <20240221100145.8234-1-dsosnowski@nvidia.com>
@ 2024-02-21 10:01 ` Dariusz Sosnowski
2024-02-21 10:01 ` [PATCH 2/4] net/mlx5: fix connection tracking action validation Dariusz Sosnowski
[not found] ` <20240223142320.49470-1-dsosnowski@nvidia.com>
2 siblings, 0 replies; 6+ messages in thread
From: Dariusz Sosnowski @ 2024-02-21 10:01 UTC (permalink / raw)
To: Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad,
Alexander Kozyrev
Cc: dev, stable
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.
Fixes: 463170a7c934 ("net/mlx5: support connection tracking with HWS")
Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action with HWS")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
doc/guides/nics/mlx5.rst | 4 ++--
drivers/net/mlx5/mlx5_flow.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index fa013b03bb..b78753696a 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -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:
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index a4d0ff7b13..b4bf96cd64 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] net/mlx5: fix connection tracking action validation
[not found] <20240221100145.8234-1-dsosnowski@nvidia.com>
2024-02-21 10:01 ` [PATCH 1/4] net/mlx5: fix conntrack action handle representation Dariusz Sosnowski
@ 2024-02-21 10:01 ` Dariusz Sosnowski
[not found] ` <20240223142320.49470-1-dsosnowski@nvidia.com>
2 siblings, 0 replies; 6+ messages in thread
From: Dariusz Sosnowski @ 2024-02-21 10:01 UTC (permalink / raw)
To: Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad; +Cc: dev, stable
In 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.
Fixes: 463170a7c934 ("net/mlx5: support connection tracking with HWS")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 6fded15d91..0604f92531 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 3bb3a9a178..2f366e9078 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/4] net/mlx5: fix conntrack action handle representation
[not found] ` <20240223142320.49470-1-dsosnowski@nvidia.com>
@ 2024-02-23 14:23 ` Dariusz Sosnowski
2024-02-23 14:23 ` [PATCH v2 2/4] net/mlx5: fix connection tracking action validation Dariusz Sosnowski
[not found] ` <20240227135224.20066-1-dsosnowski@nvidia.com>
2 siblings, 0 replies; 6+ messages in thread
From: Dariusz Sosnowski @ 2024-02-23 14:23 UTC (permalink / raw)
To: Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad,
Alexander Kozyrev
Cc: dev, stable
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.
Fixes: 463170a7c934 ("net/mlx5: support connection tracking with HWS")
Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action with HWS")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
doc/guides/nics/mlx5.rst | 4 ++--
drivers/net/mlx5/mlx5_flow.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 0d2213497a..90ae3f3047 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -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:
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index a4d0ff7b13..b4bf96cd64 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/4] net/mlx5: fix connection tracking action validation
[not found] ` <20240223142320.49470-1-dsosnowski@nvidia.com>
2024-02-23 14:23 ` [PATCH v2 1/4] net/mlx5: fix conntrack action handle representation Dariusz Sosnowski
@ 2024-02-23 14:23 ` Dariusz Sosnowski
[not found] ` <20240227135224.20066-1-dsosnowski@nvidia.com>
2 siblings, 0 replies; 6+ messages in thread
From: Dariusz Sosnowski @ 2024-02-23 14:23 UTC (permalink / raw)
To: Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad; +Cc: dev, stable
In 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.
Fixes: 463170a7c934 ("net/mlx5: support connection tracking with HWS")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 23a2388320..c78ef1f616 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index bcf43f5457..366a6956d2 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/4] net/mlx5: fix conntrack action handle representation
[not found] ` <20240227135224.20066-1-dsosnowski@nvidia.com>
@ 2024-02-27 13:52 ` Dariusz Sosnowski
2024-02-27 13:52 ` [PATCH v3 2/4] net/mlx5: fix connection tracking action validation Dariusz Sosnowski
1 sibling, 0 replies; 6+ messages in thread
From: Dariusz Sosnowski @ 2024-02-27 13:52 UTC (permalink / raw)
To: Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad,
Alexander Kozyrev
Cc: dev, stable
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.
Fixes: 463170a7c934 ("net/mlx5: support connection tracking with HWS")
Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action with HWS")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
doc/guides/nics/mlx5.rst | 4 ++--
drivers/net/mlx5/mlx5_flow.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 0079176ba3..db47d70b70 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -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:
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index a4d0ff7b13..b4bf96cd64 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/4] net/mlx5: fix connection tracking action validation
[not found] ` <20240227135224.20066-1-dsosnowski@nvidia.com>
2024-02-27 13:52 ` [PATCH v3 1/4] net/mlx5: fix conntrack action handle representation Dariusz Sosnowski
@ 2024-02-27 13:52 ` Dariusz Sosnowski
1 sibling, 0 replies; 6+ messages in thread
From: Dariusz Sosnowski @ 2024-02-27 13:52 UTC (permalink / raw)
To: Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad; +Cc: dev, stable
In 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.
Fixes: 463170a7c934 ("net/mlx5: support connection tracking with HWS")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 75a8a223ab..ddf19e9a51 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 2a1281732a..a8e2c9cc9e 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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,
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-02-27 13:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20240221100145.8234-1-dsosnowski@nvidia.com>
2024-02-21 10:01 ` [PATCH 1/4] net/mlx5: fix conntrack action handle representation Dariusz Sosnowski
2024-02-21 10:01 ` [PATCH 2/4] net/mlx5: fix connection tracking action validation Dariusz Sosnowski
[not found] ` <20240223142320.49470-1-dsosnowski@nvidia.com>
2024-02-23 14:23 ` [PATCH v2 1/4] net/mlx5: fix conntrack action handle representation Dariusz Sosnowski
2024-02-23 14:23 ` [PATCH v2 2/4] net/mlx5: fix connection tracking action validation Dariusz Sosnowski
[not found] ` <20240227135224.20066-1-dsosnowski@nvidia.com>
2024-02-27 13:52 ` [PATCH v3 1/4] net/mlx5: fix conntrack action handle representation Dariusz Sosnowski
2024-02-27 13:52 ` [PATCH v3 2/4] net/mlx5: fix connection tracking action validation Dariusz Sosnowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).