From: Viktor Barna <viktor.barna@xxxxxxxxxx> (Part of the split. Please, take a look at the cover letter for more details). Signed-off-by: Viktor Barna <viktor.barna@xxxxxxxxxx> --- drivers/net/wireless/celeno/cl8k/radio.h | 130 +++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 drivers/net/wireless/celeno/cl8k/radio.h diff --git a/drivers/net/wireless/celeno/cl8k/radio.h b/drivers/net/wireless/celeno/cl8k/radio.h new file mode 100644 index 000000000000..b51dec5b7b1e --- /dev/null +++ b/drivers/net/wireless/celeno/cl8k/radio.h @@ -0,0 +1,130 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* Copyright(c) 2019-2022, Celeno Communications Ltd. */ + +#ifndef CL_RADIO_H +#define CL_RADIO_H + +#define RADIO_STATUS_OFF 0 +#define RADIO_STATUS_ON 1 +#define RADIO_STATUS_GOING_DOWN 2 + +int cl_radio_on(struct cl_hw *cl_hw); +void cl_radio_off_chip(struct cl_chip *chip); +void cl_radio_on_chip(struct cl_chip *chip); +bool cl_radio_is_off(struct cl_hw *cl_hw); +bool cl_radio_is_on(struct cl_hw *cl_hw); +bool cl_radio_is_going_down(struct cl_hw *cl_hw); +void cl_radio_on_start(struct cl_hw *cl_hw); +int cl_radio_boot(struct cl_chip *chip); +int cl_radio_boot_recovery(struct cl_hw *cl_hw); +/* Wakes up cl_radio_off_kthread after all the stations have disconnected. */ +void cl_radio_off_wake_up(struct cl_hw *cl_hw); + +struct cl_noise_reg { + struct list_head list; + u32 np_prim20_per_ant; + u32 np_prim20_per_ant2; + u32 nasp_prim20_per_ant; + u32 nasp_prim20_per_ant2; + u32 np_sub20_per_chn; + u32 np_sub20_per_chn2; + u32 nasp_sub20_per_chn; + u32 nasp_sub20_per_chn2; + u32 np_sec20_dens_per_ant; + u32 nasp_sec20_dens_per_ant; +}; + +struct cl_noise_db { + struct list_head reg_list; + bool hist_record; + u8 active_ant; + u8 sample_cnt; +}; + +void cl_noise_init(struct cl_hw *cl_hw); +void cl_noise_close(struct cl_hw *cl_hw); +void cl_noise_maintenance(struct cl_hw *cl_hw); + +#define RX_HDR_RSSI(rxhdr) \ + {(rxhdr)->rssi1, (rxhdr)->rssi2, (rxhdr)->rssi3, \ + (rxhdr)->rssi4, (rxhdr)->rssi5, (rxhdr)->rssi6} + +struct cl_assoc_queue { + struct list_head list; + spinlock_t lock; +}; + +void cl_rssi_assoc_init(struct cl_hw *cl_hw); +void cl_rssi_assoc_exit(struct cl_hw *cl_hw); +void cl_rssi_assoc_handle(struct cl_hw *cl_hw, u8 *mac_addr, struct hw_rxhdr *rxhdr); +void cl_rssi_assoc_find(struct cl_hw *cl_hw, struct cl_sta *cl_sta, u8 num_sta); +void cl_rssi_sort_descending(s8 rssi[MAX_ANTENNAS], u8 num_ant); +s8 cl_rssi_calc_equivalent(struct cl_hw *cl_hw, s8 rssi[MAX_ANTENNAS]); +s8 cl_rssi_get_strongest(struct cl_hw *cl_hw, s8 rssi[MAX_ANTENNAS]); +void cl_rssi_block_ack_handler(struct cl_hw *cl_hw, struct cl_sta *cl_sta, + struct cl_agg_tx_report *agg_report); +void cl_rssi_rx_handler(struct cl_hw *cl_hw, struct cl_sta *cl_sta, + struct hw_rxhdr *rxhdr, s8 equivalent_rssi); +void cl_rssi_bw_adjust(struct cl_hw *cl_hw, struct hw_rxhdr *rxhdr, s8 bw_factor); +void cl_rssi_simulate(struct cl_hw *cl_hw, struct hw_rxhdr *rxhdr); + +/** + * CCA (=Clear Channel Assessment) + */ + +struct cl_cca_db { + unsigned long time; +}; + +void cl_cca_maintenance(struct cl_hw *cl_hw); +void cl_cca_init(struct cl_hw *cl_hw); + +/** + * Protection mode (RTS/CTS) control + */ +enum cl_txl_prot_mode { + TXL_NO_PROT, + TXL_PROT_RTS, + TXL_PROT_CTS, + TXL_PROT_RTS_FW, + TXL_PROT_CTS_FW, + + TXL_PROT_MAX, +}; + +struct cl_prot_mode { + u8 current_val; + u8 default_val; + u8 dynamic_val; +}; + +void cl_prot_mode_init(struct cl_hw *cl_hw); +void cl_prot_mode_set(struct cl_hw *cl_hw, u8 prot_mode_new); +u8 cl_prot_mode_get(struct cl_hw *cl_hw); + +enum edca_ac { + EDCA_AC_BE, + EDCA_AC_BK, + EDCA_AC_VI, + EDCA_AC_VO, + + EDCA_AC_MAX +}; + +struct edca_params { + u16 txop; + u8 cw_max; + u8 cw_min; + u8 aifsn; +}; + +struct cl_edca_db { + struct edca_params hw_params[AC_MAX]; +}; + +void cl_edca_hw_conf(struct cl_hw *cl_hw); +void cl_edca_set(struct cl_hw *cl_hw, u8 ac, struct edca_params *params, + struct ieee80211_he_mu_edca_param_ac_rec *mu_edca); +void cl_edca_recovery(struct cl_hw *cl_hw); + +#endif /* CL_RADIO_H */ -- 2.36.1