linux/net/smc/smc_clc.h

/* 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
 *
 *  Author(s):  Ursula Braun <[email protected]>
 */

#ifndef _SMC_CLC_H
#define _SMC_CLC_H

#include <rdma/ib_verbs.h>
#include <linux/smc.h>

#include "smc.h"
#include "smc_netlink.h"

#define SMC_CLC_PROPOSAL
#define SMC_CLC_ACCEPT
#define SMC_CLC_CONFIRM
#define SMC_CLC_DECLINE

#define SMC_TYPE_R
#define SMC_TYPE_D
#define SMC_TYPE_N
#define SMC_TYPE_B
#define CLC_WAIT_TIME
#define CLC_WAIT_TIME_SHORT
#define SMC_CLC_DECL_MEM
#define SMC_CLC_DECL_TIMEOUT_CL
#define SMC_CLC_DECL_TIMEOUT_AL
#define SMC_CLC_DECL_CNFERR
#define SMC_CLC_DECL_PEERNOSMC
#define SMC_CLC_DECL_IPSEC
#define SMC_CLC_DECL_NOSMCDEV
#define SMC_CLC_DECL_NOSMCDDEV
#define SMC_CLC_DECL_NOSMCRDEV
#define SMC_CLC_DECL_NOISM2SUPP
#define SMC_CLC_DECL_NOV2EXT
#define SMC_CLC_DECL_NOV2DEXT
#define SMC_CLC_DECL_NOSEID
#define SMC_CLC_DECL_NOSMCD2DEV
#define SMC_CLC_DECL_NOUEID
#define SMC_CLC_DECL_RELEASEERR
#define SMC_CLC_DECL_MAXCONNERR
#define SMC_CLC_DECL_MAXLINKERR
#define SMC_CLC_DECL_MODEUNSUPP
#define SMC_CLC_DECL_RMBE_EC
#define SMC_CLC_DECL_OPTUNSUPP
#define SMC_CLC_DECL_DIFFPREFIX
#define SMC_CLC_DECL_GETVLANERR
#define SMC_CLC_DECL_ISMVLANERR
#define SMC_CLC_DECL_NOACTLINK
#define SMC_CLC_DECL_NOSRVLINK
#define SMC_CLC_DECL_VERSMISMAT
#define SMC_CLC_DECL_MAX_DMB
#define SMC_CLC_DECL_NOROUTE
#define SMC_CLC_DECL_NOINDIRECT
#define SMC_CLC_DECL_SYNCERR
#define SMC_CLC_DECL_PEERDECL
#define SMC_CLC_DECL_INTERR
#define SMC_CLC_DECL_ERR_RTOK
#define SMC_CLC_DECL_ERR_RDYLNK
#define SMC_CLC_DECL_ERR_REGBUF

#define SMC_FIRST_CONTACT_MASK

struct smc_clc_msg_hdr {} __packed;			/* format defined in RFC7609 */

struct smc_clc_msg_trail {};

struct smc_clc_msg_local {};

/* Struct would be 4 byte aligned, but it is used in an array that is sent
 * to peers and must conform to RFC7609, hence we need to use packed here.
 */
struct smc_clc_ipv6_prefix {} __packed;			/* format defined in RFC7609 */

#if defined(__BIG_ENDIAN_BITFIELD)
struct smc_clc_v2_flag {
	u8 release : 4,
	   rsvd    : 3,
	   seid    : 1;
};
#elif defined(__LITTLE_ENDIAN_BITFIELD)
struct smc_clc_v2_flag {};
#endif

struct smc_clnt_opts_area_hdr {};

struct smc_clc_smcd_gid_chid {} __packed;		/* format defined in
			 * IBM Shared Memory Communications Version 2
			 * (https://www.ibm.com/support/pages/node/6326337)
			 */

struct smc_clc_v2_extension {};

struct smc_clc_msg_proposal_prefix {} __aligned();

struct smc_clc_msg_smcd {};

struct smc_clc_smcd_v2_extension {};

struct smc_clc_msg_proposal {} __aligned();

#define SMC_CLC_MAX_V6_PREFIX
#define SMC_CLC_MAX_UEID
#define SMCD_CLC_MAX_V2_GID_ENTRIES

struct smc_clc_msg_proposal_area {};

struct smcr_clc_msg_accept_confirm {} __packed;

struct smcd_clc_msg_accept_confirm_common {} __packed;

#define SMC_CLC_OS_ZOS
#define SMC_CLC_OS_LINUX
#define SMC_CLC_OS_AIX

struct smc_clc_first_contact_ext {};

struct smc_clc_first_contact_ext_v2x {} __packed;		/* format defined in
			 * IBM Shared Memory Communications Version 2 (Third Edition)
			 * (https://www.ibm.com/support/pages/node/7009315)
			 */

struct smc_clc_fce_gid_ext {};

struct smc_clc_msg_accept_confirm {};

struct smc_clc_msg_decline {} __aligned();

#define SMC_DECL_DIAG_COUNT_V2

struct smc_clc_msg_decline_v2 {} __aligned();

/* determine start of the prefix area within the proposal message */
static inline struct smc_clc_msg_proposal_prefix *
smc_clc_proposal_get_prefix(struct smc_clc_msg_proposal *pclc)
{}

static inline bool smcr_indicated(int smc_type)
{}

static inline bool smcd_indicated(int smc_type)
{}

static inline u8 smc_indicated_type(int is_smcd, int is_smcr)
{}

/* get SMC-D info from proposal message */
static inline struct smc_clc_msg_smcd *
smc_get_clc_msg_smcd(struct smc_clc_msg_proposal *prop)
{}

static inline struct smc_clc_v2_extension *
smc_get_clc_v2_ext(struct smc_clc_msg_proposal *prop)
{}

static inline struct smc_clc_smcd_v2_extension *
smc_get_clc_smcd_v2_ext(struct smc_clc_v2_extension *prop_v2ext)
{}

static inline struct smc_clc_first_contact_ext *
smc_get_clc_first_contact_ext(struct smc_clc_msg_accept_confirm *clc,
			      bool is_smcd)
{}

struct smcd_dev;
struct smc_init_info;

int smc_clc_prfx_match(struct socket *clcsock,
		       struct smc_clc_msg_proposal_prefix *prop);
int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
		     u8 expected_type, unsigned long timeout);
int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, u8 version);
int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini);
int smc_clc_send_confirm(struct smc_sock *smc, bool clnt_first_contact,
			 u8 version, u8 *eid, struct smc_init_info *ini);
int smc_clc_send_accept(struct smc_sock *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_init(void) __init;
void smc_clc_exit(void);
void smc_clc_get_hostname(u8 **host);
bool smc_clc_match_eid(u8 *negotiated_eid,
		       struct smc_clc_v2_extension *smc_v2_ext,
		       u8 *peer_eid, u8 *local_eid);
int smc_clc_ueid_count(void);
int smc_nl_dump_ueid(struct sk_buff *skb, struct netlink_callback *cb);
int smc_nl_add_ueid(struct sk_buff *skb, struct genl_info *info);
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);
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);

#endif