mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 23:57:46 +00:00
[mac] add option to change direct/indirect TX retry number (#4256)
Add MAC option to change number of direct TX retries: - add member variable containing maximum number of direct TX retries - add getter/setter methods Add public API for direct and indirect TX retries - otLinkGetMaxFrameRetriesDirect - otLinkSetMaxFrameRetriesDirect - otLinkGetMaxFrameRetriesIndirect - otLinkSetMaxFrameRetriesIndirect Add NCP support for direct and indirect TX retry configuration. Rename config definition for direct and direct TX retries. Add cli command handler for direct and indirect TX retries.
This commit is contained in:
committed by
Jonathan Hui
parent
aa6318b4dd
commit
5a7e19062c
@@ -454,6 +454,44 @@ otError otLinkSetPollPeriod(otInstance *aInstance, uint32_t aPollPeriod);
|
||||
*/
|
||||
otShortAddress otLinkGetShortAddress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This method returns the maximum number of frame retries during direct transmission.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The maximum number of retries during direct transmission.
|
||||
*
|
||||
*/
|
||||
uint8_t otLinkGetMaxFrameRetriesDirect(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This method sets the maximum number of frame retries during direct transmission.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aMaxFrameRetriesDirect The maximum number of retries during direct transmission.
|
||||
*
|
||||
*/
|
||||
void otLinkSetMaxFrameRetriesDirect(otInstance *aInstance, uint8_t aMaxFrameRetriesDirect);
|
||||
|
||||
/**
|
||||
* This method returns the maximum number of frame retries during indirect transmission.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The maximum number of retries during indirect transmission.
|
||||
*
|
||||
*/
|
||||
uint8_t otLinkGetMaxFrameRetriesIndirect(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This method sets the maximum number of frame retries during indirect transmission.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aMaxFrameRetriesIndirect The maximum number of retries during indirect transmission.
|
||||
*
|
||||
*/
|
||||
void otLinkSetMaxFrameRetriesIndirect(otInstance *aInstance, uint8_t aMaxFrameRetriesIndirect);
|
||||
|
||||
/**
|
||||
* This function gets the address mode of MAC filter.
|
||||
*
|
||||
|
||||
@@ -39,6 +39,7 @@ OpenThread test scripts use the CLI to execute test cases.
|
||||
* [leaderweight](#leaderweight)
|
||||
* [linkquality](#linkquality-extaddr)
|
||||
* [logfilename](#logfilename-filename)
|
||||
* [mac](#mac-retries-direct)
|
||||
* [macfilter](#macfilter)
|
||||
* [masterkey](#masterkey)
|
||||
* [mode](#mode)
|
||||
@@ -1373,6 +1374,44 @@ OPENTHREAD/gf4f2f04; Jul 1 2016 17:00:09
|
||||
Done
|
||||
```
|
||||
|
||||
### mac retries direct
|
||||
|
||||
Get the number of direct TX retries on the MAC layer.
|
||||
|
||||
```bash
|
||||
> mac retries direct
|
||||
3
|
||||
Done
|
||||
```
|
||||
|
||||
### mac retries direct \<number\>
|
||||
|
||||
Set the number of direct TX retries on the MAC layer.
|
||||
|
||||
```bash
|
||||
> mac retries direct 5
|
||||
Done
|
||||
```
|
||||
|
||||
### mac retries indirect
|
||||
|
||||
Get the number of indirect TX retries on the MAC layer.
|
||||
|
||||
```bash
|
||||
> mac retries indirect
|
||||
3
|
||||
Done
|
||||
```
|
||||
|
||||
### mac retries indirect \<number\>
|
||||
|
||||
Set the number of indirect TX retries on the MAC layer.
|
||||
|
||||
```bash
|
||||
> mac retries indirect 5
|
||||
Done
|
||||
```
|
||||
|
||||
### macfilter
|
||||
|
||||
List the macfilter status, including address and received signal strength filter settings.
|
||||
|
||||
@@ -155,6 +155,7 @@ const struct Command Interpreter::sCommands[] = {
|
||||
{"leaderpartitionid", &Interpreter::ProcessLeaderPartitionId},
|
||||
{"leaderweight", &Interpreter::ProcessLeaderWeight},
|
||||
#endif
|
||||
{"mac", &Interpreter::ProcessMac},
|
||||
#if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE
|
||||
{"macfilter", &Interpreter::ProcessMacFilter},
|
||||
#endif
|
||||
@@ -3491,6 +3492,74 @@ exit:
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_MAC_FILTER_ENABLE
|
||||
|
||||
void Interpreter::ProcessMac(int argc, char *argv[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
if (strcmp(argv[0], "retries") == 0)
|
||||
{
|
||||
error = ProcessMacRetries(argc - 1, argv + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
otError Interpreter::ProcessMacRetries(int argc, char *argv[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(argc > 0 && argc <= 2, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
if (strcmp(argv[0], "direct") == 0)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
mServer->OutputFormat("%d\r\n", otLinkGetMaxFrameRetriesDirect(mInstance));
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long value;
|
||||
|
||||
SuccessOrExit(error = ParseUnsignedLong(argv[1], value));
|
||||
VerifyOrExit(value <= 0xff, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
otLinkSetMaxFrameRetriesDirect(mInstance, static_cast<uint8_t>(value));
|
||||
}
|
||||
}
|
||||
#ifdef OPENTHREAD_FTD
|
||||
else if (strcmp(argv[0], "indirect") == 0)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
mServer->OutputFormat("%d\r\n", otLinkGetMaxFrameRetriesIndirect(mInstance));
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long value;
|
||||
|
||||
SuccessOrExit(error = ParseUnsignedLong(argv[1], value));
|
||||
VerifyOrExit(value <= 0xff, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
otLinkSetMaxFrameRetriesIndirect(mInstance, static_cast<uint8_t>(value));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
error = OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
void Interpreter::ProcessDiag(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -336,6 +336,8 @@ private:
|
||||
otError ProcessMacFilterAddress(int argc, char *argv[]);
|
||||
otError ProcessMacFilterRss(int argc, char *argv[]);
|
||||
#endif // OPENTHREAD_CONFIG_MAC_FILTER_ENABLE
|
||||
void ProcessMac(int argc, char *argv[]);
|
||||
otError ProcessMacRetries(int argc, char *argv[]);
|
||||
|
||||
static void HandleIcmpReceive(void * aContext,
|
||||
otMessage * aMessage,
|
||||
|
||||
@@ -187,6 +187,38 @@ otShortAddress otLinkGetShortAddress(otInstance *aInstance)
|
||||
return instance.Get<Mac::Mac>().GetShortAddress();
|
||||
}
|
||||
|
||||
uint8_t otLinkGetMaxFrameRetriesDirect(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.Get<Mac::Mac>().GetMaxFrameRetriesDirect();
|
||||
}
|
||||
|
||||
void otLinkSetMaxFrameRetriesDirect(otInstance *aInstance, uint8_t aMaxFrameRetriesDirect)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Get<Mac::Mac>().SetMaxFrameRetriesDirect(aMaxFrameRetriesDirect);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
uint8_t otLinkGetMaxFrameRetriesIndirect(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.Get<Mac::Mac>().GetMaxFrameRetriesIndirect();
|
||||
}
|
||||
|
||||
void otLinkSetMaxFrameRetriesIndirect(otInstance *aInstance, uint8_t aMaxFrameRetriesIndirect)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Get<Mac::Mac>().SetMaxFrameRetriesIndirect(aMaxFrameRetriesIndirect);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE
|
||||
|
||||
otMacFilterAddressMode otLinkFilterGetAddressMode(otInstance *aInstance)
|
||||
|
||||
@@ -60,27 +60,27 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_DIRECT
|
||||
* @def OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT
|
||||
*
|
||||
* The maximum number of retries allowed after a transmission failure for direct transmissions.
|
||||
* The default maximum number of retries allowed after a transmission failure for direct transmissions.
|
||||
*
|
||||
* Equivalent to macMaxFrameRetries, default value is 3.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_DIRECT
|
||||
#define OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_DIRECT 3
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT
|
||||
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_INDIRECT
|
||||
* @def OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT
|
||||
*
|
||||
* The maximum number of retries allowed after a transmission failure for indirect transmissions.
|
||||
* The default maximum number of retries allowed after a transmission failure for indirect transmissions.
|
||||
*
|
||||
* Equivalent to macMaxFrameRetries, default value is 0.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_INDIRECT
|
||||
#define OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_INDIRECT 0
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT
|
||||
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@
|
||||
* Takes the place of macTransactionPersistenceTime. The time period is specified in units of IEEE 802.15.4 Data
|
||||
* Request receptions, rather than being governed by macBeaconOrder.
|
||||
*
|
||||
* @sa OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_INDIRECT
|
||||
* @sa OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS
|
||||
|
||||
@@ -441,4 +441,14 @@
|
||||
"OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE was replaced by OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE."
|
||||
#endif
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_DIRECT
|
||||
#error \
|
||||
"OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_DIRECT was replaced by OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT."
|
||||
#endif
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_INDIRECT
|
||||
#error \
|
||||
"OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_INDIRECT was replaced by OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT."
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_CONFIG_CHECK_H_
|
||||
|
||||
@@ -101,6 +101,10 @@ Mac::Mac(Instance &aInstance)
|
||||
, mScanChannel(Radio::kChannelMin)
|
||||
, mScanDuration(0)
|
||||
, mScanChannelMask()
|
||||
, mMaxFrameRetriesDirect(kDefaultMaxFrameRetriesDirect)
|
||||
#if OPENTHREAD_FTD
|
||||
, mMaxFrameRetriesIndirect(kDefaultMaxFrameRetriesIndirect)
|
||||
#endif
|
||||
, mActiveScanHandler(NULL) /* Initialize `mActiveScanHandler` and `mEnergyScanHandler` union */
|
||||
, mSubMac(aInstance)
|
||||
, mOperationTask(aInstance, &Mac::HandleOperationTask, this)
|
||||
@@ -1027,7 +1031,7 @@ void Mac::BeginTransmit(void)
|
||||
PrepareBeaconRequest(sendFrame);
|
||||
sendFrame.SetSequence(0);
|
||||
sendFrame.SetMaxCsmaBackoffs(kMaxCsmaBackoffsDirect);
|
||||
sendFrame.SetMaxFrameRetries(kMaxFrameRetriesDirect);
|
||||
sendFrame.SetMaxFrameRetries(mMaxFrameRetriesDirect);
|
||||
break;
|
||||
|
||||
case kOperationTransmitBeacon:
|
||||
@@ -1035,7 +1039,7 @@ void Mac::BeginTransmit(void)
|
||||
PrepareBeacon(sendFrame);
|
||||
sendFrame.SetSequence(mBeaconSequence++);
|
||||
sendFrame.SetMaxCsmaBackoffs(kMaxCsmaBackoffsDirect);
|
||||
sendFrame.SetMaxFrameRetries(kMaxFrameRetriesDirect);
|
||||
sendFrame.SetMaxFrameRetries(mMaxFrameRetriesDirect);
|
||||
break;
|
||||
|
||||
case kOperationTransmitPoll:
|
||||
@@ -1043,13 +1047,13 @@ void Mac::BeginTransmit(void)
|
||||
SuccessOrExit(error = PrepareDataRequest(sendFrame));
|
||||
sendFrame.SetSequence(mDataSequence++);
|
||||
sendFrame.SetMaxCsmaBackoffs(kMaxCsmaBackoffsDirect);
|
||||
sendFrame.SetMaxFrameRetries(kMaxFrameRetriesDirect);
|
||||
sendFrame.SetMaxFrameRetries(mMaxFrameRetriesDirect);
|
||||
break;
|
||||
|
||||
case kOperationTransmitDataDirect:
|
||||
sendFrame.SetChannel(mRadioChannel);
|
||||
sendFrame.SetMaxCsmaBackoffs(kMaxCsmaBackoffsDirect);
|
||||
sendFrame.SetMaxFrameRetries(kMaxFrameRetriesDirect);
|
||||
sendFrame.SetMaxFrameRetries(mMaxFrameRetriesDirect);
|
||||
SuccessOrExit(error = Get<MeshForwarder>().HandleFrameRequest(sendFrame));
|
||||
sendFrame.SetSequence(mDataSequence++);
|
||||
break;
|
||||
@@ -1058,7 +1062,7 @@ void Mac::BeginTransmit(void)
|
||||
case kOperationTransmitDataIndirect:
|
||||
sendFrame.SetChannel(mRadioChannel);
|
||||
sendFrame.SetMaxCsmaBackoffs(kMaxCsmaBackoffsIndirect);
|
||||
sendFrame.SetMaxFrameRetries(kMaxFrameRetriesIndirect);
|
||||
sendFrame.SetMaxFrameRetries(mMaxFrameRetriesIndirect);
|
||||
SuccessOrExit(error = Get<DataPollHandler>().HandleFrameRequest(sendFrame));
|
||||
|
||||
// If the frame is marked as a retransmission, then data sequence number is already set.
|
||||
|
||||
+46
-4
@@ -82,10 +82,11 @@ enum
|
||||
kMaxCsmaBackoffsIndirect =
|
||||
OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_INDIRECT, ///< macMaxCsmaBackoffs for indirect transmissions
|
||||
|
||||
kMaxFrameRetriesDirect =
|
||||
OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_DIRECT, ///< macMaxFrameRetries for direct transmissions
|
||||
kMaxFrameRetriesIndirect =
|
||||
OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_INDIRECT, ///< macMaxFrameRetries for indirect transmissions
|
||||
kDefaultMaxFrameRetriesDirect =
|
||||
OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT, ///< macDefaultMaxFrameRetries for direct transmissions
|
||||
kDefaultMaxFrameRetriesIndirect =
|
||||
OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT, ///< macDefaultMaxFrameRetries for indirect
|
||||
///< transmissions
|
||||
|
||||
kTxNumBcast = OPENTHREAD_CONFIG_MAC_TX_NUM_BCAST ///< Number of times each broadcast frame is transmitted
|
||||
};
|
||||
@@ -426,6 +427,43 @@ public:
|
||||
*/
|
||||
void SetExtendedPanId(const ExtendedPanId &aExtendedPanId);
|
||||
|
||||
/**
|
||||
* This method returns the maximum number of frame retries during direct transmission.
|
||||
*
|
||||
* @returns The maximum number of retries during direct transmission.
|
||||
*
|
||||
*/
|
||||
uint8_t GetMaxFrameRetriesDirect(void) const { return mMaxFrameRetriesDirect; }
|
||||
|
||||
/**
|
||||
* This method sets the maximum number of frame retries during direct transmission.
|
||||
*
|
||||
* @param[in] aMaxFrameRetriesDirect The maximum number of retries during direct transmission.
|
||||
*
|
||||
*/
|
||||
void SetMaxFrameRetriesDirect(uint8_t aMaxFrameRetriesDirect) { mMaxFrameRetriesDirect = aMaxFrameRetriesDirect; }
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
/**
|
||||
* This method returns the maximum number of frame retries during indirect transmission.
|
||||
*
|
||||
* @returns The maximum number of retries during indirect transmission.
|
||||
*
|
||||
*/
|
||||
uint8_t GetMaxFrameRetriesIndirect(void) const { return mMaxFrameRetriesIndirect; }
|
||||
|
||||
/**
|
||||
* This method sets the maximum number of frame retries during indirect transmission.
|
||||
*
|
||||
* @param[in] aMaxFrameRetriesIndirect The maximum number of retries during indirect transmission.
|
||||
*
|
||||
*/
|
||||
void SetMaxFrameRetriesIndirect(uint8_t aMaxFrameRetriesIndirect)
|
||||
{
|
||||
mMaxFrameRetriesIndirect = aMaxFrameRetriesIndirect;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This method is called to handle a received frame.
|
||||
*
|
||||
@@ -714,6 +752,10 @@ private:
|
||||
uint8_t mScanChannel;
|
||||
uint16_t mScanDuration;
|
||||
ChannelMask mScanChannelMask;
|
||||
uint8_t mMaxFrameRetriesDirect;
|
||||
#if OPENTHREAD_FTD
|
||||
uint8_t mMaxFrameRetriesIndirect;
|
||||
#endif
|
||||
union
|
||||
{
|
||||
ActiveScanHandler mActiveScanHandler;
|
||||
|
||||
@@ -168,6 +168,9 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_MAC_CCA_FAILURE_RATE:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_CCA_FAILURE_RATE>;
|
||||
break;
|
||||
case SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT>;
|
||||
break;
|
||||
#if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE
|
||||
case SPINEL_PROP_MAC_BLACKLIST:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_BLACKLIST>;
|
||||
@@ -547,6 +550,9 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
|
||||
// FTD Only Properties (Get Handler)
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
case SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT>;
|
||||
break;
|
||||
case SPINEL_PROP_NET_PSKC:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_NET_PSKC>;
|
||||
break;
|
||||
@@ -745,6 +751,9 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_MAC_DATA_POLL_PERIOD:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_MAC_DATA_POLL_PERIOD>;
|
||||
break;
|
||||
case SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT>;
|
||||
break;
|
||||
case SPINEL_PROP_NET_IF_UP:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_NET_IF_UP>;
|
||||
break;
|
||||
@@ -903,6 +912,9 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
// FTD Only Properties (Set Handler)
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
case SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT>;
|
||||
break;
|
||||
case SPINEL_PROP_NET_PSKC:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_NET_PSKC>;
|
||||
break;
|
||||
|
||||
@@ -310,6 +310,23 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT>(void)
|
||||
{
|
||||
return mEncoder.WriteUint8(otLinkGetMaxFrameRetriesIndirect(mInstance));
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT>(void)
|
||||
{
|
||||
uint8_t maxFrameRetriesIndirect;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(maxFrameRetriesIndirect));
|
||||
otLinkSetMaxFrameRetriesIndirect(mInstance, maxFrameRetriesIndirect);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_PSKC>(void)
|
||||
{
|
||||
return mEncoder.WriteData(otThreadGetPskc(mInstance)->m8, sizeof(spinel_net_pskc_t));
|
||||
|
||||
@@ -213,6 +213,23 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_EXTENDED_ADDR>(vo
|
||||
return mEncoder.WriteEui64(*otLinkGetExtendedAddress(mInstance));
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT>(void)
|
||||
{
|
||||
return mEncoder.WriteUint8(otLinkGetMaxFrameRetriesDirect(mInstance));
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT>(void)
|
||||
{
|
||||
uint8_t maxFrameRetriesDirect;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(maxFrameRetriesDirect));
|
||||
otLinkSetMaxFrameRetriesDirect(mInstance, maxFrameRetriesDirect);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_FREQ>(void)
|
||||
{
|
||||
uint32_t freq_khz(0);
|
||||
|
||||
@@ -371,7 +371,7 @@ otError NcpBase::DecodeStreamRawTxRequest(otRadioFrame &aFrame)
|
||||
|
||||
// Set the default value for all optional parameters.
|
||||
aFrame.mInfo.mTxInfo.mMaxCsmaBackoffs = OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT;
|
||||
aFrame.mInfo.mTxInfo.mMaxFrameRetries = OPENTHREAD_CONFIG_MAC_MAX_FRAME_RETRIES_DIRECT;
|
||||
aFrame.mInfo.mTxInfo.mMaxFrameRetries = OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT;
|
||||
aFrame.mInfo.mTxInfo.mCsmaCaEnabled = true;
|
||||
|
||||
// All the next parameters are optional. Note that even if the
|
||||
|
||||
@@ -1499,6 +1499,14 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "MAC_CCA_FAILURE_RATE";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT:
|
||||
ret = "MAC_MAX_RETRY_NUMBER_DIRECT";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT:
|
||||
ret = "MAC_MAX_RETRY_NUMBER_INDIRECT";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_NET_SAVED:
|
||||
ret = "NET_SAVED";
|
||||
break;
|
||||
|
||||
@@ -1927,6 +1927,23 @@ typedef enum
|
||||
*/
|
||||
SPINEL_PROP_MAC_CCA_FAILURE_RATE = SPINEL_PROP_MAC_EXT__BEGIN + 9,
|
||||
|
||||
/// MAC Max direct retry number
|
||||
/** Format: `C`
|
||||
*
|
||||
* The maximum (user-specified) number of direct frame transmission retries.
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT = SPINEL_PROP_MAC_EXT__BEGIN + 10,
|
||||
|
||||
/// MAC Max indirect retry number
|
||||
/** Format: `C`
|
||||
* Required capability: `SPINEL_CAP_CONFIG_FTD`
|
||||
*
|
||||
* The maximum (user-specified) number of indirect frame transmission retries.
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT = SPINEL_PROP_MAC_EXT__BEGIN + 11,
|
||||
|
||||
SPINEL_PROP_MAC_EXT__END = 0x1400,
|
||||
|
||||
SPINEL_PROP_NET__BEGIN = 0x40,
|
||||
|
||||
Reference in New Issue
Block a user