mac80211: Update to version 5.9.12-1
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / subsys / 326-mac80211-notify-the-driver-when-a-sta-uses-4-address.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 21 Aug 2020 05:51:58 +0200
3 Subject: [PATCH] mac80211: notify the driver when a sta uses 4-address
4 mode
5
6 This is needed for encapsulation offload of 4-address mode packets
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/include/net/mac80211.h
12 +++ b/include/net/mac80211.h
13 @@ -3843,6 +3843,8 @@ enum ieee80211_reconfig_type {
14 * This callback may sleep.
15 * @update_vif_config: Update virtual interface offload flags
16 * This callback may sleep.
17 + * @sta_set_4addr: Called to notify the driver when a station starts/stops using
18 + * 4-address mode
19 */
20 struct ieee80211_ops {
21 void (*tx)(struct ieee80211_hw *hw,
22 @@ -4156,6 +4158,8 @@ struct ieee80211_ops {
23 struct ieee80211_sta *sta, u8 tids);
24 void (*update_vif_offload)(struct ieee80211_hw *hw,
25 struct ieee80211_vif *vif);
26 + void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
27 + struct ieee80211_sta *sta, bool enabled);
28 };
29
30 /**
31 --- a/net/mac80211/cfg.c
32 +++ b/net/mac80211/cfg.c
33 @@ -1696,6 +1696,7 @@ static int ieee80211_change_station(stru
34
35 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
36 __ieee80211_check_fast_rx_iface(vlansdata);
37 + drv_sta_set_4addr(local, sta->sdata, &sta->sta, true);
38 }
39
40 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
41 --- a/net/mac80211/driver-ops.h
42 +++ b/net/mac80211/driver-ops.h
43 @@ -1399,4 +1399,18 @@ static inline void drv_update_vif_offloa
44 trace_drv_return_void(local);
45 }
46
47 +static inline void drv_sta_set_4addr(struct ieee80211_local *local,
48 + struct ieee80211_sub_if_data *sdata,
49 + struct ieee80211_sta *sta, bool enabled)
50 +{
51 + sdata = get_bss_sdata(sdata);
52 + if (!check_sdata_in_driver(sdata))
53 + return;
54 +
55 + trace_drv_sta_set_4addr(local, sdata, sta, enabled);
56 + if (local->ops->sta_set_4addr)
57 + local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled);
58 + trace_drv_return_void(local);
59 +}
60 +
61 #endif /* __MAC80211_DRIVER_OPS */
62 --- a/net/mac80211/mlme.c
63 +++ b/net/mac80211/mlme.c
64 @@ -3523,6 +3523,9 @@ static bool ieee80211_assoc_success(stru
65 goto out;
66 }
67
68 + if (sdata->wdev.use_4addr)
69 + drv_sta_set_4addr(local, sdata, &sta->sta, true);
70 +
71 mutex_unlock(&sdata->local->sta_mtx);
72
73 /*
74 --- a/net/mac80211/trace.h
75 +++ b/net/mac80211/trace.h
76 @@ -2740,6 +2740,33 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_u
77 TP_ARGS(local, sdata)
78 );
79
80 +TRACE_EVENT(drv_sta_set_4addr,
81 + TP_PROTO(struct ieee80211_local *local,
82 + struct ieee80211_sub_if_data *sdata,
83 + struct ieee80211_sta *sta, bool enabled),
84 +
85 + TP_ARGS(local, sdata, sta, enabled),
86 +
87 + TP_STRUCT__entry(
88 + LOCAL_ENTRY
89 + VIF_ENTRY
90 + STA_ENTRY
91 + __field(bool, enabled)
92 + ),
93 +
94 + TP_fast_assign(
95 + LOCAL_ASSIGN;
96 + VIF_ASSIGN;
97 + STA_ASSIGN;
98 + __entry->enabled = enabled;
99 + ),
100 +
101 + TP_printk(
102 + LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " enabled:%d",
103 + LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->enabled
104 + )
105 +);
106 +
107 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
108
109 #undef TRACE_INCLUDE_PATH