[PATCH 45/71] NAN: Configure peer even if there is not common schedule with it
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 1 15:01:54 PDT 2026
From: Ilan Peer <ilan.peer at intel.com>
Configure a peer even if there is no common schedule with it
so the underlying driver would know on what DWs the peer device
is available for reception.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/nan/nan.c | 56 +++++++++++++++++++++++++++++++++++++--------------
1 file changed, 41 insertions(+), 15 deletions(-)
diff --git a/src/nan/nan.c b/src/nan/nan.c
index 4a8bb5176a..46e38bc295 100644
--- a/src/nan/nan.c
+++ b/src/nan/nan.c
@@ -1186,9 +1186,11 @@ static bool nan_ndp_supported(struct nan_data *nan)
}
-static void nan_peer_get_committed_avail(const struct nan_data *nan,
- const struct nan_peer *peer,
- struct nan_peer_schedule *sched);
+static void
+nan_peer_get_committed_avail(const struct nan_data *nan,
+ const struct nan_peer *peer,
+ const struct nan_schedule *local_sched,
+ struct nan_peer_schedule *sched);
static int nan_configure_peer_schedule(struct nan_data *nan,
@@ -1202,11 +1204,12 @@ static int nan_configure_peer_schedule(struct nan_data *nan,
wpa_printf(MSG_DEBUG, "NAN: Configure peer schedule");
- if (!nan_peer_schedule_intersects(nan, peer, local_sched)) {
+ os_memset(&sched, 0, sizeof(sched));
+ if (nan_peer_schedule_intersects(nan, peer, local_sched))
+ nan_peer_get_committed_avail(nan, peer, local_sched, &sched);
+ else
wpa_printf(MSG_DEBUG,
- "NAN: Cannot configure peer NMI STA - no intersecting schedule");
- return 0;
- }
+ "NAN: Cannot configure peer schedule since there is no intersection");
dl_list_for_each(cur, &peer->info.dev_capa,
struct nan_dev_capa_entry, list) {
@@ -1224,9 +1227,6 @@ static int nan_configure_peer_schedule(struct nan_data *nan,
return -1;
}
- os_memset(&sched, 0, sizeof(sched));
- nan_peer_get_committed_avail(nan, peer, &sched);
-
ret = nan->cfg->set_peer_schedule(nan->cfg->cb_ctx, peer->nmi_addr,
!peer->configured, capa->cdw_info,
peer->info.seq_id,
@@ -1839,10 +1839,28 @@ int nan_peer_get_tk(struct nan_data *nan, const u8 *addr,
}
+static bool
+nan_peer_channel_in_local_sched(const struct nan_data *nan,
+ int peer_ctrl_freq,
+ const struct nan_schedule *local_sched)
+{
+ size_t i;
+
+ /* It's enough to compare the control freqs to ensure compatibility */
+ for (i = 0; i < local_sched->n_chans; i++) {
+ if (peer_ctrl_freq == local_sched->chans[i].chan.freq)
+ return true;
+ }
+
+ return false;
+}
+
+
static void
nan_peer_get_committed_avail_add(const struct nan_data *nan,
const struct nan_peer *peer,
const struct nan_avail_entry *avail,
+ const struct nan_schedule *local_sched,
struct nan_peer_schedule *sched)
{
struct nan_map *map;
@@ -1925,6 +1943,11 @@ nan_peer_get_committed_avail_add(const struct nan_data *nan,
freq = freq - 70 + idx * 20;
/* TODO: Missing support for 80 + 80 */
+
+ /* Skip channels that are not in local schedule */
+ if (local_sched &&
+ !nan_peer_channel_in_local_sched(nan, freq, local_sched))
+ return;
}
/* Assume committed for conditional slots if setup is done */
@@ -1986,15 +2009,18 @@ nan_peer_get_committed_avail_add(const struct nan_data *nan,
}
-static void nan_peer_get_committed_avail(const struct nan_data *nan,
- const struct nan_peer *peer,
- struct nan_peer_schedule *sched)
+static void
+nan_peer_get_committed_avail(const struct nan_data *nan,
+ const struct nan_peer *peer,
+ const struct nan_schedule *local_sched,
+ struct nan_peer_schedule *sched)
{
const struct nan_avail_entry *avail;
dl_list_for_each(avail, &peer->info.avail_entries,
struct nan_avail_entry, list)
- nan_peer_get_committed_avail_add(nan, peer, avail, sched);
+ nan_peer_get_committed_avail_add(nan, peer, avail,
+ local_sched, sched);
}
@@ -2108,7 +2134,7 @@ int nan_peer_get_schedule_info(struct nan_data *nan, const u8 *addr,
if (!peer)
return -1;
- nan_peer_get_committed_avail(nan, peer, sched);
+ nan_peer_get_committed_avail(nan, peer, NULL, sched);
nan_peer_get_ndc_sched(nan, peer, sched);
nan_peer_get_immut_sched(nan, peer, sched);
--
2.53.0
More information about the Hostap
mailing list