@@ -111,6 +111,32 @@ static void rds_conn_reset(struct rds_connection *conn)
111
111
* reliability guarantees of RDS. */
112
112
}
113
113
114
+ static void __rds_conn_path_init (struct rds_connection * conn ,
115
+ struct rds_conn_path * cp , bool is_outgoing )
116
+ {
117
+ spin_lock_init (& cp -> cp_lock );
118
+ cp -> cp_next_tx_seq = 1 ;
119
+ init_waitqueue_head (& cp -> cp_waitq );
120
+ INIT_LIST_HEAD (& cp -> cp_send_queue );
121
+ INIT_LIST_HEAD (& cp -> cp_retrans );
122
+
123
+ cp -> cp_conn = conn ;
124
+ atomic_set (& cp -> cp_state , RDS_CONN_DOWN );
125
+ cp -> cp_send_gen = 0 ;
126
+ /* cp_outgoing is per-path. So we can only set it here
127
+ * for the single-path transports.
128
+ */
129
+ if (!conn -> c_trans -> t_mp_capable )
130
+ cp -> cp_outgoing = (is_outgoing ? 1 : 0 );
131
+ cp -> cp_reconnect_jiffies = 0 ;
132
+ INIT_DELAYED_WORK (& cp -> cp_send_w , rds_send_worker );
133
+ INIT_DELAYED_WORK (& cp -> cp_recv_w , rds_recv_worker );
134
+ INIT_DELAYED_WORK (& cp -> cp_conn_w , rds_connect_worker );
135
+ INIT_WORK (& cp -> cp_down_w , rds_shutdown_worker );
136
+ mutex_init (& cp -> cp_cm_lock );
137
+ cp -> cp_flags = 0 ;
138
+ }
139
+
114
140
/*
115
141
* There is only every one 'conn' for a given pair of addresses in the
116
142
* system at a time. They contain messages to be retransmitted and so
@@ -154,14 +180,8 @@ static struct rds_connection *__rds_conn_create(struct net *net,
154
180
INIT_HLIST_NODE (& conn -> c_hash_node );
155
181
conn -> c_laddr = laddr ;
156
182
conn -> c_faddr = faddr ;
157
- spin_lock_init (& conn -> c_lock );
158
- conn -> c_next_tx_seq = 1 ;
159
- conn -> c_path [0 ].cp_conn = conn ;
160
- rds_conn_net_set (conn , net );
161
183
162
- init_waitqueue_head (& conn -> c_waitq );
163
- INIT_LIST_HEAD (& conn -> c_send_queue );
164
- INIT_LIST_HEAD (& conn -> c_retrans );
184
+ rds_conn_net_set (conn , net );
165
185
166
186
ret = rds_cong_get_maps (conn );
167
187
if (ret ) {
@@ -197,17 +217,6 @@ static struct rds_connection *__rds_conn_create(struct net *net,
197
217
goto out ;
198
218
}
199
219
200
- atomic_set (& conn -> c_state , RDS_CONN_DOWN );
201
- conn -> c_send_gen = 0 ;
202
- conn -> c_path [0 ].cp_outgoing = (is_outgoing ? 1 : 0 );
203
- conn -> c_reconnect_jiffies = 0 ;
204
- INIT_DELAYED_WORK (& conn -> c_send_w , rds_send_worker );
205
- INIT_DELAYED_WORK (& conn -> c_recv_w , rds_recv_worker );
206
- INIT_DELAYED_WORK (& conn -> c_conn_w , rds_connect_worker );
207
- INIT_WORK (& conn -> c_down_w , rds_shutdown_worker );
208
- mutex_init (& conn -> c_cm_lock );
209
- conn -> c_flags = 0 ;
210
-
211
220
rdsdebug ("allocated conn %p for %pI4 -> %pI4 over %s %s\n" ,
212
221
conn , & laddr , & faddr ,
213
222
trans -> t_name ? trans -> t_name : "[unknown]" ,
@@ -224,7 +233,7 @@ static struct rds_connection *__rds_conn_create(struct net *net,
224
233
if (parent ) {
225
234
/* Creating passive conn */
226
235
if (parent -> c_passive ) {
227
- trans -> conn_free (conn -> c_transport_data );
236
+ trans -> conn_free (conn -> c_path [ 0 ]. cp_transport_data );
228
237
kmem_cache_free (rds_conn_slab , conn );
229
238
conn = parent -> c_passive ;
230
239
} else {
@@ -238,10 +247,26 @@ static struct rds_connection *__rds_conn_create(struct net *net,
238
247
239
248
found = rds_conn_lookup (net , head , laddr , faddr , trans );
240
249
if (found ) {
241
- trans -> conn_free (conn -> c_transport_data );
250
+ struct rds_conn_path * cp ;
251
+ int i ;
252
+
253
+ for (i = 0 ; i < RDS_MPATH_WORKERS ; i ++ ) {
254
+ cp = & conn -> c_path [i ];
255
+ trans -> conn_free (cp -> cp_transport_data );
256
+ if (!trans -> t_mp_capable )
257
+ break ;
258
+ }
242
259
kmem_cache_free (rds_conn_slab , conn );
243
260
conn = found ;
244
261
} else {
262
+ int i ;
263
+
264
+ for (i = 0 ; i < RDS_MPATH_WORKERS ; i ++ ) {
265
+ __rds_conn_path_init (conn , & conn -> c_path [i ],
266
+ is_outgoing );
267
+ conn -> c_path [i ].cp_index = i ;
268
+ }
269
+
245
270
hlist_add_head_rcu (& conn -> c_hash_node , head );
246
271
rds_cong_add_conn (conn );
247
272
rds_conn_count ++ ;
0 commit comments