Files
wlan-ap/feeds/qca-wifi-7/hostapd/patches/r08-04-nl80211-add-support-for-device-bandwidth-params.patch
John Crispin 68cf54d9f7 qca-wifi-7: update to ath12.5.5
Signed-off-by: John Crispin <john@phrozen.org>
2025-02-27 12:45:52 +01:00

117 lines
3.7 KiB
Diff

From 78c11c9a5a6ee954efd0a76703a4484aca093472 Mon Sep 17 00:00:00 2001
From: Shivani Tambatkar <quic_stambatk@quicinc.com>
Date: Sun, 3 Dec 2023 00:06:59 -0800
Subject: [PATCH 4/7] nl80211: add support for device bandwidth params
Add NL80211_ATTR_CHANNEL_WIDTH_DEVICE and NL80211_ATTR_CENTER_FREQ_DEVICE
to be used to pass device bandwidth parameters to kernel.
Signed-off-by: Shivani Tambatkar <quic_stambatk@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
src/drivers/driver_nl80211.c | 59 ++++++++++++++++++++++++++++++++++++
src/drivers/nl80211_copy.h | 10 ++++++
2 files changed, 69 insertions(+)
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4932,6 +4932,60 @@ err:
}
#endif /* CONFIG_DRIVER_NL80211_QCA */
+static int nl80211_put_freq_params_device(struct wpa_driver_nl80211_data *drv,
+ struct nl_msg *msg,
+ const struct hostapd_freq_params *freq)
+{
+ enum nl80211_chan_width width_device;
+
+ if (freq->center_freq_device == 0 && freq->bandwidth_device == 0)
+ return 0;
+
+ if (!drv->device_bw) {
+ wpa_printf(MSG_ERROR,
+ "nl80211: Driver does not support device BW parameters separate from operating BW");
+ return -EOPNOTSUPP;
+ }
+
+ if (!freq->eht_enabled) {
+ wpa_printf(MSG_ERROR,
+ "Device Parameters are supported only for EHT mode");
+ return -EINVAL;
+ }
+
+ if (freq->center_freq_device == 0 || freq->bandwidth_device == 0) {
+ wpa_printf(MSG_ERROR,
+ "Invalid input: bandwidth_device=%d center_freq_device=%d\n",
+ freq->bandwidth_device, freq->center_freq_device);
+ return -EINVAL;
+ }
+
+ switch (freq->bandwidth_device) {
+ case 40:
+ width_device = NL80211_CHAN_WIDTH_40;
+ break;
+ case 80:
+ width_device = NL80211_CHAN_WIDTH_80;
+ break;
+ case 160:
+ width_device = NL80211_CHAN_WIDTH_160;
+ break;
+ case 320:
+ width_device = NL80211_CHAN_WIDTH_320;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ_DEVICE, freq->center_freq_device);
+ nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH_DEVICE, width_device);
+ wpa_printf(MSG_DEBUG,
+ " * bandwidth_device=%d * center_freq_device=%d\n",
+ freq->bandwidth_device, freq->center_freq_device);
+ return 0;
+}
+
+
static int nl80211_put_freq_params(struct wpa_driver_nl80211_data *drv,
struct nl_msg *msg,
const struct hostapd_freq_params *freq)
@@ -5041,6 +5095,12 @@ static int nl80211_put_freq_params(struc
NL80211_CHAN_NO_HT))
return -ENOBUFS;
}
+
+ if (nl80211_put_freq_params_device(drv, msg, freq)) {
+ wpa_printf(MSG_ERROR, "Failed to add device parameters");
+ return -EINVAL;
+ }
+
if (freq->radar_background &&
nla_put_flag(msg, NL80211_ATTR_RADAR_BACKGROUND))
return -ENOBUFS;
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -2885,6 +2885,13 @@ enum nl80211_commands {
* @NL80211_ATTR_SET_CRITICAL_UPDATE: set critical update for the bss
* (see &enum nl80211_set_cu).
*
+ * @NL80211_ATTR_CHANNEL_WIDTH_DEVICE: Device channel width (u32). Value
+ * must be zero or twice @NL80211_ATTR_CHANNEL_WIDTH which is the
+ * operating channel width. Minimum value is 40 MHz.
+ *
+ * @NL80211_ATTR_CENTER_FREQ_DEVICE: Device center frequency (u32). The value
+ * must coincide with one edge of the operating bandwidth.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3447,6 +3454,8 @@ enum nl80211_attrs {
NL80211_ATTR_DEL_MULTI_CHAN,
NL80211_ATTR_RXMGMT_CRITICAL_UPDATE,
NL80211_ATTR_SET_CRITICAL_UPDATE,
+ NL80211_ATTR_CHANNEL_WIDTH_DEVICE,
+ NL80211_ATTR_CENTER_FREQ_DEVICE,
/* add attributes here, update the policy in nl80211.c */