@@ -36,6 +36,7 @@ MODULE_LICENSE("Dual BSD/GPL");
#define CM_DESTROY_ID_WAIT_TIMEOUT 10000 /* msecs */
#define CM_DIRECT_RETRY_CTX ((void *) 1UL)
+#define CM_MAD_TOTAL_TIMEOUT 70000 /* msecs */
static const char * const ibcm_rej_reason_strs[] = {
[IB_CM_REJ_NO_QP] = "no QP",
@@ -279,6 +280,7 @@ static struct ib_mad_send_buf *cm_alloc_msg(struct cm_id_private *cm_id_priv)
struct ib_mad_agent *mad_agent;
struct ib_mad_send_buf *m;
struct ib_ah *ah;
+ int ret;
lockdep_assert_held(&cm_id_priv->lock);
@@ -309,6 +311,17 @@ static struct ib_mad_send_buf *cm_alloc_msg(struct cm_id_private *cm_id_priv)
}
m->ah = ah;
+ m->retries = cm_id_priv->max_cm_retries;
+ ret = ib_set_mad_deadline(m, CM_MAD_TOTAL_TIMEOUT);
+ if (ret) {
+ m = ERR_PTR(ret);
+ ib_free_send_mad(m);
+ rdma_destroy_ah(ah, 0);
+ goto out;
+ }
+
+ refcount_inc(&cm_id_priv->refcount);
+ m->context[0] = cm_id_priv;
out:
spin_unlock(&cm_id_priv->av.port->cm_dev->mad_agent_lock);