[openib-general] [PATCH] ib_mad: In ib_mad_complete_recv, use atomic_dec_and_test and wait_event rather than just atomic_dec for RMPP segments and when solicited and there is no matching request found
Hal Rosenstock
Mon Oct 25 11:57:20 PDT 2004
ib_mad: In ib_mad_complete_recv, use atomic_dec_and_test and wait_event
rather than just atomic_dec for RMPP segments and when solicited and
there is no matching request found.
Index: ib_mad.c
===================================================================
--- ib_mad.c (revision 1062)
+++ ib_mad.c (working copy)
@@ -875,7 +875,8 @@
/* Fully reassemble receive before processing */
recv = reassemble_recv(mad_agent_priv, recv);
if (!recv) {
- atomic_dec(&mad_agent_priv->refcount);
+ if (atomic_dec_and_test(&mad_agent_priv->refcount))
+ wake_up(&mad_agent_priv->wait);
return;
}
@@ -887,7 +888,8 @@
if (!mad_send_wr) {
spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
ib_free_recv_mad(&recv->header.recv_wc);
- atomic_dec(&mad_agent_priv->refcount);
+ if (atomic_dec_and_test(&mad_agent_priv->refcount))
+ wake_up(&mad_agent_priv->wait);
return;
}
/* Timeout = 0 means that we won't wait for a response */
More information about the openib-general mailing list