mirror of
https://github.com/espressif/openthread.git
synced 2026-09-01 06:49:54 +00:00
[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:
@@ -1937,6 +1937,7 @@ uint32_t Mle::Reattach(void)
|
|||||||
switch (mAttachMode)
|
switch (mAttachMode)
|
||||||
{
|
{
|
||||||
case kAnyPartition:
|
case kAnyPartition:
|
||||||
|
case kBetterParent:
|
||||||
if (!IsChild())
|
if (!IsChild())
|
||||||
{
|
{
|
||||||
if (mAlternatePanId != Mac::kPanIdBroadcast)
|
if (mAlternatePanId != Mac::kPanIdBroadcast)
|
||||||
@@ -3528,6 +3529,7 @@ void Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInfo &
|
|||||||
switch (mAttachMode)
|
switch (mAttachMode)
|
||||||
{
|
{
|
||||||
case kAnyPartition:
|
case kAnyPartition:
|
||||||
|
case kBetterParent:
|
||||||
VerifyOrExit(!isPartitionIdSame || isIdSequenceGreater);
|
VerifyOrExit(!isPartitionIdSame || isIdSequenceGreater);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -4257,7 +4259,7 @@ void Mle::HandleParentSearchTimer(void)
|
|||||||
{
|
{
|
||||||
LogInfo("PeriodicParentSearch: Parent RSS less than %d, searching for new parents", kParentSearchRssThreadhold);
|
LogInfo("PeriodicParentSearch: Parent RSS less than %d, searching for new parents", kParentSearchRssThreadhold);
|
||||||
mParentSearchIsInBackoff = true;
|
mParentSearchIsInBackoff = true;
|
||||||
Attach(kAnyPartition);
|
Attach(kBetterParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@@ -4560,6 +4562,7 @@ const char *Mle::AttachModeToString(AttachMode aMode)
|
|||||||
"SamePartitionRetry", // (2) kSamePartitionRetry
|
"SamePartitionRetry", // (2) kSamePartitionRetry
|
||||||
"BetterPartition", // (3) kBetterPartition
|
"BetterPartition", // (3) kBetterPartition
|
||||||
"DowngradeToReed", // (4) kDowngradeToReed
|
"DowngradeToReed", // (4) kDowngradeToReed
|
||||||
|
"BetterParent", // (5) kBetterParent
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(kAnyPartition == 0, "kAnyPartition value is incorrect");
|
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(kSamePartitionRetry == 2, "kSamePartitionRetry value is incorrect");
|
||||||
static_assert(kBetterPartition == 3, "kBetterPartition value is incorrect");
|
static_assert(kBetterPartition == 3, "kBetterPartition value is incorrect");
|
||||||
static_assert(kDowngradeToReed == 4, "kDowngradeToReed value is incorrect");
|
static_assert(kDowngradeToReed == 4, "kDowngradeToReed value is incorrect");
|
||||||
|
static_assert(kBetterParent == 5, "kBetterParent value is incorrect");
|
||||||
|
|
||||||
return kAttachModeStrings[aMode];
|
return kAttachModeStrings[aMode];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -794,6 +794,7 @@ protected:
|
|||||||
kSamePartitionRetry, ///< Attach to the same Thread partition (attempt 2 when losing connectivity).
|
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.
|
kBetterPartition, ///< Attach to a better (i.e. higher weight/partition id) Thread partition.
|
||||||
kDowngradeToReed, ///< Attach to the same Thread partition during downgrade process.
|
kDowngradeToReed, ///< Attach to the same Thread partition during downgrade process.
|
||||||
|
kBetterParent, ///< Attach to a better parent.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -335,6 +335,7 @@ void MleRouter::HandleChildStart(AttachMode aMode)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kAnyPartition:
|
case kAnyPartition:
|
||||||
|
case kBetterParent:
|
||||||
// If attach was started due to receiving MLE Announce Messages, all rx-on-when-idle devices would
|
// 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,
|
// start attach immediately when receiving such Announce message as in Thread 1.1 specification,
|
||||||
// Section 4.8.1,
|
// Section 4.8.1,
|
||||||
|
|||||||
Reference in New Issue
Block a user