linux/net/rds/tcp.c

/*
 * Copyright (c) 2006, 2018 Oracle and/or its affiliates. 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
 *        disclaimer in the documentation and/or other materials
 *        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 <linux/kernel.h>
#include <linux/slab.h>
#include <linux/in.h>
#include <linux/module.h>
#include <net/tcp.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <net/addrconf.h>

#include "rds.h"
#include "tcp.h"

/* only for info exporting */
static DEFINE_SPINLOCK(rds_tcp_tc_list_lock);
static LIST_HEAD(rds_tcp_tc_list);

/* rds_tcp_tc_count counts only IPv4 connections.
 * rds6_tcp_tc_count counts both IPv4 and IPv6 connections.
 */
static unsigned int rds_tcp_tc_count;
#if IS_ENABLED(CONFIG_IPV6)
static unsigned int rds6_tcp_tc_count;
#endif

/* Track rds_tcp_connection structs so they can be cleaned up */
static DEFINE_SPINLOCK(rds_tcp_conn_lock);
static LIST_HEAD(rds_tcp_conn_list);
static atomic_t rds_tcp_unloading =;

static struct kmem_cache *rds_tcp_conn_slab;

static int rds_tcp_skbuf_handler(const struct ctl_table *ctl, int write,
				 void *buffer, size_t *lenp, loff_t *fpos);

static int rds_tcp_min_sndbuf =;
static int rds_tcp_min_rcvbuf =;

static struct ctl_table rds_tcp_sysctl_table[] =;

u32 rds_tcp_write_seq(struct rds_tcp_connection *tc)
{}

u32 rds_tcp_snd_una(struct rds_tcp_connection *tc)
{}

void rds_tcp_restore_callbacks(struct socket *sock,
			       struct rds_tcp_connection *tc)
{}

/*
 * rds_tcp_reset_callbacks() switches the to the new sock and
 * returns the existing tc->t_sock.
 *
 * The only functions that set tc->t_sock are rds_tcp_set_callbacks
 * and rds_tcp_reset_callbacks.  Send and receive trust that
 * it is set.  The absence of RDS_CONN_UP bit protects those paths
 * from being called while it isn't set.
 */
void rds_tcp_reset_callbacks(struct socket *sock,
			     struct rds_conn_path *cp)
{}

/* Add tc to rds_tcp_tc_list and set tc->t_sock. See comments
 * above rds_tcp_reset_callbacks for notes about synchronization
 * with data path
 */
void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp)
{}

/* Handle RDS_INFO_TCP_SOCKETS socket option.  It only returns IPv4
 * connections for backward compatibility.
 */
static void rds_tcp_tc_info(struct socket *rds_sock, unsigned int len,
			    struct rds_info_iterator *iter,
			    struct rds_info_lengths *lens)
{}

#if IS_ENABLED(CONFIG_IPV6)
/* Handle RDS6_INFO_TCP_SOCKETS socket option. It returns both IPv4 and
 * IPv6 connections. IPv4 connection address is returned in an IPv4 mapped
 * address.
 */
static void rds6_tcp_tc_info(struct socket *sock, unsigned int len,
			     struct rds_info_iterator *iter,
			     struct rds_info_lengths *lens)
{}
#endif

int rds_tcp_laddr_check(struct net *net, const struct in6_addr *addr,
			__u32 scope_id)
{}

static void rds_tcp_conn_free(void *arg)
{}

static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp)
{}

static bool list_has_conn(struct list_head *list, struct rds_connection *conn)
{}

static void rds_tcp_set_unloading(void)
{}

static bool rds_tcp_is_unloading(struct rds_connection *conn)
{}

static void rds_tcp_destroy_conns(void)
{}

static void rds_tcp_exit(void);

static u8 rds_tcp_get_tos_map(u8 tos)
{}

struct rds_transport rds_tcp_transport =;

static unsigned int rds_tcp_netid;

/* per-network namespace private data for this module */
struct rds_tcp_net {};

/* All module specific customizations to the RDS-TCP socket should be done in
 * rds_tcp_tune() and applied after socket creation.
 */
bool rds_tcp_tune(struct socket *sock)
{}

static void rds_tcp_accept_worker(struct work_struct *work)
{}

void rds_tcp_accept_work(struct sock *sk)
{}

static __net_init int rds_tcp_init_net(struct net *net)
{}

static void rds_tcp_kill_sock(struct net *net)
{}

static void __net_exit rds_tcp_exit_net(struct net *net)
{}

static struct pernet_operations rds_tcp_net_ops =;

void *rds_tcp_listen_sock_def_readable(struct net *net)
{}

/* when sysctl is used to modify some kernel socket parameters,this
 * function  resets the RDS connections in that netns  so that we can
 * restart with new parameters.  The assumption is that such reset
 * events are few and far-between.
 */
static void rds_tcp_sysctl_reset(struct net *net)
{}

static int rds_tcp_skbuf_handler(const struct ctl_table *ctl, int write,
				 void *buffer, size_t *lenp, loff_t *fpos)
{}

static void rds_tcp_exit(void)
{}
module_exit(rds_tcp_exit);

static int __init rds_tcp_init(void)
{}
module_init();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();