summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorOlga Kornievskaia <kolga@netapp.com>2021-06-23 23:28:49 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-07-08 14:03:24 -0400
commitc1830a63c79aa90f725ed6feaad097473f2b990d (patch)
treeeff67aca1b9aabb8923be2f08818c937ef9f4d8b /net
parenta8482488a7d6d320f63a9ee1912dbb5ae5b80a61 (diff)
SUNRPC for TCP display xprt's source port in sysfs xprt_info
Using TCP connection's source port it is useful to match connections seen on the network traces to the xprts used by the linux nfs client. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/sysfs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c
index 124f2e1e3409..08aa503295b7 100644
--- a/net/sunrpc/sysfs.c
+++ b/net/sunrpc/sysfs.c
@@ -5,6 +5,7 @@
#include <linux/sunrpc/clnt.h>
#include <linux/kobject.h>
#include <linux/sunrpc/addr.h>
+#include <linux/sunrpc/xprtsock.h>
#include "sysfs.h"
@@ -103,10 +104,13 @@ static ssize_t rpc_sysfs_xprt_info_show(struct kobject *kobj,
ret = sprintf(buf, "last_used=%lu\ncur_cong=%lu\ncong_win=%lu\n"
"max_num_slots=%u\nmin_num_slots=%u\nnum_reqs=%u\n"
"binding_q_len=%u\nsending_q_len=%u\npending_q_len=%u\n"
- "backlog_q_len=%u\nmain_xprt=%d\n", xprt->last_used,
- xprt->cong, xprt->cwnd, xprt->max_reqs, xprt->min_reqs,
- xprt->num_reqs, xprt->binding.qlen, xprt->sending.qlen,
- xprt->pending.qlen, xprt->backlog.qlen, xprt->main);
+ "backlog_q_len=%u\nmain_xprt=%d\nsrc_port=%u\n",
+ xprt->last_used, xprt->cong, xprt->cwnd, xprt->max_reqs,
+ xprt->min_reqs, xprt->num_reqs, xprt->binding.qlen,
+ xprt->sending.qlen, xprt->pending.qlen,
+ xprt->backlog.qlen, xprt->main,
+ (xprt->xprt_class->ident == XPRT_TRANSPORT_TCP) ?
+ get_srcport(xprt) : 0);
xprt_put(xprt);
return ret + 1;
}