Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect ICMP packet loss information #14

Merged
merged 23 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/link_prober/LinkProber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,12 @@ void LinkProber::handleRecv(
// echo reply for an echo request generated by this/active ToR
mRxSelfSeqNo = mTxSeqNo;
mLinkProberStateMachine.postLinkProberStateEvent(LinkProberStateMachine::getIcmpSelfEvent());
mContinuousIcmpUnknownEventCount = 0;
zjswhhh marked this conversation as resolved.
Show resolved Hide resolved
} else {
// echo reply for an echo request generated by peer ToR
mRxPeerSeqNo = mTxSeqNo;
mLinkProberStateMachine.postLinkProberStateEvent(LinkProberStateMachine::getIcmpPeerEvent());
mContinuousIcmpUnknownEventCount = 0;
if (ntohl(icmpPayload->command) == static_cast<uint32_t> (Command::COMMAND_SWITCH_ACTIVE)) {
boost::asio::io_service::strand &strand = mLinkProberStateMachine.getStrand();
boost::asio::io_service &ioService = strand.context();
Expand Down Expand Up @@ -394,6 +396,14 @@ void LinkProber::handleTimeout(boost::system::error_code errorCode)
if (mTxSeqNo != mRxSelfSeqNo && mTxSeqNo != mRxPeerSeqNo) {
// post unknown event
mLinkProberStateMachine.postLinkProberStateEvent(LinkProberStateMachine::getIcmpUnknownEvent());
mContinuousIcmpUnknownEventCount++;
mIcmpUnknownEventCount++;

MUXLOGINFO(boost::format("%s: continusous ICMP Unknown event count: %d, pck loss rate since initialization: %.2f %%") %
mMuxPortConfig.getPortName() %
mContinuousIcmpUnknownEventCount %
(static_cast<double_t>(mIcmpUnknownEventCount) / mIcmpPacketCount * 100)
zjswhhh marked this conversation as resolved.
Show resolved Hide resolved
);
}

// start another cycle of send/recv
Expand Down Expand Up @@ -433,6 +443,8 @@ void LinkProber::startRecv()
{
MUXLOGTRACE(mMuxPortConfig.getPortName());

mIcmpPacketCount++;

mStream.async_read_some(
boost::asio::buffer(mRxBuffer, MUX_MAX_ICMP_BUFFER_SIZE),
mStrand.wrap(boost::bind(
Expand Down
4 changes: 4 additions & 0 deletions src/link_prober/LinkProber.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ class LinkProber
std::array<uint8_t, MUX_MAX_ICMP_BUFFER_SIZE> mRxBuffer;

bool mSuspendTx = false;

uint32_t mContinuousIcmpUnknownEventCount = 0;
uint64_t mIcmpUnknownEventCount = 0;
uint64_t mIcmpPacketCount = 0;
};

} /* namespace link_prober */
Expand Down