/*
*/
/*
* This file contains code imported from the OFED rds source file ib.c
* Oracle elects to have and use the contents of ib.c under and governed
* by the OpenIB.org BSD license (see below for full license text). However,
* the following notice accompanied the original version of this file:
*/
/*
* 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>
/* NOTE: if also grabbing ibdev lock, grab this first */
void
{
/* 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;
}
if (rdsv3_ib_create_inc_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_dev;
}
goto free_dev;
}
goto free_dev;
}
goto free_attr;
}
void
{
if (!rds_ibdev)
return;
list) {
}
if (rds_ibdev->fmr_soft_cq)
if (rds_ibdev->inc_soft_cq)
#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
.name = "rdsv3_ib",
.add = rdsv3_ib_add_one,
};
#else
"rdsv3_ib",
NULL,
NULL,
};
#endif
static int
void *buffer)
{
/* We will only ever look at IB transports */
return (0);
}
return (1);
}
static void
struct rdsv3_info_iterator *iter,
struct rdsv3_info_lengths *lens)
{
sizeof (struct rds_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;
/*
* 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)
{
nr_cpus * sizeof (struct rdsv3_ib_statistics));
}
#ifndef __lock_lint
.xmit = rdsv3_ib_xmit,
.xmit_cong_map = NULL,
.recv = rdsv3_ib_recv,
.exit = rdsv3_ib_exit,
.t_name = "infiniband",
};
#else
#endif
int
rdsv3_ib_init(void)
{
int ret;
/* allocate space for ib statistics */
sizeof (struct rdsv3_ib_statistics), KM_SLEEP);
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:
nr_cpus * sizeof (struct rdsv3_ib_statistics));
return (ret);
}