From patchwork Tue Jul 19 18:55:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922927 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7DC34C77 for ; Tue, 19 Jul 2022 18:57:57 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id r24so1682282plg.3 for ; Tue, 19 Jul 2022 11:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hcxZhw4Qt+V1BJnHFmUpyU3PjwB6l6ojDBwLlt37U78=; b=cdubX3XtvQ1KRfTBHcx9m4mINj2wAp8noMBQI/iSUqdfgNvAn6LMFEes2Np69qnccH aSHlUke06ytEcR9KDyrwkNnRI4pToa3nxT6otQbbQiMm//i2HGavKrFFGj8w9rED+lRV upsodRlttyGhHHr6bfPMhVBUhdnAxZgVNTdJYwti3lMG2xHqQWLHei2oNvMzOv7t4WLo vUQw5C3czx8qs2Kkto54frO+H76DIixT6CGSDJWgiNBpolSguF5l+lB9WgSzX1U476G9 98/Oj+AGnxjxhxjStxbC0sO6jPP4Iz6HCeqfKzNafCnJKSIMIBH/d+1R6ydmO2z7j0Qd /KoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hcxZhw4Qt+V1BJnHFmUpyU3PjwB6l6ojDBwLlt37U78=; b=MDDzyh7xpJqR1oubHBxsG/6G5tD74D8MPkbLML/WbN1rbJLz0X8fFV/7o8E8kSNm5t YbIIP/jSQTwmCrCvXPlA+Z3sklvF8PoRn7GTFuWSNJazYXiNJGLyiPobwVfGYp9cjrPn YM9ZZPVdj9th/+DH+bip23N9e4cRpvPm+avs6cZKBCbNLEflzEM8ooEjD8wYeZz/UQi/ JpLW8wjLoshSgGU04lt9zSPc3/4oAl/rQD4RFHc8CwMGGLyRvVtxAlKi+9rV1EHec0Af 5VlbFU7ZwHG0jlbM7+g2Fx8XWRPhsqLtw0XowiWkmYqFu6k+pS5l0VXW4EH5ENhX+/Rj ev9w== X-Gm-Message-State: AJIora83gNi3uYuY6L7jtqzFJ8PtHIUHV6oMhLml4MQf9Db1tB8OCaOJ vn7N435rijmbBSIGD/uH9jdQDa9ghj0= X-Google-Smtp-Source: AGRyM1sYP6h5ggvbBVULEus4vtaL79KDtK9x/IDLbzvrTWgknexGcyp8sCaIbGVfvjRg6IHxYr6LIw== X-Received: by 2002:a17:90b:1642:b0:1f0:31c1:9e80 with SMTP id il2-20020a17090b164200b001f031c19e80mr833029pjb.157.1658257076692; Tue, 19 Jul 2022 11:57:56 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:57:56 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 01/12] scan: add colocated scan flag Date: Tue, 19 Jul 2022 11:55:33 -0700 Message-Id: <20220719185544.456727-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/scan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scan.c b/src/scan.c index 05e8f66e..e1c89fb2 100644 --- a/src/scan.c +++ b/src/scan.c @@ -394,6 +394,8 @@ static struct l_genl_msg *scan_build_cmd(struct scan_context *sc, if (params->ap_scan) flags |= NL80211_SCAN_FLAG_AP; + flags |= NL80211_SCAN_FLAG_COLOCATED_6GHZ; + if (flags) l_genl_msg_append_attr(msg, NL80211_ATTR_SCAN_FLAGS, 4, &flags); From patchwork Tue Jul 19 18:55:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922928 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45F5D4C82 for ; Tue, 19 Jul 2022 18:57:58 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id gn24so1282250pjb.3 for ; Tue, 19 Jul 2022 11:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DbDhtroaqcjVfvUGI9Wyt/DIs1zo4c14ptqkYtdbk5k=; b=Vo4NtftPBb5itO8pcrboJ3261Gi31lxBPGQ9WdmjvlwDAPO3IBiQJ677AwOFzfVVQs gcbRN7VMcWIqDhhKMzuLm0KbMN1FNtBhWhxsRMsoyuwtTFem6UYk5Nga9r8vIcpJJaz3 pprc5Oosk632GtXg28DcGjTndhCpQuR3tBXRYeeTUefkHKTb1Hx/Qxzsmqd9G+z6Xl0B TOlKQNT3nDTr/jD2tAW0C+L+/QPLOqAo+wF+aeHUU2JJ9gb2VvtSTVLA6IlPdftnWe04 FXgvam7cnwlaPFx3UjLO9gdSBC4/V5XMIAAMwL9N5Oi7zpLpNqvwTT5Fzqip2j7mxnQ7 KKvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DbDhtroaqcjVfvUGI9Wyt/DIs1zo4c14ptqkYtdbk5k=; b=DjIgw1c9Oqk3PXWlFOJM6/qqrIHUtMxyO58tMxRkC5YkW7x4WYCoTixk4sBums6Gst S0tQTqXBmawv8ezNnpqWFwV2/vDO9TwP3fs4ORfIn5ZgT5d6pKCuqltrhAAmpVRn/tC+ 7LFlQSVXWg5TNW2zaWLA4JEQyGKOZq3qM7B4APdQQmaCGvnj30FR9cTbjCZ5UWy4yQHw e0ZFbYZPuAB2gZQrM0RAQz9lFBKyNVHA65Rk+++9J6YzGl+8mYWKh7azsA0bfAe8Oag3 vu8CrbF3wdEZu44PiPb7iAVrcqpWWo4Gygiva2AzdvajO0vwS91l9u4qT/mWEGnGP0fC soOA== X-Gm-Message-State: AJIora81dAGOYimD/Kj+1NmXYOrL8R8nHFgRXugSQ0FHaWOQFFJVN07d Io9jK5mgJFFLzi23tR3r11n36A26PsU= X-Google-Smtp-Source: AGRyM1sHCAyXORL+5Bi5wkp82BEJwGKnzAT404bBpUT+PPPC4p5JmQqGNtKzSXmd/DwL6S0nd2Asrg== X-Received: by 2002:a17:902:b617:b0:16c:bd91:22eb with SMTP id b23-20020a170902b61700b0016cbd9122ebmr26988346pls.108.1658257077525; Tue, 19 Jul 2022 11:57:57 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:57:57 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 02/12] ie: add IE's from 802.11ax amendment Date: Tue, 19 Jul 2022 11:55:34 -0700 Message-Id: <20220719185544.456727-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/ie.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ie.h b/src/ie.h index e0bc6505..d38e9e8e 100644 --- a/src/ie.h +++ b/src/ie.h @@ -274,10 +274,29 @@ enum ie_type { IE_TYPE_OWE_DH_PARAM = 256 + 32, IE_TYPE_PASSWORD_IDENTIFIER = 256 + 33, IE_TYPE_GLK_GCR_PARAMETER_SET = 256 + 34, + IE_TYPE_HE_CAPABILITIES = 256 + 35, + IE_TYPE_HE_OPERATION = 256 + 36, + IE_TYPE_UORA_PARAMETER_SET = 256 + 37, + IE_TYPE_MU_EDCA_PARAMETER_SET = 256 + 38, + IE_TYPE_SPATIAL_REUSE_PARAMETER_SET = 256 + 39, + /* Reserved 40 */ + IE_TYPE_NDP_FEEDBACK_REPORT_PARAMETER = 256 + 41, + IE_TYPE_BSS_COLOR_CHANGE_ANNOUNCEMENT = 256 + 42, + IE_TYPE_QUIET_TIME_PERIOD = 256 + 43, IE_TYPE_VENDOR_SPECIFIC_REQUEST = 256 + 44, + IE_TYPE_ESS_REPORT = 256 + 45, + IE_TYPE_OPS = 256 + 46, + IE_TYPE_HE_BSS_LOAD = 256 + 47, IE_TYPE_MAX_CHANNEL_SWITCH_TIME = 256 + 52, IE_TYPE_ESTIMATED_SERVICE_PARAMETERS_OUT = 256 + 53, IE_TYPE_OCI = 256 + 54, + IE_TYPE_MULTIPLE_BSSID_CONFIGURATION = 256 + 55, + /* Reserved 56 */ + IE_TYPE_KNOWN_BSSID = 256 + 57, + IE_TYPE_SHORT_SSID_LIST = 256 + 58, + IE_TYPE_HE_6GHZ_BAND_CAPABILITIES = 256 + 59, + IE_TYPE_UL_MU_POWER_CAPABILITIES = 256 + 60, + /* Reserved 61 - 87 */ IE_TYPE_MSCS_DESCRIPTOR = 256 + 88, IE_TYPE_SUPPLEMENTAL_CLASS_2_CAPABILITIES = 256 + 90, IE_TYPE_REJECTED_GROUPS = 256 + 92, From patchwork Tue Jul 19 18:55:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922929 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCC6A4C77 for ; Tue, 19 Jul 2022 18:57:58 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id t15so2220003pjo.1 for ; Tue, 19 Jul 2022 11:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hldBili5cveEgXyUTuAGNzo2xkrzgi6C3TAzH0xEq1M=; b=UoXrsYpx0enJrYLVDRu9ax+H/NKsQNMzP06NI/HMSWxVg8Okdy094NX10XIKuzyCtO LwfXon8k1nVd1JLKlEnTK5hjg5AxJxkjNqehyvhe2aMMZHK+1oshnCiyqu4KUQJOIqqg DumKvE2zDyc3cvNPbn0tyyHqOA2FItBtMeH9VWEj8NWIeTQJVqMFwV9wtINBaGbBZYVB V/g4RDBp6WtKg/2EnhLTQw/ErkiC5RT81DxwmOQG+981xpzKVI520Nfu5REe8JqMhnvV sHIMgzB8997imL4KGqjU9/kWi9L/sEnq8BXPDyNWKAnAxsB2Nc1OjjN0ck5wg2zLtYOY w6fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hldBili5cveEgXyUTuAGNzo2xkrzgi6C3TAzH0xEq1M=; b=N6Q+dp/W8pcYCnIBSIrfF8yfaCxgnk9bb1f11m3u4WDyhjX9WRNWMmRJAqG9IC3lTW tqwb0PtDcrB7YEmXx7anGaBLCjdP/956KCnzJwhXk5rAd9k0ZC9eE3utEslNxBwxKCXc hNYhUwhdWLRZblYqvEczMChcoPnQhw5y9KRWMV23atZtmg/Te98ZsxvpAtvjVMWwaIwp YzqZhZka7FZhwW72Psbq7PMmRvz4JWcYZyIl9f5tMf8LbcxvslSe6TM20xT0eerDKTNF wbSnNDUalxMfUrA30eZeu9DkxUz/GfqSjNIp2srvuZ9q7yptK4+YTWo0buWDrd98dB2K +qYw== X-Gm-Message-State: AJIora8iOY5OD6Gwl7c/MqvbHj1WPV9n9xD1Y7w1KT/RisH98tY8x5/0 md0S+Ef2ILBXN1ZHl3zrrSs7mSM0MgU= X-Google-Smtp-Source: AGRyM1vCN2BGwxhhFT9qAgXP0U8tEYzZBmm1wOc/mzH3h39qGmrisbAwQSGvxsoWiJG9LQXFB0q3dA== X-Received: by 2002:a17:90b:4f4e:b0:1ef:ab40:b345 with SMTP id pj14-20020a17090b4f4e00b001efab40b345mr873104pjb.226.1658257078185; Tue, 19 Jul 2022 11:57:58 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:57:57 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 03/12] band: add band_freq Date: Tue, 19 Jul 2022 11:55:35 -0700 Message-Id: <20220719185544.456727-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 HE has different rules depending on the frequency, so the band structure also needs to track the frequency for any rate information to have context. --- src/band.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/band.h b/src/band.h index 7b9e901f..ba887ee6 100644 --- a/src/band.h +++ b/src/band.h @@ -50,6 +50,7 @@ struct band_chandef { }; struct band { + enum band_freq freq; uint8_t vht_mcs_set[8]; uint8_t vht_capabilities[4]; bool vht_supported : 1; From patchwork Tue Jul 19 18:55:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922930 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 841F24C82 for ; Tue, 19 Jul 2022 18:57:59 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id z12-20020a17090a7b8c00b001ef84000b8bso22343885pjc.1 for ; Tue, 19 Jul 2022 11:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d4MjSFXgWOJfY0OY4ByGcj2QUYiTbENckOsnVAO0y9U=; b=mESNFKUa4yINmY8b8gDJuqsFh0FeDSFcvN1aAmX/mk7tA3aesEswFaMjxKDzhWoL6f ViJdqC4w0VJnk8XSPuigTtdn3lj1AJ0AGmj7WVzsrBd+uLwseDOPk1N+e3HsOnUQlEQX GhtZIFLAKRJRtGgfLpylKQEtDJqyE84zG6AkaSa+lvTDzwatW+AbprJ7sCJw5L9dZxXk rW7u7w+Rt+lz709gACTZkpygtktH9/O7GzHnn002xravwSjxziz0WlXzP6yPmcMie3hP Bht7xhbMUi2se08Vb4fGaxJbaSF+Rm5HPf3sgDd6d6gNex9TsUFuqoKYVNwxCeXHZSPt PGaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d4MjSFXgWOJfY0OY4ByGcj2QUYiTbENckOsnVAO0y9U=; b=gSrCuohkz3WU1PM+N3S1t6sxHFlXxuiROU1JeLg8W74uatNYr41lH01BS4AfEzEkIm ewHnIcodDmEs6KoFg238pjFBNzryx+R7Xzv0ccHz0xyJrEJGp6EVCS2uTuf6iwS2HWwj WOXX0ZiAV6lXmrVR2jzP7VKzm/v4B9OnJQZB0J4NKZk+MohUtG8HiRLTltsBPySiW44E arbm6gTkMY8vrDHBqC75Saw5M0TD/ObpdbBR7FD8UJR0WO07PL9ddAojKmGDtsBdEqIG 107pcUbFVehC5dcTDk+SXS9K3jAW/EV7T0x99jL021K+MIojtAQoFTRMgEKXKpVpOjie uzoA== X-Gm-Message-State: AJIora+KbnoMmSPU6kXasNMKQJK7cvEgjOSytyIayP6V5emSrzCaSizW TXK0wS0WH/cIVYjzgiCT8fW2H3bkOEQ= X-Google-Smtp-Source: AGRyM1s7HQP5LdMJbMOR+An1JkeJ58lYjnEyOfYIZQG1FS3E+G1sj9ouNDf7ocXhBD1Cm10Gv1TENw== X-Received: by 2002:a17:90a:880a:b0:1ef:76fb:d8b6 with SMTP id s10-20020a17090a880a00b001ef76fbd8b6mr853195pjn.69.1658257078806; Tue, 19 Jul 2022 11:57:58 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:57:58 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 04/12] band: add he_capabilities queue Date: Tue, 19 Jul 2022 11:55:36 -0700 Message-Id: <20220719185544.456727-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This queue will hold iftype(s) specific data for HE capabilities. Since the capabilities may differ per-iftype the data is stored as such. Iftypes may share a configuration so the band_he_capabilities structure has a mask for each iftype using that configuration. --- src/band.c | 3 +++ src/band.h | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/band.c b/src/band.c index 984bc15d..67bbcd79 100644 --- a/src/band.c +++ b/src/band.c @@ -32,6 +32,9 @@ void band_free(struct band *band) { + if (band->he_capabilities) + l_queue_destroy(band->he_capabilities, l_free); + l_free(band); } diff --git a/src/band.h b/src/band.h index ba887ee6..1f1269c7 100644 --- a/src/band.h +++ b/src/band.h @@ -49,8 +49,16 @@ struct band_chandef { uint32_t center2_frequency; }; +struct band_he_capabilities { + uint32_t iftypes; + uint8_t he_phy_capa[11]; + uint8_t he_mcs_set[12]; +}; + struct band { enum band_freq freq; + /* Each entry is type struct band_he_capabilities */ + struct l_queue *he_capabilities; uint8_t vht_mcs_set[8]; uint8_t vht_capabilities[4]; bool vht_supported : 1; From patchwork Tue Jul 19 18:55:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922931 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1A9B4C82 for ; Tue, 19 Jul 2022 18:58:00 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id z3so438197plb.1 for ; Tue, 19 Jul 2022 11:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xaef9G1spqxBWHxWDLEPhZ4GFHqkP6QHeNcAFX5YXQg=; b=bPaam1ZecN7f4BLk+kLy7wRNhui8wvGpvoq63SsWCuESP0yqqvytr6IKK7siCr4wLq At8nE9eQPFznBKb8gA3uQrlD4ARmHsGEM4pJPzZPuTCHSx8XoaP8tqAy9g5+OfoVq4cP +7rZi/2RTkg+bpOq5zOCUSsLfRos0hriMDq/m/2Ua8+IfMdviddP2LBNVr7LTn5KSwAa cvcCiKokQutFr3PReNfv7Umd/88KFMsG+Ij7KHeQsMeqN94FiF3GMkNaUTWqqprv0u7z QLCPJvxNhpPq8r9B5a8ex+fFrcjXPCdL93G7+/GW5YcbCPzTV8GUT/96Rnnn/ZDUY2V9 L13A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xaef9G1spqxBWHxWDLEPhZ4GFHqkP6QHeNcAFX5YXQg=; b=M31wh7QlbHj3ctre4gdvr0SjxOFbrdLZxq73vt9LC1vPXqNKzjurWJ2lulTwStllpM SpN3veoKygBVI3EScjml7JJWCJz0yi+4hq+GiLnHBLz1TvmEjG7svxbGG0uOKex3GORj GG25c+McJcTTIxZoXhWn4lVjc+/PXixYEGNeYFrq2r1B3cgk/Y9vSCGm9etgiWyGJXV/ isYlli5TRxdDqU/7kbmhWuWYqcb0o9I5bt1afFyU1m1V4BdrRvrAOPvlBCoWJaVYSZY9 8dcgvpQNH+6SlDCuGpJHYOVSIOpFN/W383U9FVdy6JxtDe1ejOmQpvxq7IB+ubPwSXpi Sivw== X-Gm-Message-State: AJIora/rKq8NwysIzU/w3XGu9ziuu6rYSFlehyXrBdi8p3BBng88R6HX djtO5mgbYb3HQa3axVo9FX9IbBlQseM= X-Google-Smtp-Source: AGRyM1vDD5TuRWpeKT5I5b2DDT0I0ftQZUmFoD3ppoP/TeDrGbuKbZ4YeVcOzu5EHi6Ojh0aVG82yg== X-Received: by 2002:a17:90b:1bc7:b0:1ef:d6f3:b3d0 with SMTP id oa7-20020a17090b1bc700b001efd6f3b3d0mr896203pjb.4.1658257080035; Tue, 19 Jul 2022 11:58:00 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:57:59 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 05/12] wiphy: set band->freq when parsing band info Date: Tue, 19 Jul 2022 11:55:37 -0700 Message-Id: <20220719185544.456727-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This sets the band into the 'band' structure in order to support HE data rates. --- src/wiphy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wiphy.c b/src/wiphy.c index a52d0941..22305d5d 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -1203,16 +1203,20 @@ static void parse_supported_bands(struct wiphy *wiphy, while (l_genl_attr_next(bands, &type, NULL, NULL)) { struct band **bandp; struct band *band; + enum band_freq freq; switch (type) { case NL80211_BAND_2GHZ: bandp = &wiphy->band_2g; + freq = BAND_FREQ_2_4_GHZ; break; case NL80211_BAND_5GHZ: bandp = &wiphy->band_5g; + freq = BAND_FREQ_5_GHZ; break; case NL80211_BAND_6GHZ: bandp = &wiphy->band_6g; + freq = BAND_FREQ_6_GHZ; break; default: continue; @@ -1226,6 +1230,8 @@ static void parse_supported_bands(struct wiphy *wiphy, if (!band) continue; + band->freq = freq; + /* Reset iter to beginning */ if (!l_genl_attr_recurse(bands, &attr)) { band_free(band); From patchwork Tue Jul 19 18:55:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922932 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 895E75392 for ; Tue, 19 Jul 2022 18:58:01 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id w185so14447915pfb.4 for ; Tue, 19 Jul 2022 11:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=//r93Qm4EDqxkYxB+yOq3hqVZ4W3qRJu2Fr2LmUnJU8=; b=RqIEaplDZaIPqtjSNjGG64Hl0e1OT+TGzesfcddCfkl2XZhAjKBxql7kjAT6UCeShX emdJwMaa8Vsu2obFo1Z3v2ZSdENhBXbNbpw5zRa3QkqKZ2WGT3RaSPRAhFGmRdzLDpqk yITxJiQ9amtReX9s19VCKnRN0ZwfU3dnfOARX5hWUi/WUqjkkX7j/jIO6NNOC4BnRAYq F1iLpvGSTKnTNihAc188Zb2bt7Ip3IGJ4r4GF3+OPDhEpEYy+34movo+nLRKyb6yaTmX gM5F3cAFqDb0aZgRKO5dejfj7lNaLLkILZnIWVJbtCvodZn/18KG/4Gp8AJTdctsCMMF P9wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=//r93Qm4EDqxkYxB+yOq3hqVZ4W3qRJu2Fr2LmUnJU8=; b=PWxjSbA+Bli6+rWx5vs4VLl9yGipW7l2FRaKsDAxlVSk8XOzYg2bsQHskQt+Hz2D94 1cbUgLtbIrYztm8HjB8wQ4kyn2elsh/524pS0p4c7MCWFRMnRL+qM+8HH+J6FkEwPImM L7s9gdLvLMn3I7txr5U8xMdvvI8YQSejT7avdVK9qBNfN58/ymkg6i2pd29j1qR2+IyU DEq4+hCjYOv6lVH5wSJFvTu58xiVm2wBNYn7ECokN9s7H+IYDJ1kdCUVbzfiZqamYT0l kDW+0xyHqlgQuZ8y1ZFnIaTbfs8d7cjTQFekWV5WAFEO1WZnPxf3j4MsGt+3r+vLx/HS OdAQ== X-Gm-Message-State: AJIora+thdvgjcjUbDyQCKQ3yvP2xFzJer30aJK1AZNf4G9/w7enfkN+ GC/uBDtMeZjjBCWCSkkm25U/+HTg2P0= X-Google-Smtp-Source: AGRyM1seqk+wHLr5+zWw/BZDQXbXsddcC/zXOATvSNJGll4fXuVS/1HN/hxYOFj92QG/4sRIluwpLg== X-Received: by 2002:a63:2051:0:b0:412:6d61:ab0a with SMTP id r17-20020a632051000000b004126d61ab0amr31441165pgm.52.1658257080914; Tue, 19 Jul 2022 11:58:00 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:58:00 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 06/12] wiphy: use a 16 bit tag for extended IEs Date: Tue, 19 Jul 2022 11:55:38 -0700 Message-Id: <20220719185544.456727-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If an extended IE is needed a uint8_t tag would overflow. --- src/wiphy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wiphy.c b/src/wiphy.c index 22305d5d..d3cbe73d 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -811,7 +811,7 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy, ie_tlv_iter_init(&iter, ies, ies_len); while (ie_tlv_iter_next(&iter)) { - uint8_t tag = ie_tlv_iter_get_tag(&iter); + uint16_t tag = ie_tlv_iter_get_tag(&iter); switch (tag) { case IE_TYPE_SUPPORTED_RATES: From patchwork Tue Jul 19 18:55:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922933 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 423B64C82 for ; Tue, 19 Jul 2022 18:58:02 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id x24-20020a17090ab01800b001f21556cf48so1045300pjq.4 for ; Tue, 19 Jul 2022 11:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HtXr+E9J9eMunxHwACibY2SAcmgV0klG9HHmC9iZ9WM=; b=beZZ29I8YdTYJlxAofNu3aR6HfavWN1l7zP14zg23/kAMe149VRBhfAdcPvBs7LhIy kde6K1Ce3wvE9R4Th5iwoeH5ZnFvjBtUjW0RBKMhk3eCoK/GiTxjH+ENFdhPTk9+TGde 1xuzvbbFpYjLM8AO794Z/gnoTy7bbXI/zV5XQfw5N97bAAPcygfXmhyuPD7i8htStdSv CJmSp7e0vs1gWZcamEr7o83AiYn6DpEqRnOn2l6D+yi572q+5EYUcmYhT1SoXEADNI5O IxMYy3KL0qeaLIxSB3ejBkhP1ximbN+NOiTdYJfQElI/PSvkbe0yIIkhitfs68rtm4Dg QsSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HtXr+E9J9eMunxHwACibY2SAcmgV0klG9HHmC9iZ9WM=; b=yn3IeNKfs25vT/UEBb7H/jpvX83bdVyBnnTE7yG00h9RZToZnuh1z5flHe1SvPT7No vQFwo0jptFalwlNm7sxdVFIZpYo/e5E5Wf5k8gvf7z1AJx2QsfwlllRCgcS10RYOS8ds Z6yABMD/wml2nwvRxW07G4KuGX+TXowicNXC5jYhnEEwVU4Iji5h2w0WR0l1H/7DLlWo m6Y9hwENOkHG2dZfjD56oheJzYKOnODkUyHdJiFvG07lhlC9MDfB81Q1yQJ6OlQh8PcV wcPIaYmhDrdiNhT8kUDrY9D++JQwZs7JocTGHferoeOgfwARRrbUGqPXgztn1hT8XsfB lGMA== X-Gm-Message-State: AJIora/68Qeyf87fo1PscCWdkATdkkoEGbAsM9i5D9Lfvzf3+AoCIgqJ OnZQO2TxQQPjZowSifxDRCqVsA2wN1A= X-Google-Smtp-Source: AGRyM1vDgkYTGwzAZsjSd7P03d91P8DFaLC+gKLI4sfJtflkWaweKYphHexAnMr2zVugrrP5sbgHww== X-Received: by 2002:a17:90b:251:b0:1f2:1842:6fea with SMTP id fz17-20020a17090b025100b001f218426feamr544559pjb.73.1658257081535; Tue, 19 Jul 2022 11:58:01 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:58:01 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 07/12] wiphy: make MCS info print more generic Date: Tue, 19 Jul 2022 11:55:39 -0700 Message-Id: <20220719185544.456727-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 With the addition of HE, the print function for MCS sets needs to change slightly. The maps themselves are the same format, but the values indicate different MCS ranges. Now the three MCS max values are passed in. --- src/wiphy.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/wiphy.c b/src/wiphy.c index d3cbe73d..88a0fff8 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -903,19 +903,35 @@ static void wiphy_print_mcs_indexes(const uint8_t *mcs) } } -static void wiphy_print_vht_mcs_info(const uint8_t *mcs_map, - const char *prefix) +static void wiphy_print_mcs_info(const uint8_t *mcs_map, + const char *prefix, + uint8_t value0, + uint8_t value1, + uint8_t value2) { int i; for (i = 14; i >= 0; i -= 2) { + uint8_t value; int mcs = bit_field(mcs_map[i / 8], i % 8, 2); if (mcs == 0x3) continue; + switch (mcs) { + case 0: + value = value0; + break; + case 1: + value = value1; + break; + case 2: + value = value2; + break; + } + l_info("\t\t\tMax %s MCS: 0-%d for NSS: %d", prefix, - mcs + 7, i / 2 + 1); + value, i / 2 + 1); return; } } @@ -976,8 +992,8 @@ static void wiphy_print_band_info(struct band *band, const char *name) if (test_bit(band->vht_capabilities, 6)) l_info("\t\t\tShort GI for 160 and 80 + 80 Mhz"); - wiphy_print_vht_mcs_info(band->vht_mcs_set, "RX"); - wiphy_print_vht_mcs_info(band->vht_mcs_set + 4, "TX"); + wiphy_print_mcs_info(band->vht_mcs_set, "RX", 7, 8, 9); + wiphy_print_mcs_info(band->vht_mcs_set + 4, "TX", 7, 8, 9); } } From patchwork Tue Jul 19 18:55:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922934 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBB004C89 for ; Tue, 19 Jul 2022 18:58:02 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id o18so1466426pjs.2 for ; Tue, 19 Jul 2022 11:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uiNJZzZAPizkJbge1xg7QH1qDml9OrtVPxorwt6rKQY=; b=K9N02N3qr7036BwLVYSlxO85g/mkKHYbTOuGfPMHyGtjG06w7mjcHHTRDi0Jfo0aYK w9+E706GZlMtGOolagmylBIc8iZ2noLpD9je7lYfhEcepKynMp1CKzeDS+PY/Hy5/0Gj kQyQTZhMAJhsLAYvw8AaEgf63PLlIYOH8w7z4OPLNrE2qjDbm/dmkND5mhJrVw8zwe80 nV6kQ+fbegK8adtQensZ0V1sktBnoUk2tvDuJSOj8UgD/usBZH7wxD8hCT4yI/WKfbhC QNIuoUSql5/U18on6HCxjUdlOJMCI9S6o84HShnqmk/lYyQx5WBCLs6k7A7QAiw9xvfy ls4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uiNJZzZAPizkJbge1xg7QH1qDml9OrtVPxorwt6rKQY=; b=dXHSANmdIz5c2jYa1JN3YUDxRwT2SXF93PEX5Uus1p/DYiyERd6CefKVTc8yBD7PwR 1PE1EhLmuxK6GHo4Ja5xDIXhkOpGiQZ7IQOREZpf1LXKmKGS7tCAOv69gio7AbCznFEz uWFHqj8anlbXTu6lwcWi6lA88o4vkgf61Et8I7/Q/o3iQUkEMQ+i3Z7j8Xe1jVzdKdBU 1g7ntVOqa9ejuY6iNWTh6tMMzXaOpydTqjWDy3dYxHdmBxnqig9b9rMHc9rNH8Q6MV8S LWtFX0zvBrviClYQ/yriMbODYgctCDDaJSwIwSXjg8L8g2bWUyitt91A63pqk2+HcqOO JSKA== X-Gm-Message-State: AJIora8ABwiXoQFYxvyyvvRqxE9SMYIbbOnd/YZLTpNV7086QUYkHkFk 9ItHdy97TvvkW0Pn+HlWKnp1AAQGAiI= X-Google-Smtp-Source: AGRyM1u60quBmdvHcz7W0CV+GxBwAgEukIvlK7WKU4WfSbB01Pdk2LUGh+upKLTdmO8OqExnzxfu5Q== X-Received: by 2002:a17:90b:4a41:b0:1f0:6928:2363 with SMTP id lb1-20020a17090b4a4100b001f069282363mr851247pjb.161.1658257082159; Tue, 19 Jul 2022 11:58:02 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:58:01 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 08/12] wiphy: parse HE capabilities from band info Date: Tue, 19 Jul 2022 11:55:40 -0700 Message-Id: <20220719185544.456727-8-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The HE capabilities information is contained in NL80211_BAND_ATTR_IFTYPE_DATA where each entry is a set of attributes which define the rules for one or more interface types. This patch specifically parses the HE PHY and HE MCS data which will be used for data rate estimation. Since the set of info is per-iftype(s) the data is stored in a queue where each entry contains the PHY/MCS info, and a uint32 bit mask where each bit index signifies an interface type. --- src/wiphy.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 177 insertions(+), 3 deletions(-) diff --git a/src/wiphy.c b/src/wiphy.c index 88a0fff8..f83353ed 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -936,6 +936,74 @@ static void wiphy_print_mcs_info(const uint8_t *mcs_map, } } +static void wiphy_print_he_capabilities(struct band *band, + const struct band_he_capabilities *he_cap) +{ + int i; + char type_buf[128]; + char *s = type_buf; + uint8_t width_set = bit_field(he_cap->he_phy_capa[0], 1, 7); + + for (i = 0; i < 32; i++) { + if (!(he_cap->iftypes & (1 << i))) + continue; + + if (L_WARN_ON(s >= type_buf + sizeof(type_buf))) + return; + + switch (i) { + case NETDEV_IFTYPE_ADHOC: + s += sprintf(s, "%s ", "Ad-Hoc"); + break; + case NETDEV_IFTYPE_STATION: + s += sprintf(s, "%s ", "Station"); + break; + case NETDEV_IFTYPE_AP: + s += sprintf(s, "%s ", "AP"); + break; + case NETDEV_IFTYPE_P2P_CLIENT: + s += sprintf(s, "%s ", "P2P Client"); + break; + case NETDEV_IFTYPE_P2P_GO: + s += sprintf(s, "%s ", "P2P GO"); + break; + } + } + + l_info("\t\t\tInterface Types: %s", type_buf); + + switch (band->freq) { + case BAND_FREQ_2_4_GHZ: + wiphy_print_mcs_info(he_cap->he_mcs_set, + "HE RX <= 80MHz", 7, 9, 11); + wiphy_print_mcs_info(he_cap->he_mcs_set + 2, + "HE TX <= 80MHz", 7, 9, 11); + break; + case BAND_FREQ_5_GHZ: + case BAND_FREQ_6_GHZ: + wiphy_print_mcs_info(he_cap->he_mcs_set, + "HE RX <= 80MHz", 7, 9, 11); + wiphy_print_mcs_info(he_cap->he_mcs_set + 2, + "HE TX <= 80MHz", 7, 9, 11); + + if (test_bit(&width_set, 2)) { + wiphy_print_mcs_info(he_cap->he_mcs_set + 4, + "HE RX <= 160MHz", 7, 9, 11); + wiphy_print_mcs_info(he_cap->he_mcs_set + 6, + "HE TX <= 160MHz", 7, 9, 11); + } + + if (test_bit(&width_set, 3)) { + wiphy_print_mcs_info(he_cap->he_mcs_set + 8, + "HE RX <= 80+80MHz", 7, 9, 11); + wiphy_print_mcs_info(he_cap->he_mcs_set + 10, + "HE TX <= 80+80MHz", 7, 9, 11); + } + + break; + } +} + static void wiphy_print_band_info(struct band *band, const char *name) { int i; @@ -995,6 +1063,20 @@ static void wiphy_print_band_info(struct band *band, const char *name) wiphy_print_mcs_info(band->vht_mcs_set, "RX", 7, 8, 9); wiphy_print_mcs_info(band->vht_mcs_set + 4, "TX", 7, 8, 9); } + + if (band->he_capabilities) { + const struct l_queue_entry *entry; + + l_info("\t\tHE Capabilities"); + + for (entry = l_queue_get_entries(band->he_capabilities); + entry; entry = entry->next) { + const struct band_he_capabilities *he_cap = entry->data; + + wiphy_print_he_capabilities(band, he_cap); + } + + } } static void wiphy_print_basic_info(struct wiphy *wiphy) @@ -1208,6 +1290,90 @@ static struct band *band_new_from_message(struct l_genl_attr *band) return ret; } +static uint32_t get_iftypes(struct l_genl_attr *iftypes) +{ + uint16_t type; + uint16_t len; + uint32_t types = 0; + + while (l_genl_attr_next(iftypes, &type, &len, NULL)) { + if (len != 0) + continue; + + types |= (1 << type); + } + + return types; +} + +static void parse_iftype_attrs(struct band *band, struct l_genl_attr *types) +{ + uint16_t type; + uint16_t len; + const void *data; + unsigned int count = 0; + struct band_he_capabilities *he_cap = + l_new(struct band_he_capabilities, 1); + + while (l_genl_attr_next(types, &type, &len, &data)) { + struct l_genl_attr iftypes; + + switch (type) { + case NL80211_BAND_IFTYPE_ATTR_IFTYPES: + if (!l_genl_attr_recurse(types, &iftypes)) + goto parse_error; + + he_cap->iftypes = get_iftypes(&iftypes); + break; + case NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY: + if (len > sizeof(he_cap->he_phy_capa)) + continue; + + memcpy(he_cap->he_phy_capa, data, len); + count++; + break; + case NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET: + if (len > sizeof(he_cap->he_mcs_set)) + continue; + + memcpy(he_cap->he_mcs_set, data, len); + count++; + break; + default: + break; + } + } + + /* + * Since the capabilities element indicates what values are present in + * the MCS set ensure both values are parsed + */ + if (count != 2 || !he_cap->iftypes) + goto parse_error; + + if (!band->he_capabilities) + band->he_capabilities = l_queue_new(); + + l_queue_push_head(band->he_capabilities, he_cap); + + return; + +parse_error: + l_free(he_cap); +} + +static void parse_band_iftype_data(struct band *band, struct l_genl_attr *ifdata) +{ + while (l_genl_attr_next(ifdata, NULL, NULL, NULL)) { + struct l_genl_attr types; + + if (!l_genl_attr_recurse(ifdata, &types)) + continue; + + parse_iftype_attrs(band, &types); + } +} + static void parse_supported_bands(struct wiphy *wiphy, struct l_genl_attr *bands) { @@ -1256,15 +1422,17 @@ static void parse_supported_bands(struct wiphy *wiphy, } else band = *bandp; + + while (l_genl_attr_next(&attr, &type, &len, &data)) { - struct l_genl_attr freqs; + struct l_genl_attr nested; switch (type) { case NL80211_BAND_ATTR_FREQS: - if (!l_genl_attr_recurse(&attr, &freqs)) + if (!l_genl_attr_recurse(&attr, &nested)) continue; - parse_supported_frequencies(wiphy, &freqs); + parse_supported_frequencies(wiphy, &nested); break; case NL80211_BAND_ATTR_RATES: @@ -1304,6 +1472,12 @@ static void parse_supported_bands(struct wiphy *wiphy, memcpy(band->ht_capabilities, data, len); band->ht_supported = true; break; + case NL80211_BAND_ATTR_IFTYPE_DATA: + if (!l_genl_attr_recurse(&attr, &nested)) + continue; + + parse_band_iftype_data(band, &nested); + break; } } From patchwork Tue Jul 19 18:55:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922935 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CB404C82 for ; Tue, 19 Jul 2022 18:58:03 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id f65so14289629pgc.12 for ; Tue, 19 Jul 2022 11:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KcvNn+AQjlEqAPy2h2PYY6FrxxoPivkqhcSN5c1hIno=; b=Up9X9HOlaNZB8wGFI/zvDWukJflJM+WP6NFPmNoR1OS8mNEmGygMu4TKyHBJ+4oiSi x0HcbdnwNGBm8MXEvxv9WosVBHl59Y53BiA7OmggQ5MVolTk88CZYOvteesBU+jTUG9P GiStsS3J9SwxUz+cL6P9QsdJGQWc51CfGg9+/UoVkMVBmkRWSx+cHSh+nTcZ6XS7SZZ0 Dle44/OhBd9wSEYa6CfP2usRyn9UlxVLudGCp2yvJ8CQ5SXk1RnGEsiEMbOYWCVNHCAh Y0y2NK3FGZu867zjUbphcnGobNUUUgffJ3qVZ7gDedJy1DCsaSeN9iARfuMGq7QUokiB MacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KcvNn+AQjlEqAPy2h2PYY6FrxxoPivkqhcSN5c1hIno=; b=lB9T0y+QvapxGIhMc37baQUvXiahm+XpczRtHLDeXP7QrYEtiGIaD8v4z5LttEMhiH NpQYDgXDNPkEqvdkNd/ELx8226ajwYvQ5xgYnvR0t0jcHkJCqXKYlp1D1KuS+QnFCRIC viUmBqSwKOC5Wqa2VTSYuLilkk6zcxc3oo9gtLssqXZKDetQLIFiwy1Paxwt+HWMaB4x qud7nHGm5zno0OyWyS+sqDg4DvmwvJ+iTTQ8kv7XqcftwOHyfgbJUMGUqRin0Plnl1Qd QFw0i2fzw31Miwjf8ozgOpSFUgAtcAfilAQDT1xmQy2bkobB30Q8qQeukGkpx32aGYeI rndA== X-Gm-Message-State: AJIora9+iCviqzng0I4q2fRPLKgzF7BjtO/pTqSQyfoxmJZFrCFHfB9H Kbz2GLT4R43KSxYWD4HT4ZHkt28Bgac= X-Google-Smtp-Source: AGRyM1sXiKGzmBwKxWo3Cqs8haYexY/iu8WEEc36ZvHYMs3w0oRxE+FHBEHVmpDJwozltNZxblCbLg== X-Received: by 2002:a65:6151:0:b0:412:e419:d651 with SMTP id o17-20020a656151000000b00412e419d651mr30660252pgv.378.1658257082836; Tue, 19 Jul 2022 11:58:02 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:58:02 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 09/12] band: add find_best_mcs_nss Date: Tue, 19 Jul 2022 11:55:41 -0700 Message-Id: <20220719185544.456727-9-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is a general way of finding the best MCS/NSS values which will work for HT, VHT, and HE by passing in the max MCS values for each value which the MCS map could contain (0, 1, or 2). --- src/band.c | 75 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/src/band.c b/src/band.c index 67bbcd79..0728b0cc 100644 --- a/src/band.c +++ b/src/band.c @@ -334,6 +334,56 @@ static bool find_best_mcs_vht(uint8_t max_index, enum ofdm_channel_width width, return false; } +static bool find_best_mcs_nss(const uint8_t *rx_map, const uint8_t *tx_map, + uint8_t value0, uint8_t value1, uint8_t value2, + uint32_t *mcs_out, uint32_t *nss_out) +{ + uint32_t nss = 0; + uint32_t max_mcs = 0; + int bitoffset; + + for (bitoffset = 14; bitoffset >= 0; bitoffset -= 2) { + uint8_t rx_val = bit_field(rx_map[bitoffset / 8], + bitoffset % 8, 2); + uint8_t tx_val = bit_field(tx_map[bitoffset / 8], + bitoffset % 8, 2); + + /* + * 0 indicates support for MCS 0 - value0 + * 1 indicates support for MCS 0 - value1 + * 2 indicates support for MCS 0 - value2 + * 3 indicates no support + */ + + if (rx_val == 3 || tx_val == 3) + continue; + + /* rx_val/tx_val tells us which value# to use */ + max_mcs = minsize(rx_val, tx_val); + switch (max_mcs) { + case 0: + max_mcs = value0; + break; + case 1: + max_mcs = value1; + break; + case 2: + max_mcs = value2; + break; + } + + nss = bitoffset / 2 + 1; + break; + } + + if (!nss) + return false; + + *nss_out = nss; + *mcs_out = max_mcs; + + return true; +} /* * IEEE 802.11 - Table 9-250 * @@ -355,7 +405,6 @@ int band_estimate_vht_rx_rate(const struct band *band, uint32_t max_mcs = 7; /* MCS 0-7 for NSS:1 is always supported */ const uint8_t *rx_mcs_map; const uint8_t *tx_mcs_map; - int bitoffset; uint8_t chan_width; uint8_t channel_offset; bool sgi; @@ -378,29 +427,7 @@ int band_estimate_vht_rx_rate(const struct band *band, rx_mcs_map = band->vht_mcs_set; tx_mcs_map = vhtc + 2 + 8; - for (bitoffset = 14; bitoffset >= 0; bitoffset -= 2) { - uint8_t rx_val = bit_field(rx_mcs_map[bitoffset / 8], - bitoffset % 8, 2); - uint8_t tx_val = bit_field(tx_mcs_map[bitoffset / 8], - bitoffset % 8, 2); - - /* - * 0 indicates support for MCS 0-7 - * 1 indicates support for MCS 0-8 - * 2 indicates support for MCS 0-9 - * 3 indicates no support - */ - - if (rx_val == 3 || tx_val == 3) - continue; - - /* 7 + rx_val/tx_val gives us the maximum mcs index */ - max_mcs = minsize(rx_val, tx_val) + 7; - nss = bitoffset / 2 + 1; - break; - } - - if (!nss) + if (!find_best_mcs_nss(rx_mcs_map, tx_mcs_map, 7, 8, 9, &max_mcs, &nss)) return -EBADMSG; /* From patchwork Tue Jul 19 18:55:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922937 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C3134C82 for ; Tue, 19 Jul 2022 18:58:04 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id o18so14311987pgu.9 for ; Tue, 19 Jul 2022 11:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VoRF+IS0P8HyLxSEtJ8kTVgZC8KOdpY1QA4H07S9Gls=; b=CV5KVQ+bxnarZe2XwHtYvgamI609F4bWHGf+rKnwts7kP8bYMTB7360AMpqHtNmsYu V2bmpM+vA7yDAQf5gQ3ML8e1JUR7Vyn9FRNUSKa75eLLDl1i7I+teHCCszKPdQU4viPx WYs9XbYe7zWaMkUh1KmHQucegdKq2yUE18EIfMuRCcNg/nVCl2GSef+vvlQ3qxaSOKgj smFmdhHl8M1PY18OPj/YhWFVxZGherP+dzJjHHJvuCYed1Pahg43juw3LASZ3tZttWYJ 4MDdOZ46yJSjQxJYSYFCVrexNfsie8K7h5/LlEqRWjFRih9HBQVfHBZ8k90C+q9du0V3 vXIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VoRF+IS0P8HyLxSEtJ8kTVgZC8KOdpY1QA4H07S9Gls=; b=V2JsufSSF7XxE38+hfL6je6mAPkwt/p0uDb1ikGU+/gp5I0J0c2jUVzfF4KPL46z0Z 5otqwbM4H0KuOA9akQuE5TU2WKFIal2Rjnz3JPF0VaydU7SEdZjLBoogUnwO7qVparCM +dkGIT/sdljTKuL99OmeNo0C7AWtTekaqVkg0z4JXV7oiILNSVlb2Lc7WrZUxhALjX1V gXRqdpXG8Nwl733NZCRanew5nrO7XbvnpgUSzt7m0u7Z3HwqWC8CzXPUKJKn4qIBO4O+ WyqIWZOexIy/OE3mIJhVE51jL1o4MMp4Sdf79Et5+YqgwEIdM6qsy6h6Sx+hYojjXLOT lYRg== X-Gm-Message-State: AJIora/vUfJh0HE1PbiRKr4JKf7xYGoq7S9w2ekYGRpSfq+EAr+4LE6t /P267Y0g91r0X0hyWh7rhNhjMoPTbMg= X-Google-Smtp-Source: AGRyM1tGPjnaD1D1n+EwJu5Ov2Mh7eNz090caZZk6w1EBTHXNr4A6PHKqXiUPVgnxLZyyIA99HFg/Q== X-Received: by 2002:a05:6a00:1412:b0:528:47a6:8569 with SMTP id l18-20020a056a00141200b0052847a68569mr34590830pfu.39.1658257083980; Tue, 19 Jul 2022 11:58:03 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:58:03 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 10/12] band: add band_estimate_he_rx_rate Date: Tue, 19 Jul 2022 11:55:42 -0700 Message-Id: <20220719185544.456727-10-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Similar to the HT/VHT APIs, this estimates the data rate based on the HE Capabilities element, in addition to our own capabilities. The logic is much the same as HT/VHT. The major difference being that HE uses several MCS tables depending on the channel width. Each width MCS set is checked (if supported) and the highest estimated rate out of all the MCS sets is used. --- src/band.c | 274 +++++++++++++++++++++++++++++++++++++++++++++++++++-- src/band.h | 3 +- 2 files changed, 268 insertions(+), 9 deletions(-) diff --git a/src/band.c b/src/band.c index 0728b0cc..5afe1004 100644 --- a/src/band.c +++ b/src/band.c @@ -28,7 +28,8 @@ #include "ell/useful.h" -#include "band.h" +#include "src/band.h" +#include "src/netdev.h" void band_free(struct band *band) { @@ -125,14 +126,21 @@ int band_estimate_nonht_rate(const struct band *band, } /* - * Base RSSI values for 20MHz (both HT and VHT) channel. These values can be + * Base RSSI values for 20MHz (HT, VHT and HE) channel. These values can be * used to calculate the minimum RSSI values for all other channel widths. HT - * MCS indexes are grouped into ranges of 8 (per spatial stream) where VHT are - * grouped in chunks of 10. This just means HT will not use the last two - * index's of this array. + * MCS indexes are grouped into ranges of 8 (per spatial stream), VHT in groups + * of 10 and HE in groups of 12. This just means HT will not use the last four + * index's of this array, and VHT won't use the last two. + * + * Note: The values here are not based on anything from 802.11 but data + * found elsewhere online (presumably from testing, we hope). The two + * indexes for HE (MCS 11/12) are not based on any data, but just + * increased by 3dB compared to the previous value. We consider this good + * enough for its purpose to estimate the date rate for network/BSS + * preference. */ -static const int32_t ht_vht_base_rssi[] = { - -82, -79, -77, -74, -70, -66, -65, -64, -59, -57 +static const int32_t ht_vht_he_base_rssi[] = { + -82, -79, -77, -74, -70, -66, -65, -64, -59, -57, -54, -51 }; /* @@ -194,7 +202,7 @@ bool band_ofdm_rate(uint8_t index, enum ofdm_channel_width width, uint64_t rate; int32_t width_adjust = width * 3; - if (rssi < ht_vht_base_rssi[index] + width_adjust) + if (rssi < ht_vht_he_base_rssi[index] + width_adjust) return false; rate = ht_vht_rates[width][index]; @@ -495,6 +503,256 @@ try_vht80: return -ENETUNREACH; } +/* + * Data Rate for HE is much the same as HT/VHT but some additional MCS indexes + * were added. This mean rfactors, and nbpscs will contain two additional + * values: + * + * rfactors.extend([3/4, 5/6]) + * nbpscs.extend([10, 10]) + * + * The guard interval also differs: + * + * Tdft = 12.8us + * Tgi = 0.8, 1.6 or 2.3us + * + * The Nsd values for HE are: + * + * Nsd = [234, 468, 980, 1960] + * + * The formula is identical to HT/VHT: + * + * Nsd * Nbpscs * R * Nss / (Tdft + Tgi) + * + * Note: The table below assumes a 0.8us GI. There isn't any way to know what + * GI will be used for an actual connection, so assume the best. + */ +static uint64_t he_rates[5][12] = { + /* no-HT not applicable */ + [BAND_CHANDEF_WIDTH_20] = { + 8600000ULL, 17200000ULL, 25800000ULL, 34400000ULL, + 51600000ULL, 68800000ULL, 77400000ULL, 86000000ULL, + 103200000ULL, 114700000ULL, 129000000ULL, 143300000ULL, + }, + [BAND_CHANDEF_WIDTH_40] = { + 17200000ULL, 34400000ULL, 51600000ULL, 68800000ULL, + 103200000ULL, 137600000ULL, 154900000ULL, 172000000ULL, + 206500000ULL, 229400000ULL, 258000000ULL, 286800000ULL, + }, + [BAND_CHANDEF_WIDTH_80] = { + 36000000ULL, 72000000ULL, 108000000ULL, 144100000ULL, + 216200000ULL, 288200000ULL, 324300000ULL, 360300000ULL, + 432400000ULL, 480400000ULL, 540400000ULL, 600500000ULL, + }, + [BAND_CHANDEF_WIDTH_80P80] = { + 72000000ULL, 144100000ULL, 216200000ULL, 288200000ULL, + 432400000ULL, 576500000ULL, 648500000ULL, 720600000ULL, + 864700000ULL, 960800000ULL, 1080900000ULL, 1201000000ULL, + }, + /* 80+80MHz rates equal 160MHz according to 27.5.1 */ +}; + +static bool band_he_rate(uint8_t index, enum band_chandef_width width, + int32_t rssi, uint8_t nss, uint64_t *data_rate) +{ + uint64_t rate; + int32_t width_adjust; + + /* + * 802.11ax treats 80+80MHz and 160MHz widths together in terms of the + * data rate tables, hence why the above table has no entry for 160MHz. + * We can't simply combine the two widths fully because they differ in + * what MCS/NSS values may be supported. So if 160MHz was chosen, use + * the 80+80MHz table. + */ + if (width == BAND_CHANDEF_WIDTH_160) + width = BAND_CHANDEF_WIDTH_80P80; + + /* + * The band_chandef_width enum is being reused for HE so we have to + * subtract 1 to account for 20MHz being at index 1 (index 0 is no-HT + * which isn't applicable to HE). + */ + width_adjust = (width - 1) * 3; + + if (rssi < ht_vht_he_base_rssi[index] + width_adjust) + return false; + + rate = he_rates[width][index]; + + rate *= nss; + + *data_rate = rate; + return true; +} + +static enum band_chandef_width find_he_max_width(enum band_freq freq, + struct band_he_capabilities *he_cap, + const uint8_t *he_phy) +{ + + uint8_t own_width_set = bit_field(he_cap->he_phy_capa[0], 1, 7); + uint8_t peer_width_set = bit_field(he_phy[0], 1, 7); + enum band_chandef_width max_width = BAND_CHANDEF_WIDTH_20; + + /* + * 802.11ax Table 9-322b + */ + switch (freq) { + case BAND_FREQ_2_4_GHZ: + /* B0 indicates support for 40MHz */ + if (test_bit(&peer_width_set, 0) && test_bit(&own_width_set, 0)) + max_width = BAND_CHANDEF_WIDTH_40; + break; + case BAND_FREQ_5_GHZ: + case BAND_FREQ_6_GHZ: + /* B1 indicates support for 40MHz and 80MHz, choose 80 */ + if (test_bit(&peer_width_set, 1) && test_bit(&own_width_set, 1)) + max_width = BAND_CHANDEF_WIDTH_80; + /* B2 indicates support for 160MHz */ + if (test_bit(&peer_width_set, 2) && test_bit(&own_width_set, 2)) + max_width = BAND_CHANDEF_WIDTH_160; + /* B3 indicates support for 80+80MHz */ + if (test_bit(&peer_width_set, 3) && test_bit(&own_width_set, 3)) + max_width = BAND_CHANDEF_WIDTH_80P80; + + break; + } + + return max_width; +} + +static bool find_best_mcs_he(uint8_t max_index, enum band_chandef_width width, + int32_t rssi, uint8_t nss, + uint64_t *out_data_rate) +{ + int i; + + /* + * Iterate over all available MCS indexes to find the best one + * we can use. + */ + for (i = max_index; i >= 0; i--) + if (band_he_rate(i, width, rssi, nss, out_data_rate)) + return true; + + return false; +} + +static bool find_he_capabilities(const void *data, const void *user_data) +{ + const struct band_he_capabilities *he_cap = data; + enum netdev_iftype iftype = *((enum netdev_iftype *)user_data); + + if (he_cap->iftypes & (1 << iftype)) + return true; + + return false; +} + +/* + * HE data rate is calculated based on 802.11ax - Section 27.5 + */ +int band_estimate_he_rx_rate(const struct band *band, const uint8_t *hec, + int32_t rssi, uint64_t *out_data_rate) +{ + uint32_t nss = 0; + uint32_t max_mcs = 7; + enum band_chandef_width width; + enum band_chandef_width i; + struct band_he_capabilities *he_cap; + uint64_t best_rate = 0; + + /* + * TODO: Station type is assumed here since it is the only consumer of + * these data rate estimation APIs. If this changes the iftype + * would need to be passed in. + */ + enum netdev_iftype iftype = NETDEV_IFTYPE_STATION; + + if (!hec || !band->he_capabilities) + return -EBADMSG; + + he_cap = l_queue_find(band->he_capabilities, find_he_capabilities, + &iftype); + if (!he_cap) + return -ENOTSUP; + + /* The maximum width sets where to stop checking MCS sets */ + width = find_he_max_width(band->freq, he_cap, hec + 8); + + /* + * The HE-MCS maps are 19 bytes into the HE Capabilities IE, and + * alternate RX/TX every 2 bytes. Start the TX map 19 + 2 bytes + * into the MCS set. For each supported width beyond 80MHz + * (only 160/80+80) increment to the next map, 4 bytes ahead. + * Estimate a rate for each width, and track the largest. + */ + for (i = BAND_CHANDEF_WIDTH_80; i <= BAND_CHANDEF_WIDTH_160; i++) { + enum band_chandef_width check = i; + const uint8_t *rx_map = he_cap->he_mcs_set; + const uint8_t *tx_map = hec + 21; + uint64_t rate; + + /* + * The band_chandef_width enum does not use the same ordering as + * the MCS sets (160 and 80+80 are swapped) so we can't just + * iterate the widths and increment by 4 bytes. Instead 80+80 + * and 160 must be checked individually and skipped if not + * supported. + */ + switch (i) { + case BAND_CHANDEF_WIDTH_80P80: + /* + * 80+80 is the last map so if the width is not set to + * this continue to allow 160MHz to be checked. + */ + if (width != BAND_CHANDEF_WIDTH_80P80) + continue; + + rx_map += 8; + tx_map += 8; + break; + case BAND_CHANDEF_WIDTH_160: + /* If neither 160 or 80+80 MCS sets are supported */ + if (width != BAND_CHANDEF_WIDTH_160 && + width != BAND_CHANDEF_WIDTH_80P80) + continue; + + rx_map += 4; + tx_map += 4; + break; + default: + /* + * The <= 80MHz MCS set. If the supported width is less + * than 80Mhz use that to calculate the rate rather than + * 80Mhz. + */ + if (width < BAND_CHANDEF_WIDTH_80) + check = width; + + break; + } + + if (!find_best_mcs_nss(rx_map, tx_map, 7, 9, 11, + &max_mcs, &nss)) + continue; + + if (!find_best_mcs_he(max_mcs, check, rssi, nss, &rate)) + continue; + + if (rate > best_rate) + best_rate = rate; + } + + if (!best_rate) + return -EBADMSG; + + *out_data_rate = best_rate; + + return 0; +} + static int band_channel_info_get_bandwidth(const struct band_chandef *info) { switch (info->channel_width) { diff --git a/src/band.h b/src/band.h index 1f1269c7..9b307a77 100644 --- a/src/band.h +++ b/src/band.h @@ -74,7 +74,8 @@ void band_free(struct band *band); bool band_ofdm_rate(uint8_t index, enum ofdm_channel_width width, int32_t rssi, uint8_t nss, bool sgi, uint64_t *data_rate); - +int band_estimate_he_rx_rate(const struct band *band, const uint8_t *hec, + int32_t rssi, uint64_t *out_dat_rate); int band_estimate_vht_rx_rate(const struct band *band, const uint8_t *vhtc, const uint8_t *vhto, const uint8_t *htc, const uint8_t *hto, From patchwork Tue Jul 19 18:55:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922936 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F7AB539F for ; Tue, 19 Jul 2022 18:58:05 +0000 (UTC) Received: by mail-pf1-f181.google.com with SMTP id y141so14431346pfb.7 for ; Tue, 19 Jul 2022 11:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7rTgQX2BLtDwl0a6votul3jNEOBhBycdyWui9PbU/aQ=; b=qAtB/WzksmdCyUbGhjkHSk3Nv0AOFJ4Q5Bc3eFOCr84Tv8W2ZvMD3QrI7jo2TVSxF/ HPkjvc6GC95lQBQtNTn4V1eG/b1juLoE5bzgI+K6Ilb6zwJph455mqwR6T4aOJRF3EBp gI6N8N4D7ixs9lYGqn8MFomVVuX/l7Awj23bWH0EebscxMovegC39okE0tv4S6CwXREc KIbjcKaSWSImx5ZJY2HfK+Zpd0zh3A6QN4F7JR35uTtZcbUX4xWtgngg2xYUm7uwW41v FpT3KgbtKlWRgZn2A7HEELDqt8/ppnuE7j5MncAtD5u63Z34q5si+PtRiqFznUeGIpt7 pUkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7rTgQX2BLtDwl0a6votul3jNEOBhBycdyWui9PbU/aQ=; b=E6b5mzgJ/EIDxyPuFoubf3H4XDKlAqYnS/Q+ABKmoluZJQ76lUXGuPRVxojYKAeu40 k9BP4SvW8YBE+0/CIxZt0eWHXCKpY8CFGllxyv1TxCqK99j1yjfX5btqI6MRbqwI4fpl wT4MXV1aZbdjLai+FoRKQ9HFHRG6R/r4l5nA+FB7orZjQfL3xYvRdzfa1fMYwdy7dtC+ 4gDIYRwy2e7UGd2XCR20tuXcblVtjfibkKiNtzx9wHesCOTXVu9pnwXPcByEDEk6X5Qo eh5hrPcbiGgJhnJcS5sPPCC3hj8B72780UlpE8rHd/bxRbOzNQzC7sRkucHmHmXvzNhn RQMQ== X-Gm-Message-State: AJIora+4IBxdyYdg3Yu1G+hnGIoLvJ03Ey+qzqbeCP7AwDTUZ64ZVvcY KKFFMUpcYAPqTB6Pg8FGybx1q2n7dQc= X-Google-Smtp-Source: AGRyM1sQDxqJdJZcVLgn70FF7ENkU5ozoyk9QH0xJwY09CrOhzoJcCHQ9TUm3HxQLuti1ZjGQZW6+Q== X-Received: by 2002:a05:6a00:893:b0:528:646f:528a with SMTP id q19-20020a056a00089300b00528646f528amr34460183pfj.21.1658257084634; Tue, 19 Jul 2022 11:58:04 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:58:04 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 11/12] wiphy: use HE element for data rate estimation Date: Tue, 19 Jul 2022 11:55:43 -0700 Message-Id: <20220719185544.456727-11-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If an HE element is found, prefer using this for the rate estimation since it will likely yield the fastest rate. --- src/wiphy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/wiphy.c b/src/wiphy.c index f83353ed..cb4be66c 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -788,6 +788,7 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy, const void *vht_operation = NULL; const void *ht_capabilities = NULL; const void *ht_operation = NULL; + const void *he_capabilities = NULL; const struct band *bandp; enum band_freq band; @@ -847,11 +848,22 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy, vht_operation = iter.data - 2; break; + case IE_TYPE_HE_CAPABILITIES: + if (iter.len < 21) + return -EBADMSG; + + he_capabilities = iter.data - 2; + break; default: break; } } + if (!band_estimate_he_rx_rate(bandp, he_capabilities, + bss->signal_strength / 100, + out_data_rate)) + return 0; + if (!band_estimate_vht_rx_rate(bandp, vht_capabilities, vht_operation, ht_capabilities, ht_operation, bss->signal_strength / 100, From patchwork Tue Jul 19 18:55:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12922938 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7F3A53A0 for ; Tue, 19 Jul 2022 18:58:05 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id f65so14289728pgc.12 for ; Tue, 19 Jul 2022 11:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CyoepEdhVbNOVeorXT/E1bVVTt7BGeWeuuUsfnt/64I=; b=FzfzUxeaGzm6CwHkKrjrTJFpv5L9kjTVsVVvttd+lrHVICzSttaTo0Ms7mXwRIGfGN gXYRgvN6RAd+vFvYZj86zn7ddjFqYn3lj0FHBmUovfLCCgz+CtaslnIP+xVHJKnqi09v IHqZ5ZxwxO4Ie5JgT59GN266hM1ot5WuJO51UniRPvSI5OXvTnoP0ni3uTvpRYspS9sG d+YttQZjynE2bJTK9cBLLiRCRk0kE92DzMBKx+WLrP3qn7ofnCCYYXnsmd7TV3XSFzPy O9shRExkdQYP/Hvg6rsI8Ra3iSlJLrMUkbInDtPospq51OOWg3bsZkNKy9AGCLY4qF/0 v2Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CyoepEdhVbNOVeorXT/E1bVVTt7BGeWeuuUsfnt/64I=; b=eylYLaG9AZG7Hhd5+iYU86BPBwvKwXs/MvXm1+ucjVbXLbRRleyFCavaAUEpa0sm6c lBZSwMqkS7Tuq1+5JO1l87QIv5pDhpz1+lPUa94hf8EeYNukhtCRNFw0/oo6m5qZeX5n zkQxQicqBVy724fPW8gnfnOwbz88qQ8K2/UWSwZMDCAwDDmRYmyHip+/FFsln953WDVL bnx/OG8XzspWQerjPBl/naqGiLuPzh/sLYHR5JPHTHkVssFgL4wbZquqqycyGFmEBLJE gEUftx78caIvaWM9yab8Tk76VjO1ZVFgELVjy4bUdVtc81/6Tq3E2Ykp92pqaGENhFO8 mvtQ== X-Gm-Message-State: AJIora85e8jPjr50fyHBOlVMCG8BabeG8N0FC17tII/f3znyYxYCoTB6 Ml7VqfupR8ndtooeR+fGh43hWrcPcE8= X-Google-Smtp-Source: AGRyM1v9tauEZvoh789g4sJUtlwTgwuaBtamNJdi8b123qus3pDo5/socjiB5rXQzqi3VJUewIYv7Q== X-Received: by 2002:a05:6a00:234f:b0:525:1f7c:f2bf with SMTP id j15-20020a056a00234f00b005251f7cf2bfmr35308123pfj.14.1658257085418; Tue, 19 Jul 2022 11:58:05 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e80700b0016c68b56be7sm11937785plg.158.2022.07.19.11.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:58:04 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 12/12] scan: increase max data rate, now for HE Date: Tue, 19 Jul 2022 11:55:44 -0700 Message-Id: <20220719185544.456727-12-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719185544.456727-1-prestwoj@gmail.com> References: <20220719185544.456727-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This increases the maximum data rate which now is possible with HE. A few comments were also updated, one to include 6G when adjusting the rank for >4000mhz, and the other fixing a typo. --- src/scan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scan.c b/src/scan.c index e1c89fb2..7fc60e32 100644 --- a/src/scan.c +++ b/src/scan.c @@ -1628,17 +1628,17 @@ static void scan_bss_compute_rank(struct scan_bss *bss) double rank; uint32_t irank; /* - * Maximum rate is 2340Mbps (VHT) + * Maximum rate is 9607.8Mbps (HE) */ - double max_rate = 2340000000; + double max_rate = 9607800000; rank = (double)bss->data_rate / max_rate * USHRT_MAX; - /* Prefer 5G networks over 2.4G */ + /* Prefer 5G/6G networks over 2.4G */ if (bss->frequency > 4000) rank *= RANK_5G_FACTOR; - /* Rank loaded APs lower and lighly loaded APs higher */ + /* Rank loaded APs lower and lightly loaded APs higher */ if (bss->utilization >= 192) rank *= RANK_HIGH_UTILIZATION_FACTOR; else if (bss->utilization <= 63)