common/rbuf: Handle ring buffer wrapping

Handle when the ring buffer wraps for reads and writes.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
common: Add write commit capability to ring buffer

The ring buffer requires that all data to be added
to a ring buffer be written with a single call.  As soon as
the data is written, a reader may extract it.  This behavior
can result in a caller needing to stage its data into a
temporary buffer until the write can be issued.

Instead, allow multiple writes to occur to the ring buffer
with a commit call being used to indicate that the newly
inserted data is now safe for reading.  This avoids the need
to use a temporary buffer, with the ring buffer updated directly.

Add an abort call for good measure.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
common: Add const to ringbuf write calls

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
prov/sockets: Implement transmit context

A transmit context is an abstraction over a ring buffer, with
the ability to wait on an fd if the ring buffer is empty, until
an item is inserted into it.

Items are inserted into the transmit context when a data transfer
is initiated by the application.  The progress engine pulls
operations from the transmit context for processing.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
prov/psm: document the assumption on the "event_in" parameter.

This parameter was added to the event creation routine to allow
the event being written to the user buffer directly, bypassing
the steps of allocating/enqueuing/dequeuing a new event. The user
buffer only has space for the CQ entry of the current CQ format.
Any provider provate information should not be written to it.

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
prov/psm: implement cq_writeerr

Also allow writing multiple events with cq_write.

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
prov/psm: finish 'len' to 'count' conversion of CQ read functions

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
prov/psm: add count to event queue to support read threadhold

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
prov/psm: allow returning multiple events in a single CQ read call

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
Merge pull request #233 from shefty/master

base socket provider TX context implementation
Makefile.am: fix "make dist"

Several files were renamed in 15352c63c239af1aad43f551123facf49448efe7
without also fixing their entries in Makefile.am.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Makefile.am: clean out EXTRA_DIST

Several header files were listed in EXTRA_DIST.  Moved them all to
their corresponding _SOURCES macros.  This keeps core/provider header
files in their own distinct sections (vs. glumping .h files from
different providers in EXTRA_DIST).  The sockets .h file was already
listed in its _SOURCES macro.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Merge pull request #235 from jsquyres/pr/fix-make-dist

2 fixes for "make dist"
dist: substitute ```@VERSION@``` and ```@DATE@``` tokens

During "make dist", iterate through README and all the man pages
substituting ```@VERSION@``` with the current version number and
```@DATE@``` with today's date (in the form YYYY-MM-DD).

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
README: Add ```@VERSION@``` and ```@DATE@``` tokens.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
man: add ```@VERSION@``` and ```@DATE@``` tokens to all man pages

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
man: fi_cntr_wait, fi_cq_sread clarify timeout

When these calls return due to timeout, they should return a
specific value, vs. a generic error. This indicates to the app
that it doesn't have to read the error queue.

Signed-off-by: Sayantan Sur <sayantan.sur@intel.com>
Merge pull request #237 from sayantansur/fi-cntr-wait-timeout

man: fi_cntr_wait, fi_cq_sread clarify timeout
Merge pull request #236 from jsquyres/pr/dist-man-pages

Have "make dist" seed the README and man pages with today's date and the version
man: mention CQs in fi_endpoint(3)

The fi_endpoint man page wasn't distinguishing between CQs and EQs
per our recent change. The data transfer completions now appear in
CQs not EQs. Passive endpoints need EQs, but not active endpoints.

Signed-off-by: Sayantan Sur <sayantan.sur@intel.com>