mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 21:57:47 +00:00
[mac] remove the out-of-band frame tx API (#6778)
This commit removes the API to enqueue an out of band frame for transmission by MAC layer. This API was added as a work-around to enable legacy (non-Thread based) frames to be sent along with Thread frames. This model is no longer used and generally not recommended. The preferred way to handle multi-radio/multi-protocol is to add support for it in radio platform layer.
This commit is contained in:
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (130)
|
||||
#define OPENTHREAD_API_VERSION (131)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -506,22 +506,6 @@ otError otLinkSendDataRequest(otInstance *aInstance);
|
||||
*/
|
||||
bool otLinkIsInTransmitState(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function enqueues an IEEE 802.15.4 out of band Frame for transmission.
|
||||
*
|
||||
* An Out of Band frame is one that was generated outside of OpenThread.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aOobFrame A pointer to the frame to transmit.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully scheduled the frame transmission.
|
||||
* @retval OT_ERROR_ALREADY MAC layer is busy sending a previously requested frame.
|
||||
* @retval OT_ERROR_INVALID_STATE The MAC layer is not enabled.
|
||||
* @retval OT_ERROR_INVALID_ARGS The argument @p aOobFrame is NULL.
|
||||
*
|
||||
*/
|
||||
otError otLinkOutOfBandTransmitRequest(otInstance *aInstance, otRadioFrame *aOobFrame);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 channel.
|
||||
*
|
||||
|
||||
@@ -468,13 +468,6 @@ bool otLinkIsInTransmitState(otInstance *aInstance)
|
||||
return instance.Get<Mac::Mac>().IsInTransmitState();
|
||||
}
|
||||
|
||||
otError otLinkOutOfBandTransmitRequest(otInstance *aInstance, otRadioFrame *aOobFrame)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.Get<Mac::Mac>().RequestOutOfBandFrameTransmission(aOobFrame);
|
||||
}
|
||||
|
||||
uint16_t otLinkGetCcaFailureRate(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
+4
-49
@@ -87,7 +87,6 @@ Mac::Mac(Instance &aInstance)
|
||||
#endif
|
||||
#endif
|
||||
, mPendingTransmitPoll(false)
|
||||
, mPendingTransmitOobFrame(false)
|
||||
, mPendingWaitingForData(false)
|
||||
, mShouldTxPollBeforeData(false)
|
||||
, mRxOnWhenIdle(false)
|
||||
@@ -120,7 +119,6 @@ Mac::Mac(Instance &aInstance)
|
||||
, mLinks(aInstance)
|
||||
, mOperationTask(aInstance, Mac::HandleOperationTask)
|
||||
, mTimer(aInstance, Mac::HandleTimer)
|
||||
, mOobFrame(nullptr)
|
||||
, mKeyIdMode2FrameCounter(0)
|
||||
, mCcaSampleCount(0)
|
||||
#if OPENTHREAD_CONFIG_MULTI_RADIO
|
||||
@@ -216,7 +214,6 @@ bool Mac::IsInTransmitState(void) const
|
||||
#endif
|
||||
case kOperationTransmitBeacon:
|
||||
case kOperationTransmitPoll:
|
||||
case kOperationTransmitOutOfBandFrame:
|
||||
retval = true;
|
||||
break;
|
||||
|
||||
@@ -571,22 +568,6 @@ exit:
|
||||
#endif
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
Error Mac::RequestOutOfBandFrameTransmission(otRadioFrame *aOobFrame)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
VerifyOrExit(aOobFrame != nullptr, error = kErrorInvalidArgs);
|
||||
VerifyOrExit(IsEnabled(), error = kErrorInvalidState);
|
||||
VerifyOrExit(!mPendingTransmitOobFrame && (mOperation != kOperationTransmitOutOfBandFrame), error = kErrorAlready);
|
||||
|
||||
mOobFrame = static_cast<TxFrame *>(aOobFrame);
|
||||
|
||||
StartOperation(kOperationTransmitOutOfBandFrame);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Error Mac::RequestDataPollTransmission(void)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
@@ -715,10 +696,6 @@ void Mac::StartOperation(Operation aOperation)
|
||||
case kOperationWaitingForData:
|
||||
mPendingWaitingForData = true;
|
||||
break;
|
||||
|
||||
case kOperationTransmitOutOfBandFrame:
|
||||
mPendingTransmitOobFrame = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mOperation == kOperationIdle)
|
||||
@@ -739,7 +716,6 @@ void Mac::PerformNextOperation(void)
|
||||
if (!IsEnabled())
|
||||
{
|
||||
mPendingWaitingForData = false;
|
||||
mPendingTransmitOobFrame = false;
|
||||
mPendingActiveScan = false;
|
||||
mPendingEnergyScan = false;
|
||||
mPendingTransmitBeacon = false;
|
||||
@@ -774,11 +750,6 @@ void Mac::PerformNextOperation(void)
|
||||
mOperation = kOperationTransmitDataCsl;
|
||||
}
|
||||
#endif
|
||||
else if (mPendingTransmitOobFrame)
|
||||
{
|
||||
mPendingTransmitOobFrame = false;
|
||||
mOperation = kOperationTransmitOutOfBandFrame;
|
||||
}
|
||||
else if (mPendingActiveScan)
|
||||
{
|
||||
mPendingActiveScan = false;
|
||||
@@ -849,7 +820,6 @@ void Mac::PerformNextOperation(void)
|
||||
#endif
|
||||
#endif
|
||||
case kOperationTransmitPoll:
|
||||
case kOperationTransmitOutOfBandFrame:
|
||||
BeginTransmit();
|
||||
break;
|
||||
|
||||
@@ -1141,12 +1111,6 @@ void Mac::BeginTransmit(void)
|
||||
#endif
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
case kOperationTransmitOutOfBandFrame:
|
||||
frame = &txFrames.GetBroadcastTxFrame();
|
||||
frame->CopyFrom(*mOobFrame);
|
||||
frame->SetIsSecurityProcessed(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
OT_ASSERT(false);
|
||||
OT_UNREACHABLE_CODE(break);
|
||||
@@ -1583,13 +1547,6 @@ void Mac::HandleTransmitDone(TxFrame &aFrame, RxFrame *aAckFrame, Error aError)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case kOperationTransmitOutOfBandFrame:
|
||||
// count Oob frames
|
||||
mCounters.mTxOther++;
|
||||
FinishOperation();
|
||||
PerformNextOperation();
|
||||
break;
|
||||
|
||||
default:
|
||||
OT_ASSERT(false);
|
||||
OT_UNREACHABLE_CODE(ExitNow()); // Added to suppress "unused label exit" warning (in TREL radio only).
|
||||
@@ -2293,11 +2250,10 @@ const char *Mac::OperationToString(Operation aOperation)
|
||||
"TransmitDataDirect", // (4) kOperationTransmitDataDirect
|
||||
"TransmitPoll", // (5) kOperationTransmitPoll
|
||||
"WaitingForData", // (6) kOperationWaitingForData
|
||||
"TransmitOobFrame", // (7) kOperationTransmitOutOfBandFrame
|
||||
#if OPENTHREAD_FTD
|
||||
"TransmitDataIndirect", // (8) kOperationTransmitDataIndirect
|
||||
"TransmitDataIndirect", // (7) kOperationTransmitDataIndirect
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
|
||||
"TransmitDataCsl", // (9) kOperationTransmitDataCsl
|
||||
"TransmitDataCsl", // (8) kOperationTransmitDataCsl
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
@@ -2309,11 +2265,10 @@ const char *Mac::OperationToString(Operation aOperation)
|
||||
static_assert(kOperationTransmitDataDirect == 4, "kOperationTransmitDataDirect value is incorrect");
|
||||
static_assert(kOperationTransmitPoll == 5, "kOperationTransmitPoll value is incorrect");
|
||||
static_assert(kOperationWaitingForData == 6, "kOperationWaitingForData value is incorrect");
|
||||
static_assert(kOperationTransmitOutOfBandFrame == 7, "kOperationTransmitOutOfBandFrame value is incorrect");
|
||||
#if OPENTHREAD_FTD
|
||||
static_assert(kOperationTransmitDataIndirect == 8, "kOperationTransmitDataIndirect value is incorrect");
|
||||
static_assert(kOperationTransmitDataIndirect == 7, "kOperationTransmitDataIndirect value is incorrect");
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
|
||||
static_assert(kOperationTransmitDataCsl == 9, "TransmitDataCsl value is incorrect");
|
||||
static_assert(kOperationTransmitDataCsl == 8, "TransmitDataCsl value is incorrect");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -233,21 +233,6 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This method requests an Out of Band frame for MAC Transmission.
|
||||
*
|
||||
* An Out of Band frame is one that was generated outside of OpenThread.
|
||||
*
|
||||
* @param[in] aOobFrame A pointer to the frame.
|
||||
*
|
||||
* @retval kErrorNone Successfully scheduled the frame transmission.
|
||||
* @retval kErrorAlready MAC layer is busy sending a previously requested frame.
|
||||
* @retval kErrorInvalidState The MAC layer is not enabled.
|
||||
* @retval kErrorInvalidArgs The argument @p aOobFrame is nullptr.
|
||||
*
|
||||
*/
|
||||
Error RequestOutOfBandFrameTransmission(otRadioFrame *aOobFrame);
|
||||
|
||||
/**
|
||||
* This method requests transmission of a data poll (MAC Data Request) frame.
|
||||
*
|
||||
@@ -747,7 +732,6 @@ private:
|
||||
kOperationTransmitDataDirect,
|
||||
kOperationTransmitPoll,
|
||||
kOperationWaitingForData,
|
||||
kOperationTransmitOutOfBandFrame,
|
||||
#if OPENTHREAD_FTD
|
||||
kOperationTransmitDataIndirect,
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
|
||||
@@ -843,7 +827,6 @@ private:
|
||||
#endif
|
||||
#endif
|
||||
bool mPendingTransmitPoll : 1;
|
||||
bool mPendingTransmitOobFrame : 1;
|
||||
bool mPendingWaitingForData : 1;
|
||||
bool mShouldTxPollBeforeData : 1;
|
||||
bool mRxOnWhenIdle : 1;
|
||||
@@ -890,7 +873,6 @@ private:
|
||||
Links mLinks;
|
||||
Tasklet mOperationTask;
|
||||
TimerMilli mTimer;
|
||||
TxFrame * mOobFrame;
|
||||
otMacCounters mCounters;
|
||||
uint32_t mKeyIdMode2FrameCounter;
|
||||
SuccessRateTracker mCcaSuccessRateTracker;
|
||||
|
||||
Reference in New Issue
Block a user