Commit fb77d5bc authored by aligungr's avatar aligungr

RLS developments

parent c8c4f47c
......@@ -8,10 +8,15 @@
#include "ctl_task.hpp"
#include <utils/common.hpp>
static constexpr const size_t MAX_PDU_COUNT = 4096;
static constexpr const int MAX_PDU_TTL = 3000;
namespace nr::gnb
{
RlsControlTask::RlsControlTask(TaskBase *base) : m_udpTask{}
RlsControlTask::RlsControlTask(TaskBase *base, uint64_t sti) : m_sti{sti}, m_udpTask{}, m_pduMap{}, m_pendingAck{}
{
m_logger = base->logBase->makeUniqueLogger("rls-ctl");
}
......@@ -70,4 +75,92 @@ void RlsControlTask::onQuit()
{
}
void RlsControlTask::handleSignalDetected(int ueId)
{
// TODO: tranparently notify upper layer
}
void RlsControlTask::handleSignalLost(int ueId)
{
// TODO: tranparently notify upper layer
}
void RlsControlTask::handleRlsMessage(int ueId, rls::RlsMessage &msg)
{
if (msg.msgType == rls::EMessageType::PDU_TRANSMISSION_ACK)
{
auto &m = (rls::RlsPduTransmissionAck &)msg;
for (auto pduId : m.pduIds)
m_pduMap.erase(pduId);
}
else if (msg.msgType == rls::EMessageType::PDU_TRANSMISSION)
{
auto &m = (rls::RlsPduTransmission &)msg;
if (m.pduId != 0)
m_pendingAck[ueId].push_back(m.pduId);
if (m.pduType == rls::EPduType::DATA)
{
// TODO: send to the upper layer
}
else if (m.pduType == rls::EPduType::RRC)
{
// TODO: send to the upper layer
}
else
{
m_logger->err("Unhandled RLS PDU type");
}
}
else
{
m_logger->err("Unhandled RLS message type");
}
}
void RlsControlTask::handleDownlinkRrcDelivery(int ueId, uint32_t pduId, rrc::RrcChannel channel, OctetString &&data)
{
if (pduId != 0)
{
if (m_pduMap.count(pduId))
{
m_pduMap.clear();
// TODO: Send RLF
return;
}
if (m_pduMap.size() > MAX_PDU_COUNT)
{
m_pduMap.clear();
// TODO: Send RLF
return;
}
m_pduMap[pduId].pdu = data.copy();
m_pduMap[pduId].rrcChannel = channel;
m_pduMap[pduId].sentTime = utils::CurrentTimeMillis();
}
rls::RlsPduTransmission msg{m_sti};
msg.pduType = rls::EPduType::RRC;
msg.pdu = std::move(data);
msg.payload = static_cast<uint32_t>(channel);
msg.pduId = pduId;
m_udpTask->send(ueId, msg);
}
void RlsControlTask::handleDownlinkDataDelivery(int ueId, int psi, OctetString &&data)
{
rls::RlsPduTransmission msg{m_sti};
msg.pduType = rls::EPduType::DATA;
msg.pdu = std::move(data);
msg.payload = static_cast<uint32_t>(psi);
msg.pduId = 0;
m_udpTask->send(ueId, msg);
}
} // namespace nr::gnb
......@@ -21,10 +21,13 @@ class RlsControlTask : public NtsTask
{
private:
std::unique_ptr<Logger> m_logger;
uint64_t m_sti;
RlsUdpTask *m_udpTask;
std::unordered_map<uint32_t, rls::PduInfo> m_pduMap;
std::unordered_map<int, std::vector<uint32_t>> m_pendingAck;
public:
explicit RlsControlTask(TaskBase *base);
explicit RlsControlTask(TaskBase *base, uint64_t sti);
~RlsControlTask() override = default;
protected:
......
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