xdr_rdma.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* xdr_rdma.c, XDR implementation using RDMA to move large chunks
*/
#include <rpc/rpc_sztypes.h>
#include <rpc/rpc_rdma.h>
static struct xdr_ops *xdrrdma_ops(void);
/*
* A chunk list entry identifies a chunk
* of opaque data to be moved separately
* from the rest of the RPC message.
* xp_min_chunk = 0, is a special case for ENCODING, which means
* do not chunk the incoming stream of data.
*/
struct private {
int xp_min_chunk;
int xp_buf_size; /* size of xdr buffer */
};
/*
* The procedure xdrrdma_create initializes a stream descriptor for a
* memory buffer.
*/
void
{
/* Find last element in chunk list and set xp_cl_next */
} else
if (xdrp->xp_min_chunk == 0)
}
/* ARGSUSED */
void
{
}
struct clist *
}
static bool_t
{
return (FALSE);
/* LINTED pointer alignment */
return (TRUE);
}
static bool_t
{
return (FALSE);
/* LINTED pointer alignment */
return (TRUE);
}
/*
* DECODE some bytes from an XDR stream
*/
static bool_t
{
/*
* If there was a chunk at the current offset
* first record the destination address and length
* in the chunk list that came with the message, then
* RDMA READ the chunk data.
*/
/*
* RDMA READ the chunk data from the remote end.
* First prep the destination buffer by registering
* it, then RDMA READ the chunk data. Since we are
* doing streaming memory, sync the destination buffer
* to CPU and deregister the buffer.
*/
return (FALSE);
}
return (FALSE);
}
/*
* Now read the chunk in
*/
#ifdef DEBUG
"xdrrdma_getbytes: RDMA_READ failed\n");
#endif
goto out;
}
/*
* sync the memory for cpu
*/
goto out;
}
out:
/*
* Deregister the chunks
*/
return (retval);
}
return (FALSE);
return (TRUE);
}
/*
* ENCODE some bytes into an XDR stream
* xp_min_chunk = 0, means the stream of bytes contain no chunks
* to seperate out, and if the bytes do not fit in the supplied
* buffer, grow the buffer and free the old buffer.
*/
static bool_t
{
/*
* If this chunk meets the minimum chunk size
* then don't encode it. Just record its address
* and length in a chunk list entry so that it
* can be moved separately via RDMA.
*/
KM_SLEEP);
return (TRUE);
}
if (xdrp->xp_min_chunk == 0) {
}
} else
return (FALSE);
}
return (TRUE);
}
{
}
{
return (FALSE);
return (TRUE);
}
/* ARGSUSED */
static rpc_inline_t *
{
/*
* Since chunks aren't in-line, check to see whether
* there is a chunk in the inline range.
*/
return (NULL);
}
return (NULL);
} else {
/* LINTED pointer alignment */
return (buf);
}
}
static bool_t
{
int len;
switch (request) {
case XDR_PEEK:
/*
* Return the next 4 byte unit in the XDR stream.
*/
return (FALSE);
return (TRUE);
case XDR_SKIPBYTES:
/*
* Skip the next N bytes in the XDR stream.
*/
return (FALSE);
return (TRUE);
case XDR_RDMASET:
/*
* Set the flags provided in the *info in xp_flags for rdma xdr
* stream control.
*/
return (TRUE);
case XDR_RDMAGET:
/*
* Get the flags provided in xp_flags return through *info
*/
return (TRUE);
default:
return (FALSE);
}
}
static struct xdr_ops *
xdrrdma_ops(void)
{
}
return (&ops);
}
/*
* Not all fields in struct clist are interesting to the
* RPC over RDMA protocol. Only XDR the interesting fields.
*/
{
return (FALSE);
return (FALSE);
return (FALSE);
return (FALSE);
return (FALSE);
return (TRUE);
}
{
}
{
}