From 70df57ab9061aabbbd7323327bacae15f288d7fb Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Mon, 20 Nov 2023 21:33:13 +0100 Subject: [PATCH] wifi: Add a method to reset the backoff of all ACs --- src/wifi/model/channel-access-manager.cc | 12 ++++++++++++ src/wifi/model/channel-access-manager.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/wifi/model/channel-access-manager.cc b/src/wifi/model/channel-access-manager.cc index 7bb089601..1f3daae23 100644 --- a/src/wifi/model/channel-access-manager.cc +++ b/src/wifi/model/channel-access-manager.cc @@ -995,6 +995,18 @@ ChannelAccessManager::ResetBackoff(Ptr txop) txop->GetLink(m_linkId).access = Txop::NOT_REQUESTED; } +void +ChannelAccessManager::ResetAllBackoffs() +{ + NS_LOG_FUNCTION(this); + + for (const auto& txop : m_txops) + { + ResetBackoff(txop); + } + m_accessTimeout.Cancel(); +} + void ChannelAccessManager::NotifySleepNow() { diff --git a/src/wifi/model/channel-access-manager.h b/src/wifi/model/channel-access-manager.h index ba10e3dd8..b199bcc9f 100644 --- a/src/wifi/model/channel-access-manager.h +++ b/src/wifi/model/channel-access-manager.h @@ -329,6 +329,11 @@ class ChannelAccessManager : public Object */ void ResetBackoff(Ptr txop); + /** + * Reset the backoff for all the DCF/EDCAF. Additionally, cancel the access timeout event. + */ + void ResetAllBackoffs(); + /** * Notify that the given PHY is about to switch to the given operating channel, which is * used by the given link. This notification is sent by the EMLSR Manager when a PHY object