Skip to content

Commit 28455d8

Browse files
committed
[thread-direct] skip Thread Direct flags for rcp builds in script/test
Thread Direct requires FTD/MTD — KeyManager is not linked in radio-only builds. Guard the OT_THREAD_DIRECT_WAKE_* flags in build_simulation so they are not passed when OT_NODE_TYPE is rcp*.
1 parent 252918b commit 28455d8

86 files changed

Lines changed: 4383 additions & 3305 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/ot_api_doc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@
182182
*
183183
* @{
184184
*
185-
* @defgroup api-provisional-link Link
186-
* @defgroup api-provisional-p2p Peer-to-Peer
187-
*
188185
* @}
189186
*
190187
* @}

doc/ot_config_doc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
* @defgroup config-nat64 NAT64
7474
* @defgroup config-netdata-publisher Network Data Publisher
7575
* @defgroup config-network-diagnostic Network Diagnostics
76-
* @defgroup config-p2p Peer-to-Peer
7776
* @defgroup config-parent-search Parent Search
7877
* @defgroup config-ping-sender Ping Sender
7978
* @defgroup config-platform Platform Specific Services

etc/cmake/options.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ ot_option(OT_NETDIAG_CLIENT OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE "Network
242242
ot_option(OT_NETDIAG_VENDOR_INFO OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE "Allow setting vendor info at runtime")
243243
ot_option(OT_OPERATIONAL_DATASET_AUTO_INIT OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT "operational dataset auto init")
244244
ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS")
245-
ot_option(OT_P2P OPENTHREAD_CONFIG_P2P_ENABLE "peer to peer")
245+
246246
ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI})
247247
ot_option(OT_PLATFORM_BOOTLOADER_MODE OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE "platform bootloader mode")
248248
ot_option(OT_PLATFORM_DNSSD OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE "platform dnssd")
@@ -267,13 +267,14 @@ ot_option(OT_TCP OPENTHREAD_CONFIG_TCP_ENABLE "TCP")
267267
ot_option(OT_TIME_SYNC OPENTHREAD_CONFIG_TIME_SYNC_ENABLE "time synchronization service")
268268
ot_option(OT_TREL OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE "TREL radio link for Thread over Infrastructure feature")
269269
ot_option(OT_TREL_MANAGE_DNSSD OPENTHREAD_CONFIG_TREL_MANAGE_DNSSD_ENABLE "TREL to manage DNSSD and peer discovery")
270+
ot_option(OT_THREAD_DIRECT_WAKE_INITIATOR OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_INITIATOR_ENABLE "Thread Direct wake initiator")
271+
ot_option(OT_THREAD_DIRECT_WAKE_LISTENER OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE "Thread Direct wake listener")
270272
ot_option(OT_TX_BEACON_PAYLOAD OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE "tx beacon payload")
271273
ot_option(OT_TX_QUEUE_STATS OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE "tx queue statistics")
272274
ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward")
273275
ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime")
274276
ot_option(OT_VERHOEFF_CHECKSUM OPENTHREAD_CONFIG_VERHOEFF_CHECKSUM_ENABLE "verhoeff checksum")
275-
ot_option(OT_WAKEUP_COORDINATOR OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE "wake-up coordinator")
276-
ot_option(OT_WAKEUP_END_DEVICE OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE "wake-up end device")
277+
277278
ot_option(OT_SPINEL_CP_RESET_FAIL_CALLBACK_ENABLE OPENTHREAD_SPINEL_CONFIG_COPROCESSOR_RESET_FAILURE_CALLBACK_ENABLE "CP reset failure callback")
278279

279280
option(OT_DOC "build OpenThread documentation")

examples/platforms/simulation/radio.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,15 @@ void otPlatRadioSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCoun
11611161
sRadioContext.mMacFrameCounter = aMacFrameCounter;
11621162
}
11631163

