Skip to content

Commit 13a4376

Browse files
mark-blochjgunthorpe
authored andcommitted
RDMA/mlx5: Access the prio bypass inside the FDB flow table namespace
Now that we have a specific prio inside the FDB namespace allow retrieving it from the RDMA side. Signed-off-by: Mark Bloch <[email protected]> Reviewed-by: Maor Gottlieb <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 2e5b8a0 commit 13a4376

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3809,11 +3809,16 @@ _get_flow_table(struct mlx5_ib_dev *dev,
38093809
bool mcast)
38103810
{
38113811
struct mlx5_flow_namespace *ns = NULL;
3812-
struct mlx5_ib_flow_prio *prio;
3813-
int max_table_size;
3812+
struct mlx5_ib_flow_prio *prio = NULL;
3813+
int max_table_size = 0;
38143814
u32 flags = 0;
38153815
int priority;
38163816

3817+
if (mcast)
3818+
priority = MLX5_IB_FLOW_MCAST_PRIO;
3819+
else
3820+
priority = ib_prio_to_core_prio(fs_matcher->priority, false);
3821+
38173822
if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_BYPASS) {
38183823
max_table_size = BIT(MLX5_CAP_FLOWTABLE_NIC_RX(dev->mdev,
38193824
log_max_ft_size));
@@ -3822,29 +3827,33 @@ _get_flow_table(struct mlx5_ib_dev *dev,
38223827
if (MLX5_CAP_FLOWTABLE_NIC_RX(dev->mdev,
38233828
reformat_l3_tunnel_to_l2))
38243829
flags |= MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT;
3825-
} else { /* Can only be MLX5_FLOW_NAMESPACE_EGRESS */
3826-
max_table_size = BIT(MLX5_CAP_FLOWTABLE_NIC_TX(dev->mdev,
3827-
log_max_ft_size));
3830+
} else if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_EGRESS) {
3831+
max_table_size = BIT(
3832+
MLX5_CAP_FLOWTABLE_NIC_TX(dev->mdev, log_max_ft_size));
38283833
if (MLX5_CAP_FLOWTABLE_NIC_TX(dev->mdev, reformat))
38293834
flags |= MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT;
3835+
} else if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_FDB) {
3836+
max_table_size = BIT(
3837+
MLX5_CAP_ESW_FLOWTABLE_FDB(dev->mdev, log_max_ft_size));
3838+
priority = FDB_BYPASS_PATH;
38303839
}
38313840

38323841
if (max_table_size < MLX5_FS_MAX_ENTRIES)
38333842
return ERR_PTR(-ENOMEM);
38343843

3835-
if (mcast)
3836-
priority = MLX5_IB_FLOW_MCAST_PRIO;
3837-
else
3838-
priority = ib_prio_to_core_prio(fs_matcher->priority, false);
3839-
38403844
ns = mlx5_get_flow_namespace(dev->mdev, fs_matcher->ns_type);
38413845
if (!ns)
38423846
return ERR_PTR(-ENOTSUPP);
38433847

38443848
if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_BYPASS)
38453849
prio = &dev->flow_db->prios[priority];
3846-
else
3850+
else if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_EGRESS)
38473851
prio = &dev->flow_db->egress_prios[priority];
3852+
else if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_FDB)
3853+
prio = &dev->flow_db->fdb;
3854+
3855+
if (!prio)
3856+
return ERR_PTR(-EINVAL);
38483857

38493858
if (prio->flow_table)
38503859
return prio;

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ struct mlx5_ib_flow_db {
194194
struct mlx5_ib_flow_prio egress_prios[MLX5_IB_NUM_FLOW_FT];
195195
struct mlx5_ib_flow_prio sniffer[MLX5_IB_NUM_SNIFFER_FTS];
196196
struct mlx5_ib_flow_prio egress[MLX5_IB_NUM_EGRESS_FTS];
197+
struct mlx5_ib_flow_prio fdb;
197198
struct mlx5_flow_table *lag_demux_ft;
198199
/* Protect flow steering bypass flow tables
199200
* when add/del flow rules.

0 commit comments

Comments
 (0)