Skip to content
5 changes: 5 additions & 0 deletions drivers/wifi/nrf_wifi/inc/fmac_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */
struct net_stats_eth eth_stats;
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_TX)
bool authorized;
#endif
#ifdef CONFIG_NRF70_STA_MODE
unsigned int assoc_freq;
enum nrf_wifi_fmac_if_carr_state if_carr_state;
Expand Down Expand Up @@ -151,7 +154,9 @@
void configure_board_dep_params(struct nrf_wifi_board_params *board_params);
void set_tx_pwr_ceil_default(struct nrf_wifi_tx_pwr_ceil_params *pwr_ceil_params);
const char *nrf_wifi_get_drv_version(void);
char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
char *buf, int buflen);
enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep);

Check notice on line 159 in drivers/wifi/nrf_wifi/inc/fmac_main.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/inc/fmac_main.h:159 -char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len, - char *buf, int buflen); +char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len, char *buf, int buflen);
enum nrf_wifi_status nrf_wifi_fmac_dev_rem_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep);
struct nrf_wifi_vif_ctx_zep *nrf_wifi_get_vif_ctx(struct net_if *iface);
#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
Expand Down
55 changes: 55 additions & 0 deletions drivers/wifi/nrf_wifi/src/fmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,61 @@
struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;
static K_MUTEX_DEFINE(reg_lock);

/**
* @brief Format a link layer address to a string buffer.
*
* @param ll Pointer to the link layer address bytes.
* @param ll_len Length of the link layer address (typically 6 for MAC).
* @param buf Buffer to store the formatted string.
* @param buflen Size of the buffer.
*
* @return Pointer to the buffer on success, NULL on failure.
*/
char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
char *buf, int buflen)
{

Check notice on line 129 in drivers/wifi/nrf_wifi/src/fmac_main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/fmac_main.c:129 -char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len, - char *buf, int buflen) +char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len, char *buf, int buflen)
uint8_t i, len, blen;
char *ptr = buf;

if (ll == NULL) {
return "<unknown>";
}

switch (ll_len) {
case 8:
len = 8U;
break;
case 6:
len = 6U;
break;
case 2:
len = 2U;
break;
default:
len = 6U;
break;
}

for (i = 0U, blen = buflen; i < len && blen > 0; i++) {
uint8_t high = (ll[i] >> 4) & 0x0f;
uint8_t low = ll[i] & 0x0f;

*ptr++ = (high < 10) ? (char)(high + '0') :
(char)(high - 10 + 'A');
*ptr++ = (low < 10) ? (char)(low + '0') :
(char)(low - 10 + 'A');
*ptr++ = ':';

Check notice on line 160 in drivers/wifi/nrf_wifi/src/fmac_main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/fmac_main.c:160 - *ptr++ = (high < 10) ? (char)(high + '0') : - (char)(high - 10 + 'A'); - *ptr++ = (low < 10) ? (char)(low + '0') : - (char)(low - 10 + 'A'); + *ptr++ = (high < 10) ? (char)(high + '0') : (char)(high - 10 + 'A'); + *ptr++ = (low < 10) ? (char)(low + '0') : (char)(low - 10 + 'A');
blen -= 3U;
}

if (!(ptr - buf)) {
return NULL;
}

*(ptr - 1) = '\0';
return buf;
}

const char *nrf_wifi_get_drv_version(void)
{
return NRF70_DRIVER_VERSION;
Expand Down
37 changes: 26 additions & 11 deletions drivers/wifi/nrf_wifi/src/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
#include "wpa_supp_if.h"
#include "net_if.h"

extern char *net_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
char *buf, int buflen);

#ifdef CONFIG_NRF70_STA_MODE
static struct net_if_mcast_monitor mcast_monitor;
#endif /* CONFIG_NRF70_STA_MODE */
Expand Down Expand Up @@ -391,6 +388,7 @@
bool locked = false;
unsigned char *ra = NULL;
int peer_id = -1;
bool authorized;

if (!dev || !pkt) {
LOG_ERR("%s: vif_ctx_zep is NULL", __func__);
Expand Down Expand Up @@ -443,13 +441,28 @@
ra = nrf_wifi_util_get_ra(sys_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx], nbuf);
peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, ra);
if (peer_id == -1) {
nrf_wifi_osal_log_dbg("%s: Invalid peer",
__func__);
goto out;
/* TODO: Make this an error once we fix ping_work sending packets despite
* the interface being dormant
*/
#if CONFIG_WIFI_NRF70_LOG_LEVEL >= LOG_LEVEL_DBG
char ra_buf[18] = {0};

LOG_DBG("%s: Got packet for unknown PEER: %s", __func__,
nrf_wifi_sprint_ll_addr_buf(ra, 6, ra_buf,
sizeof(ra_buf)));
#endif

Check notice on line 453 in drivers/wifi/nrf_wifi/src/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/net_if.c:453 - nrf_wifi_sprint_ll_addr_buf(ra, 6, ra_buf, - sizeof(ra_buf))); + nrf_wifi_sprint_ll_addr_buf(ra, 6, ra_buf, sizeof(ra_buf)));
goto drop;
}

