From: Janusz Dziedzic <janusz.dziedzic@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, Janusz Dziedzic <janusz.dziedzic@gmail.com>
Subject: [PATCH] iw: channels: show CAC ongoing time
Date: Wed, 6 May 2026 17:41:03 +0200 [thread overview]
Message-ID: <20260506154103.199563-1-janusz.dziedzic@gmail.com> (raw)
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
---
phy.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/phy.c b/phy.c
index 03a7822..ab629c6 100644
--- a/phy.c
+++ b/phy.c
@@ -5,6 +5,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <time.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/family.h>
@@ -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);
+ }
}
}
}
--
2.43.0
reply other threads:[~2026-05-06 15:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260506154103.199563-1-janusz.dziedzic@gmail.com \
--to=janusz.dziedzic@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox