[openib-general] [PATCH] ib_mad.c: Fix list handling in ib_mad_recv_done_handler

Hal Rosenstock halr at voltaire.com
Tue Sep 28 08:12:23 PDT 2004


ib_mad.c: Fix list handling in ib_mad_recv_done_handler

With this patch, the receive side is working (with no clients
registered) :-)

Index: ib_mad.c
===================================================================
--- ib_mad.c    (revision 896)
+++ ib_mad.c    (working copy)
@@ -706,6 +706,7 @@
 static void ib_mad_recv_done_handler(struct ib_mad_port_private
*port_priv,
                                     struct ib_wc *wc)
 {
+       struct ib_mad_recv_buf *rbuf;
        struct ib_mad_private *recv;
        union ib_mad_recv_wrid wrid;
        unsigned long flags;
@@ -729,10 +730,13 @@
         */
        spin_lock_irqsave(&port_priv->recv_list_lock, flags);
        if (!list_empty(&port_priv->recv_posted_mad_list[qpn])) {
-               recv = list_entry(&port_priv->recv_posted_mad_list[qpn],
-                                 struct ib_mad_private,
-                                 header.recv_buf.list);
-
+               rbuf = list_entry(&port_priv->recv_posted_mad_list[qpn],
+                                struct ib_mad_recv_buf,
+                                list);
+               rbuf = (struct ib_mad_recv_buf *)rbuf->list.next;
+               recv = (struct ib_mad_private *)((char *)rbuf -
+                                                sizeof(struct
ib_mad_recv_wc));
+
                /* Remove from posted receive MAD list */
                list_del(&recv->header.recv_buf.list);
 







More information about the general mailing list