LteMacBase Class Reference

Simu5G: LteMacBase Class Reference
Simu5G

#include <LteMacBase.h>

Public Member Functions

 ~LteMacBase () override
virtual void deleteQueues (MacNodeId nodeId)
virtual void deleteQueuesRadioLinkFailure (MacNodeId nodeId)
LogicalCid drbIdToLcid (DrbId drbId)
DrbId lcidToDrbId (LogicalCid lcid)
virtual MacCid ctrlInfoToMacCid (const FlowControlInfo *info)
virtual void sendUpperPackets (cPacket *pkt)
virtual void createOutgoingConnection (MacCid cid, const FlowDescriptor &connInfo)
virtual void deleteOutgoingConnection (MacCid cid)
virtual void clearOutgoingConnectionBuffers (MacCid cid)
virtual void createIncomingConnection (MacCid cid, const FlowDescriptor &connInfo)
virtual void configureLogicalChannel (MacCid cid, const LogicalChannelConfig &cfg)
const LogicalChannelConfig * findLogicalChannelConfig (MacCid cid) const
const LogicalChannelConfig & getLogicalChannelConfig (MacCid cid) const

Protected Member Functions

void initialize (int stage) override
void handleMessage (cMessage *msg) override
void deleteModule () override
virtual void handleSelfMessage ()=0
virtual void sendLowerPackets (cPacket *pkt)
virtual bool bufferizePacket (cPacket *pkt)
virtual void handleUpperMessage (cPacket *pkt)
virtual void macHandleFeedbackPkt (cPacket *pkt)
virtual void fromRlc (cPacket *pkt)
 Upper Layer Handler.
virtual void fromPhy (cPacket *pkt)
 Lower Layer Handler.
virtual LteHarqBufferRx * createRxHarqBuffer (MacNodeId src, const UserControlInfo *userInfo)
virtual void recordBufferOverflow (Direction dir, double sample)
 Records the buffer-overflow statistic for a dropped packet of the given direction.

Protected Attributes

cGate * upOutGate_ = nullptr
 MAC <– RLC.
cGate * downInGate_ = nullptr
 MAC --> RLC.
cGate * downOutGate_ = nullptr
 MAC <– PHY.
int harqProcesses_
 MAC --> PHY.
cMessage * ttiTick_ = nullptr
 TTI self message.
double ttiPeriod_ = TTI
 TTI for this node.
MacNodeId nodeId_ = NODEID_NONE
 MacNodeId.
MacCellId cellId_
 MacCellId.
unsigned int queueSize_
 Mac Buffers maximum queue size.
std::map< MacCid, OutgoingConnectionInfo > connDescOut_
 Consolidated outgoing connection information (replaces mbuf_, macBuffers_, and connDesc_)
std::map< GHz, MacPduList > macPduList_
 List of pdus finalized for each user on each codeword (one entry per carrier)
std::map< GHz, HarqTxBuffers > harqTxBuffers_
 Harq Tx Buffers (one entry per carrier)
std::map< GHz, HarqRxBuffers > harqRxBuffers_
 Harq Rx Buffers (one entry per carrier)
std::map< MacCid, LogicalChannelConfig > lcConfig_

Detailed Description

MAC Layer.

This is the MAC layer of LTE Stack: it performs buffering/sending packets.

On each TTI, the handleSelfMessage() is called to perform scheduling and other tasks

Constructor & Destructor Documentation

◆ ~LteMacBase()

~LteMacBase ( )
override

Deletes MAC Buffers

Member Function Documentation

◆ deleteQueues()

virtual void deleteQueues ( MacNodeId nodeId)
virtual

deleteQueues() must be called on handover to delete queues for a given user

Parameters
nodeIdId of the node whose queues are deleted

Reimplemented in D2dEnbMacBase< LteMacEnb >, and D2dEnbMacBase< NrMacGnb >.

◆ deleteQueuesRadioLinkFailure()

virtual void deleteQueuesRadioLinkFailure ( MacNodeId nodeId)
virtual

