mirror of
https://github.com/espressif/openthread.git
synced 2026-10-28 18:24:37 +00:00
NcpBase: Counter for out of order received spinel frames (#1210)
- Adds a new NCP counter to indicate the number of times the received `tid` in spinel frames jumps by more than 1. This is intended to track dropped (inbound) spinel frames.
This commit is contained in:
committed by
Jonathan Hui
parent
ca59b1df41
commit
cf215262d8
+15
-2
@@ -478,6 +478,7 @@ NcpBase::NcpBase(otInstance *aInstance):
|
||||
#endif
|
||||
mDroppedReplyTid(0),
|
||||
mDroppedReplyTidBitSet(0),
|
||||
mNextExpectedTid(0),
|
||||
mAllowLocalNetworkDataChange(false),
|
||||
mRequireJoinExistingNetwork(false),
|
||||
mIsRawStreamEnabled(false),
|
||||
@@ -485,6 +486,7 @@ NcpBase::NcpBase(otInstance *aInstance):
|
||||
|
||||
mFramingErrorCounter(0),
|
||||
mRxSpinelFrameCounter(0),
|
||||
mRxSpinelOutOfOrderTidCounter(0),
|
||||
mTxSpinelFrameCounter(0),
|
||||
mInboundSecureIpFrameCounter(0),
|
||||
mInboundInsecureIpFrameCounter(0),
|
||||
@@ -930,10 +932,19 @@ void NcpBase::HandleReceive(const uint8_t *buf, uint16_t bufLength)
|
||||
spinel_tid_t tid = 0;
|
||||
|
||||
parsedLength = spinel_datatype_unpack(buf, bufLength, "CiD", &header, &command, &arg_ptr, &arg_len);
|
||||
tid = SPINEL_HEADER_GET_TID(header);
|
||||
|
||||
if (parsedLength == bufLength)
|
||||
{
|
||||
errorCode = HandleCommand(header, command, arg_ptr, static_cast<uint16_t>(arg_len));
|
||||
|
||||
// Check if we may have missed a `tid` in the sequence.
|
||||
if ((mNextExpectedTid != 0) && (tid != mNextExpectedTid))
|
||||
{
|
||||
mRxSpinelOutOfOrderTidCounter++;
|
||||
}
|
||||
|
||||
mNextExpectedTid = SPINEL_GET_NEXT_TID(tid);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -954,8 +965,6 @@ void NcpBase::HandleReceive(const uint8_t *buf, uint16_t bufLength)
|
||||
// `mDroppedReplyTid` (with value zero indicating that there
|
||||
// is no dropped reply).
|
||||
|
||||
tid = SPINEL_HEADER_GET_TID(header);
|
||||
|
||||
if (tid != 0)
|
||||
{
|
||||
if (mDroppedReplyTid == 0)
|
||||
@@ -2795,6 +2804,10 @@ ThreadError NcpBase::GetPropertyHandler_NCP_CNTR(uint8_t header, spinel_prop_key
|
||||
value = mRxSpinelFrameCounter;
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_CNTR_RX_SPINEL_OUT_OF_ORDER_TID:
|
||||
value = mRxSpinelOutOfOrderTidCounter;
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_CNTR_RX_SPINEL_ERR:
|
||||
value = mFramingErrorCounter;
|
||||
break;
|
||||
|
||||
@@ -519,6 +519,8 @@ private:
|
||||
|
||||
uint16_t mDroppedReplyTidBitSet;
|
||||
|
||||
spinel_tid_t mNextExpectedTid;
|
||||
|
||||
bool mAllowLocalNetworkDataChange;
|
||||
bool mRequireJoinExistingNetwork;
|
||||
bool mIsRawStreamEnabled;
|
||||
@@ -526,6 +528,7 @@ private:
|
||||
|
||||
uint32_t mFramingErrorCounter; // Number of improperly formed received spinel frames.
|
||||
uint32_t mRxSpinelFrameCounter; // Number of received (inbound) spinel frames.
|
||||
uint32_t mRxSpinelOutOfOrderTidCounter; // Number of out of order received spinel frames (tid increase > 1).
|
||||
uint32_t mTxSpinelFrameCounter; // Number of sent (outbound) spinel frames.
|
||||
uint32_t mInboundSecureIpFrameCounter; // Number of secure inbound data/IP frames.
|
||||
uint32_t mInboundInsecureIpFrameCounter; // Number of insecure inbound data/IP frames.
|
||||
|
||||
+4
-1
@@ -1019,7 +1019,10 @@ typedef enum
|
||||
/** Format: `L` (Read-only) */
|
||||
SPINEL_PROP_CNTR_RX_SPINEL_ERR = SPINEL_PROP_CNTR__BEGIN + 302,
|
||||
|
||||
|
||||
/// Number of out of order received spinel frames (tid increase by more than 1).
|
||||
/** Format: `L` (Read-only) */
|
||||
SPINEL_PROP_CNTR_RX_SPINEL_OUT_OF_ORDER_TID
|
||||
= SPINEL_PROP_CNTR__BEGIN + 303,
|
||||
|
||||
/// The message buffer counter info
|
||||
/** Format: `T(SSSSSSSSSSSSSSSS)` (Read-only)
|
||||
|
||||
Reference in New Issue
Block a user