[mle] add kBetterParent in AttachMode enum (#7524)

This commit adds a new enumerator `kBetterParent` in `AttachMode`
enumeration. This new value is used by periodic parent search
feature only when searching for a better parent to help make
it explicit that attach process is started for this purpose.
This commit is contained in:
Abtin Keshavarzian
2022-03-25 15:17:01 -07:00
committed by GitHub
parent 018f54f71b
commit f95bddcef4
3 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -1937,6 +1937,7 @@ uint32_t Mle::Reattach(void)
switch (mAttachMode)
{
case kAnyPartition:
case kBetterParent:
if (!IsChild())
{
if (mAlternatePanId != Mac::kPanIdBroadcast)
@@ -3528,6 +3529,7 @@ void Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInfo &
switch (mAttachMode)
{
case kAnyPartition:
case kBetterParent:
VerifyOrExit(!isPartitionIdSame || isIdSequenceGreater);
break;
@@ -4257,7 +4259,7 @@ void Mle::HandleParentSearchTimer(void)
{
LogInfo("PeriodicParentSearch: Parent RSS less than %d, searching for new parents", kParentSearchRssThreadhold);
mParentSearchIsInBackoff = true;
Attach(kAnyPartition);
Attach(kBetterParent);
}
exit:
@@ -4560,6 +4562,7 @@ const char *Mle::AttachModeToString(AttachMode aMode)
"SamePartitionRetry", // (2) kSamePartitionRetry
"BetterPartition", // (3) kBetterPartition
"DowngradeToReed", // (4) kDowngradeToReed
"BetterParent", // (5) kBetterParent
};
static_assert(kAnyPartition == 0, "kAnyPartition value is incorrect");
@@ -4567,6 +4570,7 @@ const char *Mle::AttachModeToString(AttachMode aMode)
static_assert(kSamePartitionRetry == 2, "kSamePartitionRetry value is incorrect");
static_assert(kBetterPartition == 3, "kBetterPartition value is incorrect");
static_assert(kDowngradeToReed == 4, "kDowngradeToReed value is incorrect");
static_assert(kBetterParent == 5, "kBetterParent value is incorrect");
return kAttachModeStrings[aMode];
}
+1
View File
@@ -794,6 +794,7 @@ protected:
kSamePartitionRetry, ///< Attach to the same Thread partition (attempt 2 when losing connectivity).
kBetterPartition, ///< Attach to a better (i.e. higher weight/partition id) Thread partition.
kDowngradeToReed, ///< Attach to the same Thread partition during downgrade process.
kBetterParent, ///< Attach to a better parent.
};
/**
+1
View File
@@ -335,6 +335,7 @@ void MleRouter::HandleChildStart(AttachMode aMode)
break;
case kAnyPartition:
case kBetterParent:
// If attach was started due to receiving MLE Announce Messages, all rx-on-when-idle devices would
// start attach immediately when receiving such Announce message as in Thread 1.1 specification,
// Section 4.8.1,