[PATCH wireless] wifi: nl80211: allow a NAN peer schedule with 2 channels in the same slot
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date: 2026-09-07 17:24:58
Subsystem:
802.11 (including cfg80211/nl80211), the rest · Maintainers:
Johannes Berg, Linus Torvalds
A NAN peer that has dual radio can schedule a slot to 2 different channels. Until now, for single radio devices, we disallowed such a peer schedule. This was done so because the assumption was that the user space needs to pick one of the channels for us, according to its logic. But for devices that have their ULW logic offloaded, it can be useful if we program it with the full information and let it decide what to do. For example: - peer has slot S scheduled to C1 and C2 - local schedule has S scheduled to C1 - in practice, the device is on C2 at S, for example due to non-NAN activity In that case, this extra information can actually be useful to the device, and bring to more efficient usage of the time. Allow a peer schedule that has a single slot scheduled to two different channels. Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> --- include/uapi/linux/nl80211.h | 10 ++++++---- net/wireless/nl80211.c | 23 ++--------------------- 2 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9998f6c0a665..2e2715d24227 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h@@ -1397,10 +1397,12 @@ * be provided. * Each peer channel must be compatible with at least one local channel * set by %NL80211_CMD_SET_LOCAL_NAN_SCHED. Different maps must not - * contain compatible channels. - * For single-radio devices (n_radio <= 1), different maps must not - * schedule the same time slot, as the device cannot operate on multiple - * channels simultaneously. + * contain compatible channels. Two maps may schedule the same time slot. + * The device decides at runtime which of the channels to follow. + * For example, the local schedule may place slot S on channel c1 while + * the peer advertises slot S on both c1 and c2. If the device is anyway + * on c2 during slot S (e.g. via the ULW mechanism for non-NAN activity), + * it may use slot S on c2 to communicate with the peer. * When updating an existing peer schedule, the full new schedule must be * provided - partial updates are not supported. The new schedule will * completely replace the previous one.
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 5adcb6bd0fc5..6dba0ff53061 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c@@ -17273,8 +17273,7 @@ nl80211_parse_nan_peer_map(struct genl_info *info, struct nlattr *map_attr, map->schedule, n_channels); } -static int nl80211_nan_validate_map_pair(struct wiphy *wiphy, - struct genl_info *info, +static int nl80211_nan_validate_map_pair(struct genl_info *info, const struct cfg80211_nan_peer_map *map1, const struct cfg80211_nan_peer_map *map2, struct cfg80211_nan_channel *nan_channels)
@@ -17309,24 +17308,6 @@ static int nl80211_nan_validate_map_pair(struct wiphy *wiphy, } } - /* - * Check for conflicting time slots between maps. - * Only check for single-radio devices (n_radio <= 1) which cannot - * operate on multiple channels simultaneously. - */ - if (wiphy->n_radio > 1) - return 0; - - for (int i = 0; i < ARRAY_SIZE(map1->schedule); i++) { - if (map1->schedule[i] != NL80211_NAN_SCHED_NOT_AVAIL_SLOT && - map2->schedule[i] != NL80211_NAN_SCHED_NOT_AVAIL_SLOT) { - NL_SET_ERR_MSG_FMT(info->extack, - "Maps %u and %u both schedule slot %d", - map1->map_id, map2->map_id, i); - return -EINVAL; - } - } - return 0; }
@@ -17444,7 +17425,7 @@ static int nl80211_nan_set_peer_sched(struct sk_buff *skb, /* Validate against previous maps */ for (int j = 0; j < n_maps; j++) { - ret = nl80211_nan_validate_map_pair(&rdev->wiphy, info, + ret = nl80211_nan_validate_map_pair(info, &sched.maps[j], &sched.maps[n_maps], nan_channels);
--
2.34.1