Skip to content

Commit e08073a

Browse files
committed
Binder: getMasterNode() renamed to getMasterNodeOrSelf()
Because it returns the node itself if it has no DC Master.
1 parent 20c0f8b commit e08073a

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

src/simu5g/common/binder/Binder.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ void Binder::registerMasterNode(MacNodeId masterId, MacNodeId slaveId)
266266
if (masterId == NODEID_NONE)
267267
masterId = slaveId;
268268

269-
if (secondaryNodeToMasterNode_.size() <= num(slaveId))
270-
secondaryNodeToMasterNode_.resize(num(slaveId) + 1);
271-
secondaryNodeToMasterNode_[num(slaveId)] = masterId;
269+
if (secondaryNodeToMasterNodeOrSelf_.size() <= num(slaveId))
270+
secondaryNodeToMasterNodeOrSelf_.resize(num(slaveId) + 1);
271+
secondaryNodeToMasterNodeOrSelf_[num(slaveId)] = masterId;
272272
}
273273

274274
inline ostream& operator<<(ostream& os, const L3Address& addr) { return os << addr.str(); }
@@ -288,7 +288,7 @@ void Binder::initialize(int stage)
288288
WATCH_MAP(ipAddressToNrMacNodeId_);
289289
// WATCH_MAP(nodeInfoMap_); // Commented out - contains complex NodeInfo structs that don't have stream operators
290290
WATCH_VECTOR(servingNode_);
291-
WATCH_VECTOR(secondaryNodeToMasterNode_);
291+
WATCH_VECTOR(secondaryNodeToMasterNodeOrSelf_);
292292
WATCH_SET(mecHostAddress_);
293293
WATCH_MAP(mecHostToUpfAddress_);
294294
// WATCH_MAP(extCellList_); // Commented out - contains vectors of ExtCell* pointers that don't have stream operators
@@ -427,11 +427,13 @@ MacNodeId Binder::getNextHop(MacNodeId nodeId)
427427
return (nodeId == NODEID_NONE || getNodeTypeById(nodeId) == ENODEB) ? nodeId : getServingNode(nodeId);
428428
}
429429

430-
MacNodeId Binder::getMasterNode(MacNodeId secondaryEnbId)
430+
MacNodeId Binder::getMasterNodeOrSelf(MacNodeId secondaryEnbId)
431431
{
432-
if (num(secondaryEnbId) >= secondaryNodeToMasterNode_.size())
432+
ASSERT(secondaryEnbId == NODEID_NONE || getNodeTypeById(secondaryEnbId) == ENODEB);
433+
434+
if (num(secondaryEnbId) >= secondaryNodeToMasterNodeOrSelf_.size())
433435
throw cRuntimeError("Binder::getMasterNode(): bad secondaryEnbId %hu", num(secondaryEnbId));
434-
return secondaryNodeToMasterNode_[num(secondaryEnbId)];
436+
return secondaryNodeToMasterNodeOrSelf_[num(secondaryEnbId)];
435437
}
436438

437439
void Binder::registerMecHost(const inet::L3Address& mecHostAddress)

src/simu5g/common/binder/Binder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Binder : public cSimpleModule
6262
std::map<MacNodeId, NodeInfo> nodeInfoMap_;
6363

6464
std::vector<MacNodeId> servingNode_; // ueId -> servingEnbId
65-
std::vector<MacNodeId> secondaryNodeToMasterNode_;
65+
std::vector<MacNodeId> secondaryNodeToMasterNodeOrSelf_;
6666

6767
// stores the IP address of the MEC hosts in the simulation
6868
std::set<inet::L3Address> mecHostAddress_;
@@ -317,7 +317,7 @@ class Binder : public cSimpleModule
317317
* for the given Secondary Node (SeNB, SN).
318318
*/
319319
//TODO add MacNodeId ueId arg: In LTE DC, the roles (master/secondary) are per UE, not per bearer.
320-
MacNodeId getMasterNode(MacNodeId secondaryEnbId);
320+
MacNodeId getMasterNodeOrSelf(MacNodeId secondaryEnbId);
321321

