From af9ca1f590cc38541763e0accc54c2cffe5fb1d0 Mon Sep 17 00:00:00 2001 From: Eldad Zinger Date: Sun, 24 Oct 2010 11:24:27 +0200 Subject: [PATCH] sdp: no point of waiting for data if remote host can't send Signed-off-by: Eldad Zinger --- drivers/infiniband/ulp/sdp/sdp_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/infiniband/ulp/sdp/sdp_main.c b/drivers/infiniband/ulp/sdp/sdp_main.c index d67e8d411c99..946becd4d283 100644 --- a/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/drivers/infiniband/ulp/sdp/sdp_main.c @@ -2389,6 +2389,17 @@ 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) { + /* Remote host can not send, so there is no + * point of waiting for data. + * This situation is possible if current host + * can not send credits-update due to lack of + * memory. + */ + if (!copied) + copied = -ENOMEM; + break; + } posts_handler_put(ssk, 0); sk_wait_data(sk, &timeo); -- 2.50.1