linux/drivers/infiniband/sw/siw/siw_cm.c

// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause

/* Authors: Bernard Metzler <[email protected]> */
/*          Fredy Neeser */
/*          Greg Joyce <[email protected]> */
/* Copyright (c) 2008-2019, IBM Corporation */
/* Copyright (c) 2017, Open Grid Computing, Inc. */

#include <linux/errno.h>
#include <linux/types.h>
#include <linux/net.h>
#include <linux/inetdevice.h>
#include <net/addrconf.h>
#include <linux/workqueue.h>
#include <net/sock.h>
#include <net/tcp.h>
#include <linux/inet.h>
#include <linux/tcp.h>
#include <trace/events/sock.h>

#include <rdma/iw_cm.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_user_verbs.h>

#include "siw.h"
#include "siw_cm.h"

/*
 * Set to any combination of
 * MPA_V2_RDMA_NO_RTR, MPA_V2_RDMA_READ_RTR, MPA_V2_RDMA_WRITE_RTR
 */
static __be16 rtr_type =;
static const bool relaxed_ird_negotiation =;

static void siw_cm_llp_state_change(struct sock *s);
static void siw_cm_llp_data_ready(struct sock *s);
static void siw_cm_llp_write_space(struct sock *s);
static void siw_cm_llp_error_report(struct sock *s);
static int siw_cm_upcall(struct siw_cep *cep, enum iw_cm_event_type reason,
			 int status);

static void siw_sk_assign_cm_upcalls(struct sock *sk)
{}

static void siw_sk_restore_upcalls(struct sock *sk, struct siw_cep *cep)
{}

static void siw_qp_socket_assoc(struct siw_cep *cep, struct siw_qp *qp)
{}

static void siw_socket_disassoc(struct socket *s)
{}

static void siw_rtr_data_ready(struct sock *sk)
{}

static void siw_sk_assign_rtr_upcalls(struct siw_cep *cep)
{}

static void siw_cep_socket_assoc(struct siw_cep *cep, struct socket *s)
{}

static struct siw_cep *siw_cep_alloc(struct siw_device *sdev)
{}

static void siw_cm_free_work(struct siw_cep *cep)
{}

static void siw_cancel_mpatimer(struct siw_cep *cep)
{}

static void siw_put_work(struct siw_cm_work *work)
{}

static void siw_cep_set_inuse(struct siw_cep *cep)
{}

static void siw_cep_set_free(struct siw_cep *cep)
{}

static void __siw_cep_dealloc(struct kref *ref)
{}

static struct siw_cm_work *siw_get_work(struct siw_cep *cep)
{}

static int siw_cm_alloc_work(struct siw_cep *cep, int num)
{}

/*
 * siw_cm_upcall()
 *
 * Upcall to IWCM to inform about async connection events
 */
static int siw_cm_upcall(struct siw_cep *cep, enum iw_cm_event_type reason,
			 int status)
{}

static void siw_free_cm_id(struct siw_cep *cep)
{}

static void siw_destroy_cep_sock(struct siw_cep *cep)
{}

/*
 * siw_qp_cm_drop()
 *
 * Drops established LLP connection if present and not already
 * scheduled for dropping. Called from user context, SQ workqueue
 * or receive IRQ. Caller signals if socket can be immediately
 * closed (basically, if not in IRQ).
 */
void siw_qp_cm_drop(struct siw_qp *qp, int schedule)
{}

void siw_cep_put(struct siw_cep *cep)
{}

static void siw_cep_set_free_and_put(struct siw_cep *cep)
{}

void siw_cep_get(struct siw_cep *cep)
{}

/*
 * Expects params->pd_len in host byte order
 */
static int siw_send_mpareqrep(struct siw_cep *cep, const void *pdata, u8 pd_len)
{}

/*
 * Receive MPA Request/Reply header.
 *
 * Returns 0 if complete MPA Request/Reply header including
 * eventual private data was received. Returns -EAGAIN if
 * header was partially received or negative error code otherwise.
 *
 * Context: May be called in process context only
 */
static int siw_recv_mpa_rr(struct siw_cep *cep)
{}

/*
 * siw_proc_mpareq()
 *
 * Read MPA Request from socket and signal new connection to IWCM
 * if success. Caller must hold lock on corresponding listening CEP.
 */
static int siw_proc_mpareq(struct siw_cep *cep)
{}

static int siw_proc_mpareply(struct siw_cep *cep)
{}

/*
 * siw_accept_newconn - accept an incoming pending connection
 *
 */
static void siw_accept_newconn(struct siw_cep *cep)
{}

static void siw_cm_work_handler(struct work_struct *w)
{}

static struct workqueue_struct *siw_cm_wq;

int siw_cm_queue_work(struct siw_cep *cep, enum siw_work_type type)
{}

static void siw_cm_llp_data_ready(struct sock *sk)
{}

static void siw_cm_llp_write_space(struct sock *sk)
{}

static void siw_cm_llp_error_report(struct sock *sk)
{}

static void siw_cm_llp_state_change(struct sock *sk)
{}

static int kernel_bindconnect(struct socket *s, struct sockaddr *laddr,
			      struct sockaddr *raddr, bool afonly)
{}

int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
{}

/*
 * siw_accept - Let SoftiWARP accept an RDMA connection request
 *
 * @id:		New connection management id to be used for accepted
 *		connection request
 * @params:	Connection parameters provided by ULP for accepting connection
 *
 * Transition QP to RTS state, associate new CM id @id with accepted CEP
 * and get prepared for TCP input by installing socket callbacks.
 * Then send MPA Reply and generate the "connection established" event.
 * Socket callbacks must be installed before sending MPA Reply, because
 * the latter may cause a first RDMA message to arrive from the RDMA Initiator
 * side very quickly, at which time the socket callbacks must be ready.
 */
int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params)
{}

/*
 * siw_reject()
 *
 * Local connection reject case. Send private data back to peer,
 * close connection and dereference connection id.
 */
int siw_reject(struct iw_cm_id *id, const void *pdata, u8 pd_len)
{}

/*
 * siw_create_listen - Create resources for a listener's IWCM ID @id
 *
 * Starts listen on the socket address id->local_addr.
 *
 */
int siw_create_listen(struct iw_cm_id *id, int backlog)
{}

static void siw_drop_listeners(struct iw_cm_id *id)
{}

int siw_destroy_listen(struct iw_cm_id *id)
{}

int siw_cm_init(void)
{}

void siw_cm_exit(void)
{}