[openib-general] Re: Some more ucm questions

Libor Michalek libor at topspin.com
Tue Jun 14 10:00:43 PDT 2005


On Tue, Jun 14, 2005 at 11:28:01AM -0400, Hal Rosenstock wrote:
> Hi Libor,
> 
> In the ucm kernel module, in the routine ib_ucm_event, after the user:
> label, if various errors occur relating to copying back to userspace,
> all that is currently done is that the mutex is released and the result
> returned. Doesn't there need to be more cleanup here depending on which
> error occured ? (Won't the event be left at the beginning of the list
> and the ucm would never get past this in terms of any other events ?)

  The thinking was that the problem in all those ib_ucm_event error
cases is not with the event itself, but how the user is using the
interface. If the user does not correct the problem, the next event
will have the exact same error, so deleting the current event would
not solve the issue. This also gives the user a chance to recover
without loosing anything. Since there is a wrapper library for the
user interface, and the user is not expected to use the file
descriptor directly, I would not expect these errors in normal
operation, but only during debug when changes are made to the interface
library itself.

> Also, should there be a declaration ib_cm_event_get_timed be in the user
> space include file ?

  You are correct, I'll commit the following.

-Libor

Index: userspace/libibcm/include/infiniband/cm.h
===================================================================
--- userspace/libibcm/include/infiniband/cm.h	(revision 2576)
+++ userspace/libibcm/include/infiniband/cm.h	(working copy)
@@ -244,6 +244,17 @@
  * to a user's existing communication identifier.
  */
 int ib_cm_event_get(struct ib_cm_event **event);
+/*
+ * ib_cm_event_get_timed - Retrieves the next pending communications event,
+ *   if no event is pending wait up to a certain timeout for an event.
+ * @timeout_ms: Maximum time in milliseconds to wait for an event.
+ * @event: Allocated information about the next communication event.
+ *    Event should be freed using ib_cm_event_put()
+ *
+ * If timeout expires without an event, the error -ETIMEDOUT will be
+ * returned
+ */
+int ib_cm_event_get_timed(int timeout_ms, struct ib_cm_event **event);
 
 /**
  * ib_cm_event_put - Free a communications event.



More information about the general mailing list