From owner-svn-src-all@FreeBSD.ORG Sat Jun 6 18:31:29 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3493E424; Sat, 6 Jun 2015 18:31:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 088531293; Sat, 6 Jun 2015 18:31:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t56IVS11097867; Sat, 6 Jun 2015 18:31:28 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t56IVSRQ097866; Sat, 6 Jun 2015 18:31:28 GMT (envelope-from np@FreeBSD.org) Message-Id: <201506061831.t56IVSRQ097866@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 6 Jun 2015 18:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284092 - stable/10/sys/dev/cxgbe/tom X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jun 2015 18:31:29 -0000 Author: np Date: Sat Jun 6 18:31:28 2015 New Revision: 284092 URL: https://svnweb.freebsd.org/changeset/base/284092 Log: MFC r280878: cxgbe/tom: return rx credits promptly if the socket buffer's low water mark cannot be reached because the window advertised to the peer isn't wide enough. While here, tweak the normal credit return too. Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Jun 6 18:21:16 2015 (r284091) +++ stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Jun 6 18:31:28 2015 (r284092) @@ -390,19 +390,17 @@ t4_rcvd(struct toedev *tod, struct tcpcb toep->rx_credits += toep->sb_cc - sb->sb_cc; toep->sb_cc = sb->sb_cc; } - credits = toep->rx_credits; - SOCKBUF_UNLOCK(sb); - - if (credits > 0 && - (credits + 16384 >= tp->rcv_wnd || credits >= 15 * 1024)) { + if (toep->rx_credits > 0 && + (tp->rcv_wnd <= 32 * 1024 || toep->rx_credits >= 64 * 1024 || + (toep->rx_credits >= 16 * 1024 && tp->rcv_wnd <= 128 * 1024) || + toep->sb_cc + tp->rcv_wnd < sb->sb_lowat)) { - credits = send_rx_credits(sc, toep, credits); - SOCKBUF_LOCK(sb); + credits = send_rx_credits(sc, toep, toep->rx_credits); toep->rx_credits -= credits; - SOCKBUF_UNLOCK(sb); tp->rcv_wnd += credits; tp->rcv_adv += credits; } + SOCKBUF_UNLOCK(sb); } /* @@ -1618,6 +1616,14 @@ do_rx_data(struct sge_iq *iq, const stru toep->rx_credits += toep->sb_cc - sb->sb_cc; sbappendstream_locked(sb, m); toep->sb_cc = sb->sb_cc; + if (toep->rx_credits > 0 && toep->sb_cc + tp->rcv_wnd < sb->sb_lowat) { + int credits; + + credits = send_rx_credits(sc, toep, toep->rx_credits); + toep->rx_credits -= credits; + tp->rcv_wnd += credits; + tp->rcv_adv += credits; + } sorwakeup_locked(so); SOCKBUF_UNLOCK_ASSERT(sb);