From 9c715f33fcc61b862592a26311638e5c3fe86ca2 Mon Sep 17 00:00:00 2001 From: Amir Vadai Date: Sun, 20 Mar 2011 17:25:02 +0200 Subject: [PATCH] sdp: Fixed bcopy statistics Signed-off-by: Amir Vadai --- drivers/infiniband/ulp/sdp/sdp_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/sdp/sdp_main.c b/drivers/infiniband/ulp/sdp/sdp_main.c index d9d8ca8a717f..023d92a40b24 100644 --- a/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/drivers/infiniband/ulp/sdp/sdp_main.c @@ -1907,6 +1907,8 @@ static int sdp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, sdp_dbg_data(sk, "ZCopied: 0x%x/0x%x\n", zcopied, seglen); } + SDPSTATS_COUNTER_INC(sendmsg_bcopy_segment); + while (seglen > 0) { int copy; @@ -2301,7 +2303,9 @@ sdp_mid_data: if (poll_recv_cq(sk)) { sdp_dbg_data(sk, "sk_wait_data %ld\n", timeo); - if (remote_credits(ssk) < SDP_MIN_TX_CREDITS) { + posts_handler_put(ssk, 0); + + if (remote_credits(ssk) <= SDP_MIN_TX_CREDITS) { /* Remote host can not send, so there is no * point of waiting for data. * This situation is possible if current host @@ -2312,10 +2316,10 @@ sdp_mid_data: copied = -ENOMEM; sdp_warn(sk, "out of credits\n"); } + posts_handler_get(ssk); break; } - posts_handler_put(ssk, 0); sk_wait_data(sk, &timeo); posts_handler_get(ssk); -- 2.50.1