1
2
3
4
5
6
7
8
9
10
11
12#ifndef _SMC_CLC_H
13#define _SMC_CLC_H
14
15#include <rdma/ib_verbs.h>
16
17#include "smc.h"
18
19#define SMC_CLC_PROPOSAL 0x01
20#define SMC_CLC_ACCEPT 0x02
21#define SMC_CLC_CONFIRM 0x03
22#define SMC_CLC_DECLINE 0x04
23
24
25static const char SMC_EYECATCHER[4] = {'\xe2', '\xd4', '\xc3', '\xd9'};
26
27#define SMC_CLC_V1 0x1
28#define CLC_WAIT_TIME (6 * HZ)
29#define SMC_CLC_DECL_MEM 0x01010000
30#define SMC_CLC_DECL_TIMEOUT 0x02000000
31#define SMC_CLC_DECL_CNFERR 0x03000000
32#define SMC_CLC_DECL_IPSEC 0x03030000
33#define SMC_CLC_DECL_SYNCERR 0x04000000
34#define SMC_CLC_DECL_REPLY 0x06000000
35#define SMC_CLC_DECL_INTERR 0x99990000
36#define SMC_CLC_DECL_TCL 0x02040000
37#define SMC_CLC_DECL_SEND 0x07000000
38
39struct smc_clc_msg_hdr {
40 u8 eyecatcher[4];
41 u8 type;
42 __be16 length;
43#if defined(__BIG_ENDIAN_BITFIELD)
44 u8 version : 4,
45 flag : 1,
46 rsvd : 3;
47#elif defined(__LITTLE_ENDIAN_BITFIELD)
48 u8 rsvd : 3,
49 flag : 1,
50 version : 4;
51#endif
52} __packed;
53
54struct smc_clc_msg_trail {
55 u8 eyecatcher[4];
56};
57
58struct smc_clc_msg_local {
59 u8 id_for_peer[SMC_SYSTEMID_LEN];
60 u8 gid[16];
61 u8 mac[6];
62};
63
64struct smc_clc_msg_proposal {
65 struct smc_clc_msg_hdr hdr;
66 struct smc_clc_msg_local lcl;
67 __be16 iparea_offset;
68 __be32 outgoing_subnet;
69 u8 prefix_len;
70 u8 reserved[2];
71 u8 ipv6_prefixes_cnt;
72 struct smc_clc_msg_trail trl;
73} __aligned(4);
74
75struct smc_clc_msg_accept_confirm {
76 struct smc_clc_msg_hdr hdr;
77 struct smc_clc_msg_local lcl;
78 u8 qpn[3];
79 __be32 rmb_rkey;
80 u8 conn_idx;
81 __be32 rmbe_alert_token;
82#if defined(__BIG_ENDIAN_BITFIELD)
83 u8 rmbe_size : 4,
84 qp_mtu : 4;
85#elif defined(__LITTLE_ENDIAN_BITFIELD)
86 u8 qp_mtu : 4,
87 rmbe_size : 4;
88#endif
89 u8 reserved;
90 __be64 rmb_dma_addr;
91 u8 reserved2;
92 u8 psn[3];
93 struct smc_clc_msg_trail trl;
94} __packed;
95
96struct smc_clc_msg_decline {
97 struct smc_clc_msg_hdr hdr;
98 u8 id_for_peer[SMC_SYSTEMID_LEN];
99 __be32 peer_diagnosis;
100 u8 reserved2[4];
101 struct smc_clc_msg_trail trl;
102} __aligned(4);
103
104struct smc_sock;
105struct smc_ib_device;
106
107int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
108 u8 expected_type);
109int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info,
110 u8 out_of_sync);
111int smc_clc_send_proposal(struct smc_sock *smc, struct smc_ib_device *smcibdev,
112 u8 ibport);
113int smc_clc_send_confirm(struct smc_sock *smc);
114int smc_clc_send_accept(struct smc_sock *smc, int srv_first_contact);
115
116#endif
117