The following patch fixes an issue where a response MAD could have been
incorrectly matched with an internally generated RMPP ACK.

Signed-off-by: Sean Hefty <[EMAIL PROTECTED]>

Index: core/mad.c
===================================================================
--- core/mad.c  (revision 2202)
+++ core/mad.c  (working copy)
@@ -1550,6 +1550,18 @@
                return mad_recv_wc;
 }
 
+static int is_data_mad(struct ib_mad_agent_private *mad_agent_priv,
+                      struct ib_mad_hdr *mad_hdr)
+{
+       struct ib_rmpp_mad *rmpp_mad;
+
+       rmpp_mad = (struct ib_rmpp_mad *)mad_hdr;
+       return !mad_agent_priv->agent.rmpp_version ||
+               !(ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
+                                   IB_MGMT_RMPP_FLAG_ACTIVE) ||
+               (rmpp_mad->rmpp_hdr.rmpp_type == IB_MGMT_RMPP_TYPE_DATA);
+}
+
 static struct ib_mad_send_wr_private*
 find_send_req(struct ib_mad_agent_private *mad_agent_priv,
              u64 tid)
@@ -1568,7 +1580,9 @@
         */
        list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list,
                            agent_list) {
-               if (mad_send_wr->tid == tid && mad_send_wr->timeout) {
+               if (is_data_mad(mad_agent_priv,
+                               mad_send_wr->send_wr.wr.ud.mad_hdr) &&
+                   mad_send_wr->tid == tid && mad_send_wr->timeout) {
                        /* Verify request has not been canceled */
                        return (mad_send_wr->status == IB_WC_SUCCESS) ?
                                mad_send_wr : NULL;
@@ -2055,7 +2069,9 @@
 
        list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list,
                            agent_list) {
-               if (mad_send_wr->wr_id == wr_id)
+               if (is_data_mad(mad_agent_priv,
+                               mad_send_wr->send_wr.wr.ud.mad_hdr) &&
+                   mad_send_wr->wr_id == wr_id)
                        return mad_send_wr;
        }
        return NULL;
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to