Skip to content
Merged
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
32 changes: 16 additions & 16 deletions drivers/wifi/nrf_wifi/Kconfig.nrfwifi
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ config NRF_WIFI_LOW_POWER

config NRF70_TCP_IP_CHECKSUM_OFFLOAD
bool "TCP/IP checksum offload"
depends on !NRF71_ON_IPC
default y

config NRF70_REG_DOMAIN
Expand Down Expand Up @@ -664,28 +665,27 @@ config WIFI_NRF70_SCAN_TIMEOUT_S
int "Scan timeout in seconds"
default 30

menu "nRF Wi-Fi operation band(s)"
visible if !NRF70_2_4G_ONLY
choice NRF_WIFI_OP_BAND
prompt "nRF Wi-Fi operation bands"
default NRF_WIFI_2G_BAND if NRF70_2_4G_ONLY
default NRF_WIFI_ALL_BAND

config NRF_WIFI_ALL_BAND
bool "Set operation band to all supported bands"

config NRF_WIFI_2G_BAND
bool "Set operation band to 2.4GHz"
default y if NRF70_2_4G_ONLY

config NRF_WIFI_5G_BAND
bool "Set operation band to 5GHz"
depends on !NRF70_2_4G_ONLY

config NRF_WIFI_OP_BAND
int "Options to set operation band"
default 1 if NRF_WIFI_2G_BAND
default 2 if NRF_WIFI_5G_BAND
default 3
help
Set this option to select frequency band
1 - 2.4GHz
2 - 5GHz
3 - All ( 2.4GHz and 5GHz )
endmenu
if NRF71_ON_IPC
config NRF_WIFI_6G_BAND
bool "Set operation band to 6GHz"

config NRF_WIFI_DUAL_BAND
bool "Set operation band to 2.4GHz and 5GHz"
endif # NRF71_ON_IPC
endchoice

config NRF_WIFI_IFACE_MTU
int "MTU for Wi-Fi interface"
Expand Down
5 changes: 4 additions & 1 deletion drivers/wifi/nrf_wifi/inc/fmac_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
#else
#include <radio_test/fmac_api.h>
#endif /* !CONFIG_NRF70_RADIO_TEST */

#ifdef CONFIG_NRF71_ON_IPC
#include <nrf71_wifi_ctrl.h>
#else
#include <host_rpu_umac_if.h>
#endif /* CONFIG_NRF71_ON_IPC */

#define NRF70_DRIVER_VERSION "1."KERNEL_VERSION_STRING

Expand Down
22 changes: 21 additions & 1 deletion drivers/wifi/nrf_wifi/off_raw_tx/src/off_raw_tx_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,25 @@ static int bytes_from_str(uint8_t *buf, int buf_len, const char *src)
}
#endif /* CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED */

static enum op_band get_nrf_wifi_op_band(void)
{
if (IS_ENABLED(CONFIG_NRF_WIFI_2G_BAND)) {
return BAND_24G;
}
#ifdef CONFIG_NRF71_ON_IPC
if (IS_ENABLED(CONFIG_NRF_WIFI_5G_BAND)) {
return BAND_5G;
}
if (IS_ENABLED(CONFIG_NRF_WIFI_6G_BAND)) {
return BAND_6G;
}
if (IS_ENABLED(CONFIG_NRF_WIFI_DUAL_BAND)) {
return BAND_DUAL;
}
#endif /* CONFIG_NRF71_ON_IPC */
return BAND_ALL;
}

int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code)
{
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
Expand All @@ -138,6 +157,7 @@ int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code)
struct nrf_wifi_board_params board_params;
unsigned int fw_ver = 0;
k_spinlock_key_t key;
enum op_band op_band = get_nrf_wifi_op_band();

/* The OSAL layer needs to be initialized before any other initialization
* so that other layers (like FW IF,HW IF etc) have access to OS ops
Expand Down Expand Up @@ -202,7 +222,7 @@ int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code)
HW_SLEEP_ENABLE,
#endif /* CONFIG_NRF_WIFI_LOW_POWER */
NRF_WIFI_DEF_PHY_CALIB,
CONFIG_NRF_WIFI_OP_BAND,
op_band,
IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING),
&ctrl_params,
&ceil_params,
Expand Down
4 changes: 4 additions & 0 deletions drivers/wifi/nrf_wifi/src/debug_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
*/
#include <stdlib.h>
#include <zephyr/shell/shell.h>
#ifdef NRF71_ON_IPC
#include <nrf71_wifi_ctrl.h>
#else
#include "host_rpu_umac_if.h"
#endif
#include "fmac_main.h"

extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;
Expand Down
39 changes: 32 additions & 7 deletions drivers/wifi/nrf_wifi/src/fmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ BUILD_ASSERT(CONFIG_NRF70_MAX_TX_AGGREGATION <= 15,
"Max TX aggregation is 15");
BUILD_ASSERT(CONFIG_NRF70_RX_NUM_BUFS >= 1,
"At least one RX buffer is required");
#ifndef CONFIG_NRF71_ON_IPC
BUILD_ASSERT(RPU_PKTRAM_SIZE - TOTAL_RX_SIZE >= TOTAL_TX_SIZE,
"Packet RAM overflow: not enough memory for TX");

