* [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables
@ 2025-06-17 8:19 Leon Romanovsky
2025-06-17 8:19 ` [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain Leon Romanovsky
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Leon Romanovsky @ 2025-06-17 8:19 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Andrew Lunn, Eric Dumazet, Jakub Kicinski, linux-rdma, Mark Bloch,
netdev, Paolo Abeni, Patrisious Haddad, Saeed Mahameed,
Tariq Toukan
Hi,
This short series from Patrisious extends mlx5 flow steering logic to
allow creation rule creation with priorities in RDMA TRANSPORT tables.
Thanks
Patrisious Haddad (2):
net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain
RDMA/mlx5: Add multiple priorities support to RDMA TRANSPORT userspace
tables
drivers/infiniband/hw/mlx5/fs.c | 40 ++++++++++++-------
drivers/infiniband/hw/mlx5/fs.h | 8 +++-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 4 +-
.../net/ethernet/mellanox/mlx5/core/fs_core.c | 30 ++++++++++----
include/linux/mlx5/fs.h | 2 +-
5 files changed, 56 insertions(+), 28 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain
2025-06-17 8:19 [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Leon Romanovsky
@ 2025-06-17 8:19 ` Leon Romanovsky
2025-06-25 23:42 ` Jakub Kicinski
2025-06-17 8:19 ` [PATCH rdma-next 2/2] RDMA/mlx5: Add multiple priorities support to RDMA TRANSPORT userspace tables Leon Romanovsky
2025-06-18 4:53 ` [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Zhu Yanjun
2 siblings, 1 reply; 7+ messages in thread
From: Leon Romanovsky @ 2025-06-17 8:19 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Patrisious Haddad, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
linux-rdma, Mark Bloch, netdev, Paolo Abeni, Saeed Mahameed,
Tariq Toukan
From: Patrisious Haddad <phaddad@nvidia.com>
RDMA TRANSPORT domains were initially limited to a single priority.
This change allows the domains to have multiple priorities, making
it possible to add several rules and control the order in which
they're evaluated.
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/fs_core.c | 30 ++++++++++++++-----
include/linux/mlx5/fs.h | 2 +-
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 23a7e8e7adfa..63b2aa44084b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -3242,34 +3242,48 @@ static int
init_rdma_transport_rx_root_ns_one(struct mlx5_flow_steering *steering,
int vport_idx)
{
+ struct mlx5_flow_root_namespace *root_ns;
struct fs_prio *prio;
+ int i;
steering->rdma_transport_rx_root_ns[vport_idx] =
create_root_ns(steering, FS_FT_RDMA_TRANSPORT_RX);
if (!steering->rdma_transport_rx_root_ns[vport_idx])
return -ENOMEM;
- /* create 1 prio*/
- prio = fs_create_prio(&steering->rdma_transport_rx_root_ns[vport_idx]->ns,
- MLX5_RDMA_TRANSPORT_BYPASS_PRIO, 1);
- return PTR_ERR_OR_ZERO(prio);
+ root_ns = steering->rdma_transport_rx_root_ns[vport_idx];
+
+ for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) {
+ prio = fs_create_prio(&root_ns->ns, i, 1);
+ if (IS_ERR(prio))
+ return PTR_ERR(prio);
+ }
+ set_prio_attrs(root_ns);
+ return 0;
}
static int
init_rdma_transport_tx_root_ns_one(struct mlx5_flow_steering *steering,
int vport_idx)
{
+ struct mlx5_flow_root_namespace *root_ns;
struct fs_prio *prio;
+ int i;
steering->rdma_transport_tx_root_ns[vport_idx] =
create_root_ns(steering, FS_FT_RDMA_TRANSPORT_TX);
if (!steering->rdma_transport_tx_root_ns[vport_idx])
return -ENOMEM;
- /* create 1 prio*/
- prio = fs_create_prio(&steering->rdma_transport_tx_root_ns[vport_idx]->ns,
- MLX5_RDMA_TRANSPORT_BYPASS_PRIO, 1);
- return PTR_ERR_OR_ZERO(prio);
+ root_ns = steering->rdma_transport_tx_root_ns[vport_idx];
+
+ for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) {
+ prio = fs_create_prio(&root_ns->ns, i, 1);
+ if (IS_ERR(prio))
+ return PTR_ERR(prio);
+ }
+ set_prio_attrs(root_ns);
+ return 0;
}
static int init_rdma_transport_rx_root_ns(struct mlx5_flow_steering *steering)
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 939e58c2f386..86055d55836d 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -40,7 +40,7 @@
#define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
-#define MLX5_RDMA_TRANSPORT_BYPASS_PRIO 0
+#define MLX5_RDMA_TRANSPORT_BYPASS_PRIO 16
#define MLX5_FS_MAX_POOL_SIZE BIT(30)
enum mlx5_flow_destination_type {
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH rdma-next 2/2] RDMA/mlx5: Add multiple priorities support to RDMA TRANSPORT userspace tables
2025-06-17 8:19 [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Leon Romanovsky
2025-06-17 8:19 ` [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain Leon Romanovsky
@ 2025-06-17 8:19 ` Leon Romanovsky
2025-06-18 4:53 ` [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Zhu Yanjun
2 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2025-06-17 8:19 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Patrisious Haddad, linux-rdma, Mark Bloch
From: Patrisious Haddad <phaddad@nvidia.com>
Support the creation of RDMA TRANSPORT tables over multiple priorities
via matcher creation.
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/hw/mlx5/fs.c | 40 +++++++++++++++++-----------
drivers/infiniband/hw/mlx5/fs.h | 8 ++++--
drivers/infiniband/hw/mlx5/mlx5_ib.h | 4 +--
3 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
index 680627f1de33..ebcc05f766e1 100644
--- a/drivers/infiniband/hw/mlx5/fs.c
+++ b/drivers/infiniband/hw/mlx5/fs.c
@@ -1966,7 +1966,8 @@ _get_flow_table(struct mlx5_ib_dev *dev, u16 user_priority,
break;
case MLX5_FLOW_NAMESPACE_RDMA_TRANSPORT_RX:
case MLX5_FLOW_NAMESPACE_RDMA_TRANSPORT_TX:
- if (ib_port == 0 || user_priority > MLX5_RDMA_TRANSPORT_BYPASS_PRIO)
+ if (ib_port == 0 ||
+ user_priority >= MLX5_RDMA_TRANSPORT_BYPASS_PRIO)
return ERR_PTR(-EINVAL);
ret = mlx5_ib_fill_transport_ns_info(dev, ns_type, &flags,
&vport_idx, &vport,
@@ -2016,10 +2017,10 @@ _get_flow_table(struct mlx5_ib_dev *dev, u16 user_priority,
prio = &dev->flow_db->rdma_tx[priority];
break;
case MLX5_FLOW_NAMESPACE_RDMA_TRANSPORT_RX:
- prio = &dev->flow_db->rdma_transport_rx[ib_port - 1];
+ prio = &dev->flow_db->rdma_transport_rx[priority][ib_port - 1];
break;
case MLX5_FLOW_NAMESPACE_RDMA_TRANSPORT_TX:
- prio = &dev->flow_db->rdma_transport_tx[ib_port - 1];
+ prio = &dev->flow_db->rdma_transport_tx[priority][ib_port - 1];
break;
default: return ERR_PTR(-EINVAL);
}
@@ -3466,31 +3467,40 @@ static const struct ib_device_ops flow_ops = {
int mlx5_ib_fs_init(struct mlx5_ib_dev *dev)
{
+ int i, j;
+
dev->flow_db = kzalloc(sizeof(*dev->flow_db), GFP_KERNEL);
if (!dev->flow_db)
return -ENOMEM;
- dev->flow_db->rdma_transport_rx = kcalloc(dev->num_ports,
- sizeof(struct mlx5_ib_flow_prio),
- GFP_KERNEL);
- if (!dev->flow_db->rdma_transport_rx)
- goto free_flow_db;
+ for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) {
+ dev->flow_db->rdma_transport_rx[i] =
+ kcalloc(dev->num_ports,
+ sizeof(struct mlx5_ib_flow_prio), GFP_KERNEL);
+ if (!dev->flow_db->rdma_transport_rx[i])
+ goto free_rdma_transport_rx;
+ }
- dev->flow_db->rdma_transport_tx = kcalloc(dev->num_ports,
- sizeof(struct mlx5_ib_flow_prio),
- GFP_KERNEL);
- if (!dev->flow_db->rdma_transport_tx)
- goto free_rdma_transport_rx;
+ for (j = 0; j < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; j++) {
+ dev->flow_db->rdma_transport_tx[j] =
+ kcalloc(dev->num_ports,
+ sizeof(struct mlx5_ib_flow_prio), GFP_KERNEL);
+ if (!dev->flow_db->rdma_transport_tx[j])
+ goto free_rdma_transport_tx;
+ }
mutex_init(&dev->flow_db->lock);
ib_set_device_ops(&dev->ib_dev, &flow_ops);
return 0;
+free_rdma_transport_tx:
+ while (j--)
+ kfree(dev->flow_db->rdma_transport_tx[j]);
free_rdma_transport_rx:
- kfree(dev->flow_db->rdma_transport_rx);
-free_flow_db:
+ while (i--)
+ kfree(dev->flow_db->rdma_transport_rx[i]);
kfree(dev->flow_db);
return -ENOMEM;
}
diff --git a/drivers/infiniband/hw/mlx5/fs.h b/drivers/infiniband/hw/mlx5/fs.h
index 2ebe86e5be10..7abba0e2837c 100644
--- a/drivers/infiniband/hw/mlx5/fs.h
+++ b/drivers/infiniband/hw/mlx5/fs.h
@@ -13,6 +13,8 @@ void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev);
static inline void mlx5_ib_fs_cleanup(struct mlx5_ib_dev *dev)
{
+ int i;
+
/* When a steering anchor is created, a special flow table is also
* created for the user to reference. Since the user can reference it,
* the kernel cannot trust that when the user destroys the steering
@@ -25,8 +27,10 @@ static inline void mlx5_ib_fs_cleanup(struct mlx5_ib_dev *dev)
* is a safe assumption that all references are gone.
*/
mlx5_ib_fs_cleanup_anchor(dev);
- kfree(dev->flow_db->rdma_transport_tx);
- kfree(dev->flow_db->rdma_transport_rx);
+ for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++)
+ kfree(dev->flow_db->rdma_transport_tx[i]);
+ for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++)
+ kfree(dev->flow_db->rdma_transport_rx[i]);
kfree(dev->flow_db);
}
#endif /* _MLX5_IB_FS_H */
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 9c6ec5a968b1..ef627e2f8e6d 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -320,8 +320,8 @@ struct mlx5_ib_flow_db {
struct mlx5_ib_flow_prio rdma_tx[MLX5_IB_NUM_FLOW_FT];
struct mlx5_ib_flow_prio opfcs[MLX5_IB_OPCOUNTER_MAX];
struct mlx5_flow_table *lag_demux_ft;
- struct mlx5_ib_flow_prio *rdma_transport_rx;
- struct mlx5_ib_flow_prio *rdma_transport_tx;
+ struct mlx5_ib_flow_prio *rdma_transport_rx[MLX5_RDMA_TRANSPORT_BYPASS_PRIO];
+ struct mlx5_ib_flow_prio *rdma_transport_tx[MLX5_RDMA_TRANSPORT_BYPASS_PRIO];
/* Protect flow steering bypass flow tables
* when add/del flow rules.
* only single add/removal of flow steering rule could be done
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables
2025-06-17 8:19 [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Leon Romanovsky
2025-06-17 8:19 ` [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain Leon Romanovsky
2025-06-17 8:19 ` [PATCH rdma-next 2/2] RDMA/mlx5: Add multiple priorities support to RDMA TRANSPORT userspace tables Leon Romanovsky
@ 2025-06-18 4:53 ` Zhu Yanjun
2025-06-18 10:39 ` Leon Romanovsky
2 siblings, 1 reply; 7+ messages in thread
From: Zhu Yanjun @ 2025-06-18 4:53 UTC (permalink / raw)
To: Leon Romanovsky, Jason Gunthorpe
Cc: Andrew Lunn, Eric Dumazet, Jakub Kicinski, linux-rdma, Mark Bloch,
netdev, Paolo Abeni, Patrisious Haddad, Saeed Mahameed,
Tariq Toukan
在 2025/6/17 1:19, Leon Romanovsky 写道:
> Hi,
>
> This short series from Patrisious extends mlx5 flow steering logic to
> allow creation rule creation with priorities in RDMA TRANSPORT tables.
^^^^^^^^
This "creation" should be removed?
Yanjun.Zhu
>
> Thanks
>
> Patrisious Haddad (2):
> net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain
> RDMA/mlx5: Add multiple priorities support to RDMA TRANSPORT userspace
> tables
>
> drivers/infiniband/hw/mlx5/fs.c | 40 ++++++++++++-------
> drivers/infiniband/hw/mlx5/fs.h | 8 +++-
> drivers/infiniband/hw/mlx5/mlx5_ib.h | 4 +-
> .../net/ethernet/mellanox/mlx5/core/fs_core.c | 30 ++++++++++----
> include/linux/mlx5/fs.h | 2 +-
> 5 files changed, 56 insertions(+), 28 deletions(-)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables
2025-06-18 4:53 ` [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Zhu Yanjun
@ 2025-06-18 10:39 ` Leon Romanovsky
0 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2025-06-18 10:39 UTC (permalink / raw)
To: Zhu Yanjun
Cc: Jason Gunthorpe, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
linux-rdma, Mark Bloch, netdev, Paolo Abeni, Patrisious Haddad,
Saeed Mahameed, Tariq Toukan
On Tue, Jun 17, 2025 at 09:53:18PM -0700, Zhu Yanjun wrote:
> 在 2025/6/17 1:19, Leon Romanovsky 写道:
> > Hi,
> >
> > This short series from Patrisious extends mlx5 flow steering logic to
> > allow creation rule creation with priorities in RDMA TRANSPORT tables.
> ^^^^^^^^
> This "creation" should be removed?
This is typo on cover letter which is going to be disposed.
Thanks
>
> Yanjun.Zhu
>
> >
> > Thanks
> >
> > Patrisious Haddad (2):
> > net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain
> > RDMA/mlx5: Add multiple priorities support to RDMA TRANSPORT userspace
> > tables
> >
> > drivers/infiniband/hw/mlx5/fs.c | 40 ++++++++++++-------
> > drivers/infiniband/hw/mlx5/fs.h | 8 +++-
> > drivers/infiniband/hw/mlx5/mlx5_ib.h | 4 +-
> > .../net/ethernet/mellanox/mlx5/core/fs_core.c | 30 ++++++++++----
> > include/linux/mlx5/fs.h | 2 +-
> > 5 files changed, 56 insertions(+), 28 deletions(-)
> >
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain
2025-06-17 8:19 ` [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain Leon Romanovsky
@ 2025-06-25 23:42 ` Jakub Kicinski
2025-06-26 6:49 ` Leon Romanovsky
0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-06-25 23:42 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Jason Gunthorpe, Patrisious Haddad, Andrew Lunn, Eric Dumazet,
linux-rdma, Mark Bloch, netdev, Paolo Abeni, Saeed Mahameed,
Tariq Toukan
On Tue, 17 Jun 2025 11:19:15 +0300 Leon Romanovsky wrote:
> + for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) {
> + prio = fs_create_prio(&root_ns->ns, i, 1);
> + if (IS_ERR(prio))
> + return PTR_ERR(prio);
> + }
> + set_prio_attrs(root_ns);
Looking at the PR now -- y'all sure this doesn't need any extra cleanup
if creation of non-first prio fails?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain
2025-06-25 23:42 ` Jakub Kicinski
@ 2025-06-26 6:49 ` Leon Romanovsky
0 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2025-06-26 6:49 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Jason Gunthorpe, Patrisious Haddad, Andrew Lunn, Eric Dumazet,
linux-rdma, Mark Bloch, netdev, Paolo Abeni, Saeed Mahameed,
Tariq Toukan
On Wed, Jun 25, 2025 at 04:42:00PM -0700, Jakub Kicinski wrote:
> On Tue, 17 Jun 2025 11:19:15 +0300 Leon Romanovsky wrote:
> > + for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) {
> > + prio = fs_create_prio(&root_ns->ns, i, 1);
> > + if (IS_ERR(prio))
> > + return PTR_ERR(prio);
> > + }
> > + set_prio_attrs(root_ns);
>
> Looking at the PR now -- y'all sure this doesn't need any extra cleanup
> if creation of non-first prio fails?
Yes, it was missed.
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-06-26 6:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 8:19 [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Leon Romanovsky
2025-06-17 8:19 ` [PATCH mlx5-next 1/2] net/mlx5: fs, add multiple prios to RDMA TRANSPORT steering domain Leon Romanovsky
2025-06-25 23:42 ` Jakub Kicinski
2025-06-26 6:49 ` Leon Romanovsky
2025-06-17 8:19 ` [PATCH rdma-next 2/2] RDMA/mlx5: Add multiple priorities support to RDMA TRANSPORT userspace tables Leon Romanovsky
2025-06-18 4:53 ` [PATCH rdma-next 0/2] Add multiple priorities support to mlx5 RDMA TRANSPORT tables Zhu Yanjun
2025-06-18 10:39 ` Leon Romanovsky
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).