Tear down all MAC/HARQ/connection state for a node after an RLC-detected radio link failure (TS 38.322 5.3.2 / TS 36.322 5.2.1: indicate max retransmissions to upper layers). Marks HARQ reset so any in-flight feedback for the node is dropped this TTI (isHarqReset()), then calls the (virtual) deleteQueues(). Driven by BearerManagement::handleRadioLinkFailure.

◆ drbIdToLcid()

LogicalCid drbIdToLcid ( DrbId drbId)
inline

Maps a DRB ID to the corresponding Logical Channel ID. Currently a 1:1 mapping.

Referenced by ctrlInfoToMacCid().

◆ lcidToDrbId()

DrbId lcidToDrbId ( LogicalCid lcid)
inline

Maps a Logical Channel ID to the corresponding DRB ID. Currently a 1:1 mapping.

◆ ctrlInfoToMacCid()

virtual MacCid ctrlInfoToMacCid ( const FlowControlInfo * info)
inlinevirtual

Extracts a MacCid from FlowControlInfo. Converts DrbId (from PDCP/RLC) to LogicalCid (MAC layer).

References drbIdToLcid().

◆ sendUpperPackets()

virtual void sendUpperPackets ( cPacket * pkt)
virtual

sendUpperPackets() is used to send packets to upper layer

Parameters
pktPacket to send

◆ initialize()

void initialize ( int stage)
overrideprotected

Grabs NED parameters, initializes gates and the TTI self message

◆ handleMessage()

void handleMessage ( cMessage * msg)
overrideprotected

Analyze gate of incoming packet and call proper handler

◆ deleteModule()

void deleteModule ( )
overrideprotected

Statistics recording Deleting the module

Method is overridden to cancel the periodic TTI self-message, afterwards the deleteModule method of cSimpleModule is called.

◆ handleSelfMessage()

virtual void handleSelfMessage ( )
protectedpure virtual

Main loop of the Mac level, calls the scheduler and every other function every TTI: must be reimplemented by derived classes

◆ sendLowerPackets()

virtual void sendLowerPackets ( cPacket * pkt)
protectedvirtual

sendLowerPackets() is used to send packets to lower layer

Parameters
pktPacket to send

◆ createOutgoingConnection()

virtual void createOutgoingConnection ( MacCid cid,
const FlowDescriptor & connInfo )
virtual

createOutgoingConnection() creates MAC queues and buffers for a given CID and registers the outgoing connection if they don't already exist

◆ deleteOutgoingConnection()

virtual void deleteOutgoingConnection ( MacCid cid)
virtual

deleteOutgoingConnection() deletes MAC queues and buffers for a given CID and unregisters the outgoing connection

Parameters
cidConnection identifier to delete
Exceptions
cRuntimeErrorif the connection does not exist

◆ clearOutgoingConnectionBuffers()

virtual void clearOutgoingConnectionBuffers ( MacCid cid)
virtual

clearOutgoingConnectionBuffers() empties the MAC queues and virtual buffers for a given CID without destroying the connection. Used during D2D mode switch to preserve the connection for potential mode switch back.

◆ createIncomingConnection()

virtual void createIncomingConnection ( MacCid cid,
const FlowDescriptor & connInfo )
virtual

createIncomingConnection() registers an incoming connection for a given CID if it doesn't already exist

◆ configureLogicalChannel()

virtual void configureLogicalChannel ( MacCid cid,
const LogicalChannelConfig & cfg )
virtual

configureLogicalChannel() records the RLC/logical-channel configuration of a channel (MacCid = remote node + LCID), as pushed by the configuring entity (RRC) at bearer establishment. Upsert: re-establishment re-pushes the same values.

◆ findLogicalChannelConfig()

const LogicalChannelConfig * findLogicalChannelConfig ( MacCid cid) const
inline

findLogicalChannelConfig() returns the configuration pushed for a channel, or nullptr if the channel has none (e.g. a configured bearer that is not established yet).

References lcConfig_.

