Skip to content

Commit 1189333

Browse files
committed
Pdcp: do not tweak srcId/destId in FlowControlInfo when sending DL packet over the X2 link
For DualConnectivity / Split Bearer, all DL packets arrive at the Master, and those that go via the Secondary Node must be tunnelled over to it via X2. Existing code tweaked the FlowControlInfo srcId/destId field to make it look like the packet goes Enb-to-Enb, but that is not necessary. This patch gets rid of that tweaking. Note: the useNR flag selects whether the packet should go via the Master or Secondary Enb.
1 parent 24a5786 commit 1189333

2 files changed

Lines changed: 18 additions & 22 deletions

File tree

src/simu5g/stack/pdcp/NrPdcpEnb.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ void NrPdcpEnb::analyzePacket(inet::Packet *pkt)
8686
ConnectionKey key{srcAddr, destAddr, lteInfo->getTypeOfService(), lteInfo->getDirection()};
8787
LogicalCid lcid = lookupOrAssignLcid(key);
8888

89+
// Dual Connectivity: adjust source and dest IDs for downlink packets in DC scenarios.
90+
// If this is a master eNB in DC and there's a secondary for this UE which will get this packet via X2 and transmit it via its RAN
91+
MacNodeId secondaryNodeId = binder_->getSecondaryNode(nodeId_);
92+
if (dualConnectivityEnabled_ && secondaryNodeId != NODEID_NONE && lteInfo->getUseNR()) {
93+
lteInfo->setSourceId(secondaryNodeId);
94+
lteInfo->setDestId(binder_->getNrMacNodeId(destAddr)); // use NR nodeId of the UE
95+
}
96+
8997
// assign LCID
9098
lteInfo->setLcid(lcid);
9199
}
@@ -142,21 +150,13 @@ void NrPdcpEnb::receiveDataFromSourceNode(Packet *pkt, MacNodeId sourceNode)
142150
Enter_Method("receiveDataFromSourceNode");
143151
take(pkt);
144152

145-
auto ctrlInfo = pkt->getTagForUpdate<FlowControlInfo>();
153+
auto ctrlInfo = pkt->getTag<FlowControlInfo>();
146154
if (ctrlInfo->getDirection() == DL) {
147-
// if DL, forward the PDCP PDU to the RLC layer
148-
149-
// recover the original destId of the UE, using the destAddress and write it into the ControlInfo
150-
MacNodeId destId = binder_->getNrMacNodeId(Ipv4Address(ctrlInfo->getDstAddr()));
151-
ctrlInfo->setSourceId(nodeId_);
152-
ctrlInfo->setDestId(destId);
153-
155+
MacNodeId destId = ctrlInfo->getDestId();
154156
EV << NOW << " NrPdcpEnb::receiveDataFromSourceNode - Received PDCP PDU from master node with id " << sourceNode << " - destination node[" << destId << "]" << endl;
155-
156157
sendToLowerLayer(pkt);
157158
}
158159
else { // UL
159-
// if UL, call the handler for reception from RLC layer (of the secondary node)
160160
EV << NOW << " NrPdcpEnb::receiveDataFromSourceNode - Received PDCP PDU from secondary node with id " << sourceNode << endl;
161161
fromLowerLayer(pkt);
162162
}

src/simu5g/stack/pdcp/NrTxPdcpEntity.cc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,26 @@ void NrTxPdcpEntity::deliverPdcpPdu(Packet *pkt)
2929
LteTxPdcpEntity::deliverPdcpPdu(pkt);
3030
}
3131
else { // ENODEB
32-
if (!pdcp_->isDualConnectivityEnabled()) {
33-
MacNodeId destId = lteInfo->getDestId();
34-
if (getNodeTypeById(destId) != UE)
35-
throw cRuntimeError("NrTxPdcpEntity::deliverPdcpPdu - the destination is not a UE, but Dual Connectivity is not enabled.");
32+
MacNodeId destId = lteInfo->getDestId();
33+
if (getNodeTypeById(destId) != UE)
34+
throw cRuntimeError("NrTxPdcpEntity::deliverPdcpPdu - destination must be a UE");
3635

36+
if (!pdcp_->isDualConnectivityEnabled()) {
3737
EV << NOW << " NrTxPdcpEntity::deliverPdcpPdu - LCID[" << lteInfo->getLcid() << "] - the destination is a UE. Sending packet to lower layer" << endl;
3838
LteTxPdcpEntity::deliverPdcpPdu(pkt);
3939
}
4040
else {
41-
MacNodeId destId = lteInfo->getDestId();
4241
bool useNR = lteInfo->getUseNR();
4342
if (!useNR) {
44-
if (getNodeTypeById(destId) != UE)
45-
throw cRuntimeError("NrTxPdcpEntity::deliverPdcpPdu - the destination is a UE under the control of a secondary node, but the packet has not been marked as NR packet.");
46-
4743
EV << NOW << " NrTxPdcpEntity::deliverPdcpPdu - LCID[" << lteInfo->getLcid() << "] useNR[" << useNR << "] - the destination is a UE. Sending packet to lower layer." << endl;
4844
LteTxPdcpEntity::deliverPdcpPdu(pkt);
4945
}
5046
else { // useNR
51-
if (getNodeTypeById(destId) == UE)
52-
throw cRuntimeError("NrTxPdcpEntity::deliverPdcpPdu - the packet has been marked as NR packet, but the destination is not the secondary node");
53-
5447
EV << NOW << " NrTxPdcpEntity::deliverPdcpPdu - LCID[" << lteInfo->getLcid() << "] - the destination is under the control of a secondary node" << endl;
55-
pdcp_->forwardDataToTargetNode(pkt, destId);
48+
MacNodeId secondaryNodeId = pdcp_->binder_->getSecondaryNode(pdcp_->nodeId_);
49+
ASSERT(secondaryNodeId != NODEID_NONE);
50+
ASSERT(secondaryNodeId != pdcp_->nodeId_);
51+
pdcp_->forwardDataToTargetNode(pkt, secondaryNodeId);
5652
}
5753
}
5854
}

0 commit comments

Comments
 (0)