blob: e87d7986709941dbb35e365c7054e98c3eb28f11 [file] [log] [blame]
Ursula Braunac713872017-01-09 16:55:13 +01001/*
2 * Shared Memory Communications over RDMA (SMC-R) and RoCE
3 *
4 * Definitions for the SMC module (socket related)
5 *
6 * Copyright IBM Corp. 2016
7 *
8 * Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com>
9 */
10#ifndef __SMC_H
11#define __SMC_H
12
13#include <linux/socket.h>
14#include <linux/types.h>
15#include <net/sock.h>
16
17#define SMCPROTO_SMC 0 /* SMC protocol */
18
Ursula Brauna4cf0442017-01-09 16:55:14 +010019#define SMC_MAX_PORTS 2 /* Max # of ports */
20
Ursula Braunac713872017-01-09 16:55:13 +010021enum smc_state { /* possible states of an SMC socket */
22 SMC_ACTIVE = 1,
23 SMC_INIT = 2,
24 SMC_CLOSED = 7,
25 SMC_LISTEN = 10,
26};
27
28struct smc_sock { /* smc sock container */
29 struct sock sk;
30 struct socket *clcsock; /* internal tcp socket */
31 bool use_fallback; /* fallback to tcp */
32};
33
34static inline struct smc_sock *smc_sk(const struct sock *sk)
35{
36 return (struct smc_sock *)sk;
37}
38
Ursula Brauna4cf0442017-01-09 16:55:14 +010039#define SMC_SYSTEMID_LEN 8
40
41extern u8 local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */
42
Ursula Braunac713872017-01-09 16:55:13 +010043#endif /* __SMC_H */