Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] iw: channels: show CAC ongoing time
@ 2026-05-06 15:41 Janusz Dziedzic
  0 siblings, 0 replies; only message in thread
From: Janusz Dziedzic @ 2026-05-06 15:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-06 15:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 15:41 [PATCH] iw: channels: show CAC ongoing time Janusz Dziedzic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox