blob: 5e2ff4de042749fc2cf4b8e81ca3f47c2751a424 [file] [log] [blame]
developer8eb72a32023-03-30 08:32:07 +08001From 872a283c4ddf853e6f3c280925eae1e2b0c015b8 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
developer8eb72a32023-03-30 08:32:07 +08004Subject: [PATCH 13/15] mac80211: mtk: fix build error on Linux Kernel 5.4
developer4a339e82022-12-12 19:00:30 +08005
6---
7 include/linux/ieee80211.h | 8 +++-----
8 net/mac80211/rc80211_minstrel_ht.c | 2 ++
9 net/mac80211/wpa.c | 4 ++--
10 net/wireless/nl80211.c | 4 ++++
11 4 files changed, 11 insertions(+), 7 deletions(-)
12
13diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
14index 7969093..6f70394 100644
15--- 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
33index 33001ec..277fec9 100644
34--- 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
developeraab83332023-03-07 18:17:19 +080069index 202f802..1035f74 100644
developer4a339e82022-12-12 19:00:30 +080070--- a/net/wireless/nl80211.c
71+++ b/net/wireless/nl80211.c
developeraab83332023-03-07 18:17:19 +080072@@ -16441,9 +16441,11 @@ static const struct genl_ops nl80211_ops[] = {
developer4a339e82022-12-12 19:00:30 +080073 /* can be retrieved by unprivileged users */
74 .internal_flags = IFLAGS(NL80211_FLAG_NEED_WIPHY),
75 },
76+#if LINUX_VERSION_IS_GEQ(5,10,0)
77 };
78
79 static const struct genl_small_ops nl80211_small_ops[] = {
80+#endif
81 {
82 .cmd = NL80211_CMD_SET_WIPHY,
83 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
developeraab83332023-03-07 18:17:19 +080084@@ -17280,8 +17282,10 @@ static struct genl_family nl80211_fam __genl_ro_after_init = {
developer4a339e82022-12-12 19:00:30 +080085 .module = THIS_MODULE,
86 .ops = nl80211_ops,
87 .n_ops = ARRAY_SIZE(nl80211_ops),
88+#if LINUX_VERSION_IS_GEQ(5,10,0)
89 .small_ops = nl80211_small_ops,
90 .n_small_ops = ARRAY_SIZE(nl80211_small_ops),
91+#endif
92 #if LINUX_VERSION_IS_GEQ(6,1,0)
93 .resv_start_op = NL80211_CMD_REMOVE_LINK_STA + 1,
94 #endif
95--
developeraab83332023-03-07 18:17:19 +0800962.18.0
developer4a339e82022-12-12 19:00:30 +080097