Skip to content

wifi: nrf_wifi: ignore interface if TX disabled #92361

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions drivers/wifi/nrf_wifi/src/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);

#include <zephyr/net/conn_mgr_monitor.h>
#include <zephyr/sys/reboot.h>

#include "net_private.h"
Expand Down Expand Up @@ -678,6 +679,11 @@ void nrf_wifi_if_init_zep(struct net_if *iface)
nrf_wifi_net_iface_work_handler);
#endif /* CONFIG_NRF70_DATA_TX */

#ifdef CONFIG_NRF70_SCAN_ONLY
/* In scan only mode this interface should be ignored by the connectivity manager */
conn_mgr_ignore_iface(iface);
#endif /* CONFIG_NRF70_SCAN_ONLY */

#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
k_work_init(&vif_ctx_zep->nrf_wifi_rpu_recovery_work,
nrf_wifi_rpu_recovery_work_handler);
Expand Down
13 changes: 6 additions & 7 deletions subsys/net/conn_mgr/conn_mgr_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static struct k_thread conn_mgr_mon_thread;
* conn_mgr_mon_get_if_by_index and conn_mgr_get_index_for_if are used to go back and forth between
* iface_states indices and Zephyr iface pointers.
*/
uint16_t iface_states[CONN_MGR_IFACE_MAX];
static uint16_t iface_states[CONN_MGR_IFACE_MAX];

/* Tracks the most recent total quantity of L4-ready ifaces (any, IPv4, IPv6) */
static uint16_t last_ready_count;
Expand All @@ -50,6 +50,11 @@ K_SEM_DEFINE(conn_mgr_mon_updated, 1, 1);
/* Used to protect conn_mgr_monitor state */
K_MUTEX_DEFINE(conn_mgr_mon_lock);

uint16_t *conn_mgr_if_state_internal(void)
{
return iface_states;
}

/**
* @brief Retrieves pointer to an iface by the index that corresponds to it in iface_states
*
Expand Down Expand Up @@ -400,12 +405,6 @@ void conn_mgr_watch_l2(const struct net_l2 *l2)

static int conn_mgr_mon_init(void)
{
int i;

for (i = 0; i < ARRAY_SIZE(iface_states); i++) {
iface_states[i] = 0;
}

k_thread_create(&conn_mgr_mon_thread, conn_mgr_mon_stack,
CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE,
conn_mgr_mon_thread_fn,
Expand Down
3 changes: 3 additions & 0 deletions subsys/net/conn_mgr/conn_mgr_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ void conn_mgr_init_events_handler(void);
/* Cause conn_mgr_connectivity to Initialize all connectivity implementation bindings */
void conn_mgr_conn_init(void);

/* Retrieve the raw pointer to the state array of size CONN_MGR_IFACE_MAX */
uint16_t *conn_mgr_if_state_internal(void);

/* Internal helper function to allow the shell net cm command to safely read conn_mgr state. */
uint16_t conn_mgr_if_state(struct net_if *iface);

Expand Down
5 changes: 3 additions & 2 deletions subsys/net/conn_mgr/events_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ LOG_MODULE_DECLARE(conn_mgr, CONFIG_NET_CONNECTION_MANAGER_LOG_LEVEL);
#include <zephyr/net/net_mgmt.h>
#include "conn_mgr_private.h"

extern uint16_t iface_states[CONN_MGR_IFACE_MAX];

static struct net_mgmt_event_callback iface_events_cb;
static struct net_mgmt_event_callback ipv6_events_cb;
static struct net_mgmt_event_callback ipv4_events_cb;
Expand All @@ -22,6 +20,7 @@ static void conn_mgr_iface_events_handler(struct net_mgmt_event_callback *cb,
uint64_t mgmt_event,
struct net_if *iface)
{
uint16_t *iface_states = conn_mgr_if_state_internal();
int idx;

NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "Iface", mgmt_event,
Expand Down Expand Up @@ -58,6 +57,7 @@ static void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb,
uint64_t mgmt_event,
struct net_if *iface)
{
uint16_t *iface_states = conn_mgr_if_state_internal();
int idx;

NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv6", mgmt_event,
Expand Down Expand Up @@ -115,6 +115,7 @@ static void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb,
uint64_t mgmt_event,
struct net_if *iface)
{
uint16_t *iface_states = conn_mgr_if_state_internal();
int idx;

NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv4", mgmt_event,
Expand Down