Skip to content

Commit 2348372

Browse files
Hakon-BuggeSomasundaram Krishnasamy
authored andcommitted
rds: Fix and augment probe counters
Prior to commit 041dc3e ("Backport multipath RDS from upstream to UEK4"), there was a function called rds_send_pong that incremented the statistics counter s_send_pong. After said commit, the function was re-factored and renamed to rds_send_probe. It was used as a helper function to send pongs, heartbeat pings, and heartbeat pongs. But it still, incorrectly now, incremented s_send_pong. Fixes the above in addition to introducing the full matrix of counters for {send,recv}_[{hb_,mprds_}]{ping,pong}. Orabug: 30418039 Fixes: 041dc3e ("Backport multipath RDS from upstream to UEK4") Signed-off-by: Håkon Bugge <[email protected]> Tested-by: Michael Nowak <[email protected]> Reviewed-by: Ka-Cheong Poon <[email protected]> --- v1->v2: * Removed MPRDS handshake probes from the statistics * Moved increment of s_send_ping to rds_sendmsg() for simplicity, as suggested by Ka-Cheong * Added Mike's t-b v2->v3: * Added separate counters for MPRDS handshakes, as per discussion with Ka-Cheong * Fixed a glitch where MPRDS handshakes would be logged as illegal probes, as detected by Ka-Cheong v3->v4: * Re-factored the statistics counting in rds_send_probe() and moved them to the respective functions calling rds_send_probe() * Added Ka-Cheong's r-b Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 57b8368 commit 2348372

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

