Author: jhb
Date: Mon Oct 19 20:08:50 2020
New Revision: 366854
URL: https://svnweb.freebsd.org/changeset/base/366854

Log:
  Re-enable receive flow control for TOE TLS sockets.
  
  Flow control was disabled during initial TOE TLS development to
  workaround a hang (and to match the Linux TOE TLS support for T6).
  The rest of the TOE TLS code maintained credits as if flow control was
  enabled which was inherited from before the workaround was added with
  the exception that the receive window was allowed to go negative.
  This negative receive window handling (rcv_over) was because I hadn't
  realized the full implications of disabling flow control.
  
  To clean this up, re-enable flow control on TOE TLS sockets.  The
  existing TPF_FORCE_CREDITS workaround is sufficient for the original
  hang.  Now that flow control is enabled, remove the rcv_over
  workaround and instead assert that the receive window never goes
  negative matching plain TCP TOE sockets.
  
  Reviewed by:  np
  MFC after:    2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:        https://reviews.freebsd.org/D26799

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/dev/cxgbe/tom/t4_tls.h
  head/sys/dev/cxgbe/tom/t4_tom.c

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Mon Oct 19 20:08:47 2020        
(r366853)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Mon Oct 19 20:08:50 2020        
(r366854)
@@ -446,16 +446,6 @@ t4_rcvd_locked(struct toedev *tod, struct tcpcb *tp)
        SOCKBUF_LOCK_ASSERT(sb);
 
        rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0;
-       if (ulp_mode(toep) == ULP_MODE_TLS) {
-               if (toep->tls.rcv_over >= rx_credits) {
-                       toep->tls.rcv_over -= rx_credits;
-                       rx_credits = 0;
-               } else {
-                       rx_credits -= toep->tls.rcv_over;
-                       toep->tls.rcv_over = 0;
-               }
-       }
-
        if (rx_credits > 0 &&
            (tp->rcv_wnd <= 32 * 1024 || rx_credits >= 64 * 1024 ||
            (rx_credits >= 16 * 1024 && tp->rcv_wnd <= 128 * 1024) ||

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tls.c     Mon Oct 19 20:08:47 2020        
(r366853)
+++ head/sys/dev/cxgbe/tom/t4_tls.c     Mon Oct 19 20:08:50 2020        
(r366854)
@@ -2045,11 +2045,9 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head
 #endif
 
        tp->rcv_nxt += pdu_length;
-       if (tp->rcv_wnd < pdu_length) {
-               toep->tls.rcv_over += pdu_length - tp->rcv_wnd;
-               tp->rcv_wnd = 0;
-       } else
-               tp->rcv_wnd -= pdu_length;
+       KASSERT(tp->rcv_wnd >= pdu_length,
+           ("%s: negative window size", __func__));
+       tp->rcv_wnd -= pdu_length;
 
        /* XXX: Not sure what to do about urgent data. */
 

Modified: head/sys/dev/cxgbe/tom/t4_tls.h
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tls.h     Mon Oct 19 20:08:47 2020        
(r366853)
+++ head/sys/dev/cxgbe/tom/t4_tls.h     Mon Oct 19 20:08:50 2020        
(r366854)
@@ -276,7 +276,6 @@ struct tls_ofld_info {
        enum tls_mode mode;
        struct callout handshake_timer;
        u_int sb_off;
-       u_int rcv_over;
 };
 
 struct tls_key_req {

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.c     Mon Oct 19 20:08:47 2020        
(r366853)
+++ head/sys/dev/cxgbe/tom/t4_tom.c     Mon Oct 19 20:08:50 2020        
(r366854)
@@ -1036,8 +1036,6 @@ calc_options2(struct vi_info *vi, struct conn_params *
        if (cp->ulp_mode == ULP_MODE_TCPDDP)
                opt2 |= F_RX_FC_DDP;
 #endif
-       if (cp->ulp_mode == ULP_MODE_TLS)
-               opt2 |= F_RX_FC_DISABLE;
 
        return (htobe32(opt2));
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to