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
6 This is needed for encapsulation offload of 4-address mode packets
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 --- a/include/net/mac80211.h
12 +++ b/include/net/mac80211.h
13 @@ -3840,6 +3840,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
20 struct ieee80211_ops {
21 void (*tx)(struct ieee80211_hw *hw,
22 @@ -4153,6 +4155,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);
31 --- a/net/mac80211/cfg.c
32 +++ b/net/mac80211/cfg.c
33 @@ -1693,6 +1693,7 @@ static int ieee80211_change_station(stru
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);
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 @@ -1400,4 +1400,18 @@ static inline void drv_update_vif_offloa
44 trace_drv_return_void(local);
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)
51 + sdata = get_bss_sdata(sdata);
52 + if (!check_sdata_in_driver(sdata))
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);
61 #endif /* __MAC80211_DRIVER_OPS */
62 --- a/net/mac80211/mlme.c
63 +++ b/net/mac80211/mlme.c
64 @@ -3518,6 +3518,9 @@ static bool ieee80211_assoc_success(stru
68 + if (sdata->wdev.use_4addr)
69 + drv_sta_set_4addr(local, sdata, &sta->sta, true);
71 mutex_unlock(&sdata->local->sta_mtx);
74 --- a/net/mac80211/trace.h
75 +++ b/net/mac80211/trace.h
76 @@ -2739,6 +2739,33 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_u
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),
85 + TP_ARGS(local, sdata, sta, enabled),
91 + __field(bool, enabled)
98 + __entry->enabled = enabled;
102 + LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " enabled:%d",
103 + LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->enabled
107 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
109 #undef TRACE_INCLUDE_PATH