EtherLLC

Package: inet.linklayer.ethernet

EtherLLC

simple module

Provides Ethernet 802.3 encapsulation/decapsulation and dispatching to the appropriate higher layer by DSAP values.

Expected environment:

  • lowerLayerIn, lowerLayerOut gates should be connected to Ethernet EtherMAC
  • upperLayerIn[], upperLayerOut[] gates should be connected to higher layer protocols or applications

Functionality:

Processes commands received from upper layers, as described in Communication between LLC and higher layers. The following commands are supported:

  • IEEE802CTRL_DATA: send a frame. Encapsulates packet into EtherFrameWithLLC. This includes assigning dest address, ssap and dsap from the Ieee802Ctrl structure acompanying the message. Src address will be filled in by EtherMAC.
  • IEEE802CTRL_REGISTER_DSAP: register application in LLC, as described in Application registration.
  • IEEE802CTRL_DEREGISTER_DSAP: deregister application, as described in Application registration.
  • IEEE802CTRL_SENDPAUSE: send PAUSE frame, as described in PAUSE frames.

Processing of packets received from the lower layers:

Used in compound modules

Name Type Description
EtherHost compound module

An example host with one Ethernet port and a traffic generator that generates request-reply traffic directly over Ethernet. This host model does not contain higher layer protocols (IP, TCP). By default it is configured to use half-duplex MAC (CSMA/CD).

Properties

Name Value Description
display i=block/fork

Gates

Name Direction Size Description
upperLayerIn [ ] input

higher layer

upperLayerOut [ ] output

higher layer

lowerLayerIn input

to Ethernet MAC

lowerLayerOut output

to Ethernet MAC

Signals

Name Type Unit
passedUpPk cPacket
dsap long
droppedPkUnknownDSAP cPacket
pauseSent long
decapPk cPacket
encapPk cPacket

Statistics

Name Title Source Record Unit Interpolation Mode
passedUpPk packets passed up passedUpPk count, sum(packetBytes), vector(packetBytes) none
dsap dsap registering sum, vector
droppedPkUnknownDSAP dropped packets unknown DSAP droppedPkUnknownDSAP count, sum(packetBytes), vector(packetBytes) none
pauseSent pause sent count, vector
decapPk packets decapsulated decapPk count, sum(packetBytes), vector(packetBytes) none
encapPk packets encapsulated encapPk count, sum(packetBytes), vector(packetBytes) none

Source code

//
// Provides Ethernet 802.3 encapsulation/decapsulation and dispatching
// to the appropriate higher layer by DSAP values.
//
// Expected environment:
// - lowerLayerIn, lowerLayerOut gates should be connected
//   to Ethernet ~EtherMAC
// - upperLayerIn[], upperLayerOut[] gates should be connected to
//   higher layer protocols or applications
//
// Functionality:
//
// Processes commands received from upper layers, as described in
// <a href="llc-app.html">Communication between LLC and higher layers</a>.
// The following commands are supported:
// - IEEE802CTRL_DATA: send a frame.
//   Encapsulates packet into ~EtherFrameWithLLC. This includes assigning
//   dest address, ssap and dsap from the ~Ieee802Ctrl structure acompanying
//   the message. Src address will be filled in by ~EtherMAC.
// - IEEE802CTRL_REGISTER_DSAP: register application in LLC, as described in
//   <a href="appreg.html">Application registration</a>.
// - IEEE802CTRL_DEREGISTER_DSAP: deregister application, as described in
//   <a href="appreg.html">Application registration</a>.
// - IEEE802CTRL_SENDPAUSE: send PAUSE frame, as described in
//   <a href="ether-pause.html">PAUSE frames</a>.
//
// Processing of packets received from the lower layers:
// - decapsulate frames received from ~EtherMAC
// - sends received frames to corresponding application, based on dsap.
// - only servicetype=0 is implemented (connectionless)
// - reception of non-~EtherFrameWithLLC objects (e.g. ~EthernetIIFrame,
//   ~EtherFrameWithSNAP) will cause a runtime error.
//
simple EtherLLC
{
    parameters:
        @display("i=block/fork");

        @signal[dsap](type=long);
        @signal[encapPk](type=cPacket);
        @signal[decapPk](type=cPacket);
        @signal[passedUpPk](type=cPacket);
        @signal[droppedPkUnknownDSAP](type=cPacket);
        @signal[pauseSent](type=long); // pause units
        @statistic[dsap](title="dsap registering"; record=sum,vector);
        @statistic[encapPk](title="packets encapsulated"; source=encapPk; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[decapPk](title="packets decapsulated"; source=decapPk; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[passedUpPk](title="packets passed up"; source=passedUpPk; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[droppedPkUnknownDSAP](title="dropped packets unknown DSAP"; source=droppedPkUnknownDSAP; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[pauseSent](title="pause sent"; record=count,vector);
    gates:
        input upperLayerIn[] @labels(Ieee802Ctrl/down); // higher layer
        output upperLayerOut[] @labels(Ieee802Ctrl/up); // higher layer
        input lowerLayerIn @labels(EtherFrame);     // to Ethernet MAC
        output lowerLayerOut @labels(EtherFrame);   // to Ethernet MAC
}

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