mirror of
https://github.com/espressif/openthread.git
synced 2026-07-22 12:04:06 +00:00
add mac layer counter (#90)
* add mac layer counter * add more counters and Doxygen for MAC counters * have a seperate counter for acked data transmission and refine the code based on the comments * refine counters for acked and unacked transmissions * fix check test error * refine code style and use VerifyOrExit to exit * move all events tracker to tx/rx done task, and add more counters * fix other error counter * refine counters structure to be clearer * add Doxygen for the added thread errors * fix conflicts
This commit is contained in:
@@ -81,6 +81,36 @@ typedef enum ThreadError
|
||||
*/
|
||||
kThreadError_Detached = 18,
|
||||
|
||||
/**
|
||||
* FCS check failure while receiving.
|
||||
*/
|
||||
kThreadError_FcsErr = 19,
|
||||
|
||||
/**
|
||||
* No frame received.
|
||||
*/
|
||||
kThreadError_NoFrameReceived = 20,
|
||||
|
||||
/**
|
||||
* Received a frame from an unknown neighbor.
|
||||
*/
|
||||
kThreadError_UnknownNeighbor = 21,
|
||||
|
||||
/**
|
||||
* Received a frame from an invalid source address.
|
||||
*/
|
||||
kThreadError_InvalidSourceAddress = 22,
|
||||
|
||||
/**
|
||||
* Received a frame filtered by the whitelist.
|
||||
*/
|
||||
kThreadError_WhitelistFiltered = 23,
|
||||
|
||||
/**
|
||||
* Received a frame filtered by the destination address check.
|
||||
*/
|
||||
kThreadError_DestinationAddressFiltered = 24,
|
||||
|
||||
kThreadError_Error = 255,
|
||||
} ThreadError;
|
||||
|
||||
@@ -341,6 +371,38 @@ typedef enum
|
||||
kDeviceRoleLeader, ///< The Thread Leader role.
|
||||
} otDeviceRole;
|
||||
|
||||
/**
|
||||
* This structure represents the MAC layer counters.
|
||||
*/
|
||||
typedef struct otMacCounters
|
||||
{
|
||||
uint32_t mTxTotal; ///< The total number of transmissions.
|
||||
uint32_t mTxAckRequested; ///< The number of transmissions with ack request.
|
||||
uint32_t mTxAcked; ///< The number of transmissions that were acked.
|
||||
uint32_t mTxNoAckRequested; ///< The number of transmissions without ack request.
|
||||
uint32_t mTxData; ///< The number of transmitted data.
|
||||
uint32_t mTxDataPoll; ///< The number of transmitted data poll.
|
||||
uint32_t mTxBeacon; ///< The number of transmitted beacon.
|
||||
uint32_t mTxBeaconRequest; ///< The number of transmitted beacon request.
|
||||
uint32_t mTxOther; ///< The number of transmitted other types of frames.
|
||||
uint32_t mTxRetry; ///< The number of retransmission times.
|
||||
uint32_t mTxErrCca; ///< The number of CCA failure times.
|
||||
uint32_t mRxTotal; ///< The total number of received packets.
|
||||
uint32_t mRxData; ///< The number of received data.
|
||||
uint32_t mRxDataPoll; ///< The number of received data poll.
|
||||
uint32_t mRxBeacon; ///< The number of received beacon.
|
||||
uint32_t mRxBeaconRequest; ///< The number of received beacon request.
|
||||
uint32_t mRxOther; ///< The number of received other types of frames.
|
||||
uint32_t mRxWhitelistFiltered; ///< The number of received packets filtered by whitelist.
|
||||
uint32_t mRxDestAddrFiltered; ///< The number of received packets filtered by destination check.
|
||||
uint32_t mRxErrNoFrame; ///< The number of received packets that do not contain contents.
|
||||
uint32_t mRxErrUnknownNeighbor; ///< The number of recevied packets from unknown neighbor.
|
||||
uint32_t mRxErrInvalidSrcAddr; ///< The number of received packets whose source address is invalid.
|
||||
uint32_t mRxErrSec; ///< The number of recevied packets with security error.
|
||||
uint32_t mRxErrFcs; ///< The number of recevied packets with FCS error.
|
||||
uint32_t mRxErrOther; ///< The number of received packets with other error.
|
||||
} otMacCounters;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
@@ -901,6 +901,13 @@ bool otIsLinkPromiscuous(void);
|
||||
*/
|
||||
ThreadError otSetLinkPromiscuous(bool aPromiscuous);
|
||||
|
||||
/**
|
||||
* Get the MAC layer counters.
|
||||
*
|
||||
* @returns A pointer to the MAC layer counters.
|
||||
*/
|
||||
const otMacCounters *otGetMacCounters(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user