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/prot_mode.c | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 drivers/net/wireless/celeno/cl8k/prot_mode.c diff --git a/drivers/net/wireless/celeno/cl8k/prot_mode.c b/drivers/net/wireless/celeno/cl8k/prot_mode.c new file mode 100644 index 000000000000..34e20328772e --- /dev/null +++ b/drivers/net/wireless/celeno/cl8k/prot_mode.c @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT +/* Copyright(c) 2019-2021, Celeno Communications Ltd. */ + +#include "prot_mode.h" +#include "fw/msg_tx.h" +#include <linux/string.h> + +void cl_prot_mode_init(struct cl_hw *cl_hw) +{ + struct cl_prot_mode *prot_mode = &cl_hw->prot_mode; + u8 init = cl_hw->conf->ce_prot_mode; + + prot_mode->current_val = init; + prot_mode->default_val = init; + prot_mode->dynamic_val = (init != TXL_NO_PROT) ? init : TXL_PROT_RTS; +} + +void cl_prot_mode_set(struct cl_hw *cl_hw, u8 prot_mode_new) +{ + struct cl_prot_mode *prot_mode = &cl_hw->prot_mode; + struct cl_tcv_conf *conf = cl_hw->conf; + + if (prot_mode->current_val != prot_mode_new) { + prot_mode->current_val = prot_mode_new; + cl_msg_tx_prot_mode(cl_hw, + conf->ce_prot_log_nav_en, + prot_mode_new, + conf->ce_prot_rate_format, + conf->ce_prot_rate_mcs, + conf->ce_prot_rate_pre_type); + } +} + +void cl_prot_mode_disable(struct cl_hw *cl_hw) +{ + cl_prot_mode_set(cl_hw, TXL_NO_PROT); +} + +void cl_prot_mode_enable(struct cl_hw *cl_hw) +{ + cl_prot_mode_set(cl_hw, cl_hw->prot_mode.dynamic_val); +} + +void cl_prot_mode_restore_default(struct cl_hw *cl_hw) +{ + cl_prot_mode_set(cl_hw, cl_hw->prot_mode.default_val); +} + +u8 cl_prot_mode_get(struct cl_hw *cl_hw) +{ + return cl_hw->prot_mode.current_val; +} + -- 2.30.0 ________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose. ________________________________