aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@dev.mellanox.co.il>2012-08-03 04:40:57 -0400
committerRoland Dreier <roland@purestorage.com>2012-09-30 23:33:43 -0400
commit47605df953985c2b792ac9f3ddf70d270b89adb8 (patch)
treeb95cef28771ea4982a5bca6130dab4ace79d622c /include/linux/mlx4
parentafa8fd1db9f295a0c4130bc6d87bf8b05bdd0523 (diff)
mlx4: Modify proxy/tunnel QP mechanism so that guests do no calculations
Previously, the structure of a guest's proxy QPs followed the structure of the PPF special qps (qp0 port 1, qp0 port 2, qp1 port 1, qp1 port 2, ...). The guest then did offset calculations on the sqp_base qp number that the PPF passed to it in QUERY_FUNC_CAP(). This is now changed so that the guest does no offset calculations regarding proxy or tunnel QPs to use. This change frees the PPF from needing to adhere to a specific order in allocating proxy and tunnel QPs. Now QUERY_FUNC_CAP provides each port individually with its proxy qp0, proxy qp1, tunnel qp0, and tunnel qp1 QP numbers, and these are used directly where required (with no offset calculations). To accomplish this change, several fields were added to the phys_caps structure for use by the PPF and by non-SR-IOV mode: base_sqpn -- in non-sriov mode, this was formerly sqp_start. base_proxy_sqpn -- the first physical proxy qp number -- used by PPF base_tunnel_sqpn -- the first physical tunnel qp number -- used by PPF. The current code in the PPF still adheres to the previous layout of sqps, proxy-sqps and tunnel-sqps. However, the PPF can change this layout without affecting VF or (paravirtualized) PF code. Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include/linux/mlx4')
-rw-r--r--include/linux/mlx4/device.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index c0f8f74a0a5e..6d1acb04cd17 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -328,6 +328,9 @@ struct mlx4_phys_caps {
328 u32 gid_phys_table_len[MLX4_MAX_PORTS + 1]; 328 u32 gid_phys_table_len[MLX4_MAX_PORTS + 1];
329 u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1]; 329 u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1];
330 u32 num_phys_eqs; 330 u32 num_phys_eqs;
331 u32 base_sqpn;
332 u32 base_proxy_sqpn;
333 u32 base_tunnel_sqpn;
331}; 334};
332 335
333struct mlx4_caps { 336struct mlx4_caps {
@@ -358,9 +361,10 @@ struct mlx4_caps {
358 int max_rq_desc_sz; 361 int max_rq_desc_sz;
359 int max_qp_init_rdma; 362 int max_qp_init_rdma;
360 int max_qp_dest_rdma; 363 int max_qp_dest_rdma;
361 int sqp_start; 364 u32 *qp0_proxy;
362 u32 base_sqpn; 365 u32 *qp1_proxy;
363 u32 base_tunnel_sqpn; 366 u32 *qp0_tunnel;
367 u32 *qp1_tunnel;
364 int num_srqs; 368 int num_srqs;
365 int max_srq_wqes; 369 int max_srq_wqes;
366 int max_srq_sge; 370 int max_srq_sge;
@@ -722,15 +726,15 @@ static inline int mlx4_is_master(struct mlx4_dev *dev)
722 726
723static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 727static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
724{ 728{
725 return (qpn < dev->caps.base_sqpn + 8 + 729 return (qpn < dev->phys_caps.base_sqpn + 8 +
726 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev)); 730 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev));
727} 731}
728 732
729static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn) 733static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn)
730{ 734{
731 int base = dev->caps.sqp_start + slave * 8; 735 int guest_proxy_base = dev->phys_caps.base_proxy_sqpn + slave * 8;
732 736
733 if (qpn >= base && qpn < base + 8) 737 if (qpn >= guest_proxy_base && qpn < guest_proxy_base + 8)
734 return 1; 738 return 1;
735 739
736 return 0; 740 return 0;