Skip to content

Commit 77ee238

Browse files
sachinthegreenkrish2718
authored andcommitted
[nrf fromtree] nrf_wifi: Remove dependency on OSAL layer handle
Removes the requirement for the different layers in the OS agnostic parts of the driver having to maintain a handle to the OS interface layer in order to call the OS interface calls. The OS interface layer now maitains the handle to OS-specific ops internally and invokes the appropriate functions. Fixes SHEL-2639 Signed-off-by: Sachin D Kulkarni <[email protected]> (cherry picked from commit 1f49438)
1 parent 6181cc1 commit 77ee238

File tree

7 files changed

+31
-39
lines changed

7 files changed

+31
-39
lines changed

drivers/wifi/nrfwifi/src/fmac_main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);
4545

4646
struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;
47+
extern const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops;
4748

4849
/* 3 bytes for addreess, 3 bytes for length */
4950
#define MAX_PKT_RAM_TX_ALIGN_OVERHEAD 6
@@ -259,7 +260,7 @@ static void nrf_wifi_process_rssi_from_rx(void *vif_ctx,
259260

260261
vif_ctx_zep->rssi = MBM_TO_DBM(signal);
261262
vif_ctx_zep->rssi_record_timestamp_us =
262-
nrf_wifi_osal_time_get_curr_us(fmac_dev_ctx->fpriv->opriv);
263+
nrf_wifi_osal_time_get_curr_us();
263264
}
264265
#endif /* CONFIG_NRF70_STA_MODE */
265266

@@ -762,12 +763,22 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
762763
callbk_fns.get_conn_info_callbk_fn = nrf_wifi_supp_event_proc_get_conn_info;
763764
#endif /* CONFIG_NRF70_STA_MODE */
764765

766+
/* The OSAL layer needs to be initialized before any other initialization
767+
* so that other layers (like FW IF,HW IF etc) have access to OS ops
768+
*/
769+
nrf_wifi_osal_init(&nrf_wifi_os_zep_ops);
770+
765771
rpu_drv_priv_zep.fmac_priv = nrf_wifi_fmac_init(&data_config,
766772
rx_buf_pools,
767773
&callbk_fns);
768774
#else /* !CONFIG_NRF70_RADIO_TEST */
769775
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
770776

777+
/* The OSAL layer needs to be initialized before any other initialization
778+
* so that other layers (like FW IF,HW IF etc) have access to OS ops
779+
*/
780+
nrf_wifi_osal_init(&nrf_wifi_os_zep_ops);
781+
771782
rpu_drv_priv_zep.fmac_priv = nrf_wifi_fmac_init_rt();
772783
#endif /* CONFIG_NRF70_RADIO_TEST */
773784

@@ -808,6 +819,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
808819
#ifdef CONFIG_NRF70_RADIO_TEST
809820
fmac_deinit:
810821
nrf_wifi_fmac_deinit_rt(rpu_drv_priv_zep.fmac_priv);
822+
nrf_wifi_osal_deinit();
811823
#endif /* CONFIG_NRF70_RADIO_TEST */
812824
err:
813825
return -1;

drivers/wifi/nrfwifi/src/net_if.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,7 @@ enum nrf_wifi_status nrf_wifi_get_mac_addr(struct nrf_wifi_vif_ctx_zep *vif_ctx_
487487
}
488488
#endif
489489