#endif /* CONFIG_NRF71_ON_IPC */
BUILD_ASSERT(CONFIG_NRF70_TX_MAX_DATA_SIZE >= MAX_TX_FRAME_SIZE,
"TX buffer size must be at least as big as the MTU and headroom");

Expand Down Expand Up @@ -503,12 +504,9 @@ void reg_change_callbk_fn(void *vif_ctx,
}
#endif /* !CONFIG_NRF70_RADIO_TEST */

#ifdef CONFIG_NRF71_ON_IPC
#define MAX_TX_PWR(label) DT_PROP(DT_NODELABEL(wifi), label) * 4
#else
#ifndef CONFIG_NRF71_ON_IPC
/* DTS uses 1dBm as the unit for TX power, while the RPU uses 0.25dBm */
#define MAX_TX_PWR(label) DT_PROP(DT_NODELABEL(nrf70), label) * 4
#endif /* CONFIG_NRF71_ON_IPC */

void configure_tx_pwr_settings(struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_params,
struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params)
Expand Down Expand Up @@ -587,13 +585,34 @@ void configure_board_dep_params(struct nrf_wifi_board_params *board_params)
board_params->pcb_loss_5g_band3 = CONFIG_NRF70_PCB_LOSS_5G_BAND3;
#endif /* CONFIG_NRF70_2_4G_ONLY */
}
#endif /* CONFIG_NRF71_ON_IPC */

static enum op_band get_nrf_wifi_op_band(void)
{
if (IS_ENABLED(CONFIG_NRF_WIFI_2G_BAND)) {
return BAND_24G;
}
#ifdef CONFIG_NRF71_ON_IPC
if (IS_ENABLED(CONFIG_NRF_WIFI_5G_BAND)) {
return BAND_5G;
}

if (IS_ENABLED(CONFIG_NRF_WIFI_6G_BAND)) {
return BAND_6G;
}
if (IS_ENABLED(CONFIG_NRF_WIFI_DUAL_BAND)) {
return BAND_DUAL;
}
#endif /* CONFIG_NRF71_ON_IPC */
return BAND_ALL;
}

enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep)
{
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
void *rpu_ctx = NULL;
enum op_band op_band = CONFIG_NRF_WIFI_OP_BAND;
enum op_band op_band = get_nrf_wifi_op_band();
#ifdef CONFIG_NRF_WIFI_LOW_POWER
int sleep_type = -1;

Expand All @@ -606,7 +625,6 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv
struct nrf_wifi_tx_pwr_ctrl_params tx_pwr_ctrl_params;
struct nrf_wifi_tx_pwr_ceil_params tx_pwr_ceil_params;
struct nrf_wifi_board_params board_params;

unsigned int fw_ver = 0;

#if defined(CONFIG_NRF70_SR_COEX_SLEEP_CTRL_GPIO_CTRL) && \
Expand Down Expand Up @@ -654,10 +672,12 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv
NRF_WIFI_UMAC_VER_MIN(fw_ver),
NRF_WIFI_UMAC_VER_EXTRA(fw_ver));

#ifndef CONFIG_NRF71_ON_IPC
configure_tx_pwr_settings(&tx_pwr_ctrl_params,
&tx_pwr_ceil_params);

configure_board_dep_params(&board_params);
#endif /* CONFIG_NRF71_ON_IPC */

#if defined(CONFIG_NRF70_SR_COEX_SLEEP_CTRL_GPIO_CTRL) && \
defined(CONFIG_NRF70_SYSTEM_MODE)
Expand Down Expand Up @@ -853,9 +873,14 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
struct nrf_wifi_sys_fmac_priv *sys_fpriv = NULL;

sys_fpriv = wifi_fmac_priv(rpu_drv_priv_zep.fmac_priv);
#ifdef CONFIG_NRF71_ON_IPC
/* TODO: Revisit this */
sys_fpriv->max_ampdu_len_per_token = 8192;
#else
sys_fpriv->max_ampdu_len_per_token =
(RPU_PKTRAM_SIZE - (CONFIG_NRF70_RX_NUM_BUFS * CONFIG_NRF70_RX_MAX_DATA_SIZE)) /
CONFIG_NRF70_MAX_TX_TOKENS;
#endif /* CONFIG_NRF71_ON_IPC */
/* Align to 4-byte */
sys_fpriv->max_ampdu_len_per_token &= ~0x3;

Expand Down
8 changes: 7 additions & 1 deletion drivers/wifi/nrf_wifi/src/fw_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,33 @@
LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);

