Ursula Braun | ac71387 | 2017-01-09 16:55:13 +0100 | [diff] [blame] | 1 | /* |
| 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 Braun | a4cf044 | 2017-01-09 16:55:14 +0100 | [diff] [blame^] | 19 | #define SMC_MAX_PORTS 2 /* Max # of ports */ |
| 20 | |
Ursula Braun | ac71387 | 2017-01-09 16:55:13 +0100 | [diff] [blame] | 21 | enum 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 | |
| 28 | struct 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 | |
| 34 | static inline struct smc_sock *smc_sk(const struct sock *sk) |
| 35 | { |
| 36 | return (struct smc_sock *)sk; |
| 37 | } |
| 38 | |
Ursula Braun | a4cf044 | 2017-01-09 16:55:14 +0100 | [diff] [blame^] | 39 | #define SMC_SYSTEMID_LEN 8 |
| 40 | |
| 41 | extern u8 local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */ |
| 42 | |
Ursula Braun | ac71387 | 2017-01-09 16:55:13 +0100 | [diff] [blame] | 43 | #endif /* __SMC_H */ |