From: Johannes Berg When the flush_sta operation doesn't exist, the code falls back to flushing the interface queues. Move the fallback into the drv_flush_sta() wrapper to have it available to future callers too. While at it, pass the right sdata. Signed-off-by: Johannes Berg --- net/mac80211/driver-ops.c | 25 ++++++++++++++++++++++++- net/mac80211/driver-ops.h | 25 ++++--------------------- net/mac80211/sta_info.c | 7 +------ 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c index 1f3e0765a8ab..f3d0b39720e9 100644 --- a/net/mac80211/driver-ops.c +++ b/net/mac80211/driver-ops.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2015 Intel Deutschland GmbH - * Copyright (C) 2022-2025 Intel Corporation + * Copyright (C) 2022-2026 Intel Corporation */ #include #include "ieee80211_i.h" @@ -709,3 +709,26 @@ int drv_link_sta_statistics(struct ieee80211_local *local, return 0; } + +void drv_flush_sta(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct sta_info *sta) +{ + might_sleep(); + lockdep_assert_wiphy(local->hw.wiphy); + + sdata = get_bss_sdata(sdata); + + if (sdata && !check_sdata_in_driver(sdata)) + return; + + if (!sta->uploaded) + return; + + trace_drv_flush_sta(local, sdata, &sta->sta); + if (local->ops->flush_sta) + local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta); + else + ieee80211_flush_queues(local, sdata, false); + trace_drv_return_void(local); +} diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 78230779e7fb..0edaaab7ac52 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -2,7 +2,7 @@ /* * Portions of this file * Copyright(c) 2016 Intel Deutschland GmbH -* Copyright (C) 2018-2019, 2021-2025 Intel Corporation +* Copyright (C) 2018-2019, 2021-2026 Intel Corporation */ #ifndef __MAC80211_DRIVER_OPS @@ -710,26 +710,9 @@ static inline void drv_flush(struct ieee80211_local *local, trace_drv_return_void(local); } -static inline void drv_flush_sta(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct sta_info *sta) -{ - might_sleep(); - lockdep_assert_wiphy(local->hw.wiphy); - - sdata = get_bss_sdata(sdata); - - if (sdata && !check_sdata_in_driver(sdata)) - return; - - if (!sta->uploaded) - return; - - trace_drv_flush_sta(local, sdata, &sta->sta); - if (local->ops->flush_sta) - local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta); - trace_drv_return_void(local); -} +void drv_flush_sta(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct sta_info *sta); static inline void drv_channel_switch(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 23166fc39729..5e46dcd2ae82 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1489,12 +1489,7 @@ static int _sta_info_move_state(struct sta_info *sta, */ if (local->ops->set_key) { synchronize_net(); - if (local->ops->flush_sta) - drv_flush_sta(local, sta->sdata, sta); - else - ieee80211_flush_queues(local, - sta->sdata, - false); + drv_flush_sta(local, sta->sdata, sta); } ieee80211_clear_fast_xmit(sta); -- 2.56.0