/* VIF or per-peer depending on RA */
if (peer_id == MAX_PEERS) {
authorized = vif_ctx_zep->authorized;
} else {
authorized = sys_dev_ctx->tx_config.peers[peer_id].authorized;
}

if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) ||
(!sys_dev_ctx->tx_config.peers[peer_id].authorized && !is_eapol(pkt))) {
(!authorized && !is_eapol(pkt))) {
ret = -EPERM;
goto drop;
}
Expand Down Expand Up @@ -495,7 +508,6 @@
struct net_eth_addr mac_addr;
struct nrf_wifi_umac_mcast_cfg *mcast_info = NULL;
enum nrf_wifi_status status;
uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")];
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
int ret;

Expand Down Expand Up @@ -551,13 +563,16 @@
vif_ctx_zep->vif_idx,
mcast_info);
if (status == NRF_WIFI_STATUS_FAIL) {
char mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")];

LOG_ERR("%s: nrf_wifi_fmac_set_multicast failed for"
" mac addr=%s",
__func__,
net_sprint_ll_addr_buf(mac_addr.addr,
WIFI_MAC_ADDR_LEN, mac_string_buf,
sizeof(mac_string_buf)));
nrf_wifi_sprint_ll_addr_buf(mac_addr.addr,
WIFI_MAC_ADDR_LEN,
mac_string_buf,
sizeof(mac_string_buf)));
}

Check notice on line 575 in drivers/wifi/nrf_wifi/src/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/net_if.c:575 - nrf_wifi_sprint_ll_addr_buf(mac_addr.addr, - WIFI_MAC_ADDR_LEN, - mac_string_buf, - sizeof(mac_string_buf))); + nrf_wifi_sprint_ll_addr_buf(mac_addr.addr, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf)));
unlock:
nrf_wifi_osal_mem_free(mcast_info);
k_mutex_unlock(&vif_ctx_zep->vif_lock);
Expand Down
24 changes: 12 additions & 12 deletions drivers/wifi/nrf_wifi/src/wifi_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,18 +875,6 @@ int nrf_wifi_channel(const struct device *dev,
return ret;
}

for (i = 0; i < MAX_PEERS; i++) {
peer = &sys_dev_ctx->tx_config.peers[i];
if (peer->peer_id == -1) {
continue;
}
if (peer->authorized) {
LOG_ERR("%s: Cannot change channel when in station connected mode",
__func__);
return ret;
}
}

rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
if (!rpu_ctx_zep) {
LOG_ERR("%s: rpu_ctx_zep is NULL", __func__);
Expand All @@ -902,6 +890,18 @@ int nrf_wifi_channel(const struct device *dev,
fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);

for (i = 0; i < MAX_PEERS; i++) {
peer = &sys_dev_ctx->tx_config.peers[i];
if (peer->peer_id == -1) {
continue;
}
if (peer->authorized) {
LOG_ERR("%s: Cannot change channel when in station connected mode",
__func__);
return ret;
}
}

if (channel->oper == WIFI_MGMT_SET) {
/**
* Send the driver vif_idx instead of upper layer sent if_index.
Expand Down
61 changes: 37 additions & 24 deletions drivers/wifi/nrf_wifi/src/wpa_supp_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,9 +1108,8 @@
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
struct nrf_wifi_umac_chg_sta_info chg_sta_info;
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx;
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
int peer_id = -1;
int ret = -1;

if (!if_priv || !bssid) {
Expand All @@ -1131,6 +1130,12 @@
goto out;
}

sys_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx);
if (!sys_dev_ctx) {
LOG_ERR("%s: sys_dev_ctx is NULL", __func__);
goto out;
}

if (vif_ctx_zep->if_op_state != NRF_WIFI_FMAC_IF_OP_STATE_UP) {
LOG_DBG("%s: Interface not UP, ignoring", __func__);
ret = 0;
Expand All @@ -1141,6 +1146,7 @@

memcpy(chg_sta_info.mac_addr, bssid, ETH_ALEN);

vif_ctx_zep->authorized = authorized;
if (authorized) {
/* BIT(NL80211_STA_FLAG_AUTHORIZED) */
chg_sta_info.sta_flags2.nrf_wifi_mask = 1 << 1;
Expand All @@ -1158,17 +1164,8 @@
goto out;
}

sys_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx);

peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, chg_sta_info.mac_addr);
if (peer_id == -1) {
nrf_wifi_osal_log_err("%s: Invalid peer",
__func__);
goto out;
}

