Skip to content
Open
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ target_compile_definitions(
$<$<BOOL:${CONFIG_NRF71_ON_IPC}>:NRF71_ON_IPC>
$<$<BOOL:${CONFIG_NRF_WIFI_DYNAMIC_BANDWIDTH_SIGNALLING}>:NRF_WIFI_DYNAMIC_BANDWIDTH_SIGNALLING>
$<$<BOOL:${CONFIG_NRF_WIFI_DYNAMIC_ED}>:NRF_WIFI_DYNAMIC_ED>
$<$<BOOL:${CONFIG_NRF71_HOST_RX_BUF_CMD}>:NRF71_HOST_RX_BUF_CMD>
$<$<BOOL:${CONFIG_NRF71_SOFT_HPQM}>:NRF71_SOFT_HPQM>
NRF_WIFI_MAX_PS_POLL_FAIL_CNT=${CONFIG_NRF_WIFI_MAX_PS_POLL_FAIL_CNT}
NRF70_RX_NUM_BUFS=${CONFIG_NRF70_RX_NUM_BUFS}
NRF70_MAX_TX_TOKENS=${CONFIG_NRF70_MAX_TX_TOKENS}
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ ccflags-y += -DNRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS=50000
ccflags-y += -DNRF_WIFI_DISPLAY_SCAN_BSS_LIMIT=150
ccflags-y += -DNRF_WIFI_RPU_MIN_TIME_TO_ENTER_SLEEP_MS=1000
ccflags-y += -DWIFI_NRF70_LOG_LEVEL=1
#ccflags-y += -DNRF71_HOST_RX_BUF_CMD

# Source files
SRCS = os_if/src/osal.c \
Expand Down
24 changes: 24 additions & 0 deletions fw_if/umac_if/inc/fw/host_rpu_common_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,30 @@ struct host_rpu_umac_info {
/** OTP params */
unsigned int calib[9];
} __NRF_WIFI_PKD;

#ifdef NRF71_SOFT_HPQM

#define NRF_WIFI_HOST_RPU_CMD_BUFFERS 4
#define NRF_WIFI_HOST_RPU_EVENT_BUFFERS 7
#define NRF_WIFI_HOST_RPU_TX_DESC 12

struct soft_hpqm_info {
volatile unsigned int host_cmd_free_index;
volatile unsigned int rpu_cmd_busy_index;
volatile unsigned int host_event_busy_index;
volatile unsigned int rpu_event_free_index;
volatile unsigned int host_tx_cmd_busy_index;
volatile unsigned int rpu_tx_cmd_busy_index;
volatile unsigned int host_tx_done_busy_index;
volatile unsigned int rpu_tx_done_busy_index;
volatile unsigned int cmd_free_buffs[NRF_WIFI_HOST_RPU_CMD_BUFFERS];
volatile unsigned int cmd_busy_buffs[NRF_WIFI_HOST_RPU_CMD_BUFFERS];
volatile unsigned int event_free_buffs[NRF_WIFI_HOST_RPU_EVENT_BUFFERS];
volatile unsigned int event_busy_buffs[NRF_WIFI_HOST_RPU_EVENT_BUFFERS];
volatile unsigned int tx_cmd_buffs[NRF_WIFI_HOST_RPU_TX_DESC];
volatile unsigned int tx_done_buffs[NRF_WIFI_HOST_RPU_TX_DESC];
} __NRF_WIFI_PKD;
#endif /* NRF71_SOFT_HPQM */
/**
* @}
*/
Expand Down
1 change: 1 addition & 0 deletions fw_if/umac_if/inc/fw/host_rpu_sys_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#define MAX_TX_AGG_SIZE 16
#define MAX_RX_BUFS_PER_EVNT 64
#define MAX_RX_BUFS_PER_CMD 32
#define MAX_MGMT_BUFS 16

/*#define ETH_ADDR_LEN 6*/
Expand Down
17 changes: 17 additions & 0 deletions fw_if/umac_if/inc/fw/host_rpu_umac_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ enum nrf_wifi_umac_commands {
NRF_WIFI_UMAC_CMD_CONFIG_QUIET_PERIOD,
/** Command to specify power save exit strategy */
NRF_WIFI_UMAC_CMD_PS_EXIT_STRATEGY,
/** Send host RX Buffers */
NRF_WIFI_UMAC_CMD_CONFIG_RX_BUF,
};

/**
Expand Down Expand Up @@ -3548,4 +3550,19 @@ struct nrf_wifi_cmd_ps_exit_strategy {
unsigned char ps_exit_strategy;
} __NRF_WIFI_PKD;

struct nrf_wifi_rx_buf {
unsigned int skb_pointer;
unsigned short skb_desc_no;
} __NRF_WIFI_PKD;

/**
* @brief This structure represents the command used to configure rx buffers.
*
*/
struct nrf_wifi_cmd_rx_buf_info {
struct nrf_wifi_umac_hdr umac_hdr;
unsigned int rx_buf_num;
struct nrf_wifi_rx_buf info[0];
} __NRF_WIFI_PKD;

#endif /* __HOST_RPU_UMAC_IF_H */
15 changes: 15 additions & 0 deletions fw_if/umac_if/inc/system/fmac_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,21 @@ enum nrf_wifi_status nrf_wifi_sys_fmac_stats_get(struct nrf_wifi_fmac_dev_ctx *f
enum rpu_op_mode op_mode,
struct rpu_sys_op_stats *stats);

#ifdef NRF71_HOST_RX_BUF_CMD
/**
* @brief Configure Rx buffer to firmware.
* @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
* @param nrf_wifi_rx_buf RX buffer info.
* @param num_buffs Number of buffers.
*
* This function is used to send host Rx buffers to UMAC module
*
* @return Command execution status
*/
enum nrf_wifi_status nrf_wifi_sys_fmac_prog_rx_buf_info(void *fmac_dev_ctx,
struct nrf_wifi_rx_buf *rx_buf,
unsigned int num_buffs);
#endif /* NRF71_HOST_RX_BUF_CMD*/
/**
* @}
*/
Expand Down
5 changes: 4 additions & 1 deletion fw_if/umac_if/inc/system/fmac_rx.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ enum nrf_wifi_status nrf_wifi_fmac_rx_event_process(struct nrf_wifi_fmac_dev_ctx
struct nrf_wifi_rx_buff *config);

void nrf_wifi_fmac_rx_tasklet(void *data);

#ifdef NRF71_HOST_RX_BUF_CMD
unsigned long nrf_wifi_fmac_get_rx_buf_map_addr(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
unsigned int desc_id);
#endif /* NRF71_HOST_RX_BUF_CMD */
#endif /* __FMAC_RX_H__ */
83 changes: 83 additions & 0 deletions fw_if/umac_if/src/system/fmac_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3346,6 +3346,89 @@ enum nrf_wifi_status nrf_wifi_sys_fmac_set_ps_exit_strategy(void *dev_ctx,

return status;
}

#ifdef NRF71_HOST_RX_BUF_CMD
enum nrf_wifi_status nrf_wifi_sys_fmac_prog_rx_buf_info(void *dev_ctx,
struct nrf_wifi_rx_buf *rx_buf,
unsigned int rx_buf_nums)
{
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
struct nrf_wifi_cmd_rx_buf_info *rx_buf_cmd = NULL;
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;
struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL;
struct nrf_wifi_rx_buf *rx_buf_iter = NULL;
int i = 0, remained_buf_cnt = 0, counter = 0, rx_buff_prog_cnt = 0;

fmac_dev_ctx = dev_ctx;
def_dev_ctx = wifi_dev_priv(fmac_dev_ctx);

if (rx_buf_nums > MAX_RX_BUFS_PER_CMD) {
rx_buff_prog_cnt = MAX_RX_BUFS_PER_CMD;
remained_buf_cnt = rx_buf_nums % MAX_RX_BUFS_PER_CMD;
counter = rx_buf_nums / MAX_RX_BUFS_PER_CMD;
} else {
rx_buff_prog_cnt = rx_buf_nums;
counter = 1;
}

rx_buf_iter = rx_buf;

for (i = 0; i < counter; i++) {
rx_buf_cmd = nrf_wifi_osal_mem_zalloc(sizeof(*rx_buf_cmd) +
rx_buff_prog_cnt *
sizeof(struct nrf_wifi_rx_buf));
if (!rx_buf_cmd) {
nrf_wifi_osal_log_err("%s: Unable to allocate memory\n",
__func__);
goto out;
}

rx_buf_cmd->umac_hdr.cmd_evnt = NRF_WIFI_UMAC_CMD_CONFIG_RX_BUF;
nrf_wifi_osal_mem_cpy(&rx_buf_cmd->info,
rx_buf,
rx_buff_prog_cnt * sizeof(struct nrf_wifi_rx_buf));

rx_buf_cmd->rx_buf_num = rx_buff_prog_cnt;

status = umac_cmd_cfg(fmac_dev_ctx,
rx_buf_cmd,
sizeof(*rx_buf_cmd) +
rx_buff_prog_cnt *
sizeof(struct nrf_wifi_rx_buf));
if (rx_buf_cmd) {
nrf_wifi_osal_mem_free(rx_buf_cmd);
}
}
if (remained_buf_cnt > 0) {
rx_buf_cmd = nrf_wifi_osal_mem_zalloc(sizeof(*rx_buf_cmd) +
remained_buf_cnt *
sizeof(struct nrf_wifi_rx_buf));
if (!rx_buf_cmd) {
nrf_wifi_osal_log_err("%s: Unable to allocate memory\n",
__func__);
goto out;
}

rx_buf_cmd->umac_hdr.cmd_evnt = NRF_WIFI_UMAC_CMD_CONFIG_RX_BUF;
nrf_wifi_osal_mem_cpy(&rx_buf_cmd->info,
rx_buf + (MAX_RX_BUFS_PER_CMD),
remained_buf_cnt * sizeof(struct nrf_wifi_rx_buf));

rx_buf_cmd->rx_buf_num = remained_buf_cnt;

status = umac_cmd_cfg(fmac_dev_ctx,
rx_buf_cmd,
sizeof(*rx_buf_cmd) +
remained_buf_cnt *
sizeof(struct nrf_wifi_rx_buf));
if (rx_buf_cmd) {
nrf_wifi_osal_mem_free(rx_buf_cmd);
}
}
out:
return status;
}
#endif /* NRF71_HOST_RX_BUF_CMD */
#endif /* NRF70_STA_MODE */

enum nrf_wifi_status nrf_wifi_sys_fmac_stats_get(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
Expand Down
88 changes: 87 additions & 1 deletion fw_if/umac_if/src/system/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "system/fmac_rx.h"
#include "common/fmac_util.h"
#include "system/fmac_promisc.h"
#ifdef NRF71_HOST_RX_BUF_CMD
#include "system/fmac_api.h"
#endif /* NRF71_HOST_RX_BUF_CMD */

static enum nrf_wifi_status
nrf_wifi_fmac_map_desc_to_pool(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
Expand Down Expand Up @@ -165,6 +168,47 @@ static void nrf_wifi_convert_to_eth(void *nwb,
}
#endif /* NRF70_STA_MODE */

#ifdef NRF71_HOST_RX_BUF_CMD
unsigned long nrf_wifi_fmac_get_rx_buf_map_addr(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
unsigned int desc_id)
{
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
struct nrf_wifi_sys_fmac_priv *sys_fpriv = NULL;
struct nrf_wifi_fmac_buf_map_info *rx_buf_info = NULL;
struct nrf_wifi_fmac_rx_pool_map_info pool_info;
unsigned long phy_addr = 0;

sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);
sys_fpriv = wifi_fmac_priv(fmac_dev_ctx->fpriv);

status = nrf_wifi_fmac_map_desc_to_pool(fmac_dev_ctx,
desc_id,
&pool_info);

if (status != NRF_WIFI_STATUS_SUCCESS) {
nrf_wifi_osal_log_err("%s: nrf_wifi_fmac_map_desc_to_pool failed\n",
__func__);
goto out;
}

rx_buf_info = &sys_dev_ctx->rx_buf_info[desc_id];

if (rx_buf_info->mapped) {
phy_addr = nrf_wifi_sys_hal_get_buf_map_rx(fmac_dev_ctx->hal_dev_ctx,
pool_info.pool_id,
pool_info.buf_id);
return phy_addr;
} else {
nrf_wifi_osal_log_err("%s: rx buffer not mapped for desc_id= %d\n",
__func__,
desc_id);
}
out:
return 0;
}
#endif /* NRF71_HOST_RX_BUF_CMD */

enum nrf_wifi_status nrf_wifi_fmac_rx_cmd_send(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
enum nrf_wifi_fmac_rx_cmd_type cmd_type,
unsigned int desc_id)
Expand Down Expand Up @@ -245,12 +289,14 @@ enum nrf_wifi_status nrf_wifi_fmac_rx_cmd_send(struct nrf_wifi_fmac_dev_ctx *fma
#else
rx_cmd.addr = (unsigned int)nwb_data;
#endif /* NRF71_ON_IPC */
#ifndef NRF71_HOST_RX_BUF_CMD
status = nrf_wifi_sys_hal_data_cmd_send(fmac_dev_ctx->hal_dev_ctx,
NRF_WIFI_HAL_MSG_TYPE_CMD_DATA_RX,
&rx_cmd,
sizeof(rx_cmd),
desc_id,
pool_info.pool_id);
#endif /* NRF71_HOST_RX_BUF_CMD */
} else if (cmd_type == NRF_WIFI_FMAC_RX_CMD_TYPE_DEINIT) {
#ifndef NRF71_ON_IPC
/* TODO: Need to initialize a command and send it to LMAC
Expand Down Expand Up @@ -359,6 +405,10 @@ enum nrf_wifi_status nrf_wifi_fmac_rx_event_process(struct nrf_wifi_fmac_dev_ctx
#endif /* NRF70_STA_MODE */
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
struct nrf_wifi_sys_fmac_priv *sys_fpriv = NULL;
#ifdef NRF71_HOST_RX_BUF_CMD
unsigned int buf_addr = 0;
struct nrf_wifi_rx_buf *rx_buf_ipc = NULL, *rx_buf_info_iter = NULL;
#endif /* NRF71_HOST_RX_BUF_CMD */

sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);
sys_fpriv = wifi_fmac_priv(fmac_dev_ctx->fpriv);
Expand All @@ -373,6 +423,12 @@ enum nrf_wifi_status nrf_wifi_fmac_rx_event_process(struct nrf_wifi_fmac_dev_ctx
#endif /* NRF70_STA_MODE */
num_pkts = config->rx_pkt_cnt;

#ifdef NRF71_HOST_RX_BUF_CMD
rx_buf_ipc = nrf_wifi_osal_mem_zalloc(num_pkts *
sizeof(struct nrf_wifi_rx_buf));
rx_buf_info_iter = rx_buf_ipc;
#endif /* NRF71_HOST_RX_BUF_CMD */

for (i = 0; i < num_pkts; i++) {
desc_id = config->rx_buff_info[i].descriptor_id;
pkt_len = config->rx_buff_info[i].rx_pkt_len;
Expand Down Expand Up @@ -548,8 +604,38 @@ enum nrf_wifi_status nrf_wifi_fmac_rx_event_process(struct nrf_wifi_fmac_dev_ctx
__func__);
continue;
}
#ifdef NRF71_HOST_RX_BUF_CMD
buf_addr = (unsigned int) nrf_wifi_fmac_get_rx_buf_map_addr(fmac_dev_ctx,
desc_id);
if (buf_addr) {
rx_buf_info_iter->skb_pointer = buf_addr;
rx_buf_info_iter->skb_desc_no = desc_id;
rx_buf_info_iter++;
} else {
nrf_wifi_osal_log_err("%s: UMAC rx buff not mapped\
for desc_id = %d\n",
__func__,
desc_id);
continue;
}
#endif /* NRF71_HOST_RX_BUF_CMD */
}

#ifdef NRF71_HOST_RX_BUF_CMD
status = nrf_wifi_sys_fmac_prog_rx_buf_info(fmac_dev_ctx,
rx_buf_ipc,
num_pkts);
if (status != NRF_WIFI_STATUS_SUCCESS) {
nrf_wifi_osal_log_err("%s: UMAC rx buff\
programming failed \n",
__func__);
status = NRF_WIFI_STATUS_FAIL;
} else {
nrf_wifi_osal_log_dbg("%s: UMAC rx buff refill\
programmed for num_buffs= %d \n",
__func__, num_pkts);
nrf_wifi_osal_mem_free(rx_buf_ipc);
}
#endif /* NRF71_HOST_RX_BUF_CMD */
/* A single failure returns failure for the entire event */
return status;
}
4 changes: 4 additions & 0 deletions hw_if/hal/inc/common/hal_structs_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ enum NRF_WIFI_HAL_STATUS {
* @brief Structure to hold RPU information.
*/
struct nrf_wifi_hal_info {
#ifdef NRF71_SOFT_HPQM
/** Host RPU soft_hpqm information */
struct soft_hpqm_info *soft_hpq;
#endif /* NRF71_SOFT_HPQM */
/** Host RPU HPQM information */
struct host_rpu_hpqm_info hpqm_info;
/** RX command base */
Expand Down
6 changes: 5 additions & 1 deletion hw_if/hal/inc/common/rpu_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,13 @@ struct rpu_mcu_boot_vectors {

/* Address which has information about the host port queue manager (HPQM) */
#define RPU_MEM_HPQ_INFO 0xB0000024
#ifdef NRF71_SOFT_HPQM
#define RPU_MEM_TX_CMD_BASE 0x200800B8
#define NRF_WIFI_SOFTHPQM_INFO_START_ADDR 0x20084548
#else
/* Address which has information about the TX command base */
#define RPU_MEM_TX_CMD_BASE 0xB00000B8

#endif /* NRF71_SOFT_HPQM */
/* Address which has OTP location containing the factory test program version */
#define RPU_MEM_OTP_FT_PROG_VERSION 0xB0004FD8
/* Address which has the OTP flags */
Expand Down
5 changes: 5 additions & 0 deletions hw_if/hal/inc/system/hal_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,9 @@ enum nrf_wifi_status nrf_wifi_hal_coex_config_sleep_ctrl_gpio_ctrl(
unsigned int invert_bt_coex_grant_output);
#endif /* NRF70_SR_COEX_SLEEP_CTRL_GPIO_CTRL */

#ifdef NRF71_HOST_RX_BUF_CMD
unsigned long nrf_wifi_sys_hal_get_buf_map_rx(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx,
unsigned int pool_id,
unsigned int buf_id);
#endif /* NRF71_HOST_RX_BUF_CMD */
#endif /* __HAL_API_SYS_H__ */
Loading