◆ getLogicalChannelConfig()

const LogicalChannelConfig & getLogicalChannelConfig ( MacCid cid) const

getLogicalChannelConfig() returns the configuration pushed for a channel.

Exceptions
cRuntimeErrorif the channel has no configuration (a push path was missed)

◆ bufferizePacket()

virtual bool bufferizePacket ( cPacket * pkt)
protectedvirtual

bufferizePacket() is called every time a packet is received from the upper layer

Referenced by handleUpperMessage().

◆ handleUpperMessage()

virtual void handleUpperMessage ( cPacket * pkt)
inlineprotectedvirtual

handleUpperMessage() is called every time a packet is received from the upper layer

References bufferizePacket().

◆ macHandleFeedbackPkt()

virtual void macHandleFeedbackPkt ( cPacket * pkt)
inlineprotectedvirtual

macHandleFeedbackPkt is called every time a feedback pkt arrives on MAC

◆ fromRlc()

virtual void fromRlc ( cPacket * pkt)
protectedvirtual

Upper Layer Handler.

◆ fromPhy()

virtual void fromPhy ( cPacket * pkt)
protectedvirtual

Lower Layer Handler.

Reimplemented in D2dEnbMacBase< LteMacEnb >, and D2dEnbMacBase< NrMacGnb >.

Referenced by D2dEnbMacBase< Base >::fromPhy().

◆ createRxHarqBuffer()

virtual LteHarqBufferRx * createRxHarqBuffer ( MacNodeId src,
const UserControlInfo * userInfo )
protectedvirtual

Factory for the RX HARQ buffer created upon first reception from a node. The base implementation supports the DL and UL directions only.

Reimplemented in D2dEnbMacBase< LteMacEnb >, D2dEnbMacBase< NrMacGnb >, D2dUeMacBase< LteMacUe >, and D2dUeMacBase< NrMacUe >.

◆ recordBufferOverflow()

virtual void recordBufferOverflow ( Direction dir,
double sample )
protectedvirtual

Records the buffer-overflow statistic for a dropped packet of the given direction.

Reimplemented in D2dUeMacBase< LteMacUe >, and D2dUeMacBase< NrMacUe >.

Member Data Documentation

◆ upOutGate_

cGate* upOutGate_ = nullptr
protected

MAC <– RLC.

◆ downInGate_

cGate* downInGate_ = nullptr
protected

MAC --> RLC.

◆ downOutGate_

cGate* downOutGate_ = nullptr
protected

MAC <– PHY.

◆ harqProcesses_

int harqProcesses_
protected

MAC --> PHY.

◆ ttiTick_

cMessage* ttiTick_ = nullptr
protected

TTI self message.

◆ ttiPeriod_

double ttiPeriod_ = TTI
protected

TTI for this node.

◆ nodeId_

MacNodeId nodeId_ = NODEID_NONE
protected

MacNodeId.

◆ cellId_

MacCellId cellId_
protected

◆ queueSize_

unsigned int queueSize_
protected

Mac Buffers maximum queue size.

◆ connDescOut_

std::map<MacCid, OutgoingConnectionInfo> connDescOut_
protected

Consolidated outgoing connection information (replaces mbuf_, macBuffers_, and connDesc_)

◆ macPduList_

std::map<GHz, MacPduList> macPduList_
protected

List of pdus finalized for each user on each codeword (one entry per carrier)

◆ harqTxBuffers_

std::map<GHz, HarqTxBuffers> harqTxBuffers_
protected

Harq Tx Buffers (one entry per carrier)

◆ harqRxBuffers_

std::map<GHz, HarqRxBuffers> harqRxBuffers_
protected

Harq Rx Buffers (one entry per carrier)

◆ lcConfig_

std::map<MacCid, LogicalChannelConfig> lcConfig_
protected

Per-channel RLC/logical-channel configuration pushed by the configuring entity (RRC) at bearer establishment; shared by the outgoing and incoming direction.

Referenced by findLogicalChannelConfig().