Skip to content

Commit 29bb33d

Browse files
Hal RosenstockLinus Torvalds
authored andcommitted
[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 <[email protected]> Signed-off-by: Hal Rosenstock <[email protected]> Cc: Roland Dreier <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 03b61ad commit 29bb33d

File tree

1 file changed

+13
-8
lines changed
  • drivers/infiniband/core

1 file changed

+13
-8
lines changed

drivers/infiniband/core/mad.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,14 +1754,18 @@ static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr)
17541754
delay = mad_send_wr->timeout;
17551755
mad_send_wr->timeout += jiffies;
17561756

1757-
list_for_each_prev(list_item, &mad_agent_priv->wait_list) {
1758-
temp_mad_send_wr = list_entry(list_item,
1759-
struct ib_mad_send_wr_private,
1760-
agent_list);
1761-
if (time_after(mad_send_wr->timeout,
1762-
temp_mad_send_wr->timeout))
1763-
break;
1757+
if (delay) {
1758+
list_for_each_prev(list_item, &mad_agent_priv->wait_list) {
1759+
temp_mad_send_wr = list_entry(list_item,
1760+
struct ib_mad_send_wr_private,
1761+
agent_list);
1762+
if (time_after(mad_send_wr->timeout,
1763+
temp_mad_send_wr->timeout))
1764+
break;
1765+
}
17641766
}
1767+
else
1768+
list_item = &mad_agent_priv->wait_list;
17651769
list_add(&mad_send_wr->agent_list, list_item);
17661770

17671771
/* Reschedule a work item if we have a shorter timeout */
@@ -2197,7 +2201,8 @@ static void timeout_sends(void *data)
21972201
}
21982202

21992203
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))
22012206
continue;
22022207

22032208
spin_unlock_irqrestore(&mad_agent_priv->lock, flags);

0 commit comments

Comments
 (0)