Skip to content

Commit 90be114

Browse files
authored
Merge branch 'main' into test/reset/NCSDK-36564_Analyze_device_reset
2 parents b008e54 + 32a0efc commit 90be114

File tree

42 files changed

+732
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+732
-125
lines changed

arch/riscv/core/vector_table.ld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*/
66

77
#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION)
8-
INCLUDE isr_tables_vt.ld
98
KEEP(*(.vectors.__start))
9+
. = ALIGN(CONFIG_ARCH_IRQ_VECTOR_TABLE_ALIGN);
10+
INCLUDE isr_tables_vt.ld
1011
#else
1112
KEEP(*(.vectors.*))
1213
#endif

boards/nordic/nrf54lm20dk/board.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
if(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP)
5-
board_runner_args(jlink "--device=cortex-m33" "--speed=4000")
5+
board_runner_args(jlink "--device=nRF54LM20A_M33" "--speed=4000")
66
elseif(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR)
7-
board_runner_args(jlink "--speed=4000")
7+
board_runner_args(jlink "--device=nRF54LM20A_RV32" "--speed=4000")
88
endif()
99

1010
if(CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP_NS)

doc/connectivity/bluetooth/api/mesh/provisioning.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ provisionee:
124124

125125
* **Static OOB:** An authentication value is assigned to the device in
126126
production, which the provisioner can query in some application specific
127-
way.
127+
way. For secure provisioning with the BTM_ECDH_P256_HMAC_SHA256_AES_CCM
128+
algorithm, the Static OOB value should contain more than 128 bits of entropy
129+
to provide adequate security against attacks.
128130
* **Input OOB:** The user inputs the authentication value. The available input
129131
actions are listed in :c:enum:`bt_mesh_input_action_t`.
130132
* **Output OOB:** Show the user the authentication value. The available output

drivers/i2s/i2s_nrf_tdm.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ LOG_MODULE_REGISTER(tdm_nrf, CONFIG_I2S_LOG_LEVEL);
3232
*/
3333
#define NRFX_TDM_STATUS_TRANSFER_STOPPED BIT(1)
3434

