2 * Shared Memory Communications over RDMA (SMC-R) and RoCE
4 * Definitions for the SMC module (socket related)
6 * Copyright IBM Corp. 2016
8 * Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com>
13 #include <linux/socket.h>
14 #include <linux/types.h>
17 #define SMCPROTO_SMC 0 /* SMC protocol */
19 #define SMC_MAX_PORTS 2 /* Max # of ports */
21 enum smc_state { /* possible states of an SMC socket */
28 struct smc_sock { /* smc sock container */
30 struct socket *clcsock; /* internal tcp socket */
31 struct sockaddr *addr; /* inet connect address */
32 struct smc_sock *listen_smc; /* listen parent */
33 struct work_struct tcp_listen_work;/* handle tcp socket accepts */
34 struct work_struct smc_listen_work;/* prepare new accept socket */
35 struct list_head accept_q; /* sockets to be accepted */
36 spinlock_t accept_q_lock; /* protects accept_q */
37 bool use_fallback; /* fallback to tcp */
40 static inline struct smc_sock *smc_sk(const struct sock *sk)
42 return (struct smc_sock *)sk;
45 #define SMC_SYSTEMID_LEN 8
47 extern u8 local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */
50 static inline bool using_ipsec(struct smc_sock *smc)
52 return (smc->clcsock->sk->sk_policy[0] ||
53 smc->clcsock->sk->sk_policy[1]) ? 1 : 0;
56 static inline bool using_ipsec(struct smc_sock *smc)
62 int smc_netinfo_by_tcpsk(struct socket *clcsock, __be32 *subnet,