[openib-general] [PATCH] user_mad: In send_handler, only return header on timeout
Hal Rosenstock
halr at voltaire.com
Tue Jun 28 14:13:52 PDT 2005
user_mad: In send_handler, only return header on timeout
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Index: user_mad.c
===================================================================
--- user_mad.c (revision 2731)
+++ user_mad.c (working copy)
@@ -139,19 +139,30 @@
struct ib_mad_send_wc *send_wc)
{
struct ib_umad_file *file = agent->context;
- struct ib_umad_packet *packet =
+ struct ib_umad_packet *timeout, *packet =
(void *) (unsigned long) send_wc->wr_id;
ib_destroy_ah(packet->msg->send_wr.wr.ud.ah);
ib_free_send_mad(packet->msg);
if (send_wc->status == IB_WC_RESP_TIMEOUT_ERR) {
- packet->mad.hdr.status = ETIMEDOUT;
+ timeout = kmalloc(sizeof *timeout + sizeof (struct ib_mad_hdr),
+ GFP_KERNEL);
+ if (!timeout)
+ goto out;
- if (!queue_packet(file, agent, packet))
- return;
+ memset(timeout, 0, sizeof *timeout + sizeof (struct ib_mad_hdr));
+
+ timeout->length = sizeof (struct ib_mad_hdr);
+ timeout->mad.hdr.id = packet->mad.hdr.id;
+ timeout->mad.hdr.status = ETIMEDOUT;
+ memcpy(timeout->mad.data, packet->mad.data,
+ sizeof (struct ib_mad_hdr));
+
+ if (!queue_packet(file, agent, timeout))
+ return;
}
-
+out:
kfree(packet);
}
More information about the general
mailing list