aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/ath
diff options
context:
space:
mode:
Diffstat (limited to 'package/kernel/mac80211/patches/ath')
-rw-r--r--package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch117
-rw-r--r--package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch53
-rw-r--r--package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch4
-rw-r--r--package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch8
-rw-r--r--package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch4
-rw-r--r--package/kernel/mac80211/patches/ath/405-ath_regd_us.patch4
-rw-r--r--package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch2
-rw-r--r--package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch61
8 files changed, 128 insertions, 125 deletions
diff --git a/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch
new file mode 100644
index 00000000000..6c476e90581
--- /dev/null
+++ b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch
@@ -0,0 +1,117 @@
+From e8053643b6d70e23a634f14e4408f3a6d1d3a6bf Mon Sep 17 00:00:00 2001
+From: Shiji Yang <yangshiji66@qq.com>
+Date: Sat, 27 May 2023 09:04:48 +0000
+Subject: [PATCH] wifi: ath: add struct_group for struct ath_cycle_counters
+
+Add a struct_group to around all members in struct ath_cycle_counters.
+It can help the compiler detect the intended bounds of the memcpy() and
+memset().
+
+This patch fixes the following build warning:
+
+In function 'fortify_memset_chk',
+ inlined from 'ath9k_ps_wakeup' at /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/backports-6.1.24/drivers/net/wireless/ath/ath9k/main.c:140:3:
+./include/linux/fortify-string.h:314:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
+ 314 | __write_overflow_field(p_size_field, size);
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Shiji Yang <yangshiji66@qq.com>
+---
+ drivers/net/wireless/ath/ath.h | 10 ++++++----
+ drivers/net/wireless/ath/ath5k/ani.c | 2 +-
+ drivers/net/wireless/ath/ath5k/base.c | 4 ++--
+ drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +-
+ drivers/net/wireless/ath/ath9k/link.c | 2 +-
+ drivers/net/wireless/ath/ath9k/main.c | 4 ++--
+ drivers/net/wireless/ath/hw.c | 2 +-
+ 7 files changed, 14 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath.h
++++ b/drivers/net/wireless/ath/ath.h
+@@ -43,10 +43,12 @@ struct ath_ani {
+ };
+
+ struct ath_cycle_counters {
+- u32 cycles;
+- u32 rx_busy;
+- u32 rx_frame;
+- u32 tx_frame;
++ struct_group(cnts,
++ u32 cycles;
++ u32 rx_busy;
++ u32 rx_frame;
++ u32 tx_frame;
++ );
+ };
+
+ enum ath_device_state {
+--- a/drivers/net/wireless/ath/ath5k/ani.c
++++ b/drivers/net/wireless/ath/ath5k/ani.c
+@@ -379,7 +379,7 @@ ath5k_hw_ani_get_listen_time(struct ath5
+ spin_lock_bh(&common->cc_lock);
+
+ ath_hw_cycle_counters_update(common);
+- memcpy(&as->last_cc, &common->cc_ani, sizeof(as->last_cc));
++ memcpy(&as->last_cc.cnts, &common->cc_ani.cnts, sizeof(as->last_cc.cnts));
+
+ /* clears common->cc_ani */
+ listen = ath_hw_get_listen_time(common);
+--- a/drivers/net/wireless/ath/ath5k/base.c
++++ b/drivers/net/wireless/ath/ath5k/base.c
+@@ -2985,8 +2985,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
+ memset(&ah->survey, 0, sizeof(ah->survey));
+ spin_lock_bh(&common->cc_lock);
+ ath_hw_cycle_counters_update(common);
+- memset(&common->cc_survey, 0, sizeof(common->cc_survey));
+- memset(&common->cc_ani, 0, sizeof(common->cc_ani));
++ memset(&common->cc_survey.cnts, 0, sizeof(common->cc_survey.cnts));
++ memset(&common->cc_ani.cnts, 0, sizeof(common->cc_ani.cnts));
+ spin_unlock_bh(&common->cc_lock);
+
+ /*
+--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+@@ -665,7 +665,7 @@ ath5k_get_survey(struct ieee80211_hw *hw
+ ah->survey.time_rx += cc->rx_frame / div;
+ ah->survey.time_tx += cc->tx_frame / div;
+ }
+- memset(cc, 0, sizeof(*cc));
++ memset(&cc->cnts, 0, sizeof(cc->cnts));
+ spin_unlock_bh(&common->cc_lock);
+
+ memcpy(survey, &ah->survey, sizeof(*survey));
+--- a/drivers/net/wireless/ath/ath9k/link.c
++++ b/drivers/net/wireless/ath/ath9k/link.c
+@@ -536,7 +536,7 @@ int ath_update_survey_stats(struct ath_s
+ if (cc->cycles > 0)
+ ret = cc->rx_busy * 100 / cc->cycles;
+
+- memset(cc, 0, sizeof(*cc));
++ memset(&cc->cnts, 0, sizeof(cc->cnts));
+
+ ath_update_survey_nf(sc, pos);
+
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -135,8 +135,8 @@ void ath9k_ps_wakeup(struct ath_softc *s
+ if (power_mode != ATH9K_PM_AWAKE) {
+ spin_lock(&common->cc_lock);
+ ath_hw_cycle_counters_update(common);
+- memset(&common->cc_survey, 0, sizeof(common->cc_survey));
+- memset(&common->cc_ani, 0, sizeof(common->cc_ani));
++ memset(&common->cc_survey.cnts, 0, sizeof(common->cc_survey.cnts));
++ memset(&common->cc_ani.cnts, 0, sizeof(common->cc_ani.cnts));
+ spin_unlock(&common->cc_lock);
+ }
+
+--- a/drivers/net/wireless/ath/hw.c
++++ b/drivers/net/wireless/ath/hw.c
+@@ -183,7 +183,7 @@ int32_t ath_hw_get_listen_time(struct at
+ listen_time = (cc->cycles - cc->rx_frame - cc->tx_frame) /
+ (common->clockrate * 1000);
+
+- memset(cc, 0, sizeof(*cc));
++ memset(&cc->cnts, 0, sizeof(cc->cnts));
+
+ return listen_time;
+ }
diff --git a/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
deleted file mode 100644
index d1d6c9e2e3e..00000000000
--- a/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From: Christian Lamparter <chunkeey@gmail.com>
-Date: Sat, 16 Nov 2019 19:25:24 +0100
-Subject: [PATCH] owl_loader: compatibility patch
-
-This patch includes OpenWrt specific changes that are
-not included in the upstream owl-loader.
-
-This includes a platform data handling changes for ar71xx.
-
-Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
-
---- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
-+++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
-@@ -103,6 +103,7 @@ static void owl_fw_cb(const struct firmw
- {
- struct pci_dev *pdev = (struct pci_dev *)context;
- struct owl_ctx *ctx = (struct owl_ctx *)pci_get_drvdata(pdev);
-+ struct ath9k_platform_data *pdata = dev_get_platdata(&pdev->dev);
- struct pci_bus *bus;
-
- complete(&ctx->eeprom_load);
-@@ -118,6 +119,16 @@ static void owl_fw_cb(const struct firmw
- goto release;
- }
-
-+ if (pdata) {
-+ memcpy(pdata->eeprom_data, fw->data, fw->size);
-+
-+ /*
-+ * eeprom has been successfully loaded - pass the data to ath9k
-+ * but remove the eeprom_name, so it doesn't try to load it too.
-+ */
-+ pdata->eeprom_name = NULL;
-+ }
-+
- if (ath9k_pci_fixup(pdev, (const u16 *)fw->data, fw->size))
- goto release;
-
-@@ -137,8 +148,14 @@ release:
- static const char *owl_get_eeprom_name(struct pci_dev *pdev)
- {
- struct device *dev = &pdev->dev;
-+ struct ath9k_platform_data *pdata;
- char *eeprom_name;
-
-+ /* try the existing platform data first */
-+ pdata = dev_get_platdata(dev);
-+ if (pdata && pdata->eeprom_name)
-+ return pdata->eeprom_name;
-+
- dev_dbg(dev, "using auto-generated eeprom filename\n");
-
- eeprom_name = devm_kzalloc(dev, EEPROM_FILENAME_LEN, GFP_KERNEL);
diff --git a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch
index db10c45104d..23b7340e25c 100644
--- a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch
+++ b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/Makefile
+++ b/drivers/net/wireless/ath/Makefile
-@@ -15,10 +15,10 @@ ath-objs := main.o \
+@@ -16,10 +16,10 @@ ath-objs := main.o \
regd.o \
hw.o \
key.o \
@@ -14,7 +14,7 @@
CFLAGS_trace.o := -I$(src)
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
-@@ -316,14 +316,7 @@ void _ath_dbg(struct ath_common *common,
+@@ -321,14 +321,7 @@ void _ath_dbg(struct ath_common *common,
#endif /* CPTCFG_ATH_DEBUG */
/** Returns string describing opmode, or NULL if unknown mode. */
diff --git a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch
index 3c9180b1137..601ebdc7583 100644
--- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch
+++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch
@@ -37,7 +37,7 @@
for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!wiphy->bands[band])
continue;
-@@ -378,6 +387,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
+@@ -379,6 +388,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
{
struct ieee80211_supported_band *sband;
@@ -47,7 +47,7 @@
sband = wiphy->bands[NL80211_BAND_2GHZ];
if (!sband)
return;
-@@ -407,6 +419,9 @@ static void ath_reg_apply_radar_flags(st
+@@ -408,6 +420,9 @@ static void ath_reg_apply_radar_flags(st
struct ieee80211_channel *ch;
unsigned int i;
@@ -57,7 +57,7 @@
if (!wiphy->bands[NL80211_BAND_5GHZ])
return;
-@@ -639,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator
+@@ -640,6 +655,10 @@ ath_regd_init_wiphy(struct ath_regulator
const struct ieee80211_regdomain *regd;
wiphy->reg_notifier = reg_notifier;
@@ -82,7 +82,7 @@
help
--- a/local-symbols
+++ b/local-symbols
-@@ -86,6 +86,7 @@ ADM8211=
+@@ -101,6 +101,7 @@ ADM8211=
ATH_COMMON=
WLAN_VENDOR_ATH=
ATH_DEBUG=
diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch
index c6dc184e28c..d0f4b15772f 100644
--- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch
+++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch
@@ -1,6 +1,6 @@
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
-@@ -3252,6 +3252,8 @@ void regulatory_hint_country_ie(struct w
+@@ -3340,6 +3340,8 @@ void regulatory_hint_country_ie(struct w
enum environment_cap env = ENVIRON_ANY;
struct regulatory_request *request = NULL, *lr;
@@ -9,7 +9,7 @@
/* IE len must be evenly divisible by 2 */
if (country_ie_len & 0x01)
return;
-@@ -3503,6 +3505,7 @@ static bool is_wiphy_all_set_reg_flag(en
+@@ -3591,6 +3593,7 @@ static bool is_wiphy_all_set_reg_flag(en
void regulatory_hint_disconnect(void)
{
diff --git a/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch b/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch
index 088833199d0..6723721a47b 100644
--- a/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch
+++ b/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch
@@ -8,7 +8,7 @@
FRANCE_RES = 0x31,
FCC3_FCCA = 0x3A,
FCC3_WORLD = 0x3B,
-@@ -172,6 +173,7 @@ static struct reg_dmn_pair_mapping regDo
+@@ -173,6 +174,7 @@ static struct reg_dmn_pair_mapping regDo
{FCC2_WORLD, CTL_FCC, CTL_ETSI},
{FCC2_ETSIC, CTL_FCC, CTL_ETSI},
{FCC3_FCCA, CTL_FCC, CTL_FCC},
@@ -16,7 +16,7 @@
{FCC3_WORLD, CTL_FCC, CTL_ETSI},
{FCC3_ETSIC, CTL_FCC, CTL_ETSI},
{FCC4_FCCA, CTL_FCC, CTL_FCC},
-@@ -483,6 +485,7 @@ static struct country_code_to_enum_rd al
+@@ -486,6 +488,7 @@ static struct country_code_to_enum_rd al
{CTRY_UAE, NULL1_WORLD, "AE"},
{CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
{CTRY_UNITED_STATES, FCC3_FCCA, "US"},
diff --git a/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch b/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch
index 35b0f2b76ef..ee4e461342a 100644
--- a/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch
+++ b/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch
@@ -39,7 +39,7 @@
bool ath_is_world_regd(struct ath_regulatory *reg)
{
return is_wwr_sku(ath_regd_get_eepromRD(reg));
-@@ -658,6 +666,9 @@ ath_regd_init_wiphy(struct ath_regulator
+@@ -659,6 +667,9 @@ ath_regd_init_wiphy(struct ath_regulator
if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
return 0;
diff --git a/package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch
deleted file mode 100644
index d0eb43fdea0..00000000000
--- a/package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 22fb5991a44c78ff18ec0082dc90c809356eb893 Mon Sep 17 00:00:00 2001
-From: Ansuel Smith <ansuelsmth@gmail.com>
-Date: Sun, 27 Sep 2020 19:23:35 +0200
-Subject: [PATCH 1/2] ath10k: Try to get mac-address from dts
-
-Most of embedded device that have the ath10k wifi integrated store the
-mac-address in nvmem partitions. Try to fetch the mac-address using the
-standard 'of_get_mac_address' than in all the check also try to fetch the
-address using the nvmem api searching for a defined 'mac-address' cell.
-Mac-address defined in the dts have priority than any other address found.
-
-Tested-on: QCA9984 hw1.0 PCI 10.4
-
-Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
----
- drivers/net/wireless/ath/ath10k/core.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
-index 5f4e12196..9ed7b9883 100644
---- a/drivers/net/wireless/ath/ath10k/core.c
-+++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -8,6 +8,9 @@
- #include <linux/module.h>
- #include <linux/firmware.h>
- #include <linux/of.h>
-+#include <linux/of_net.h>
-+#include <linux/of_platform.h>
-+#include <linux/property.h>
- #include <linux/property.h>
- #include <linux/dmi.h>
- #include <linux/ctype.h>
-@@ -2961,8 +2963,14 @@ EXPORT_SYMBOL(ath10k_core_stop);
- static int ath10k_core_probe_fw(struct ath10k *ar)
- {
- struct bmi_target_info target_info;
-+ const char *mac;
- int ret = 0;
-
-+#ifdef CONFIG_OF
-+ /* register the platform to be found by the of api */
-+ of_platform_device_create(ar->dev->of_node, NULL, NULL);
-+#endif
-+
- ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_NORMAL);
- if (ret) {
- ath10k_err(ar, "could not power on hif bus (%d)\n", ret);
-@@ -3062,6 +3068,10 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
-
- device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
-
-+ mac = of_get_mac_address(ar->dev->of_node);
-+ if (!IS_ERR(mac))
-+ ether_addr_copy(ar->mac_addr, mac);
-+
- ret = ath10k_core_init_firmware_features(ar);
- if (ret) {
- ath10k_err(ar, "fatal problem with firmware features: %d\n",
---
-2.27.0
-