net/rds/rds.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,11 @@ struct rds_statistics {
914914
uint64_t s_recv_ack_required;
915915
uint64_t s_recv_rdma_bytes;
916916
uint64_t s_recv_ping;
917+
uint64_t s_recv_pong;
918+
uint64_t s_recv_hb_ping;
919+
uint64_t s_recv_hb_pong;
920+
uint64_t s_recv_mprds_ping;
921+
uint64_t s_recv_mprds_pong;
917922
uint64_t s_send_queue_empty;
918923
uint64_t s_send_queue_full;
919924
uint64_t s_send_lock_contention;
@@ -925,7 +930,12 @@ struct rds_statistics {
925930
uint64_t s_send_queued;
926931
uint64_t s_send_rdma;
927932
uint64_t s_send_rdma_bytes;
933+
uint64_t s_send_ping;
928934
uint64_t s_send_pong;
935+
uint64_t s_send_hb_ping;
936+
uint64_t s_send_hb_pong;
937+
uint64_t s_send_mprds_ping;
938+
uint64_t s_send_mprds_pong;
929939
uint64_t s_page_remainder_hit;
930940
uint64_t s_page_remainder_miss;
931941
uint64_t s_copy_to_user;

net/rds/recv.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,11 +700,17 @@ rds_recv_local(struct rds_conn_path *cp, struct in6_addr *saddr,
700700
goto out;
701701
}
702702
if (is_hb_ping) {
703+
rds_stats_inc(s_recv_hb_ping);
703704
rds_send_hb(conn, 1);
704705
} else if (is_hb_pong) {
706+
rds_stats_inc(s_recv_hb_pong);
705707
cp->cp_hb_start = 0;
706708
} else {
707-
rds_stats_inc(s_recv_ping);
709+
if (be16_to_cpu(inc->i_hdr.h_sport) == RDS_FLAG_PROBE_PORT)
710+
rds_stats_inc(s_recv_mprds_ping);
711+
else
712+
rds_stats_inc(s_recv_ping);
713+
708714
rds_send_pong(cp, inc->i_hdr.h_sport);
709715
/* if this is a handshake ping,
710716
* start multipath if necessary
@@ -721,13 +727,17 @@ rds_recv_local(struct rds_conn_path *cp, struct in6_addr *saddr,
721727
if (conn->c_trans->t_mp_capable &&
722728
be16_to_cpu(inc->i_hdr.h_dport) == RDS_FLAG_PROBE_PORT &&
723729
inc->i_hdr.h_sport == 0) {
730+
rds_stats_inc(s_recv_mprds_pong);
724731
rds_recv_hs_exthdrs(&inc->i_hdr, cp->cp_conn);
725732
/* if this is a handshake pong, start multipath if necessary */
726733
rds_start_mprds(cp->cp_conn);
727734
wake_up(&cp->cp_conn->c_hs_waitq);
728735
goto out;
729736
}
730737

738+
if (!inc->i_hdr.h_sport)
739+
rds_stats_inc(s_recv_pong);
740+
731741
if (!rs)
732742
rs = rds_find_bound(daddr, inc->i_hdr.h_dport,
733743
conn->c_bound_if);

net/rds/send.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,9 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
16281628
*/
16291629
rds_stats_inc(s_send_queued);
16301630

1631+
if (!dport)
1632+
rds_stats_inc(s_send_ping);
1633+
16311634
ret = rds_send_xmit(cpath);
16321635
if (ret == -ENOMEM || ret == -EAGAIN)
16331636
rds_cond_queue_send_work(cpath, 1);
@@ -1850,7 +1853,6 @@ static int rds_send_probe(struct rds_conn_path *cp, __be16 sport,
18501853
spin_unlock_irqrestore(&cp->cp_lock, flags);
18511854

18521855
rds_stats_inc(s_send_queued);
1853-
rds_stats_inc(s_send_pong);
18541856

18551857
if (!test_bit(RDS_LL_SEND_FULL, &cp->cp_flags))
18561858
rds_cond_queue_send_work(cp, 0);
@@ -1872,10 +1874,13 @@ rds_send_hb(struct rds_connection *conn, int response)
18721874
if (conn->c_trans->t_type == RDS_TRANS_TCP)
18731875
return 0;
18741876

1875-
if (response)
1877+
if (response) {
18761878
flags |= RDS_FLAG_HB_PONG;
1877-
else
1879+
rds_stats_inc(s_send_hb_pong);
1880+
} else {
18781881
flags |= RDS_FLAG_HB_PING;
1882+
rds_stats_inc(s_send_hb_ping);
1883+
}
18791884
flags |= RDS_FLAG_ACK_REQUIRED;
18801885

18811886
rds_send_probe(&conn->c_path[0], 0, 0, flags);
@@ -1886,6 +1891,11 @@ rds_send_hb(struct rds_connection *conn, int response)
18861891
int
18871892
rds_send_pong(struct rds_conn_path *cp, __be16 dport)
18881893
{
1894+
if (be16_to_cpu(dport) == RDS_FLAG_PROBE_PORT)
1895+
rds_stats_inc(s_send_mprds_pong);
1896+
else
1897+
rds_stats_inc(s_send_pong);
1898+
18891899
return rds_send_probe(cp, 0, dport, 0);
18901900
}
18911901

@@ -1901,7 +1911,9 @@ rds_send_ping(struct rds_connection *conn, int cp_index)
19011911
return;
19021912
}
19031913
conn->c_ping_triggered = 1;
1914+
19041915
spin_unlock_irqrestore(&cp->cp_lock, flags);
1916+
rds_stats_inc(s_send_mprds_ping);
19051917
rds_send_probe(cp, cpu_to_be16(RDS_FLAG_PROBE_PORT), 0, 0);
19061918
}
19071919
EXPORT_SYMBOL_GPL(rds_send_ping);

net/rds/stats.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ static char *rds_stat_names[] = {
5555
"recv_ack_required",
5656
"recv_rdma_bytes",
5757
"recv_ping",
58+
"recv_pong",
59+
"recv_hb_ping",
60+
"recv_hb_pong",
61+
"recv_mprds_ping",
62+
"recv_mprds_pong",
5863
"send_queue_empty",
5964
"send_queue_full",
6065
"send_lock_contention",
@@ -66,7 +71,12 @@ static char *rds_stat_names[] = {
6671
"send_queued",
6772
"send_rdma",
6873
"send_rdma_bytes",
74+
"send_ping",
6975
"send_pong",
76+
"send_hb_ping",
77+
"send_hb_pong",
78+
"send_mprds_ping",
79+
"send_mprds_pong",
7080
"page_remainder_hit",
7181
"page_remainder_miss",
7282
"copy_to_user",

0 commit comments

Comments
 (0)