aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4/device.h
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@dev.mellanox.co.il>2012-06-19 04:21:42 -0400
committerRoland Dreier <roland@purestorage.com>2012-07-11 14:35:55 -0400
commit396f2feb05d7cc5549c611c05abfb4108cd1c6d6 (patch)
tree797eabb6ea6b2e85480ed9375849c7648d72ed7e /include/linux/mlx4/device.h
parent2aca1172c2f5b27fbc37297574f716c1c15f4153 (diff)
mlx4_core: Implement mechanism for reserved Q_Keys
The SR-IOV special QP tunneling mechanism uses proxy special QPs (instead of the real special QPs) for MADs on guests. These proxy QPs send their packets to a "tunnel" QP owned by the master. The master then forwards the MAD (after any required paravirtualization) to the real special QP, which sends out the MAD. For security reasons (i.e., to prevent guests from sending MADs to tunnel QPs belonging to other guests), each proxy-tunnel QP pair is assigned a unique, reserved, Q_Key. These Q_Keys are available only for proxy and tunnel QPs -- if the guest tries to use these Q_Keys with other QPs, it will fail. This patch introduces a mechanism for reserving a block of 64K Q_Keys for proxy/tunneling use. The patch introduces also two new fields into mlx4_dev: base_sqpn and base_tunnel_sqpn. In SR-IOV mode, the QP numbers for the "real," proxy, and tunnel sqps are added to the reserved QPN area (so that they will not change). There are 8 special QPs per port in the HCA, and each of them is assigned both a proxy and a tunnel QP, for each VF and for the PF as well in SR-IOV mode. The QPNs for these QPs are arranged as follows: 1. The real SQP numbers (8) 2. The proxy SQPs (8 * (max number of VFs + max number of PFs) 3. The tunnel SQPs (8 * (max number of VFs + max number of PFs) To support these QPs, two new fields are added to struct mlx4_dev: base_sqp: this is the QP number of the first of the real SQPs base_tunnel_sqp: this is the qp number of the first qp in the tunnel sqp region. (On guests, this is the first tunnel sqp of the 8 which are assigned to that guest). In addition, in SR-IOV mode, sqp_start is the number of the first proxy SQP in the proxy SQP region. (In guests, this is the first proxy SQP of the 8 which are assigned to that guest) Note that in non-SR-IOV mode, there are no proxies and no tunnels. In this case, sqp_start is set to sqp_base -- which minimizes code changes. Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include/linux/mlx4/device.h')
-rw-r--r--include/linux/mlx4/device.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 7fbdc89de495..c30a314e095c 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -56,6 +56,13 @@ enum {
56 MLX4_MAX_PORTS = 2 56 MLX4_MAX_PORTS = 2
57}; 57};
58 58
59/* base qkey for use in sriov tunnel-qp/proxy-qp communication.
60 * These qkeys must not be allowed for general use. This is a 64k range,
61 * and to test for violation, we use the mask (protect against future chg).
62 */
63#define MLX4_RESERVED_QKEY_BASE (0xFFFF0000)
64#define MLX4_RESERVED_QKEY_MASK (0xFFFF0000)
65
59enum { 66enum {
60 MLX4_BOARD_ID_LEN = 64 67 MLX4_BOARD_ID_LEN = 64
61}; 68};
@@ -293,6 +300,8 @@ struct mlx4_caps {
293 int max_qp_init_rdma; 300 int max_qp_init_rdma;
294 int max_qp_dest_rdma; 301 int max_qp_dest_rdma;
295 int sqp_start; 302 int sqp_start;
303 u32 base_sqpn;
304 u32 base_tunnel_sqpn;
296 int num_srqs; 305 int num_srqs;
297 int max_srq_wqes; 306 int max_srq_wqes;
298 int max_srq_sge; 307 int max_srq_sge;
@@ -772,4 +781,6 @@ int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port);
772int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx); 781int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx);
773void mlx4_counter_free(struct mlx4_dev *dev, u32 idx); 782void mlx4_counter_free(struct mlx4_dev *dev, u32 idx);
774 783
784int mlx4_get_parav_qkey(struct mlx4_dev *dev, u32 qpn, u32 *qkey);
785
775#endif /* MLX4_DEVICE_H */ 786#endif /* MLX4_DEVICE_H */