[PATCH 44/71] NAN: Make the potential entries in NAN availability attribute optional
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 1 15:01:53 PDT 2026
From: Avraham Stern <avraham.stern at intel.com>
Add an option not to add potential entries to NAN availability
attribute. The availability attribute will be passed to the driver for
sending a schedule update frame which doesn't need the potenial
entries. Since the potential availability part may become large,
don't pass it to the driver.
Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
src/nan/nan.c | 6 ++++--
src/nan/nan.h | 3 ++-
src/nan/nan_i.h | 2 +-
src/nan/nan_ndl.c | 2 +-
src/nan/nan_util.c | 14 ++++++++++----
wpa_supplicant/nan_supplicant.c | 6 ++++--
6 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/nan/nan.c b/src/nan/nan.c
index b99cebb9f9..4a8bb5176a 100644
--- a/src/nan/nan.c
+++ b/src/nan/nan.c
@@ -2198,6 +2198,7 @@ int nan_peer_get_pot_avail(struct nan_data *nan, const u8 *addr,
* @n_chans: Number of channel entries in chans
* @chans: Channel entries
* @buf: Buffer to which the availability attributes will be added
+ * @include_potential: If true, potential availability entries will be included
* Returns: 0 on success; -1 on failure
*
* Convert the given NAN schedule information to availability attributes and add
@@ -2208,11 +2209,12 @@ int nan_convert_sched_to_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap,
size_t n_chans,
struct nan_chan_schedule *chans,
- struct wpabuf *buf)
+ struct wpabuf *buf,
+ bool include_potential)
{
return nan_add_avail_attrs(nan, sequence_id, map_ids_bitmap,
NAN_AVAIL_ENTRY_CTRL_TYPE_COND,
- n_chans, chans, buf);
+ n_chans, chans, buf, include_potential);
}
diff --git a/src/nan/nan.h b/src/nan/nan.h
index eb67645096..a3c521bf64 100644
--- a/src/nan/nan.h
+++ b/src/nan/nan.h
@@ -557,7 +557,8 @@ int nan_convert_sched_to_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap,
size_t n_chans,
struct nan_chan_schedule *chans,
- struct wpabuf *buf);
+ struct wpabuf *buf,
+ bool include_potential);
bool nan_peer_pairing_supported(struct nan_data *nan, const u8 *addr);
bool nan_peer_npk_nik_caching_supported(struct nan_data *nan, const u8 *addr);
int nan_get_peer_ndc_freq(struct nan_data *nan ,
diff --git a/src/nan/nan_i.h b/src/nan/nan_i.h
index 16dabada7d..2f3d9eaeff 100644
--- a/src/nan/nan_i.h
+++ b/src/nan/nan_i.h
@@ -579,7 +579,7 @@ int nan_get_chan_bm(struct nan_data *nan, const struct nan_sched_chan *chan,
int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap, u8 type_for_conditional,
size_t n_chans, struct nan_chan_schedule *chans,
- struct wpabuf *buf);
+ struct wpabuf *buf, bool include_potential);
void nan_del_avail_entry(struct nan_avail_entry *entry);
void nan_flush_avail_entries(struct dl_list *avail_entries);
int nan_sched_entries_to_avail_entries(struct nan_data *nan,
diff --git a/src/nan/nan_ndl.c b/src/nan/nan_ndl.c
index aa0a8137e6..ca537e26d5 100644
--- a/src/nan/nan_ndl.c
+++ b/src/nan/nan_ndl.c
@@ -1372,7 +1372,7 @@ int nan_ndl_add_avail_attrs(struct nan_data *nan, const struct nan_peer *peer,
return nan_add_avail_attrs(nan, sched->sequence_id,
sched->map_ids_bitmap,
type_for_conditional,
- sched->n_chans, sched->chans, buf);
+ sched->n_chans, sched->chans, buf, true);
}
diff --git a/src/nan/nan_util.c b/src/nan/nan_util.c
index e736ea8510..52cc8d67af 100644
--- a/src/nan/nan_util.c
+++ b/src/nan/nan_util.c
@@ -706,6 +706,7 @@ static void nan_build_pot_avail_entry(struct nan_data *nan, struct wpabuf *buf,
* @n_chans: Number of channels in chans
* @chans: Channel schedules
* @buf: Frame buffer to which the attribute would be added
+ * @include_potential: If true, potential availability entries would be added
* Returns: 0 on success, negative on failure.
*
* An availability attribute is added for each map (identified by map ID) in the
@@ -716,7 +717,7 @@ static void nan_build_pot_avail_entry(struct nan_data *nan, struct wpabuf *buf,
int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap, u8 type_for_conditional,
size_t n_chans, struct nan_chan_schedule *chans,
- struct wpabuf *buf)
+ struct wpabuf *buf, bool include_potential)
{
u8 last_map_id = NAN_INVALID_MAP_ID;
u32 handled_map_ids = 0;
@@ -770,8 +771,9 @@ int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
"NAN: Add avail attr done: map_id=%u",
last_map_id);
- nan_build_pot_avail_entry(nan, buf,
- last_map_id);
+ if (include_potential)
+ nan_build_pot_avail_entry(nan, buf,
+ last_map_id);
WPA_PUT_LE16(len_ptr,
(u8 *) wpabuf_put(buf, 0) -
len_ptr - 2);
@@ -815,7 +817,8 @@ int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
}
if (last_map_id != NAN_INVALID_MAP_ID) {
- nan_build_pot_avail_entry(nan, buf, last_map_id);
+ if (include_potential)
+ nan_build_pot_avail_entry(nan, buf, last_map_id);
WPA_PUT_LE16(len_ptr, (u8 *) wpabuf_put(buf, 0) - len_ptr - 2);
wpa_printf(MSG_DEBUG, "NAN: Add avail attr done: map_id=%u",
@@ -825,6 +828,9 @@ int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
"NAN: No committed/conditional entries were added");
}
+ if (!include_potential)
+ return 0;
+
/*
* Add NAN availability attributes with a single potential availability
* entry for map IDs that are not included in the schedule.
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index fcc78f5ea7..febbd512d4 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -2044,8 +2044,10 @@ static void wpas_nan_de_add_extra_attrs(void *ctx, struct wpabuf *buf)
wpas_nan_fill_ndp_schedule(wpa_s, &sched);
nan_add_dev_capa_attr(wpa_s->nan, buf);
- nan_convert_sched_to_avail_attrs(wpa_s->nan, wpa_s->schedule_sequence_id,
- map_ids, sched.n_chans,sched.chans, buf);
+ nan_convert_sched_to_avail_attrs(wpa_s->nan,
+ wpa_s->schedule_sequence_id,
+ map_ids, sched.n_chans,
+ sched.chans, buf, true);
}
--
2.53.0
More information about the Hostap
mailing list