Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf_wifi: commit changes to remove supplicant dependency #1446

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions nrf_wifi/fw_if/umac_if/inc/default/fmac_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
Expand All @@ -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. */
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nrf_wifi/fw_if/umac_if/inc/fmac_api_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 22 additions & 2 deletions nrf_wifi/fw_if/umac_if/src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1058,19 +1069,28 @@ 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;
#endif
#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) {
Expand Down
6 changes: 5 additions & 1 deletion nrf_wifi/fw_if/umac_if/src/fmac_api_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down
82 changes: 39 additions & 43 deletions nrf_wifi/fw_if/umac_if/src/fmac_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -283,43 +309,13 @@ 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)
{
return nrf_wifi_osal_nbuf_data_get(fmac_dev_ctx->fpriv->opriv,
nwb);
}


unsigned char *nrf_wifi_util_get_ra(struct nrf_wifi_fmac_vif_ctx *vif,
void *nwb)
{
Expand Down Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions nrf_wifi/fw_if/umac_if/src/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions nrf_wifi/fw_if/umac_if/src/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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,
Expand Down
Loading