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
This commit is contained in:
John Baldwin 2020-10-19 20:08:50 +00:00
parent 3f3e04a062
commit 6b7ecdcd9d
4 changed files with 3 additions and 18 deletions

View File

@ -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) ||

View File

@ -2045,11 +2045,9 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
#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. */

View File

@ -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 {

View File

@ -1036,8 +1036,6 @@ calc_options2(struct vi_info *vi, struct conn_params *cp)
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));
}