Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2198413/?format=api
{ "id": 2198413, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2198413/?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-16-andrei.otcheretianski@intel.com>", "date": "2026-02-19T20:24:31", "name": "[15/58] common: Add some helper functions", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "eb421b02620cb406b67b569e4729ab89a597c56c", "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-16-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/2198413/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=n/dSWlZB;\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=ilThIjXC;\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 4fH4fV3pmxz1xxN\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 20 Feb 2026 07:26:42 +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 1vtAbI-0000000BwPA-3pvT;\n\tThu, 19 Feb 2026 20:26:16 +0000", "from mgamail.intel.com ([198.175.65.10])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vtAbG-0000000BwCB-2LIH\n\tfor hostap@lists.infradead.org;\n\tThu, 19 Feb 2026 20:26:15 +0000", "from orviesa004.jf.intel.com ([10.64.159.144])\n by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 19 Feb 2026 12:26:15 -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:26:12 -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=Qs1tJrPSTE4bBMChwUecHWppFEH0G4kZ6OEpYOAk7SM=; b=n/dSWlZB5uURCO\n\t8uyAWEYlTGkfWGQwHDAxhnbTH0w4mBZnRGYrY8jdsV3LQ/EiVUsJdSy2FIn+OsGyPr+1orTbgsPMG\n\tcYuh18ZvuBgoiqrCK7GbqeJQ2gWFEe/QLPlbrbpDTCV4opOjPtdoC4dJcyuo2gBEgSnKZJbyb0d9i\n\tKdRYbnI40nDxARmvpfiBkkfltTyZLqEkgqxqN4mFkD2+JNRPV1gMsqXNZV2pIPJxB/rt4w7iht7Yp\n\tRBtpfUlIqZO6C2ZCC8xv7BTpfCyQQ2znZjiufTv2Bs8nETfDWFiRPAktbIkf+dppDpjPqt3lcEyAP\n\t0BsDpo7K6JpQH4BFfo/Q==;", "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1771532775; x=1803068775;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=QaszgkTx9KToWBgjiZht7z3tHwf0WRQwjXveUuHhnmQ=;\n b=ilThIjXCZlbilxYh9goe48cv+Y94viDup5pveXAyPi0oOVcks7JczVed\n SnPg6+hphm/XYWEZr/lvJPiSJJjjWrJvD7REf2IZJqdHb92RPV1cqVgVv\n 9rp4fJGqQeggOfhzPTWkmOXgrajj3D5lOEo+c3q6KYZkIPzkkwHhjuYS3\n mXo+pXd8uZlnxiKsCyv6ZupM/3OptiWnXlFMtLCobZwOgdjCYbAbFE6sS\n lYZPMBTlRXXLs/o8mgByCp/3gWPOHzd1N6fjrZNyRO11VM9dhJRhoyTK+\n zXagdUlZXCpSambbxB2lRN8BPx1LWGhhRnHArTlz30OkJuHfG649CUb0H\n Q==;" ], "X-CSE-ConnectionGUID": [ "Wpqlk7d+QFm8vrRuqFIN9Q==", "JYCwRnX+RtSsp97aXxoTew==" ], "X-CSE-MsgGUID": [ "kPHyYWfFSwy3e3+78PjESw==", "J0ngWnh3SE6jQBMHGadd0g==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11706\"; a=\"90039980\"", "E=Sophos;i=\"6.21,300,1763452800\";\n d=\"scan'208\";a=\"90039980\"", "E=Sophos;i=\"6.21,300,1763452800\";\n d=\"scan'208\";a=\"219153792\"" ], "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 15/58] common: Add some helper functions", "Date": "Thu, 19 Feb 2026 22:24:31 +0200", "Message-ID": "<20260219202514.5781-16-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_122614_656175_E0FCDE36 ", "X-CRM114-Status": "GOOD ( 15.03 )", "X-Spam-Score": "-4.4 (----)", "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: From: Ilan Peer <ilan.peer@intel.com> Add helper function\n for the following: 1. Get the channel index within an operating class. 2.\n Get the channel number by its index within an operating class. 3. Get the\n center frequency corresponding to a control frequency based on the ope\n [...] \n Content analysis details: (-4.4 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.10 listed in list.dnswl.org]\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.10 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.10 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.10 listed in\n bl.score.senderscore.com]\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_EF Message has a valid DKIM or DK signature from\n envelope-from domain\n -0.1 DKIM_VALID Message has at least one valid DKIM or DK\n signature\n 0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n not necessarily valid\n -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n [score: 0.0000]\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\nAdd helper function for the following:\n\n 1. Get the channel index within an operating class.\n 2. Get the channel number by its index within an operating class.\n 3. Get the center frequency corresponding to a control frequency\n based on the operating class bandwidth.\n\nSigned-off-by: Ilan Peer <ilan.peer@intel.com>\n---\n src/common/ieee802_11_common.c | 147 +++++++++++++++++++++++++++++++++\n src/common/ieee802_11_common.h | 5 ++\n 2 files changed, 152 insertions(+)", "diff": "diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c\nindex 77d2132d8f..039614b952 100644\n--- a/src/common/ieee802_11_common.c\n+++ b/src/common/ieee802_11_common.c\n@@ -4074,3 +4074,150 @@ enum chan_width get_sta_operation_chan_width(\n \n \treturn ap_operation_chan_width;\n }\n+\n+\n+const u8 channels_80mhz[] = { 42, 58, 106, 122, 138, 155 };\n+const u8 channels_160mhz[] = { 50, 114, 163 };\n+\n+\n+static u8 op_class_idx_to_chan_vht(u8 op_class, u8 idx)\n+{\n+\tconst u8 *chans_array;\n+\tu8 size;\n+\n+\tif (op_class == 128 || op_class == 130) {\n+\t\tchans_array = channels_80mhz;\n+\t\tsize = ARRAY_SIZE(channels_80mhz);\n+\t} else if (op_class == 129) {\n+\t\tchans_array = channels_160mhz;\n+\t\tsize = ARRAY_SIZE(channels_160mhz);\n+\t} else {\n+\t\treturn 0;\n+\t}\n+\n+\tif (idx >= size)\n+\t\treturn 0;\n+\n+\treturn chans_array[idx];\n+}\n+\n+\n+/**\n+ * op_class_idx_to_chan - channel index in the operating class to channel number\n+ * @op: A pointer to the operating class object\n+ * @idx: The channel index within the operating class. The channels are ordered\n+ *\tfrom lowest number to highest, index starting from 0.\n+ */\n+u8 op_class_idx_to_chan(const struct oper_class_map *op, u8 idx)\n+{\n+\tu8 chan;\n+\n+\tif (op->bw == BW80 || op->bw == BW80P80 ||\n+\t op->bw == BW160)\n+\t\treturn op_class_idx_to_chan_vht(op->op_class, idx);\n+\n+\tchan = op->min_chan + idx * op->inc;\n+\tif (chan > op->max_chan)\n+\t\treturn 0;\n+\n+\treturn chan;\n+}\n+\n+\n+static int op_class_chan_to_idx_vht(u8 op_class, u8 chan)\n+{\n+\tconst u8 *chans_array;\n+\tu8 i, size;\n+\n+\tif (op_class == 128 || op_class == 130) {\n+\t\tchans_array = channels_80mhz;\n+\t\tsize = ARRAY_SIZE(channels_80mhz);\n+\t} else if (op_class == 129) {\n+\t\tchans_array = channels_160mhz;\n+\t\tsize = ARRAY_SIZE(channels_160mhz);\n+\t} else {\n+\t\treturn -1;\n+\t}\n+\n+\tfor (i = 0; i < size; i++)\n+\t\tif (chan == chans_array[i])\n+\t\t\treturn i;\n+\n+\treturn -1;\n+}\n+\n+\n+/**\n+ * op_class_chan_to_idx - channel number to channel index in the operating class\n+ * @op: A pointer to the operating class object\n+ * @chan: The channel number.\n+ */\n+int op_class_chan_to_idx(const struct oper_class_map *op, u8 chan)\n+{\n+\tif (op->bw == BW80 || op->bw == BW80P80 ||\n+\t op->bw == BW160)\n+\t\treturn op_class_chan_to_idx_vht(op->op_class, chan);\n+\n+\tif (chan < op->min_chan || chan > op->max_chan ||\n+\t (chan - op->min_chan) % op->inc)\n+\t\treturn -1;\n+\n+\treturn (chan - op->min_chan) / op->inc;\n+}\n+\n+\n+static int get_center_freq_80mhz(int ctrl_freq)\n+{\n+\tint center_freqs[] = { 5210, 5290, 5530, 5610, 5690, 5775 };\n+\tsize_t i;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(center_freqs); i++) {\n+\t\tif (ctrl_freq >= center_freqs[i] - 30 &&\n+\t\t ctrl_freq <= center_freqs[i] + 30)\n+\t\t\treturn center_freqs[i];\n+\t}\n+\n+\treturn 0;\n+}\n+\n+\n+static int get_center_freq_160mhz(int ctrl_freq)\n+{\n+\tint center_freqs[] = { 5250, 5570 };\n+\tsize_t i;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(center_freqs); i++) {\n+\t\tif (ctrl_freq >= center_freqs[i] - 70 &&\n+\t\t ctrl_freq <= center_freqs[i] + 70)\n+\t\t\treturn center_freqs[i];\n+\t}\n+\n+\treturn 0;\n+}\n+\n+\n+/**\n+ * ieee80211_get_center_freq - return center frequency based on control\n+ * frequency and operating class information.\n+ *\n+ * @param: ctrl_freq: control frequency\n+ * @bw: the bandwidth as defined in 'struct oper_class_map'\n+ */\n+int ieee80211_get_center_freq(int ctrl_freq, u32 bw)\n+{\n+\tswitch (bw) {\n+\tcase BW20:\n+\t\treturn ctrl_freq;\n+\tcase BW40PLUS:\n+\t\treturn ctrl_freq + 10;\n+\tcase BW40MINUS:\n+\t\treturn ctrl_freq - 10;\n+\tcase BW80:\n+\tcase BW80P80:\n+\t\treturn get_center_freq_80mhz(ctrl_freq);\n+\tcase BW160:\n+\t\treturn get_center_freq_160mhz(ctrl_freq);\n+\tdefault:\n+\t\treturn -1;\n+\t}\n+}\ndiff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h\nindex 1b472a7d07..3db6461ba2 100644\n--- a/src/common/ieee802_11_common.h\n+++ b/src/common/ieee802_11_common.h\n@@ -392,6 +392,11 @@ const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type);\n const u8 * get_basic_mle_mld_addr(const u8 *buf, size_t len);\n const u8 * get_basic_mle_eml_capa(const u8 *buf, size_t len);\n int get_basic_mle_link_id(const u8 *buf, size_t len);\n+u8 op_class_idx_to_chan(const struct oper_class_map *op, u8 idx);\n+\n+int op_class_chan_to_idx(const struct oper_class_map *op, u8 chan);\n+\n+int ieee80211_get_center_freq(int ctrl_freq, u32 bw);\n \n unsigned int get_max_nss_capability(struct ieee802_11_elems *elems,\n \t\t\t\t bool parse_for_rx, enum chan_width bw);\n", "prefixes": [ "15/58" ] }