From e949c291a7db96541206d3661a45c275fba318b1 Mon Sep 17 00:00:00 2001 From: Vivekananda Uppunda Date: Tue, 27 Aug 2024 11:47:51 +0530 Subject: [PATCH] nrf_wifi: commit changes to remove supplicant dependency changes to remove supplicant dependency Signed-off-by: Vivekananda Uppunda --- .../fw_if/umac_if/inc/default/fmac_structs.h | 47 ++++++----- nrf_wifi/fw_if/umac_if/inc/fmac_api_common.h | 2 +- nrf_wifi/fw_if/umac_if/src/event.c | 24 +++++- nrf_wifi/fw_if/umac_if/src/fmac_api_common.c | 6 +- nrf_wifi/fw_if/umac_if/src/fmac_util.c | 82 +++++++++---------- nrf_wifi/fw_if/umac_if/src/rx.c | 3 + nrf_wifi/fw_if/umac_if/src/tx.c | 6 ++ 7 files changed, 102 insertions(+), 68 deletions(-) diff --git a/nrf_wifi/fw_if/umac_if/inc/default/fmac_structs.h b/nrf_wifi/fw_if/umac_if/inc/default/fmac_structs.h index 7e3a1e01f8..2ddd699351 100644 --- a/nrf_wifi/fw_if/umac_if/inc/default/fmac_structs.h +++ b/nrf_wifi/fw_if/umac_if/inc/default/fmac_structs.h @@ -139,11 +139,19 @@ struct nrf_wifi_fmac_callbk_fns { signed short signal); #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ -#if defined(CONFIG_NRF700X_STA_MODE) || defined(__DOXYGEN__) +#if defined(CONFIG_NRF700X_STA_MODE) || defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) || defined(__DOXYGEN__) /** Callback function to be called when an interface association state changes. */ enum nrf_wifi_status (*if_carr_state_chg_callbk_fn)(void *os_vif_ctx, enum nrf_wifi_fmac_if_carr_state cs); + /** Callback function to be called when a set interface response is received. */ + void (*set_if_callbk_fn)(void *os_vif_ctx, + struct nrf_wifi_umac_event_set_interface *set_if_event, + unsigned int event_len); +#endif + +#if defined(CONFIG_NRF700X_STA_MODE) || defined(__DOXYGEN__) + /** Callback function to be called when a frame is received. */ void (*rx_frm_callbk_fn)(void *os_vif_ctx, void *frm); @@ -198,11 +206,6 @@ struct nrf_wifi_fmac_callbk_fns { struct nrf_wifi_umac_event_mlme *tx_status_event, unsigned int event_len); - /** Callback function to be called when a set interface response is received. */ - void (*set_if_callbk_fn)(void *os_vif_ctx, - struct nrf_wifi_umac_event_set_interface *set_if_event, - unsigned int event_len); - /** Callback function to be called when a remain on channel response is received. */ void (*roc_callbk_fn)(void *os_vif_ctx, struct nrf_wifi_event_remain_on_channel *roc_event, @@ -280,18 +283,7 @@ struct nrf_wifi_fmac_callbk_fns { unsigned int event_len); }; -#if defined(CONFIG_NRF700X_STA_MODE) || defined(__DOXYGEN__) -/** - * @brief The TWT sleep state of device. - * - */ -enum nrf_wifi_fmac_twt_state { - /** RPU in TWT sleep state. */ - NRF_WIFI_FMAC_TWT_STATE_SLEEP, - /** RPU in TWT awake state. */ - NRF_WIFI_FMAC_TWT_STATE_AWAKE -}; - +#if defined(CONFIG_NRF700X_STA_MODE) || defined(__DOXYGEN__) || defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) /** * @brief Structure to hold peer context information. * @@ -354,7 +346,18 @@ struct tx_config { void *tx_done_tasklet_event_q; #endif /* CONFIG_NRF700X_TX_DONE_WQ_ENABLED */ }; -#endif /* CONFIG_NRF700X_STA_MODE */ + +/** + * @brief The TWT sleep state of device. + * + */ +enum nrf_wifi_fmac_twt_state { + /** RPU in TWT sleep state. */ + NRF_WIFI_FMAC_TWT_STATE_SLEEP, + /** RPU in TWT awake state. */ + NRF_WIFI_FMAC_TWT_STATE_AWAKE +}; +#endif /* CONFIG_NRF700X_STA_MODE || CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES */ /** * @brief Structure to hold context information for the UMAC IF layer. @@ -373,7 +376,7 @@ struct nrf_wifi_fmac_priv_def { unsigned int rx_desc[MAX_NUM_OF_RX_QUEUES]; /** Maximum number of host buffers needed for RX frames. */ unsigned int num_rx_bufs; -#if defined(CONFIG_NRF700X_STA_MODE) +#if defined(CONFIG_NRF700X_STA_MODE) || defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) /** Maximum number of tokens available for TX. */ unsigned char num_tx_tokens; /** Maximum number of TX tokens available reserved per AC. */ @@ -470,13 +473,15 @@ struct nrf_wifi_fmac_dev_ctx_def { unsigned char num_ap; /** Queue for storing mapping info of RX buffers. */ struct nrf_wifi_fmac_buf_map_info *rx_buf_info; -#if defined(CONFIG_NRF700X_STA_MODE) +#if defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) || defined(CONFIG_NRF700X_STA_MODE) /** Queue for storing mapping info of TX buffers. */ struct nrf_wifi_fmac_buf_map_info *tx_buf_info; /** Context information related to TX path. */ struct tx_config tx_config; /** TWT state of the RPU. */ enum nrf_wifi_fmac_twt_state twt_sleep_status; +#endif +#if defined(CONFIG_NRF700X_STA_MODE) #if defined(CONFIG_NRF700X_TX_DONE_WQ_ENABLED) /** Tasklet for TX done. */ void *tx_done_tasklet; diff --git a/nrf_wifi/fw_if/umac_if/inc/fmac_api_common.h b/nrf_wifi/fw_if/umac_if/inc/fmac_api_common.h index 64e909b65b..a17fa69648 100644 --- a/nrf_wifi/fw_if/umac_if/inc/fmac_api_common.h +++ b/nrf_wifi/fw_if/umac_if/inc/fmac_api_common.h @@ -307,7 +307,7 @@ int nrf_wifi_phy_rf_params_init(struct nrf_wifi_osal_priv *opriv, unsigned int package_info, unsigned char *str); -#ifdef CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES +#if defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) || defined(CONFIG_NRF700X_SYSTEM_MODE) /** * @brief Set the current mode of operation * @param dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. diff --git a/nrf_wifi/fw_if/umac_if/src/event.c b/nrf_wifi/fw_if/umac_if/src/event.c index 6e58ec7d46..934525c4d7 100644 --- a/nrf_wifi/fw_if/umac_if/src/event.c +++ b/nrf_wifi/fw_if/umac_if/src/event.c @@ -19,7 +19,7 @@ #include "fmac_ap.h" #include "fmac_util.h" -#ifdef CONFIG_NRF700X_DATA_TX +#if defined(CONFIG_NRF700X_DATA_TX) || defined(CONFIG_NRF700X_MONITOR_MODE) static enum nrf_wifi_status nrf_wifi_fmac_if_carr_state_event_proc(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, unsigned char *umac_head, @@ -638,7 +638,7 @@ nrf_wifi_fmac_data_event_process(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, switch (event) { case NRF_WIFI_CMD_RX_BUFF: -#ifdef CONFIG_NRF700X_RX_DONE_WQ_ENABLED +#ifdef CONFIG_NRF700X_RX_DONE_WQ_ENABLED struct nrf_wifi_rx_buff *config = nrf_wifi_osal_mem_zalloc( fmac_dev_ctx->fpriv->opriv, sizeof(struct nrf_wifi_rx_buff)); @@ -667,6 +667,9 @@ nrf_wifi_fmac_data_event_process(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, nrf_wifi_osal_tasklet_schedule(fmac_dev_ctx->fpriv->opriv, def_dev_ctx->rx_tasklet); #else + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: RX event process is being called", + __func__); status = nrf_wifi_fmac_rx_event_process(fmac_dev_ctx, umac_head); #endif /* CONFIG_NRF700X_RX_DONE_WQ_ENABLED */ @@ -706,6 +709,8 @@ nrf_wifi_fmac_data_event_process(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, umac_head); #endif /* CONFIG_NRF700X_TX_DONE_WQ_ENABLED */ break; +#endif /* CONFIG_NRF700X_DATA_TX */ +#if defined(CONFIG_NRF700X_DATA_TX) || defined(CONFIG_NRF700X_MONITOR_MODE) case NRF_WIFI_CMD_CARRIER_ON: status = nrf_wifi_fmac_if_carr_state_event_proc(fmac_dev_ctx, umac_head, @@ -983,6 +988,9 @@ nrf_wifi_fmac_if_mode_set_event_proc(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, vif->if_type = NRF_WIFI_IFTYPE_MONITOR; config->peers[MAX_PEERS].peer_id = -1; config->peers[MAX_PEERS].if_idx = -1; + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: Mode set to monitor mode", + __func__); #ifdef CONFIG_NRF700X_RAW_DATA_TX if ((mode_event->op_mode ^ NRF_WIFI_TX_INJECTION_MODE) == 0) { @@ -1024,6 +1032,9 @@ static enum nrf_wifi_status umac_process_sys_events(struct nrf_wifi_fmac_dev_ctx return status; } + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: umac_process_sys_event_called", + __func__); #ifdef CONFIG_NRF700X_RADIO_TEST def_dev_ctx_rt = wifi_dev_priv(fmac_dev_ctx); #else @@ -1058,12 +1069,18 @@ static enum nrf_wifi_status umac_process_sys_events(struct nrf_wifi_fmac_dev_ctx #endif /* CONFIG_NRF700X_RADIO_TEST */ #ifdef CONFIG_NRF700X_RAW_DATA_TX case NRF_WIFI_EVENT_RAW_TX_DONE: + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: Raw TX done is being called", + __func__); status = nrf_wifi_fmac_rawtx_done_event_process(fmac_dev_ctx, (struct nrf_wifi_event_raw_tx_done *)sys_head); break; #endif #ifdef CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES case NRF_WIFI_EVENT_MODE_SET_DONE: + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: mode set is being invoked", + __func__); status = nrf_wifi_fmac_if_mode_set_event_proc(fmac_dev_ctx, (struct nrf_wifi_event_raw_config_mode *)sys_head); break; @@ -1071,6 +1088,9 @@ static enum nrf_wifi_status umac_process_sys_events(struct nrf_wifi_fmac_dev_ctx #if defined(CONFIG_NRF700X_RAW_DATA_TX) || defined(CONFIG_NRF700X_RAW_DATA_RX) case NRF_WIFI_EVENT_CHANNEL_SET_DONE: struct nrf_wifi_event_set_channel *channel_event; + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: channel set is being invoked", + __func__); channel_event = (struct nrf_wifi_event_set_channel *)sys_head; if (!channel_event->status) { 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..e857ec8e31 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 @@ -1170,7 +1170,7 @@ enum nrf_wifi_status nrf_wifi_fmac_get_host_rpu_ps_ctrl_state(void *dev_ctx, #endif /* CONFIG_NRF_WIFI_LOW_POWER */ #endif /* CONFIG_NRF700X_UTIL */ -#ifdef CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES +#if defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) || defined(CONFIG_NRF700X_SYSTEM_MODE) enum nrf_wifi_status nrf_wifi_fmac_set_mode(void *dev_ctx, unsigned char if_idx, unsigned char mode) @@ -1253,6 +1253,10 @@ enum nrf_wifi_status nrf_wifi_fmac_set_channel(void *dev_ctx, status = nrf_wifi_hal_ctrl_cmd_send(fmac_dev_ctx->hal_dev_ctx, umac_cmd, (sizeof(*umac_cmd) + len)); + + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: nrf_wifi_hal_ctrl_cmd_send succeeded", + __func__); out: return status; } diff --git a/nrf_wifi/fw_if/umac_if/src/fmac_util.c b/nrf_wifi/fw_if/umac_if/src/fmac_util.c index aa33b00cd2..0ec365dd0d 100644 --- a/nrf_wifi/fw_if/umac_if/src/fmac_util.c +++ b/nrf_wifi/fw_if/umac_if/src/fmac_util.c @@ -47,18 +47,6 @@ unsigned short nrf_wifi_util_rx_get_eth_type(struct nrf_wifi_fmac_dev_ctx *fmac_ return payload[6] << 8 | payload[7]; } - -unsigned short nrf_wifi_util_tx_get_eth_type(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, - void *nwb) -{ - unsigned char *payload = NULL; - - payload = (unsigned char *)nwb; - - return payload[12] << 8 | payload[13]; -} - - int nrf_wifi_util_get_skip_header_bytes(unsigned short eth_type) { /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ @@ -204,6 +192,44 @@ void nrf_wifi_util_rx_convert_amsdu_to_eth(struct nrf_wifi_fmac_dev_ctx *fmac_de } } +int nrf_wifi_util_get_vif_indx(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, + const unsigned char *mac_addr) +{ + int i = 0; + int vif_index = -1; + struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; + + def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); + + for (i = 0; i < MAX_PEERS; i++) { + if (!nrf_wifi_util_ether_addr_equal(def_dev_ctx->tx_config.peers[i].ra_addr, + mac_addr)) { + vif_index = def_dev_ctx->tx_config.peers[i].if_idx; + break; + } + } + + if (vif_index == -1) { + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: Invalid vif_index = %d", + __func__, + vif_index); + } + + return vif_index; +} +#endif + +#if defined(CONFIG_NRF700X_STA_MODE) || defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) +unsigned short nrf_wifi_util_tx_get_eth_type(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, + void *nwb) +{ + unsigned char *payload = NULL; + + payload = (unsigned char *)nwb; + + return payload[12] << 8 | payload[13]; +} int nrf_wifi_util_get_tid(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb) @@ -283,35 +309,6 @@ int nrf_wifi_util_get_tid(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, return priority; } - -int nrf_wifi_util_get_vif_indx(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, - const unsigned char *mac_addr) -{ - int i = 0; - int vif_index = -1; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - for (i = 0; i < MAX_PEERS; i++) { - if (!nrf_wifi_util_ether_addr_equal(def_dev_ctx->tx_config.peers[i].ra_addr, - mac_addr)) { - vif_index = def_dev_ctx->tx_config.peers[i].if_idx; - break; - } - } - - if (vif_index == -1) { - nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, - "%s: Invalid vif_index = %d", - __func__, - vif_index); - } - - return vif_index; -} - - unsigned char *nrf_wifi_util_get_dest(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb) { @@ -319,7 +316,6 @@ unsigned char *nrf_wifi_util_get_dest(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx nwb); } - unsigned char *nrf_wifi_util_get_ra(struct nrf_wifi_fmac_vif_ctx *vif, void *nwb) { @@ -347,7 +343,7 @@ unsigned char *nrf_wifi_util_get_src(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, nwb) + NRF_WIFI_FMAC_ETH_ADDR_LEN; } -#endif /* CONFIG_NRF700X_STA_MODE */ +#endif /* CONFIG_NRF700X_STA_MODE || CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES*/ enum nrf_wifi_status nrf_wifi_check_mode_validity(unsigned char mode) { diff --git a/nrf_wifi/fw_if/umac_if/src/rx.c b/nrf_wifi/fw_if/umac_if/src/rx.c index 01f6d3d468..06f63d4473 100644 --- a/nrf_wifi/fw_if/umac_if/src/rx.c +++ b/nrf_wifi/fw_if/umac_if/src/rx.c @@ -382,6 +382,9 @@ enum nrf_wifi_status nrf_wifi_fmac_rx_event_process(struct nrf_wifi_fmac_dev_ctx raw_rx_hdr.signal = config->signal; raw_rx_hdr.rate_flags = config->rate_flags; raw_rx_hdr.rate = config->rate; + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: NRF_WIFI_RAW_RX_PKT invoked", + __func__); def_priv->callbk_fns.rx_sniffer_frm_callbk_fn(vif_ctx->os_vif_ctx, nwb, diff --git a/nrf_wifi/fw_if/umac_if/src/tx.c b/nrf_wifi/fw_if/umac_if/src/tx.c index a662f61c7d..0ed896ea29 100644 --- a/nrf_wifi/fw_if/umac_if/src/tx.c +++ b/nrf_wifi/fw_if/umac_if/src/tx.c @@ -944,6 +944,9 @@ enum nrf_wifi_status rawtx_cmd_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, goto out; } + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: nrf_wifi_hal_ctrl_cmd_send is being called", + __func__); status = nrf_wifi_hal_ctrl_cmd_send(fmac_dev_ctx->hal_dev_ctx, umac_cmd, (sizeof(*umac_cmd) + len)); @@ -1029,6 +1032,9 @@ enum nrf_wifi_status tx_pending_process(struct nrf_wifi_fmac_dev_ctx *fmac_dev_c def_dev_ctx->tx_config.pkt_info_p[desc].peer_id); #ifdef CONFIG_NRF700X_RAW_DATA_TX } else { + nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv, + "%s: rawtx_cmd_init being called", + __func__); status = rawtx_cmd_init(fmac_dev_ctx, def_dev_ctx->tx_config.pkt_info_p[desc].pkt, desc,