]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sdp: add [rt]x_bytes counters to sdpstats
authorAmir Vadai <amirv@mellanox.co.il>
Tue, 3 Apr 2012 10:52:45 +0000 (13:52 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:05:51 +0000 (05:05 -0700)
Those counter shows how many bytes actually rx/tx using SDP sockets.

Signed-off-by: Amir Vadai <amirv@mellanox.co.il>
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
drivers/infiniband/ulp/sdp/sdp.h
drivers/infiniband/ulp/sdp/sdp_main.c
drivers/infiniband/ulp/sdp/sdp_proc.c

index 02cf8f0e6f42797b3f257ecd46cb4fd7d31ee159..6213f794e54c34908e9e7c666fcfbd86506e7df0 100644 (file)
@@ -772,6 +772,8 @@ static inline int credit_update_needed(struct sdp_sock *ssk)
 
 #define SDPSTATS_MAX_HIST_SIZE 256
 struct sdpstats {
+       u64 rx_bytes;
+       u64 tx_bytes;
        u32 post_send[256];
        u32 inline_sends;
        u32 sendmsg_bcopy_segment;
index c26f6aff6c223f919899e53f14ce331e66ad8de8..9287003e02b00d4f0698512bce5a281ee123cff8 100644 (file)
@@ -2018,6 +2018,8 @@ out:
        err = copied;
 
        sdp_dbg_data(sk, "copied: 0x%x\n", copied);
+       if (copied > 0)
+               SDPSTATS_COUNTER_ADD(tx_bytes, copied);
 
        goto fin;
 
@@ -2442,6 +2444,8 @@ found_fin_ok:
 
 got_disconn_in_peek:
        err = copied;
+       if (copied > 0)
+               SDPSTATS_COUNTER_ADD(rx_bytes, copied);
 out:
 
        posts_handler_put(ssk, SDP_RX_ARMING_DELAY);
index e502b37f85815bdc6ba1019f41e4793066ae4b07..fa0a9875985aaf107b06320b87d7713c67538d98 100644 (file)
@@ -314,13 +314,15 @@ static void sdpstats_seq_hist(struct seq_file *seq, char *str, u32 *h, int n,
        }
 }
 
-#define SDPSTATS_COUNTER_GET(var) ({ \
-       u32 __val = 0;                                          \
+#define _SDPSTATS_COUNTER_GET(var, _type) ({ \
+       _type __val = 0;                                                \
        unsigned int __i;                                       \
        for_each_possible_cpu(__i)                              \
                __val += per_cpu(sdpstats, __i).var;            \
        __val;                                                  \
 })
+#define SDPSTATS_COUNTER_GET(var) _SDPSTATS_COUNTER_GET(var, u32)
+#define SDPSTATS_COUNTER_GET64(var) _SDPSTATS_COUNTER_GET(var, u64)
 
 #define SDPSTATS_HIST_GET(hist, hist_len, sum) ({ \
        unsigned int __i;                                       \
@@ -360,6 +362,11 @@ static int sdpstats_seq_show(struct seq_file *seq, void *v)
 
        seq_printf(seq, "SDP statistics:\n");
 
+       seq_printf(seq, "rx_bytes\t\t: %llu\n",
+               SDPSTATS_COUNTER_GET64(rx_bytes));
+       seq_printf(seq, "tx_bytes\t\t: %llu\n",
+               SDPSTATS_COUNTER_GET64(tx_bytes));
+
        __sdpstats_seq_hist(seq, "sendmsg_seglen", sendmsg_seglen, 1);
        __sdpstats_seq_hist(seq, "send_size", send_size, 1);
        __sdpstats_seq_hist(seq, "credits_before_update",