mirror of
https://github.com/espressif/openthread.git
synced 2026-08-06 02:37:47 +00:00
[mesh-forwarder] update indirect message logs (#3135)
This commit makes the following changes in `MeshForwarder`: - It separates the logging of sent direct and indirect messages, ensuring that for indirect messages the status (success/failure) is logged after all retry attempts. - It updates the log message (status of transmission) for a larger message requiring fragmentation and multiple frame transmissions when `CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE` is not enabled. - It fixes managing of `IpCounters` to only account for messages with type `kTypeIp6`.
This commit is contained in:
committed by
Jonathan Hui
parent
739842d168
commit
467ab24e9b
@@ -1074,6 +1074,8 @@ void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError)
|
||||
}
|
||||
else
|
||||
{
|
||||
otError txError = aError;
|
||||
|
||||
mSendMessage->ClearDirectTransmission();
|
||||
mSendMessage->SetOffset(0);
|
||||
|
||||
@@ -1081,6 +1083,35 @@ void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError)
|
||||
{
|
||||
neighbor->GetLinkInfo().AddMessageTxStatus(mSendMessage->GetTxSuccess());
|
||||
}
|
||||
|
||||
#if !OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE
|
||||
|
||||
// When `CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE` is
|
||||
// disabled, all fragment frames of a larger message are
|
||||
// sent even if the transmission of an earlier fragment fail.
|
||||
// Note that `GetTxSuccess() tracks the tx success of the
|
||||
// entire message, while `aError` represents the error
|
||||
// status of the last fragment frame transmission.
|
||||
|
||||
if (!mSendMessage->GetTxSuccess() && (txError == OT_ERROR_NONE))
|
||||
{
|
||||
txError = OT_ERROR_FAILED;
|
||||
}
|
||||
#endif
|
||||
|
||||
LogMessage(kMessageTransmit, *mSendMessage, &macDest, txError);
|
||||
|
||||
if (mSendMessage->GetType() == Message::kTypeIp6)
|
||||
{
|
||||
if (mSendMessage->GetTxSuccess())
|
||||
{
|
||||
mIpCounters.mTxSuccess++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mIpCounters.mTxFailure++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mSendMessage->GetSubType() == Message::kSubTypeMleDiscoverRequest)
|
||||
@@ -1106,20 +1137,6 @@ void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError)
|
||||
}
|
||||
}
|
||||
|
||||
if (mMessageNextOffset >= mSendMessage->GetLength())
|
||||
{
|
||||
LogMessage(kMessageTransmit, *mSendMessage, &macDest, aError);
|
||||
|
||||
if (aError == OT_ERROR_NONE)
|
||||
{
|
||||
mIpCounters.mTxSuccess++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mIpCounters.mTxFailure++;
|
||||
}
|
||||
}
|
||||
|
||||
if (mSendMessage->GetDirectTransmission() == false && mSendMessage->IsChildPending() == false)
|
||||
{
|
||||
mSendQueue.Dequeue(*mSendMessage);
|
||||
@@ -1425,7 +1442,11 @@ void MeshForwarder::ClearReassemblyList(void)
|
||||
mReassemblyList.Dequeue(*message);
|
||||
|
||||
LogMessage(kMessageReassemblyDrop, *message, NULL, OT_ERROR_NO_FRAME_RECEIVED);
|
||||
mIpCounters.mRxFailure++;
|
||||
|
||||
if (message->GetType() == Message::kTypeIp6)
|
||||
{
|
||||
mIpCounters.mRxFailure++;
|
||||
}
|
||||
|
||||
message->Free();
|
||||
}
|
||||
@@ -1455,7 +1476,11 @@ void MeshForwarder::HandleReassemblyTimer(void)
|
||||
mReassemblyList.Dequeue(*message);
|
||||
|
||||
LogMessage(kMessageReassemblyDrop, *message, NULL, OT_ERROR_REASSEMBLY_TIMEOUT);
|
||||
mIpCounters.mRxFailure++;
|
||||
|
||||
if (message->GetType() == Message::kTypeIp6)
|
||||
{
|
||||
mIpCounters.mRxFailure++;
|
||||
}
|
||||
|
||||
message->Free();
|
||||
}
|
||||
@@ -1528,7 +1553,11 @@ otError MeshForwarder::HandleDatagram(Message & aMessage,
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
LogMessage(kMessageReceive, aMessage, &aMacSource, OT_ERROR_NONE);
|
||||
mIpCounters.mRxSuccess++;
|
||||
|
||||
if (aMessage.GetType() == Message::kTypeIp6)
|
||||
{
|
||||
mIpCounters.mRxSuccess++;
|
||||
}
|
||||
|
||||
return netif.GetIp6().HandleDatagram(aMessage, &netif, netif.GetInterfaceId(), &aLinkInfo, false);
|
||||
}
|
||||
|
||||
@@ -675,6 +675,7 @@ void MeshForwarder::HandleSentFrameToChild(const Mac::Frame &aFrame, otError aEr
|
||||
}
|
||||
else
|
||||
{
|
||||
otError txError = aError;
|
||||
uint8_t childIndex;
|
||||
|
||||
if (mSendMessage == child->GetIndirectMessage())
|
||||
@@ -693,6 +694,22 @@ void MeshForwarder::HandleSentFrameToChild(const Mac::Frame &aFrame, otError aEr
|
||||
// address mode for source address matching.
|
||||
|
||||
mSourceMatchController.SetSrcMatchAsShort(*child, true);
|
||||
|
||||
#if !OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE
|
||||
|
||||
// When `CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE` is
|
||||
// disabled, all fragment frames of a larger message are
|
||||
// sent even if the transmission of an earlier fragment fail.
|
||||
// Note that `GetIndirectTxSuccess() tracks the tx success of
|
||||
// the entire message to the child, while `txError = aError`
|
||||
// represents the error status of the last fragment frame
|
||||
// transmission.
|
||||
|
||||
if (!child->GetIndirectTxSuccess() && (txError == OT_ERROR_NONE))
|
||||
{
|
||||
txError = OT_ERROR_FAILED;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
childIndex = netif.GetMle().GetChildTable().GetChildIndex(*child);
|
||||
@@ -702,6 +719,20 @@ void MeshForwarder::HandleSentFrameToChild(const Mac::Frame &aFrame, otError aEr
|
||||
mSendMessage->ClearChildMask(childIndex);
|
||||
mSourceMatchController.DecrementMessageCount(*child);
|
||||
}
|
||||
|
||||
LogMessage(kMessageTransmit, *mSendMessage, &aMacDest, txError);
|
||||
|
||||
if (mSendMessage->GetType() == Message::kTypeIp6)
|
||||
{
|
||||
if (mSendMessage->GetTxSuccess())
|
||||
{
|
||||
mIpCounters.mTxSuccess++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mIpCounters.mTxFailure++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aError == OT_ERROR_NONE)
|
||||
|
||||
Reference in New Issue
Block a user