EthernetInterface
Package: inet.linklayer.ethernet

EthernetInterface

compound module

Ethernet network interface. Complements EtherMac and EtherEncap with an output queue for QoS and RED support.

IHook IHook ITrafficConditioner ITrafficConditioner IOutputQueue IEtherMac IEtherEncap

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Parameters

Name Type Default value Description
interfaceTableModule string
csmacdSupport bool false

by default CSMA/CD is turned off, so only point-to-point duplex links are supported.

fcsMode string "declared"
numOutputHooks int 0
numInputHooks int 0

Properties

Name Value Description
class InterfaceEntry
display i=block/ifcard;bgl=2

Gates

Name Direction Size Description
upperLayerIn input
upperLayerOut output
phys inout

Unassigned submodule parameters

Name Type Default value Description
mac.promiscuous bool

if true, all packets are received, otherwise only the ones with matching destination MAC address

mac.address string

MAC address as hex string (12 hex digits), or "auto". "auto" values will be replaced by a generated MAC address in init stage 0.

mac.duplexMode bool

selects full-duplex (true) or half-duplex (false) operation

mac.mtu int

Source code

//
// Ethernet network interface. Complements ~EtherMac and ~EtherEncap
// with an output queue for QoS and RED support.
//
module EthernetInterface like IEthernetInterface
{
    parameters:
        @class(InterfaceEntry);
        string interfaceTableModule;
        bool csmacdSupport = default(false);  // by default CSMA/CD is turned off, so only point-to-point duplex links are supported.
        string fcsMode @enum("declared","computed") = default("declared");
        int numOutputHooks = default(0);
        int numInputHooks = default(0);
        @display("i=block/ifcard;bgl=2");
        *.interfaceTableModule = default(absPath(interfaceTableModule));
        *.fcsMode = fcsMode;
    gates:
        input upperLayerIn;
        output upperLayerOut;
        inout phys @labels(EtherFrame);
    submodules:
        outputHook[numOutputHooks]: <default("Nop")> like IHook if numOutputHooks>0 {
            @display("p=100,100;is=s");
        }
        inputHook[numInputHooks]: <default("Nop")> like IHook if numInputHooks>0 {
            @display("p=400,100;is=s");
        }
        ingressTC: <default("")> like ITrafficConditioner if typename != "" {
            @display("p=400,200");
        }
        egressTC: <default("")> like ITrafficConditioner if typename != "" {
            @display("p=100,200");
        }
        queue: <default("")> like IOutputQueue if typename != "" {
            parameters:
                @display("p=100,400;q=l2queue");
        }
        mac: <default(csmacdSupport ? "EtherMac" : "EtherMacFullDuplex")> like IEtherMac {
            parameters:
                queueModule = (exists(queue) ? "^.queue" : "");
                txQueueLimit = (exists(queue) ? 1 : 10000); // queue sends one packet at a time
                @display("p=200,500");
        }
        encap: <default("EtherEncap")> like IEtherEncap {
            parameters:
                @display("p=250,300");
        }
    connections:
        mac.upperLayerOut --> encap.lowerLayerIn;
        mac.phys <--> { @display("m=s"); } <--> phys;

        if exists(queue) {
            encap.lowerLayerOut --> queue.in;
            queue.out --> mac.upperLayerIn;
        }

        encap.lowerLayerOut --> mac.upperLayerIn if !exists(queue);

        // no input hooks, no ingressTC
        encap.upperLayerOut --> { @display("m=n"); } --> upperLayerOut if numInputHooks == 0 && !exists(ingressTC);

        // no input hooks, there is ingressTC
        if numInputHooks == 0 && exists(ingressTC) {
            encap.upperLayerOut --> ingressTC.in;
            ingressTC.out --> { @display("m=n"); } --> upperLayerOut;
        }

        // there are input hooks
        if numInputHooks > 0 {
            inputHook[numInputHooks-1].out --> { @display("m=n"); } --> upperLayerOut;
        }
        for i=0..numInputHooks-2 {
            inputHook[i].out --> inputHook[i+1].in;
        }

        // there are input hooks, no ingressTC
        if numInputHooks > 0 && exists(ingressTC) {
            encap.upperLayerOut --> inputHook[0].in;
        }

        // there are input hooks, there is ingressTC
        if numInputHooks > 0 && exists(ingressTC) {
            encap.upperLayerOut --> ingressTC.in;
            ingressTC.out --> inputHook[0].in;
        }

        // chain output hooks
        for i=0..numOutputHooks-2 {
            outputHook[i].out --> outputHook[i+1].in;
        }

        // no output hooks, no egressTC
        upperLayerIn --> { @display("m=n"); } --> encap.upperLayerIn if numOutputHooks == 0 && !exists(egressTC);

        // there are output hooks
        if numOutputHooks > 0 {
            upperLayerIn --> { @display("m=n"); } --> outputHook[0].in;
        }

        // no output hooks, there is egressTC
        if numOutputHooks == 0 && exists(egressTC) {
            upperLayerIn --> { @display("m=n"); } --> egressTC.in;
        }

        // there is egressTC
        if exists(egressTC) {
            egressTC.out --> encap.upperLayerIn;
        }

        // there are output hooks, no egressTC
        if numOutputHooks > 0 && exists(egressTC) {
            outputHook[numOutputHooks-1].out --> encap.upperLayerIn;
        }

        // there are output hooks, there is egressTC
        if numOutputHooks > 0 && exists(egressTC) {
            outputHook[numOutputHooks-1].out --> egressTC.in;
        }
}

File: src/inet/linklayer/ethernet/EthernetInterface.ned