Skip to content

Commit

Permalink
Added few counter traces
Browse files Browse the repository at this point in the history
  • Loading branch information
shripad621git committed Jan 25, 2024
1 parent 7e347d1 commit 1328724
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate
{
MATTER_TRACE_SCOPE("OnDisconnectionDetected", "WiFiDiagnosticsDelegate");
ChipLogProgress(Zcl, "WiFiDiagnosticsDelegate: OnDisconnectionDetected");

for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id))
{
// If WiFi Network Diagnostics cluster is implemented on this endpoint
Expand Down
1 change: 0 additions & 1 deletion src/lib/dnssd/Resolver_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ void MinMdnsResolver::OnMdnsPacketData(const BytesRange & data, const chip::Inet
{
MATTER_TRACE_SCOPE("Received MDNS Packet", "MinMdnsResolver");

MATTER_TRACE_COUNTER("MDNSCount", "MinMdnsResolver");
// Fill up any relevant data
mPacketParser.ParseSrvRecords(data);
mPacketParser.ParseNonSrvRecords(info->Interface, data);
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/secure_channel/CASEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void CASEServer::OnSessionEstablishmentError(CHIP_ERROR err)
{
MATTER_TRACE_SCOPE("OnSessionEstablishmentError", "CASEServer");
ChipLogError(Inet, "CASE Session establishment failed: %" CHIP_ERROR_FORMAT, err.Format());

MATTER_TRACE_SCOPE("CASEFail", "CASESession");
PrepareForSessionEstablishment();
}

Expand Down
11 changes: 5 additions & 6 deletions src/protocols/secure_channel/CASESession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,9 @@ 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"));
MATTER_TRACE_COUNTER("casetimeout", "CASESession");
ChipLogError(SecureChannel, "CASESession timed out while waiting for a response from the peer. Current state was %u",
to_underlying(mState));
MATTER_TRACE_COUNTER("CASETimeout", "CASESession");
// Discard the exchange so that Clear() doesn't try aborting it. The
// exchange will handle that.
DiscardExchange();
Expand Down Expand Up @@ -649,7 +649,6 @@ CHIP_ERROR CASESession::RecoverInitiatorIpk()
CHIP_ERROR CASESession::SendSigma1()
{
MATTER_TRACE_SCOPE("SendSigma1", "CASESession");
MATTER_TRACE_COUNTER("Sendsigmacnt", "CASESession");
size_t data_len = TLV::EstimateStructOverhead(kSigmaParamRandomNumberSize, // initiatorRandom
sizeof(uint16_t), // initiatorSessionId,
kSHA256_Hash_Length, // destinationId
Expand Down Expand Up @@ -751,8 +750,6 @@ CHIP_ERROR CASESession::SendSigma1()
CHIP_ERROR CASESession::HandleSigma1_and_SendSigma2(System::PacketBufferHandle && msg)
{
MATTER_TRACE_SCOPE("HandleSigma1_and_SendSigma2", "CASESession");
MATTER_TRACE_COUNTER("sigma1cnt", "CASESession");

ReturnErrorOnFailure(HandleSigma1(std::move(msg)));

return CHIP_NO_ERROR;
Expand Down Expand Up @@ -848,6 +845,7 @@ CHIP_ERROR CASESession::HandleSigma1(System::PacketBufferHandle && msg)
ByteSpan initiatorRandom;

ChipLogProgress(SecureChannel, "Received Sigma1 msg");
MATTER_TRACE_COUNTER("Sigma1", "CASESession");

bool sessionResumptionRequested = false;
ByteSpan resumptionId;
Expand Down Expand Up @@ -974,7 +972,6 @@ CHIP_ERROR CASESession::SendSigma2Resume()
CHIP_ERROR CASESession::SendSigma2()
{
MATTER_TRACE_SCOPE("SendSigma2", "CASESession");
MATTER_TRACE_COUNTER("sigma2cnt", "CASESession");

VerifyOrReturnError(GetLocalSessionId().HasValue(), CHIP_ERROR_INCORRECT_STATE);
VerifyOrReturnError(mFabricsTable != nullptr, CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -1105,6 +1102,7 @@ CHIP_ERROR CASESession::SendSigma2()
mState = State::kSentSigma2;

ChipLogProgress(SecureChannel, "Sent Sigma2 msg");
MATTER_TRACE_COUNTER("Sigma2", "CASESession");

return CHIP_NO_ERROR;
}
Expand All @@ -1121,6 +1119,7 @@ CHIP_ERROR CASESession::HandleSigma2Resume(System::PacketBufferHandle && msg)
uint32_t decodeTagIdSeq = 0;

ChipLogDetail(SecureChannel, "Received Sigma2Resume msg");
MATTER_TRACE_COUNTER("Sigma2Resume", "CASESession");

uint8_t sigma2ResumeMIC[CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES];

Expand Down Expand Up @@ -1570,7 +1569,6 @@ CHIP_ERROR CASESession::SendSigma3c(SendSigma3Data & data, CHIP_ERROR status)
CHIP_ERROR CASESession::HandleSigma3a(System::PacketBufferHandle && msg)
{
MATTER_TRACE_SCOPE("HandleSigma3", "CASESession");
MATTER_TRACE_COUNTER("sigma3cnt", "CASESession");
CHIP_ERROR err = CHIP_NO_ERROR;
System::PacketBufferTLVReader tlvReader;
TLV::TLVReader decryptedDataTlvReader;
Expand All @@ -1591,6 +1589,7 @@ CHIP_ERROR CASESession::HandleSigma3a(System::PacketBufferHandle && msg)
uint8_t msg_salt[kIPKSize + kSHA256_Hash_Length];

ChipLogProgress(SecureChannel, "Received Sigma3 msg");
MATTER_TRACE_COUNTER("Sigma3", "CASESession");

auto helper = WorkHelper<HandleSigma3Data>::Create(*this, &HandleSigma3b, &CASESession::HandleSigma3c);
VerifyOrExit(helper, err = CHIP_ERROR_NO_MEMORY);
Expand Down
5 changes: 5 additions & 0 deletions src/protocols/secure_channel/PASESession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ void PASESession::OnResponseTimeout(ExchangeContext * ec)
// If we were waiting for something, mNextExpectedMsg had better have a value.
ChipLogError(SecureChannel, "PASESession timed out while waiting for a response from the peer. Expected message type was %u",
to_underlying(mNextExpectedMsg.Value()));
MATTER_TRACE_COUNTER("PASETimeout", "PASESession");
// Discard the exchange so that Clear() doesn't try closing it. The
// exchange will handle that.
DiscardExchange();
Expand Down Expand Up @@ -572,6 +573,7 @@ CHIP_ERROR PASESession::HandleMsg1_and_SendMsg2(System::PacketBufferHandle && ms
size_t verifier_len = kMAX_Hash_Length;

ChipLogDetail(SecureChannel, "Received spake2p msg1");
MATTER_TRACE_SCOPE("Pake1", "PASESession");

System::PacketBufferTLVReader tlvReader;
TLV::TLVType containerType = TLV::kTLVType_Structure;
Expand Down Expand Up @@ -620,6 +622,7 @@ CHIP_ERROR PASESession::HandleMsg1_and_SendMsg2(System::PacketBufferHandle && ms
}

ChipLogDetail(SecureChannel, "Sent spake2p msg2");
MATTER_TRACE_COUNTER("Pake2", "PASESession");

exit:

Expand Down Expand Up @@ -711,6 +714,7 @@ CHIP_ERROR PASESession::HandleMsg3(System::PacketBufferHandle && msg)
CHIP_ERROR err = CHIP_NO_ERROR;

ChipLogDetail(SecureChannel, "Received spake2p msg3");
MATTER_TRACE_COUNTER("Pake3", "PASESession");

mNextExpectedMsg.ClearValue();

Expand Down Expand Up @@ -871,6 +875,7 @@ CHIP_ERROR PASESession::OnMessageReceived(ExchangeContext * exchange, const Payl
DiscardExchange();
Clear();
ChipLogError(SecureChannel, "Failed during PASE session setup: %" CHIP_ERROR_FORMAT, err.Format());
MATTER_TRACE_COUNTER("PASEFail", "PASESession");
// Do this last in case the delegate frees us.
NotifySessionEstablishmentError(err);
}
Expand Down

0 comments on commit 1328724

Please sign in to comment.