linux/net/smc/smc_clc.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  Shared Memory Communications over RDMA (SMC-R) and RoCE
 *
 *  CLC (connection layer control) handshake over initial TCP socket to
 *  prepare for RDMA traffic
 *
 *  Copyright IBM Corp. 2016, 2018
 *
 *  Author(s):  Ursula Braun <[email protected]>
 */

#include <linux/in.h>
#include <linux/inetdevice.h>
#include <linux/if_ether.h>
#include <linux/sched/signal.h>
#include <linux/utsname.h>
#include <linux/ctype.h>

#include <net/addrconf.h>
#include <net/sock.h>
#include <net/tcp.h>

#include "smc.h"
#include "smc_core.h"
#include "smc_clc.h"
#include "smc_ib.h"
#include "smc_ism.h"
#include "smc_netlink.h"

#define SMCR_CLC_ACCEPT_CONFIRM_LEN
#define SMCD_CLC_ACCEPT_CONFIRM_LEN
#define SMCD_CLC_ACCEPT_CONFIRM_LEN_V2
#define SMCR_CLC_ACCEPT_CONFIRM_LEN_V2
#define SMC_CLC_RECV_BUF_LEN

/* eye catcher "SMCR" EBCDIC for CLC messages */
static const char SMC_EYECATCHER[4] =;
/* eye catcher "SMCD" EBCDIC for CLC messages */
static const char SMCD_EYECATCHER[4] =;

static u8 smc_hostname[SMC_MAX_HOSTNAME_LEN];

struct smc_clc_eid_table {};

static struct smc_clc_eid_table smc_clc_eid_table;

struct smc_clc_eid_entry {};

/* The size of a user EID is 32 characters.
 * Valid characters should be (single-byte character set) A-Z, 0-9, '.' and '-'.
 * Blanks should only be used to pad to the expected size.
 * First character must be alphanumeric.
 */
static bool smc_clc_ueid_valid(char *ueid)
{}

static int smc_clc_ueid_add(char *ueid)
{}

int smc_clc_ueid_count(void)
{}

int smc_nl_add_ueid(struct sk_buff *skb, struct genl_info *info)
{}

/* remove one or all ueid entries from the table */
static int smc_clc_ueid_remove(char *ueid)
{}

int smc_nl_remove_ueid(struct sk_buff *skb, struct genl_info *info)
{}

int smc_nl_flush_ueid(struct sk_buff *skb, struct genl_info *info)
{}

static int smc_nl_ueid_dumpinfo(struct sk_buff *skb, u32 portid, u32 seq,
				u32 flags, char *ueid)
{}

static int _smc_nl_ueid_dump(struct sk_buff *skb, u32 portid, u32 seq,
			     int start_idx)
{}

int smc_nl_dump_ueid(struct sk_buff *skb, struct netlink_callback *cb)
{}

int smc_nl_dump_seid(struct sk_buff *skb, struct netlink_callback *cb)
{}

int smc_nl_enable_seid(struct sk_buff *skb, struct genl_info *info)
{}

int smc_nl_disable_seid(struct sk_buff *skb, struct genl_info *info)
{}

static bool _smc_clc_match_ueid(u8 *peer_ueid)
{}

bool smc_clc_match_eid(u8 *negotiated_eid,
		       struct smc_clc_v2_extension *smc_v2_ext,
		       u8 *peer_eid, u8 *local_eid)
{}

/* check arriving CLC proposal */
static bool smc_clc_msg_prop_valid(struct smc_clc_msg_proposal *pclc)
{}

/* check arriving CLC accept or confirm */
static bool
smc_clc_msg_acc_conf_valid(struct smc_clc_msg_accept_confirm *clc)
{}

/* check arriving CLC decline */
static bool
smc_clc_msg_decl_valid(struct smc_clc_msg_decline *dclc)
{}

static int smc_clc_fill_fce_v2x(struct smc_clc_first_contact_ext_v2x *fce_v2x,
				struct smc_init_info *ini)
{}

/* check if received message has a correct header length and contains valid
 * heading and trailing eyecatchers
 */
