File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
src/inet/linklayer/ethernet Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -398,8 +398,8 @@ void EthernetMacBase::readChannelParameters(bool errorWhenAsymmetric)
398
398
if (connected && ((!outTrChannel) || (!inTrChannel)))
399
399
throw cRuntimeError (" Ethernet phys gate must be connected using a transmission channel" );
400
400
401
- double txRate = outTrChannel ? outTrChannel-> getNominalDatarate () : 0.0 ;
402
- double rxRate = inTrChannel ? inTrChannel-> getNominalDatarate () : 0.0 ;
401
+ double txRate = 0.0 ;
402
+ double rxRate = 0.0 ;
403
403
404
404
bool rxDisabled = !inTrChannel || inTrChannel->isDisabled ();
405
405
bool txDisabled = !outTrChannel || outTrChannel->isDisabled ();
@@ -425,6 +425,18 @@ void EthernetMacBase::readChannelParameters(bool errorWhenAsymmetric)
425
425
else {
426
426
if (outTrChannel && !transmissionChannel)
427
427
outTrChannel->subscribe (POST_MODEL_CHANGE, this );
428
+
429
+ // TODO The NetworkInterface::computeDatarate() function does something similar to the following code:
430
+ if (networkInterface && networkInterface->hasPar (" bitrate" ))
431
+ txRate = rxRate = networkInterface->par (" bitrate" );
432
+ double channelTxRate = outTrChannel->getNominalDatarate ();
433
+ if (txRate == 0.0 ) {
434
+ txRate = channelTxRate;
435
+ rxRate = inTrChannel ? inTrChannel->getNominalDatarate () : 0.0 ;
436
+ }
437
+ else if (channelTxRate != 0 && txRate != channelTxRate)
438
+ throw cRuntimeError (" Wired network interface datarate is set on both the network interface module and on the corresponding transmission channel and the two values are different" );
439
+
428
440
transmissionChannel = outTrChannel;
429
441
dataratesDiffer = (txRate != rxRate);
430
442
}
Original file line number Diff line number Diff line change @@ -130,9 +130,11 @@ void EthernetMacPhy::startFrameTransmission()
130
130
}
131
131
signal->encapsulate (frame);
132
132
ASSERT (curTxSignal == nullptr );
133
- curTxSignal = signal->dup ();
133
+ simtime_t duration = signal->getBitLength () / curEtherDescr.bitrate ;
134
+ signal->setDuration (duration);
134
135
emit (transmissionStartedSignal, signal);
135
- send (signal, SendOptions ().transmissionId (curTxSignal->getId ()), physOutGate);
136
+ curTxSignal = signal->dup ();
137
+ send (signal, SendOptions ().transmissionId (curTxSignal->getId ()).duration (duration), physOutGate);
136
138
scheduleAt (transmissionChannel->getTransmissionFinishTime (), endTxTimer);
137
139
changeTransmissionState (TRANSMITTING_STATE);
138
140
}
You can’t perform that action at this time.
0 commit comments