1164+
#if OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_INITIATOR_ENABLE || OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE
1165+
void otPlatRadioSetWakeKey(otInstance *aInstance, uint8_t aKeyIndex, const otMacKeyMaterial *aWakeKey)
1166+
{
1167+
OT_UNUSED_VARIABLE(aInstance);
1168+
OT_UNUSED_VARIABLE(aKeyIndex);
1169+
OT_UNUSED_VARIABLE(aWakeKey);
1170+
}
1171+
#endif
1172+
11641173
otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower)
11651174
{
11661175
OT_UNUSED_VARIABLE(aInstance);

examples/platforms/utils/mac_frame.cpp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,7 @@ otError otMacFrameProcessTransmitSecurity(otRadioFrame *aFrame, otRadioContext *
318318
uint32_t frameCounter;
319319
bool processKeyId;
320320

321-
processKeyId =
322-
#if OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE
323-
otMacFrameIsKeyIdMode2(aFrame) ||
324-
#endif
325-
otMacFrameIsKeyIdMode1(aFrame);
321+
processKeyId = otMacFrameIsKeyIdMode1(aFrame);
326322

327323
VerifyOrExit(otMacFrameIsSecurityEnabled(aFrame) && processKeyId && !aFrame->mInfo.mTxInfo.mIsSecurityProcessed);
328324

@@ -455,3 +451,23 @@ bool otMacFrameSrcAddrMatchCslReceiverPeer(const otRadioFrame *aFrame, const otR
455451
exit:
456452
return matches;
457453
}
454+
455+
#if OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_INITIATOR_ENABLE
456+
457+
bool otMacFrameIsTdWakeCommand(otRadioFrame *aFrame)
458+
{
459+
uint8_t keyId;
460+
461+
if (!otMacFrameIsCommand(aFrame) || otMacFrameIsAckRequested(aFrame) || !otMacFrameIsSecurityEnabled(aFrame) ||
462+
!otMacFrameIsKeyIdMode1(aFrame))
463+
{
464+
return false;
465+
}
466+
467+
keyId = otMacFrameGetKeyId(aFrame);
468+
469+
return keyId == OT_MAC_FRAME_WAKE_KEY_INDEX ||
470+
(keyId >= OT_MAC_FRAME_GUEST_WAKE_KEY_INDEX_MIN && keyId <= OT_MAC_FRAME_GUEST_WAKE_KEY_INDEX_MAX);
471+
}
472+
473+
#endif // OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_INITIATOR_ENABLE

examples/platforms/utils/mac_frame.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,21 @@ otError otMacFrameProcessTransmitSecurity(otRadioFrame *aFrame, otRadioContext *
401401
*/
402402
bool otMacFrameSrcAddrMatchCslReceiverPeer(const otRadioFrame *aFrame, const otRadioContext *aRadioContext);
403403

404+
#if OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_INITIATOR_ENABLE
405+
/**
406+
* Tell if @p aFrame is a Thread Direct Wake Command frame.
407+
*
408+
* A TD Wake Command is a MAC Command with no ACK request and wake key index 129 or 130-192
409+
* in the Auxiliary Security Header (stamped by the stack before transmit).
410+
*
411+
* @param[in] aFrame A pointer to the frame.
412+
*
413+
* @retval true The frame is a TD Wake Command.
414+
* @retval false The frame is not a TD Wake Command.
415+
*/
416+
bool otMacFrameIsTdWakeCommand(otRadioFrame *aFrame);
417+
#endif
418+
404419
#ifdef __cplusplus
405420
} // extern "C"
406421
#endif

include/openthread/BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,11 @@ source_set("openthread") {
113113
"platform/settings.h",
114114
"platform/spi-slave.h",
115115
"platform/tcp.h",
116+
"platform/thread_direct.h",
116117
"platform/time.h",
117118
"platform/toolchain.h",
118119
"platform/trel.h",
119120
"platform/udp.h",
120-
"provisional/link.h",
121-
"provisional/p2p.h",
122121
"radio_stats.h",
123122
"random_crypto.h",
124123
"random_noncrypto.h",
@@ -134,6 +133,7 @@ source_set("openthread") {
134133
"tcp.h",
135134
"tcp_ext.h",
136135
"thread.h",
136+
"thread_direct.h",
137137
"thread_ftd.h",
138138
"trel.h",
139139
"udp.h",

include/openthread/dataset.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ typedef struct otOperationalDatasetComponents
207207
bool mIsPskcPresent; ///< TRUE if PSKc is present, FALSE otherwise.
208208
bool mIsSecurityPolicyPresent; ///< TRUE if Security Policy is present, FALSE otherwise.
209209
bool mIsChannelMaskPresent; ///< TRUE if Channel Mask is present, FALSE otherwise.
210-
bool mIsWakeupChannelPresent; ///< TRUE if Wake-up Channel is present, FALSE otherwise.
210+
bool mIsWakeupChannelPresent; ///< TRUE if Wake Channel is present, FALSE otherwise.
211211
} otOperationalDatasetComponents;
212212

213213
/**
@@ -227,20 +227,20 @@ typedef struct otTimestamp
227227
*/
228228
typedef struct otOperationalDataset
229229
{
230-
otTimestamp mActiveTimestamp; ///< Active Timestamp
231-
otTimestamp mPendingTimestamp; ///< Pending Timestamp
232-
otNetworkKey mNetworkKey; ///< Network Key
233-
otNetworkName mNetworkName; ///< Network Name
234-
otExtendedPanId mExtendedPanId; ///< Extended PAN ID
235-
otMeshLocalPrefix mMeshLocalPrefix; ///< Mesh Local Prefix
236-
uint32_t mDelay; ///< Delay Timer
237-
otPanId mPanId; ///< PAN ID
238-
uint16_t mChannel; ///< Channel
239-
uint16_t mWakeupChannel; ///< Wake-up Channel
240-
otPskc mPskc; ///< PSKc
241-
otSecurityPolicy mSecurityPolicy; ///< Security Policy
242-
otChannelMask mChannelMask; ///< Channel Mask
243-
otOperationalDatasetComponents mComponents; ///< Specifies which components are set in the Dataset.
230+
otTimestamp mActiveTimestamp; ///< Active Timestamp
231+
otTimestamp mPendingTimestamp; ///< Pending Timestamp
232+
otNetworkKey mNetworkKey; ///< Network Key
233+
otNetworkName mNetworkName; ///< Network Name
234+
otExtendedPanId mExtendedPanId; ///< Extended PAN ID
235+
otMeshLocalPrefix mMeshLocalPrefix; ///< Mesh Local Prefix
236+
uint32_t mDelay; ///< Delay Timer
237+
otPanId mPanId; ///< PAN ID
238+
uint16_t mChannel; ///< Channel
239+
uint16_t mWakeupChannel; ///< Wake Channel (always 20; see OPENTHREAD_CONFIG_THREAD_DIRECT_DEFAULT_WAKE_CHANNEL)
240+
otPskc mPskc; ///< PSKc
241+
otSecurityPolicy mSecurityPolicy; ///< Security Policy
242+
otChannelMask mChannelMask; ///< Channel Mask
243+
otOperationalDatasetComponents mComponents; ///< Specifies which components are set in the Dataset.
244244
} otOperationalDataset;
245245

246246
/**
@@ -303,7 +303,7 @@ typedef enum otMeshcopTlvType
303303
OT_MESHCOP_TLV_SCAN_DURATION = 56, ///< meshcop Scan Duration TLV
304304
OT_MESHCOP_TLV_ENERGY_LIST = 57, ///< meshcop Energy List TLV
305305
OT_MESHCOP_TLV_THREAD_DOMAIN_NAME = 59, ///< meshcop Thread Domain Name TLV
306-
OT_MESHCOP_TLV_WAKEUP_CHANNEL = 74, ///< meshcop Wake-up Channel TLV
306+
OT_MESHCOP_TLV_WAKEUP_CHANNEL = 74, ///< meshcop Wake Channel TLV (always 20 for Thread Direct)
307307
OT_MESHCOP_TLV_ADMITTER_STATE = 90, ///< meshcop Admitter State TLV
308308
OT_MESHCOP_TLV_ENROLLER_ID = 91, ///< meshcop Enroller ID TLV
309309
OT_MESHCOP_TLV_ENROLLER_MODE = 92, ///< meshcop Enroller Mode TLV

include/openthread/instance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern "C" {
5252
*
5353
* @note This number versions both OpenThread platform and user APIs.
5454
*/
55-
#define OPENTHREAD_API_VERSION (605)
55+
#define OPENTHREAD_API_VERSION (606)
5656

5757
/**
5858
* @addtogroup api-instance

include/openthread/link.h

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,35 +1115,38 @@ otError otLinkSetRegion(otInstance *aInstance, uint16_t aRegionCode);
11151115
otError otLinkGetRegion(otInstance *aInstance, uint16_t *aRegionCode);
11161116

11171117
/**
1118-
* Gets the Wake-up channel.
1118+
* Gets the Thread Direct Wake Channel.
11191119
*
1120-
* Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
1120+
* Requires `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_INITIATOR_ENABLE` or
1121+
* `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE`.
11211122
*
11221123
* @param[in] aInstance A pointer to an OpenThread instance.
11231124
*
1124-
* @returns The Wake-up channel.
1125+
* @returns The Wake Channel (always 20).
11251126
*/
11261127
uint8_t otLinkGetWakeupChannel(otInstance *aInstance);
11271128

11281129
/**
1129-
* Sets the Wake-up channel.
1130+
* Sets the Thread Direct Wake Channel.
11301131
*
1131-
* Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
1132+
* Requires `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_INITIATOR_ENABLE` or
1133+
* `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE`.
1134+
*
1135+
* The Thread Direct feature mandates channel 20 (`OPENTHREAD_CONFIG_THREAD_DIRECT_DEFAULT_WAKE_CHANNEL`)
1136+
* as the sole Wake Channel. Any other value returns `OT_ERROR_INVALID_ARGS`.
11321137
*
11331138
* @param[in] aInstance A pointer to an OpenThread instance.
1134-
* @param[in] aChannel The Wake-up sample channel. Channel value should be `0` (Set Wake-up Channel unspecified,
1135-
* which means the device will use the PAN channel) or within the range [1, 10] (if 915-MHz
1136-
* supported) and [11, 26] (if 2.4 GHz supported).
1139+
* @param[in] aChannel The Wake Channel. Must equal 20.
11371140
*
1138-
* @retval OT_ERROR_NONE Successfully set the Wake-up channel.
1139-
* @retval OT_ERROR_INVALID_ARGS Invalid @p aChannel.
1141+
* @retval OT_ERROR_NONE Successfully set the Wake Channel.
1142+
* @retval OT_ERROR_INVALID_ARGS @p aChannel is not 20.
11401143
*/
11411144
otError otLinkSetWakeupChannel(otInstance *aInstance, uint8_t aChannel);
11421145

11431146
/**
11441147
* Enables or disables listening for wake-up frames.
11451148
*
1146-
* Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
1149+
* Requires `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE`.
11471150
*
11481151
* @param[in] aInstance A pointer to an OpenThread instance.
11491152
* @param[in] aEnable true to enable listening for wake-up frames, or false otherwise.
@@ -1157,7 +1160,7 @@ otError otLinkSetWakeUpListenEnabled(otInstance *aInstance, bool aEnable);
11571160
/**
11581161
* Returns whether listening for wake-up frames is enabled.
11591162
*
1160-
* Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
1163+
* Requires `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE`.
11611164
*
11621165
* @param[in] aInstance A pointer to an OpenThread instance.
11631166
*
@@ -1169,7 +1172,7 @@ bool otLinkIsWakeupListenEnabled(otInstance *aInstance);
11691172
/**
11701173
* Get the wake-up listen parameters.
11711174
*
1172-
* Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
1175+
* Requires `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE`.
11731176
*
11741177
* @param[in] aInstance A pointer to an OpenThread instance.
11751178
* @param[out] aInterval A pointer to return the wake-up listen interval in microseconds.
@@ -1183,7 +1186,7 @@ void otLinkGetWakeupListenParameters(otInstance *aInstance, uint32_t *aInterval,
11831186
* The listen interval must be greater than the listen duration.
11841187
* The listen duration must be greater or equal than the minimum supported.
11851188
*
1186-
* Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
1189+
* Requires `OPENTHREAD_CONFIG_THREAD_DIRECT_WAKE_LISTENER_ENABLE`.
11871190
*
11881191
* @param[in] aInstance A pointer to an OpenThread instance.
11891192
* @param[in] aInterval The wake-up listen interval in microseconds.

0 commit comments

Comments
 (0)