Skip to content

Commit 95d1ded

Browse files
committed
fix PDCP bug
Failures: /simulations/nr/dualConnectivity_multicell/ -f omnetpp.ini -c SplitBearer-CBR-DL -r 0 (some fingerprint mismatch: actual '09f4-2368/tplx;9051-9bc4/sz', expected: '08b0-117e/tplx;6ae8-d7e6/sz') /simulations/nr/dualConnectivity/ -f omnetpp.ini -c DualConn-SplitBearer-DL -r 0 (some fingerprint mismatch: actual '8374-3d2c/tplx;b1ad-9eca/sz', expected: '2a68-ef06/tplx;a8eb-317b/sz') /simulations/nr/dualConnectivity/ -f omnetpp.ini -c DualConn-SplitBearer-UL -r 0 (some fingerprint mismatch: actual '4a58-fbc0/tplx;10fc-8897/~tNl;8d56-a05a/sz', expected: '1edd-20b8/tplx;918b-7244/~tNl;d494-fafd/sz') /simulations/nr/test_numerology/ -f omnetpp.ini -c MultiCell-CBR-DL -r 0 (some fingerprint mismatch: actual '734e-aeb6/tplx;ba3b-79af/sz', expected: 'dc64-0700/tplx;2be7-67b0/sz') /simulations/nr/test_numerology/ -f omnetpp.ini -c MultiCell-CBR-UL -r 0 (some fingerprint mismatch: actual '9fa6-61ae/tplx;fbcb-904c/~tNl;7037-b0f5/sz', expected: '29d2-5907/tplx;6ea1-c40a/~tNl;e70b-6f52/sz') ---------------------------------------------------------------------- Ran 127 tests in 163.028s FAILED (failures=5) Failures: /simulations/nr/dualConnectivity_multicell/ -f omnetpp.ini -c SplitBearer-CBR-DL -r 0 (some fingerprint mismatch: actual '09f4-2368/tplx;9051-9bc4/sz', expected: '08b0-117e/tplx;6ae8-d7e6/sz') /simulations/nr/dualConnectivity/ -f omnetpp.ini -c DualConn-SplitBearer-DL -r 0 (some fingerprint mismatch: actual '8374-3d2c/tplx;b1ad-9eca/sz', expected: '2a68-ef06/tplx;a8eb-317b/sz') /simulations/nr/dualConnectivity/ -f omnetpp.ini -c DualConn-SplitBearer-UL -r 0 (some fingerprint mismatch: actual '4a58-fbc0/tplx;10fc-8897/~tNl;8d56-a05a/sz', expected: '1edd-20b8/tplx;918b-7244/~tNl;d494-fafd/sz') /simulations/nr/test_numerology/ -f omnetpp.ini -c MultiCell-CBR-DL -r 0 (some fingerprint mismatch: actual '734e-aeb6/tplx;ba3b-79af/sz', expected: 'dc64-0700/tplx;2be7-67b0/sz') /simulations/nr/test_numerology/ -f omnetpp.ini -c MultiCell-CBR-UL -r 0 (some fingerprint mismatch: actual '9fa6-61ae/tplx;fbcb-904c/~tNl;7037-b0f5/sz', expected: '29d2-5907/tplx;6ea1-c40a/~tNl;e70b-6f52/sz') ---------------------------------------------------------------------- Ran 127 tests in 164.289s FAILED (failures=5)
1 parent 8d9ccb2 commit 95d1ded

1 file changed

Lines changed: 29 additions & 23 deletions

File tree

src/simu5g/stack/pdcp/LtePdcp.cc

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

1212
#include "simu5g/stack/pdcp/LtePdcp.h"
1313

14-
#include <inet/common/stlutils.h>
1514
#include <inet/networklayer/ipv4/Ipv4Header_m.h>
1615
#include <inet/transportlayer/tcp_common/TcpHeader.h>
1716
#include <inet/transportlayer/udp/UdpHeader_m.h>
@@ -152,6 +151,17 @@ void LtePdcpBase::fromDataPort(cPacket *pktAux)
152151

153152
MacCid cid = MacCid(lteInfo->getDestId(), lteInfo->getLcid());
154153

154+
// Handle DC setup: Assume packet arrives in Master nodeB (LTE), and wants to use Secondary nodeB (NR).
155+
// Packet is processed by local PDCP entity, then needs to be tunneled over X2 to Secondary for transmission.
156+
// However, local PDCP entity is keyed on LTE nodeIds, so we need to tweak the cid and replace NR nodeId
157+
// with LTE nodeId so that lookup succeeds.
158+
if (getNodeTypeById(nodeId_) == ENODEB && lteInfo->getMulticastGroupId() == -1 && binder_->isGNodeB(nodeId_) != isNrUe(lteInfo->getDestId()) ) {
159+
// use another CID whose technology matches the nodeB
160+
MacNodeId otherDestId = binder_->getUeNodeId(lteInfo->getDestId(), !isNrUe(lteInfo->getDestId()));
161+
ASSERT(otherDestId != NODEID_NONE);
162+
cid = MacCid(otherDestId, lteInfo->getLcid());
163+
}
164+
155165
LteTxPdcpEntity *entity = lookupTxEntity(cid);
156166

