[openib-general] [PATCH] ib_mad.c: Better implementation of obtaining receive buffer in ib_mad_recv_done_handler
Hal Rosenstock
halr at voltaire.com
Tue Sep 28 10:55:46 PDT 2004
Better implementation of obtaining receive buffer in
ib_mad_recv_done_handler
Index: ib_mad.c
===================================================================
--- ib_mad.c (revision 898)
+++ ib_mad.c (working copy)
@@ -706,6 +707,7 @@
static void ib_mad_recv_done_handler(struct ib_mad_port_private
*port_priv,
struct ib_wc *wc)
{
+ struct ib_mad_private_header *mad_priv_hdr;
struct ib_mad_recv_buf *rbuf;
struct ib_mad_private *recv;
union ib_mad_recv_wrid wrid;
@@ -734,8 +736,8 @@
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));
+ mad_priv_hdr = container_of(rbuf, struct
ib_mad_private_header,
recv_buf);
+ recv = container_of(mad_priv_hdr, struct ib_mad_private,
header)
;
/* Remove from posted receive MAD list */
list_del(&recv->header.recv_buf.list);
More information about the general
mailing list