Commit cb4899d2 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent 748d53e5
...@@ -22,8 +22,8 @@ static constexpr const int TIMER_PERIOD_ACK_SEND = 2250; ...@@ -22,8 +22,8 @@ static constexpr const int TIMER_PERIOD_ACK_SEND = 2250;
namespace nr::ue namespace nr::ue
{ {
RlsControlTask::RlsControlTask(TaskBase *base, uint64_t sti) RlsControlTask::RlsControlTask(TaskBase *base, RlsSharedContext *shCtx)
: m_sti{sti}, m_servingCell{}, m_mainTask{}, m_udpTask{}, m_pduMap{}, m_pendingAck{} : m_shCtx{shCtx}, m_servingCell{}, m_mainTask{}, m_udpTask{}, m_pduMap{}, m_pendingAck{}
{ {
m_logger = base->logBase->makeUniqueLogger(base->config->getLoggerPrefix() + "rls-ctl"); m_logger = base->logBase->makeUniqueLogger(base->config->getLoggerPrefix() + "rls-ctl");
} }
...@@ -185,7 +185,7 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr ...@@ -185,7 +185,7 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr
m_pduMap[pduId].sentTime = utils::CurrentTimeMillis(); m_pduMap[pduId].sentTime = utils::CurrentTimeMillis();
} }
rls::RlsPduTransmission msg{m_sti}; rls::RlsPduTransmission msg{m_shCtx->sti};
msg.pduType = rls::EPduType::RRC; msg.pduType = rls::EPduType::RRC;
msg.pdu = std::move(data); msg.pdu = std::move(data);
msg.payload = static_cast<uint32_t>(channel); msg.payload = static_cast<uint32_t>(channel);
...@@ -196,7 +196,7 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr ...@@ -196,7 +196,7 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr
void RlsControlTask::handleUplinkDataDelivery(int psi, OctetString &&data) void RlsControlTask::handleUplinkDataDelivery(int psi, OctetString &&data)
{ {
rls::RlsPduTransmission msg{m_sti}; rls::RlsPduTransmission msg{m_shCtx->sti};
msg.pduType = rls::EPduType::DATA; msg.pduType = rls::EPduType::DATA;
msg.pdu = std::move(data); msg.pdu = std::move(data);
msg.payload = static_cast<uint32_t>(psi); msg.payload = static_cast<uint32_t>(psi);
...@@ -243,7 +243,7 @@ void RlsControlTask::onAckSendTimerExpired() ...@@ -243,7 +243,7 @@ void RlsControlTask::onAckSendTimerExpired()
if (!item.second.empty()) if (!item.second.empty())
continue; continue;
rls::RlsPduTransmissionAck msg{m_sti}; rls::RlsPduTransmissionAck msg{m_shCtx->sti};
msg.pduIds = std::move(item.second); msg.pduIds = std::move(item.second);
m_udpTask->send(item.first, msg); m_udpTask->send(item.first, msg);
......
...@@ -25,7 +25,7 @@ class RlsControlTask : public NtsTask ...@@ -25,7 +25,7 @@ class RlsControlTask : public NtsTask
{ {
private: private:
std::unique_ptr<Logger> m_logger; std::unique_ptr<Logger> m_logger;
uint64_t m_sti; RlsSharedContext *m_shCtx;
int m_servingCell; int m_servingCell;
NtsTask *m_mainTask; NtsTask *m_mainTask;
RlsUdpTask *m_udpTask; RlsUdpTask *m_udpTask;
...@@ -33,7 +33,7 @@ class RlsControlTask : public NtsTask ...@@ -33,7 +33,7 @@ class RlsControlTask : public NtsTask
std::unordered_map<int, std::vector<uint32_t>> m_pendingAck; std::unordered_map<int, std::vector<uint32_t>> m_pendingAck;
public: public:
explicit RlsControlTask(TaskBase *base, uint64_t sti); explicit RlsControlTask(TaskBase *base, RlsSharedContext *shCtx);
~RlsControlTask() override = default; ~RlsControlTask() override = default;
protected: protected:
......
...@@ -21,10 +21,11 @@ UeRlsTask::UeRlsTask(TaskBase *base) : m_base{base} ...@@ -21,10 +21,11 @@ UeRlsTask::UeRlsTask(TaskBase *base) : m_base{base}
{ {
m_logger = m_base->logBase->makeUniqueLogger(m_base->config->getLoggerPrefix() + "rls"); m_logger = m_base->logBase->makeUniqueLogger(m_base->config->getLoggerPrefix() + "rls");
m_sti = utils::Random64(); m_shCtx = new RlsSharedContext();
m_shCtx->sti = utils::Random64();
m_udpTask = new RlsUdpTask(base, m_sti, base->config->gnbSearchList); m_udpTask = new RlsUdpTask(base, m_shCtx, base->config->gnbSearchList);
m_ctlTask = new RlsControlTask(base, m_sti); m_ctlTask = new RlsControlTask(base, m_shCtx);
m_udpTask->initialize(m_ctlTask); m_udpTask->initialize(m_ctlTask);
m_ctlTask->initialize(this, m_udpTask); m_ctlTask->initialize(this, m_udpTask);
...@@ -107,6 +108,7 @@ void UeRlsTask::onLoop() ...@@ -107,6 +108,7 @@ void UeRlsTask::onLoop()
break; break;
} }
case NmUeRrcToRls::RESET_STI: { case NmUeRrcToRls::RESET_STI: {
m_shCtx->sti = utils::Random64();
break; break;
} }
} }
...@@ -138,8 +140,11 @@ void UeRlsTask::onQuit() ...@@ -138,8 +140,11 @@ void UeRlsTask::onQuit()
{ {
m_udpTask->quit(); m_udpTask->quit();
m_ctlTask->quit(); m_ctlTask->quit();
delete m_udpTask; delete m_udpTask;
delete m_ctlTask; delete m_ctlTask;
delete m_shCtx;
} }
} // namespace nr::ue } // namespace nr::ue
...@@ -34,7 +34,7 @@ class UeRlsTask : public NtsTask ...@@ -34,7 +34,7 @@ class UeRlsTask : public NtsTask
TaskBase *m_base; TaskBase *m_base;
std::unique_ptr<Logger> m_logger; std::unique_ptr<Logger> m_logger;
uint64_t m_sti; RlsSharedContext* m_shCtx;
RlsUdpTask *m_udpTask; RlsUdpTask *m_udpTask;
RlsControlTask *m_ctlTask; RlsControlTask *m_ctlTask;
......
...@@ -24,8 +24,9 @@ static constexpr const int HEARTBEAT_THRESHOLD = 2000; // (LOOP_PERIOD + RECEIVE ...@@ -24,8 +24,9 @@ static constexpr const int HEARTBEAT_THRESHOLD = 2000; // (LOOP_PERIOD + RECEIVE
namespace nr::ue namespace nr::ue
{ {
RlsUdpTask::RlsUdpTask(TaskBase *base, uint64_t sti, const std::vector<std::string> &searchSpace) RlsUdpTask::RlsUdpTask(TaskBase *base, RlsSharedContext *shCtx, const std::vector<std::string> &searchSpace)
: m_server{}, m_ctlTask{}, m_sti{sti}, m_searchSpace{}, m_cells{}, m_cellIdToSti{}, m_lastLoop{}, m_cellIdCounter{} : m_server{}, m_ctlTask{}, m_shCtx{shCtx}, m_searchSpace{}, m_cells{}, m_cellIdToSti{}, m_lastLoop{},
m_cellIdCounter{}
{ {
m_logger = base->logBase->makeUniqueLogger(base->config->getLoggerPrefix() + "rls-udp"); m_logger = base->logBase->makeUniqueLogger(base->config->getLoggerPrefix() + "rls-udp");
...@@ -160,7 +161,7 @@ void RlsUdpTask::heartbeatCycle(uint64_t time, const Vector3 &simPos) ...@@ -160,7 +161,7 @@ void RlsUdpTask::heartbeatCycle(uint64_t time, const Vector3 &simPos)
for (auto &addr : m_searchSpace) for (auto &addr : m_searchSpace)
{ {
rls::RlsHeartBeat msg{m_sti}; rls::RlsHeartBeat msg{m_shCtx->sti};
msg.simPos = simPos; msg.simPos = simPos;
sendRlsPdu(addr, msg); sendRlsPdu(addr, msg);
} }
......
...@@ -35,7 +35,7 @@ class RlsUdpTask : public NtsTask ...@@ -35,7 +35,7 @@ class RlsUdpTask : public NtsTask
std::unique_ptr<Logger> m_logger; std::unique_ptr<Logger> m_logger;
udp::UdpServer *m_server; udp::UdpServer *m_server;
NtsTask *m_ctlTask; NtsTask *m_ctlTask;
uint64_t m_sti; RlsSharedContext* m_shCtx;
std::vector<InetAddress> m_searchSpace; std::vector<InetAddress> m_searchSpace;
std::unordered_map<uint64_t, CellInfo> m_cells; std::unordered_map<uint64_t, CellInfo> m_cells;
std::unordered_map<int, uint64_t> m_cellIdToSti; std::unordered_map<int, uint64_t> m_cellIdToSti;
...@@ -44,7 +44,7 @@ class RlsUdpTask : public NtsTask ...@@ -44,7 +44,7 @@ class RlsUdpTask : public NtsTask
int m_cellIdCounter; int m_cellIdCounter;
public: public:
explicit RlsUdpTask(TaskBase *base, uint64_t sti, const std::vector<std::string> &searchSpace); explicit RlsUdpTask(TaskBase *base, RlsSharedContext* shCtx, const std::vector<std::string> &searchSpace);
~RlsUdpTask() override = default; ~RlsUdpTask() override = default;
protected: protected:
......
...@@ -168,6 +168,11 @@ struct UeSharedContext ...@@ -168,6 +168,11 @@ struct UeSharedContext
bool hasActiveCell(); bool hasActiveCell();
}; };
struct RlsSharedContext
{
std::atomic<uint64_t> sti{};
};
struct TaskBase struct TaskBase
{ {
UserEquipment *ue{}; UserEquipment *ue{};
......
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