A driver that uses ieee80211_sta_flow_prio() stores the result in its hardware flow entries. Once the SCS or MSCS rules of a station change, those entries are stale. Add a driver op that is called after each rule change, so that the driver can drop the entries of the station and query again when the flows are added back. Signed-off-by: Felix Fietkau --- include/net/mac80211.h | 13 +++++++++++++ net/mac80211/driver-ops.h | 19 +++++++++++++++++++ net/mac80211/scs.c | 4 ++++ net/mac80211/trace.h | 7 +++++++ 4 files changed, 43 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d0ac8493889a..010165043c4d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -5110,6 +5110,19 @@ struct ieee80211_ops { struct ieee80211_sta *sta, struct cfg80211_scs_desc * const *desc, struct cfg80211_scs_result *res, u8 n_desc); + /** + * @flow_offload_flush: + * Called after the SCS or MSCS rules of a station changed. Any + * priority that ieee80211_sta_flow_prio() returned for the station + * before is stale, so the driver must drop the hardware flow entries + * that use it. Optional, only needed by drivers that use + * ieee80211_sta_flow_prio(). + * + * Called with the wiphy mutex held. This callback may sleep. + */ + void (*flow_offload_flush)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta); int (*set_tid_config)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index f7684e8db025..903d8c728a23 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1578,6 +1578,25 @@ static inline int drv_sta_set_scs(struct ieee80211_local *local, return ret; } +static inline void drv_flow_offload_flush(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct sta_info *sta) +{ + might_sleep(); + lockdep_assert_wiphy(local->hw.wiphy); + + if (!local->ops->flow_offload_flush || !sta->uploaded) + return; + + sdata = get_bss_sdata(sdata); + if (!check_sdata_in_driver(sdata)) + return; + + trace_drv_flow_offload_flush(local, sdata, &sta->sta); + local->ops->flow_offload_flush(&local->hw, &sdata->vif, &sta->sta); + trace_drv_return_void(local); +} + static inline int drv_set_tid_config(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, struct ieee80211_sta *sta, diff --git a/net/mac80211/scs.c b/net/mac80211/scs.c index 519f85c897ff..ec7004265b4f 100644 --- a/net/mac80211/scs.c +++ b/net/mac80211/scs.c @@ -504,6 +504,8 @@ int ieee80211_set_scs(struct wiphy *wiphy, struct net_device *dev, if (old) kvfree_rcu(old, rcu_head); + drv_flow_offload_flush(sdata->local, sdata, sta); + return 0; free: @@ -564,6 +566,8 @@ int ieee80211_set_mscs(struct wiphy *wiphy, struct net_device *dev, kfree_rcu(old, rcu_head); } + drv_flow_offload_flush(sdata->local, sdata, sta); + return 0; } diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 1e6026306fb2..58cbb53ac0e4 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -1050,6 +1050,13 @@ TRACE_EVENT(drv_sta_set_scs, ) ); +DEFINE_EVENT(sta_event, drv_flow_offload_flush, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta), + TP_ARGS(local, sdata, sta) +); + DEFINE_EVENT(sta_event, drv_sta_statistics, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, -- git-series 0.9.1