Skip to content

Commit b9e5b9a

Browse files
committed
PacketFlowManager: comments cleaned up
1 parent e444559 commit b9e5b9a

4 files changed

Lines changed: 68 additions & 173 deletions

File tree

src/simu5g/stack/packetFlowManager/PacketFlowManagerBase.h

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,26 @@ class LteRlcUmDataPdu;
2626
struct StatusDescriptor;
2727

2828
/**
29-
* This module is responsible for keeping track of all PDCP SDUs.
29+
* This module is responsible for keeping tracking the flow of SDUs in the stack,
30+
* and compute statistics from them. It is passive observer of the packet flow.
31+
*
3032
* A PDCP SDU is encapsulated in the following packets while it is going down
3133
* through the LTE NIC layers:
3234
*
33-
* PDCP SDU
34-
* some operations
35-
* PDCP PDU
36-
* RLC SDU
37-
* RLC PDU or fragmented into more than one RLC PDUs
38-
* MAC SDU
39-
* inserted into one TB
40-
* MAC PDU (aka TB)
35+
* - PDCP SDU
36+
* - some operations
37+
* - PDCP PDU
38+
* - RLC SDU
39+
* - RLC PDU or fragmented into more than one RLC PDUs
40+
* - MAC SDU
41+
* - inserted into one TB
42+
* - MAC PDU (aka TB)
4143
*
42-
* Each PDCP has its own seq number, managed by the corresponding LCID
44+
* Each PDCP has its own sequence number, managed by the corresponding LCID
4345
*
4446
* The main functions of this module are:
4547
* - detect PDCP SDUs discarded (no part transmitted)
46-
* - calculate the delay time of a pkt, from PDCP SDU to last Harq ACK of the
48+
* - calculate the delay time of a packet, from PDCP SDU to last HARQ ACK of the
4749
* corresponding seq number.
4850
*/
4951
class PacketFlowManagerBase : public cSimpleModule
@@ -66,7 +68,7 @@ class PacketFlowManagerBase : public cSimpleModule
6668
DiscardedPkts pktDiscardCounterTotal_; // total discarded packets counter of the node
6769

6870
RanNodeType nodeType_; // UE or ENODEB (used for set MACROS)
69-
short int harqProcesses_; // number of harq processes
71+
short int harqProcesses_; // number of HARQ processes
7072

7173
std::string pfmType;
7274

@@ -77,77 +79,81 @@ class PacketFlowManagerBase : public cSimpleModule
7779
void initialize(int stage) override;
7880
void finish() override;
7981

80-
// return true if a structure for this lcid is present
82+
// Return true if a data structure for this LCID is present
8183
virtual bool hasLcid(LogicalCid lcid) = 0;
82-
/*
83-
* initialize a new structure for this lcid
84-
* abstract since in eNodeB case, it initializes
85-
* different structure with respect to the UE
86-
*/
84+
85+
// Initialize a new data structure for this LCID. Abstract since in eNodeB case,
86+
// it initializes different structures with respect to the UE
8787
virtual void initLcid(LogicalCid lcid, MacNodeId nodeId) = 0;
8888

89-
/* reset the structure for this lcid
90-
* abstract since in eNodeB case, it clears
91-
* different structure with respect to the UE
92-
*/
89+
// Reset the data structure for this LCID. Abstract since in eNodeB case,
90+
// it clears different structures with respect to the UE
9391
virtual void clearLcid(LogicalCid lcid) = 0;
9492

95-
// reset structures for all connections
93+
// Reset data structures for all connections
9694
virtual void clearAllLcid() = 0;
9795

9896
public:
99-
/*
100-
* This method inserts a new pdcp seqnum and the corresponding entry time
101-
* @param lcid
102-
* @param pdcpSno sequence number of the pdcp pdu
103-
* @param entryTime the time the packet enters the PDCP layer
104-
*
105-
* Used only by the eNodeB packetFlowManager
97+
/**
98+
* This method is called when a PDCP SDU enters the PDCP layer for downlink transmission.
99+
* It records the PDCP sequence number and entry timestamp in the tracking data structures
100+
* to enable delay measurement and packet flow monitoring. Used only by the eNodeB.
106101
*/
107102
virtual void insertPdcpSdu(inet::Packet *pdcpPkt) = 0;
103+
104+
/**
105+
* This method is called when a PDCP SDU is received on the uplink.
106+
* It tracks uplink data volume and packet loss rate statistics.
107+
*/
108108
virtual void receivedPdcpSdu(inet::Packet *pdcpPkt) = 0;
109109

