Commit 29bb33dd authored by Hal Rosenstock's avatar Hal Rosenstock Committed by Linus Torvalds

[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: default avatarSean Hefty <sean.hefty@intel.com>
Signed-off-by: default avatarHal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 03b61ad2
...@@ -1754,14 +1754,18 @@ static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr) ...@@ -1754,14 +1754,18 @@ static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr)
delay = mad_send_wr->timeout; delay = mad_send_wr->timeout;
mad_send_wr->timeout += jiffies; mad_send_wr->timeout += jiffies;
list_for_each_prev(list_item, &mad_agent_priv->wait_list) { if (delay) {
temp_mad_send_wr = list_entry(list_item, list_for_each_prev(list_item, &mad_agent_priv->wait_list) {
struct ib_mad_send_wr_private, temp_mad_send_wr = list_entry(list_item,
agent_list); struct ib_mad_send_wr_private,
if (time_after(mad_send_wr->timeout, agent_list);
temp_mad_send_wr->timeout)) if (time_after(mad_send_wr->timeout,
break; temp_mad_send_wr->timeout))
break;
}
} }
else
list_item = &mad_agent_priv->wait_list;
list_add(&mad_send_wr->agent_list, list_item); list_add(&mad_send_wr->agent_list, list_item);
/* Reschedule a work item if we have a shorter timeout */ /* Reschedule a work item if we have a shorter timeout */
...@@ -2197,7 +2201,8 @@ static void timeout_sends(void *data) ...@@ -2197,7 +2201,8 @@ static void timeout_sends(void *data)
} }
list_del(&mad_send_wr->agent_list); list_del(&mad_send_wr->agent_list);
if (!retry_send(mad_send_wr)) if (mad_send_wr->status == IB_WC_SUCCESS &&
!retry_send(mad_send_wr))
continue; continue;
spin_unlock_irqrestore(&mad_agent_priv->lock, flags); spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment