aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@dev.mellanox.co.il>2013-07-18 07:02:30 -0400
committerRoland Dreier <roland@purestorage.com>2013-07-31 15:22:12 -0400
commit3eac103f83ab0c2013b734981d92d56be51a1a9c (patch)
treee7a5056a642a1d5d272f640dc1c34676691d6c29 /drivers/infiniband
parent3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff)
IB/mlx4: Use default pkey when creating tunnel QPs
When creating tunnel QPs for special QP tunneling, look for the default pkey in the slave's virtual pkey table. If it is present, use the real pkey index where the default pkey is located. If the default pkey is not found in the pkey table, use the real pkey index which is stored at index 0 in the slave's virtual pkey table (this is the current behavior). This change is required to support cloud computing, where the paravirtualized index of the default pkey is moved to index 1 or higher. The pkey at paravirtualized index 0 is used for the default IPoIB interface created by the VF. Its possible for the pkey value at paravirtualized index 0 to be invalid (zero) at VF probe time (pkey index 0 is mapped to real pkey index 127, which contains pkey = 0). At some point after the VF probe, the cloud computing interface at the hypervisor maps virtual index 0 for the VF to the pkey index containing the pkey that IPoIB will use in its operation. However, when the tunnel QP is created, the pkey at the slave's virtual index 0 is still mapped to the invalid pkey index, so tunnel QP creation fails. This commit causes the hypervisor to search for the default pkey in the slave's pkey table -- and this pkey is present in the table (at index > 0) at tunnel QP creation time, so that the tunnel QP creation will succeed. 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 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/mlx4/mad.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 4d599cedbb0b..f2a3f48107e7 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -1511,8 +1511,14 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
1511 1511
1512 memset(&attr, 0, sizeof attr); 1512 memset(&attr, 0, sizeof attr);
1513 attr.qp_state = IB_QPS_INIT; 1513 attr.qp_state = IB_QPS_INIT;
1514 attr.pkey_index = 1514 ret = 0;
1515 to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; 1515 if (create_tun)
1516 ret = find_slave_port_pkey_ix(to_mdev(ctx->ib_dev), ctx->slave,
1517 ctx->port, IB_DEFAULT_PKEY_FULL,
1518 &attr.pkey_index);
1519 if (ret || !create_tun)
1520 attr.pkey_index =
1521 to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0];
1516 attr.qkey = IB_QP1_QKEY; 1522 attr.qkey = IB_QP1_QKEY;
1517 attr.port_num = ctx->port; 1523 attr.port_num = ctx->port;
1518 ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); 1524 ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT);