From 67f159c5e32d67d5abfa24470f15739a4cf82fd7 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 18 Jun 2019 11:48:44 -0700 Subject: [PATCH] [data-poll-manager] remove code handling NO_BUFS error (#3918) This commit remove the logic in `DataPollManager` related to handling the `NO_BUFS` error case when sending a data poll. This logic is no longer needed since the data poll tx logic is now handled by `Mac` layer directly and there is no need to allocate/use a `Message` instance for data poll (which could lead to `NO_BUFs` error situation). --- src/core/thread/data_poll_manager.cpp | 25 ++----------------------- src/core/thread/data_poll_manager.hpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/core/thread/data_poll_manager.cpp b/src/core/thread/data_poll_manager.cpp index f407766a4..4b093b80e 100644 --- a/src/core/thread/data_poll_manager.cpp +++ b/src/core/thread/data_poll_manager.cpp @@ -56,7 +56,6 @@ DataPollManager::DataPollManager(Instance &aInstance) , mEnabled(false) , mAttachMode(false) , mRetxMode(false) - , mNoBufferRetxMode(false) , mPollTimeoutCounter(0) , mPollTxFailureCounter(0) , mRemainingFastPolls(0) @@ -82,7 +81,6 @@ void DataPollManager::StopPolling(void) mTimer.Stop(); mAttachMode = false; mRetxMode = false; - mNoBufferRetxMode = false; mPollTimeoutCounter = 0; mPollTxFailureCounter = 0; mRemainingFastPolls = 0; @@ -111,17 +109,7 @@ exit: { case OT_ERROR_NONE: otLogDebgMac("Sending data poll"); - - if (mNoBufferRetxMode == true) - { - mNoBufferRetxMode = false; - ScheduleNextPoll(kRecalculatePollPeriod); - } - else - { - ScheduleNextPoll(kUsePreviousPollPeriod); - } - + ScheduleNextPoll(kUsePreviousPollPeriod); break; case OT_ERROR_INVALID_STATE: @@ -134,9 +122,8 @@ exit: ScheduleNextPoll(kUsePreviousPollPeriod); break; - case OT_ERROR_NO_BUFS: default: - mNoBufferRetxMode = true; + otLogWarnMac("Unexpected error %s requesting data poll", otThreadErrorToString(error)); ScheduleNextPoll(kRecalculatePollPeriod); break; } @@ -440,14 +427,6 @@ uint32_t DataPollManager::CalculatePollPeriod(void) const } } - if (mNoBufferRetxMode == true) - { - if ((period == 0) || (period > kNoBufferRetxPollPeriod)) - { - period = kNoBufferRetxPollPeriod; - } - } - if (mRemainingFastPolls != 0) { if ((period == 0) || (period > kFastPollPeriod)) diff --git a/src/core/thread/data_poll_manager.hpp b/src/core/thread/data_poll_manager.hpp index 4d7745953..6a0646a60 100644 --- a/src/core/thread/data_poll_manager.hpp +++ b/src/core/thread/data_poll_manager.hpp @@ -219,13 +219,12 @@ public: private: enum // Poll period under different conditions (in milliseconds). { - kAttachDataPollPeriod = OPENTHREAD_CONFIG_ATTACH_DATA_POLL_PERIOD, ///< Poll period during attach. - kRetxPollPeriod = OPENTHREAD_CONFIG_RETX_POLL_PERIOD, ///< Poll retx period due to tx failure. - kNoBufferRetxPollPeriod = 200, ///< Poll retx due to no buffer space. - kFastPollPeriod = 188, ///< Period used for fast polls. - kMinPollPeriod = OPENTHREAD_CONFIG_MINIMUM_POLL_PERIOD, ///< Minimum allowed poll period. - kMaxExternalPeriod = ((1 << 26) - 1), ///< Maximum allowed user-specified period. - ///< i.e. (0x3FFFFF)ms, about 18.64 hours. + kAttachDataPollPeriod = OPENTHREAD_CONFIG_ATTACH_DATA_POLL_PERIOD, ///< Poll period during attach. + kRetxPollPeriod = OPENTHREAD_CONFIG_RETX_POLL_PERIOD, ///< Poll retx period due to tx failure. + kFastPollPeriod = 188, ///< Period used for fast polls. + kMinPollPeriod = OPENTHREAD_CONFIG_MINIMUM_POLL_PERIOD, ///< Minimum allowed poll period. + kMaxExternalPeriod = ((1 << 26) - 1), ///< Maximum allowed user-specified period. + ///< i.e. (0x3FFFFF)ms, about 18.64 hours. }; enum @@ -256,7 +255,6 @@ private: bool mEnabled : 1; //< Indicates whether data polling is enabled/started. bool mAttachMode : 1; //< Indicates whether in attach mode (to use attach poll period). bool mRetxMode : 1; //< Indicates whether last poll tx failed at mac/radio layer (poll retx mode). - bool mNoBufferRetxMode : 1; //< Indicates whether last poll tx failed due to insufficient buffer. uint8_t mPollTimeoutCounter : 4; //< Poll timeouts counter (0 to `kQuickPollsAfterTimout`). uint8_t mPollTxFailureCounter : 4; //< Poll tx failure counter (0 to `kMaxPollRetxAttempts`). uint8_t mRemainingFastPolls : 4; //< Number of remaining fast polls when in transient fast polling mode.