linux/include/rdma
Roland Dreier ed23a72778 IB: Return "maybe missed event" hint from ib_req_notify_cq()
The semantics defined by the InfiniBand specification say that
completion events are only generated when a completions is added to a
completion queue (CQ) after completion notification is requested.  In
other words, this means that the following race is possible:

	while (CQ is not empty)
		ib_poll_cq(CQ);
	// new completion is added after while loop is exited
	ib_req_notify_cq(CQ);
	// no event is generated for the existing completion

To close this race, the IB spec recommends doing another poll of the
CQ after requesting notification.

However, it is not always possible to arrange code this way (for
example, we have found that NAPI for IPoIB cannot poll after
requesting notification).  Also, some hardware (eg Mellanox HCAs)
actually will generate an event for completions added before the call
to ib_req_notify_cq() -- which is allowed by the spec, since there's
no way for any upper-layer consumer to know exactly when a completion
was really added -- so the extra poll of the CQ is just a waste.

Motivated by this, we add a new flag "IB_CQ_REPORT_MISSED_EVENTS" for
ib_req_notify_cq() so that it can return a hint about whether the a
completion may have been added before the request for notification.
The return value of ib_req_notify_cq() is extended so:

	 < 0	means an error occurred while requesting notification
	== 0	means notification was requested successfully, and if
		IB_CQ_REPORT_MISSED_EVENTS was passed in, then no
		events were missed and it is safe to wait for another
		event.
	 > 0	is only returned if IB_CQ_REPORT_MISSED_EVENTS was
		passed in.  It means that the consumer must poll the
		CQ again to make sure it is empty to avoid the race
		described above.

We add a flag to enable this behavior rather than turning it on
unconditionally, because checking for missed events may incur
significant overhead for some low-level drivers, and consumers that
don't care about the results of this test shouldn't be forced to pay
for the test.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2007-05-06 21:18:11 -07:00
..
ib_addr.h IB/sa: Track multicast join/leave requests 2007-02-16 14:20:02 -08:00
ib_cache.h IB: Add caching of ports' LMC 2006-06-17 20:37:34 -07:00
ib_cm.h IB/cm: Fix automatic path migration support 2006-11-29 15:33:10 -08:00
ib_fmr_pool.h [PATCH] fmr pool: remove unnecessary pointer dereference 2006-07-14 21:53:51 -07:00
ib_mad.h IB/mad: Validate MADs for spec compliance 2006-07-24 09:18:07 -07:00
ib_marshall.h RDMA/cma: Export rdma cm interface to userspace 2006-12-12 11:50:22 -08:00
ib_pack.h [PATCH] IB: move include files to include/rdma 2005-08-26 20:37:38 -07:00
ib_sa.h IB/sa: Track multicast join/leave requests 2007-02-16 14:20:02 -08:00
ib_smi.h IB: Move struct port_info from ipath to <rdma/ib_smi.h> 2006-06-17 20:37:36 -07:00
ib_user_cm.h IB/cm: Fix automatic path migration support 2006-11-29 15:33:10 -08:00
ib_user_mad.h IB: Make sure struct ib_user_mad.data is aligned 2007-02-04 14:11:56 -08:00
ib_user_sa.h IB: common handling for marshalling parameters to/from userspace 2006-06-17 20:37:27 -07:00
ib_user_verbs.h IB/uverbs: Return sq_draining value in query_qp response 2006-10-30 21:19:35 -08:00
ib_verbs.h IB: Return "maybe missed event" hint from ib_req_notify_cq() 2007-05-06 21:18:11 -07:00
iw_cm.h RDMA: iWARP Connection Manager. 2006-09-22 15:22:46 -07:00
Kbuild [HEADERS] One line per header in Kbuild files to reduce conflicts 2006-09-19 12:43:58 +01:00
rdma_cm_ib.h RDMA/cma: Add multicast communication support 2007-02-16 14:29:07 -08:00
rdma_cm.h RDMA/cma: Add multicast communication support 2007-02-16 14:29:07 -08:00
rdma_user_cm.h RDMA/cma: Add multicast communication support 2007-02-16 14:29:07 -08:00