git: 7916bb5cdf86 - releng/14.0 - cxgbe tom: Call t4_rcvd_locked from do_rx_data to return RX credits

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 16 Oct 2023 23:05:14 UTC
The branch releng/14.0 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=7916bb5cdf86d01f4e4c5049260af64ac02534d4

commit 7916bb5cdf86d01f4e4c5049260af64ac02534d4
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-09-08 23:30:35 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-10-16 23:04:33 +0000

    cxgbe tom: Call t4_rcvd_locked from do_rx_data to return RX credits
    
    In particular, the kernel RPC layer used by the NFS client never
    invokes pru_rcvd since it always reads data from the socket upcall
    via MSG_SOCALLBCK which avoids calling pru_rcvd.  As a result, on an
    NFS client connection managed by t4_tom, RX credits were never
    returned to the TOE connection to open the TCP window resulting in
    connection hangs.
    
    To fix, expand the set of conditions in do_rx_data where RX credits
    are returned to match those in t4_rcvd_locked by calling the function
    directly.
    
    Reviewed by:    np
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D41688
    
    (cherry picked from commit dcfddc8dc091e7688abc8488a0307eba425fa7a2)
    (cherry picked from commit bd8cecc466adeca0763cca674f83bfcc3a751356)
    
    Approved by:    re (karels)
---
 sys/dev/cxgbe/tom/t4_cpl_io.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index 9b48b2891f64..235d4196226d 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -1647,7 +1647,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 	struct socket *so;
 	struct sockbuf *sb;
 	struct epoch_tracker et;
-	int len, rx_credits;
+	int len;
 	uint32_t ddp_placed = 0;
 
 	if (__predict_false(toep->flags & TPF_SYNQE)) {
@@ -1779,12 +1779,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 	}
 
 	sbappendstream_locked(sb, m, 0);
-	rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0;
-	if (rx_credits > 0 && sbused(sb) + tp->rcv_wnd < sb->sb_lowat) {
-		rx_credits = send_rx_credits(sc, toep, rx_credits);
-		tp->rcv_wnd += rx_credits;
-		tp->rcv_adv += rx_credits;
-	}
+	t4_rcvd_locked(&toep->td->tod, tp);
 
 	if (ulp_mode(toep) == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 &&
 	    sbavail(sb) != 0) {