IB/mlx5: Add block multicast loopback support
authorEli Cohen <eli@dev.mellanox.co.il>
Tue, 1 Apr 2014 21:10:16 +0000 (00:10 +0300)
committerRoland Dreier <roland@purestorage.com>
Fri, 11 Apr 2014 01:43:32 +0000 (18:43 -0700)
Add support for the block multicast loopback QP creation flag along
the proper firmware API for that.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/qp.c
include/linux/mlx5/device.h
include/linux/mlx5/qp.h

index fa6dc870adae54cafd2e3925aaf9359b396942b4..364d4b6937f519af3c9d347fec12ae397d0b4fba 100644 (file)
@@ -282,6 +282,8 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
                props->sig_guard_cap = IB_GUARD_T10DIF_CRC |
                                       IB_GUARD_T10DIF_CSUM;
        }
+       if (flags & MLX5_DEV_CAP_FLAG_BLOCK_MCAST)
+               props->device_cap_flags |= IB_DEVICE_BLOCK_MULTICAST_LOOPBACK;
 
        props->vendor_id           = be32_to_cpup((__be32 *)(out_mad->data + 36)) &
                0xffffff;
index ae788d27b93f51de73e869b728f7ce0ba16d586f..dc930ed21eca66c17114ce27a79f2a6b7d7e0170 100644 (file)
@@ -807,6 +807,15 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
        spin_lock_init(&qp->sq.lock);
        spin_lock_init(&qp->rq.lock);
 
+       if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) {
+               if (!(dev->mdev.caps.flags & MLX5_DEV_CAP_FLAG_BLOCK_MCAST)) {
+                       mlx5_ib_dbg(dev, "block multicast loopback isn't supported\n");
+                       return -EINVAL;
+               } else {
+                       qp->flags |= MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK;
+               }
+       }
+
        if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR)
                qp->sq_signal_bits = MLX5_WQE_CTRL_CQ_UPDATE;
 
@@ -878,6 +887,9 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
        if (qp->wq_sig)
                in->ctx.flags_pd |= cpu_to_be32(MLX5_QP_ENABLE_SIG);
 
+       if (qp->flags & MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK)
+               in->ctx.flags_pd |= cpu_to_be32(MLX5_QP_BLOCK_MCAST);
+
        if (qp->scat_cqe && is_connected(init_attr->qp_type)) {
                int rcqe_sz;
                int scqe_sz;
index 407bdb67fd4f809ac1cc53d5db0de47b901d2424..3406cfb1267a9bbf5bd9cb2294309535e5d74eee 100644 (file)
@@ -179,6 +179,7 @@ enum {
        MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL <<  9,
        MLX5_DEV_CAP_FLAG_APM           = 1LL << 17,
        MLX5_DEV_CAP_FLAG_ATOMIC        = 1LL << 18,
+       MLX5_DEV_CAP_FLAG_BLOCK_MCAST   = 1LL << 23,
        MLX5_DEV_CAP_FLAG_ON_DMND_PG    = 1LL << 24,
        MLX5_DEV_CAP_FLAG_CQ_MODER      = 1LL << 29,
        MLX5_DEV_CAP_FLAG_RESIZE_CQ     = 1LL << 30,
index f829ad80ff28fc38883025c4e06c4247ba908edd..9709b30e2d690da604336a48f96d3757bb7d25c5 100644 (file)
@@ -146,6 +146,7 @@ enum {
 
 enum {
        MLX5_QP_LAT_SENSITIVE   = 1 << 28,
+       MLX5_QP_BLOCK_MCAST     = 1 << 30,
        MLX5_QP_ENABLE_SIG      = 1 << 31,
 };