2022-05-24 13:14:57

by Viktor Barna

[permalink] [raw]
Subject: [RFC v2 71/96] cl8k: add scan.h

From: Viktor Barna <[email protected]>

(Part of the split. Please, take a look at the cover letter for more
details).

Signed-off-by: Viktor Barna <[email protected]>
---
drivers/net/wireless/celeno/cl8k/scan.h | 53 +++++++++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 drivers/net/wireless/celeno/cl8k/scan.h

diff --git a/drivers/net/wireless/celeno/cl8k/scan.h b/drivers/net/wireless/celeno/cl8k/scan.h
new file mode 100644
index 000000000000..857e1cfc1745
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/scan.h
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
+/* Copyright(c) 2019-2022, Celeno Communications Ltd. */
+
+#ifndef CL_SCAN_H
+#define CL_SCAN_H
+
+#include <linux/kthread.h>
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+#include <linux/completion.h>
+
+#include "channel.h"
+
+struct cl_chan_scanner {
+ struct cl_channel_stats channels[MAX_CHANNELS];
+ enum cl_channel_bw scan_bw;
+ u8 channels_num;
+ u8 scan_channels_num;
+ u8 curr_ch_idx;
+
+ struct task_struct *scan_thread;
+ atomic_t scan_thread_busy;
+
+ u32 scan_time;
+ u32 wait_time;
+
+ bool scans_enabled;
+ bool scan_aborted;
+ struct completion abort_completion;
+
+ u8 prescan_bw;
+ u32 prescan_channel;
+
+ wait_queue_head_t wq;
+ struct cl_hw *cl_hw;
+
+ void (*completion_cb)(struct cl_hw *cl_hw, void *arg);
+ void *completion_arg;
+};
+
+/* Use CHNL scan_bw =_BW_MAX to perform scan on current bandwidth */
+s32 cl_trigger_off_channel_scan(struct cl_chan_scanner *scanner, u32 scan_time, u32 wait_time,
+ const u8 *channels, enum cl_channel_bw scan_bw, u8 channels_num,
+ void (*completion_cb)(struct cl_hw *cl_hw, void *arg),
+ void *completion_arg);
+void cl_abort_scan(struct cl_chan_scanner *scanner);
+int cl_scanner_init(struct cl_hw *cl_hw);
+void cl_scanner_deinit(struct cl_hw *cl_hw);
+int cl_scan_channel_switch(struct cl_hw *cl_hw, u8 channel, u8 bw, bool allow_recalib);
+bool cl_is_scan_in_progress(const struct cl_chan_scanner *scanner);
+
+#endif /* CL_SCAN_H */
--
2.36.1