summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2025-08-11 03:42:16 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2025-08-11 03:42:16 +0000
commita6a613da12da2c540267b07219fef9bd655aa01b (patch)
tree10d7728a26095c4d97633e8f487f27d50a059682
parent9c6b6723ca8440203bd44eabf7451ff3a7df20e4 (diff)
ath-common: update common Atheros/QCA codevendor/Linux/ath-common/torvalds-v6.16
This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 038d61fd642278bab63ee8ef722c50d10ab01e8f ( tag: v6.16 ). Sponsored by: The FreeBSD Foundation
-rw-r--r--Kconfig68
-rw-r--r--Makefile25
-rw-r--r--ath.h6
-rw-r--r--dfs_pattern_detector.c21
-rw-r--r--hw.c2
-rw-r--r--key.c4
-rw-r--r--testmode_i.h66
-rw-r--r--trace.h4
8 files changed, 176 insertions, 20 deletions
diff --git a/Kconfig b/Kconfig
new file mode 100644
index 000000000000..910c10028b14
--- /dev/null
+++ b/Kconfig
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: ISC
+config ATH_COMMON
+ tristate
+
+config WLAN_VENDOR_ATH
+ bool "Atheros/Qualcomm devices"
+ default y
+ help
+ If you have a wireless card belonging to this class, say Y.
+
+ Note that the answer to this question doesn't directly affect the
+ kernel: saying N will just cause the configurator to skip all the
+ questions about these cards. If you say Y, you will be asked for
+ your specific card in the following questions.
+
+ For more information and documentation on this module you can visit:
+
+ https://wireless.wiki.kernel.org/en/users/Drivers/ath
+
+ For information on all Atheros wireless drivers visit:
+
+ https://wireless.wiki.kernel.org/en/users/Drivers/Atheros
+
+if WLAN_VENDOR_ATH
+
+config ATH_DEBUG
+ bool "Atheros wireless debugging"
+ help
+ Say Y, if you want to debug atheros wireless drivers.
+ Right now only ath9k makes use of this.
+
+config ATH_TRACEPOINTS
+ bool "Atheros wireless tracing"
+ depends on ATH_DEBUG
+ depends on EVENT_TRACING
+ help
+ This option enables tracepoints for atheros wireless drivers.
+ Currently, ath9k makes use of this facility.
+
+config ATH_REG_DYNAMIC_USER_REG_HINTS
+ bool "Atheros dynamic user regulatory hints"
+ depends on CFG80211_CERTIFICATION_ONUS
+ default n
+ help
+ Say N. This should only be enabled in countries where
+ this feature is explicitly allowed and only on cards that
+ specifically have been tested for this.
+
+config ATH_REG_DYNAMIC_USER_CERT_TESTING
+ bool "Atheros dynamic user regulatory testing"
+ depends on ATH_REG_DYNAMIC_USER_REG_HINTS && CFG80211_CERTIFICATION_ONUS
+ default n
+ help
+ Say N. This should only be enabled on systems
+ undergoing certification testing.
+
+source "drivers/net/wireless/ath/ath5k/Kconfig"
+source "drivers/net/wireless/ath/ath9k/Kconfig"
+source "drivers/net/wireless/ath/carl9170/Kconfig"
+source "drivers/net/wireless/ath/ath6kl/Kconfig"
+source "drivers/net/wireless/ath/ar5523/Kconfig"
+source "drivers/net/wireless/ath/wil6210/Kconfig"
+source "drivers/net/wireless/ath/ath10k/Kconfig"
+source "drivers/net/wireless/ath/wcn36xx/Kconfig"
+source "drivers/net/wireless/ath/ath11k/Kconfig"
+source "drivers/net/wireless/ath/ath12k/Kconfig"
+
+endif
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..8d6e6e218d24
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: ISC
+obj-$(CONFIG_ATH5K) += ath5k/
+obj-$(CONFIG_ATH9K_HW) += ath9k/
+obj-$(CONFIG_CARL9170) += carl9170/
+obj-$(CONFIG_ATH6KL) += ath6kl/
+obj-$(CONFIG_AR5523) += ar5523/
+obj-$(CONFIG_WIL6210) += wil6210/
+obj-$(CONFIG_ATH10K) += ath10k/
+obj-$(CONFIG_WCN36XX) += wcn36xx/
+obj-$(CONFIG_ATH11K) += ath11k/
+obj-$(CONFIG_ATH12K) += ath12k/
+
+obj-$(CONFIG_ATH_COMMON) += ath.o
+
+ath-objs := main.o \
+ regd.o \
+ hw.o \
+ key.o \
+ dfs_pattern_detector.o \
+ dfs_pri_detector.o
+
+ath-$(CONFIG_ATH_DEBUG) += debug.o
+ath-$(CONFIG_ATH_TRACEPOINTS) += trace.o
+
+CFLAGS_trace.o := -I$(src)
diff --git a/ath.h b/ath.h
index f02a308a9ffc..34654f710d8a 100644
--- a/ath.h
+++ b/ath.h
@@ -171,8 +171,10 @@ struct ath_common {
unsigned int clockrate;
spinlock_t cc_lock;
- struct ath_cycle_counters cc_ani;
- struct ath_cycle_counters cc_survey;
+ struct_group(cc,
+ struct ath_cycle_counters cc_ani;
+ struct ath_cycle_counters cc_survey;
+ );
struct ath_regulatory regulatory;
struct ath_regulatory reg_world_copy;
diff --git a/dfs_pattern_detector.c b/dfs_pattern_detector.c
index 27f4d74a41c8..700da9f4531e 100644
--- a/dfs_pattern_detector.c
+++ b/dfs_pattern_detector.c
@@ -161,7 +161,7 @@ get_dfs_domain_radar_types(enum nl80211_dfs_regions region)
struct channel_detector {
struct list_head head;
u16 freq;
- struct pri_detector **detectors;
+ struct pri_detector *detectors[];
};
/* channel_detector_reset() - reset detector lines for a given channel */
@@ -183,14 +183,13 @@ static void channel_detector_exit(struct dfs_pattern_detector *dpd,
if (cd == NULL)
return;
list_del(&cd->head);
- if (cd->detectors) {
- for (i = 0; i < dpd->num_radar_types; i++) {
- struct pri_detector *de = cd->detectors[i];
- if (de != NULL)
- de->exit(de);
- }
+
+ for (i = 0; i < dpd->num_radar_types; i++) {
+ struct pri_detector *de = cd->detectors[i];
+ if (de != NULL)
+ de->exit(de);
}
- kfree(cd->detectors);
+
kfree(cd);
}
@@ -200,16 +199,12 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq)
u32 i;
struct channel_detector *cd;
- cd = kmalloc(sizeof(*cd), GFP_ATOMIC);
+ cd = kzalloc(struct_size(cd, detectors, dpd->num_radar_types), GFP_ATOMIC);
if (cd == NULL)
goto fail;
INIT_LIST_HEAD(&cd->head);
cd->freq = freq;
- cd->detectors = kmalloc_array(dpd->num_radar_types,
- sizeof(*cd->detectors), GFP_ATOMIC);
- if (cd->detectors == NULL)
- goto fail;
for (i = 0; i < dpd->num_radar_types; i++) {
const struct radar_detector_specs *rs = &dpd->radar_spec[i];
diff --git a/hw.c b/hw.c
index 85955572a705..b301e6fbce6c 100644
--- a/hw.c
+++ b/hw.c
@@ -15,7 +15,7 @@
*/
#include <linux/export.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
#include "ath.h"
#include "reg.h"
diff --git a/key.c b/key.c
index b7b61d4f02ba..0ae436bd9b66 100644
--- a/key.c
+++ b/key.c
@@ -16,7 +16,7 @@
*/
#include <linux/export.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
#include <net/mac80211.h>
#include "ath.h"
@@ -104,7 +104,7 @@ bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac)
* Not setting this bit allows the hardware to use the key
* for multicast frame decryption.
*/
- if (mac[0] & 0x01)
+ if (is_multicast_ether_addr(mac))
unicast_flag = 0;
macLo = get_unaligned_le32(mac);
diff --git a/testmode_i.h b/testmode_i.h
new file mode 100644
index 000000000000..980ef2f3f05f
--- /dev/null
+++ b/testmode_i.h
@@ -0,0 +1,66 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+/* "API" level of the ath testmode interface. Bump it after every
+ * incompatible interface change.
+ */
+#define ATH_TESTMODE_VERSION_MAJOR 1
+
+/* Bump this after every _compatible_ interface change, for example
+ * addition of a new command or an attribute.
+ */
+#define ATH_TESTMODE_VERSION_MINOR 1
+
+#define ATH_TM_DATA_MAX_LEN 5000
+#define ATH_FTM_EVENT_MAX_BUF_LENGTH 2048
+
+enum ath_tm_attr {
+ __ATH_TM_ATTR_INVALID = 0,
+ ATH_TM_ATTR_CMD = 1,
+ ATH_TM_ATTR_DATA = 2,
+ ATH_TM_ATTR_WMI_CMDID = 3,
+ ATH_TM_ATTR_VERSION_MAJOR = 4,
+ ATH_TM_ATTR_VERSION_MINOR = 5,
+ ATH_TM_ATTR_WMI_OP_VERSION = 6,
+
+ /* keep last */
+ __ATH_TM_ATTR_AFTER_LAST,
+ ATH_TM_ATTR_MAX = __ATH_TM_ATTR_AFTER_LAST - 1,
+};
+
+/* All ath testmode interface commands specified in
+ * ATH_TM_ATTR_CMD
+ */
+enum ath_tm_cmd {
+ /* Returns the supported ath testmode interface version in
+ * ATH_TM_ATTR_VERSION. Always guaranteed to work. User space
+ * uses this to verify it's using the correct version of the
+ * testmode interface
+ */
+ ATH_TM_CMD_GET_VERSION = 0,
+
+ /* The command used to transmit a WMI command to the firmware and
+ * the event to receive WMI events from the firmware. Without
+ * struct wmi_cmd_hdr header, only the WMI payload. Command id is
+ * provided with ATH_TM_ATTR_WMI_CMDID and payload in
+ * ATH_TM_ATTR_DATA.
+ */
+ ATH_TM_CMD_WMI = 1,
+
+ /* Boots the UTF firmware, the netdev interface must be down at the
+ * time.
+ */
+ ATH_TM_CMD_TESTMODE_START = 2,
+
+ /* The command used to transmit a FTM WMI command to the firmware
+ * and the event to receive WMI events from the firmware. The data
+ * received only contain the payload, need to add the tlv header
+ * and send the cmd to firmware with command id WMI_PDEV_UTF_CMDID.
+ * The data payload size could be large and the driver needs to
+ * send segmented data to firmware.
+ */
+ ATH_TM_CMD_WMI_FTM = 3,
+};
diff --git a/trace.h b/trace.h
index 9935cf475b6d..82aac0a4baff 100644
--- a/trace.h
+++ b/trace.h
@@ -44,8 +44,8 @@ TRACE_EVENT(ath_log,
),
TP_fast_assign(
- __assign_str(device, wiphy_name(wiphy));
- __assign_str(driver, KBUILD_MODNAME);
+ __assign_str(device);
+ __assign_str(driver);
__assign_vstr(msg, vaf->fmt, vaf->va);
),