aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/mad.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 7af72d4ae6c8..1d8f26f54ec9 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -1754,14 +1754,18 @@ static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr)
1754 delay = mad_send_wr->timeout; 1754 delay = mad_send_wr->timeout;
1755 mad_send_wr->timeout += jiffies; 1755 mad_send_wr->timeout += jiffies;
1756 1756
1757 list_for_each_prev(list_item, &mad_agent_priv->wait_list) { 1757 if (delay) {
1758 temp_mad_send_wr = list_entry(list_item, 1758 list_for_each_prev(list_item, &mad_agent_priv->wait_list) {
1759 struct ib_mad_send_wr_private, 1759 temp_mad_send_wr = list_entry(list_item,
1760 agent_list); 1760 struct ib_mad_send_wr_private,
1761 if (time_after(mad_send_wr->timeout, 1761 agent_list);
1762 temp_mad_send_wr->timeout)) 1762 if (time_after(mad_send_wr->timeout,
1763 break; 1763 temp_mad_send_wr->timeout))
1764 break;
1765 }
1764 } 1766 }
1767 else
1768 list_item = &mad_agent_priv->wait_list;
1765 list_add(&mad_send_wr->agent_list, list_item); 1769 list_add(&mad_send_wr->agent_list, list_item);
1766 1770
1767 /* Reschedule a work item if we have a shorter timeout */ 1771 /* Reschedule a work item if we have a shorter timeout */
@@ -2197,7 +2201,8 @@ static void timeout_sends(void *data)
2197 } 2201 }
2198 2202
2199 list_del(&mad_send_wr->agent_list); 2203 list_del(&mad_send_wr->agent_list);
2200 if (!retry_send(mad_send_wr)) 2204 if (mad_send_wr->status == IB_WC_SUCCESS &&
2205 !retry_send(mad_send_wr))
2201 continue; 2206 continue;
2202 2207
2203 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2208 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);