mac: Update the log message for "tx failure" to include the attempt counter and dst address (#1480)

This commit is contained in:
Abtin Keshavarzian
2017-03-20 09:52:34 -07:00
committed by Jonathan Hui
parent 163c54537f
commit 0b66335234
+28 -4
View File
@@ -1030,6 +1030,7 @@ void Mac::SentFrame(ThreadError aError)
{
Frame &sendFrame(*mTxFrame);
Sender *sender;
Address dstAddr;
switch (aError)
{
@@ -1038,11 +1039,34 @@ void Mac::SentFrame(ThreadError aError)
case kThreadError_ChannelAccessFailure:
case kThreadError_Abort:
otLogInfoMac(GetInstance(), "Tx failed with error %s (%d)", otThreadErrorToString(aError), aError);
// Intentional fall through to next case.
case kThreadError_NoAck:
sendFrame.GetDstAddr(dstAddr);
switch (dstAddr.mLength)
{
case sizeof(ShortAddress):
otLogInfoMac(GetInstance(), "Tx failed - Error: %s (%d) - SeqNum: %d - Attempt %d/%d - Dst (short): %04x",
otThreadErrorToString(aError), aError, sendFrame.GetSequence(), mTransmitAttempts + 1,
sendFrame.GetMaxTxAttempts(), dstAddr.mShortAddress);
break;
case sizeof(ExtAddress):
otLogInfoMac(GetInstance(), "Tx failed - Error: %s (%d) - SeqNum: %d - Attempt %d/%d - "
"Dst: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
otThreadErrorToString(aError), aError, sendFrame.GetSequence(), mTransmitAttempts + 1,
sendFrame.GetMaxTxAttempts(), dstAddr.mExtAddress.m8[0], dstAddr.mExtAddress.m8[1],
dstAddr.mExtAddress.m8[2], dstAddr.mExtAddress.m8[3], dstAddr.mExtAddress.m8[4],
dstAddr.mExtAddress.m8[5], dstAddr.mExtAddress.m8[6], dstAddr.mExtAddress.m8[7]);
break;
default:
otLogInfoMac(GetInstance(), "Tx failed - Error: %s (%d) - SeqNum: %d - Attempt %d/%d",
otThreadErrorToString(aError), aError, sendFrame.GetSequence(), mTransmitAttempts + 1,
sendFrame.GetMaxTxAttempts());
break;
}
otDumpDebgMac("TX ERR", sendFrame.GetHeader(), 16);
if (!RadioSupportsRetries() &&