if (chg_sta_info.sta_flags2.nrf_wifi_set & NRF_WIFI_STA_FLAG_AUTHORIZED) {
sys_dev_ctx->tx_config.peers[peer_id].authorized = true;
if (vif_ctx_zep->if_type == NRF_WIFI_IFTYPE_STATION) {
sys_dev_ctx->tx_config.peers[0].authorized = authorized;
}

ret = 0;
Expand Down Expand Up @@ -3007,6 +3004,7 @@
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
int peer_id = -1;
int ret = -1;
char buf[18] = {0};

if (!if_priv || !addr) {
LOG_ERR("%s: Invalid params", __func__);
Expand All @@ -3028,30 +3026,45 @@

memcpy(chg_sta.mac_addr, addr, sizeof(chg_sta.mac_addr));

if (!net_eth_is_addr_valid((struct net_eth_addr *)&chg_sta.mac_addr)) {
LOG_ERR("%s: Invalid peer MAC address: %s", __func__,
nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf,
sizeof(buf)));
goto out;
}

peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, chg_sta.mac_addr);
if (peer_id == -1) {
LOG_ERR("%s: Unknown PEER: %s", __func__,
nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf,
sizeof(buf)));
goto out;
}

if (peer_id == MAX_PEERS) {
LOG_ERR("%s: Invalid PEER (group): %s", __func__,
nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf,
sizeof(buf)));
goto out;

Check notice on line 3048 in drivers/wifi/nrf_wifi/src/wpa_supp_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/wpa_supp_if.c:3048 - nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf, - sizeof(buf))); + nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf, sizeof(buf))); goto out; } peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, chg_sta.mac_addr); if (peer_id == -1) { LOG_ERR("%s: Unknown PEER: %s", __func__, - nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf, - sizeof(buf))); + nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf, sizeof(buf))); goto out; } if (peer_id == MAX_PEERS) { LOG_ERR("%s: Invalid PEER (group): %s", __func__, - nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf, - sizeof(buf))); + nrf_wifi_sprint_ll_addr_buf(chg_sta.mac_addr, 6, buf, sizeof(buf)));
}

chg_sta.sta_flags2.nrf_wifi_mask = nrf_wifi_sta_flags_to_nrf(flags_or | ~flags_and);
chg_sta.sta_flags2.nrf_wifi_set = nrf_wifi_sta_flags_to_nrf(flags_or);

LOG_DBG("%s %x, %x", __func__,
chg_sta.sta_flags2.nrf_wifi_set, chg_sta.sta_flags2.nrf_wifi_mask);

status = nrf_wifi_sys_fmac_chg_sta(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &chg_sta);
status = nrf_wifi_sys_fmac_chg_sta(rpu_ctx_zep->rpu_ctx,
vif_ctx_zep->vif_idx, &chg_sta);
if (status != NRF_WIFI_STATUS_SUCCESS) {

Check notice on line 3059 in drivers/wifi/nrf_wifi/src/wpa_supp_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/wpa_supp_if.c:3059 - status = nrf_wifi_sys_fmac_chg_sta(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, &chg_sta); + status = nrf_wifi_sys_fmac_chg_sta(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &chg_sta);
LOG_ERR("%s: nrf_wifi_sys_fmac_chg_sta failed", __func__);
goto out;
}

sys_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx);

peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, chg_sta.mac_addr);
if (peer_id == -1) {
nrf_wifi_osal_log_err("%s: Invalid peer",
__func__);
goto out;
}

if (chg_sta.sta_flags2.nrf_wifi_set & NRF_WIFI_STA_FLAG_AUTHORIZED) {
sys_dev_ctx->tx_config.peers[peer_id].authorized = true;
}
sys_dev_ctx->tx_config.peers[peer_id].authorized =
!!(chg_sta.sta_flags2.nrf_wifi_set & NRF_WIFI_STA_FLAG_AUTHORIZED);

ret = 0;

Expand Down
2 changes: 1 addition & 1 deletion modules/hostap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ config WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE
# overflow issues. Need to identify the cause for higher stack usage.
default 8192 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
# This is needed to handle stack overflow issues on nRF Wi-Fi drivers.
default 5900 if WIFI_NM_WPA_SUPPLICANT_AP
default 6144 if WIFI_NM_WPA_SUPPLICANT_AP
default 5800

config WIFI_NM_WPA_SUPPLICANT_WQ_STACK_SIZE
Expand Down
4 changes: 2 additions & 2 deletions west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ manifest:
groups:
- hal
- name: hal_nordic
revision: 564e754139944286208f3eac122781cec4262392
revision: e891e1cda4db109c6816cc929dda4f6a18e3e1bc
path: modules/hal/nordic
groups:
- hal
Expand Down Expand Up @@ -337,7 +337,7 @@ manifest:
revision: 5eec7aca321735f5fc8e3e7c79e162f0e9810b16
path: modules/bsim_hw_models/nrf_hw_models
- name: nrf_wifi
revision: f0b6706cac522371e651f589d53d3026cc6f97dd
revision: 97c6751657187ab811e73c36cc4c47acb1783fff
path: modules/lib/nrf_wifi
- name: open-amp
revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637
Expand Down
Loading