157167
// get the PDCP entity for this LCID and process the packet
@@ -160,18 +170,8 @@ void LtePdcpBase::fromDataPort(cPacket *pktAux)
160170
<< " multicast=" << lteInfo->getMulticastGroupId() << " direction=" << dirToA((Direction)lteInfo->getDirection())
161171
<< " ---> CID " << cid << (entity == nullptr ? " (NEW)" : " (existing)") << std::endl;
162172

163-
if (entity == nullptr) {
173+
if (entity == nullptr)
164174
entity = createTxEntity(cid);
165-
166-
// check for bug
167-
if (getNodeTypeById(nodeId_) == ENODEB && lteInfo->getMulticastGroupId() == -1) {
168-
MacCid lteCid = MacCid(binder_->getUeNodeId(lteInfo->getDestId(), false), lteInfo->getLcid());
169-
MacCid nrCid = MacCid(binder_->getUeNodeId(lteInfo->getDestId(), true), lteInfo->getLcid());
170-
if (inet::containsKey(txEntities_, lteCid) && inet::containsKey(txEntities_, nrCid))
171-
throw cRuntimeError("Both LTE and NR cids of same UE are present as txEntities_ keys: %s, %s", lteCid.str().c_str(), nrCid.str().c_str());
172-
}
173-
}
174-
175175
entity->handlePacketFromUpperLayer(pkt);
176176
}
177177

@@ -186,21 +186,27 @@ void LtePdcpBase::fromLowerLayer(cPacket *pktAux)
186186

187187
auto lteInfo = pkt->getTag<FlowControlInfo>();
188188

189-
MacCid cid = MacCid(lteInfo->getSourceId(), lteInfo->getLcid()); // TODO: check if you have to get master node id
189+
MacCid cid = MacCid(lteInfo->getSourceId(), lteInfo->getLcid());
190+
191+
// Handle DC setup: Assume packet arrives at this Master nodeB (LTE) from Secondary (NR) over X2.
192+
// Packet needs to be processed by local PDCP entity. However, local PDCP entity is keyed on LTE nodeIds,
193+
// so we need to tweak the cid and replace NR nodeId with LTE nodeId so that lookup succeeds.
194+
if (getNodeTypeById(nodeId_) == ENODEB && lteInfo->getMulticastGroupId() == -1 && binder_->isGNodeB(nodeId_) != isNrUe(lteInfo->getSourceId()) ) {
195+
// use another CID whose technology matches the nodeB
196+
MacNodeId otherSourceId = binder_->getUeNodeId(lteInfo->getSourceId(), !isNrUe(lteInfo->getSourceId()));
197+
ASSERT(otherSourceId != NODEID_NONE);
198+
cid = MacCid(otherSourceId, lteInfo->getLcid());
199+
}
190200

191201
LteRxPdcpEntity *entity = lookupRxEntity(cid);
192-
if (entity == nullptr) {
193-
entity = createRxEntity(cid);
194202

195-
// check for bug
196-
if (getNodeTypeById(nodeId_) == ENODEB && lteInfo->getMulticastGroupId() == -1) {
197-
MacCid lteCid = MacCid(binder_->getUeNodeId(lteInfo->getSourceId(), false), lteInfo->getLcid());
198-
MacCid nrCid = MacCid(binder_->getUeNodeId(lteInfo->getSourceId(), true), lteInfo->getLcid());
199-
if (inet::containsKey(rxEntities_, lteCid) && inet::containsKey(rxEntities_, nrCid))
200-
throw cRuntimeError("Both LTE and NR cids of same UE are present as rxEntities_ keys: %s, %s", lteCid.str().c_str(), nrCid.str().c_str());
201-
}
203+
EV << "fromLowerLayer in " << getFullPath() << " event #" << getSimulation()->getEventNumber()
204+
<< ": Processing packet " << pkt->getName() << " src=" << lteInfo->getSourceId() << " dest=" << lteInfo->getDestId()
205+
<< " multicast=" << lteInfo->getMulticastGroupId() << " direction=" << dirToA((Direction)lteInfo->getDirection())
206+
<< " ---> CID " << cid << (entity == nullptr ? " (NEW)" : " (existing)") << std::endl;
202207

203-
}
208+
if (entity == nullptr)
209+
entity = createRxEntity(cid);
204210
entity->handlePacketFromLowerLayer(pkt);
205211
}
206212

0 commit comments

Comments
 (0)