Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Aug 2021 23:25:37 GMT
From:      Andrew Gallatin <gallatin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 739de953ecc1 - main - ktls: Move KERN_TLS ifdef to tcp_var.h
Message-ID:  <202108052325.175NPbZG035136@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by gallatin:

URL: https://cgit.FreeBSD.org/src/commit/?id=739de953ecc13afa930e2f55b7ee2a04e41e3519

commit 739de953ecc13afa930e2f55b7ee2a04e41e3519
Author:     Andrew Gallatin <gallatin@FreeBSD.org>
AuthorDate: 2021-08-05 23:17:35 +0000
Commit:     Andrew Gallatin <gallatin@FreeBSD.org>
CommitDate: 2021-08-05 23:17:35 +0000

    ktls: Move KERN_TLS ifdef to tcp_var.h
    
    This allows us to remove stubs in ktls.h and allows us
    to sort the function prototypes.
    
    Reviewed by: jhb
    Sponsored by: Netflix
---
 sys/netinet/tcp_var.h |  6 +++---
 sys/sys/ktls.h        | 14 +++-----------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 8cfd2c5417c2..64e954cf4ad5 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1144,8 +1144,6 @@ static inline void
 tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt,
     uint8_t is_tlp, int hw_tls)
 {
-	uint64_t rexmit_percent;
-
 	if (is_tlp) {
 		tp->t_sndtlppack++;
 		tp->t_sndtlpbyte += len;
@@ -1156,11 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt,
 	else
 		tp->t_sndbytes += len;
 
+#ifdef KERN_TLS
 	if (hw_tls && is_rxt) {
-		rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * (tp->t_snd_rxt_bytes + tp->t_sndbytes));
+		uint64_t rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * (tp->t_snd_rxt_bytes + tp->t_sndbytes));
 		if (rexmit_percent > ktls_ifnet_max_rexmit_pct)
 			ktls_disable_ifnet(tp);
 	}
+#endif
 
 }
 #endif /* _KERNEL */
diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h
index a4156eb10395..437e36f965ea 100644
--- a/sys/sys/ktls.h
+++ b/sys/sys/ktls.h
@@ -197,7 +197,10 @@ struct ktls_session {
 	bool disable_ifnet_pending;
 } __aligned(CACHE_LINE_SIZE);
 
+extern unsigned int ktls_ifnet_max_rexmit_pct;
+
 void ktls_check_rx(struct sockbuf *sb);
+void ktls_disable_ifnet(void *arg);
 int ktls_enable_rx(struct socket *so, struct tls_enable *en);
 int ktls_enable_tx(struct socket *so, struct tls_enable *en);
 void ktls_destroy(struct ktls_session *tls);
@@ -233,16 +236,5 @@ ktls_free(struct ktls_session *tls)
 		ktls_destroy(tls);
 }
 
-#ifdef KERN_TLS
-extern unsigned int ktls_ifnet_max_rexmit_pct;
-void ktls_disable_ifnet(void *arg);
-#else
-#define ktls_ifnet_max_rexmit_pct 1
-static inline void
-ktls_disable_ifnet(void *arg __unused)
-{
-}
-#endif
-
 #endif /* !_KERNEL */
 #endif /* !_SYS_KTLS_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108052325.175NPbZG035136>