diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2012-08-03 04:40:57 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-09-30 23:33:43 -0400 |
commit | 47605df953985c2b792ac9f3ddf70d270b89adb8 (patch) | |
tree | b95cef28771ea4982a5bca6130dab4ace79d622c /drivers/infiniband/hw/mlx4/mad.c | |
parent | afa8fd1db9f295a0c4130bc6d87bf8b05bdd0523 (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 'drivers/infiniband/hw/mlx4/mad.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/mad.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 603a114b3dfe..658a622791fb 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -505,7 +505,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
505 | } else | 505 | } else |
506 | tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0]; | 506 | tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0]; |
507 | 507 | ||
508 | dqpn = dev->dev->caps.sqp_start + 8 * slave + port + (dest_qpt * 2) - 1; | 508 | dqpn = dev->dev->phys_caps.base_proxy_sqpn + 8 * slave + port + (dest_qpt * 2) - 1; |
509 | 509 | ||
510 | /* get tunnel tx data buf for slave */ | 510 | /* get tunnel tx data buf for slave */ |
511 | src_qp = tun_qp->qp; | 511 | src_qp = tun_qp->qp; |
@@ -1074,9 +1074,9 @@ static int mlx4_ib_multiplex_sa_handler(struct ib_device *ibdev, int port, | |||
1074 | 1074 | ||
1075 | static int is_proxy_qp0(struct mlx4_ib_dev *dev, int qpn, int slave) | 1075 | static int is_proxy_qp0(struct mlx4_ib_dev *dev, int qpn, int slave) |
1076 | { | 1076 | { |
1077 | int slave_start = dev->dev->caps.sqp_start + 8 * slave; | 1077 | int proxy_start = dev->dev->phys_caps.base_proxy_sqpn + 8 * slave; |
1078 | 1078 | ||
1079 | return (qpn >= slave_start && qpn <= slave_start + 1); | 1079 | return (qpn >= proxy_start && qpn <= proxy_start + 1); |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | 1082 | ||
@@ -1191,14 +1191,14 @@ static void mlx4_ib_multiplex_mad(struct mlx4_ib_demux_pv_ctx *ctx, struct ib_wc | |||
1191 | int slave; | 1191 | int slave; |
1192 | 1192 | ||
1193 | /* Get slave that sent this packet */ | 1193 | /* Get slave that sent this packet */ |
1194 | if (wc->src_qp < dev->dev->caps.sqp_start || | 1194 | if (wc->src_qp < dev->dev->phys_caps.base_proxy_sqpn || |
1195 | wc->src_qp >= dev->dev->caps.base_tunnel_sqpn || | 1195 | wc->src_qp >= dev->dev->phys_caps.base_proxy_sqpn + 8 * MLX4_MFUNC_MAX || |
1196 | (wc->src_qp & 0x1) != ctx->port - 1 || | 1196 | (wc->src_qp & 0x1) != ctx->port - 1 || |
1197 | wc->src_qp & 0x4) { | 1197 | wc->src_qp & 0x4) { |
1198 | mlx4_ib_warn(ctx->ib_dev, "can't multiplex bad sqp:%d\n", wc->src_qp); | 1198 | mlx4_ib_warn(ctx->ib_dev, "can't multiplex bad sqp:%d\n", wc->src_qp); |
1199 | return; | 1199 | return; |
1200 | } | 1200 | } |
1201 | slave = ((wc->src_qp & ~0x7) - dev->dev->caps.sqp_start) / 8; | 1201 | slave = ((wc->src_qp & ~0x7) - dev->dev->phys_caps.base_proxy_sqpn) / 8; |
1202 | if (slave != ctx->slave) { | 1202 | if (slave != ctx->slave) { |
1203 | mlx4_ib_warn(ctx->ib_dev, "can't multiplex bad sqp:%d: " | 1203 | mlx4_ib_warn(ctx->ib_dev, "can't multiplex bad sqp:%d: " |
1204 | "belongs to another slave\n", wc->src_qp); | 1204 | "belongs to another slave\n", wc->src_qp); |