diff options
author | Matan Barak <matanb@mellanox.com> | 2013-11-07 08:25:14 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-01-14 17:06:50 -0500 |
commit | 4de6580360867d44adecb2d05febed1c8d186c82 (patch) | |
tree | 4645ce69a405ff0ed519da0ad7d8ba12c76e05a8 | |
parent | 240ae00e4d834e387f4f09e236130f520e357a70 (diff) |
mlx4_core: Add support for steerable IB UD QPs
This patch adds support for allocating IB UD QPs that we can steer
traffic from. We introduce a new firmware command FLOW_STEERING_IB_UC_QP_RANGE
and a capability bit.
This command isn't supported for VFs.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cmd.c | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mcg.c | 17 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4.h | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 10 | ||||
-rw-r--r-- | include/linux/mlx4/cmd.h | 1 | ||||
-rw-r--r-- | include/linux/mlx4/device.h | 6 |
7 files changed, 57 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 1e9970d2f0f3..0d02fba94536 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -1371,6 +1371,15 @@ static struct mlx4_cmd_info cmd_info[] = { | |||
1371 | .verify = NULL, | 1371 | .verify = NULL, |
1372 | .wrapper = mlx4_QP_FLOW_STEERING_DETACH_wrapper | 1372 | .wrapper = mlx4_QP_FLOW_STEERING_DETACH_wrapper |
1373 | }, | 1373 | }, |
1374 | { | ||
1375 | .opcode = MLX4_FLOW_STEERING_IB_UC_QP_RANGE, | ||
1376 | .has_inbox = false, | ||
1377 | .has_outbox = false, | ||
1378 | .out_is_imm = false, | ||
1379 | .encode_slave_id = false, | ||
1380 | .verify = NULL, | ||
1381 | .wrapper = mlx4_FLOW_STEERING_IB_UC_QP_RANGE_wrapper | ||
1382 | }, | ||
1374 | }; | 1383 | }; |
1375 | 1384 | ||
1376 | static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave, | 1385 | static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 194928214606..4bd2d80d065e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -513,6 +513,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
513 | #define QUERY_DEV_CAP_MAX_XRC_OFFSET 0x67 | 513 | #define QUERY_DEV_CAP_MAX_XRC_OFFSET 0x67 |
514 | #define QUERY_DEV_CAP_MAX_COUNTERS_OFFSET 0x68 | 514 | #define QUERY_DEV_CAP_MAX_COUNTERS_OFFSET 0x68 |
515 | #define QUERY_DEV_CAP_EXT_2_FLAGS_OFFSET 0x70 | 515 | #define QUERY_DEV_CAP_EXT_2_FLAGS_OFFSET 0x70 |
516 | #define QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET 0x74 | ||
516 | #define QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET 0x76 | 517 | #define QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET 0x76 |
517 | #define QUERY_DEV_CAP_FLOW_STEERING_MAX_QP_OFFSET 0x77 | 518 | #define QUERY_DEV_CAP_FLOW_STEERING_MAX_QP_OFFSET 0x77 |
518 | #define QUERY_DEV_CAP_RDMARC_ENTRY_SZ_OFFSET 0x80 | 519 | #define QUERY_DEV_CAP_RDMARC_ENTRY_SZ_OFFSET 0x80 |
@@ -603,6 +604,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
603 | if (field & 0x80) | 604 | if (field & 0x80) |
604 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_FS_EN; | 605 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_FS_EN; |
605 | dev_cap->fs_log_max_ucast_qp_range_size = field & 0x1f; | 606 | dev_cap->fs_log_max_ucast_qp_range_size = field & 0x1f; |
607 | MLX4_GET(field, outbox, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); | ||
608 | if (field & 0x80) | ||
609 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_DMFS_IPOIB; | ||
606 | MLX4_GET(field, outbox, QUERY_DEV_CAP_FLOW_STEERING_MAX_QP_OFFSET); | 610 | MLX4_GET(field, outbox, QUERY_DEV_CAP_FLOW_STEERING_MAX_QP_OFFSET); |
607 | dev_cap->fs_max_num_qp_per_entry = field; | 611 | dev_cap->fs_max_num_qp_per_entry = field; |
608 | MLX4_GET(stat_rate, outbox, QUERY_DEV_CAP_RATE_SUPPORT_OFFSET); | 612 | MLX4_GET(stat_rate, outbox, QUERY_DEV_CAP_RATE_SUPPORT_OFFSET); |
@@ -860,6 +864,12 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave, | |||
860 | MLX4_PUT(outbox->buf, field, | 864 | MLX4_PUT(outbox->buf, field, |
861 | QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET); | 865 | QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET); |
862 | } | 866 | } |
867 | |||
868 | /* turn off ipoib managed steering for guests */ | ||
869 | MLX4_GET(field, outbox, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); | ||
870 | field &= ~0x80; | ||
871 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); | ||
872 | |||
863 | return 0; | 873 | return 0; |
864 | } | 874 | } |
865 | 875 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index acf9d5f1f922..34dffcf61bff 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -895,6 +895,23 @@ int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id) | |||
895 | } | 895 | } |
896 | EXPORT_SYMBOL_GPL(mlx4_flow_detach); | 896 | EXPORT_SYMBOL_GPL(mlx4_flow_detach); |
897 | 897 | ||
898 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, | ||
899 | u32 max_range_qpn) | ||
900 | { | ||
901 | int err; | ||
902 | u64 in_param; | ||
903 | |||
904 | in_param = ((u64) min_range_qpn) << 32; | ||
905 | in_param |= ((u64) max_range_qpn) & 0xFFFFFFFF; | ||
906 | |||
907 | err = mlx4_cmd(dev, in_param, 0, 0, | ||
908 | MLX4_FLOW_STEERING_IB_UC_QP_RANGE, | ||
909 | MLX4_CMD_TIME_CLASS_A, MLX4_CMD_NATIVE); | ||
910 | |||
911 | return err; | ||
912 | } | ||
913 | EXPORT_SYMBOL_GPL(mlx4_FLOW_STEERING_IB_UC_QP_RANGE); | ||
914 | |||
898 | int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | 915 | int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
899 | int block_mcast_loopback, enum mlx4_protocol prot, | 916 | int block_mcast_loopback, enum mlx4_protocol prot, |
900 | enum mlx4_steer_type steer) | 917 | enum mlx4_steer_type steer) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index e582a41a802b..59f67f9086dc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -1236,6 +1236,11 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | |||
1236 | struct mlx4_cmd_mailbox *inbox, | 1236 | struct mlx4_cmd_mailbox *inbox, |
1237 | struct mlx4_cmd_mailbox *outbox, | 1237 | struct mlx4_cmd_mailbox *outbox, |
1238 | struct mlx4_cmd_info *cmd); | 1238 | struct mlx4_cmd_info *cmd); |
1239 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE_wrapper(struct mlx4_dev *dev, int slave, | ||
1240 | struct mlx4_vhcr *vhcr, | ||
1241 | struct mlx4_cmd_mailbox *inbox, | ||
1242 | struct mlx4_cmd_mailbox *outbox, | ||
1243 | struct mlx4_cmd_info *cmd); | ||
1239 | 1244 | ||
1240 | int mlx4_get_mgm_entry_size(struct mlx4_dev *dev); | 1245 | int mlx4_get_mgm_entry_size(struct mlx4_dev *dev); |
1241 | int mlx4_get_qp_per_mgm(struct mlx4_dev *dev); | 1246 | int mlx4_get_qp_per_mgm(struct mlx4_dev *dev); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 2f3f2bc7f283..663510325c22 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -3844,6 +3844,16 @@ int mlx4_QUERY_IF_STAT_wrapper(struct mlx4_dev *dev, int slave, | |||
3844 | return err; | 3844 | return err; |
3845 | } | 3845 | } |
3846 | 3846 | ||
3847 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE_wrapper(struct mlx4_dev *dev, int slave, | ||
3848 | struct mlx4_vhcr *vhcr, | ||
3849 | struct mlx4_cmd_mailbox *inbox, | ||
3850 | struct mlx4_cmd_mailbox *outbox, | ||
3851 | struct mlx4_cmd_info *cmd) | ||
3852 | { | ||
3853 | return -EPERM; | ||
3854 | } | ||
3855 | |||
3856 | |||
3847 | static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp) | 3857 | static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp) |
3848 | { | 3858 | { |
3849 | struct res_gid *rgid; | 3859 | struct res_gid *rgid; |
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 8df61bc5da00..ff36620f88a7 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
@@ -157,6 +157,7 @@ enum { | |||
157 | /* register/delete flow steering network rules */ | 157 | /* register/delete flow steering network rules */ |
158 | MLX4_QP_FLOW_STEERING_ATTACH = 0x65, | 158 | MLX4_QP_FLOW_STEERING_ATTACH = 0x65, |
159 | MLX4_QP_FLOW_STEERING_DETACH = 0x66, | 159 | MLX4_QP_FLOW_STEERING_DETACH = 0x66, |
160 | MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64, | ||
160 | }; | 161 | }; |
161 | 162 | ||
162 | enum { | 163 | enum { |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 7d3a523160ba..7de9fde3a9dd 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -160,7 +160,8 @@ enum { | |||
160 | MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, | 160 | MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, |
161 | MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, | 161 | MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, |
162 | MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7, | 162 | MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7, |
163 | MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8 | 163 | MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8, |
164 | MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9 | ||
164 | }; | 165 | }; |
165 | 166 | ||
166 | enum { | 167 | enum { |
@@ -1144,6 +1145,9 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int | |||
1144 | void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); | 1145 | void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); |
1145 | __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); | 1146 | __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); |
1146 | 1147 | ||
1148 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, | ||
1149 | u32 max_range_qpn); | ||
1150 | |||
1147 | cycle_t mlx4_read_clock(struct mlx4_dev *dev); | 1151 | cycle_t mlx4_read_clock(struct mlx4_dev *dev); |
1148 | 1152 | ||
1149 | #endif /* MLX4_DEVICE_H */ | 1153 | #endif /* MLX4_DEVICE_H */ |