35+
/* Due to hardware limitations, the TDM peripheral requires the rx/tx size
36+
* to be greater than 8 bytes.
37+
*/
38+
#define NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED 8
39+
3540
/* Maximum clock divider value. Corresponds to CKDIV2. */
3641
#define NRFX_TDM_MAX_SCK_DIV_VALUE TDM_CONFIG_SCK_DIV_SCKDIV_Max
3742
#define NRFX_TDM_MAX_MCK_DIV_VALUE TDM_CONFIG_MCK_DIV_DIV_Max
@@ -475,8 +480,10 @@ static int tdm_nrf_configure(const struct device *dev, enum i2s_dir dir,
475480

476481
__ASSERT_NO_MSG(tdm_cfg->mem_slab != NULL && tdm_cfg->block_size != 0);
477482

478-
if ((tdm_cfg->block_size % sizeof(uint32_t)) != 0) {
479-
LOG_ERR("This device can transfer only full 32-bit words");
483+
if ((tdm_cfg->block_size % sizeof(uint32_t)) != 0 ||
484+
tdm_cfg->block_size <= NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED) {
485+
LOG_ERR("This device can only transmit full 32-bit words greater than %u bytes.",
486+
NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED);
480487
return -EINVAL;
481488
}
482489

@@ -673,11 +680,18 @@ static int tdm_nrf_write(const struct device *dev, void *mem_block, size_t size)
673680
return -EIO;
674681
}
675682

676-
if (size > drv_data->tx.cfg.block_size || size < sizeof(uint32_t)) {
683+
if (size > drv_data->tx.cfg.block_size) {
677684
LOG_ERR("This device can only write blocks up to %u bytes",
678685
drv_data->tx.cfg.block_size);
679686
return -EIO;
680687
}
688+
689+
if ((size % sizeof(uint32_t)) != 0 || size <= NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED) {
690+
LOG_ERR("This device can only write full 32-bit words greater than %u bytes.",
691+
NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED);
692+
return -EIO;
693+
}
694+
681695
ret = dmm_buffer_out_prepare(drv_cfg->mem_reg, buf.mem_block, buf.size,
682696
(void **)&buf.dmm_buf);
683697
ret = k_msgq_put(&drv_data->tx_queue, &buf, SYS_TIMEOUT_MS(drv_data->tx.cfg.timeout));

drivers/pwm/pwm_nrfx.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,11 @@ static int pwm_suspend(const struct device *dev)
354354
while (!nrfx_pwm_stopped_check(&data->pwm)) {
355355
}
356356

357-
memset(dev->data, 0, sizeof(struct pwm_nrfx_data));
357+
/* Explicitly clear driver state that might be invalid after subsequent resume. */
358+
data->period_cycles = 0;
359+
data->pwm_needed = 0;
360+
data->prescaler = 0;
361+
data->stop_requested = 0;
358362
(void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
359363

360364
return 0;

drivers/watchdog/wdt_nrfx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static int wdt_nrf_disable(const struct device *dev)
7575

7676
if (err_code < 0) {
7777
/* This can only happen if wdt_nrf_setup() is not called first. */
78-
return err_code;
78+
return -EFAULT;
7979
}
8080

8181
#if defined(WDT_NRFX_SYNC_STOP)

drivers/wifi/nrf_wifi/inc/fmac_main.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ struct nrf_wifi_vif_ctx_zep {
7575
#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */
7676
struct net_stats_eth eth_stats;
7777
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
78+
#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_TX)
79+
bool authorized;
80+
#endif
7881
#ifdef CONFIG_NRF70_STA_MODE
7982
unsigned int assoc_freq;
8083
enum nrf_wifi_fmac_if_carr_state if_carr_state;
@@ -151,6 +154,8 @@ void configure_tx_pwr_settings(struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_p
151154
void configure_board_dep_params(struct nrf_wifi_board_params *board_params);
152155
void set_tx_pwr_ceil_default(struct nrf_wifi_tx_pwr_ceil_params *pwr_ceil_params);
153156
const char *nrf_wifi_get_drv_version(void);
157+
char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
158+
char *buf, int buflen);
154159
enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep);
155160
enum nrf_wifi_status nrf_wifi_fmac_dev_rem_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep);
156161
struct nrf_wifi_vif_ctx_zep *nrf_wifi_get_vif_ctx(struct net_if *iface);

drivers/wifi/nrf_wifi/src/fmac_main.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,61 @@ static const unsigned int rx3_buf_sz = 1000;
114114
struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;
115115
static K_MUTEX_DEFINE(reg_lock);
116116

117+
/**
118+
* @brief Format a link layer address to a string buffer.
119+
*
120+
* @param ll Pointer to the link layer address bytes.
121+
* @param ll_len Length of the link layer address (typically 6 for MAC).
122+
* @param buf Buffer to store the formatted string.
123+
* @param buflen Size of the buffer.
124+
*
125+
* @return Pointer to the buffer on success, NULL on failure.
126+
*/
127+
char *nrf_wifi_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
128+
char *buf, int buflen)
129+
{
130+
uint8_t i, len, blen;
131+
char *ptr = buf;
132+
133+
if (ll == NULL) {
134+
return "<unknown>";
135+
}
136+
137+
switch (ll_len) {
138+
case 8:
139+
len = 8U;
140+
break;
141+
case 6:
142+
len = 6U;
143+
break;
144+
case 2:
145+
len = 2U;
146+
break;
147+
default:
148+
len = 6U;
149+
break;
150+
}
151+
152+
for (i = 0U, blen = buflen; i < len && blen > 0; i++) {
153+
uint8_t high = (ll[i] >> 4) & 0x0f;
154+
uint8_t low = ll[i] & 0x0f;
155+
156+
*ptr++ = (high < 10) ? (char)(high + '0') :
157+
(char)(high - 10 + 'A');
158+
*ptr++ = (low < 10) ? (char)(low + '0') :
159+
(char)(low - 10 + 'A');
160+
*ptr++ = ':';
161+
blen -= 3U;
162+
}
163+
164+
if (!(ptr - buf)) {
165+
return NULL;
166+
}
167+
168+
*(ptr - 1) = '\0';
169+
return buf;
170+
}
171+
117172
const char *nrf_wifi_get_drv_version(void)
118173
{
119174
return NRF70_DRIVER_VERSION;

drivers/wifi/nrf_wifi/src/net_if.c

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);
3131
#include "wpa_supp_if.h"
3232
#include "net_if.h"
3333

34-
extern char *net_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
35-
char *buf, int buflen);
36-
3734
#ifdef CONFIG_NRF70_STA_MODE
3835
static struct net_if_mcast_monitor mcast_monitor;
3936
#endif /* CONFIG_NRF70_STA_MODE */
@@ -391,6 +388,7 @@ int nrf_wifi_if_send(const struct device *dev,
391388
bool locked = false;
392389
unsigned char *ra = NULL;
393390
int peer_id = -1;
391+
bool authorized;
394392

395393
if (!dev || !pkt) {
396394
LOG_ERR("%s: vif_ctx_zep is NULL", __func__);
@@ -443,13 +441,28 @@ int nrf_wifi_if_send(const struct device *dev,
443441
ra = nrf_wifi_util_get_ra(sys_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx], nbuf);
444442
peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, ra);
445443
if (peer_id == -1) {
446-
nrf_wifi_osal_log_dbg("%s: Invalid peer",
447-
__func__);
448-
goto out;
444+
/* TODO: Make this an error once we fix ping_work sending packets despite
445+
* the interface being dormant
446+
*/
447+
#if CONFIG_WIFI_NRF70_LOG_LEVEL >= LOG_LEVEL_DBG
448+
char ra_buf[18] = {0};
449+
450+
LOG_DBG("%s: Got packet for unknown PEER: %s", __func__,
451+
nrf_wifi_sprint_ll_addr_buf(ra, 6, ra_buf,
452+
sizeof(ra_buf)));
453+
#endif
454+
goto drop;
455+
}
456+
457+
/* VIF or per-peer depending on RA */
458+
if (peer_id == MAX_PEERS) {
459+
authorized = vif_ctx_zep->authorized;
460+
} else {
461+
authorized = sys_dev_ctx->tx_config.peers[peer_id].authorized;
449462
}
450463

451464
if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) ||
452-
(!sys_dev_ctx->tx_config.peers[peer_id].authorized && !is_eapol(pkt))) {
465+
(!authorized && !is_eapol(pkt))) {
453466
ret = -EPERM;
454467
goto drop;
455468
}
@@ -495,7 +508,6 @@ static void ip_maddr_event_handler(struct net_if *iface,
495508
struct net_eth_addr mac_addr;
496509
struct nrf_wifi_umac_mcast_cfg *mcast_info = NULL;
497510
enum nrf_wifi_status status;
498-
uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")];
499511
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
500512
int ret;
501513

@@ -551,12 +563,15 @@ static void ip_maddr_event_handler(struct net_if *iface,
551563
vif_ctx_zep->vif_idx,
552564
mcast_info);
553565
if (status == NRF_WIFI_STATUS_FAIL) {
566+
char mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")];
567+
554568
LOG_ERR("%s: nrf_wifi_fmac_set_multicast failed for"
555569
" mac addr=%s",
556570
__func__,
557-
net_sprint_ll_addr_buf(mac_addr.addr,
558-
WIFI_MAC_ADDR_LEN, mac_string_buf,
559-
sizeof(mac_string_buf)));
571+
nrf_wifi_sprint_ll_addr_buf(mac_addr.addr,
572+
WIFI_MAC_ADDR_LEN,
573+
mac_string_buf,
574+
sizeof(mac_string_buf)));
560575
}
561576
unlock:
562577
nrf_wifi_osal_mem_free(mcast_info);

