Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2198437/?format=api
{ "id": 2198437, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2198437/?format=api", "project": { "id": 22, "url": "http://patchwork.ozlabs.org/api/1.0/projects/22/?format=api", "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": "<20260219202514.5781-51-andrei.otcheretianski@intel.com>", "date": "2026-02-19T20:25:06", "name": "[50/58] NAN: Add an API to get committed/conditional schedule of a peer", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "df4e0e6b809fe9aa3819763c2d4e38bd90fb3cdf", "submitter": { "id": 62065, "url": "http://patchwork.ozlabs.org/api/1.0/people/62065/?format=api", "name": "Andrei Otcheretianski", "email": "andrei.otcheretianski@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/hostap/patch/20260219202514.5781-51-andrei.otcheretianski@intel.com/mbox/", "series": [ { "id": 492721, "url": "http://patchwork.ozlabs.org/api/1.0/series/492721/?format=api", "date": "2026-02-19T20:24:21", "name": "NAN: Add NAN Data Path (NDP) support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492721/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2198437/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=p2TbXiqY;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256\n header.s=desiato.20200630 header.b=Ix/vIiGB;\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=a3VUpDie;\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 4fH4jG0cTsz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 20 Feb 2026 07:29:06 +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 1vtAdX-0000000BzZU-3Gp2;\n\tThu, 19 Feb 2026 20:28:35 +0000", "from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vtAd6-0000000Byx9-1ZdE\n\tfor hostap@bombadil.infradead.org;\n\tThu, 19 Feb 2026 20:28:08 +0000", "from mgamail.intel.com ([198.175.65.18])\n\tby desiato.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vtAct-00000001qHa-32yN\n\tfor hostap@lists.infradead.org;\n\tThu, 19 Feb 2026 20:28:01 +0000", "from orviesa004.jf.intel.com ([10.64.159.144])\n by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 19 Feb 2026 12:27:53 -0800", "from aotchere-mobl1.ger.corp.intel.com (HELO\n aotchere-mobl1.intel.com) ([10.245.246.171])\n by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 19 Feb 2026 12:27:49 -0800" ], "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:Cc:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=v/Sr99m0qXXrU0qnZ0ThUmE6SHkXjlf6MzDDdgo/k4c=; b=p2TbXiqYMin5Pf\n\t+5aQe//4ljnu8l4++sTKHVGy/LrIIDSTuD4diQVjcZo48Ru0squq+5UUwyvzqIeUoAwgodYSHDmNU\n\t5orWYdM+SFBgunMQe4oMETRCD8+vAiCDb4V9fOJ0uEdkIzG16pyRQpA8hF+jDtN1nkslCmicb6FG3\n\txi04tdmtUMMKLskz5ueQiVSZjQVAXFh2/PcPE9tQWJtfph3jiklgbSDReDQe0zkkz+j03pqTGKNqf\n\tFt1O8amm8Lbbq1OyNeqISW1xb8j9DPHKAWdKGwtl1w7vrKf73TcrInx5/vEa/UTf7KenDU3Agu+ma\n\tVdldLcJLgPutQ4pjhVWw==;", "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version\n\t:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:\n\tContent-Type:Content-ID:Content-Description;\n\tbh=6161s/H3t2H2C4rdMJgTCaJPK8dTBmcaxtDO/2Lvsbc=; b=Ix/vIiGBIdeu5Btt/JOu7MkwXc\n\t60hRIg1ZCRrsDFU4NK11CgklZ35AYJ/x9ZOYpGvJCogIXee4KR35fofyj9ByD05lsnckoSsWp1WKL\n\tMns5Jla4cCm5uityoYbZla/UsGg9hfaDee/WMd1C/5x5WfCt8cbbg6ESjh+PValfb1wndAsdilIlh\n\twDAcYcQ/mKQH1+UXvdvzZCeANbk0kbSIqa8zfan8W+pe4oHfazmnaw4tLUkTV5jbFXWYv3BnwYmDu\n\tWp34R7SsgxLH0QupUyw/D+b6IZpG9L8UuGP8sWUMZ4X/IyN65duwCV2DGBohCIUtd2JstjZcM8xUq\n\tHvm015cA==;", "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1771532876; x=1803068876;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=+kG1LBlLpS0tasKcCdDyuYnddqaUaswMrQGxPMh4s9c=;\n b=a3VUpDieYqNj5PtKkIxCFTcXkDuimOIM5vDTms4oMN6MxQeXoJEClg5/\n a62DNRgmS82dd6d+VCiLtVkVSiNvMly7GclvbY15U7fU7WdwoEqCf7XpL\n C5MCCNwl2kmZAFS26PkwnRk78yzSp8X/F8Gr1gdD1BQy28bbFty0/mo3v\n TySx5bhHElGdnQRP/E/oyTRZA1v3NmP6SgZuiYRuGiyA+fe7dCobs4J6t\n Xehrbi943K33hAJWIu0StVFYIMLAsdSnWfWtxHHUBeiz0xkENUqoSgP8G\n rayd6979evU0rMfQ6P2Yrm3u4s+bsyIKUnWbeoZ0pjhgf8SIQfFQQTUnI\n w==;" ], "X-CSE-ConnectionGUID": [ "4XPC702TTWKM1pUkVwInag==", "1H0jS5vVR7qm9+qO+g/L+g==" ], "X-CSE-MsgGUID": [ "GEhklDyrQtS2uC/Gd/0XLg==", "scjMz5DlT9+pfA31V3q6EQ==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11706\"; a=\"72674067\"", "E=Sophos;i=\"6.21,300,1763452800\";\n d=\"scan'208\";a=\"72674067\"", "E=Sophos;i=\"6.21,300,1763452800\";\n d=\"scan'208\";a=\"219154100\"" ], "X-ExtLoop1": "1", "From": "Andrei Otcheretianski <andrei.otcheretianski@intel.com>", "To": "hostap@lists.infradead.org,\n\tvamsin@qti.qualcomm.com,\n\tvganneva@qti.qualcomm.com,\n\tmaheshkkv@google.com", "Cc": "Ilan Peer <ilan.peer@intel.com>", "Subject": "[PATCH 50/58] NAN: Add an API to get committed/conditional schedule\n of a peer", "Date": "Thu, 19 Feb 2026 22:25:06 +0200", "Message-ID": "<20260219202514.5781-51-andrei.otcheretianski@intel.com>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260219202514.5781-1-andrei.otcheretianski@intel.com>", "References": "<20260219202514.5781-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-20260219_202759_556398_B430BA05 ", "X-CRM114-Status": "GOOD ( 25.78 )", "X-Spam-Score": "-0.9 (/)", "X-Spam-Report": "Spam detection software,\n running on the system \"desiato.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: From: Ilan Peer <ilan.peer@intel.com> In addition add an\n API\n to dump the peer schedule into a buffer. Signed-off-by: Ilan Peer\n <ilan.peer@intel.com>\n --- src/nan/nan.c | 272 +++++++++++++++++++++++++++++++++++++++++++++\n src/nan/nan.h\n | 40 +++++++ src/nan/nan_util.c | 109 ++++++++++++++++++ 3 files chan\n [...] \n Content analysis details: (-0.9 points, 5.0 required)\n pts rule name description\n ---- ----------------------\n --------------------------------------------------\n -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low\n trust\n [198.175.65.18 listed in list.dnswl.org]\n -0.0 SPF_PASS SPF: sender matches SPF record\n 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record\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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from\n envelope-from domain\n 0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n not necessarily valid\n 0.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.18 listed in sa-accredit.habeas.com]\n 0.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.18 listed in\n sa-trusted.bondedsender.org]\n 0.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.18 listed in\n bl.score.senderscore.com]\n -0.0 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": "From: Ilan Peer <ilan.peer@intel.com>\n\nIn addition add an API to dump the peer schedule into a buffer.\n\nSigned-off-by: Ilan Peer <ilan.peer@intel.com>\n---\n src/nan/nan.c | 272 +++++++++++++++++++++++++++++++++++++++++++++\n src/nan/nan.h | 40 +++++++\n src/nan/nan_util.c | 109 ++++++++++++++++++\n 3 files changed, 421 insertions(+)", "diff": "diff --git a/src/nan/nan.c b/src/nan/nan.c\nindex 3e106597da..7037b61169 100644\n--- a/src/nan/nan.c\n+++ b/src/nan/nan.c\n@@ -11,6 +11,7 @@\n #include \"nan.h\"\n #include \"nan_i.h\"\n #include \"eloop.h\"\n+#include \"common/ieee802_11_common.h\"\n \n #define NAN_MAX_PEERS 32\n #define NAN_MAX_NAF_LEN 1024\n@@ -1721,3 +1722,274 @@ int nan_peer_get_tk(struct nan_data *nan, const u8 *addr,\n \n \treturn nan_sec_get_tk(nan, peer, peer_ndi, local_ndi, tk, tk_len, csid);\n }\n+\n+\n+static void nan_peer_get_committed_avail(struct nan_data *nan,\n+\t\t\t\t\t struct nan_peer *peer,\n+\t\t\t\t\t struct nan_peer_schedule *sched)\n+{\n+\tstruct nan_avail_entry *avail;\n+\n+\tdl_list_for_each(avail, &peer->info.avail_entries,\n+\t\t\t struct nan_avail_entry, list) {\n+\t\tstruct nan_map *map;\n+\t\tstruct nan_map_chan *chan;\n+\t\tstruct nan_sched_chan schan;\n+\t\tconst struct oper_class_map *op;\n+\t\tu8 chan_id;\n+\t\tbool committed;\n+\t\tint freq, bw, center_freq1, center_freq2, idx;\n+\t\tu8 i;\n+\n+\t\tif (avail->type != NAN_AVAIL_ENTRY_CTRL_TYPE_COMMITTED &&\n+\t\t avail->type != NAN_AVAIL_ENTRY_CTRL_TYPE_COND)\n+\t\t\tcontinue;\n+\n+\t\t/*\n+\t\t * This should not happen in practice as committed and\n+\t\t * conditional entries should have only a single channel entry\n+\t\t */\n+\t\tif (avail->n_band_chan != 1) {\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: Skip availability entry with n_band_chan=%u\",\n+\t\t\t\t avail->n_band_chan);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Get all the channel parameters */\n+\t\top = get_oper_class(NULL, avail->band_chan[0].u.chan.op_class);\n+\t\tif (!op) {\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: Unknown operating class %u\",\n+\t\t\t\t avail->band_chan[0].u.chan.op_class);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tidx = ffs(le_to_host16(avail->band_chan[0].u.chan.chan_bitmap)) - 1;\n+\t\tif (idx < 0) {\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: No channel found in chan_bitmap 0x%04x for oper_class %u\",\n+\t\t\t\t le_to_host16(avail->band_chan[0].u.chan.chan_bitmap),\n+\t\t\t\t avail->band_chan[0].u.chan.op_class);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tchan_id = op_class_idx_to_chan(op, idx);\n+\t\tif (!chan_id) {\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: No channel found for oper_class %u idx %u\",\n+\t\t\t\t avail->band_chan[0].u.chan.op_class, idx);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tfreq = ieee80211_chan_to_freq(NULL,\n+\t\t\t\t\t avail->band_chan[0].u.chan.op_class,\n+\t\t\t\t\t chan_id);\n+\t\tbw = oper_class_bw_to_int(op);\n+\n+\t\tcenter_freq2 = 0;\n+\t\tif (op->op_class < 128) {\n+\t\t\tcenter_freq1 = ieee80211_get_center_freq(freq, op->bw);\n+\t\t} else if (op->op_class > 130) {\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: Missing support for op_class %u\",\n+\t\t\t\t op->op_class);\n+\t\t\tcontinue;\n+\t\t} else {\n+\t\t\tidx = ffs(avail->band_chan[0].u.chan.pri_chan_bitmap) - 1;\n+\t\t\tif (idx < 0) {\n+\t\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t\t \"NAN: No primary channel found in pri_chan_bitmap 0x%04x\",\n+\t\t\t\t\t le_to_host16(avail->band_chan[0].u.chan.pri_chan_bitmap));\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tcenter_freq1 = freq;\n+\t\t\tif (op->bw == BW80 || op->bw == BW80P80)\n+\t\t\t\tfreq = freq - 30 + idx * 20;\n+\t\t\telse if (op->bw == BW160)\n+\t\t\t\tfreq = freq - 70 + idx * 20;\n+\n+\t\t\t/* TODO: Missing support for 80 + 80 */\n+\t\t}\n+\n+\t\t/* Assume committed for conditional slots if setup is done */\n+\t\tcommitted = (avail->type ==\n+\t\t\t NAN_AVAIL_ENTRY_CTRL_TYPE_COMMITTED) ||\n+\t\t\t (avail->type ==\n+\t\t\t NAN_AVAIL_ENTRY_CTRL_TYPE_COND &&\n+\t\t\t peer->ndl->state == NAN_NDL_STATE_DONE &&\n+\t\t\t peer->ndl->status == NAN_NDL_STATUS_ACCEPTED);\n+\n+\t\t/* Find map ID entry if already exists */\n+\t\tfor (i = 0; i < sched->n_maps; i++)\n+\t\t\tif (sched->maps[i].map_id == avail->map_id)\n+\t\t\t\tbreak;\n+\n+\t\tmap = &sched->maps[i];\n+\t\tif (i == sched->n_maps) {\n+\t\t\tif (sched->n_maps == NAN_MAX_MAPS) {\n+\t\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t\t \"NAN: Too many map entries in schedule\");\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tsched->n_maps++;\n+\t\t}\n+\n+\t\tmap->map_id = avail->map_id;\n+\n+\t\tos_memset(&schan, 0, sizeof(schan));\n+\n+\t\t/* Find channel entry if already exists */\n+\t\tfor (i = 0; i < map->n_chans; i++) {\n+\t\t\tif (map->chans[i].committed != committed)\n+\t\t\t\tcontinue;\n+\n+\t\t\tif (map->chans[i].chan.freq == freq &&\n+\t\t\t map->chans[i].chan.bandwidth == bw &&\n+\t\t\t map->chans[i].chan.center_freq1 == center_freq1 &&\n+\t\t\t map->chans[i].chan.center_freq2 == center_freq2)\n+\t\t\t\tbreak;\n+\t\t}\n+\n+\t\tchan = &map->chans[i];\n+\t\tif (i == map->n_chans) {\n+\t\t\tif (map->n_chans == NAN_MAX_CHAN_ENTRIES) {\n+\t\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t\t \"NAN: Too many channel entries in schedule map_id=%u\",\n+\t\t\t\t\t map->map_id);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tmap->n_chans++;\n+\t\t}\n+\n+\t\tchan->committed = committed;\n+\t\tchan->rx_nss = avail->rx_nss;\n+\t\tchan->chan.freq = freq;\n+\t\tchan->chan.bandwidth = bw;\n+\t\tchan->chan.center_freq1 = center_freq1;\n+\t\tchan->chan.center_freq2 = center_freq2;\n+\n+\t\tos_memcpy(&chan->tbm, &avail->tbm, sizeof(avail->tbm));\n+\t}\n+}\n+\n+\n+static void nan_peer_set_sched(struct nan_data *nan, struct nan_peer *peer,\n+\t\t\t struct nan_peer_schedule *sched,\n+\t\t\t const u8 *sched_buf, size_t sched_buf_len,\n+\t\t\t bool ndc)\n+{\n+\tstruct dl_list sched_entries;\n+\tstruct nan_avail_entry *cur;\n+\tint ret;\n+\n+\tif (!sched->n_maps)\n+\t\treturn;\n+\n+\tif (!sched_buf || !sched_buf_len)\n+\t\treturn;\n+\n+\tif (sched_buf_len < sizeof(struct nan_sched_entry)) {\n+\t\twpa_printf(MSG_DEBUG, \"NAN: Schedule buffer too short=%zu\",\n+\t\t\t sched_buf_len);\n+\t\treturn;\n+\t}\n+\n+\t/* Convert the schedule the availability entries */\n+\tret = nan_sched_entries_to_avail_entries(nan,\n+\t\t\t\t\t\t &sched_entries,\n+\t\t\t\t\t\t (u8 *)sched_buf,\n+\t\t\t\t\t\t sched_buf_len);\n+\tif (ret) {\n+\t\twpa_printf(MSG_DEBUG,\n+\t\t\t \"NAN: Failed to parse peer schedule entries\");\n+\t\treturn;\n+\t}\n+\n+\t/*\n+\t * For each schedule entry find the corresponding map in the committed\n+\t * schedule and store the copy of the time bitmap\n+\t */\n+\tdl_list_for_each(cur, &sched_entries, struct nan_avail_entry, list) {\n+\t\tstruct nan_map *map;\n+\t\tu8 i;\n+\n+\t\tfor (i = 0; i < sched->n_maps; i++) {\n+\t\t\tmap = &sched->maps[i];\n+\n+\t\t\tif (map->map_id == cur->map_id)\n+\t\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (i == sched->n_maps) {\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: No map entry found for map_id=%u in peer schedule\",\n+\t\t\t\t cur->map_id);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (ndc)\n+\t\t\tos_memcpy(&map->ndc, &cur->tbm, sizeof(cur->tbm));\n+\t\telse\n+\t\t\tos_memcpy(&map->immutable, &cur->tbm, sizeof(cur->tbm));\n+\t}\n+\n+\tnan_flush_avail_entries(&sched_entries);\n+}\n+\n+\n+static void nan_peer_get_ndc_sched(struct nan_data *nan,\n+\t\t\t\t struct nan_peer *peer,\n+\t\t\t\t struct nan_peer_schedule *sched)\n+{\n+\tif (!peer->ndl)\n+\t\treturn;\n+\n+\tnan_peer_set_sched(nan, peer, sched,\n+\t\t\t peer->ndl->ndc_sched,\n+\t\t\t peer->ndl->ndc_sched_len, true);\n+}\n+\n+\n+static void nan_peer_get_immut_sched(struct nan_data *nan,\n+\t\t\t\t struct nan_peer *peer,\n+\t\t\t\t struct nan_peer_schedule *sched)\n+{\n+\tif (!peer->ndl)\n+\t\treturn;\n+\n+\tnan_peer_set_sched(nan, peer, sched,\n+\t\t\t peer->ndl->immut_sched,\n+\t\t\t peer->ndl->immut_sched_len, false);\n+}\n+\n+\n+\n+/*\n+ * nan_peer_get_schedule_info - Get peer's schedule information\n+ * @nan: NAN module context from nan_init()\n+ * @addr: NAN MAC address of the peer\n+ * @sched: on return would hold the schedule information.\n+ * Return 0 on success; -1 otherwise.\n+ */\n+int nan_peer_get_schedule_info(struct nan_data *nan, const u8 *addr,\n+\t\t\t struct nan_peer_schedule *sched)\n+{\n+\tstruct nan_peer *peer;\n+\n+\tif (!nan || !sched)\n+\t\treturn -1;\n+\n+\tos_memset(sched, 0, sizeof(*sched));\n+\n+\tpeer = nan_get_peer(nan, addr);\n+\tif (!peer)\n+\t\treturn -1;\n+\n+\tnan_peer_get_committed_avail(nan, peer, sched);\n+\tnan_peer_get_ndc_sched(nan, peer, sched);\n+\tnan_peer_get_immut_sched(nan, peer, sched);\n+\n+\treturn 0;\n+}\ndiff --git a/src/nan/nan.h b/src/nan/nan.h\nindex 4957687ced..f174a1347e 100644\n--- a/src/nan/nan.h\n+++ b/src/nan/nan.h\n@@ -319,6 +319,42 @@ struct nan_channels {\n \tstruct nan_channel_info *chans;\n };\n \n+#define NAN_MAX_MAPS 8\n+#define NAN_MAX_CHAN_ENTRIES 16\n+\n+/**\n+ * struct nan_peer_schedule - NAN peer schedule information\n+ *\n+ * @n_maps: Number of maps\n+ * @maps: Array of maps\n+ * @map_id: Map ID\n+ * @n_chans: Number of channels in the map\n+ * @chans: Array of channels in the map\n+ * @committed: Committed schedule bitmap for the channel\n+ * @rx_nss: Number of spatial streams supported by the peer for RX on this\n+ * channel\n+ * @chan: Channel information\n+ * @tbm: Time bitmap for the channel\n+ * @ndc: NDC time bitmap for the map\n+ * @immutable: Immutable time bitmap for the map\n+ */\n+struct nan_peer_schedule {\n+\tu8 n_maps;\n+\tstruct nan_map {\n+\t\tu8 map_id;\n+\t\tu8 n_chans;\n+\t\tstruct nan_map_chan{\n+\t\t\tbool committed;\n+\t\t\tu8 rx_nss;\n+\t\t\tstruct nan_sched_chan chan;\n+\t\t\tstruct nan_time_bitmap tbm;\n+\t\t} chans[NAN_MAX_CHAN_ENTRIES];\n+\n+\t\tstruct nan_time_bitmap ndc;\n+\t\tstruct nan_time_bitmap immutable;\n+\t} maps[NAN_MAX_MAPS];\n+};\n+\n struct nan_config {\n \tvoid *cb_ctx;\n \tu8 nmi_addr[ETH_ALEN];\n@@ -457,4 +493,8 @@ int nan_peer_get_tk(struct nan_data *nan, const u8 *addr,\n \t\t const u8 *peer_ndi, const u8 *local_ndi,\n \t\t u8 *tk, size_t *tk_len,\n \t\t enum nan_cipher_suite_id *csid);\n+int nan_peer_get_schedule_info(struct nan_data *nan, const u8 *addr,\n+\t\t\t struct nan_peer_schedule *sched);\n+int nan_peer_dump_sched_to_buf(struct nan_peer_schedule *sched,\n+\t\t\t char *buf, size_t buflen);\n #endif /* NAN_H */\ndiff --git a/src/nan/nan_util.c b/src/nan/nan_util.c\nindex 840b39c4b0..535a7c815f 100644\n--- a/src/nan/nan_util.c\n+++ b/src/nan/nan_util.c\n@@ -1503,3 +1503,112 @@ fail:\n \tbitfield_free(res_bf);\n \treturn NULL;\n }\n+\n+\n+/**\n+ * nan_peer_dump_sched_to_buf - Dump peer schedule to a buffer\n+ *\n+ * @sched: Peer schedule\n+ * @buf: Output buffer\n+ * @buflen: The length of &buf in bytes\n+ *\n+ * Returns: The number of characters written to the buffer, or -1 on error,\n+ * which indicates that the buffer was too small.\n+ */\n+int nan_peer_dump_sched_to_buf(struct nan_peer_schedule *sched,\n+\t\t\t char *buf, size_t buflen)\n+{\n+\tint i, j, ret;\n+\tchar *pos = buf;\n+\tchar *end = buf + buflen;\n+\n+\tfor (i = 0; i < sched->n_maps; i++) {\n+\t\tstruct nan_map *map = &sched->maps[i];\n+\n+\t\tret = wpa_scnprintf(pos, end - pos,\n+\t\t\t\t \"MAP [%u]\\n\\tmap_id=%u\\n\\tn_chans=%u\\n\",\n+\t\t\t\t i, map->map_id, map->n_chans);\n+\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\tgoto err;\n+\t\tpos += ret;\n+\n+\t\tfor (j = 0; j < map->n_chans; j++) {\n+\t\t\tstruct nan_map_chan *chan = &map->chans[j];\n+\n+\t\t\tret = wpa_scnprintf(pos, end - pos,\n+\t\t\t\t\t \"\\tchannel[%u]: committed=%u rx_nss=%u freq=%u bw=%u cfreq1=%u cfreq2=%u\\n\",\n+\t\t\t\t\t j, chan->committed, chan->rx_nss,\n+\t\t\t\t\t chan->chan.freq, chan->chan.bandwidth,\n+\t\t\t\t\t chan->chan.center_freq1,\n+\t\t\t\t\t chan->chan.center_freq2);\n+\t\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\t\tgoto err;\n+\t\t\tpos += ret;\n+\n+\t\t\tret = wpa_scnprintf(pos, end - pos,\n+\t\t\t\t\t \"\\t\\tbitmap: period=%u duration=%u offset=%u \",\n+\t\t\t\t\t BIT(6 + chan->tbm.period),\n+\t\t\t\t\t BIT(4 + chan->tbm.duration),\n+\t\t\t\t\t 16 * chan->tbm.offset);\n+\t\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\t\tgoto err;\n+\t\t\tpos += ret;\n+\n+\t\t\tret = wpa_scnprintf(pos, end - pos, \"bitmap=\");\n+\t\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\t\tgoto err;\n+\t\t\tpos += ret;\n+\n+\t\t\tret = wpa_snprintf_hex(pos, end - pos, chan->tbm.bitmap,\n+\t\t\t\t\t chan->tbm.len);\n+\t\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\t\tgoto err;\n+\t\t\tpos += ret;\n+\n+\t\t\tret = wpa_scnprintf(pos, end - pos, \"\\n\");\n+\t\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\t\tgoto err;\n+\t\t\tpos += ret;\n+\t\t}\n+\n+\t\tret = wpa_scnprintf(pos, end - pos,\n+\t\t\t\t \"\\tndc: period=%u duration=%u offset=%u bitmap=\",\n+\t\t\t\t BIT(6 + map->ndc.period),\n+\t\t\t\t BIT(4 + map->ndc.duration),\n+\t\t\t\t 16 * map->ndc.offset);\n+\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\tgoto err;\n+\t\tpos += ret;\n+\n+\t\tret = wpa_snprintf_hex(pos, end - pos, map->ndc.bitmap,\n+\t\t\t\t map->ndc.len);\n+\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\tgoto err;\n+\t\tpos += ret;\n+\n+\t\tret = wpa_scnprintf(pos, end - pos,\n+\t\t\t\t \"\\n\\timmutable: period=%u duration=%u offset=%u bitmap=\",\n+\t\t\t\t BIT(6 + map->immutable.period),\n+\t\t\t\t BIT(4 + map->immutable.duration),\n+\t\t\t\t 16 * map->immutable.offset);\n+\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\tgoto err;\n+\t\tpos += ret;\n+\n+\t\tret = wpa_snprintf_hex(pos, end - pos, map->immutable.bitmap,\n+\t\t\t\t map->immutable.len);\n+\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\tgoto err;\n+\t\tpos += ret;\n+\n+\t\tret = wpa_scnprintf(pos, end - pos, \"\\n\");\n+\t\tif (os_snprintf_error(end - pos, ret))\n+\t\t\tgoto err;\n+\t\tpos += ret;\n+\t}\n+\n+\treturn pos - buf;\n+err:\n+\twpa_printf(MSG_DEBUG, \"NAN: Buffer too small to dump peer schedule\");\n+\treturn -1;\n+}\n", "prefixes": [ "50/58" ] }