From d4b68955c5b91d5828f6618884d1f28fd5c8135e Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 16 Oct 2024 02:40:00 +0530 Subject: [PATCH 1/2] nrf_wifi: Fix the regulatory wait flag The flag should be reset before sending to avoid a tiny race b/w flag set and reading the flag. Signed-off-by: Chaitanya Tata --- nrf_wifi/fw_if/umac_if/src/fmac_api_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c b/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c index 2da71209cc..b92f570690 100644 --- a/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c +++ b/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c @@ -824,6 +824,7 @@ enum nrf_wifi_status nrf_wifi_fmac_set_reg(struct nrf_wifi_fmac_dev_ctx *fmac_de set_reg_cmd->valid_fields |= NRF_WIFI_CMD_REQ_SET_REG_USER_REG_FORCE; } + fmac_dev_ctx->reg_set_status = false; status = umac_cmd_cfg(fmac_dev_ctx, set_reg_cmd, sizeof(*set_reg_cmd)); From 653947434585444423171a5bb44083b757199151 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 16 Oct 2024 02:41:29 +0530 Subject: [PATCH 2/2] nrf_wifi: Add a flag to indicate waiting for reg change event To determine if the regulatory change event is solicited or not, this flag is handy. Helps fix #79733. Signed-off-by: Chaitanya Tata --- nrf_wifi/fw_if/umac_if/inc/fmac_structs_common.h | 2 ++ nrf_wifi/fw_if/umac_if/src/fmac_api_common.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/nrf_wifi/fw_if/umac_if/inc/fmac_structs_common.h b/nrf_wifi/fw_if/umac_if/inc/fmac_structs_common.h index b5222f9628..f357286916 100644 --- a/nrf_wifi/fw_if/umac_if/inc/fmac_structs_common.h +++ b/nrf_wifi/fw_if/umac_if/inc/fmac_structs_common.h @@ -170,6 +170,8 @@ struct nrf_wifi_fmac_dev_ctx { unsigned int reg_chan_count; /** Regulatory channel attributes */ struct nrf_wifi_get_reg_chn_info *reg_chan_info; + /** To determine if event is solicited or not */ + bool waiting_for_reg_event; /** Regulatory set status */ int reg_set_status; /** Regulatory change event */ diff --git a/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c b/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c index b92f570690..8c801cac45 100644 --- a/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c +++ b/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c @@ -825,6 +825,8 @@ enum nrf_wifi_status nrf_wifi_fmac_set_reg(struct nrf_wifi_fmac_dev_ctx *fmac_de } fmac_dev_ctx->reg_set_status = false; + fmac_dev_ctx->waiting_for_reg_event = true; + status = umac_cmd_cfg(fmac_dev_ctx, set_reg_cmd, sizeof(*set_reg_cmd)); @@ -849,6 +851,7 @@ enum nrf_wifi_status nrf_wifi_fmac_set_reg(struct nrf_wifi_fmac_dev_ctx *fmac_de goto out; } + fmac_dev_ctx->waiting_for_reg_event = false; reg_change = fmac_dev_ctx->reg_change; if (reg_change->intr != exp_initiator) {