aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorHal Rosenstock <halr@voltaire.com>2005-07-27 14:45:32 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-27 19:26:11 -0400
commit29bb33dd87dbe8db07c2b19df3fb453d999c96de (patch)
treebe4e391cf2c79e618a934a2b0fb9c2bd4a053e6b /drivers/infiniband
parent03b61ad2f29295f019e095d0f490f30a4d678d3f (diff)
[PATCH] IB: Optimize canceling a MAD
Optimize canceling a MAD. - Eliminate searching timeout list in cancel case. - Remove duplicate calls to queue work item. - Eliminate resending a MAD before MAD is completed. 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')
-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);