This commit implements delay-aware queue management. When enabled the
device will monitor time-in-queue of messages in the direct tx queue
and if it is lager than specified thresholds it updates ECN flag
(if message indicates it is ECN-capable) and/or drop the message. This
mechanism is applied to IPv6 messages on the first device that sends
the message into Thread mesh and also on intermediate routers that are
forwarding the message (e.g., as a "mesh lowpan fragment" frame). On an
intermediate router when forwarding the fragments of a message, if any
fragment is dropped by the queue management policy, all subsequent
fragments will also be dropped.
In particular, this commit contains the following:
- Adds `DecompressEcn()` and `MarkCompressedEcn()` in `Lowpan` class
to decompress or update the ECN field in a compressed IPHC header
(unit test `test_lowpan` is also updated to test the new methods).
- Adds `UpdateEcnOrDrop()` which implements the main queue management
logic. This method is used when preparing next direct tx message. It
decides whether to keep the message as is, update ECN on it or drop
it.
- Updates `EvictMessage()` to first apply the queue management rule
to see if any message can be dropped before using the eviction
logic based on message priority.
- Updates and reuses the `FragmentPriorityList` to track whether
queue management dropped any of the fragments of same message so
to also drop any subsequent ones.
- Updates `LogMessage()` to log when a message is dropped by
queue-management or when ECN is marked on a message.
This commit updates the MLE attach process so that in the first attach
cycle device tries a total of six MLE Parent Requests, the first two
to routers only followed by four to routers and REEDs. For example,
the six Parent Request message will be used before device can decide
to act the leader. An MTD in the next attach attempt (if cannot find a
parent in first attempt cycle), will go to the model of two Parent
Requests (first to routers, then to routers/REEDs).
This change impacts the time it takes for a device to start as leader
(due to increased number of Parent Request and wait time). This commit
updates different test scripts to address the change in the wait
time. It adds a new `config.LEADER_STARTUP_DELAY` constants which is
used for wait time for leader to start.
This commit contain smaller enhancements related to managing the
local OMR prefix:
- It adds a new class to encapsulate all the related data and
methods.
- We directly track whether or not the prefix is added to the local
Network Data (using a boolean)
- The methods are renamed to use the terms "add/remove" instead of
"publish/unpublish" since the Network data publisher is not used
for OMR prefix and it is directly added or removed.
This commit adds `Ip6::Headers` class which represents IPv6 header
along with related transport layer header (UDP, TCP or ICMP6). It
provides helper methods to parse all headers from an IPv6 message or
decompress and read them from a lowpan frame.
This helps simplify the code and allows us to remove multiple similar
methods in `MeshForwarder` performing decompression/parsing.
This commit adds a call to `Get<Mac::Mac>().UpdateCsl()` when there
is role change from `SetStateLeader()` or `SetStateRouter()`. This
ensures to disable CSL at `SubMac` and radio platform.
When the RCP is not stable, it causes the Thread stack to crash. To
better know the stability of the RCP, this commit adds an API to
return the radio spinel metrics.
After enabling the scheduling of delayed reception slots in #7677
they would be configured even when the device switched to MED mode.
This commit introduces some simplifications around the CSL states
and scheduling:
- Maintain the CSL timer stopped if not in CSL Receiver mode.
- Keep the CSL Period and Channel values in the MAC in order to use
them as an indication of CSL Receiver mode in the Sub-Mac.
- Simplify CSL states with `mIsCslSampling` variable.
- Use a simplified interaction between MAC and SubMac:
- `SubMac::UpdateCsl` for CSL config or stopping CSL sampling.
- `SubMac::CslSample` for start/maintain CSL sampling.
This commit adds a helper method `ParsePreference()` to parse a given
CLI argument string as a route preference comparing it against "high",
"med", or "low". This commit also moves the `PreferenceToString()`
method from `Cli::NetworkData` to `Cli::Interpreter` class.
This commit adds new mechanism in `RoutingManager` to allow user to
get or set the preference level to use when advertising Rout Info
Options (e.g., for discovered OMR prefixes) in RA messages sent on
infra netif. By default 'medium' preference is used. As an example,
user can choose to set the preference to 'low' when the device is
acting as a temporary BR (a mobile or battery-powered BR) to indicate
that other BRs should be preferred over this BR on the infra link.
This commit also adds CLI sub-commands for newly added APIs and
updates the documentation.
This commit updates how `RoutingManager` learns the RA header from
host daemons. It adds a new method to determine whether a received RA
message is prepared by the `RoutingManager` itself by checking the
options (PIO and RIO) from the RA message. When learning/updating the
host RA header, we check and skip over such self-prepared RA
messages.
This commit adds a new mechanism related to Network Data recovery on
leader after restart. We determine whether device is starting normally
as leader or restoring its role as leader after restart. In the
latter case, we do not allow the device to accept any new Network Data
registrations until it has successfully recovered the Network Data
(received MLE Data Response).
This change help address situation where Network Data entries
registered with leader before it syncs and restores the Network Data
can be removed and then take a while to be re-registered.
This commit updates `RoutingManager` to discover and publish default
route entries. It updates `DiscoveredPrefixTable` to track which
routers provide default route when processing the received RA
messages. A router can indicate that it provides default route in the
RA message header and it can also include an RIO for "::/0". When
processing the RA message, the preference and lifetime values in a
"::/0" RIO override the preference and lifetime values in the RA
header.
While `DiscoveredPrefixTable` will always track default routes, only
if we see an OMR prefix with default route flag in the Network Data,
we allow it to publish the discovered default route (as "::/0"
external route) in the Network Data. Finding such an OMR prefix
indicates that this prefix is routable beyond the infra link and
therefore default routes can be published and used within Thread
mesh.
Adding support for 1.3 style border router configurations which are
different from the 1.2 style border router configurations. The
'device capabilities' is used to differentiate between these 2 device
types to assign them their needed configuration parameters.
Also moving restartAgentService to the proper class.
This commit updates the data model used by `DiscoveredPrefixTable` in
`RoutingManager` to track the router which added each prefix entry.
This change ensures correct behavior when multiple routers on the
infra link advertise the same set of prefixes. The routers can
potentially advertise the same prefixes (in RIOs) with different
preference levels and/or stop/start advertising the prefixes
independently of each other. We publish the prefixes in Network Data
with highest seen preference. The published entries in Network Data
are also updated as the table entries changes.
This commit implements new mechanism in `Mle` related to key sequence
update when an MLE message is received with a larger key sequence
compared to the one being used by `KeyManager`. The MLE messages are
categorized into classes of Authoritative, or Peer depending on the
MLE command type and included TLVs. The class determines different
actions: Authoritative indicates sender is confident that its key seq
is in sync, so receiver will adopt the larger key seq. Peer class is
used when both sender and receiver think they are in sync. In this
case, if the MLE message is from a known neighbor, receiver will
adopt the larger key seq if the difference is one, otherwise it will
try to re-establish link with the neighbor using Authoritative
message exchanges (e.g. sending Link Request or Child Update
Request).
This commit moves the definitions of constants related to min/max
number of IPv6 addresses that can be included in an IP6 Addresses TLV
to `Ip6AddressesTlv` class. It also adds a public OT constant in
`ip6.h` related to this for MLR feature which is then used in `cli`
and `ncp` modules so to avoid the use of OT core internal constant
from CLI/NCP.
This commit updates `check-simulation-build-autotools` to use the
`LOG_OUTPUT` switch directly. This addresses an issue where
we could end up with multiple `OPENTHREAD_CONFIG_LOG_OUTPUT`
definitions in the `CPPFLAGS`.
This commit adds a new method in `Array` to remove all elements
in the array matching a given indicator.
This commit also updates `test_array.cpp` unit test to validate
the behavior of the newly added method.
This commit updates `NetworkData::Publisher` so that a call to
`PublishOnMeshPrefix()` or `PublishExternalRoute()` replaces a
previous request for the same prefix. In particular, if the new call
only changes the flags (e.g., preference level) and the prefix is
already added in the Network Data, the change to flags is immediately
reflected in the Network Data. This ensures that existing entries in
the Network Data are not abruptly removed. Note that a change in the
preference level can potentially later cause the entry to be removed
from the Network Data after determining there are other nodes that
are publishing the same prefix with the same or higher preference.
This commit also updates `test_netdata_publisher.py` to test the newly
added behavior.
This commit adds a new mechanism to allow border routers to request
router role upgrade.
A border router which provides IP connectivity (either adding an
external route prefix or an on-mesh prefix with default route flag)
and is acting as a REED is eligible to request a router role upgrade
by sending an "Address Solicit" request to leader with status reason
`BorderRouterRequest`. This reason is used when the number of active
routers in the Thread mesh is above the threshold, and only if the
number of existing eligible BRs (determined from the network data)
that are acting as router is less than two. This mechanism allows up
to two eligible border routers to request router role upgrade when
the number of routers is already above the threshold.
This commit also adds a new test-case `test_br_upgrade_router_role`
which validates the behavior of the new mechanism.
This commit introduces `DiscoveredPrefixTable` class as a nested type
in `RoutingManager`. This class maintains the on-link and route
prefixes which are discovered by processing the received Router
Advertisement messages. It manages the lifetime of the discovered
prefixes (running a timer and removing entries when they expire). It
also handles publishing and unpublishing the prefixes in the Thread
Network Data as they are added and removed.
When there is any change in the table (an entry is added, removed,
or modified), it signals this through a callback to `RoutingManager`
which can then take action and decide whether or not to re-evaluate
the routing policy. A `Tasklet` is used for signalling which ensures
that if there are multiple changes within the same flow of execution,
the callback is invoked after all the changes are processed.
The change in this commit simplifies the overall `RoutingManager`
code by abstracting away the prefix table management into its own
class and allows us to hide the internal data model used for storing
the discovered prefixes.
This commit simplifies `NetworkData::Publisher` to rely and use the
new `HandleServerDataUpdated()` behavior which uses a `Tasklet` to
start the registration with leader. With this, we can directly call
`HandleServerDataUpdated()` whenever there is a change and even
multiple times during processing from `Publisher` while ensuring that
all changes are still registered together.
This commit adds a `Taskelt` in `NetworkData::Notifier` to perform
`SynchronizeServerData()` and post this tasklet when there is a
change and `HandleServerDataUpdated()` is called. This ensures that
if there are multiple changes triggered within the same flow of
execution, they are all synchronized together and included in the
same message to register with leader.
This commit updates `Ip6::Prefix` comparison (overload of `<`
operator). If the two prefixes have same length N, then the bytes are
compared directly (as two big-endian N-bit numbers). If the two
prefix have different lengths, the shorter prefix is padded by `0`
bit up to the longer prefix length N before the bytes are compared
(as big-endian N-bit numbers). If all bytes are equal, the prefix
with shorter length is considered smaller.
This commit also updates `test_ip_address` unit test to validate
the new comparison behavior.
This commit adds `Remove/RemoveMatching()` in `Array` class which
remove a given or a matched element from the array. To remove the
element, it is replaced by the last element from array, so the order
of items in the array can change after call to these method.
This commit also updated unit test `test_array` to verify the behavior
of newly added methods.
This commit updates the calculation of the next stale time in
`ResetDiscoveredPrefixStaleTimer()` in (unlikely) cases where the
stale time of a discovered prefix or RA header happens to be in past
(compared to `GetNow()`). In such a case, we use `now` as the stale
time of the entry. This then ensures that the we can correctly
compare the stale time with `now.GetDistantFuture()`.
This commit is a cosmetic change and contains no change in the code
logic. It is a follow-up from #7689 which added `Mle::Tx/RxMessage`
types. This commit moves all `TxMessage` and `RxMessage` method
definitions close to one another (at the end of `mle.cpp`).