diff options
author | Matan Barak <matanb@mellanox.com> | 2013-11-07 08:25:15 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-01-14 17:06:50 -0500 |
commit | 0a9b7d59d5a8e2b97406a29a8a807bbc5ce7092e (patch) | |
tree | 10f4ab5179aadaa0f180e8211c56938296afdcba /drivers/infiniband | |
parent | 4de6580360867d44adecb2d05febed1c8d186c82 (diff) |
IB/mlx4: Enable device-managed steering support for IB ports too
Up until now, flow steering wasn't supported when using IB ports.
This patch enables support for flow steering if all hardware ports
support that, for example the new MLX4_DEV_CAP_FLAG2_DMFS_IPOIB mlx4
device capability.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 31 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/mlx4_ib.h | 1 |
2 files changed, 20 insertions, 12 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 1958c5ca792a..e8d0c5592fd3 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -92,21 +92,27 @@ static union ib_gid zgid; | |||
92 | 92 | ||
93 | static int check_flow_steering_support(struct mlx4_dev *dev) | 93 | static int check_flow_steering_support(struct mlx4_dev *dev) |
94 | { | 94 | { |
95 | int eth_num_ports = 0; | ||
95 | int ib_num_ports = 0; | 96 | int ib_num_ports = 0; |
96 | int i; | ||
97 | |||
98 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
99 | ib_num_ports++; | ||
100 | 97 | ||
101 | if (dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED) { | 98 | int dmfs = dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED; |
102 | if (ib_num_ports || mlx4_is_mfunc(dev)) { | 99 | |
103 | pr_warn("Device managed flow steering is unavailable " | 100 | if (dmfs) { |
104 | "for IB ports or in multifunction env.\n"); | 101 | int i; |
105 | return 0; | 102 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) |
103 | eth_num_ports++; | ||
104 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
105 | ib_num_ports++; | ||
106 | dmfs &= (!ib_num_ports || | ||
107 | (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DMFS_IPOIB)) && | ||
108 | (!eth_num_ports || | ||
109 | (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FS_EN)); | ||
110 | if (ib_num_ports && mlx4_is_mfunc(dev)) { | ||
111 | pr_warn("Device managed flow steering is unavailable for IB port in multifunction env.\n"); | ||
112 | dmfs = 0; | ||
106 | } | 113 | } |
107 | return 1; | ||
108 | } | 114 | } |
109 | return 0; | 115 | return dmfs; |
110 | } | 116 | } |
111 | 117 | ||
112 | static int mlx4_ib_query_device(struct ib_device *ibdev, | 118 | static int mlx4_ib_query_device(struct ib_device *ibdev, |
@@ -165,7 +171,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
165 | props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2B; | 171 | props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2B; |
166 | else | 172 | else |
167 | props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2A; | 173 | props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2A; |
168 | if (check_flow_steering_support(dev->dev)) | 174 | if (dev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED) |
169 | props->device_cap_flags |= IB_DEVICE_MANAGED_FLOW_STEERING; | 175 | props->device_cap_flags |= IB_DEVICE_MANAGED_FLOW_STEERING; |
170 | } | 176 | } |
171 | 177 | ||
@@ -1682,6 +1688,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
1682 | } | 1688 | } |
1683 | 1689 | ||
1684 | if (check_flow_steering_support(dev)) { | 1690 | if (check_flow_steering_support(dev)) { |
1691 | ibdev->steering_support = MLX4_STEERING_MODE_DEVICE_MANAGED; | ||
1685 | ibdev->ib_dev.create_flow = mlx4_ib_create_flow; | 1692 | ibdev->ib_dev.create_flow = mlx4_ib_create_flow; |
1686 | ibdev->ib_dev.destroy_flow = mlx4_ib_destroy_flow; | 1693 | ibdev->ib_dev.destroy_flow = mlx4_ib_destroy_flow; |
1687 | 1694 | ||
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index 036b663dd26e..e9fb39603ee9 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
@@ -494,6 +494,7 @@ struct mlx4_ib_dev { | |||
494 | struct kobject *dev_ports_parent[MLX4_MFUNC_MAX]; | 494 | struct kobject *dev_ports_parent[MLX4_MFUNC_MAX]; |
495 | struct mlx4_ib_iov_port iov_ports[MLX4_MAX_PORTS]; | 495 | struct mlx4_ib_iov_port iov_ports[MLX4_MAX_PORTS]; |
496 | struct pkey_mgt pkeys; | 496 | struct pkey_mgt pkeys; |
497 | int steering_support; | ||
497 | }; | 498 | }; |
498 | 499 | ||
499 | struct ib_event_work { | 500 | struct ib_event_work { |