From 62678c2d5161c0d582ca4ef223580facd04b243b Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 24 Mar 2017 17:52:35 -0700 Subject: [PATCH] Update source address matching logs (#1514) This commit updates the source address matching feature's debug logs. It mainly adds a prefix of "SrcAddrMatch" to the log string. --- src/core/mac/mac.cpp | 27 +++++++++++++++++++-------- src/core/thread/mesh_forwarder.cpp | 1 - 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index ab52ac791..126e66230 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -1674,7 +1674,7 @@ otMacCounters &Mac::GetCounters(void) void Mac::EnableSrcMatch(bool aEnable) { otPlatRadioEnableSrcMatch(GetInstance(), aEnable); - otLogDebgMac(GetInstance(), "Enable SrcMatch -- %d(0:Dis, 1:En)", aEnable); + otLogDebgMac(GetInstance(), "SrcAddrMatch - %s", aEnable ? "Enabling" : "Disabling"); } ThreadError Mac::AddSrcMatchEntry(Address &aAddr) @@ -1684,7 +1684,9 @@ ThreadError Mac::AddSrcMatchEntry(Address &aAddr) if (aAddr.mLength == 2) { error = otPlatRadioAddSrcMatchShortEntry(GetInstance(), aAddr.mShortAddress); - otLogDebgMac(GetInstance(), "Adding short address: 0x%x -- %d (0:Ok, 3:NoBufs)", aAddr.mShortAddress, error); + + otLogDebgMac(GetInstance(), "SrcAddrMatch - Adding short address: 0x%04x -- %s (%d)", aAddr.mShortAddress, + otThreadErrorToString(error), error); } else { @@ -1696,8 +1698,11 @@ ThreadError Mac::AddSrcMatchEntry(Address &aAddr) } error = otPlatRadioAddSrcMatchExtEntry(GetInstance(), buf); - otLogDebgMac(GetInstance(), "Adding extended address: 0x%02x%02x%02x%02x%02x%02x%02x%02x -- %d (0:OK, 3:NoBufs)", - buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0], error); + + otLogDebgMac(GetInstance(), + "SrcAddrMatch - Adding extended address: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x -- %s (%d)", + buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0], otThreadErrorToString(error), + error); } return error; @@ -1710,7 +1715,9 @@ ThreadError Mac::ClearSrcMatchEntry(Address &aAddr) if (aAddr.mLength == 2) { error = otPlatRadioClearSrcMatchShortEntry(GetInstance(), aAddr.mShortAddress); - otLogDebgMac(GetInstance(), "Clearing short address: 0x%x -- %d (0:OK, 10:NoAddress)", aAddr.mShortAddress, error); + + otLogDebgMac(GetInstance(), "SrcAddrMatch - Clearing short address: 0x%04x -- %s (%d)", aAddr.mShortAddress, + otThreadErrorToString(error), error); } else { @@ -1722,8 +1729,11 @@ ThreadError Mac::ClearSrcMatchEntry(Address &aAddr) } error = otPlatRadioClearSrcMatchExtEntry(GetInstance(), buf); - otLogDebgMac(GetInstance(), "Clearing extended address: 0x%02x%02x%02x%02x%02x%02x%02x%02x -- %d (0:OK, 10:NoAddress)", - buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0], error); + + otLogDebgMac(GetInstance(), + "SrcAddrMatch - Clearing extended address: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x -- %s (%d)", + buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0], otThreadErrorToString(error), + error); } return error; @@ -1733,7 +1743,8 @@ void Mac::ClearSrcMatchEntries() { otPlatRadioClearSrcMatchShortEntries(GetInstance()); otPlatRadioClearSrcMatchExtEntries(GetInstance()); - otLogDebgMac(GetInstance(), "Clearing source match table"); + + otLogDebgMac(GetInstance(), "SrcAddrMatch - Cleared all entries"); } diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 87ea55d23..5c41c9778 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -401,7 +401,6 @@ exit: void MeshForwarder::ClearSrcMatchEntry(Child &aChild) { Mac::Address macAddr; - otLogDebgMac(GetInstance(), "SrcMatch %d (0:Dis, 1:En))", mSrcMatchEnabled); if (aChild.mAddSrcMatchEntryShort) {