]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
SDP: BUG1309 - SDP close is slow + fix recv buffer initial size setting
authorAmir Vadai <amirv@mellanox.co.il>
Thu, 8 Jan 2009 11:00:16 +0000 (13:00 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:04:23 +0000 (05:04 -0700)
sdp_post_recv is called when the QP is closed. therefore it tries to post
recv buffers without success till the socket is destructed.

Signed-off-by: Amir Vadai <amirv@mellanox.co.il>
drivers/infiniband/ulp/sdp/sdp_bcopy.c

index 53e2d7ed030436a264e735eedfb411a20f0557c4..1288c68e632dc6b39b7065cba61503e611cd5ea9 100644 (file)
@@ -380,9 +380,13 @@ static void sdp_post_recv(struct sdp_sock *ssk)
 
 void sdp_post_recvs(struct sdp_sock *ssk)
 {
+       struct sock *sk = &ssk->isk.sk;
        int scale = ssk->rcvbuf_scale;
-       if (unlikely(!ssk->id))
+
+       if (unlikely(!ssk->id || ((1 << sk->sk_state) & 
+               (TCPF_CLOSE | TCPF_TIME_WAIT)))) {
                return;
+       }
 
        if (top_mem_usage &&
            (top_mem_usage * 0x100000) < atomic_read(&sdp_current_mem_usage) * PAGE_SIZE)
@@ -391,8 +395,7 @@ void sdp_post_recvs(struct sdp_sock *ssk)
        while ((likely(ssk->rx_head - ssk->rx_tail < SDP_RX_SIZE) &&
                (ssk->rx_head - ssk->rx_tail - SDP_MIN_BUFS) *
                (SDP_HEAD_SIZE + ssk->recv_frags * PAGE_SIZE) +
-               ssk->rcv_nxt - ssk->copied_seq <
-               ssk->isk.sk.sk_rcvbuf * scale) ||
+               ssk->rcv_nxt - ssk->copied_seq < sk->sk_rcvbuf * scale) ||
               unlikely(ssk->rx_head - ssk->rx_tail < SDP_MIN_BUFS))
                sdp_post_recv(ssk);
 }
@@ -595,6 +598,7 @@ int sdp_init_buffers(struct sdp_sock *ssk, u32 new_size)
        ssk->recv_frags = PAGE_ALIGN(new_size - SDP_HEAD_SIZE) / PAGE_SIZE;
        if (ssk->recv_frags > SDP_MAX_SEND_SKB_FRAGS)
                ssk->recv_frags = SDP_MAX_SEND_SKB_FRAGS;
+       ssk->rcvbuf_scale = rcvbuf_scale;
 
        sdp_post_recvs(ssk);