RDMA/mlx5: Add support for RDMA TX flow table
authorMichael Guralnik <michaelgur@mellanox.com>
Tue, 24 Mar 2020 06:14:25 +0000 (08:14 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 27 Mar 2020 16:24:48 +0000 (13:24 -0300)
Enable user application to add rules for RDMA TX steering table.
Rules in this steering table will allow to steer transmitted RDMA
traffic.

Link: https://lore.kernel.org/r/20200324061425.1570190-3-leon@kernel.org
Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/flow.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
include/uapi/rdma/mlx5_user_ioctl_verbs.h

index dbee17d..862b7bf 100644 (file)
@@ -35,6 +35,9 @@ mlx5_ib_ft_type_to_namespace(enum mlx5_ib_uapi_flow_table_type table_type,
        case MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX:
                *namespace = MLX5_FLOW_NAMESPACE_RDMA_RX;
                break;
+       case MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX:
+               *namespace = MLX5_FLOW_NAMESPACE_RDMA_TX;
+               break;
        default:
                return -EINVAL;
        }
index fce8636..96dcaec 100644 (file)
@@ -4045,6 +4045,11 @@ _get_flow_table(struct mlx5_ib_dev *dev,
                        BIT(MLX5_CAP_FLOWTABLE_RDMA_RX(dev->mdev,
                                                       log_max_ft_size));
                priority = fs_matcher->priority;
+       } else if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_RDMA_TX) {
+               max_table_size =
+                       BIT(MLX5_CAP_FLOWTABLE_RDMA_TX(dev->mdev,
+                                                      log_max_ft_size));
+               priority = fs_matcher->priority;
        }
 
        max_table_size = min_t(int, max_table_size, MLX5_FS_MAX_ENTRIES);
@@ -4061,6 +4066,8 @@ _get_flow_table(struct mlx5_ib_dev *dev,
                prio = &dev->flow_db->fdb;
        else if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_RDMA_RX)
                prio = &dev->flow_db->rdma_rx[priority];
+       else if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_RDMA_TX)
+               prio = &dev->flow_db->rdma_tx[priority];
 
        if (!prio)
                return ERR_PTR(-EINVAL);
index 89a050e..6fe01d6 100644 (file)
@@ -210,6 +210,7 @@ struct mlx5_ib_flow_db {
        struct mlx5_ib_flow_prio        egress[MLX5_IB_NUM_EGRESS_FTS];
        struct mlx5_ib_flow_prio        fdb;
        struct mlx5_ib_flow_prio        rdma_rx[MLX5_IB_NUM_FLOW_FT];
+       struct mlx5_ib_flow_prio        rdma_tx[MLX5_IB_NUM_FLOW_FT];
        struct mlx5_flow_table          *lag_demux_ft;
        /* Protect flow steering bypass flow tables
         * when add/del flow rules.
index 88b6ca7..7ab4b92 100644 (file)
@@ -44,6 +44,7 @@ enum mlx5_ib_uapi_flow_table_type {
        MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX     = 0x1,
        MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB        = 0x2,
        MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX    = 0x3,
+       MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX    = 0x4,
 };
 
 enum mlx5_ib_uapi_flow_action_packet_reformat_type {