.. | .. |
---|
18 | 18 | |
---|
19 | 19 | #include "smc_ib.h" |
---|
20 | 20 | |
---|
| 21 | +#define SMC_V1 1 /* SMC version V1 */ |
---|
| 22 | +#define SMC_V2 2 /* SMC version V2 */ |
---|
| 23 | +#define SMC_RELEASE 0 |
---|
| 24 | + |
---|
21 | 25 | #define SMCPROTO_SMC 0 /* SMC protocol, IPv4 */ |
---|
22 | 26 | #define SMCPROTO_SMC6 1 /* SMC protocol, IPv6 */ |
---|
| 27 | + |
---|
| 28 | +#define SMC_MAX_ISM_DEVS 8 /* max # of proposed non-native ISM |
---|
| 29 | + * devices |
---|
| 30 | + */ |
---|
| 31 | + |
---|
| 32 | +#define SMC_MAX_HOSTNAME_LEN 32 |
---|
| 33 | +#define SMC_MAX_EID_LEN 32 |
---|
23 | 34 | |
---|
24 | 35 | extern struct proto smc_proto; |
---|
25 | 36 | extern struct proto smc_proto6; |
---|
.. | .. |
---|
121 | 132 | struct smc_connection { |
---|
122 | 133 | struct rb_node alert_node; |
---|
123 | 134 | struct smc_link_group *lgr; /* link group of connection */ |
---|
| 135 | + struct smc_link *lnk; /* assigned SMC-R link */ |
---|
124 | 136 | u32 alert_token_local; /* unique conn. id */ |
---|
125 | 137 | u8 peer_rmbe_idx; /* from tcp handshake */ |
---|
126 | 138 | int peer_rmbe_size; /* size of peer rx buffer */ |
---|
.. | .. |
---|
142 | 154 | * .prod cf. TCP snd_nxt |
---|
143 | 155 | * .cons cf. TCP sends ack |
---|
144 | 156 | */ |
---|
| 157 | + union smc_host_cursor local_tx_ctrl_fin; |
---|
| 158 | + /* prod crsr - confirmed by peer |
---|
| 159 | + */ |
---|
145 | 160 | union smc_host_cursor tx_curs_prep; /* tx - prepared data |
---|
146 | 161 | * snd_max..wmem_alloc |
---|
147 | 162 | */ |
---|
.. | .. |
---|
153 | 168 | */ |
---|
154 | 169 | atomic_t sndbuf_space; /* remaining space in sndbuf */ |
---|
155 | 170 | u16 tx_cdc_seq; /* sequence # for CDC send */ |
---|
| 171 | + u16 tx_cdc_seq_fin; /* sequence # - tx completed */ |
---|
156 | 172 | spinlock_t send_lock; /* protect wr_sends */ |
---|
| 173 | + atomic_t cdc_pend_tx_wr; /* number of pending tx CDC wqe |
---|
| 174 | + * - inc when post wqe, |
---|
| 175 | + * - dec on polled tx cqe |
---|
| 176 | + */ |
---|
| 177 | + wait_queue_head_t cdc_pend_tx_wq; /* wakeup on no cdc_pend_tx_wr*/ |
---|
157 | 178 | struct delayed_work tx_work; /* retry of smc_cdc_msg_send */ |
---|
158 | 179 | u32 tx_off; /* base offset in peer rmb */ |
---|
159 | 180 | |
---|
.. | .. |
---|
183 | 204 | spinlock_t acurs_lock; /* protect cursors */ |
---|
184 | 205 | #endif |
---|
185 | 206 | struct work_struct close_work; /* peer sent some closing */ |
---|
| 207 | + struct work_struct abort_work; /* abort the connection */ |
---|
186 | 208 | struct tasklet_struct rx_tsklet; /* Receiver tasklet for SMC-D */ |
---|
187 | 209 | u8 rx_off; /* receive offset: |
---|
188 | 210 | * 0 for SMC-R, 32 for SMC-D |
---|
189 | 211 | */ |
---|
190 | 212 | u64 peer_token; /* SMC-D token of peer */ |
---|
191 | | -}; |
---|
192 | | - |
---|
193 | | -struct smc_connect_info { |
---|
194 | | - int flags; |
---|
195 | | - int alen; |
---|
196 | | - struct sockaddr addr; |
---|
| 213 | + u8 killed : 1; /* abnormal termination */ |
---|
| 214 | + u8 out_of_sync : 1; /* out of sync with peer */ |
---|
197 | 215 | }; |
---|
198 | 216 | |
---|
199 | 217 | struct smc_sock { /* smc sock container */ |
---|
200 | 218 | struct sock sk; |
---|
201 | 219 | struct socket *clcsock; /* internal tcp socket */ |
---|
| 220 | + void (*clcsk_data_ready)(struct sock *sk); |
---|
| 221 | + /* original data_ready fct. **/ |
---|
202 | 222 | struct smc_connection conn; /* smc connection */ |
---|
203 | 223 | struct smc_sock *listen_smc; /* listen parent */ |
---|
204 | | - struct smc_connect_info *connect_info; /* connect address & flags */ |
---|
205 | 224 | struct work_struct connect_work; /* handle non-blocking connect*/ |
---|
206 | 225 | struct work_struct tcp_listen_work;/* handle tcp socket accepts */ |
---|
207 | 226 | struct work_struct smc_listen_work;/* prepare new accept socket */ |
---|
.. | .. |
---|
219 | 238 | * started, waiting for unsent |
---|
220 | 239 | * data to be sent |
---|
221 | 240 | */ |
---|
| 241 | + u8 connect_nonblock : 1; |
---|
| 242 | + /* non-blocking connect in |
---|
| 243 | + * flight |
---|
| 244 | + */ |
---|
222 | 245 | struct mutex clcsock_release_lock; |
---|
223 | 246 | /* protects clcsock of a listen |
---|
224 | 247 | * socket |
---|
.. | .. |
---|
230 | 253 | return (struct smc_sock *)sk; |
---|
231 | 254 | } |
---|
232 | 255 | |
---|
| 256 | +extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */ |
---|
| 257 | +extern struct workqueue_struct *smc_close_wq; /* wq for close work */ |
---|
| 258 | + |
---|
233 | 259 | #define SMC_SYSTEMID_LEN 8 |
---|
234 | 260 | |
---|
235 | 261 | extern u8 local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */ |
---|
236 | 262 | |
---|
| 263 | +#define ntohll(x) be64_to_cpu(x) |
---|
| 264 | +#define htonll(x) cpu_to_be64(x) |
---|
| 265 | + |
---|
237 | 266 | /* convert an u32 value into network byte order, store it into a 3 byte field */ |
---|
238 | 267 | static inline void hton24(u8 *net, u32 host) |
---|
239 | 268 | { |
---|