blob: a75e19c1bf25453f089c0957e01a94f168d4836a [file] [log] [blame]
developer83ad30d2023-09-12 17:28:06 +08001From d0528e1e6fffdb620314bb7934cdab4971e02e77 Mon Sep 17 00:00:00 2001
developer77ffbda2022-12-16 04:36:08 +08002From: Evelyn Tsai <evelyn.tsai@mediatek.com>
3Date: Tue, 13 Dec 2022 09:04:49 +0800
developer83ad30d2023-09-12 17:28:06 +08004Subject: [PATCH 11/21] mac80211: mtk: fix build error on Linux Kernel 5.4
developer4a339e82022-12-12 19:00:30 +08005
6---
developer83ad30d2023-09-12 17:28:06 +08007 include/linux/ieee80211.h | 8 +++-----
8 net/mac80211/rc80211_minstrel_ht.c | 2 ++
9 net/mac80211/wpa.c | 4 ++--
10 net/wireless/nl80211.c | 12 +++++-------
11 4 files changed, 12 insertions(+), 14 deletions(-)
developer4a339e82022-12-12 19:00:30 +080012
13diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
developer83ad30d2023-09-12 17:28:06 +080014index 4b99809..7aaae32 100644
developer4a339e82022-12-12 19:00:30 +080015--- a/include/linux/ieee80211.h
16+++ b/include/linux/ieee80211.h
17@@ -310,11 +310,9 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
18 struct ieee80211_hdr {
19 __le16 frame_control;
20 __le16 duration_id;
21- struct_group(addrs,
22- u8 addr1[ETH_ALEN];
23- u8 addr2[ETH_ALEN];
24- u8 addr3[ETH_ALEN];
25- );
26+ u8 addr1[ETH_ALEN];
27+ u8 addr2[ETH_ALEN];
28+ u8 addr3[ETH_ALEN];
29 __le16 seq_ctrl;
30 u8 addr4[ETH_ALEN];
31 } __packed __aligned(2);
32diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
developer83ad30d2023-09-12 17:28:06 +080033index e916130..c09147f 100644
developer4a339e82022-12-12 19:00:30 +080034--- a/net/mac80211/rc80211_minstrel_ht.c
35+++ b/net/mac80211/rc80211_minstrel_ht.c
36@@ -10,7 +10,9 @@
37 #include <linux/random.h>
38 #include <linux/moduleparam.h>
39 #include <linux/ieee80211.h>
40+#if LINUX_VERSION_IS_GEQ(5,10,0)
41 #include <linux/minmax.h>
42+#endif
43 #include <net/mac80211.h>
44 #include "rate.h"
45 #include "sta_info.h"
46diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
47index 20f742b..93ec2f3 100644
48--- a/net/mac80211/wpa.c
49+++ b/net/mac80211/wpa.c
50@@ -351,7 +351,7 @@ static u8 ccmp_gcmp_aad(struct sk_buff *skb, u8 *aad)
51 * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
52 put_unaligned_be16(len_a, &aad[0]);
53 put_unaligned(mask_fc, (__le16 *)&aad[2]);
54- memcpy(&aad[4], &hdr->addrs, 3 * ETH_ALEN);
55+ memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
56
57 /* Mask Seq#, leave Frag# */
58 aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f;
59@@ -792,7 +792,7 @@ static void bip_aad(struct sk_buff *skb, u8 *aad)
60 IEEE80211_FCTL_MOREDATA);
61 put_unaligned(mask_fc, (__le16 *) &aad[0]);
62 /* A1 || A2 || A3 */
63- memcpy(aad + 2, &hdr->addrs, 3 * ETH_ALEN);
64+ memcpy(aad + 2, &hdr->addr1, 3 * ETH_ALEN);
65 }
66
67
68diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
developer83ad30d2023-09-12 17:28:06 +080069index ff8afa5..0ed3f51 100644
developer4a339e82022-12-12 19:00:30 +080070--- a/net/wireless/nl80211.c
71+++ b/net/wireless/nl80211.c
developer83ad30d2023-09-12 17:28:06 +080072@@ -461,11 +461,6 @@ nl80211_sta_wme_policy[NL80211_STA_WME_MAX + 1] = {
73 [NL80211_STA_WME_MAX_SP] = { .type = NLA_U8 },
74 };
75
76-static struct netlink_range_validation nl80211_punct_bitmap_range = {
77- .min = 0,
78- .max = 0xffff,
79-};
80-
81 static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
82 [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD },
83 [NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
84@@ -805,8 +800,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
85 [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN),
86 [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
87 [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT },
88- [NL80211_ATTR_PUNCT_BITMAP] =
89- NLA_POLICY_FULL_RANGE(NLA_U32, &nl80211_punct_bitmap_range),
90+ [NL80211_ATTR_PUNCT_BITMAP] = NLA_POLICY_RANGE(NLA_U8, 0, 0xffff),
91
92 [NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS] = { .type = NLA_U16 },
93 [NL80211_ATTR_HW_TIMESTAMP_ENABLED] = { .type = NLA_FLAG },
94@@ -16687,9 +16681,11 @@ static const struct genl_ops nl80211_ops[] = {
developer4a339e82022-12-12 19:00:30 +080095 /* can be retrieved by unprivileged users */
96 .internal_flags = IFLAGS(NL80211_FLAG_NEED_WIPHY),
97 },
98+#if LINUX_VERSION_IS_GEQ(5,10,0)
99 };
100
101 static const struct genl_small_ops nl80211_small_ops[] = {
102+#endif
103 {
104 .cmd = NL80211_CMD_SET_WIPHY,
105 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
developer83ad30d2023-09-12 17:28:06 +0800106@@ -17534,8 +17530,10 @@ static struct genl_family nl80211_fam __genl_ro_after_init = {
developer4a339e82022-12-12 19:00:30 +0800107 .module = THIS_MODULE,
108 .ops = nl80211_ops,
109 .n_ops = ARRAY_SIZE(nl80211_ops),
110+#if LINUX_VERSION_IS_GEQ(5,10,0)
111 .small_ops = nl80211_small_ops,
112 .n_small_ops = ARRAY_SIZE(nl80211_small_ops),
113+#endif
114 #if LINUX_VERSION_IS_GEQ(6,1,0)
115 .resv_start_op = NL80211_CMD_REMOVE_LINK_STA + 1,
116 #endif
117--
developerebaa5512023-04-19 18:23:21 +08001182.39.2
developer4a339e82022-12-12 19:00:30 +0800119