490-
if (!nrf_wifi_utils_is_mac_addr_valid(fmac_dev_ctx->fpriv->opriv,
491-
vif_ctx_zep->mac_addr.addr)) {
490+
if (!nrf_wifi_utils_is_mac_addr_valid(vif_ctx_zep->mac_addr.addr)) {
492491
LOG_ERR("%s: Invalid MAC address: %s",
493492
__func__,
494493
net_sprint_ll_addr(vif_ctx_zep->mac_addr.addr,
@@ -682,8 +681,7 @@ int nrf_wifi_if_start_zep(const struct device *dev)
682681
mac_addr = net_if_get_link_addr(vif_ctx_zep->zep_net_if_ctx)->addr;
683682
mac_addr_len = net_if_get_link_addr(vif_ctx_zep->zep_net_if_ctx)->len;
684683

685-
if (!nrf_wifi_utils_is_mac_addr_valid(fmac_dev_ctx->fpriv->opriv,
686-
mac_addr)) {
684+
if (!nrf_wifi_utils_is_mac_addr_valid(mac_addr)) {
687685
status = nrf_wifi_get_mac_addr(vif_ctx_zep);
688686
if (status != NRF_WIFI_STATUS_SUCCESS) {
689687
LOG_ERR("%s: Failed to get MAC address",

drivers/wifi/nrfwifi/src/shim.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ static unsigned int zep_shim_strlen(const void *str)
872872
return strlen(str);
873873
}
874874

875-
static const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = {
875+
const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = {
876876
.mem_alloc = zep_shim_mem_alloc,
877877
.mem_zalloc = zep_shim_mem_zalloc,
878878
.mem_free = k_free,
@@ -962,8 +962,3 @@ static const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = {
962962
.assert = zep_shim_assert,
963963
.strlen = zep_shim_strlen,
964964
};
965-
966-
const struct nrf_wifi_osal_ops *get_os_ops(void)
967-
{
968-
return &nrf_wifi_os_zep_ops;
969-
}

drivers/wifi/nrfwifi/src/wifi_mgmt.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,13 @@ int nrf_wifi_get_power_save_config(const struct device *dev,
203203
}
204204

205205
do {
206-
nrf_wifi_osal_sleep_ms(fmac_dev_ctx->fpriv->opriv,
207-
1);
206+
nrf_wifi_osal_sleep_ms(1);
208207
count++;
209208
} while ((vif_ctx_zep->ps_config_info_evnt == false) &&
210209
(count < NRF_WIFI_FMAC_PS_CONF_EVNT_RECV_TIMEOUT));
211210

212211
if (count == NRF_WIFI_FMAC_PS_CONF_EVNT_RECV_TIMEOUT) {
213-
nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv,
214-
"%s: Timed out",
212+
nrf_wifi_osal_log_err("%s: Timed out",
215213
__func__);
216214
goto out;
217215
}
@@ -697,19 +695,16 @@ void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx,
697695

698696
switch (sleep_evnt->info.type) {
699697
case TWT_BLOCK_TX:
700-
nrf_wifi_osal_spinlock_take(fmac_dev_ctx->fpriv->opriv,
701-
def_dev_ctx->tx_config.tx_lock);
698+
nrf_wifi_osal_spinlock_take(def_dev_ctx->tx_config.tx_lock);
702699

703700
def_dev_ctx->twt_sleep_status = NRF_WIFI_FMAC_TWT_STATE_SLEEP;
704701

705702
wifi_mgmt_raise_twt_sleep_state(vif_ctx_zep->zep_net_if_ctx,
706703
WIFI_TWT_STATE_SLEEP);
707-
nrf_wifi_osal_spinlock_rel(fmac_dev_ctx->fpriv->opriv,
708-
def_dev_ctx->tx_config.tx_lock);
704+
nrf_wifi_osal_spinlock_rel(def_dev_ctx->tx_config.tx_lock);
709705
break;
710706
case TWT_UNBLOCK_TX:
711-
nrf_wifi_osal_spinlock_take(fmac_dev_ctx->fpriv->opriv,
712-
def_dev_ctx->tx_config.tx_lock);
707+
nrf_wifi_osal_spinlock_take(def_dev_ctx->tx_config.tx_lock);
713708
def_dev_ctx->twt_sleep_status = NRF_WIFI_FMAC_TWT_STATE_AWAKE;
714709
wifi_mgmt_raise_twt_sleep_state(vif_ctx_zep->zep_net_if_ctx,
715710
WIFI_TWT_STATE_AWAKE);
@@ -722,8 +717,7 @@ void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx,
722717
}
723718
}
724719
#endif
725-
nrf_wifi_osal_spinlock_rel(fmac_dev_ctx->fpriv->opriv,
726-
def_dev_ctx->tx_config.tx_lock);
720+
nrf_wifi_osal_spinlock_rel(def_dev_ctx->tx_config.tx_lock);
727721
break;
728722
default:
729723
break;

drivers/wifi/nrfwifi/src/wifi_mgmt_scan.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ int nrf_wifi_disp_scan_zep(const struct device *dev, struct wifi_scan_params *pa
192192
}
193193

194194
scan_info->scan_params.center_frequency[k++] = nrf_wifi_utils_chan_to_freq(
195-
fmac_dev_ctx->fpriv->opriv, band, params->band_chan[i].channel);
195+
band, params->band_chan[i].channel);
196196

197197
if (scan_info->scan_params.center_frequency[k - 1] == -1) {
198198
LOG_ERR("%s: Invalid channel %d", __func__,
@@ -414,23 +414,16 @@ void nrf_wifi_rx_bcn_prb_resp_frm(void *vif_ctx,
414414

415415
fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
416416

417-
frame_length = nrf_wifi_osal_nbuf_data_size(fmac_dev_ctx->fpriv->opriv,
418-
nwb);
417+
frame_length = nrf_wifi_osal_nbuf_data_size(nwb);
419418

420419
if (frame_length > CONFIG_WIFI_MGMT_RAW_SCAN_RESULT_LENGTH) {
421-
nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
422-
&bcn_prb_resp_info.data,
423-
nrf_wifi_osal_nbuf_data_get(
424-
fmac_dev_ctx->fpriv->opriv,
425-
nwb),
420+
nrf_wifi_osal_mem_cpy(&bcn_prb_resp_info.data,
421+
nrf_wifi_osal_nbuf_data_get(nwb),
426422
CONFIG_WIFI_MGMT_RAW_SCAN_RESULT_LENGTH);
427423

428424
} else {
429-
nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
430-
&bcn_prb_resp_info.data,
431-
nrf_wifi_osal_nbuf_data_get(
432-
fmac_dev_ctx->fpriv->opriv,
433-
nwb),
425+
nrf_wifi_osal_mem_cpy(&bcn_prb_resp_info.data,
426+
nrf_wifi_osal_nbuf_data_get(nwb),
434427
frame_length);
435428
}
436429

drivers/wifi/nrfwifi/src/wifi_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static int nrf_wifi_util_tx_stats(const struct shell *sh,
295295

296296
for (int i = 0; i < NRF_WIFI_FMAC_AC_MAX ; i++) {
297297
queue = def_dev_ctx->tx_config.data_pending_txq[peer_index][i];
298-
tx_pending_pkts = nrf_wifi_utils_q_len(fmac_dev_ctx->fpriv->opriv, queue);
298+
tx_pending_pkts = nrf_wifi_utils_q_len(queue);
299299

300300
shell_fprintf(
301301
sh,

drivers/wifi/nrfwifi/src/wpa_supp_if.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@ int nrf_wifi_wpa_supp_signal_poll(void *if_priv, struct wpa_signal_info *si, uns
11721172

11731173
vif_ctx_zep->signal_info = si;
11741174

1175-
rssi_record_elapsed_time_ms = nrf_wifi_osal_time_elapsed_us(fmac_dev_ctx->fpriv->opriv,
1176-
vif_ctx_zep->rssi_record_timestamp_us) / 1000;
1175+
rssi_record_elapsed_time_ms =
1176+
nrf_wifi_osal_time_elapsed_us(vif_ctx_zep->rssi_record_timestamp_us) / 1000;
11771177

11781178
if (rssi_record_elapsed_time_ms > CONFIG_NRF70_RSSI_STALE_TIMEOUT_MS) {
11791179
ret = nrf_wifi_fmac_get_station(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, bssid);

0 commit comments

Comments
 (0)