rxrpc: Record stats for why the REQUEST-ACK flag is being set
authorDavid Howells <dhowells@redhat.com>
Thu, 18 Aug 2022 10:52:36 +0000 (11:52 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 8 Nov 2022 16:42:15 +0000 (16:42 +0000)
Record stats for why the REQUEST-ACK flag is being set.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org

include/trace/events/rxrpc.h
net/rxrpc/ar-internal.h
net/rxrpc/output.c
net/rxrpc/proc.c

index a72f04e3d264386581e46e5fbeac42e19b873c6c..794523d15321127562126508c908207dadf3c878 100644 (file)
        EM(rxrpc_reqack_retrans,                "RETRANS   ")   \
        EM(rxrpc_reqack_slow_start,             "SLOW-START")   \
        E_(rxrpc_reqack_small_txwin,            "SMALL-TXWN")
+/* ---- Must update size of stat_why_req_ack[] if more are added! */
 
 /*
  * Generate enums for tracing information.
index 8ed707a11d43f26f7b875ff9b22c4bdcb631731e..436a1e8d0abd3ed148cbd18b58cabea412d48ed6 100644 (file)
@@ -107,6 +107,8 @@ struct rxrpc_net {
        atomic_t                stat_tx_ack_skip;
        atomic_t                stat_tx_acks[256];
        atomic_t                stat_rx_acks[256];
+
+       atomic_t                stat_why_req_ack[8];
 };
 
 /*
index f350d39e3a603a0ee9d5db83aa0cc8cb02bea28f..77ed46ab33c526a136bc446562c6022b23a61e48 100644 (file)
@@ -430,6 +430,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
        else
                goto dont_set_request_ack;
 
+       rxrpc_inc_stat(call->rxnet, stat_why_req_ack[why]);
        trace_rxrpc_req_ack(call->debug_id, sp->hdr.seq, why);
        if (why != rxrpc_reqack_no_srv_last)
                whdr.flags |= RXRPC_REQUEST_ACK;
index 488c403f1d33c29c2a212134fec43439a36fdaea..9bd357f39c39de5f87746321a8e7ba51a8540217 100644 (file)
@@ -445,6 +445,18 @@ int rxrpc_stats_show(struct seq_file *seq, void *v)
                   atomic_read(&rxnet->stat_rx_acks[RXRPC_ACK_PING_RESPONSE]),
                   atomic_read(&rxnet->stat_rx_acks[RXRPC_ACK_DELAY]),
                   atomic_read(&rxnet->stat_rx_acks[RXRPC_ACK_IDLE]));
+       seq_printf(seq,
+                  "Why-Req-A: acklost=%u already=%u mrtt=%u ortt=%u\n",
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_ack_lost]),
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_already_on]),
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_more_rtt]),
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_old_rtt]));
+       seq_printf(seq,
+                  "Why-Req-A: nolast=%u retx=%u slows=%u smtxw=%u\n",
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_no_srv_last]),
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_retrans]),
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_slow_start]),
+                  atomic_read(&rxnet->stat_why_req_ack[rxrpc_reqack_small_txwin]));
        seq_printf(seq,
                   "Buffers  : txb=%u rxb=%u\n",
                   atomic_read(&rxrpc_n_tx_skbs),
@@ -476,5 +488,7 @@ int rxrpc_stats_clear(struct file *file, char *buf, size_t size)
        atomic_set(&rxnet->stat_tx_ack_skip, 0);
        memset(&rxnet->stat_tx_acks, 0, sizeof(rxnet->stat_tx_acks));
        memset(&rxnet->stat_rx_acks, 0, sizeof(rxnet->stat_rx_acks));
+
+       memset(&rxnet->stat_why_req_ack, 0, sizeof(rxnet->stat_why_req_ack));
        return size;
 }