Skip to content

Commit 3938a88

Browse files
committed
Rlc: converting LteRlcPduNewData chunk to tag
As it is not real packet data, just a simulation artifact for communication between protocol layers (RLC->MAC notification) No fingerprint change!
1 parent 7ac17c6 commit 3938a88

8 files changed

Lines changed: 53 additions & 24 deletions

File tree

src/simu5g/stack/mac/LteMacEnb.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "simu5g/stack/phy/LtePhyBase.h"
3434
#include "simu5g/stack/rlc/packet/LteRlcPdu_m.h"
3535
#include "simu5g/stack/rlc/packet/LteRlcPdu_m.h"
36+
#include "simu5g/stack/rlc/packet/LteRlcNewDataTag_m.h"
3637
#include "simu5g/stack/packetFlowManager/PacketFlowManagerBase.h"
3738
#include "simu5g/stack/rlc/um/LteRlcUm.h"
3839
#include "simu5g/stack/pdcp/NrPdcpEnb.h"
@@ -672,10 +673,11 @@ bool LteMacEnb::bufferizePacket(cPacket *cpkt)
672673
LteMacBuffer *vqueue = connInfo.buffer;
673674

674675
// this packet is used to signal the arrival of new data in the RLC buffers
675-
if (checkIfHeaderType<LteRlcPduNewData>(pkt)) {
676+
if (pkt->findTag<LteRlcNewDataTag>()) {
676677
// update the virtual buffer for this connection
677678
// build the virtual packet corresponding to this incoming packet
678-
pkt->popAtFront<LteRlcPduNewData>();
679+
// remove the tag since it's just a notification
680+
pkt->removeTag<LteRlcNewDataTag>();
679681
auto rlcSdu = pkt->peekAtFront<LteRlcSdu>();
680682
PacketInfo vpkt(rlcSdu->getLengthMainPacket(), pkt->getTimestamp());
681683
vqueue->pushBack(vpkt);
@@ -719,7 +721,7 @@ void LteMacEnb::handleUpperMessage(cPacket *pktAux)
719721
auto lteInfo = pkt->getTag<FlowControlInfo>();
720722
MacCid cid = MacCid(lteInfo->getDestId(), lteInfo->getLcid());
721723

722-
bool isLteRlcPduNewData = checkIfHeaderType<LteRlcPduNewData>(pkt);
724+
bool isLteRlcPduNewData = (pkt->findTag<LteRlcNewDataTag>() != nullptr);
723725

724726
bool packetIsBuffered = bufferizePacket(pkt); // will buffer (or destroy if the queue is full)
725727

src/simu5g/stack/mac/LteMacUe.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "simu5g/stack/mac/scheduler/LteSchedulerUeUl.h"
2424
#include "simu5g/stack/rlc/packet/LteRlcPdu_m.h"
2525
#include "simu5g/stack/rlc/packet/LteRlcSdu_m.h"
26+
#include "simu5g/stack/rlc/packet/LteRlcNewDataTag_m.h"
2627

2728
namespace simu5g {
2829

@@ -266,10 +267,11 @@ bool LteMacUe::bufferizePacket(cPacket *cpkt)
266267
LteMacBuffer *vqueue = connInfo.buffer;
267268

268269
// this packet is used to signal the arrival of new data in the RLC buffers
269-
if (checkIfHeaderType<LteRlcPduNewData>(pkt)) {
270+
if (pkt->findTag<LteRlcNewDataTag>()) {
271+
// remove the tag since it's just a notification
272+
pkt->removeTag<LteRlcNewDataTag>();
270273
// update the virtual buffer for this connection
271274
// build the virtual packet corresponding to this incoming packet
272-
pkt->popAtFront<LteRlcPduNewData>();
273275
auto rlcSdu = pkt->peekAtFront<LteRlcSdu>();
274276
PacketInfo vpkt(rlcSdu->getLengthMainPacket(), pkt->getTimestamp());
275277
vqueue->pushBack(vpkt);
@@ -564,7 +566,7 @@ void LteMacUe::macPduUnmake(cPacket *cpkt)
564566
void LteMacUe::handleUpperMessage(cPacket *pktAux)
565567
{
566568
auto pkt = check_and_cast<Packet *>(pktAux);
567-
bool isLteRlcPduNewDataInd = checkIfHeaderType<LteRlcPduNewData>(pkt);
569+
bool isLteRlcPduNewDataInd = (pkt->findTag<LteRlcNewDataTag>() != nullptr);
568570

569571
// bufferize packet
570572
bufferizePacket(pkt);

src/simu5g/stack/rlc/am/LteRlcAm.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "simu5g/stack/rlc/am/AmTxQueue.h"
1717
#include "simu5g/stack/rlc/am/AmRxQueue.h"
1818
#include "simu5g/stack/mac/packet/LteMacSduRequest.h"
19+
#include "simu5g/stack/rlc/packet/LteRlcNewDataTag_m.h"
1920

2021
namespace simu5g {
2122

@@ -232,8 +233,8 @@ void LteRlcAm::indicateNewDataToMac(cPacket *pktAux) {
232233

233234
newData->insertAtFront(rlcSdu);
234235

235-
auto newDataHdr = inet::makeShared<LteRlcPduNewData>();
236-
newData->insertAtFront(newDataHdr);
236+
// add tag to indicate new data availability to MAC
237+
newData->addTag<LteRlcNewDataTag>();
237238

238239
newData->copyTags(*pkt);
239240

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Simu5G
3+
//
4+
// Authors: Giovanni Nardini, Giovanni Stea, Antonio Virdis (University of Pisa)
5+
//
6+
// This file is part of a software released under the license included in file
7+
// "license.pdf". Please read LICENSE and README files before using it.
8+
// The above files and the present reference are part of the software itself,
9+
// and cannot be removed from it.
10+
//
11+
12+
import inet.common.INETDefs;
13+
import inet.common.TagBase;
14+
15+
namespace simu5g;
16+
17+
//
18+
// @class LteRlcNewDataTag
19+
// @brief Tag to indicate new data availability to MAC layer
20+
//
21+
// This tag replaces LteRlcPduNewData chunk and serves as a notification
22+
// mechanism to inform the MAC layer that new data is available in the
23+
// RLC transmission buffers. It carries no data fields - its mere presence
24+
// on a packet indicates new data availability.
25+
//
26+
class LteRlcNewDataTag extends inet::TagBase
27+
{
28+
// No fields needed - this is purely a notification tag
29+
}

src/simu5g/stack/rlc/packet/LteRlcPdu.msg

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ class size_t {
2727

2828
namespace simu5g;
2929

30-
// new data indication for MAC
31-
class LteRlcPduNewData extends inet::FieldsChunk
32-
{
33-
chunkLength = inet::B(0);
34-
}
35-
3630
class LteRlcDataPdu extends inet::FieldsChunk
3731
{
3832
chunkLength = inet::b(1);

src/simu5g/stack/rlc/tm/LteRlcTm.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "simu5g/stack/rlc/packet/LteRlcPdu_m.h"
1616
#include "simu5g/stack/rlc/packet/LteRlcSdu_m.h"
1717
#include "simu5g/stack/mac/packet/LteMacSduRequest.h"
18+
#include "simu5g/stack/rlc/packet/LteRlcNewDataTag_m.h"
1819

1920
namespace simu5g {
2021

@@ -65,13 +66,13 @@ void LteRlcTm::handleUpperMessage(cPacket *pktAux)
6566
emit(signal, 0.0);
6667

6768
// create a message to notify the MAC layer that the queue contains new data
68-
auto newDataPkt = inet::makeShared<LteRlcPduNewData>();
6969
// make a copy of the RLC SDU
7070
// the MAC will only be interested in the size of this packet
7171
auto pktDup = pkt->dup();
72-
pktDup->insertAtFront(newDataPkt);
72+
// add tag to indicate new data availability to MAC
73+
pktDup->addTag<LteRlcNewDataTag>();
7374

74-
EV << "LteRlcTm::handleUpperMessage - Sending message " << newDataPkt->getName() << " to port TM_Sap_down$o\n";
75+
EV << "LteRlcTm::handleUpperMessage - Sending new data indication to port TM_Sap_down$o\n";
7576
emit(sentPacketToLowerLayerSignal_, pktDup);
7677
send(pktDup, downOutGate_);
7778
}
@@ -139,4 +140,3 @@ void LteRlcTm::handleMessage(cMessage *msg)
139140
}
140141

141142
} //namespace
142-

src/simu5g/stack/rlc/um/LteRlcUm.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "simu5g/stack/rlc/um/LteRlcUm.h"
1616
#include "simu5g/stack/mac/packet/LteMacSduRequest.h"
17+
#include "simu5g/stack/rlc/packet/LteRlcNewDataTag_m.h"
1718

1819
namespace simu5g {
1920

@@ -131,13 +132,13 @@ void LteRlcUm::handleUpperMessage(cPacket *pktAux)
131132
EV << "LteRlcUm::handleUpperMessage - Enqueue packet " << rlcPkt->getClassName() << " into the Tx Buffer\n";
132133

133134
// create a message to notify the MAC layer that the queue contains new data
134-
auto newDataPkt = inet::makeShared<LteRlcPduNewData>();
135135
// make a copy of the RLC SDU
136136
auto pktDup = pkt->dup();
137-
pktDup->insertAtFront(newDataPkt);
137+
// add tag to indicate new data availability to MAC
138+
pktDup->addTag<LteRlcNewDataTag>();
138139
// the MAC will only be interested in the size of this packet
139140

140-
EV << "LteRlcUm::handleUpperMessage - Sending message " << newDataPkt->getClassName() << " to port UM_Sap_down$o\n";
141+
EV << "LteRlcUm::handleUpperMessage - Sending new data indication to port UM_Sap_down$o\n";
141142
send(pktDup, downOutGate_);
142143
}
143144
else {

src/simu5g/stack/rlc/um/UmTxEntity.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "simu5g/stack/rlc/um/UmTxEntity.h"
1313
#include "simu5g/stack/rlc/packet/LteRlcPdu_m.h"
14+
#include "simu5g/stack/rlc/packet/LteRlcNewDataTag_m.h"
1415

1516
#include "simu5g/stack/packetFlowManager/PacketFlowManagerUe.h"
1617
#include "simu5g/stack/packetFlowManager/PacketFlowManagerEnb.h"
@@ -321,10 +322,10 @@ void UmTxEntity::resumeDownstreamInPackets()
321322
// store the SDU in the TX buffer
322323
if (enque(pktRlc)) {
323324
// create a message to notify the MAC layer that the queue contains new data
324-
auto newDataPkt = inet::makeShared<LteRlcPduNewData>();
325325
// make a copy of the RLC SDU
326326
auto pktRlcdup = pktRlc->dup();
327-
pktRlcdup->insertAtFront(newDataPkt);
327+
// add tag to indicate new data availability to MAC
328+
pktRlcdup->addTag<LteRlcNewDataTag>();
328329
// send the new data indication to the MAC
329330
lteRlc_->sendToLowerLayer(pktRlcdup);
330331
}
@@ -373,4 +374,3 @@ void UmTxEntity::rlcHandleD2DModeSwitch(bool oldConnection, bool clearBuffer)
373374
}
374375

375376
} //namespace
376-

0 commit comments

Comments
 (0)