Skip to content

Commit 1ff4e8f

Browse files
nbd168jmberg-intel
authored andcommitted
mac80211: notify the driver when a sta uses 4-address mode
This is needed for encapsulation offload of 4-address mode packets Signed-off-by: Felix Fietkau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent cc20ff2 commit 1ff4e8f

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

include/net/mac80211.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,6 +3842,8 @@ enum ieee80211_reconfig_type {
38423842
* This callback may sleep.
38433843
* @update_vif_config: Update virtual interface offload flags
38443844
* This callback may sleep.
3845+
* @sta_set_4addr: Called to notify the driver when a station starts/stops using
3846+
* 4-address mode
38453847
*/
38463848
struct ieee80211_ops {
38473849
void (*tx)(struct ieee80211_hw *hw,
@@ -4155,6 +4157,8 @@ struct ieee80211_ops {
41554157
struct ieee80211_sta *sta, u8 tids);
41564158
void (*update_vif_offload)(struct ieee80211_hw *hw,
41574159
struct ieee80211_vif *vif);
4160+
void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4161+
struct ieee80211_sta *sta, bool enabled);
41584162
};
41594163

41604164
/**

net/mac80211/cfg.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
16961696

16971697
rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
16981698
__ieee80211_check_fast_rx_iface(vlansdata);
1699+
drv_sta_set_4addr(local, sta->sdata, &sta->sta, true);
16991700
}
17001701

17011702
if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&

net/mac80211/driver-ops.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,4 +1399,18 @@ static inline void drv_update_vif_offload(struct ieee80211_local *local,
13991399
trace_drv_return_void(local);
14001400
}
14011401

1402+
static inline void drv_sta_set_4addr(struct ieee80211_local *local,
1403+
struct ieee80211_sub_if_data *sdata,
1404+
struct ieee80211_sta *sta, bool enabled)
1405+
{
1406+
sdata = get_bss_sdata(sdata);
1407+
if (!check_sdata_in_driver(sdata))
1408+
return;
1409+
1410+
trace_drv_sta_set_4addr(local, sdata, sta, enabled);
1411+
if (local->ops->sta_set_4addr)
1412+
local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled);
1413+
trace_drv_return_void(local);
1414+
}
1415+
14021416
#endif /* __MAC80211_DRIVER_OPS */

net/mac80211/mlme.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3548,6 +3548,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
35483548
goto out;
35493549
}
35503550

3551+
if (sdata->wdev.use_4addr)
3552+
drv_sta_set_4addr(local, sdata, &sta->sta, true);
3553+
35513554
mutex_unlock(&sdata->local->sta_mtx);
35523555

35533556
/*

net/mac80211/trace.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,6 +2740,33 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_update_vif_offload,
27402740
TP_ARGS(local, sdata)
27412741
);
27422742

2743+
TRACE_EVENT(drv_sta_set_4addr,
2744+
TP_PROTO(struct ieee80211_local *local,
2745+
struct ieee80211_sub_if_data *sdata,
2746+
struct ieee80211_sta *sta, bool enabled),
2747+
2748+
TP_ARGS(local, sdata, sta, enabled),
2749+
2750+
TP_STRUCT__entry(
2751+
LOCAL_ENTRY
2752+
VIF_ENTRY
2753+
STA_ENTRY
2754+
__field(bool, enabled)
2755+
),
2756+
2757+
TP_fast_assign(
2758+
LOCAL_ASSIGN;
2759+
VIF_ASSIGN;
2760+
STA_ASSIGN;
2761+
__entry->enabled = enabled;
2762+
),
2763+
2764+
TP_printk(
2765+
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " enabled:%d",
2766+
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->enabled
2767+
)
2768+
);
2769+
27432770
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
27442771

27452772
#undef TRACE_INCLUDE_PATH

0 commit comments

Comments
 (0)