Commit 6055137b authored by aligungr's avatar aligungr

Performance improvements

parent 2fd25c41
......@@ -118,19 +118,19 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
}
Json json = Json::Obj({
{"cm-state", ToJson(m_base->nasTask->layer->mm->m_cmState)},
{"rm-state", ToJson(m_base->nasTask->layer->mm->m_rmState)},
{"mm-state", ToJson(m_base->nasTask->layer->mm->m_mmSubState)},
{"5u-state", ToJson(m_base->nasTask->layer->mm->m_storage->uState->get())},
{"sim-inserted", m_base->nasTask->layer->mm->m_usim->isValid()},
{"cm-state", ToJson(m_base->nasTask->layer->m_mm->m_cmState)},
{"rm-state", ToJson(m_base->nasTask->layer->m_mm->m_rmState)},
{"mm-state", ToJson(m_base->nasTask->layer->m_mm->m_mmSubState)},
{"5u-state", ToJson(m_base->nasTask->layer->m_mm->m_storage->uState->get())},
{"sim-inserted", m_base->nasTask->layer->m_mm->m_usim->isValid()},
{"selected-plmn", ::ToJson(m_base->shCtx.selectedPlmn.get())},
{"current-cell", ::ToJson(currentCellId)},
{"current-plmn", ::ToJson(currentPlmn)},
{"current-tac", ::ToJson(currentTac)},
{"last-tai", ToJson(m_base->nasTask->layer->mm->m_storage->lastVisitedRegisteredTai)},
{"stored-suci", ToJson(m_base->nasTask->layer->mm->m_storage->storedSuci->get())},
{"stored-guti", ToJson(m_base->nasTask->layer->mm->m_storage->storedGuti->get())},
{"has-emergency", ::ToJson(m_base->nasTask->layer->mm->hasEmergency())},
{"last-tai", ToJson(m_base->nasTask->layer->m_mm->m_storage->lastVisitedRegisteredTai)},
{"stored-suci", ToJson(m_base->nasTask->layer->m_mm->m_storage->storedSuci->get())},
{"stored-guti", ToJson(m_base->nasTask->layer->m_mm->m_storage->storedGuti->get())},
{"has-emergency", ::ToJson(m_base->nasTask->layer->m_mm->hasEmergency())},
});
sendResult(msg.address, json.dumpYaml());
break;
......@@ -141,7 +141,7 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
{"hplmn", ToJson(m_base->config->hplmn)},
{"imei", ::ToJson(m_base->config->imei)},
{"imeisv", ::ToJson(m_base->config->imeiSv)},
{"ecall-only", ::ToJson(m_base->nasTask->layer->usim->m_isECallOnly)},
{"ecall-only", ::ToJson(m_base->nasTask->layer->m_usim->m_isECallOnly)},
{"uac-aic", Json::Obj({
{"mps", m_base->config->uacAic.mps},
{"mcs", m_base->config->uacAic.mcs},
......@@ -154,18 +154,18 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
{"class-14", m_base->config->uacAcc.cls14},
{"class-15", m_base->config->uacAcc.cls15},
})},
{"is-high-priority", m_base->nasTask->layer->mm->isHighPriority()},
{"is-high-priority", m_base->nasTask->layer->m_mm->isHighPriority()},
});
sendResult(msg.address, json.dumpYaml());
break;
}
case app::UeCliCommand::TIMERS: {
sendResult(msg.address, ToJson(m_base->nasTask->layer->timers).dumpYaml());
sendResult(msg.address, ToJson(m_base->nasTask->layer->m_timers).dumpYaml());
break;
}
case app::UeCliCommand::DE_REGISTER: {
m_base->nasTask->layer->mm->deregistrationRequired(msg.cmd->deregCause);
m_base->nasTask->layer->m_mm->deregistrationRequired(msg.cmd->deregCause);
if (msg.cmd->deregCause != EDeregCause::SWITCH_OFF)
sendResult(msg.address, "De-registration procedure triggered");
......@@ -175,12 +175,12 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
}
case app::UeCliCommand::PS_RELEASE: {
for (int i = 0; i < msg.cmd->psCount; i++)
m_base->nasTask->layer->sm->sendReleaseRequest(static_cast<int>(msg.cmd->psIds[i]) % 16);
m_base->nasTask->layer->m_sm->sendReleaseRequest(static_cast<int>(msg.cmd->psIds[i]) % 16);
sendResult(msg.address, "PDU session release procedure(s) triggered");
break;
}
case app::UeCliCommand::PS_RELEASE_ALL: {
m_base->nasTask->layer->sm->sendReleaseRequestForAll();
m_base->nasTask->layer->m_sm->sendReleaseRequestForAll();
sendResult(msg.address, "PDU session release procedure(s) triggered");
break;
}
......@@ -190,13 +190,13 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
config.isEmergency = msg.cmd->isEmergency;
config.apn = msg.cmd->apn;
config.sNssai = msg.cmd->sNssai;
m_base->nasTask->layer->sm->sendEstablishmentRequest(config);
m_base->nasTask->layer->m_sm->sendEstablishmentRequest(config);
sendResult(msg.address, "PDU session establishment procedure triggered");
break;
}
case app::UeCliCommand::PS_LIST: {
Json json = Json::Obj({});
for (auto *pduSession : m_base->nasTask->layer->sm->m_pduSessions)
for (auto *pduSession : m_base->nasTask->layer->m_sm->m_pduSessions)
{
if (pduSession->psi == 0 || pduSession->psState == EPsState::INACTIVE)
continue;
......
......@@ -3,32 +3,32 @@
namespace nr::ue
{
NasLayer::NasLayer(TaskBase *base) : base{base}, timers{}
NasLayer::NasLayer(TaskBase *base) : m_base{base}, m_timers{}
{
logger = base->logBase->makeUniqueLogger(base->config->getLoggerPrefix() + "nas");
m_logger = base->logBase->makeUniqueLogger(base->config->getLoggerPrefix() + "nas");
mm = new NasMm(base, &timers);
sm = new NasSm(base, &timers);
usim = new Usim();
m_mm = new NasMm(base, &m_timers);
m_sm = new NasSm(base, &m_timers);
m_usim = new Usim();
}
void NasLayer::onStart()
{
usim->initialize(base->config->supi.has_value());
m_usim->initialize(m_base->config->supi.has_value());
sm->onStart(mm);
mm->onStart(sm, usim);
m_sm->onStart(m_mm);
m_mm->onStart(m_sm, m_usim);
}
void NasLayer::onQuit()
{
mm->onQuit();
sm->onQuit();
m_mm->onQuit();
m_sm->onQuit();
delete mm;
delete sm;
delete m_mm;
delete m_sm;
delete usim;
delete m_usim;
}
void NasLayer::handleSapMessage(std::unique_ptr<NtsMessage> msg)
......@@ -36,7 +36,7 @@ void NasLayer::handleSapMessage(std::unique_ptr<NtsMessage> msg)
switch (msg->msgType)
{
case NtsMessageType::UE_RRC_TO_NAS: {
mm->handleRrcEvent(dynamic_cast<NmUeRrcToNas &>(*msg));
m_mm->handleRrcEvent(dynamic_cast<NmUeRrcToNas &>(*msg));
break;
}
case NtsMessageType::UE_TUN_TO_APP: {
......@@ -44,7 +44,7 @@ void NasLayer::handleSapMessage(std::unique_ptr<NtsMessage> msg)
switch (w.present)
{
case NmUeTunToApp::DATA_PDU_DELIVERY: {
sm->handleUplinkDataRequest(w.psi, std::move(w.data));
m_sm->handleUplinkDataRequest(w.psi, std::move(w.data));
break;
}
default:
......@@ -57,7 +57,7 @@ void NasLayer::handleSapMessage(std::unique_ptr<NtsMessage> msg)
switch (w.present)
{
case NmUeRlsToNas::DATA_PDU_DELIVERY: {
sm->handleDownlinkDataRequest(w.psi, std::move(w.pdu));
m_sm->handleDownlinkDataRequest(w.psi, std::move(w.pdu));
break;
}
}
......@@ -65,35 +65,36 @@ void NasLayer::handleSapMessage(std::unique_ptr<NtsMessage> msg)
break;
}
default:
logger->unhandledNts(*msg);
m_logger->unhandledNts(*msg);
break;
}
}
void NasLayer::performTick()
{
std::array<UeTimer *, 17> arr = {
&timers.t3346, &timers.t3396, &timers.t3444, &timers.t3445, &timers.t3502, &timers.t3510,
&timers.t3511, &timers.t3512, &timers.t3516, &timers.t3517, &timers.t3519, &timers.t3520,
&timers.t3521, &timers.t3525, &timers.t3540, &timers.t3584, &timers.t3585,
UeTimer *const arr[] = {
&m_timers.t3346, &m_timers.t3396, &m_timers.t3444, &m_timers.t3445, &m_timers.t3502, &m_timers.t3510,
&m_timers.t3511, &m_timers.t3512, &m_timers.t3516, &m_timers.t3517, &m_timers.t3519, &m_timers.t3520,
&m_timers.t3521, &m_timers.t3525, &m_timers.t3540, &m_timers.t3584, &m_timers.t3585,
};
for (auto* timer : arr){
for (auto *timer : arr)
{
if (timer->performTick())
{
if (timer->isMmTimer())
mm->onTimerExpire(*timer);
m_mm->onTimerExpire(*timer);
else
sm->onTimerExpire(*timer);
m_sm->onTimerExpire(*timer);
}
}
sm->onTimerTick();
m_sm->onTimerTick();
}
void NasLayer::performCycle()
{
mm->performMmCycle();
m_mm->performMmCycle();
}
} // namespace nr::ue
\ No newline at end of file
......@@ -14,13 +14,13 @@ namespace nr::ue
class NasLayer
{
TaskBase *base;
std::unique_ptr<Logger> logger;
TaskBase *m_base;
std::unique_ptr<Logger> m_logger;
NasTimers timers;
NasMm *mm;
NasSm *sm;
Usim *usim;
NasTimers m_timers;
NasMm *m_mm;
NasSm *m_sm;
Usim *m_usim;
friend class UeCmdHandler;
......@@ -28,16 +28,13 @@ class NasLayer
explicit NasLayer(TaskBase *base);
~NasLayer() = default;
public:
void onStart();
void onQuit();
public:
void handleSapMessage(std::unique_ptr<NtsMessage> msg);
public:
void performCycle();
void performTick();
void handleSapMessage(std::unique_ptr<NtsMessage> msg);
};
} // namespace nr::ue
\ No newline at end of file
......@@ -14,6 +14,7 @@
#include <cstdint>
#include <memory>
#include <vector>
#include <array>
class OctetString
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment