ib.c revision b27516f55237249607f754e6e42e865f12456675
/*
* 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 (c) 2006 Oracle. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#include <sys/sysmacros.h>
unsigned int rdsv3_ib_retry_count = RDSV3_IB_DEFAULT_RETRY_COUNT;
struct list rdsv3_ib_devices;
/* NOTE: if also grabbing ibdev lock, grab this first */
void
{
struct rdsv3_ib_device *rds_ibdev;
char name[64];
/* Only handle IB (no iWARP) devices */
return;
if (!dev_attr)
return;
RDSV3_DPRINTF2("rdsv3_ib_add_one",
goto free_attr;
}
/* We depend on Reserved Lkey */
RDSV3_DPRINTF2("rdsv3_ib_add_one",
"Reserved Lkey support is required: %s",
goto free_attr;
}
if (!rds_ibdev)
goto free_attr;
goto free_dev;
if (rdsv3_ib_create_mr_pool(rds_ibdev) != 0) {
goto free_dev;
}
sizeof (struct rdsv3_page_frag), 0, rdsv3_ib_frag_constructor,
RDSV3_DPRINTF2("rdsv3_ib_add_one",
"kmem_cache_create for ib_frag_slab failed for device: %s",
goto free_dev;
}
goto free_attr;
}
void
{
struct rdsv3_ib_device *rds_ibdev;
if (!rds_ibdev)
return;
list) {
}
#if 0
#ifndef __lock_lint
RDSV3_DPRINTF5("rdsv3_ib_remove_one",
"%s-%d Failed to dealloc pd %p",
#endif
}
#else
#ifndef __lock_lint
RDSV3_DPRINTF2("rdsv3_ib_remove_one",
#endif
}
#endif
}
#ifndef __lock_lint
struct ib_client rdsv3_ib_client = {
.name = "rdsv3_ib",
.add = rdsv3_ib_add_one,
};
#else
struct ib_client rdsv3_ib_client = {
"rdsv3_ib",
NULL,
NULL,
};
#endif
static int
void *buffer)
{
struct rdsv3_ib_connection *ic;
/* We will only ever look at IB transports */
return (0);
struct rdsv3_ib_device *rds_ibdev;
struct rdma_dev_addr *dev_addr;
}
return (1);
}
static void
struct rdsv3_info_iterator *iter,
struct rdsv3_info_lengths *lens)
{
sizeof (struct rdsv3_info_rdma_connection));
}
/*
* device with that address set.
*
* If it were me, I'd advocate for something more flexible. Sending and
* receiving should be device-agnostic. Transports would try and maintain
* connections between peers who have messages queued. Userspace would be
* allowed to influence which paths have priority. We could call userspace
* asserting this policy "routing".
*/
static int
{
int ret;
struct rdma_cm_id *cm_id;
struct sockaddr_in sin;
/*
* Create a CMA ID and try to bind it. This catches both
* IB and iWARP capable NICs.
*/
if (!cm_id)
return (-EADDRNOTAVAIL);
/* rdma_bind_addr will only succeed for IB & iWARP devices */
/*
* due to this, we will claim to support iWARP devices unless we
* check node_type.
*/
ret = -EADDRNOTAVAIL;
RDSV3_DPRINTF5("rds_ib_laddr_check",
"addr %u.%u.%u.%u ret %d node type %d",
return (ret);
}
void
rdsv3_ib_exit(void)
{
}
#ifndef __lock_lint
struct rdsv3_transport rdsv3_ib_transport = {
.xmit = rdsv3_ib_xmit,
.xmit_cong_map = NULL,
.recv = rdsv3_ib_recv,
.exit = rdsv3_ib_exit,
.t_name = "infiniband",
};
#else
struct rdsv3_transport rdsv3_ib_transport;
#endif
int
rdsv3_ib_init(void)
{
int ret;
if (ret)
goto out;
ret = rdsv3_ib_sysctl_init();
if (ret)
goto out_ibreg;
ret = rdsv3_ib_recv_init();
if (ret)
goto out_sysctl;
if (ret)
goto out_recv;
return (0);
out:
return (ret);
}