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
This commit is contained in:
Andrew Gallatin 2021-08-05 19:17:35 -04:00
parent 09066b9866
commit 739de953ec
2 changed files with 6 additions and 14 deletions

View File

@ -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 */

View File

@ -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_ */