322322
/**
323323
* Returns the MacNodeId for the given IP address

src/simu5g/corenetwork/trafficFlowFilter/TrafficFlowFilter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ TrafficFlowTemplateId TrafficFlowFilter::findTrafficFlow(L3Address srcAddress, L
182182

183183
// the serving node for the UE might be a secondary node in case of NR Dual Connectivity
184184
// obtains the master node, if any (the function returns destEnb if it is a master already)
185-
MacNodeId destMaster = binder_->getMasterNode(destBS);
185+
MacNodeId destMaster = binder_->getMasterNodeOrSelf(destBS);
186186
MacNodeId srcMaster = binder_->getNextHop(binder_->getMacNodeId(srcAddress.toIpv4()));
187187

188188
if (isBaseStation(ownerType_)) {

src/simu5g/stack/pdcp/LtePdcp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class LtePdcpEnb : public LtePdcpBase
372372
}
373373
else {
374374
// for dual connectivity
375-
master = binder_->getMasterNode(master);
375+
master = binder_->getMasterNodeOrSelf(master);
376376
if (master != nodeId_) {
377377
destId = master;
378378
}

src/simu5g/stack/pdcp/NrPdcpEnb.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void NrPdcpEnb::fromLowerLayer(cPacket *pktAux)
100100

101101
// if dual connectivity is enabled and this is a secondary node,
102102
// forward the packet to the PDCP of the master node
103-
MacNodeId masterId = binder_->getMasterNode(nodeId_);
103+
MacNodeId masterId = binder_->getMasterNodeOrSelf(nodeId_);
104104
if (dualConnectivityEnabled_ && (nodeId_ != masterId)) {
105105
EV << NOW << " NrPdcpEnb::fromLowerLayer - forward packet to the master node - id [" << masterId << "]" << endl;
106106
forwardDataToTargetNode(pkt, masterId);
@@ -125,7 +125,7 @@ MacNodeId NrPdcpEnb::getDestId(inet::Ptr<FlowControlInfo> lteInfo)
125125
}
126126
else {
127127
// for dual connectivity
128-
master = binder_->getMasterNode(master);
128+
master = binder_->getMasterNodeOrSelf(master);
129129
if (master != nodeId_) {
130130
destId = master;
131131
}

src/simu5g/stack/phy/NrPhyUe.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void NrPhyUe::handleAirFrame(cMessage *msg)
7474
}
7575

7676
// Check if the eNodeB is a secondary node
77-
MacNodeId masterNodeId = binder_->getMasterNode(sourceId);
77+
MacNodeId masterNodeId = binder_->getMasterNodeOrSelf(sourceId);
7878
if (masterNodeId != sourceId) {
7979
// The node has a master node, check if the other PHY of this UE is attached to that master.
8080
// If not, the UE cannot attach to this secondary node and the packet must be deleted.
@@ -219,7 +219,7 @@ void NrPhyUe::triggerHandover()
219219
EV << "Candidate RSSI: " << candidateMasterRssi_ << endl;
220220
EV << "############" << endl;
221221

222-
MacNodeId masterNode = binder_->getMasterNode(candidateMasterId_);
222+
MacNodeId masterNode = binder_->getMasterNodeOrSelf(candidateMasterId_);
223223
if (masterNode != candidateMasterId_) { // The candidate is a secondary node
224224
if (otherPhy_->getMasterId() == masterNode) {
225225
MacNodeId otherNodeId = otherPhy_->getMacNodeId();
@@ -259,7 +259,7 @@ void NrPhyUe::triggerHandover()
259259

260260
if (otherPhy_->getMasterId() != NODEID_NONE) {
261261
// Check if there are secondary nodes connected
262-
MacNodeId otherMasterId = binder_->getMasterNode(otherPhy_->getMasterId());
262+
MacNodeId otherMasterId = binder_->getMasterNodeOrSelf(otherPhy_->getMasterId());
263263
if (otherMasterId == masterId_) {
264264
EV << NOW << " NrPhyUe::triggerHandover - Forcing detachment from " << otherPhy_->getMasterId() << " which was a secondary node to " << masterId_ << ". Delay this handover." << endl;
265265

@@ -445,7 +445,7 @@ void NrPhyUe::deleteOldBuffers(MacNodeId masterId)
445445
// Delete PDCP Entities
446446
// delete pdcpEntities[nodeId_] at old master
447447
// in case of NR dual connectivity, the master can be a secondary node, hence we have to delete PDCP entities residing in the node's master
448-
MacNodeId masterNodeId = binder_->getMasterNode(masterId);
448+
MacNodeId masterNodeId = binder_->getMasterNodeOrSelf(masterId);
449449
LtePdcpEnb *masterPdcp = check_and_cast<LtePdcpEnb *>(binder_->getPdcpByNodeId(masterNodeId));
450450
masterPdcp->deleteEntities(nodeId_);
451451

0 commit comments

Comments
 (0)