From 3460029b99392a502fe923868a45ea589edbf781 Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Fri, 19 Jan 2024 13:16:51 +0530 Subject: [PATCH] Added fabric, secure channel and cluster specfic traces for better tracing. (#31238) * Added few secure channel CASE related traces * Added PASE related traces * Added some fabric related traces * Added cluster specific traces * Addressed review comments * Restlyed the code * Update src/credentials/FabricTable.cpp Co-authored-by: Shubham Patil --------- Co-authored-by: Shubham Patil --- .../administrator-commissioning-server.cpp | 4 ++++ .../basic-information/basic-information.cpp | 3 +++ ...ridged-device-basic-information-server.cpp | 2 ++ .../color-control-server.cpp | 10 ++++++++++ .../clusters/groups-server/groups-server.cpp | 7 +++++++ .../identify-server/identify-server.cpp | 3 +++ .../clusters/level-control/level-control.cpp | 9 +++++++++ .../low-power-server/low-power-server.cpp | 2 ++ .../mode-base-server/mode-base-server.cpp | 2 ++ .../mode-select-server/mode-select-server.cpp | 2 ++ .../clusters/on-off-server/on-off-server.cpp | 8 ++++++++ .../clusters/scenes-server/scenes-server.cpp | 11 +++++++++++ .../wifi-network-diagnostics-server.cpp | 4 ++++ src/credentials/BUILD.gn | 2 ++ src/credentials/FabricTable.cpp | 19 +++++++++++++++++++ src/protocols/secure_channel/CASEServer.cpp | 6 ++++++ src/protocols/secure_channel/CASESession.cpp | 8 ++++++++ src/protocols/secure_channel/PASESession.cpp | 5 ++++- src/tracing/esp32_trace/esp32_tracing.cpp | 16 ++++++++-------- 19 files changed, 114 insertions(+), 9 deletions(-) diff --git a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp index 81dd97503e36af..8189ae3d67ae12 100644 --- a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp +++ b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp @@ -35,6 +35,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -82,6 +83,7 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback( app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::OpenCommissioningWindow::DecodableType & commandData) { + MATTER_TRACE_SCOPE("OpenCommissioningWindow", "AdministratorCommissioning"); auto commissioningTimeout = System::Clock::Seconds16(commandData.commissioningTimeout); auto & pakeVerifier = commandData.PAKEPasscodeVerifier; auto & discriminator = commandData.discriminator; @@ -141,6 +143,7 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::OpenBasicCommissioningWindow::DecodableType & commandData) { + MATTER_TRACE_SCOPE("OpenBasicCommissioningWindow", "AdministratorCommissioning"); auto commissioningTimeout = System::Clock::Seconds16(commandData.commissioningTimeout); Optional status = Optional::Missing(); @@ -187,6 +190,7 @@ bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback( app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::RevokeCommissioning::DecodableType & commandData) { + MATTER_TRACE_SCOPE("RevokeCommissioning", "AdministratorCommissioning"); ChipLogProgress(Zcl, "Received command to close commissioning window"); Server::GetInstance().GetFailSafeContext().ForceFailSafeTimerExpiry(); diff --git a/src/app/clusters/basic-information/basic-information.cpp b/src/app/clusters/basic-information/basic-information.cpp index 510e4991b25bae..f241bb2cf5a008 100644 --- a/src/app/clusters/basic-information/basic-information.cpp +++ b/src/app/clusters/basic-information/basic-information.cpp @@ -33,6 +33,7 @@ #include #include +#include using namespace chip; using namespace chip::app; @@ -410,6 +411,7 @@ class PlatformMgrDelegate : public DeviceLayer::PlatformManagerDelegate { void OnStartUp(uint32_t softwareVersion) override { + MATTER_TRACE_INSTANT("OnStartUp", "BasicInfo"); // The StartUp event SHALL be emitted by a Node after completing a boot or reboot process ChipLogDetail(Zcl, "Emitting StartUp event"); @@ -429,6 +431,7 @@ class PlatformMgrDelegate : public DeviceLayer::PlatformManagerDelegate void OnShutDown() override { + MATTER_TRACE_INSTANT("OnShutDown", "BasicInfo"); // The ShutDown event SHOULD be emitted on a best-effort basis by a Node prior to any orderly shutdown sequence. ChipLogDetail(Zcl, "Emitting ShutDown event"); diff --git a/src/app/clusters/bridged-device-basic-information-server/bridged-device-basic-information-server.cpp b/src/app/clusters/bridged-device-basic-information-server/bridged-device-basic-information-server.cpp index a8785abd516954..0f4137f07b2a1d 100644 --- a/src/app/clusters/bridged-device-basic-information-server/bridged-device-basic-information-server.cpp +++ b/src/app/clusters/bridged-device-basic-information-server/bridged-device-basic-information-server.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -36,6 +37,7 @@ namespace { void ReachableChanged(EndpointId endpointId) { + MATTER_TRACE_INSTANT("ReachableChanged", "BridgeBasicInfo"); bool reachable = false; if (EMBER_ZCL_STATUS_SUCCESS != Attributes::Reachable::Get(endpointId, &reachable)) { diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index cb0d7e5be78605..a21a44ada8d23f 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef EMBER_AF_PLUGIN_SCENES_MANAGEMENT #include @@ -1354,6 +1355,7 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const HueMoveMode moveMode, uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride, bool isEnhanced) { + MATTER_TRACE_SCOPE("moveHue", "ColorControl"); EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); @@ -1459,6 +1461,7 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons uint16_t hue, HueDirection moveDirection, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride, bool isEnhanced) { + MATTER_TRACE_SCOPE("moveToHue", "ColorControl"); EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; @@ -1593,6 +1596,7 @@ bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * com uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride, bool isEnhanced) { + MATTER_TRACE_SCOPE("moveToHueAndSaturation", "ColorControl"); // limit checking: hue and saturation are 0..254. Spec dictates we ignore // this and report a constraint error. if ((!isEnhanced && hue > MAX_HUE_VALUE) || saturation > MAX_SATURATION_VALUE) @@ -1632,6 +1636,7 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const HueStepMode stepMode, uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride, bool isEnhanced) { + MATTER_TRACE_SCOPE("stepHue", "ColorControl"); EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; @@ -1715,6 +1720,7 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::MoveSaturation::DecodableType & commandData) { + MATTER_TRACE_SCOPE("moveSaturation", "ColorControl"); auto & moveMode = commandData.moveMode; auto & rate = commandData.rate; auto & optionsMask = commandData.optionsMask; @@ -1798,6 +1804,7 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj, bool ColorControlServer::moveToSaturationCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::MoveToSaturation::DecodableType & commandData) { + MATTER_TRACE_SCOPE("moveToSaturation", "ColorControl"); // limit checking: saturation is 0..254. Spec dictates we ignore // this and report a malformed packet. if (commandData.saturation > MAX_SATURATION_VALUE) @@ -1822,6 +1829,7 @@ bool ColorControlServer::moveToSaturationCommand(app::CommandHandler * commandOb bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::StepSaturation::DecodableType & commandData) { + MATTER_TRACE_SCOPE("stepSaturation", "ColorControl"); auto stepMode = commandData.stepMode; uint8_t stepSize = commandData.stepSize; uint8_t transitionTime = commandData.transitionTime; @@ -1885,6 +1893,7 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj, bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::ColorLoopSet::DecodableType & commandData) { + MATTER_TRACE_SCOPE("colorLoop", "ColorControl"); auto updateFlags = commandData.updateFlags; auto action = commandData.action; auto direction = commandData.direction; @@ -2010,6 +2019,7 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons */ void ColorControlServer::updateHueSatCommand(EndpointId endpoint) { + MATTER_TRACE_SCOPE("updateHueSat", "ColorControl"); ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState(endpoint); diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index 4ab5fa24ee577e..a6d502acb18e52 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef EMBER_AF_PLUGIN_SCENES_MANAGEMENT #include @@ -141,6 +142,7 @@ void emberAfGroupsClusterServerInitCallback(EndpointId endpointId) bool emberAfGroupsClusterAddGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::AddGroup::DecodableType & commandData) { + MATTER_TRACE_SCOPE("AddGroup", "Groups"); auto fabricIndex = commandObj->GetAccessingFabricIndex(); Groups::Commands::AddGroupResponse::Type response; @@ -153,6 +155,7 @@ bool emberAfGroupsClusterAddGroupCallback(app::CommandHandler * commandObj, cons bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::ViewGroup::DecodableType & commandData) { + MATTER_TRACE_SCOPE("ViewGroup", "Groups"); auto fabricIndex = commandObj->GetAccessingFabricIndex(); auto groupId = commandData.groupID; GroupDataProvider * provider = GetGroupDataProvider(); @@ -255,6 +258,7 @@ struct GroupMembershipResponse bool emberAfGroupsClusterGetGroupMembershipCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::GetGroupMembership::DecodableType & commandData) { + MATTER_TRACE_SCOPE("GetGroupMembership", "Groups"); auto fabricIndex = commandObj->GetAccessingFabricIndex(); auto * provider = GetGroupDataProvider(); Status status = Status::Failure; @@ -284,6 +288,7 @@ bool emberAfGroupsClusterGetGroupMembershipCallback(app::CommandHandler * comman bool emberAfGroupsClusterRemoveGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::RemoveGroup::DecodableType & commandData) { + MATTER_TRACE_SCOPE("RemoveGroup", "Groups"); auto fabricIndex = commandObj->GetAccessingFabricIndex(); Groups::Commands::RemoveGroupResponse::Type response; @@ -301,6 +306,7 @@ bool emberAfGroupsClusterRemoveGroupCallback(app::CommandHandler * commandObj, c bool emberAfGroupsClusterRemoveAllGroupsCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::RemoveAllGroups::DecodableType & commandData) { + MATTER_TRACE_SCOPE("RemoveAllGroups", "Groups"); auto fabricIndex = commandObj->GetAccessingFabricIndex(); auto * provider = GetGroupDataProvider(); Status status = Status::Failure; @@ -342,6 +348,7 @@ bool emberAfGroupsClusterAddGroupIfIdentifyingCallback(app::CommandHandler * com const app::ConcreteCommandPath & commandPath, const Commands::AddGroupIfIdentifying::DecodableType & commandData) { + MATTER_TRACE_SCOPE("AddGroupIfIdentifying", "Groups"); auto fabricIndex = commandObj->GetAccessingFabricIndex(); auto groupId = commandData.groupID; auto groupName = commandData.groupName; diff --git a/src/app/clusters/identify-server/identify-server.cpp b/src/app/clusters/identify-server/identify-server.cpp index e60b89d7d6931b..55a0e15ee59c2f 100644 --- a/src/app/clusters/identify-server/identify-server.cpp +++ b/src/app/clusters/identify-server/identify-server.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #if CHIP_DEVICE_LAYER_NONE #error "identify requrires a device layer" @@ -196,6 +197,7 @@ void MatterIdentifyClusterServerAttributeChangedCallback(const app::ConcreteAttr bool emberAfIdentifyClusterIdentifyCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::Identify::DecodableType & commandData) { + MATTER_TRACE_SCOPE("IdentifyCommand", "Identify"); auto & identifyTime = commandData.identifyTime; // cmd Identify @@ -207,6 +209,7 @@ bool emberAfIdentifyClusterIdentifyCallback(CommandHandler * commandObj, const C bool emberAfIdentifyClusterTriggerEffectCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::TriggerEffect::DecodableType & commandData) { + MATTER_TRACE_SCOPE("TriggerEffect", "Identify"); auto & effectIdentifier = commandData.effectIdentifier; auto & effectVariant = commandData.effectVariant; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index ba22be03055886..f3f31d58982d93 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef EMBER_AF_PLUGIN_SCENES_MANAGEMENT #include @@ -577,6 +578,7 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, chip::O bool emberAfLevelControlClusterMoveToLevelCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::MoveToLevel::DecodableType & commandData) { + MATTER_TRACE_SCOPE("MoveToLevel", "LevelControl"); commandObj->AddStatus(commandPath, LevelControlServer::MoveToLevel(commandPath.mEndpointId, commandData)); return true; } @@ -621,6 +623,7 @@ bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler const app::ConcreteCommandPath & commandPath, const Commands::MoveToLevelWithOnOff::DecodableType & commandData) { + MATTER_TRACE_SCOPE("MoveToLevelWithOnOff", "LevelControl"); auto & level = commandData.level; auto & transitionTime = commandData.transitionTime; auto & optionsMask = commandData.optionsMask; @@ -650,6 +653,7 @@ bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::Move::DecodableType & commandData) { + MATTER_TRACE_SCOPE("Move", "LevelControl"); auto & moveMode = commandData.moveMode; auto & rate = commandData.rate; auto & optionsMask = commandData.optionsMask; @@ -674,6 +678,7 @@ bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, co bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::MoveWithOnOff::DecodableType & commandData) { + MATTER_TRACE_SCOPE("MoveWithOnOff", "LevelControl"); auto & moveMode = commandData.moveMode; auto & rate = commandData.rate; auto & optionsMask = commandData.optionsMask; @@ -698,6 +703,7 @@ bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * comma bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::Step::DecodableType & commandData) { + MATTER_TRACE_SCOPE("Step", "LevelControl"); auto & stepMode = commandData.stepMode; auto & stepSize = commandData.stepSize; auto & transitionTime = commandData.transitionTime; @@ -723,6 +729,7 @@ bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, co bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::StepWithOnOff::DecodableType & commandData) { + MATTER_TRACE_SCOPE("StepWithOnOff", "LevelControl"); auto & stepMode = commandData.stepMode; auto & stepSize = commandData.stepSize; auto & transitionTime = commandData.transitionTime; @@ -748,6 +755,7 @@ bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * comma bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::Stop::DecodableType & commandData) { + MATTER_TRACE_SCOPE("Stop", "LevelControl"); auto & optionsMask = commandData.optionsMask; auto & optionsOverride = commandData.optionsOverride; @@ -760,6 +768,7 @@ bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, co bool emberAfLevelControlClusterStopWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::StopWithOnOff::DecodableType & commandData) { + MATTER_TRACE_SCOPE("StopWithOnOff", "LevelControl"); auto & optionsMask = commandData.optionsMask; auto & optionsOverride = commandData.optionsOverride; ChipLogProgress(Zcl, "%s STOP_WITH_ON_OFF", "RX level-control:"); diff --git a/src/app/clusters/low-power-server/low-power-server.cpp b/src/app/clusters/low-power-server/low-power-server.cpp index 5881d2e56fc322..4e8b10e8f082ea 100644 --- a/src/app/clusters/low-power-server/low-power-server.cpp +++ b/src/app/clusters/low-power-server/low-power-server.cpp @@ -31,6 +31,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app::Clusters; @@ -93,6 +94,7 @@ void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) bool emberAfLowPowerClusterSleepCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, const Commands::Sleep::DecodableType & commandData) { + MATTER_TRACE_SCOPE("Sleep", "LowPower"); using Protocols::InteractionModel::Status; EndpointId endpoint = commandPath.mEndpointId; diff --git a/src/app/clusters/mode-base-server/mode-base-server.cpp b/src/app/clusters/mode-base-server/mode-base-server.cpp index 28d958d25f2651..1d01c10c718ac2 100644 --- a/src/app/clusters/mode-base-server/mode-base-server.cpp +++ b/src/app/clusters/mode-base-server/mode-base-server.cpp @@ -24,6 +24,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -378,6 +379,7 @@ void Instance::UnregisterThisInstance() void Instance::HandleChangeToMode(HandlerContext & ctx, const Commands::ChangeToMode::DecodableType & commandData) { + MATTER_TRACE_SCOPE("ChangeToMode", "ModeBase"); uint8_t newMode = commandData.newMode; Commands::ChangeToModeResponse::Type response; diff --git a/src/app/clusters/mode-select-server/mode-select-server.cpp b/src/app/clusters/mode-select-server/mode-select-server.cpp index 2c9d88c1872737..4ca641e8e48d95 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef EMBER_AF_PLUGIN_ON_OFF #include @@ -98,6 +99,7 @@ CHIP_ERROR ModeSelectAttrAccess::Read(const ConcreteReadAttributePath & aPath, A bool emberAfModeSelectClusterChangeToModeCallback(CommandHandler * commandHandler, const ConcreteCommandPath & commandPath, const ModeSelect::Commands::ChangeToMode::DecodableType & commandData) { + MATTER_TRACE_SCOPE("ChangeToMode", "ModeSelect"); ChipLogProgress(Zcl, "ModeSelect: Entering emberAfModeSelectClusterChangeToModeCallback"); EndpointId endpointId = commandPath.mEndpointId; uint8_t newMode = commandData.newMode; diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index eb867fb4ef893c..ea7dd0786a9917 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef EMBER_AF_PLUGIN_SCENES_MANAGEMENT #include @@ -341,6 +342,7 @@ EmberAfStatus OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * curre */ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, bool initiatedByLevelChange) { + MATTER_TRACE_SCOPE("setOnOffValue", "OnOff"); EmberAfStatus status; bool currentValue, newValue; @@ -568,6 +570,7 @@ EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bo bool OnOffServer::offCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { + MATTER_TRACE_SCOPE("OffCommand", "OnOff"); EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Off::Id, false); commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status)); @@ -576,6 +579,7 @@ bool OnOffServer::offCommand(app::CommandHandler * commandObj, const app::Concre bool OnOffServer::onCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { + MATTER_TRACE_SCOPE("OnCommand", "OnOff"); EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::On::Id, false); commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status)); @@ -584,6 +588,7 @@ bool OnOffServer::onCommand(app::CommandHandler * commandObj, const app::Concret bool OnOffServer::toggleCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { + MATTER_TRACE_SCOPE("ToggleCommand", "OnOff"); EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Toggle::Id, false); commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status)); @@ -593,6 +598,7 @@ bool OnOffServer::toggleCommand(app::CommandHandler * commandObj, const app::Con bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::OffWithEffect::DecodableType & commandData) { + MATTER_TRACE_SCOPE("offWithEffectCommand", "OnOff"); auto effectId = commandData.effectIdentifier; auto effectVariant = commandData.effectVariant; chip::EndpointId endpoint = commandPath.mEndpointId; @@ -650,6 +656,7 @@ bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const a bool OnOffServer::OnWithRecallGlobalSceneCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { + MATTER_TRACE_SCOPE("OnWithRecallGlobalSceneCommand", "OnOff"); chip::EndpointId endpoint = commandPath.mEndpointId; if (!SupportsLightingApplications(endpoint)) @@ -711,6 +718,7 @@ uint32_t OnOffServer::calculateNextWaitTimeMS() bool OnOffServer::OnWithTimedOffCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::OnWithTimedOff::DecodableType & commandData) { + MATTER_TRACE_SCOPE("OnWithTimedOffCommand", "OnOff"); BitFlags onOffControl = commandData.onOffControl; uint16_t onTime = commandData.onTime; uint16_t offWaitTime = commandData.offWaitTime; diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp index 29dbab3b119cf9..05e8ec8addb23d 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -31,6 +31,7 @@ #include #include #include +#include using SceneTableEntry = chip::scenes::DefaultSceneTableImpl::SceneTableEntry; using SceneStorageId = chip::scenes::DefaultSceneTableImpl::SceneStorageId; @@ -812,16 +813,19 @@ void ScenesServer::RemoveFabric(EndpointId aEndpointId, FabricIndex aFabricIndex void ScenesServer::HandleAddScene(HandlerContext & ctx, const Commands::AddScene::DecodableType & req) { + MATTER_TRACE_SCOPE("AddScene", "Scenes"); AddSceneParse(ctx, req, mGroupProvider); } void ScenesServer::HandleViewScene(HandlerContext & ctx, const Commands::ViewScene::DecodableType & req) { + MATTER_TRACE_SCOPE("ViewScene", "Scenes"); ViewSceneParse(ctx, req, mGroupProvider); } void ScenesServer::HandleRemoveScene(HandlerContext & ctx, const Commands::RemoveScene::DecodableType & req) { + MATTER_TRACE_SCOPE("RemoveScene", "Scenes"); Commands::RemoveSceneResponse::Type response; uint16_t endpointTableSize = 0; @@ -878,6 +882,7 @@ void ScenesServer::HandleRemoveScene(HandlerContext & ctx, const Commands::Remov void ScenesServer::HandleRemoveAllScenes(HandlerContext & ctx, const Commands::RemoveAllScenes::DecodableType & req) { + MATTER_TRACE_SCOPE("RemoveAllScenes", "Scenes"); Commands::RemoveAllScenesResponse::Type response; uint16_t endpointTableSize = 0; @@ -927,6 +932,7 @@ void ScenesServer::HandleRemoveAllScenes(HandlerContext & ctx, const Commands::R void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreScene::DecodableType & req) { + MATTER_TRACE_SCOPE("StoreScene", "Scenes"); Commands::StoreSceneResponse::Type response; // Response data @@ -947,6 +953,7 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS void ScenesServer::HandleRecallScene(HandlerContext & ctx, const Commands::RecallScene::DecodableType & req) { + MATTER_TRACE_SCOPE("RecallScene", "Scenes"); CHIP_ERROR err = RecallSceneParse(ctx.mCommandHandler.GetAccessingFabricIndex(), ctx.mRequestPath.mEndpointId, req.groupID, req.sceneID, req.transitionTime, mGroupProvider); @@ -968,6 +975,7 @@ void ScenesServer::HandleRecallScene(HandlerContext & ctx, const Commands::Recal void ScenesServer::HandleGetSceneMembership(HandlerContext & ctx, const Commands::GetSceneMembership::DecodableType & req) { + MATTER_TRACE_SCOPE("GetSceneMembership", "Scenes"); Commands::GetSceneMembershipResponse::Type response; uint16_t endpointTableSize = 0; @@ -1014,15 +1022,18 @@ void ScenesServer::HandleGetSceneMembership(HandlerContext & ctx, const Commands void ScenesServer::HandleEnhancedAddScene(HandlerContext & ctx, const Commands::EnhancedAddScene::DecodableType & req) { + MATTER_TRACE_SCOPE("EnhancedAddScene", "Scenes"); AddSceneParse(ctx, req, mGroupProvider); } void ScenesServer::HandleEnhancedViewScene(HandlerContext & ctx, const Commands::EnhancedViewScene::DecodableType & req) { + MATTER_TRACE_SCOPE("EnhancedViewScene", "Scenes"); ViewSceneParse(ctx, req, mGroupProvider); } void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopyScene::DecodableType & req) { + MATTER_TRACE_SCOPE("CopyScene", "Scenes"); Commands::CopySceneResponse::Type response; uint16_t endpointTableSize = 0; diff --git a/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp b/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp index 52a98d7b157b82..bd02f36d731cf2 100644 --- a/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp +++ b/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp @@ -27,6 +27,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -242,6 +243,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate // Gets called when the Node detects Node’s Wi-Fi connection has been disconnected. void OnDisconnectionDetected(uint16_t reasonCode) override { + MATTER_TRACE_SCOPE("OnDisconnectionDetected", "WiFiDiagnosticsDelegate"); ChipLogProgress(Zcl, "WiFiDiagnosticsDelegate: OnDisconnectionDetected"); for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id)) @@ -260,6 +262,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate // Gets called when the Node fails to associate or authenticate an access point. void OnAssociationFailureDetected(uint8_t associationFailureCause, uint16_t status) override { + MATTER_TRACE_SCOPE("OnAssociationFailureDetected", "WiFiDiagnosticsDelegate"); ChipLogProgress(Zcl, "WiFiDiagnosticsDelegate: OnAssociationFailureDetected"); Events::AssociationFailure::Type event{ static_cast(associationFailureCause), status }; @@ -279,6 +282,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate // Gets when the Node’s connection status to a Wi-Fi network has changed. void OnConnectionStatusChanged(uint8_t connectionStatus) override { + MATTER_TRACE_SCOPE("OnConnectionStatusChanged", "WiFiDiagnosticsDelegate"); ChipLogProgress(Zcl, "WiFiDiagnosticsDelegate: OnConnectionStatusChanged"); Events::ConnectionStatus::Type event{ static_cast(connectionStatus) }; diff --git a/src/credentials/BUILD.gn b/src/credentials/BUILD.gn index 0e23eb497cf702..6aa10311560fa5 100644 --- a/src/credentials/BUILD.gn +++ b/src/credentials/BUILD.gn @@ -128,6 +128,8 @@ static_library("credentials") { "${chip_root}/src/lib/support", "${chip_root}/src/platform", "${chip_root}/src/protocols:type_definitions", + "${chip_root}/src/tracing", + "${chip_root}/src/tracing:macros", "${nlassert_root}:nlassert", ] } diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index 0091fdec291c30..ade5189a738f27 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace chip { using namespace Credentials; @@ -279,6 +280,7 @@ CHIP_ERROR FabricTable::ValidateIncomingNOCChain(const ByteSpan & noc, const Byt NodeId & outNodeId, Crypto::P256PublicKey & outNocPubkey, Crypto::P256PublicKey & outRootPubkey) { + MATTER_TRACE_SCOPE("ValidateIncomingNOCChain", "Fabric"); Credentials::ValidationContext validContext; // Note that we do NOT set a time in the validation context. This will @@ -328,6 +330,7 @@ CHIP_ERROR FabricTable::ValidateIncomingNOCChain(const ByteSpan & noc, const Byt CHIP_ERROR FabricInfo::SignWithOpKeypair(ByteSpan message, P256ECDSASignature & outSignature) const { + MATTER_TRACE_SCOPE("SignWithOpKeypair", "Fabric"); VerifyOrReturnError(mOperationalKey != nullptr, CHIP_ERROR_KEY_NOT_FOUND); return mOperationalKey->ECDSA_sign_msg(message.data(), message.size(), outSignature); @@ -335,6 +338,7 @@ CHIP_ERROR FabricInfo::SignWithOpKeypair(ByteSpan message, P256ECDSASignature & CHIP_ERROR FabricInfo::FetchRootPubkey(Crypto::P256PublicKey & outPublicKey) const { + MATTER_TRACE_SCOPE("FetchRootPubKey", "Fabric"); VerifyOrReturnError(IsInitialized(), CHIP_ERROR_KEY_NOT_FOUND); outPublicKey = mRootPublicKey; return CHIP_NO_ERROR; @@ -345,6 +349,7 @@ CHIP_ERROR FabricTable::VerifyCredentials(FabricIndex fabricIndex, const ByteSpa FabricId & outFabricId, NodeId & outNodeId, Crypto::P256PublicKey & outNocPubkey, Crypto::P256PublicKey * outRootPublicKey) const { + MATTER_TRACE_SCOPE("VerifyCredentials", "Fabric"); assertChipStackLockedByCurrentThread(); uint8_t rootCertBuf[kMaxCHIPCertLength]; MutableByteSpan rootCertSpan{ rootCertBuf }; @@ -562,12 +567,14 @@ const FabricInfo * FabricTable::FindFabricWithCompressedId(CompressedFabricId co CHIP_ERROR FabricTable::FetchRootCert(FabricIndex fabricIndex, MutableByteSpan & outCert) const { + MATTER_TRACE_SCOPE("FetchRootCert", "Fabric"); VerifyOrReturnError(mOpCertStore != nullptr, CHIP_ERROR_INCORRECT_STATE); return mOpCertStore->GetCertificate(fabricIndex, CertChainElement::kRcac, outCert); } CHIP_ERROR FabricTable::FetchPendingNonFabricAssociatedRootCert(MutableByteSpan & outCert) const { + MATTER_TRACE_SCOPE("FetchPendingNonFabricAssociatedRootCert", "Fabric"); VerifyOrReturnError(mOpCertStore != nullptr, CHIP_ERROR_INCORRECT_STATE); if (!mStateFlags.Has(StateFlags::kIsTrustedRootPending)) { @@ -586,6 +593,7 @@ CHIP_ERROR FabricTable::FetchPendingNonFabricAssociatedRootCert(MutableByteSpan CHIP_ERROR FabricTable::FetchICACert(FabricIndex fabricIndex, MutableByteSpan & outCert) const { + MATTER_TRACE_SCOPE("FetchICACert", "Fabric"); VerifyOrReturnError(mOpCertStore != nullptr, CHIP_ERROR_INCORRECT_STATE); CHIP_ERROR err = mOpCertStore->GetCertificate(fabricIndex, CertChainElement::kIcac, outCert); @@ -605,12 +613,14 @@ CHIP_ERROR FabricTable::FetchICACert(FabricIndex fabricIndex, MutableByteSpan & CHIP_ERROR FabricTable::FetchNOCCert(FabricIndex fabricIndex, MutableByteSpan & outCert) const { + MATTER_TRACE_SCOPE("FetchNOCCert", "Fabric"); VerifyOrReturnError(mOpCertStore != nullptr, CHIP_ERROR_INCORRECT_STATE); return mOpCertStore->GetCertificate(fabricIndex, CertChainElement::kNoc, outCert); } CHIP_ERROR FabricTable::FetchRootPubkey(FabricIndex fabricIndex, Crypto::P256PublicKey & outPublicKey) const { + MATTER_TRACE_SCOPE("FetchRootPubkey", "Fabric"); const FabricInfo * fabricInfo = FindFabricWithIndex(fabricIndex); ReturnErrorCodeIf(fabricInfo == nullptr, CHIP_ERROR_INVALID_FABRIC_INDEX); return fabricInfo->FetchRootPubkey(outPublicKey); @@ -747,6 +757,7 @@ class NotBeforeCollector : public Credentials::CertificateValidityPolicy CHIP_ERROR FabricTable::NotifyFabricUpdated(FabricIndex fabricIndex) { + MATTER_TRACE_SCOPE("NotifyFabricUpdated", "Fabric"); FabricTable::Delegate * delegate = mDelegateListRoot; while (delegate) { @@ -761,6 +772,8 @@ CHIP_ERROR FabricTable::NotifyFabricUpdated(FabricIndex fabricIndex) CHIP_ERROR FabricTable::NotifyFabricCommitted(FabricIndex fabricIndex) { + MATTER_TRACE_SCOPE("NotifyFabricCommitted", "Fabric"); + FabricTable::Delegate * delegate = mDelegateListRoot; while (delegate) { @@ -919,6 +932,7 @@ FabricTable::AddOrUpdateInner(FabricIndex fabricIndex, bool isAddition, Crypto:: CHIP_ERROR FabricTable::Delete(FabricIndex fabricIndex) { + MATTER_TRACE_SCOPE("Delete", "Fabric"); VerifyOrReturnError(mStorage != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(IsValidFabricIndex(fabricIndex), CHIP_ERROR_INVALID_ARGUMENT); @@ -1608,6 +1622,7 @@ CHIP_ERROR FabricTable::AddNewPendingTrustedRootCert(const ByteSpan & rcac) CHIP_ERROR FabricTable::FindExistingFabricByNocChaining(FabricIndex pendingFabricIndex, const ByteSpan & noc, FabricIndex & outMatchingFabricIndex) const { + MATTER_TRACE_SCOPE("FindExistingFabricByNocChaining", "Fabric"); // Check whether we already have a matching fabric from a cert chain perspective. // To do so we have to extract the FabricID from the NOC and the root public key from the RCAC. // We assume the RCAC is currently readable from OperationalCertificateStore, whether pending @@ -1653,6 +1668,7 @@ CHIP_ERROR FabricTable::AddNewPendingFabricCommon(const ByteSpan & noc, const By Crypto::P256Keypair * existingOpKey, bool isExistingOpKeyExternallyOwned, AdvertiseIdentity advertiseIdentity, FabricIndex * outNewFabricIndex) { + MATTER_TRACE_SCOPE("AddNewPendingFabricCommon", "Fabric"); VerifyOrReturnError(mOpCertStore != nullptr, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(outNewFabricIndex != nullptr, CHIP_ERROR_INVALID_ARGUMENT); static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); @@ -1724,6 +1740,7 @@ CHIP_ERROR FabricTable::UpdatePendingFabricCommon(FabricIndex fabricIndex, const Crypto::P256Keypair * existingOpKey, bool isExistingOpKeyExternallyOwned, AdvertiseIdentity advertiseIdentity) { + MATTER_TRACE_SCOPE("UpdatePendingFabricCommon", "Fabric"); VerifyOrReturnError(mOpCertStore != nullptr, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(IsValidFabricIndex(fabricIndex), CHIP_ERROR_INVALID_ARGUMENT); @@ -2009,6 +2026,7 @@ CHIP_ERROR FabricTable::CommitPendingFabricData() void FabricTable::RevertPendingFabricData() { + MATTER_TRACE_SCOPE("RevertPendingFabricData", "Fabric"); // Will clear pending UpdateNoc/AddNOC RevertPendingOpCertsExceptRoot(); @@ -2031,6 +2049,7 @@ void FabricTable::RevertPendingFabricData() void FabricTable::RevertPendingOpCertsExceptRoot() { + MATTER_TRACE_SCOPE("RevertPendingOpCertsExceptRoot", "Fabric"); mPendingFabric.Reset(); if (mStateFlags.Has(StateFlags::kIsPendingFabricDataPresent)) diff --git a/src/protocols/secure_channel/CASEServer.cpp b/src/protocols/secure_channel/CASEServer.cpp index f8d580fdd9957b..d701d8c568c584 100644 --- a/src/protocols/secure_channel/CASEServer.cpp +++ b/src/protocols/secure_channel/CASEServer.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include using namespace ::chip::Inet; @@ -58,6 +59,7 @@ CHIP_ERROR CASEServer::ListenForSessionEstablishment(Messaging::ExchangeManager CHIP_ERROR CASEServer::InitCASEHandshake(Messaging::ExchangeContext * ec) { + MATTER_TRACE_SCOPE("InitCASEHandshake", "CASEServer"); ReturnErrorCodeIf(ec == nullptr, CHIP_ERROR_INVALID_ARGUMENT); // Hand over the exchange context to the CASE session. @@ -76,6 +78,7 @@ CHIP_ERROR CASEServer::OnUnsolicitedMessageReceived(const PayloadHeader & payloa CHIP_ERROR CASEServer::OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, System::PacketBufferHandle && payload) { + MATTER_TRACE_SCOPE("OnMessageReceived", "CASEServer"); if (GetSession().GetState() != CASESession::State::kInitialized) { // We are in the middle of CASE handshake @@ -177,6 +180,7 @@ void CASEServer::PrepareForSessionEstablishment(const ScopedNodeId & previouslyE void CASEServer::OnSessionEstablishmentError(CHIP_ERROR err) { + MATTER_TRACE_SCOPE("OnSessionEstablishmentError", "CASEServer"); ChipLogError(Inet, "CASE Session establishment failed: %" CHIP_ERROR_FORMAT, err.Format()); PrepareForSessionEstablishment(); @@ -184,6 +188,7 @@ void CASEServer::OnSessionEstablishmentError(CHIP_ERROR err) void CASEServer::OnSessionEstablished(const SessionHandle & session) { + MATTER_TRACE_SCOPE("OnSessionEstablished", "CASEServer"); ChipLogProgress(Inet, "CASE Session established to peer: " ChipLogFormatScopedNodeId, ChipLogValueScopedNodeId(session->GetPeer())); PrepareForSessionEstablishment(session->GetPeer()); @@ -191,6 +196,7 @@ void CASEServer::OnSessionEstablished(const SessionHandle & session) CHIP_ERROR CASEServer::SendBusyStatusReport(Messaging::ExchangeContext * ec, System::Clock::Milliseconds16 minimumWaitTime) { + MATTER_TRACE_SCOPE("SendBusyStatusReport", "CASEServer"); ChipLogProgress(Inet, "Already in the middle of CASE handshake, sending busy status report"); System::PacketBufferHandle handle = Protocols::SecureChannel::StatusReport::MakeBusyStatusReportMessage(minimumWaitTime); diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index 296ba0848150c7..8573d1565686fe 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -386,6 +386,7 @@ void CASESession::OnSessionReleased() void CASESession::Clear() { + MATTER_TRACE_SCOPE("Clear", "CASESession"); // Cancel any outstanding work. if (mSendSigma3Helper) { @@ -436,6 +437,7 @@ void CASESession::InvalidateIfPendingEstablishmentOnFabric(FabricIndex fabricInd CHIP_ERROR CASESession::Init(SessionManager & sessionManager, Credentials::CertificateValidityPolicy * policy, SessionEstablishmentDelegate * delegate, const ScopedNodeId & sessionEvictionHint) { + MATTER_TRACE_SCOPE("Init", "CASESession"); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(mGroupDataProvider != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(sessionManager.GetSessionKeystore() != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -462,6 +464,7 @@ CASESession::PrepareForSessionEstablishment(SessionManager & sessionManager, Fab SessionEstablishmentDelegate * delegate, const ScopedNodeId & previouslyEstablishedPeer, Optional mrpLocalConfig) { + MATTER_TRACE_SCOPE("PrepareForSessionEstablishment", "CASESession"); // Below VerifyOrReturnError is not SuccessOrExit since we only want to goto `exit:` after // Init has been successfully called. VerifyOrReturnError(fabricTable != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -544,6 +547,7 @@ CHIP_ERROR CASESession::EstablishSession(SessionManager & sessionManager, Fabric void CASESession::OnResponseTimeout(ExchangeContext * ec) { + MATTER_TRACE_SCOPE("OnResponseTimeout", "CASESession"); VerifyOrReturn(ec != nullptr, ChipLogError(SecureChannel, "CASESession::OnResponseTimeout was called by null exchange")); VerifyOrReturn(mExchangeCtxt == ec, ChipLogError(SecureChannel, "CASESession::OnResponseTimeout exchange doesn't match")); ChipLogError(SecureChannel, "CASESession timed out while waiting for a response from the peer. Current state was %u", @@ -556,6 +560,7 @@ void CASESession::OnResponseTimeout(ExchangeContext * ec) void CASESession::AbortPendingEstablish(CHIP_ERROR err) { + MATTER_TRACE_SCOPE("AbortPendingEstablish", "CASESession"); // This needs to come before Clear() which will reset mState. SessionEstablishmentStage state = MapCASEStateToSessionEstablishmentStage(mState); Clear(); @@ -751,6 +756,7 @@ CHIP_ERROR CASESession::HandleSigma1_and_SendSigma2(System::PacketBufferHandle & CHIP_ERROR CASESession::FindLocalNodeFromDestinationId(const ByteSpan & destinationId, const ByteSpan & initiatorRandom) { + MATTER_TRACE_SCOPE("FindLocalNodeFromDestinationId", "CASESession"); VerifyOrReturnError(mFabricsTable != nullptr, CHIP_ERROR_INCORRECT_STATE); bool found = false; @@ -805,6 +811,7 @@ CHIP_ERROR CASESession::FindLocalNodeFromDestinationId(const ByteSpan & destinat CHIP_ERROR CASESession::TryResumeSession(SessionResumptionStorage::ConstResumptionIdView resumptionId, ByteSpan resume1MIC, ByteSpan initiatorRandom) { + MATTER_TRACE_SCOPE("TryResumeSession", "CASESession"); VerifyOrReturnError(mSessionResumptionStorage != nullptr, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(mFabricsTable != nullptr, CHIP_ERROR_INCORRECT_STATE); @@ -2095,6 +2102,7 @@ CHIP_ERROR CASESession::ValidateReceivedMessage(ExchangeContext * ec, const Payl CHIP_ERROR CASESession::OnMessageReceived(ExchangeContext * ec, const PayloadHeader & payloadHeader, System::PacketBufferHandle && msg) { + MATTER_TRACE_SCOPE("OnMessageReceived", "CASESession"); CHIP_ERROR err = ValidateReceivedMessage(ec, payloadHeader, msg); Protocols::SecureChannel::MsgType msgType = static_cast(payloadHeader.GetMessageType()); SuccessOrExit(err); diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index da168fa7c79c95..67da1d103ebf83 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -89,6 +89,7 @@ void PASESession::Finish() void PASESession::Clear() { + MATTER_TRACE_SCOPE("Clear", "PASESession"); // This function zeroes out and resets the memory used by the object. // It's done so that no security related information will be leaked. memset(&mPASEVerifier, 0, sizeof(mPASEVerifier)); @@ -112,6 +113,7 @@ void PASESession::Clear() CHIP_ERROR PASESession::Init(SessionManager & sessionManager, uint32_t setupCode, SessionEstablishmentDelegate * delegate) { + MATTER_TRACE_SCOPE("Init", "PASESession"); VerifyOrReturnError(sessionManager.GetSessionKeystore() != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -242,6 +244,7 @@ CHIP_ERROR PASESession::Pair(SessionManager & sessionManager, uint32_t peerSetUp void PASESession::OnResponseTimeout(ExchangeContext * ec) { + MATTER_TRACE_SCOPE("OnResponseTimeout", "PASESession"); VerifyOrReturn(ec != nullptr, ChipLogError(SecureChannel, "PASESession::OnResponseTimeout was called by null exchange")); VerifyOrReturn(mExchangeCtxt == nullptr || mExchangeCtxt == ec, ChipLogError(SecureChannel, "PASESession::OnResponseTimeout exchange doesn't match")); @@ -691,7 +694,6 @@ CHIP_ERROR PASESession::HandleMsg2_and_SendMsg3(System::PacketBufferHandle && ms mNextExpectedMsg.SetValue(MsgType::StatusReport); } - ChipLogDetail(SecureChannel, "Sent spake2p msg3"); exit: @@ -814,6 +816,7 @@ CHIP_ERROR PASESession::OnUnsolicitedMessageReceived(const PayloadHeader & paylo CHIP_ERROR PASESession::OnMessageReceived(ExchangeContext * exchange, const PayloadHeader & payloadHeader, System::PacketBufferHandle && msg) { + MATTER_TRACE_SCOPE("OnMessageReceived", "PASESession"); CHIP_ERROR err = ValidateReceivedMessage(exchange, payloadHeader, msg); MsgType msgType = static_cast(payloadHeader.GetMessageType()); SuccessOrExit(err); diff --git a/src/tracing/esp32_trace/esp32_tracing.cpp b/src/tracing/esp32_trace/esp32_tracing.cpp index 24a7166dde04eb..7a1313089703f2 100644 --- a/src/tracing/esp32_trace/esp32_tracing.cpp +++ b/src/tracing/esp32_trace/esp32_tracing.cpp @@ -29,7 +29,7 @@ namespace Tracing { namespace Insights { namespace { -constexpr size_t kPermitListMaxSize = 10; +constexpr size_t kPermitListMaxSize = 20; using HashValue = uint32_t; // Implements a murmurhash with 0 seed. @@ -66,13 +66,13 @@ uint32_t MurmurHash(const void * key) * are well known permitted entries. */ -HashValue gPermitList[kPermitListMaxSize] = { - MurmurHash("PASESession"), - MurmurHash("CASESession"), - MurmurHash("NetworkCommissioning"), - MurmurHash("GeneralCommissioning"), - MurmurHash("OperationalCredentials"), -}; +HashValue gPermitList[kPermitListMaxSize] = { MurmurHash("PASESession"), + MurmurHash("CASESession"), + MurmurHash("NetworkCommissioning"), + MurmurHash("GeneralCommissioning"), + MurmurHash("OperationalCredentials"), + MurmurHash("CASEServer"), + MurmurHash("Fabric") }; // namespace bool IsPermitted(HashValue hashValue) {