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