static bool smc_clc_msg_hdr_valid(struct smc_clc_msg_hdr *clcm, bool check_trl)
{}

/* find ipv4 addr on device and get the prefix len, fill CLC proposal msg */
static int smc_clc_prfx_set4_rcu(struct dst_entry *dst, __be32 ipv4,
				 struct smc_clc_msg_proposal_prefix *prop)
{}

/* fill CLC proposal msg with ipv6 prefixes from device */
static int smc_clc_prfx_set6_rcu(struct dst_entry *dst,
				 struct smc_clc_msg_proposal_prefix *prop,
				 struct smc_clc_ipv6_prefix *ipv6_prfx)
{}

/* retrieve and set prefixes in CLC proposal msg */
static int smc_clc_prfx_set(struct socket *clcsock,
			    struct smc_clc_msg_proposal_prefix *prop,
			    struct smc_clc_ipv6_prefix *ipv6_prfx)
{}

/* match ipv4 addrs of dev against addr in CLC proposal */
static int smc_clc_prfx_match4_rcu(struct net_device *dev,
				   struct smc_clc_msg_proposal_prefix *prop)
{}

/* match ipv6 addrs of dev against addrs in CLC proposal */
static int smc_clc_prfx_match6_rcu(struct net_device *dev,
				   struct smc_clc_msg_proposal_prefix *prop)
{}

/* check if proposed prefixes match one of our device prefixes */
int smc_clc_prfx_match(struct socket *clcsock,
		       struct smc_clc_msg_proposal_prefix *prop)
{}

/* Wait for data on the tcp-socket, analyze received data
 * Returns:
 * 0 if success and it was not a decline that we received.
 * SMC_CLC_DECL_REPLY if decline received for fallback w/o another decl send.
 * clcsock error, -EINTR, -ECONNRESET, -EPROTO otherwise.
 */
int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
		     u8 expected_type, unsigned long timeout)
{}

/* send CLC DECLINE message across internal TCP socket */
int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, u8 version)
{}

/* send CLC PROPOSAL message across internal TCP socket */
int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
{}

static void
smcd_clc_prep_confirm_accept(struct smc_connection *conn,
			     struct smc_clc_msg_accept_confirm *clc,
			     int first_contact, u8 version,
			     u8 *eid, struct smc_init_info *ini,
			     int *fce_len,
			     struct smc_clc_first_contact_ext_v2x *fce_v2x,
			     struct smc_clc_msg_trail *trl)
{}

static void
smcr_clc_prep_confirm_accept(struct smc_connection *conn,
			     struct smc_clc_msg_accept_confirm *clc,
			     int first_contact, u8 version,
			     u8 *eid, struct smc_init_info *ini,
			     int *fce_len,
			     struct smc_clc_first_contact_ext_v2x *fce_v2x,
			     struct smc_clc_fce_gid_ext *gle,
			     struct smc_clc_msg_trail *trl)
{}

/* build and send CLC CONFIRM / ACCEPT message */
static int smc_clc_send_confirm_accept(struct smc_sock *smc,
				       struct smc_clc_msg_accept_confirm *clc,
				       int first_contact, u8 version,
				       u8 *eid, struct smc_init_info *ini)
{}

/* send CLC CONFIRM message across internal TCP socket */
int smc_clc_send_confirm(struct smc_sock *smc, bool clnt_first_contact,
			 u8 version, u8 *eid, struct smc_init_info *ini)
{}

/* send CLC ACCEPT message across internal TCP socket */
int smc_clc_send_accept(struct smc_sock *new_smc, bool srv_first_contact,
			u8 version, u8 *negotiated_eid, struct smc_init_info *ini)
{}

int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
				      struct smc_clc_msg_proposal *pclc,
				      struct smc_init_info *ini)
{}

int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce,
				       struct smc_init_info *ini)
{}

int smc_clc_v2x_features_confirm_check(struct smc_clc_msg_accept_confirm *cclc,
				       struct smc_init_info *ini)
{}

void smc_clc_get_hostname(u8 **host)
{}

void __init smc_clc_init(void)
{}

void smc_clc_exit(void)
{}