[openib-general] [PATCH] ib_mad.c: In ib_free_recv_mad, walk list of buffers to be returned
Hal Rosenstock
halr at voltaire.com
Thu Sep 16 05:46:55 PDT 2004
ib_mad.c: In ib_free_recv_mad, walk list of buffers to be returned
Index: ib_mad.c
===================================================================
--- ib_mad.c (revision 847)
+++ ib_mad.c (working copy)
@@ -365,7 +365,20 @@
*/
void ib_free_recv_mad(struct ib_mad_recv_wc *mad_recv_wc)
{
- kfree(mad_recv_wc); /* RMPP !!! */
+ struct ib_mad_recv_buf *entry;
+ struct ib_mad_private *buffer = (struct ib_mad_private *)mad_recv_wc;
+
+ /*
+ * Walk receive buffer list associated with this WC
+ * No need to remove them from list of receive buffers
+ */
+ list_for_each_entry(entry, &mad_recv_wc->recv_buf->list, list) {
+ /* Free previous receive buffer */
+ kfree(buffer);
+ buffer = (void *)entry - sizeof(struct ib_mad_private_header);
+ }
+ /* Free last buffer */
+ kfree(buffer);
}
EXPORT_SYMBOL(ib_free_recv_mad);
@@ -944,8 +957,7 @@
* This is for both MAD and private header
* which contains the receive tracking structure.
* By prepending this header, there is one rather
- * than multiple memory allocations.
- * Ths will need revisiting for RMPP !!!
+ * than two memory allocations.
*/
mad_priv = kmalloc(sizeof *mad_priv,
(in_atomic() || irqs_disabled()) ?
More information about the general
mailing list