Commit 6055137b authored by aligungr's avatar aligungr

Performance improvements

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