[openib-general] [PATCH] user_mad: In send_handler, only return header on timeout
Hal Rosenstock
halr at voltaire.com
Tue Jun 28 13:44:10 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,28 @@
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 + 24, GFP_KERNEL);
+ if (!timeout)
+ goto out;
- if (!queue_packet(file, agent, packet))
- return;
+ memset(timeout, 0, sizeof *timeout + 24);
+
+ timeout->length = 24;
+ timeout->mad.hdr.id = packet->mad.hdr.id;
+ timeout->mad.hdr.status = ETIMEDOUT;
+ memcpy(timeout->mad.data, packet->mad.data, 24);
+
+ if (!queue_packet(file, agent, timeout))
+ return;
}
-
+out:
kfree(packet);
}
More information about the general
mailing list