diff options
author | Sowmini Varadhan <sowmini.varadhan@oracle.com> | 2017-06-21 16:40:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-22 11:34:04 -0400 |
commit | 69b92b5b7419846e2a0d61a097b11b17a089e046 (patch) | |
tree | dc21d77a3eed374fb5be93efaa1c0b2ebd2d81b9 /net/rds | |
parent | 6d659237657c64e9e2a930865da4c777239b678e (diff) |
rds: tcp: send handshake ping-probe from passive endpoint
The RDS handshake ping probe added by commit 5916e2c1554f
("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).
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Tested-by: Jenny Xu <jenny.x.xu@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds')
-rw-r--r-- | net/rds/rds.h | 1 | ||||
-rw-r--r-- | net/rds/recv.c | 6 | ||||
-rw-r--r-- | net/rds/send.c | 14 | ||||
-rw-r--r-- | net/rds/tcp_listen.c | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/net/rds/rds.h b/net/rds/rds.h index d6a04a05eb79..aa696b361e20 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h | |||
@@ -827,6 +827,7 @@ void rds_send_drop_acked(struct rds_connection *conn, u64 ack, | |||
827 | is_acked_func is_acked); | 827 | is_acked_func is_acked); |
828 | void rds_send_path_drop_acked(struct rds_conn_path *cp, u64 ack, | 828 | void rds_send_path_drop_acked(struct rds_conn_path *cp, u64 ack, |
829 | is_acked_func is_acked); | 829 | is_acked_func is_acked); |
830 | void rds_send_ping(struct rds_connection *conn, int cp_index); | ||
830 | int rds_send_pong(struct rds_conn_path *cp, __be16 dport); | 831 | int rds_send_pong(struct rds_conn_path *cp, __be16 dport); |
831 | 832 | ||
832 | /* rdma.c */ | 833 | /* rdma.c */ |
diff --git a/net/rds/recv.c b/net/rds/recv.c index 49493dbc43a1..373a6aa1d976 100644 --- a/net/rds/recv.c +++ b/net/rds/recv.c | |||
@@ -227,6 +227,7 @@ static void rds_recv_hs_exthdrs(struct rds_header *hdr, | |||
227 | } | 227 | } |
228 | /* if RDS_EXTHDR_NPATHS was not found, default to a single-path */ | 228 | /* if RDS_EXTHDR_NPATHS was not found, default to a single-path */ |
229 | conn->c_npaths = max_t(int, conn->c_npaths, 1); | 229 | conn->c_npaths = max_t(int, conn->c_npaths, 1); |
230 | conn->c_ping_triggered = 0; | ||
230 | rds_conn_peer_gen_update(conn, new_peer_gen_num); | 231 | rds_conn_peer_gen_update(conn, new_peer_gen_num); |
231 | } | 232 | } |
232 | 233 | ||
@@ -244,8 +245,7 @@ static void rds_recv_hs_exthdrs(struct rds_header *hdr, | |||
244 | * called after reception of the probe-pong on all mprds_paths. | 245 | * called after reception of the probe-pong on all mprds_paths. |
245 | * Otherwise (sender of probe-ping is not the smaller ip addr): just call | 246 | * Otherwise (sender of probe-ping is not the smaller ip addr): just call |
246 | * rds_conn_path_connect_if_down on the hashed path. (see rule 4) | 247 | * rds_conn_path_connect_if_down on the hashed path. (see rule 4) |
247 | * 4. when cp_index > 0, rds_connect_worker must only trigger | 248 | * 4. rds_connect_worker must only trigger a connection if laddr < faddr. |
248 | * a connection if laddr < faddr. | ||
249 | * 5. sender may end up queuing the packet on the cp. will get sent out later. | 249 | * 5. sender may end up queuing the packet on the cp. will get sent out later. |
250 | * when connection is completed. | 250 | * when connection is completed. |
251 | */ | 251 | */ |
@@ -256,7 +256,7 @@ static void rds_start_mprds(struct rds_connection *conn) | |||
256 | 256 | ||
257 | if (conn->c_npaths > 1 && | 257 | if (conn->c_npaths > 1 && |
258 | IS_CANONICAL(conn->c_laddr, conn->c_faddr)) { | 258 | IS_CANONICAL(conn->c_laddr, conn->c_faddr)) { |
259 | for (i = 1; i < conn->c_npaths; i++) { | 259 | for (i = 0; i < conn->c_npaths; i++) { |
260 | cp = &conn->c_path[i]; | 260 | cp = &conn->c_path[i]; |
261 | rds_conn_path_connect_if_down(cp); | 261 | rds_conn_path_connect_if_down(cp); |
262 | } | 262 | } |
diff --git a/net/rds/send.c b/net/rds/send.c index 3652a50397c7..e81aa176f4e2 100644 --- a/net/rds/send.c +++ b/net/rds/send.c | |||
@@ -971,8 +971,6 @@ static int rds_cmsg_send(struct rds_sock *rs, struct rds_message *rm, | |||
971 | return ret; | 971 | return ret; |
972 | } | 972 | } |
973 | 973 | ||
974 | static void rds_send_ping(struct rds_connection *conn); | ||
975 | |||
976 | static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn) | 974 | static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn) |
977 | { | 975 | { |
978 | int hash; | 976 | int hash; |
@@ -982,7 +980,7 @@ static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn) | |||
982 | else | 980 | else |
983 | hash = RDS_MPATH_HASH(rs, conn->c_npaths); | 981 | hash = RDS_MPATH_HASH(rs, conn->c_npaths); |
984 | if (conn->c_npaths == 0 && hash != 0) { | 982 | if (conn->c_npaths == 0 && hash != 0) { |
985 | rds_send_ping(conn); | 983 | rds_send_ping(conn, 0); |
986 | 984 | ||
987 | if (conn->c_npaths == 0) { | 985 | if (conn->c_npaths == 0) { |
988 | wait_event_interruptible(conn->c_hs_waitq, | 986 | wait_event_interruptible(conn->c_hs_waitq, |
@@ -1282,11 +1280,11 @@ rds_send_pong(struct rds_conn_path *cp, __be16 dport) | |||
1282 | return rds_send_probe(cp, 0, dport, 0); | 1280 | return rds_send_probe(cp, 0, dport, 0); |
1283 | } | 1281 | } |
1284 | 1282 | ||
1285 | static void | 1283 | void |
1286 | rds_send_ping(struct rds_connection *conn) | 1284 | rds_send_ping(struct rds_connection *conn, int cp_index) |
1287 | { | 1285 | { |
1288 | unsigned long flags; | 1286 | unsigned long flags; |
1289 | struct rds_conn_path *cp = &conn->c_path[0]; | 1287 | struct rds_conn_path *cp = &conn->c_path[cp_index]; |
1290 | 1288 | ||
1291 | spin_lock_irqsave(&cp->cp_lock, flags); | 1289 | spin_lock_irqsave(&cp->cp_lock, flags); |
1292 | if (conn->c_ping_triggered) { | 1290 | if (conn->c_ping_triggered) { |
@@ -1295,6 +1293,6 @@ rds_send_ping(struct rds_connection *conn) | |||
1295 | } | 1293 | } |
1296 | conn->c_ping_triggered = 1; | 1294 | conn->c_ping_triggered = 1; |
1297 | spin_unlock_irqrestore(&cp->cp_lock, flags); | 1295 | spin_unlock_irqrestore(&cp->cp_lock, flags); |
1298 | rds_send_probe(&conn->c_path[0], cpu_to_be16(RDS_FLAG_PROBE_PORT), | 1296 | rds_send_probe(cp, cpu_to_be16(RDS_FLAG_PROBE_PORT), 0, 0); |
1299 | 0, 0); | ||
1300 | } | 1297 | } |
1298 | EXPORT_SYMBOL_GPL(rds_send_ping); | ||
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index df291ac245d6..6089e9a8e00a 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c | |||
@@ -192,6 +192,8 @@ int rds_tcp_accept_one(struct socket *sock) | |||
192 | } | 192 | } |
193 | new_sock = NULL; | 193 | new_sock = NULL; |
194 | ret = 0; | 194 | ret = 0; |
195 | if (conn->c_npaths == 0) | ||
196 | rds_send_ping(cp->cp_conn, cp->cp_index); | ||
195 | goto out; | 197 | goto out; |
196 | rst_nsk: | 198 | rst_nsk: |
197 | /* reset the newly returned accept sock and bail. | 199 | /* reset the newly returned accept sock and bail. |