110-
/*
111-
* This method inserts a new rlc seqnum and the corresponding pdcp pdus inside it
112-
* @param lcid
113-
* @param rlcPdu packet pointer
110+
/**
111+
* This method is called when an RLC PDU is created from PDCP SDUs for transmission.
112+
* It records the mapping between the RLC PDU and its contained PDCP SDUs in the tracking
113+
* data structures, along with burst status information for throughput measurement.
114114
*/
115115
virtual void insertRlcPdu(LogicalCid lcid, const inet::Ptr<LteRlcUmDataPdu> rlcPdu, RlcBurstStatus status) = 0;
116116

117-
/*
118-
* This method inserts a new macPduId Omnet id and the corresponding rlc pdus inside it
119-
* @param lcid
120-
* @param macPdu packet pointer
117+
/**
118+
* This method is called when a MAC PDU is inserted into the HARQ buffer for transmission.
119+
* It records the mapping between the MAC PDU and its contained RLC PDUs in the tracking
120+
* data structures for downlink packet flow management.
121121
*/
122122
virtual void insertMacPdu(const inet::Ptr<const LteMacPdu> macPdu) = 0;
123123

124-
/*
125-
* This method checks if the HARQ aSequenceNumberSet related to a macPduId acknowledges an ENTIRE
126-
* pdcp sdu
127-
* @param lcid
128-
* @param macPduId Omnet id of the mac pdu
124+
/**
125+
* This method is called when a downlink MAC PDU is successfully acknowledged by the UE.
126+
* It processes the acknowledgment to determine if complete PDCP SDUs have been delivered,
127+
* calculates packet delays, and updates statistics for downlink transmission.
129128
*/
130129
virtual void macPduArrived(const inet::Ptr<const LteMacPdu> macPdu) = 0;
131130

131+
/**
132+
* This method is called when an uplink MAC PDU is received from a UE at the eNodeB.
133+
* It measures uplink packet delay by matching the received PDU with the corresponding
134+
* grant that was previously sent to the UE (identified by grantId).
135+
*/
132136
virtual void ulMacPduArrived(MacNodeId nodeId, unsigned int grantId) {};
133-
/*
137+
138+
/**
134139
* This method is called after maxHarqTransmission of a MAC PDU ID has been
135-
* reached. The PDCP, RLC, seq numbers referred to the macPdu are cleared from the
136-
* data structures
137-
* @param lcid
138-
* @param macPduId Omnet id of the mac pdu to be discarded
140+
* reached. The PDCP, RLC sequence numbers referred to the MAC PDU are cleared from the
141+
* data structures.
139142
*/
140143
virtual void discardMacPdu(const inet::Ptr<const LteMacPdu> macPdu) = 0;
141144

142-
/*
143-
* This method is used to keep track of all discarded RLC pdus. If all rlc pdus
144-
* that compose a PDCP SDU have been discarded the discarded counters are updated
145-
* @param lcid
146-
* @param rlcSno sequence number of the rlc pdu
147-
* @param fromMac used when this method is called by discardMacPdu
145+
/**
146+
* This method is used to keep track of all discarded RLC PDUs. If all RLC PDUs
147+
* that compose a PDCP SDU have been discarded, the discarded counters are updated.
148+
* The fromMac parameter is used when this method is called by discardMacPdu.
148149
*/
149150
virtual void discardRlcPdu(LogicalCid lcid, unsigned int rlcSno, bool fromMac = false) = 0;
150151

152+
/**
153+
* This method is called when an uplink grant is sent to a UE.
154+
* It records the grant transmission timestamp to enable uplink delay
155+
* measurement when the corresponding MAC PDU is received.
156+
*/
151157
virtual void grantSent(MacNodeId nodeId, unsigned int grantId) {}
152158

153159
virtual void resetDiscardCounter();
@@ -156,4 +162,3 @@ class PacketFlowManagerBase : public cSimpleModule
156162
} //namespace
157163

158164
#endif
159-

src/simu5g/stack/packetFlowManager/PacketFlowManagerEnb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void PacketFlowManagerEnb::clearAllLcid()
8585
EV_FATAL << NOW << " " << pfmType << "::clearAllLcid - cleared data structures for all lcids " << endl;
8686
}
8787

