Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
[cascardo/linux.git] / drivers / infiniband / hw / hfi1 / verbs.c
index d502ba0..4b7a16c 100644 (file)
@@ -76,7 +76,7 @@ static unsigned int hfi1_max_ahs = 0xFFFF;
 module_param_named(max_ahs, hfi1_max_ahs, uint, S_IRUGO);
 MODULE_PARM_DESC(max_ahs, "Maximum number of address handles to support");
 
-unsigned int hfi1_max_cqes = 0x2FFFF;
+unsigned int hfi1_max_cqes = 0x2FFFFF;
 module_param_named(max_cqes, hfi1_max_cqes, uint, S_IRUGO);
 MODULE_PARM_DESC(max_cqes,
                 "Maximum number of completion queue entries to support");
@@ -89,7 +89,7 @@ unsigned int hfi1_max_qp_wrs = 0x3FFF;
 module_param_named(max_qp_wrs, hfi1_max_qp_wrs, uint, S_IRUGO);
 MODULE_PARM_DESC(max_qp_wrs, "Maximum number of QP WRs to support");
 
-unsigned int hfi1_max_qps = 16384;
+unsigned int hfi1_max_qps = 32768;
 module_param_named(max_qps, hfi1_max_qps, uint, S_IRUGO);
 MODULE_PARM_DESC(max_qps, "Maximum number of QPs to support");
 
@@ -335,7 +335,7 @@ const u8 hdr_len_by_opcode[256] = {
        [IB_OPCODE_RC_RDMA_READ_RESPONSE_LAST]        = 12 + 8 + 4,
        [IB_OPCODE_RC_RDMA_READ_RESPONSE_ONLY]        = 12 + 8 + 4,
        [IB_OPCODE_RC_ACKNOWLEDGE]                    = 12 + 8 + 4,
-       [IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE]             = 12 + 8 + 4,
+       [IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE]             = 12 + 8 + 4 + 8,
        [IB_OPCODE_RC_COMPARE_SWAP]                   = 12 + 8 + 28,
        [IB_OPCODE_RC_FETCH_ADD]                      = 12 + 8 + 28,
        [IB_OPCODE_RC_SEND_LAST_WITH_INVALIDATE]      = 12 + 8 + 4,
@@ -403,6 +403,28 @@ static const opcode_handler opcode_handler_tbl[256] = {
        [IB_OPCODE_CNP]                               = &hfi1_cnp_rcv
 };
 
+#define OPMASK 0x1f
+
+static const u32 pio_opmask[BIT(3)] = {
+       /* RC */
+       [IB_OPCODE_RC >> 5] =
+               BIT(RC_OP(SEND_ONLY) & OPMASK) |
+               BIT(RC_OP(SEND_ONLY_WITH_IMMEDIATE) & OPMASK) |
+               BIT(RC_OP(RDMA_WRITE_ONLY) & OPMASK) |
+               BIT(RC_OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE) & OPMASK) |
+               BIT(RC_OP(RDMA_READ_REQUEST) & OPMASK) |
+               BIT(RC_OP(ACKNOWLEDGE) & OPMASK) |
+               BIT(RC_OP(ATOMIC_ACKNOWLEDGE) & OPMASK) |
+               BIT(RC_OP(COMPARE_SWAP) & OPMASK) |
+               BIT(RC_OP(FETCH_ADD) & OPMASK),
+       /* UC */
+       [IB_OPCODE_UC >> 5] =
+               BIT(UC_OP(SEND_ONLY) & OPMASK) |
+               BIT(UC_OP(SEND_ONLY_WITH_IMMEDIATE) & OPMASK) |
+               BIT(UC_OP(RDMA_WRITE_ONLY) & OPMASK) |
+               BIT(UC_OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE) & OPMASK),
+};
+
 /*
  * System image GUID.
  */
@@ -1210,22 +1232,18 @@ static inline send_routine get_send_routine(struct rvt_qp *qp,
        case IB_QPT_GSI:
        case IB_QPT_UD:
                break;
-       case IB_QPT_RC:
-               if (piothreshold &&
-                   qp->s_cur_size <= min(piothreshold, qp->pmtu) &&
-                   (BIT(get_opcode(h) & 0x1f) & rc_only_opcode) &&
-                   iowait_sdma_pending(&priv->s_iowait) == 0 &&
-                   !sdma_txreq_built(&tx->txreq))
-                       return dd->process_pio_send;
-               break;
        case IB_QPT_UC:
+       case IB_QPT_RC: {
+               u8 op = get_opcode(h);
+
                if (piothreshold &&
                    qp->s_cur_size <= min(piothreshold, qp->pmtu) &&
-                   (BIT(get_opcode(h) & 0x1f) & uc_only_opcode) &&
+                   (BIT(op & OPMASK) & pio_opmask[op >> 5]) &&
                    iowait_sdma_pending(&priv->s_iowait) == 0 &&
                    !sdma_txreq_built(&tx->txreq))
                        return dd->process_pio_send;
                break;
+       }
        default:
                break;
        }
@@ -1423,7 +1441,8 @@ static int modify_device(struct ib_device *device,
        }
 
        if (device_modify_mask & IB_DEVICE_MODIFY_NODE_DESC) {
-               memcpy(device->node_desc, device_modify->node_desc, 64);
+               memcpy(device->node_desc, device_modify->node_desc,
+                      IB_DEVICE_NODE_DESC_MAX);
                for (i = 0; i < dd->num_pports; i++) {
                        struct hfi1_ibport *ibp = &dd->pport[i].ibport_data;