forked from Minki/linux
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>
This commit is contained in:
parent
3b2f64d00c
commit
3eac103f83
@ -1511,8 +1511,14 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
|
||||
|
||||
memset(&attr, 0, sizeof attr);
|
||||
attr.qp_state = IB_QPS_INIT;
|
||||
attr.pkey_index =
|
||||
to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0];
|
||||
ret = 0;
|
||||
if (create_tun)
|
||||
ret = find_slave_port_pkey_ix(to_mdev(ctx->ib_dev), ctx->slave,
|
||||
ctx->port, IB_DEFAULT_PKEY_FULL,
|
||||
&attr.pkey_index);
|
||||
if (ret || !create_tun)
|
||||
attr.pkey_index =
|
||||
to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0];
|
||||
attr.qkey = IB_QP1_QKEY;
|
||||
attr.port_num = ctx->port;
|
||||
ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT);
|
||||
|
Loading…
Reference in New Issue
Block a user