{"id":2218828,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2218828/?format=json","project":{"id":22,"url":"http://patchwork.ozlabs.org/api/1.0/projects/22/?format=json","name":"HostAP Development","link_name":"hostap","list_id":"hostap.lists.infradead.org","list_email":"hostap@lists.infradead.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260401220220.4418-40-andrei.otcheretianski@intel.com>","date":"2026-04-01T22:01:48","name":"[39/71] wpa_supplicant: Implement NAN peer configuration and scheduling","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"94abec81317fad198635d2d745f321f5bea1d58a","submitter":{"id":62065,"url":"http://patchwork.ozlabs.org/api/1.0/people/62065/?format=json","name":"Andrei Otcheretianski","email":"andrei.otcheretianski@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/hostap/patch/20260401220220.4418-40-andrei.otcheretianski@intel.com/mbox/","series":[{"id":498402,"url":"http://patchwork.ozlabs.org/api/1.0/series/498402/?format=json","date":"2026-04-01T22:01:09","name":"NAN Data Path and Bootstrapping support","version":1,"mbox":"http://patchwork.ozlabs.org/series/498402/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2218828/checks/","tags":{},"headers":{"Return-Path":"\n <hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=vLUvsV/t;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=mwg6FoLY;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmJym11K7z1yFv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 09:08:16 +1100 (AEDT)","from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w83iu-0000000GCuS-402T;\n\tWed, 01 Apr 2026 22:07:40 +0000","from mgamail.intel.com ([198.175.65.20])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w83hI-0000000G9is-2TaC\n\tfor hostap@lists.infradead.org;\n\tWed, 01 Apr 2026 22:06:03 +0000","from fmviesa003.fm.intel.com ([10.60.135.143])\n  by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 01 Apr 2026 15:05:54 -0700","from iapp347.iil.intel.com (HELO 87c02287900a.iil.intel.com)\n ([10.167.28.6])\n  by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 01 Apr 2026 15:05:53 -0700"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=P5eKPo73wWmersg+k1Zn4rn1PsPArCxh/+27H/kgEIg=; b=vLUvsV/t03zGBF\n\tba99AB57aoy4RtruOOXaqp2QhefeRVHHMo1LfjcM5+8i0WvCpjehYfCZPi4m+EJKTTCg0b+p4jnLB\n\tBLHei6EKNMdZkXMnDu7MFAR561rPH730bM+RGpBF3eY75DEgclrZrObYaiQgKcy1RvZZfA1LIsdHU\n\tLA40dz2z0ivP+zf5fkb3ib3zIZnu0uW01ufMRyecYkUzxQeU5JqAJFFXmeyQZtTSc/TG8sMPjoHw1\n\t5gZC+1xP39aXZRxN1euq6MO34JjiaRPb+xIUVCWC37s8TBa6weQ/On6yUYUwiCRCwbtS+8kpkoK/1\n\tv/6LsbwXvynDi9GKIxww==;","v=1; a=rsa-sha256; c=relaxed/simple;\n  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n  t=1775081160; x=1806617160;\n  h=from:to:subject:date:message-id:in-reply-to:references:\n   mime-version:content-transfer-encoding;\n  bh=63VoQo/J1Q2iiMSWuDzj+E+DkC7lLxTS9SjDPWlpYRs=;\n  b=mwg6FoLYmUnXLwKmdgZW9PQSNUPOxg/2oE/6ixKYoFJIPD/PxX/X2eZA\n   chrHz4qOfJ0yiTkZt9EzFS1s4JlRFvYVNy8y03Gz9cXlYHnuOmp+mkrNL\n   J6n9n1uoClOXYyFPW4pw+N5yTodZVwyzy1+cCVx3k3eVuI8EY6ruZD7Gz\n   blokbFi5b3pjkSGMEteDGwN2xIo+beeg5zVRy9wkxOdB7tKojtSAlRjGn\n   V1JemhdtZTrwyvrikQaxhMQEVR+yUELRqMGZ3zOHz/Nu3fhaE0ny2Q1Vb\n   qGHnN0PN/zRGK8ygHcXcGFEElfXMTDanrzb1Oyb0G2vVoB9sLoYNv1Fsk\n   Q==;"],"X-CSE-ConnectionGUID":["UA3PfDJaQCSYOXpDrnTJvg==","wOheQGZbT36aAq7jp3HMWw=="],"X-CSE-MsgGUID":["oNuwPfKIT7WVbTMDZK+WbA==","UZkorEghQQSDtcV61vVSiw=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11746\"; a=\"75851630\"","E=Sophos;i=\"6.23,153,1770624000\";\n   d=\"scan'208\";a=\"75851630\""],"X-ExtLoop1":"1","From":"Andrei Otcheretianski <andrei.otcheretianski@intel.com>","To":"hostap@lists.infradead.org","Subject":"[PATCH 39/71] wpa_supplicant: Implement NAN peer configuration and\n scheduling","Date":"Thu,  2 Apr 2026 01:01:48 +0300","Message-ID":"<20260401220220.4418-40-andrei.otcheretianski@intel.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260401220220.4418-1-andrei.otcheretianski@intel.com>","References":"<20260401220220.4418-1-andrei.otcheretianski@intel.com>","MIME-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20260401_150600_808982_E4B16F30 ","X-CRM114-Status":"GOOD (  17.64  )","X-Spam-Score":"-1.9 (-)","X-Spam-Report":"Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  Create a station for each new NMI peer. Configure peer\n schedule\n    if provided. If the schedule is NULL,\n remove the schedule and the peer. Signed-off-by:\n    Andrei Otcheretianski <andrei.otcheretianski@intel.com> ---\n wpa_supplicant/driver_i.h\n    | 15 ++++ wpa_supplicant/nan_supplicant.c | 138\n ++++++++++++++++++++++++++++++++\n    2 files changed, 1 [...]\n Content analysis details:   (-1.9 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,\n                             medium trust\n                             [198.175.65.20 listed in list.dnswl.org]\n  1.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n                              Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                             [198.175.65.20 listed in\n bl.score.senderscore.com]\n  1.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The\n                             query to Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                          [198.175.65.20 listed in\n sa-trusted.bondedsender.org]\n  1.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n                              Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                             [198.175.65.20 listed in sa-accredit.habeas.com]\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -0.0 SPF_PASS               SPF: sender matches SPF record\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n -0.5 DKIMWL_WL_HIGH         DKIMwl.org - High trust sender","X-BeenThere":"hostap@lists.infradead.org","X-Mailman-Version":"2.1.34","Precedence":"list","List-Id":"<hostap.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/hostap>,\n <mailto:hostap-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/hostap/>","List-Post":"<mailto:hostap@lists.infradead.org>","List-Help":"<mailto:hostap-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/hostap>,\n <mailto:hostap-request@lists.infradead.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"Hostap\" <hostap-bounces@lists.infradead.org>","Errors-To":"hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"Create a station for each new NMI peer. Configure peer schedule if\nprovided.\nIf the schedule is NULL, remove the schedule and the peer.\n\nSigned-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>\n---\n wpa_supplicant/driver_i.h       |  15 ++++\n wpa_supplicant/nan_supplicant.c | 138 ++++++++++++++++++++++++++++++++\n 2 files changed, 153 insertions(+)","diff":"diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h\nindex 4d67145955..e4b26e2e8e 100644\n--- a/wpa_supplicant/driver_i.h\n+++ b/wpa_supplicant/driver_i.h\n@@ -1313,6 +1313,21 @@ static inline int wpa_drv_nan_config_schedule(struct wpa_supplicant *wpa_s,\n \treturn wpa_s->driver->nan_config_schedule(wpa_s->drv_priv, map_id,\n \t\t\t\t\t\t  conf);\n }\n+\n+static inline int\n+wpa_drv_nan_config_peer_schedule(struct wpa_supplicant *wpa_s, const u8 *peer,\n+\t\t\t\t u16 cdw, u8 sequence_id,\n+\t\t\t\t u16 max_chan_switch_time,\n+\t\t\t\t const struct wpabuf *ulw,\n+\t\t\t\t struct nan_peer_schedule_config *sched)\n+{\n+\tif (!wpa_s->driver->nan_config_peer_schedule)\n+\t\treturn -1;\n+\treturn wpa_s->driver->nan_config_peer_schedule(wpa_s->drv_priv, peer,\n+\t\t\t\t\t\t       cdw, sequence_id,\n+\t\t\t\t\t\t       max_chan_switch_time,\n+\t\t\t\t\t\t       ulw, sched);\n+}\n #endif /* CONFIG_NAN */\n \n #endif /* DRIVER_I_H */\ndiff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c\nindex 8868c95a9f..fcc78f5ea7 100644\n--- a/wpa_supplicant/nan_supplicant.c\n+++ b/wpa_supplicant/nan_supplicant.c\n@@ -174,6 +174,143 @@ static void wpas_nan_stop_cb(void *ctx)\n }\n \n \n+static int wpas_nan_set_peer_schedule_cb(void *ctx, const u8 *nmi_addr, bool new_sta,\n+\t\t\t\t\t u16 cdw, u8 sequence_id,\n+\t\t\t\t\t u16 max_channel_switch_time,\n+\t\t\t\t\t const struct nan_peer_schedule *sched,\n+\t\t\t\t\t const struct wpabuf *ulw_elems)\n+{\n+\tstruct wpa_supplicant *wpa_s = ctx;\n+\tstruct nan_peer_schedule_config peer_sched;\n+\tint i, j, ret;\n+\n+\twpa_printf(MSG_DEBUG, \"NAN: Set peer schedule - nmi_addr=\" MACSTR\n+\t\t   \" new_sta=%d cdw=%u seq_id=%u max_chan_switch_time=%u\",\n+\t\t   MAC2STR(nmi_addr), new_sta, cdw, sequence_id,\n+\t\t   max_channel_switch_time);\n+\n+\tif (new_sta) {\n+\t\tstruct hostapd_sta_add_params sta_params;\n+\n+\t\twpa_printf(MSG_DEBUG, \"NAN: New NMI station\");\n+\t\tos_memset(&sta_params, 0, sizeof(sta_params));\n+\t\tsta_params.addr = nmi_addr;\n+\t\tsta_params.flags = WPA_STA_AUTHENTICATED | WPA_STA_ASSOCIATED;\n+\t\tsta_params.flags_mask = sta_params.flags;\n+\t\tret = wpa_drv_sta_add(wpa_s, &sta_params);\n+\t\tif (ret) {\n+\t\t\twpa_printf(MSG_ERROR,\n+\t\t\t\t   \"NAN: Failed to add NMI station\");\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\tos_memset(&peer_sched, 0, sizeof(peer_sched));\n+\tif (sched) {\n+\t\twpa_printf(MSG_DEBUG, \"NAN: Peer schedule info:\");\n+\t\twpa_printf(MSG_DEBUG, \"  n_maps=%u\", sched->n_maps);\n+\n+\t\tpeer_sched.n_maps = sched->n_maps;\n+\t\tfor (i = 0; i < sched->n_maps && i < MAX_NUM_NAN_MAPS; i++) {\n+\t\t\tstruct nan_schedule_config *sched_cfg =\n+\t\t\t\t&peer_sched.maps[i].sched;\n+\n+\t\t\twpa_printf(MSG_DEBUG, \"  Map %d: map_id=%u\",\n+\t\t\t\t   i, sched->maps[i].map_id);\n+\n+\t\t\tpeer_sched.maps[i].map_id = sched->maps[i].map_id;\n+\t\t\tsched_cfg->num_channels = 0;\n+\n+\t\t\tfor (j = 0; j < sched->maps[i].n_chans &&\n+\t\t\t     sched_cfg->num_channels < MAX_NUM_NAN_SCHEDULE_CHANNELS;\n+\t\t\t     j++) {\n+\t\t\t\tconst struct nan_map_chan *src_chan =\n+\t\t\t\t\t&sched->maps[i].chans[j];\n+\t\t\t\tstruct nan_chan_entry *chan_entry;\n+\t\t\t\tint ch_idx;\n+\n+\t\t\t\tif (!src_chan->committed)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t\t   \"    Channel freq=%u, rx_nss=%u\",\n+\t\t\t\t\t   src_chan->chan.freq,\n+\t\t\t\t\t   src_chan->rx_nss);\n+\t\t\t\twpa_hexdump(MSG_DEBUG, \"      committed_bitmap\",\n+\t\t\t\t\t    src_chan->tbm.bitmap,\n+\t\t\t\t\t    src_chan->tbm.len);\n+\n+\t\t\t\tch_idx = sched_cfg->num_channels;\n+\t\t\t\tsched_cfg->channels[ch_idx].freq =\n+\t\t\t\t\tsrc_chan->chan.freq;\n+\t\t\t\tsched_cfg->channels[ch_idx].center_freq1 =\n+\t\t\t\t\tsrc_chan->chan.center_freq1;\n+\t\t\t\tsched_cfg->channels[ch_idx].center_freq2 =\n+\t\t\t\t\tsrc_chan->chan.center_freq2;\n+\t\t\t\tsched_cfg->channels[ch_idx].bandwidth =\n+\t\t\t\t\tsrc_chan->chan.bandwidth;\n+\t\t\t\tsched_cfg->channels[ch_idx].rx_nss =\n+\t\t\t\t\tsrc_chan->rx_nss;\n+\t\t\t\tchan_entry = (void *)sched_cfg->channels[ch_idx].chan_entry;\n+\n+\t\t\t\tret = nan_get_chan_entry(wpa_s->nan,\n+\t\t\t\t\t\t\t &src_chan->chan,\n+\t\t\t\t\t\t\t chan_entry);\n+\t\t\t\tif (ret) {\n+\t\t\t\t\twpa_printf(MSG_ERROR,\n+\t\t\t\t\t\t   \"NAN: Failed to get chan entry for freq %d\",\n+\t\t\t\t\t\t   src_chan->chan.freq);\n+\t\t\t\t\tgoto out;\n+\t\t\t\t}\n+\n+\t\t\t\t/* Copy time bitmap */\n+\t\t\t\tif (src_chan->tbm.len > 0) {\n+\t\t\t\t\tsched_cfg->channels[ch_idx].time_bitmap =\n+\t\t\t\t\t\twpabuf_alloc_copy(\n+\t\t\t\t\t\t\tsrc_chan->tbm.bitmap,\n+\t\t\t\t\t\t\tsrc_chan->tbm.len);\n+\t\t\t\t}\n+\n+\t\t\t\tsched_cfg->num_channels++;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tret = wpa_drv_nan_config_peer_schedule(wpa_s, nmi_addr,\n+\t\t\t\t\t       cdw, sequence_id,\n+\t\t\t\t\t       max_channel_switch_time,\n+\t\t\t\t\t       ulw_elems, &peer_sched);\n+\n+\t/* Only print an error without returning, so we attempt to remove\n+\t * the STA if needed (sched == NULL)\n+\t */\n+\tif (ret)\n+\t\twpa_printf(MSG_ERROR,\n+\t\t\t   \"NAN: Failed to configure peer schedule\");\n+\n+\tif (!sched && !new_sta) {\n+\t\t/* TODO: Should we maybe keep that NMI station? */\n+\t\twpa_printf(MSG_DEBUG, \"NAN: Remove NMI station\");\n+\t\tret = wpa_drv_sta_remove(wpa_s, nmi_addr);\n+\t\tif (ret)\n+\t\t\twpa_printf(MSG_ERROR,\n+\t\t\t\t   \"NAN: Failed to remove NMI station\");\n+\t}\n+\n+out:\n+\t/* Free allocated time bitmaps */\n+\tfor (i = 0; i < peer_sched.n_maps; i++) {\n+\t\tstruct nan_schedule_config *sched_cfg =\n+\t\t\t&peer_sched.maps[i].sched;\n+\n+\t\tfor (j = 0; j < sched_cfg->num_channels; j++)\n+\t\t\twpabuf_free(sched_cfg->channels[j].time_bitmap);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+\n static void wpas_nan_ndp_action_notif_cb(void *ctx,\n \t\t\t\t\t struct nan_ndp_action_notif_params *params)\n {\n@@ -441,6 +578,7 @@ int wpas_nan_init(struct wpa_supplicant *wpa_s)\n \tnan.send_naf = wpas_nan_send_naf_cb;\n \tnan.get_chans = wpas_nan_get_chans_cb;\n \tnan.is_valid_publish_id = wpas_nan_is_valid_publish_id_cb;\n+\tnan.set_peer_schedule = wpas_nan_set_peer_schedule_cb;\n \n \t/*\n \t * TODO: Set the device capabilities based on configuration and driver\n","prefixes":["39/71"]}