Lock-free encoding and independent svc reply queue.

Implements an out-of-line, blocking reply queue for svc_vc
transports.

It -would- appear logical to add an xdr_ioq_truncate operation
permitting a caller to discard bytes at the end of the stream, if
the need for it arose.

Works, maybe consolidate vrec->off and vrec->len, which now appear the
same.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/clnt_vc.c
	src/svc_vc.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add extend-buffer interface.

As a workaround for current GSS mic and wrap interfaces which
cannot deal with segmented buffers, allow growing a single buffer
segment.

Use this only when auth flavor is RPCSEC_GSS.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Avoid use of uninitialized __rpc_sockinfo.

Moves __rpc2sockinfo call up in makefd_xprt.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix refcnt underruns.

The initial refcnt should be 1, not 0.  Also, must be initialized
in vrec_next, in the non-extend case.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Dont smash the stack in ioq_flushv.

There is no way to assume an iovcnt in advance, but it will be
small.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Use configured sendsize + 8K for ioq max segment size.

Pending support for GSSAPI iov interfaces, svc_vc_reply ecodes
in one buffer segment.  Since most replies are small, an initial
buffer segment of 8K ("page size") is tried first.  If a reply
would exceed this, it is reallocated with a larger size, which
with this change, is of length MaxRPCSendBufferSize + 8K.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove unused VREC_NIOVS.

(Rebaseme.)

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix buffer advance logic, plus refactor vrec_next.

Add missing advance of user-supplied buffer position on
segment advance (xdr_ioq_getbytes, xdr_ioq_putbytes).

Also reorganize vrec_next, which had acquired a special
case in its prologue.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Drain svc_ioq on svc_shutdown().

Waits 1s, then inifinite in 5s increments, for the ioq
to drain.

Also fixes a deadlock condition in svc_xprt_shutdown(),
which called SVC_DESTROY while holding the transport fd
rec locked.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix IOQ_FLAG_REALLOC cases in vrec_next.

The realloc path is taken only when using RPCSEC_GSS protection,
and will be avoided when we have an iovec equivalent to gss_getmic,
or workaround.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add debugging counter to xdr_ioq.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Init rstat.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add svc_ioq_maxbuf svc_init param.

This is used to explicitly set a value for the max xdr_ioq
max segment size.  Previously, the value was taken from the
transport handle, but currently the value is sanitized by
__rpc_get_t_size(), preventing values larger than 256K.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Call authgss_ctx_gc_idle in __svc_clean_idle2.

Actually call the method which trims the GSS context cache
during idle processing.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Adjust EPOLL wake and idle tuning.

This change partially decouples idle processing from EPOLL
timeouts.  The __svc_clean_idle routine is still called on
EPOLL timeout, but the timeout is raised to 120s, pending
future parameterization.

Then a static counter of total wakeups is kept, and idle
processing is secondarily done after 1000 wakeups, pending
future parameterization.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>