|
|
| 210 |
PointToPointNetDevice::DoInitialize (void) |
210 |
PointToPointNetDevice::DoInitialize (void) |
| 211 |
{ |
211 |
{ |
| 212 |
NS_LOG_FUNCTION (this); |
212 |
NS_LOG_FUNCTION (this); |
| 213 |
// A NetDeviceQueueInterface object must have been aggregated to this device |
213 |
// The traffic control layer, if installed, has aggregated a |
| 214 |
// by the traffic control layer |
214 |
// NetDeviceQueueInterface object to this device |
| 215 |
m_queueInterface = GetObject<NetDeviceQueueInterface> (); |
215 |
m_queueInterface = GetObject<NetDeviceQueueInterface> (); |
| 216 |
NetDevice::DoInitialize (); |
216 |
NetDevice::DoInitialize (); |
| 217 |
} |
217 |
} |
|
Lines 292-305
PointToPointNetDevice::TransmitComplete (void)
|
Link Here
|
|---|
|
| 292 |
m_phyTxEndTrace (m_currentPkt); |
292 |
m_phyTxEndTrace (m_currentPkt); |
| 293 |
m_currentPkt = 0; |
293 |
m_currentPkt = 0; |
| 294 |
|
294 |
|
| 295 |
NS_ASSERT (m_queueInterface); |
295 |
Ptr<NetDeviceQueue> txq; |
| 296 |
Ptr<NetDeviceQueue> txq = m_queueInterface->GetTxQueue (0); |
296 |
if (m_queueInterface) |
|
|
297 |
{ |
| 298 |
txq = m_queueInterface->GetTxQueue (0); |
| 299 |
} |
| 297 |
|
300 |
|
| 298 |
Ptr<QueueItem> item = m_queue->Dequeue (); |
301 |
Ptr<QueueItem> item = m_queue->Dequeue (); |
| 299 |
if (item == 0) |
302 |
if (item == 0) |
| 300 |
{ |
303 |
{ |
| 301 |
NS_LOG_LOGIC ("No pending packets in device queue after tx complete"); |
304 |
NS_LOG_LOGIC ("No pending packets in device queue after tx complete"); |
| 302 |
txq->Wake (); |
305 |
if (txq) |
|
|
306 |
{ |
| 307 |
txq->Wake (); |
| 308 |
} |
| 303 |
return; |
309 |
return; |
| 304 |
} |
310 |
} |
| 305 |
|
311 |
|
|
Lines 309-315
PointToPointNetDevice::TransmitComplete (void)
|
Link Here
|
|---|
|
| 309 |
// layers because otherwise a packet is sent to the device while the machine |
315 |
// layers because otherwise a packet is sent to the device while the machine |
| 310 |
// state is busy, thus causing the assert in TransmitStart to fail. |
316 |
// state is busy, thus causing the assert in TransmitStart to fail. |
| 311 |
// |
317 |
// |
| 312 |
if (txq->IsStopped ()) |
318 |
if (txq && txq->IsStopped ()) |
| 313 |
{ |
319 |
{ |
| 314 |
txq->Start (); |
320 |
txq->Start (); |
| 315 |
} |
321 |
} |
|
Lines 532-541
PointToPointNetDevice::Send (
|
Link Here
|
|---|
|
| 532 |
const Address &dest, |
538 |
const Address &dest, |
| 533 |
uint16_t protocolNumber) |
539 |
uint16_t protocolNumber) |
| 534 |
{ |
540 |
{ |
| 535 |
NS_ASSERT (m_queueInterface); |
541 |
Ptr<NetDeviceQueue> txq; |
| 536 |
Ptr<NetDeviceQueue> txq = m_queueInterface->GetTxQueue (0); |
542 |
if (m_queueInterface) |
|
|
543 |
{ |
| 544 |
txq = m_queueInterface->GetTxQueue (0); |
| 545 |
} |
| 537 |
|
546 |
|
| 538 |
NS_ASSERT_MSG (!txq->IsStopped (), "Send should not be called when the device is stopped"); |
547 |
NS_ASSERT_MSG (!txq || !txq->IsStopped (), "Send should not be called when the device is stopped"); |
| 539 |
|
548 |
|
| 540 |
NS_LOG_FUNCTION (this << packet << dest << protocolNumber); |
549 |
NS_LOG_FUNCTION (this << packet << dest << protocolNumber); |
| 541 |
NS_LOG_LOGIC ("p=" << packet << ", dest=" << &dest); |
550 |
NS_LOG_LOGIC ("p=" << packet << ", dest=" << &dest); |
|
Lines 580-586
PointToPointNetDevice::Send (
|
Link Here
|
|---|
|
| 580 |
// Enqueue may fail (overflow). Stop the tx queue, so that the upper layers |
589 |
// Enqueue may fail (overflow). Stop the tx queue, so that the upper layers |
| 581 |
// do not send packets until there is room in the queue again. |
590 |
// do not send packets until there is room in the queue again. |
| 582 |
m_macTxDropTrace (packet); |
591 |
m_macTxDropTrace (packet); |
| 583 |
txq->Stop (); |
592 |
if (txq) |
|
|
593 |
{ |
| 594 |
txq->Stop (); |
| 595 |
} |
| 584 |
return false; |
596 |
return false; |
| 585 |
} |
597 |
} |
| 586 |
|
598 |
|
| 587 |
- |
|
|