drivers/wifi/nrf_wifi/src/wifi_mgmt.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -875,18 +875,6 @@ int nrf_wifi_channel(const struct device *dev,
875875
return ret;
876876
}
877877

878-
for (i = 0; i < MAX_PEERS; i++) {
879-
peer = &sys_dev_ctx->tx_config.peers[i];
880-
if (peer->peer_id == -1) {
881-
continue;
882-
}
883-
if (peer->authorized) {
884-
LOG_ERR("%s: Cannot change channel when in station connected mode",
885-
__func__);
886-
return ret;
887-
}
888-
}
889-
890878
rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
891879
if (!rpu_ctx_zep) {
892880
LOG_ERR("%s: rpu_ctx_zep is NULL", __func__);
@@ -902,6 +890,18 @@ int nrf_wifi_channel(const struct device *dev,
902890
fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
903891
sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);
904892

893+
for (i = 0; i < MAX_PEERS; i++) {
894+
peer = &sys_dev_ctx->tx_config.peers[i];
895+
if (peer->peer_id == -1) {
896+
continue;
897+
}
898+
if (peer->authorized) {
899+
LOG_ERR("%s: Cannot change channel when in station connected mode",
900+
__func__);
901+
return ret;
902+
}
903+
}
904+
905905
if (channel->oper == WIFI_MGMT_SET) {
906906
/**
907907
* Send the driver vif_idx instead of upper layer sent if_index.

0 commit comments

Comments
 (0)