Skip to content

Commit 5fb4fb5

Browse files
sowminivSomasundaram Krishnasamy
authored andcommitted
rds: tcp: send handshake ping-probe from passive endpoint
The RDS handshake ping probe added by commit 5916e2c ("RDS: TCP: Enable multipath RDS for TCP") is sent from rds_sendmsg() before the first data packet is sent to a peer. If the conversation is not bidirectional (i.e., one side is always passive and never invokes rds_sendmsg()) and the passive side restarts its rds_tcp module, a new HS ping probe needs to be sent, so that the number of paths can be re-established. This patch achieves that by sending a HS ping probe from rds_tcp_accept_one() when c_npaths is 0 (i.e., we have not done a handshake probe with this peer yet). Orabug: 26477841 Signed-off-by: Sowmini Varadhan <[email protected]> Reviewed-by: Yuval Shaia <[email protected]> Orabug: 27364391 (cherry picked from commit a7d089b) cherry-pick-repo=linux-uek.git Signed-off-by: Gerd Rausch <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent d6235f4 commit 5fb4fb5

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

net/rds/rds.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ void rds_send_drop_acked(struct rds_connection *conn, u64 ack,
10631063
void rds_send_path_drop_acked(struct rds_conn_path *cp, u64 ack,
10641064
is_acked_func is_acked);
10651065
void rds_send_remove_from_sock(struct list_head *messages, int status);
1066+
void rds_send_ping(struct rds_connection *conn, int cp_index);
10661067
int rds_send_pong(struct rds_conn_path *cp, __be16 dport);
10671068
int rds_send_hb(struct rds_connection *conn, int response);
10681069
struct rds_message *rds_send_get_message(struct rds_connection *,

net/rds/recv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ static void rds_recv_hs_exthdrs(struct rds_header *hdr,
278278
}
279279
/* if RDS_EXTHDR_NPATHS was not found, default to a single-path */
280280
conn->c_npaths = max_t(int, conn->c_npaths, 1);
281+
conn->c_ping_triggered = 0;
281282
rds_conn_peer_gen_update(conn, new_peer_gen_num);
282283
}
283284

@@ -295,8 +296,7 @@ static void rds_recv_hs_exthdrs(struct rds_header *hdr,
295296
* called after reception of the probe-pong on all mprds_paths.
296297
* Otherwise (sender of probe-ping is not the smaller ip addr): just call
297298
* rds_conn_path_connect_if_down on the hashed path. (see rule 4)
298-
* 4. when cp_index > 0, rds_connect_worker must only trigger
299-
* a connection if laddr < faddr.
299+
* 4. rds_connect_worker must only trigger a connection if laddr < faddr.
300300
* 5. sender may end up queuing the packet on the cp. will get sent out later.
301301
* when connection is completed.
302302
*/
@@ -307,7 +307,7 @@ static void rds_start_mprds(struct rds_connection *conn)
307307

308308
if (conn->c_npaths > 1 &&
309309
IS_CANONICAL(conn->c_laddr, conn->c_faddr)) {
310-
for (i = 1; i < conn->c_npaths; i++) {
310+
for (i = 0; i < conn->c_npaths; i++) {
311311
cp = &conn->c_path[i];
312312
rds_conn_path_connect_if_down(cp);
313313
}

net/rds/send.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,8 +1178,6 @@ static inline int rds_rdma_bytes(struct msghdr *msg, size_t *rdma_bytes)
11781178
return 0;
11791179
}
11801180

1181-
static void rds_send_ping(struct rds_connection *conn);
1182-
11831181
static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn)
11841182
{
11851183
int hash;
@@ -1189,7 +1187,7 @@ static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn)
11891187
else
11901188
hash = RDS_MPATH_HASH(rs, conn->c_npaths);
11911189
if (conn->c_npaths == 0 && hash != 0) {
1192-
rds_send_ping(conn);
1190+
rds_send_ping(conn, 0);
11931191

11941192
if (conn->c_npaths == 0) {
11951193
wait_event_interruptible(conn->c_hs_waitq,
@@ -1725,10 +1723,10 @@ rds_send_pong(struct rds_conn_path *cp, __be16 dport)
17251723
}
17261724

17271725
void
1728-
rds_send_ping(struct rds_connection *conn)
1726+
rds_send_ping(struct rds_connection *conn, int cp_index)
17291727
{
17301728
unsigned long flags;
1731-
struct rds_conn_path *cp = &conn->c_path[0];
1729+
struct rds_conn_path *cp = &conn->c_path[cp_index];
17321730

17331731
spin_lock_irqsave(&cp->cp_lock, flags);
17341732
if (conn->c_ping_triggered) {
@@ -1737,6 +1735,6 @@ rds_send_ping(struct rds_connection *conn)
17371735
}
17381736
conn->c_ping_triggered = 1;
17391737
spin_unlock_irqrestore(&cp->cp_lock, flags);
1740-
rds_send_probe(&conn->c_path[0], cpu_to_be16(RDS_FLAG_PROBE_PORT),
1741-
0, 0);
1738+
rds_send_probe(cp, cpu_to_be16(RDS_FLAG_PROBE_PORT), 0, 0);
17421739
}
1740+
EXPORT_SYMBOL_GPL(rds_send_ping);

net/rds/tcp_listen.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ int rds_tcp_accept_one(struct socket *sock)
185185
}
186186
new_sock = NULL;
187187
ret = 0;
188+
if (conn->c_npaths == 0)
189+
rds_send_ping(cp->cp_conn, cp->cp_index);
188190
goto out;
189191
rst_nsk:
190192
/* reset the newly returned accept sock and bail.

0 commit comments

Comments
 (0)