From: Janusz Dziedzic Date: Wed, 6 May 2026 15:41:03 +0000 (+0200) Subject: iw: channels: show CAC ongoing time X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=13cbdf77f4cc861abb49a055fc33283d44cfec7a;p=thirdparty%2Fiw.git iw: channels: show CAC ongoing time Signed-off-by: Janusz Dziedzic Link: https://patch.msgid.link/20260506154103.199563-1-janusz.dziedzic@gmail.com Signed-off-by: Johannes Berg --- diff --git a/phy.c b/phy.c index 03a7822..ab629c6 100644 --- a/phy.c +++ b/phy.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -143,6 +144,20 @@ static int print_channels_handler(struct nl_msg *msg, void *arg) printf("\t DFS CAC time: %u ms\n", nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_CAC_TIME])); } + + if (tb_freq[NL80211_FREQUENCY_ATTR_CAC_START_TIME]) { + struct timespec now_ts; + unsigned long long now_ns, cac_start_ns, elapsed_ms; + + clock_gettime(CLOCK_BOOTTIME, &now_ts); + now_ns = now_ts.tv_sec * 1000000000ULL; + now_ns += now_ts.tv_nsec; + + cac_start_ns = nla_get_u64(tb_freq[NL80211_FREQUENCY_ATTR_CAC_START_TIME]); + elapsed_ms = (now_ns - cac_start_ns) / 1000000; + + printf("\t CAC ongoing (elapsed time: %llu ms)\n", elapsed_ms); + } } } }