88-
void PacketFlowManagerEnb::initPdcpStatus(StatusDescriptor *desc, unsigned int pdcp, unsigned int sduHeaderSize, simtime_t& arrivalTime)
88+
void PacketFlowManagerEnb::initPdcpStatus(StatusDescriptor *desc, unsigned int pdcp, unsigned int sduHeaderSize, simtime_t arrivalTime)
8989
{
9090
// if pdcpStatus_ already present, error
9191
std::map<unsigned int, PdcpStatus>::iterator it = desc->pdcpStatus_.find(pdcp);

src/simu5g/stack/packetFlowManager/PacketFlowManagerEnb.h

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,7 @@ using namespace omnetpp;
2626
class LteRlcUmDataPdu;
2727

2828
/**
29-
* This module is responsible for keeping track of all PDCP SDUs.
30-
* A PDCP SDU passes through the following states while it is going down
31-
* through the LTE NIC layers:
32-
*
33-
* PDCP SDU
34-
* few operations
35-
* PDCP PDU
36-
* RLC SDU
37-
* RLC PDU or fragmented into more than one RLC PDU
38-
* MAC SDU
39-
* inserted into one TB
40-
* MAC PDU (aka TB)
41-
*
42-
* Each PDCP has its own sequence number, managed by the corresponding LCID
43-
*
44-
* The main functions of this module are:
45-
* - detect PDCP SDU discarded (no part transmitted)
46-
* - calculate the delay time of a packet, from PDCP SDU to last Harq ACK of the
47-
* corresponding sequence number.
29+
* The eNB-specific version of PacketFlowManager.
4830
*/
4931
class PacketFlowManagerEnb : public PacketFlowManagerBase
5032
{
@@ -129,15 +111,15 @@ class PacketFlowManagerEnb : public PacketFlowManagerBase
129111
* total of the burst size.
130112
* It is called by macPduArrived (ack true) and rlcPduDiscarded (ack false)
131113
* @param desc LCID descriptor
132-
* @param pdcpSno PDCP sequence number
114+
* @param rlcSno RLC sequence number
133115
* @bool ack PDCP acknowledgment flag
134116
*/
135117
void removePdcpBurstRLC(StatusDescriptor *desc, unsigned int rlcSno, bool ack);
136118

137119
/*
138120
* This method creates a pdcpStatus structure when a PDCP SDU arrives at the PDCP layer.
139121
*/
140-
void initPdcpStatus(StatusDescriptor *desc, unsigned int pdcp, unsigned int sduHeaderSize, simtime_t& arrivalTime);
122+
void initPdcpStatus(StatusDescriptor *desc, unsigned int pdcp, unsigned int sduHeaderSize, simtime_t arrivalTime);
141123

142124
// return true if a structure for this LCID is present
143125
bool hasLcid(LogicalCid lcid) override;
@@ -151,50 +133,20 @@ class PacketFlowManagerEnb : public PacketFlowManagerBase
151133
public:
152134
void insertPdcpSdu(inet::Packet *pdcpPkt) override;
153135
void receivedPdcpSdu(inet::Packet *pdcpPkt) override;
154-
155136
void insertRlcPdu(LogicalCid lcid, const inet::Ptr<LteRlcUmDataPdu> rlcPdu, RlcBurstStatus status) override;
156-
157137
void insertMacPdu(inet::Ptr<const LteMacPdu>) override;
158-
159-
/*
160-
* This method checks if the HARQ acknowledgment relative to a macPduId acknowledges an ENTIRE
161-
* PDCP SDU
162-
* @param lcid
163-
* @param macPduId Omnet ID of the MAC PDU
164-
*/
165138
void macPduArrived(inet::Ptr<const LteMacPdu>) override;
166-
167139
void ulMacPduArrived(MacNodeId nodeId, unsigned int grantId) override;
168-
169-
/*
170-
* This method is called after maxHarqTransmission of a MAC PDU ID has been
171-
* reached. The PDCP, RLC, SN referred to the macPdu are cleared from the
172-
* data structures
173-
* @param lcid
174-
* @param macPduId Omnet ID of the MAC PDU to be discarded
175-
*/
176140
void discardMacPdu(const inet::Ptr<const LteMacPdu> macPdu) override;
177-
178-
/*
179-
* This method is used to keep track of all discarded RLC PDUs. If all RLC PDUs
180-
* that compose a PDCP SDU have been discarded the discarded counters are updated
181-
* @param lcid
182-
* @param rlcSno sequence number of the RLC PDU
183-
* @param fromMac used when this method is called by discardMacPdu
184-
*/
185141
void discardRlcPdu(LogicalCid lcid, unsigned int rlcSno, bool fromMac = false) override;
186-
187142
void grantSent(MacNodeId nodeId, unsigned int grantId) override;
188143

189-
/*
190-
* deletes all the LCID structures related to the UE
191-
* called upon handover
144+
/**
145+
* Deletes all the LCID structures related to the UE. Called upon handover.
192146
*/
193147
virtual void deleteUe(MacNodeId id);
194148

195-
/*
196-
* The methods are called for a specific UE
197-
*/
149+
// Per-UE statistics
198150

199151
virtual uint64_t getDataVolume(MacNodeId nodeId, Direction dir);
200152
virtual void resetDataVolume(MacNodeId nodeId, Direction dir);

src/simu5g/stack/packetFlowManager/PacketFlowManagerUe.h

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,10 @@ class LteRlcUmDataPdu;
2323
class LtePdcpUe;
2424

2525
/**
26-
* This module is responsible for keeping track of all PDCP SDUs.
27-
* A PDCP SDU passes through the following states while it is going down
28-
* through the LTE NIC layers:
29-
*
30-
* PDCP SDU
31-
* few operations
32-
* PDCP PDU
33-
* RLC SDU
34-
* RLC PDU or fragmented into more than one RLC PDU
35-
* MAC SDU
36-
* inserted into one TB
37-
* MAC PDU (aka TB)
38-
*
39-
* Each PDCP has its own sequence number, managed by the corresponding LCID.
40-
*
41-
* The main functions of this module are:
42-
* - detect PDCP SDU discarded (no part transmitted)
43-
* - calculate the delay time of a packet, from PDCP SDU to last HARQ ACK of the
44-
* corresponding sequence number.
26+
* The UE-specific version of Packet Flow Manager.
4527
*/
4628
class PacketFlowManagerUe : public PacketFlowManagerBase
4729
{
48-
4930
/*
5031
* The node can have different active connections (LCID) at the same time, hence we need to
5132
* maintain the status for each of them.
@@ -69,12 +50,10 @@ class PacketFlowManagerUe : public PacketFlowManagerBase
6950
std::set<unsigned int> myset;
7051

7152
protected:
72-
7353
void initialize(int stage) override;
7454
void finish() override;
7555

7656
void initPdcpStatus(StatusDescriptor *desc, unsigned int pdcp, unsigned int sduHeaderSize, simtime_t& arrivalTime);
77-
7857
// return true if a structure for this LCID is present
7958
bool hasLcid(LogicalCid lcid) override;
8059
// initialize a new structure for this LCID
@@ -86,57 +65,16 @@ class PacketFlowManagerUe : public PacketFlowManagerBase
8665

8766
public:
8867
void insertPdcpSdu(inet::Packet *pdcpPkt) override;
89-
9068
void receivedPdcpSdu(inet::Packet *pdcpPkt) override { /*TODO*/ }
91-
92-
/*
93-
* This method inserts a new RLC sequence number and the corresponding PDCP PDUs inside it.
94-
* @param lcid
95-
* @param rlcSno sequence number of the RLC PDU
96-
* @param pdcpSnoSet list of PDCP PDUs inside the RLC PDU
97-
* @param lastIsFrag used to inform if the last PDCP is fragmented or not.
98-
*/
99-
10069
void insertRlcPdu(LogicalCid lcid, const inet::Ptr<LteRlcUmDataPdu> rlcPdu, RlcBurstStatus status) override;
101-
102-
/*
103-
* This method inserts a new MAC PDU ID Omnet ID and the corresponding RLC PDUs inside it.
104-
* @param lcid
105-
* @param macPdu packet pointer
106-
*/
10770
void insertMacPdu(const inet::Ptr<const LteMacPdu> macPdu) override;
108-
109-
/*
110-
* This method checks if the HARQ ACK sequence number set relative to a MAC PDU ID acknowledges an ENTIRE
111-
* PDCP SDU.
112-
* @param lcid
113-
* @param macPduId Omnet ID of the MAC PDU
114-
*/
11571
void macPduArrived(const inet::Ptr<const LteMacPdu> macPdu) override;
116-
117-
/*
118-
* This method is called after the maximum HARQ transmission of a MAC PDU ID has been
119-
* reached. The PDCP, RLC, sequence number referred to the MAC PDU are cleared from the
120-
* data structures.
121-
* @param lcid
122-
* @param macPduId Omnet ID of the MAC PDU to be discarded
123-
*/
12472
void discardMacPdu(const inet::Ptr<const LteMacPdu> macPdu) override;
125-
126-
/*
127-
* This method is used to keep track of all discarded RLC PDUs. If all RLC PDUs
128-
* that compose a PDCP SDU have been discarded, the discard counters are updated.
129-
* @param lcid
130-
* @param rlcSno sequence number of the RLC PDU
131-
* @param fromMac used when this method is called by discardMacPdu
132-
*/
13373
void discardRlcPdu(LogicalCid lcid, unsigned int rlcSno, bool fromMac = false) override;
13474

13575
DiscardedPkts getDiscardedPkt();
136-
13776
double getDelayStats();
13877
void resetDelayCounter();
139-
14078
};
14179

14280
} //namespace

0 commit comments

Comments
 (0)