[openib-general] [PATCH] ib_cancel_mad API
Roland Dreier
roland at topspin.com
Wed Sep 29 11:21:24 PDT 2004
+int ib_cancel_mad(struct ib_mad_agent *mad_agent,
+ u64 wr_id)
Is wr_id enough to identify a sent MAD? I guess this imposes the
requirement that consumers must not use duplicate wr_ids.
+{
+ struct ib_mad_agent_private *mad_agent_priv;
+ struct ib_mad_send_wr_private *mad_send_wr;
+ struct ib_mad_send_wc mad_send_wc;
+ unsigned long flags;
+
+ mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private,
+ agent);
+ spin_lock_irqsave(&mad_agent_priv->send_list_lock, flags);
+ list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list,
+ agent_send_list) {
+ if (mad_send_wr->wr_id == wr_id)
+ goto found;
+ }
+ spin_unlock_irqrestore(&mad_agent_priv->send_list_lock, flags);
+ return -EINVAL;
This is exactly the issue I was talking about last time. Since we
remove the MAD from the send list before calling the consumer's send
handler, it's entirely possible for ib_cancel_mad() to return -EINVAL
with the send handler still running on another CPU ... oops.
- R.
More information about the general
mailing list