|
Bugzilla – Full Text Bug Listing |
| Summary: | Packet copy in CsmaChannel breaks netanim tracing | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | klb <klb> |
| Component: | csma | Assignee: | ns-bugs <ns-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | tomh |
| Priority: | P3 | ||
| Version: | ns-3.27 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | patch to fix | ||
|
Description
klb
2018-02-16 07:48:47 UTC
If we move the TxBegin trace to before the TransmitStart() call, then it should fix this. However, the behavior would change slightly; drops would see the TxBegin() trace followed immediately by a TxDrop() trace (rather than just a TxDrop() alone).
//
// The channel is free, transmit the packet
//
if (m_channel->TransmitStart (m_currentPkt, m_deviceId) == false)
{
NS_LOG_WARN ("Channel TransmitStart returns an error");
m_phyTxDropTrace (m_currentPkt);
m_currentPkt = 0;
m_txMachineState = READY;
}
else
{
//
// Transmission succeeded, reset the backoff time parameters and
// schedule a transmit complete event.
//
m_backoff.ResetBackoffTime ();
m_txMachineState = BUSY;
m_phyTxBeginTrace (m_currentPkt);
Time tEvent = m_bps.CalculateBytesTxTime (m_currentPkt->GetSize ());
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << tEvent.GetSeconds () << "sec");
Simulator::Schedule (tEvent, &CsmaNetDevice::TransmitCompleteEvent, this);
}
What I proposed above would make it consistent with how PointToPointNetDevice handles it:
m_phyTxBeginTrace (m_currentPkt);
Time txTime = m_bps.CalculateBytesTxTime (p->GetSize ());
Time txCompleteTime = txTime + m_tInterframeGap;
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << txCompleteTime.GetSeconds () << "sec");
Simulator::Schedule (txCompleteTime, &PointToPointNetDevice::TransmitComplete, this);
bool result = m_channel->TransmitStart (p, this, txTime);
if (result == false)
{
m_phyTxDropTrace (p);
}
Created attachment 3086 [details]
patch to fix
I pushed a change in changeset 13408:07055158a65d; please let me know if it does not resolve the issue for you. I tested it on NetAnim and it seemed to resolve it. |