#include <fmac_main.h>
#ifndef CONFIG_NRF71_ON_IPC
static const char fw_patch[] = {
#include <nrf70_fw_patch/nrf70.bin.inc>
};
#endif /* CONFIG_NRF71_ON_IPC */

enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx)
{
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;

#ifndef CONFIG_NRF71_ON_IPC
struct nrf_wifi_fmac_fw_info fw_info = { 0 };

status = nrf_wifi_fmac_fw_parse(rpu_ctx, fw_patch, sizeof(fw_patch), &fw_info);
if (status != NRF_WIFI_STATUS_SUCCESS) {
LOG_ERR("%s: nrf_wifi_fmac_fw_parse failed", __func__);
return status;
}
#ifndef CONFIG_NRF71_ON_IPC

/* Load the FW patches to the RPU */
status = nrf_wifi_fmac_fw_load(rpu_ctx, &fw_info);

if (status != NRF_WIFI_STATUS_SUCCESS) {
LOG_ERR("%s: nrf_wifi_fmac_fw_load failed", __func__);
}
#else
status = NRF_WIFI_STATUS_SUCCESS;
#endif /* !CONFIG_NRF71_ON_IPC */
return status;
}
3 changes: 2 additions & 1 deletion drivers/wifi/nrf_wifi/src/wifi_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,9 @@ int nrf_wifi_set_twt(const struct device *dev,

twt_info.dialog_token = twt_params->dialog_token;
twt_info.twt_wake_ahead_duration = twt_params->setup.twt_wake_ahead_duration;
#ifndef CONFIG_NRF71_ON_IPC
twt_info.twt_req_timeout = CONFIG_NRF_WIFI_TWT_SETUP_TIMEOUT_MS;

#endif /* CONFIG_NRF71_ON_IPC */
status = nrf_wifi_sys_fmac_twt_setup(rpu_ctx_zep->rpu_ctx,
vif_ctx_zep->vif_idx,
&twt_info);
Expand Down
11 changes: 11 additions & 0 deletions drivers/wifi/nrf_wifi/src/wifi_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@
* @brief NRF Wi-Fi util shell module
*/
#include <stdlib.h>
#ifdef NRF71_ON_IPC
#include <nrf71_wifi_ctrl.h>
#else
#include "host_rpu_umac_if.h"
#endif
#include "common/fmac_util.h"
#include "system/fmac_api.h"
#include "fmac_main.h"
#include "wifi_util.h"

#ifndef CONFIG_NRF71_ON_IPC
#include "rpu_lmac_phy_stats.h"
#include "rpu_umac_stats.h"
#endif

extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;
struct nrf_wifi_ctx_zep *ctx = &rpu_drv_priv_zep.rpu_ctx_zep;
Expand Down Expand Up @@ -973,6 +979,7 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh,
}
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */

#ifndef CONFIG_NRF71_ON_IPC
static int nrf_wifi_dump_stats(const struct shell *sh,
struct nrf_wifi_hal_dev_ctx *hal_dev_ctx,
const char *name,
Expand Down Expand Up @@ -1010,6 +1017,7 @@ static int nrf_wifi_dump_stats(const struct shell *sh,
return ret;
}


static int nrf_wifi_util_dump_rpu_stats_mem(const struct shell *sh,
size_t argc,
const char *argv[])
Expand Down Expand Up @@ -1095,6 +1103,7 @@ static int nrf_wifi_util_dump_rpu_stats_mem(const struct shell *sh,
k_mutex_unlock(&ctx->rpu_lock);
return ret;
}
#endif /* !CONFIG_NRF71_ON_IPC */

SHELL_STATIC_SUBCMD_SET_CREATE(
nrf70_util,
Expand Down Expand Up @@ -1199,13 +1208,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
1,
0),
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */
#ifndef CONFIG_NRF71_ON_IPC
SHELL_CMD_ARG(rpu_stats_mem,
NULL,
"Display RPU stats by reading from memory "
"Parameters: umac or lmac or or all (default)",
nrf_wifi_util_dump_rpu_stats_mem,
1,
1),
#endif /* !CONFIG_NRF71_ON_IPC */
SHELL_SUBCMD_SET_END);


Expand Down
4 changes: 4 additions & 0 deletions drivers/wifi/nrf_wifi/src/wifi_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
#include <zephyr/shell/shell.h>
#include <zephyr/init.h>
#include <ctype.h>
#ifdef CONFIG_NRF71_ON_IPC
#include <nrf71_wifi_ctrl.h>
#else
#include <host_rpu_sys_if.h>
#endif
#include <common/fmac_structs_common.h>
#include <queue.h>

Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ manifest:
revision: 40403f5f2805cca210d2a47c8717d89c4e816cda
path: modules/bsim_hw_models/nrf_hw_models
- name: nrf_wifi
revision: b822726084f55df19aa6660dc46cf602757e8645
revision: e269670cd17fb8ccc4b7004544276bc7d9578496
path: modules/lib/nrf_wifi
- name: open-amp
revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637
Expand Down