aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2021-10-14 17:59:16 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2021-10-14 17:59:16 +0000
commitef3f98ae4778a8d4463166c5ff3c7831099c6048 (patch)
tree780bb8f7ac35e70802f72745277ee2310d2f5e45
parent367ec75323e660f7827e960f55688d557291236c (diff)
downloadsrc-ef3f98ae4778a8d4463166c5ff3c7831099c6048.tar.gz
src-ef3f98ae4778a8d4463166c5ff3c7831099c6048.zip
cxgbe: Only run ktls_tick when NIC TLS is enabled.
Previously the body of ktls_tick was a nop when NIC TLS was disabled, but the callout was still scheduled consuming power on otherwise-idle systems with Chelsio T6 adapters. Now the callout only runs while NIC TLS is enabled on at least one interface of an adapter. Reported by: mav Reviewed by: np, mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32491
-rw-r--r--sys/dev/cxgbe/t4_main.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index f728ddf5b212..66f48f2bf922 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -5393,11 +5393,9 @@ ktls_tick(void *arg)
uint32_t tstamp;
sc = arg;
- if (sc->flags & KERN_TLS_ON) {
- tstamp = tcp_ts_getticks();
- t4_write_reg(sc, A_TP_SYNC_TIME_HI, tstamp >> 1);
- t4_write_reg(sc, A_TP_SYNC_TIME_LO, tstamp << 31);
- }
+ tstamp = tcp_ts_getticks();
+ t4_write_reg(sc, A_TP_SYNC_TIME_HI, tstamp >> 1);
+ t4_write_reg(sc, A_TP_SYNC_TIME_LO, tstamp << 31);
callout_schedule_sbt(&sc->ktls_tick, SBT_1MS, 0, C_HARDCLOCK);
}
@@ -5417,10 +5415,14 @@ t4_config_kern_tls(struct adapter *sc, bool enable)
return (rc);
}
- if (enable)
+ if (enable) {
sc->flags |= KERN_TLS_ON;
- else
+ callout_reset_sbt(&sc->ktls_tick, SBT_1MS, 0, ktls_tick, sc,
+ C_HARDCLOCK);
+ } else {
sc->flags &= ~KERN_TLS_ON;
+ callout_stop(&sc->ktls_tick);
+ }
return (rc);
}
@@ -6468,11 +6470,6 @@ adapter_full_init(struct adapter *sc)
write_global_rss_key(sc);
t4_intr_enable(sc);
}
-#ifdef KERN_TLS
- if (is_ktls(sc))
- callout_reset_sbt(&sc->ktls_tick, SBT_1MS, 0, ktls_tick, sc,
- C_HARDCLOCK);
-#endif
return (0);
}