/*
*/
/*
* This file contains code imported from the OFED rds source file connection.c
* Oracle elects to have and use the contents of connection.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.
*
*/
/* converting this to RCU is a chore for another day.. */
if (test) \
} while (0)
static struct rdsv3_connection *
{
RDSV3_DPRINTF5("rdsv3_conn_lookup",
"returning conn %p for %u.%u.%u.%u -> %u.%u.%u.%u",
return (conn);
}
/*
* This is called by transports as they're bringing down a connection.
* It clears partial message state so that the transport can start sending
* and receiving over this connection again in the future. It is up to
* the transport to have serialized this call with its send and recv.
*/
void
{
RDSV3_DPRINTF2("rdsv3_conn_reset",
"connection %u.%u.%u.%u to %u.%u.%u.%u reset",
/*
* Do not clear next_rx_seq here, else we cannot distinguish
* retransmitted packets from new packets, and will hand all
* of them to the application. That is not consistent with the
* reliability guarantees of RDS.
*/
}
/*
* There is only every one 'conn' for a given pair of addresses in the
* system at a time. They contain messages to be retransmitted and so
* span the lifetime of the actual underlying transport connections.
*
* For now they are not garbage collected once they're created. They
* are torn down as the module is removed, if ever.
*/
static struct rdsv3_connection *
{
int ret;
if (conn &&
conn->c_loopback &&
!is_outgoing) {
/*
* This is a looped back IB connection, and we're
* called by the code handling the incoming connect.
* We need a second connection object into which we
* can stick the other QP.
*/
}
if (conn)
goto out;
if (!conn) {
goto out;
}
/* see rdsv3_conn_constructor */
/*
* We don't allow sockets to send messages without binding.
* So, the IP address will already be there in the bind array.
* Mostly, this is a readonly operation.
* For now, passing GLOBAL_ZONEID.
*/
if (ret) {
goto out;
}
/*
* This is where a connection becomes loopback. If *any* RDS sockets
* can bind to the destination address then we'd rather the messages
* flow through loopback rather than either transport.
*/
if (rdsv3_trans_get_preferred(faddr)) {
/*
* "outgoing" connection - and the transport
* says it wants the connection handled by the
* loopback transport. This is what TCP does.
*/
}
}
if (ret) {
goto out;
}
conn->c_reconnect_jiffies = 0;
RDSV3_DPRINTF2("__rdsv3_conn_create",
"allocated conn %p for %u.%u.%u.%u -> %u.%u.%u.%u over %s %s",
/*
* Since we ran without holding the conn lock, someone could
* have created the same conn (either normal or passive) in the
* interim. We check while holding the lock. If we won, we complete
* init and return our conn. If we lost, we rollback and return the
* other one.
*/
if (parent) {
/* Creating passive conn */
} else {
}
} else {
/* Creating normal conn */
if (found) {
} else {
}
}
out:
return (conn);
}
struct rdsv3_connection *
{
}
struct rdsv3_connection *
{
}
extern struct avl_tree rdsv3_conn_hash;
void
{
/* shut it down unless it's down already */
/*
* Quiesce the connection mgmt handlers before we start tearing
* things down. We don't hold the mutex for the entire
* duration of the shutdown operation, else we may be
* deadlocking with the CM handler. Instead, the CM event
* handler is supposed to check for state DISCONNECTING
*/
RDSV3_DPRINTF2("rdsv3_conn_shutdown",
"shutdown called in state %d",
return;
}
/* verify everybody's out of rds_send_xmit() */
delay(1);
}
RDSV3_CONN_DOWN)) {
/*
* This can happen - eg when we're in the middle of
* tearing down the connection, and someone unloads
* the rds module.
* Quite reproduceable with loopback connections.
* Mostly harmless.
*/
#ifndef __lock_lint
RDSV3_DPRINTF2("rdsv3_conn_shutdown",
"failed to transition to state DOWN, "
"current statis is: %d",
#endif
return;
}
}
/*
* Then reconnect if it's still live.
* The passive side of an IB loopback connection is never added
* to the conn hash, so we never trigger a reconnect on this
* conn - the reconnect is always triggered by the active peer.
*/
{
}
}
/*
* Stop and free a connection.
*/
void
{
RDSV3_DPRINTF4("rdsv3_conn_destroy",
"freeing conn %p for %u.%u.%u.%u -> %u.%u.%u.%u",
/* tear down queued messages */
}
m_conn_item) {
}
}
/*
* The congestion maps aren't freed up here. They're
* freed by rdsv3_cong_exit() after all the connections
* have been freed.
*/
}
/* ARGSUSED */
static void
struct rdsv3_info_iterator *iter,
struct rdsv3_info_lengths *lens,
int want_send)
{
unsigned int total = 0;
len /= sizeof (struct rds_info_message);
if (avl_is_empty(&rdsv3_conn_hash)) {
/* no connections */
return;
}
do {
if (want_send)
else
/* XXX too lazy to maintain counts.. */
total++;
}
}
static void
struct rdsv3_info_iterator *iter,
struct rdsv3_info_lengths *lens)
{
}
static void
unsigned int len,
struct rdsv3_info_iterator *iter,
struct rdsv3_info_lengths *lens)
{
}
/* ARGSUSED */
void
struct rdsv3_info_iterator *iter,
struct rdsv3_info_lengths *lens,
int (*visitor)(struct rdsv3_connection *, void *),
{
if (avl_is_empty(&rdsv3_conn_hash)) {
/* no connections */
return;
}
/* allocate a little extra as this can get cast to a uint64_t */
do {
/* XXX no c_lock usage.. */
/*
* We copy as much as we can fit in the buffer,
* but we count all items so that the caller
* can resize the buffer.
*/
RDSV3_DPRINTF4("rdsv3_for_each_conn_info",
"buffer: %p iter: %p bytes: %d", buffer,
}
}
}
static int
{
/* XXX Future: return the state rather than these funky bits */
return (1);
}
static void
{
rdsv3_conn_info_visitor, sizeof (struct rds_info_connection));
}
int
{
sizeof (struct rdsv3_connection), 0, rdsv3_conn_constructor,
if (!rdsv3_conn_slab) {
RDSV3_DPRINTF2("rdsv3_conn_init",
"kmem_cache_create(rdsv3_conn_slab) failed");
return (-ENOMEM);
}
c_hash_node));
return (0);
}
void
{
}
/*
* Force a disconnect
*/
void
{
}