[mac] update the log message for frame tx failure (#4059)

The new model handles the case where frame retries are not handled
by sub-mac layer (e.g., delegated to radio platform).

This helps improve the log message in posix-app model where the retx
is handled by the RCP and not on the host side.
This commit is contained in:
Abtin Keshavarzian
2019-08-08 08:31:12 -07:00
committed by Jonathan Hui
parent 700bb6b5a8
commit 18cd02e6b1
3 changed files with 10 additions and 7 deletions
+8 -5
View File
@@ -1182,7 +1182,7 @@ void Mac::RecordFrameTransmitStatus(const TxFrame &aFrame,
if (aError != OT_ERROR_NONE)
{
LogFrameTxFailure(aFrame, aError, aRetryCount);
LogFrameTxFailure(aFrame, aError, aRetryCount, aWillRetx);
otDumpDebgMac("TX ERR", aFrame.GetHeader(), 16);
if (aWillRetx)
@@ -1947,10 +1947,13 @@ void Mac::LogFrameRxFailure(const RxFrame *aFrame, otError aError) const
}
}
void Mac::LogFrameTxFailure(const TxFrame &aFrame, otError aError, uint8_t aRetryCount) const
void Mac::LogFrameTxFailure(const TxFrame &aFrame, otError aError, uint8_t aRetryCount, bool aWillRetx) const
{
otLogInfoMac("Frame tx failed, error:%s, retries:%d/%d, %s", otThreadErrorToString(aError), aRetryCount,
aFrame.GetMaxFrameRetries(), aFrame.ToInfoString().AsCString());
uint8_t maxAttempts = aFrame.GetMaxFrameRetries() + 1;
uint8_t curAttempt = aWillRetx ? (aRetryCount + 1) : maxAttempts;
otLogInfoMac("Frame tx attempt %d/%d failed, error:%s, %s", curAttempt, maxAttempts, otThreadErrorToString(aError),
aFrame.ToInfoString().AsCString());
}
void Mac::LogBeacon(const char *aActionText, const BeaconPayload &aBeaconPayload) const
@@ -1968,7 +1971,7 @@ void Mac::LogBeacon(const char *, const BeaconPayload &) const
{
}
void Mac::LogFrameTxFailure(const TxFrame &, otError, uint8_t) const
void Mac::LogFrameTxFailure(const TxFrame &, otError, uint8_t, bool) const
{
}
+1 -1
View File
@@ -674,7 +674,7 @@ private:
void ReportEnergyScanResult(int8_t aRssi);
void LogFrameRxFailure(const RxFrame *aFrame, otError aError) const;
void LogFrameTxFailure(const TxFrame &aFrame, otError aError, uint8_t aRetryCount) const;
void LogFrameTxFailure(const TxFrame &aFrame, otError aError, uint8_t aRetryCount, bool aWillRetx) const;
void LogBeacon(const char *aActionText, const BeaconPayload &aBeaconPayload) const;
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
+1 -1
View File
@@ -135,7 +135,7 @@ public:
* OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
* OT_ERROR_CHANNEL_ACCESS_FAILURE tx failed due to activity on the channel,
* OT_ERROR_ABORT when transmission was aborted for other reasons.
* @param[in] aRetryCount Number of transmission retries for this frame.
* @param[in] aRetryCount Current retry count. This is valid only when sub-mac handles frame re-transmissions.
* @param[in] aWillRetx Indicates whether frame will be retransmitted or not. This is applicable only
* when there was an error in current transmission attempt.
*