diff options
author | Sean Hefty <sean.hefty@intel.com> | 2012-10-03 19:42:31 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-10-04 22:11:54 -0400 |
commit | 4ede178a5eb55fe70070fcd0960b58ba6a5643a8 (patch) | |
tree | c36266c019b688418ddbfe2e927a37a8c0a661f9 /drivers/infiniband | |
parent | 7a9a2970b5c1c2ce73d4bb84edaa7ebf13e0c841 (diff) |
RDMA/cma: Check that retry count values are in range
The retry_count and rnr_retry_count connection parameters are both
3-bit values. Check that the values are in range and reduce if
they're not.
This fixes a problem reported by Doug Ledford <dledford@redhat.com>
that resulted in the userspace rping test (part of the librdmacm
samples) failing to run over Intel IB HCAs.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
[ Use min_t() to avoid warnings about type mismatch. - Roland ]
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/cma.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 26b37603dcf1..1983adc19243 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -2648,8 +2648,8 @@ static int cma_connect_ib(struct rdma_id_private *id_priv, | |||
2648 | req.responder_resources = conn_param->responder_resources; | 2648 | req.responder_resources = conn_param->responder_resources; |
2649 | req.initiator_depth = conn_param->initiator_depth; | 2649 | req.initiator_depth = conn_param->initiator_depth; |
2650 | req.flow_control = conn_param->flow_control; | 2650 | req.flow_control = conn_param->flow_control; |
2651 | req.retry_count = conn_param->retry_count; | 2651 | req.retry_count = min_t(u8, 7, conn_param->retry_count); |
2652 | req.rnr_retry_count = conn_param->rnr_retry_count; | 2652 | req.rnr_retry_count = min_t(u8, 7, conn_param->rnr_retry_count); |
2653 | req.remote_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT; | 2653 | req.remote_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT; |
2654 | req.local_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT; | 2654 | req.local_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT; |
2655 | req.max_cm_retries = CMA_MAX_CM_RETRIES; | 2655 | req.max_cm_retries = CMA_MAX_CM_RETRIES; |
@@ -2770,7 +2770,7 @@ static int cma_accept_ib(struct rdma_id_private *id_priv, | |||
2770 | rep.initiator_depth = conn_param->initiator_depth; | 2770 | rep.initiator_depth = conn_param->initiator_depth; |
2771 | rep.failover_accepted = 0; | 2771 | rep.failover_accepted = 0; |
2772 | rep.flow_control = conn_param->flow_control; | 2772 | rep.flow_control = conn_param->flow_control; |
2773 | rep.rnr_retry_count = conn_param->rnr_retry_count; | 2773 | rep.rnr_retry_count = min_t(u8, 7, conn_param->rnr_retry_count); |
2774 | rep.srq = id_priv->srq ? 1 : 0; | 2774 | rep.srq = id_priv->srq ? 1 : 0; |
2775 | 2775 | ||
2776 | ret = ib_send_cm_rep(id_priv->cm_id.ib, &rep); | 2776 | ret = ib_send_cm_rep(id_priv->cm_id.ib, &rep); |