Skip to content

Commit

Permalink
EthernetMac, EthernetCsmaMac: added allowNonstandardBitrate NED param…
Browse files Browse the repository at this point in the history
…eter

Usually disabled. When enable it, the ethernet allows any bitrate.
See EthernetModes class.
  • Loading branch information
ZoltanBojthe committed Mar 11, 2024
1 parent 956dc6e commit 410f005
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/inet/linklayer/ethernet/base/EthernetMacBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void EthernetMacBase::initialize(int stage)
MacProtocolBase::initialize(stage);
if (stage == INITSTAGE_LOCAL) {
fcsMode = parseFcsMode(par("fcsMode"));
allowNonstandardBitrate = par("allowNonstandardBitrate");
physInGate = gate("phys$i");
physOutGate = gate("phys$o");
lowerLayerInGateId = physInGate->getId();
Expand Down Expand Up @@ -428,7 +429,7 @@ void EthernetMacBase::readChannelParameters(bool errorWhenAsymmetric)

if (connected) {
// Check valid speeds
curEtherDescr = EthernetModes::getEthernetMode(txRate);
curEtherDescr = EthernetModes::getEthernetMode(txRate, allowNonstandardBitrate);
halfBitTime = 0.5 / txRate;
if (networkInterface) {
networkInterface->setCarrier(true);
Expand Down
1 change: 1 addition & 0 deletions src/inet/linklayer/ethernet/base/EthernetMacBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class INET_API EthernetMacBase : public MacProtocolBase, public queueing::IActiv
// configuration
const char *displayStringTextFormat = nullptr;
bool sendRawBytes = false;
bool allowNonstandardBitrate = true;
FcsMode fcsMode = FCS_MODE_UNDEFINED;
EthernetModes::EthernetMode curEtherDescr = EthernetModes::nullEthernetMode; // constants for the current Ethernet mode, e.g. txrate
simtime_t halfBitTime = SIMTIME_ZERO; // transmission time of a half bit
Expand Down
1 change: 1 addition & 0 deletions src/inet/linklayer/ethernet/basic/EthernetCsmaMac.ned
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ module EthernetCsmaMac like IEtherMac
// ones with matching destination MAC address
bool duplexMode; // selects full-duplex (true) or half-duplex (false) operation
bool frameBursting = default(true); // enable/disable frame bursting mode in Gigabit Ethernet
bool allowNonstandardBitrate = default(false); // allows any bitrate and uses first larger bitrate specified parameters
int mtu @unit(B) = default(1500B);
string fcsMode @enum("declared","computed");
@lifecycleSupport;
Expand Down
1 change: 1 addition & 0 deletions src/inet/linklayer/ethernet/basic/EthernetMac.ned
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ module EthernetMac like IEtherMac
// ones with matching destination MAC address
bool duplexMode; // must be set to "true", as EthernetMac does not support half-duplex operation
// (parameter is present to reduce the risk of accidental misconfiguration)
bool allowNonstandardBitrate = default(false); // allows any bitrate and uses first larger bitrate specified parameters
int mtu @unit(B) = default(1500B);
string fcsMode @enum("declared","computed");
@lifecycleSupport;
Expand Down

0 comments on commit 410f005

Please sign in to comment.