aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/mad.c
diff options
context:
space:
mode:
authorHal Rosenstock <halr@voltaire.com>2005-07-27 14:45:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-27 19:26:10 -0400
commitf75b7a5294949cd1b7bc301e3087c7bb78e22520 (patch)
treefaea8070eb47b3526daa32dbb60f405f958e4a7e /drivers/infiniband/core/mad.c
parentdf9f9ead746e9607099d7024f312133944173609 (diff)
[PATCH] IB: Add automatic retries to MAD layer
Add automatic retries to MAD layer. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Hal Rosenstock <halr@voltaire.com> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/core/mad.c')
-rw-r--r--drivers/infiniband/core/mad.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 430a6ee8987..04f88d33738 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -954,7 +954,7 @@ int ib_post_send_mad(struct ib_mad_agent *mad_agent,
954 /* Timeout will be updated after send completes */ 954 /* Timeout will be updated after send completes */
955 mad_send_wr->timeout = msecs_to_jiffies(send_wr->wr. 955 mad_send_wr->timeout = msecs_to_jiffies(send_wr->wr.
956 ud.timeout_ms); 956 ud.timeout_ms);
957 mad_send_wr->retry = 0; 957 mad_send_wr->retries = mad_send_wr->send_wr.wr.ud.retries;
958 /* One reference for each work request to QP + response */ 958 /* One reference for each work request to QP + response */
959 mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0); 959 mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0);
960 mad_send_wr->status = IB_WC_SUCCESS; 960 mad_send_wr->status = IB_WC_SUCCESS;
@@ -2174,6 +2174,27 @@ local_send_completion:
2174 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2174 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2175} 2175}
2176 2176
2177static int retry_send(struct ib_mad_send_wr_private *mad_send_wr)
2178{
2179 int ret;
2180
2181 if (!mad_send_wr->retries--)
2182 return -ETIMEDOUT;
2183
2184 mad_send_wr->timeout = msecs_to_jiffies(mad_send_wr->send_wr.
2185 wr.ud.timeout_ms);
2186
2187 ret = ib_send_mad(mad_send_wr);
2188
2189 if (!ret) {
2190 mad_send_wr->refcount++;
2191 list_del(&mad_send_wr->agent_list);
2192 list_add_tail(&mad_send_wr->agent_list,
2193 &mad_send_wr->mad_agent_priv->send_list);
2194 }
2195 return ret;
2196}
2197
2177static void timeout_sends(void *data) 2198static void timeout_sends(void *data)
2178{ 2199{
2179 struct ib_mad_agent_private *mad_agent_priv; 2200 struct ib_mad_agent_private *mad_agent_priv;
@@ -2202,6 +2223,9 @@ static void timeout_sends(void *data)
2202 break; 2223 break;
2203 } 2224 }
2204 2225
2226 if (!retry_send(mad_send_wr))
2227 continue;
2228
2205 list_del(&mad_send_wr->agent_list); 2229 list_del(&mad_send_wr->agent_list);
2206 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2230 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2207 2231