/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2008, The Ohio State University. All rights reserved.
*
* Portions of this source code is developed by the team members of
* The Ohio State University's Network-Based Computing Laboratory (NBCL),
* headed by Professor Dhabaleswar K. (DK) Panda.
*
* Acknowledgements to contributions from developors:
* Ranjit Noronha: noronha@cse.ohio-state.edu
* Lei Chai : chail@cse.ohio-state.edu
* Weikuan Yu : yuw@cse.ohio-state.edu
*
*/
#include <rpc/rpc_rdma.h>
/*
* Globals
*/
/*
* Statics
*/
/*
* Externs
*/
extern kstat_named_t *rdmarcstat_ptr;
extern uint_t rdmarcstat_ndata;
extern kstat_named_t *rdmarsstat_ptr;
extern uint_t rdmarsstat_ndata;
void rdma_kstat_init();
/*
* RDMATF module registration routine.
* This routine is expected to be called by the init routine in
* the plugin modules.
*/
{
return (RDMA_BADVERS);
}
/*
* Ensure not already registered
*/
mp = &rdma_mod_head;
KNC_STRSIZE) == 0) {
goto announce_hca;
}
return (RDMA_REG_EXIST);
}
}
/*
* New one, create and add to registry
*/
m->r_mod_state = RDMA_MOD_ACTIVE;
*mp = m;
/*
* Start the nfs service on the rdma xprts.
* (this notification mechanism will need to change when we support
* multiple hcas and have support for multiple rdma plugins).
*/
return (RDMA_SUCCESS);
}
/*
* RDMATF module unregistration routine.
* This routine is expected to be called by the fini routine in
* the plugin modules.
*/
{
m = &rdma_mod_head;
while (*m != NULL) {
KNC_STRSIZE) != 0) {
m = &((*m)->r_next);
continue;
}
/*
* Check if any device attached, if so return error
*/
if (mod->rdma_count != 0) {
return (RDMA_FAILED);
}
/*
* Found entry. Mark it inactive.
*/
mmod = *m;
break;
}
rdma_modloaded = 0;
rdma_dev_available = 0;
/*
* Stop the nfs service running on the rdma xprts.
* (this notification mechanism will need to change when we support
* multiple hcas and have support for multiple rdma plugins).
*/
/*
* Not found.
*/
return (RDMA_SUCCESS);
}
struct clist *
clist_alloc(void)
{
return (clp);
}
{
while (cl) {
}
return (len);
}
void
{
break;
}
}
/*
* Creates a new chunk list entry, and
* adds it to the end of a chunk list.
*/
void
{
/* Find the end of the list */
cl = clist_alloc();
if (shandle)
if (dhandle)
}
{
struct clist *c;
int status;
if (c->c_len <= 0)
continue;
switch (dstsrc) {
case CLIST_REG_SOURCE:
&c->c_smemhandle, (void **)&c->c_ssynchandle,
(void *)c->rb_longbuf.rb_private);
break;
case CLIST_REG_DST:
&c->c_dmemhandle, (void **)&c->c_dsynchandle,
(void *)c->rb_longbuf.rb_private);
break;
default:
return (RDMA_INVAL);
}
if (status != RDMA_SUCCESS) {
return (status);
}
}
return (RDMA_SUCCESS);
}
{
struct clist *c;
switch (c->c_regtype) {
case CLIST_REG_SOURCE:
if (c->c_smemhandle.mrc_rmr != 0) {
(void) RDMA_DEREGMEMSYNC(conn,
c->c_smemhandle,
(void *)(uintptr_t)c->c_ssynchandle,
(void *)c->rb_longbuf.rb_private);
c->c_smemhandle.mrc_rmr = 0;
c->c_ssynchandle = NULL;
}
break;
case CLIST_REG_DST:
if (c->c_dmemhandle.mrc_rmr != 0) {
(void) RDMA_DEREGMEMSYNC(conn,
c->c_dmemhandle,
(void *)(uintptr_t)c->c_dsynchandle,
(void *)c->rb_longbuf.rb_private);
c->c_dmemhandle.mrc_rmr = 0;
c->c_dsynchandle = NULL;
}
break;
default:
/* clist unregistered. continue */
break;
}
}
return (RDMA_SUCCESS);
}
{
struct clist *c;
c = cl;
switch (dstsrc) {
case CLIST_REG_SOURCE:
while (c != NULL) {
if (c->c_ssynchandle) {
(void *)(uintptr_t)c->c_ssynchandle,
c->c_len, 0);
if (status != RDMA_SUCCESS)
return (status);
}
c = c->c_next;
}
break;
case CLIST_REG_DST:
while (c != NULL) {
if (c->c_ssynchandle) {
(void *)(uintptr_t)c->c_dsynchandle,
c->c_len, 1);
if (status != RDMA_SUCCESS)
return (status);
}
c = c->c_next;
}
break;
default:
return (RDMA_INVAL);
}
return (RDMA_SUCCESS);
}
/*
* Frees up entries in chunk list
*/
void
{
while (c != NULL) {
c = cl;
}
}
{
return (RDMA_NORESOURCE);
}
clist_free(cl);
return (retval);
}
{
}
{
} else {
clist_free(cl);
}
return (retval);
}
{
}
void
{
return;
}
}
/*
* Caller is holding rdma_modload_lock mutex
*/
int
{
int status;
/*
* Load all available RDMA plugins which right now is only IB plugin.
* If no IB hardware is present, then quit right away.
* ENODEV -- For no device on the system
* EPROTONOSUPPORT -- For module not avilable either due to failure to
* load or some other reason.
*/
rdma_modloaded = 1;
if (ibt_hw_is_present() == 0) {
rdma_dev_available = 0;
return (ENODEV);
}
rdma_dev_available = 1;
return (EPROTONOSUPPORT);
if (status != 0)
return (EPROTONOSUPPORT);
/*
* We will need to reload the plugin module after it was unregistered
* but the resources below need to allocated only the first time.
*/
if (!clist_cache) {
}
return (0);
}
void
rdma_kstat_init(void)
{
/*
* The RDMA framework doesn't know how to deal with Zones, and is
* only available in the global zone.
*/
if (ksp) {
}
if (ksp) {
}
}
rdma_kwait(void)
{
int ret;
/*
* stat back.
*/
if (ret)
else
return (stat);
}