hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/net/smc/smc.h
....@@ -18,8 +18,19 @@
1818
1919 #include "smc_ib.h"
2020
21
+#define SMC_V1 1 /* SMC version V1 */
22
+#define SMC_V2 2 /* SMC version V2 */
23
+#define SMC_RELEASE 0
24
+
2125 #define SMCPROTO_SMC 0 /* SMC protocol, IPv4 */
2226 #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
2334
2435 extern struct proto smc_proto;
2536 extern struct proto smc_proto6;
....@@ -121,6 +132,7 @@
121132 struct smc_connection {
122133 struct rb_node alert_node;
123134 struct smc_link_group *lgr; /* link group of connection */
135
+ struct smc_link *lnk; /* assigned SMC-R link */
124136 u32 alert_token_local; /* unique conn. id */
125137 u8 peer_rmbe_idx; /* from tcp handshake */
126138 int peer_rmbe_size; /* size of peer rx buffer */
....@@ -142,6 +154,9 @@
142154 * .prod cf. TCP snd_nxt
143155 * .cons cf. TCP sends ack
144156 */
157
+ union smc_host_cursor local_tx_ctrl_fin;
158
+ /* prod crsr - confirmed by peer
159
+ */
145160 union smc_host_cursor tx_curs_prep; /* tx - prepared data
146161 * snd_max..wmem_alloc
147162 */
....@@ -153,7 +168,13 @@
153168 */
154169 atomic_t sndbuf_space; /* remaining space in sndbuf */
155170 u16 tx_cdc_seq; /* sequence # for CDC send */
171
+ u16 tx_cdc_seq_fin; /* sequence # - tx completed */
156172 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*/
157178 struct delayed_work tx_work; /* retry of smc_cdc_msg_send */
158179 u32 tx_off; /* base offset in peer rmb */
159180
....@@ -183,25 +204,23 @@
183204 spinlock_t acurs_lock; /* protect cursors */
184205 #endif
185206 struct work_struct close_work; /* peer sent some closing */
207
+ struct work_struct abort_work; /* abort the connection */
186208 struct tasklet_struct rx_tsklet; /* Receiver tasklet for SMC-D */
187209 u8 rx_off; /* receive offset:
188210 * 0 for SMC-R, 32 for SMC-D
189211 */
190212 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 */
197215 };
198216
199217 struct smc_sock { /* smc sock container */
200218 struct sock sk;
201219 struct socket *clcsock; /* internal tcp socket */
220
+ void (*clcsk_data_ready)(struct sock *sk);
221
+ /* original data_ready fct. **/
202222 struct smc_connection conn; /* smc connection */
203223 struct smc_sock *listen_smc; /* listen parent */
204
- struct smc_connect_info *connect_info; /* connect address & flags */
205224 struct work_struct connect_work; /* handle non-blocking connect*/
206225 struct work_struct tcp_listen_work;/* handle tcp socket accepts */
207226 struct work_struct smc_listen_work;/* prepare new accept socket */
....@@ -219,6 +238,10 @@
219238 * started, waiting for unsent
220239 * data to be sent
221240 */
241
+ u8 connect_nonblock : 1;
242
+ /* non-blocking connect in
243
+ * flight
244
+ */
222245 struct mutex clcsock_release_lock;
223246 /* protects clcsock of a listen
224247 * socket
....@@ -230,10 +253,16 @@
230253 return (struct smc_sock *)sk;
231254 }
232255
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
+
233259 #define SMC_SYSTEMID_LEN 8
234260
235261 extern u8 local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */
236262
263
+#define ntohll(x) be64_to_cpu(x)
264
+#define htonll(x) cpu_to_be64(x)
265
+
237266 /* convert an u32 value into network byte order, store it into a 3 byte field */
238267 static inline void hton24(u8 *net, u32 host)
239268 {