aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index c458f8d1d6d1..4b4e7dfdff14 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -382,6 +382,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
382 /* If we've sent the entire packet, immediately 382 /* If we've sent the entire packet, immediately
383 * reset the count of bytes sent. */ 383 * reset the count of bytes sent. */
384 req->rq_bytes_sent += status; 384 req->rq_bytes_sent += status;
385 task->tk_bytes_sent += status;
385 if (likely(req->rq_bytes_sent >= req->rq_slen)) { 386 if (likely(req->rq_bytes_sent >= req->rq_slen)) {
386 req->rq_bytes_sent = 0; 387 req->rq_bytes_sent = 0;
387 return 0; 388 return 0;
@@ -1114,6 +1115,8 @@ static void xs_tcp_connect_worker(void *args)
1114 } 1115 }
1115 1116
1116 /* Tell the socket layer to start connecting... */ 1117 /* Tell the socket layer to start connecting... */
1118 xprt->stat.connect_count++;
1119 xprt->stat.connect_start = jiffies;
1117 status = sock->ops->connect(sock, (struct sockaddr *) &xprt->addr, 1120 status = sock->ops->connect(sock, (struct sockaddr *) &xprt->addr,
1118 sizeof(xprt->addr), O_NONBLOCK); 1121 sizeof(xprt->addr), O_NONBLOCK);
1119 dprintk("RPC: %p connect status %d connected %d sock state %d\n", 1122 dprintk("RPC: %p connect status %d connected %d sock state %d\n",
@@ -1177,6 +1180,50 @@ static void xs_connect(struct rpc_task *task)
1177 } 1180 }
1178} 1181}
1179 1182
1183/**
1184 * xs_udp_print_stats - display UDP socket-specifc stats
1185 * @xprt: rpc_xprt struct containing statistics
1186 * @seq: output file
1187 *
1188 */
1189static void xs_udp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
1190{
1191 seq_printf(seq, "\txprt:\tudp %u %lu %lu %lu %lu %Lu %Lu\n",
1192 xprt->port,
1193 xprt->stat.bind_count,
1194 xprt->stat.sends,
1195 xprt->stat.recvs,
1196 xprt->stat.bad_xids,
1197 xprt->stat.req_u,
1198 xprt->stat.bklog_u);
1199}
1200
1201/**
1202 * xs_tcp_print_stats - display TCP socket-specifc stats
1203 * @xprt: rpc_xprt struct containing statistics
1204 * @seq: output file
1205 *
1206 */
1207static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
1208{
1209 long idle_time = 0;
1210
1211 if (xprt_connected(xprt))
1212 idle_time = (long)(jiffies - xprt->last_used) / HZ;
1213
1214 seq_printf(seq, "\txprt:\ttcp %u %lu %lu %lu %ld %lu %lu %lu %Lu %Lu\n",
1215 xprt->port,
1216 xprt->stat.bind_count,
1217 xprt->stat.connect_count,
1218 xprt->stat.connect_time,
1219 idle_time,
1220 xprt->stat.sends,
1221 xprt->stat.recvs,
1222 xprt->stat.bad_xids,
1223 xprt->stat.req_u,
1224 xprt->stat.bklog_u);
1225}
1226
1180static struct rpc_xprt_ops xs_udp_ops = { 1227static struct rpc_xprt_ops xs_udp_ops = {
1181 .set_buffer_size = xs_udp_set_buffer_size, 1228 .set_buffer_size = xs_udp_set_buffer_size,
1182 .reserve_xprt = xprt_reserve_xprt_cong, 1229 .reserve_xprt = xprt_reserve_xprt_cong,
@@ -1191,6 +1238,7 @@ static struct rpc_xprt_ops xs_udp_ops = {
1191 .release_request = xprt_release_rqst_cong, 1238 .release_request = xprt_release_rqst_cong,
1192 .close = xs_close, 1239 .close = xs_close,
1193 .destroy = xs_destroy, 1240 .destroy = xs_destroy,
1241 .print_stats = xs_udp_print_stats,
1194}; 1242};
1195 1243
1196static struct rpc_xprt_ops xs_tcp_ops = { 1244static struct rpc_xprt_ops xs_tcp_ops = {
@@ -1204,6 +1252,7 @@ static struct rpc_xprt_ops xs_tcp_ops = {
1204 .set_retrans_timeout = xprt_set_retrans_timeout_def, 1252 .set_retrans_timeout = xprt_set_retrans_timeout_def,
1205 .close = xs_close, 1253 .close = xs_close,
1206 .destroy = xs_destroy, 1254 .destroy = xs_destroy,
1255 .print_stats = xs_tcp_print_stats,
1207}; 1256};
1208 1257
1209/** 1258/**