diff --git a/drivers/nrf_wifi/fw_if/umac_if/inc/offload_raw_tx/fmac_structs.h b/drivers/nrf_wifi/fw_if/umac_if/inc/offload_raw_tx/fmac_structs.h index d7b0dbdb..cf42d505 100644 --- a/drivers/nrf_wifi/fw_if/umac_if/inc/offload_raw_tx/fmac_structs.h +++ b/drivers/nrf_wifi/fw_if/umac_if/inc/offload_raw_tx/fmac_structs.h @@ -20,6 +20,8 @@ #include "host_rpu_sys_if.h" +#define NRF_WIFI_FMAC_PARAMS_RECV_TIMEOUT 100 /* ms */ + /** * @brief Structure to hold per device context information for the UMAC IF layer. * @@ -29,6 +31,7 @@ struct nrf_wifi_off_raw_tx_fmac_dev_ctx { enum nrf_wifi_cmd_status off_raw_tx_cmd_status; bool off_raw_tx_cmd_done; + unsigned char country_code[NRF_WIFI_COUNTRY_CODE_LEN]; }; // extern struct nrf_wifi_off_raw_tx_fmac_dev_ctx *def_dev_ctx_off_raw_tx; diff --git a/drivers/nrf_wifi/fw_if/umac_if/src/event.c b/drivers/nrf_wifi/fw_if/umac_if/src/event.c index a48ca017..65f1f013 100644 --- a/drivers/nrf_wifi/fw_if/umac_if/src/event.c +++ b/drivers/nrf_wifi/fw_if/umac_if/src/event.c @@ -150,6 +150,9 @@ static enum nrf_wifi_status umac_event_ctrl_process(struct nrf_wifi_fmac_dev_ctx #elif NRF70_RADIO_TEST struct nrf_wifi_reg *get_reg_event = NULL; struct nrf_wifi_event_regulatory_change *reg_change_event = NULL; +#elif NRF70_OFFLOADED_RAW_TX + struct nrf_wifi_off_raw_tx_fmac_dev_ctx *def_dev_ctx_off_raw_tx = NULL; + struct nrf_wifi_reg *get_reg_event = NULL; #endif /* !NRF70_RADIO_TEST && !NRF70_OFFLOADED_RAW_TX */ unsigned char if_id = 0; unsigned int event_num = 0; @@ -170,6 +173,10 @@ static enum nrf_wifi_status umac_event_ctrl_process(struct nrf_wifi_fmac_dev_ctx #endif /* !NRF70_RADIO_TEST && !NRF70_OFFLOADED_RAW_TX */ +#ifdef NRF70_OFFLOADED_RAW_TX + def_dev_ctx_off_raw_tx = wifi_dev_priv(fmac_dev_ctx); +#endif /* NRF70_OFFLOADED_RAW_TX */ + umac_hdr = event_data; if_id = umac_hdr->ids.wdev_id; event_num = umac_hdr->cmd_evnt; @@ -219,6 +226,14 @@ static enum nrf_wifi_status umac_event_ctrl_process(struct nrf_wifi_fmac_dev_ctx sizeof(get_reg_event->nrf_wifi_alpha2)); fmac_dev_ctx->alpha2_valid = true; #endif /* NRF70_RADIO_TEST */ +#ifdef NRF70_OFFLOADED_RAW_TX + get_reg_event = (struct nrf_wifi_reg *)event_data; + + nrf_wifi_osal_mem_cpy(&def_dev_ctx_off_raw_tx->country_code, + &get_reg_event->nrf_wifi_alpha2, + sizeof(get_reg_event->nrf_wifi_alpha2)); + fmac_dev_ctx->alpha2_valid = true; +#endif /* NRF70_OFFLOADED_RAW_TX */ break; case NRF_WIFI_UMAC_EVENT_REG_CHANGE: #ifdef NRF70_STA_MODE diff --git a/drivers/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c b/drivers/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c index 6616533f..218d9d4c 100644 --- a/drivers/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c +++ b/drivers/nrf_wifi/fw_if/umac_if/src/fmac_api_common.c @@ -849,6 +849,7 @@ enum nrf_wifi_status nrf_wifi_fmac_set_reg(struct nrf_wifi_fmac_dev_ctx *fmac_de return status; } +#endif /* !NRF70_OFFLOADED_RAW_TX */ enum nrf_wifi_status nrf_wifi_fmac_get_reg(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, struct nrf_wifi_fmac_reg_info *reg_info) @@ -911,7 +912,6 @@ enum nrf_wifi_status nrf_wifi_fmac_get_reg(struct nrf_wifi_fmac_dev_ctx *fmac_de } return status; } -#endif int nrf_wifi_phy_rf_params_init(struct nrf_wifi_phy_rf_params *prf, unsigned int package_info, diff --git a/drivers/nrf_wifi/fw_if/umac_if/src/offload_raw_tx/fmac_api.c b/drivers/nrf_wifi/fw_if/umac_if/src/offload_raw_tx/fmac_api.c index ac85dcd6..a73c38bb 100644 --- a/drivers/nrf_wifi/fw_if/umac_if/src/offload_raw_tx/fmac_api.c +++ b/drivers/nrf_wifi/fw_if/umac_if/src/offload_raw_tx/fmac_api.c @@ -210,6 +210,7 @@ enum nrf_wifi_status nrf_wifi_fmac_off_raw_tx_conf(struct nrf_wifi_fmac_dev_ctx { enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; struct nrf_wifi_off_raw_tx_fmac_dev_ctx *def_dev_ctx_off_raw_tx; + struct nrf_wifi_fmac_reg_info reg_domain_info = {0}; unsigned char count = 0; if (!fmac_dev_ctx) { @@ -240,14 +241,30 @@ enum nrf_wifi_status nrf_wifi_fmac_off_raw_tx_conf(struct nrf_wifi_fmac_dev_ctx nrf_wifi_osal_sleep_ms(1); count++; } while ((def_dev_ctx_off_raw_tx->off_raw_tx_cmd_done == true) && - (count < NRF_WIFI_FMAC_STATS_RECV_TIMEOUT)); + (count < NRF_WIFI_FMAC_PARAMS_RECV_TIMEOUT)); - if (count == NRF_WIFI_FMAC_STATS_RECV_TIMEOUT) { + if (count == NRF_WIFI_FMAC_PARAMS_RECV_TIMEOUT) { nrf_wifi_osal_log_err("%s: Timed out", __func__); goto out; } + if (def_dev_ctx_off_raw_tx->off_raw_tx_cmd_status != NRF_WIFI_UMAC_CMD_SUCCESS) { + status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, ®_domain_info); + if (status != NRF_WIFI_STATUS_SUCCESS) { + nrf_wifi_osal_log_err("%s: Failed to get regulatory domain", + __func__); + goto out; + } + + nrf_wifi_osal_log_err("%s: Failed to set configuration, check config against %.2s regulatory domain rules", + __func__, + def_dev_ctx_off_raw_tx->country_code); + status = NRF_WIFI_STATUS_FAIL; + goto out; + } + + status = NRF_WIFI_STATUS_SUCCESS; out: return status; }