Commit 5805cdca authored by aligungr's avatar aligungr

RLS improvements

parent 1139725c
...@@ -8,12 +8,22 @@ ...@@ -8,12 +8,22 @@
#include "rls_pdu.hpp" #include "rls_pdu.hpp"
#include <lib/rrc/rrc.hpp>
namespace rls namespace rls
{ {
enum class ERlfCause struct PduInfo
{ {
OctetString pdu;
rrc::RrcChannel rrcChannel{};
int64_t sentTime{};
};
enum class ERlfCause
{
PDU_ID_EXISTS,
PDU_ID_FULL
}; };
} } // namespace rls
\ No newline at end of file \ No newline at end of file
...@@ -253,6 +253,7 @@ struct NwUeRlsToRls : NtsMessage ...@@ -253,6 +253,7 @@ struct NwUeRlsToRls : NtsMessage
DOWNLINK_DATA, DOWNLINK_DATA,
DOWNLINK_RRC, DOWNLINK_RRC,
RADIO_LINK_FAILURE, RADIO_LINK_FAILURE,
TRANSMISSION_FAILURE,
} present; } present;
// RECEIVE_RLS_MESSAGE // RECEIVE_RLS_MESSAGE
...@@ -280,12 +281,15 @@ struct NwUeRlsToRls : NtsMessage ...@@ -280,12 +281,15 @@ struct NwUeRlsToRls : NtsMessage
// DOWNLINK_RRC // DOWNLINK_RRC
rrc::RrcChannel rrcChannel{}; rrc::RrcChannel rrcChannel{};
// DOWNLINK_RRC // UPLINK_RRC
uint32_t pduId{}; uint32_t pduId{};
// RADIO_LINK_FAILURE // RADIO_LINK_FAILURE
rls::ERlfCause rlfCause{}; rls::ERlfCause rlfCause{};
// TRANSMISSION_FAILURE
std::vector<rls::PduInfo> pduList;
explicit NwUeRlsToRls(PR present) : NtsMessage(NtsMessageType::UE_RLS_TO_RLS), present(present) explicit NwUeRlsToRls(PR present) : NtsMessage(NtsMessageType::UE_RLS_TO_RLS), present(present)
{ {
} }
......
...@@ -114,29 +114,35 @@ void RlsControlTask::handleRlsMessage(int cellId, rls::RlsMessage &msg) ...@@ -114,29 +114,35 @@ void RlsControlTask::handleRlsMessage(int cellId, rls::RlsMessage &msg)
// (This is not a problem for RRC, but for DATA), normally we should avoid this, no need for now. // (This is not a problem for RRC, but for DATA), normally we should avoid this, no need for now.
(void)cellId; (void)cellId;
int psi = static_cast<int>(m.payload); auto *w = new NwUeRlsToRls(NwUeRlsToRls::DOWNLINK_DATA);
w->psi = static_cast<int>(m.payload);
w->data = std::move(m.pdu);
// TODO: send to upper layer [PSI, DATA] // TODO: send to upper layer [PSI, DATA]
} }
else if (m.pduType == rls::EPduType::RRC) else if (m.pduType == rls::EPduType::RRC)
{ {
auto rrcChannel = static_cast<rrc::RrcChannel>(m.payload); auto *w = new NwUeRlsToRls(NwUeRlsToRls::DOWNLINK_RRC);
w->cellId = cellId;
w->rrcChannel = static_cast<rrc::RrcChannel>(m.payload);
w->data = std::move(m.pdu);
// TODO: send to upper layer [rrcChannel, DATA] // TODO: send to upper layer [rrcChannel, DATA]
} }
else else
{ {
// TODO: log m_logger->err("Unhandled RLS PDU type");
} }
} }
else else
{ {
// TODO: log m_logger->err("Unhandled RLS message type");
} }
} }
void RlsControlTask::handleSignalChange(int cellId, int dbm) void RlsControlTask::handleSignalChange(int cellId, int dbm)
{ {
auto *w = new NwUeRlsToRls(NwUeRlsToRls::SIGNAL_CHANGED);
w->cellId = cellId;
w->dbm = dbm;
// TODO transparently send to the RRC // TODO transparently send to the RRC
} }
...@@ -146,6 +152,8 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr ...@@ -146,6 +152,8 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr
{ {
if (m_pduMap.count(pduId)) if (m_pduMap.count(pduId))
{ {
auto *w = new NwUeRlsToRls(NwUeRlsToRls::RADIO_LINK_FAILURE);
w->rlfCause = rls::ERlfCause::PDU_ID_EXISTS;
// TODO: issue RLF // TODO: issue RLF
m_pduMap.clear(); m_pduMap.clear();
...@@ -154,6 +162,8 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr ...@@ -154,6 +162,8 @@ void RlsControlTask::handleUplinkRrcDelivery(int cellId, uint32_t pduId, rrc::Rr
if (m_pduMap.size() > MAX_PDU_COUNT) if (m_pduMap.size() > MAX_PDU_COUNT)
{ {
auto *w = new NwUeRlsToRls(NwUeRlsToRls::RADIO_LINK_FAILURE);
w->rlfCause = rls::ERlfCause::PDU_ID_FULL;
// TODO: issue RLF // TODO: issue RLF
m_pduMap.clear(); m_pduMap.clear();
...@@ -189,7 +199,7 @@ void RlsControlTask::onAckControlTimerExpired() ...@@ -189,7 +199,7 @@ void RlsControlTask::onAckControlTimerExpired()
{ {
int64_t current = utils::CurrentTimeMillis(); int64_t current = utils::CurrentTimeMillis();
std::vector<PduInfo> transmissionFailures; std::vector<rls::PduInfo> transmissionFailures;
for (auto &pdu : m_pduMap) for (auto &pdu : m_pduMap)
{ {
...@@ -200,7 +210,9 @@ void RlsControlTask::onAckControlTimerExpired() ...@@ -200,7 +210,9 @@ void RlsControlTask::onAckControlTimerExpired()
m_pduMap.clear(); m_pduMap.clear();
// TODO: Notify transmisson failures auto *w = new NwUeRlsToRls(NwUeRlsToRls::TRANSMISSION_FAILURE);
w->pduList = std::move(transmissionFailures);
// TODO: Notify transmission failures
} }
void RlsControlTask::onAckSendTimerExpired() void RlsControlTask::onAckSendTimerExpired()
......
...@@ -23,18 +23,10 @@ namespace nr::ue ...@@ -23,18 +23,10 @@ namespace nr::ue
class RlsControlTask : public NtsTask class RlsControlTask : public NtsTask
{ {
private:
struct PduInfo
{
OctetString pdu;
rrc::RrcChannel rrcChannel{};
int64_t sentTime{};
};
private: private:
std::unique_ptr<Logger> m_logger; std::unique_ptr<Logger> m_logger;
RlsUdpTask *m_udpTask; RlsUdpTask *m_udpTask;
std::unordered_map<uint32_t, PduInfo> m_pduMap; std::unordered_map<uint32_t, rls::PduInfo> m_pduMap;
uint64_t m_sti; uint64_t m_sti;
std::unordered_map<int, std::vector<uint32_t>> m_pendingAck; std::unordered_map<int, std::vector<uint32_t>> m_pendingAck;
......
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