From eb30d86d44b157182facea6051532d009fe4c5bf Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 23 Jul 2018 17:49:26 +0200 Subject: [PATCH] process RRC PDUs in RRC thread --- srsue/hdr/upper/rrc.h | 3 +++ srsue/src/upper/rrc.cc | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/srsue/hdr/upper/rrc.h b/srsue/hdr/upper/rrc.h index e56db9e9e..e4d06eb1f 100644 --- a/srsue/hdr/upper/rrc.h +++ b/srsue/hdr/upper/rrc.h @@ -326,10 +326,12 @@ private: typedef struct { enum { + PDU, PCCH, STOP } command; byte_buffer_t *pdu; + uint16_t lcid; } cmd_msg_t; bool running; @@ -606,6 +608,7 @@ private: void send_rrc_ue_cap_info(); // Parsers + void process_pdu(uint32_t lcid, byte_buffer_t *pdu); void parse_dl_ccch(byte_buffer_t *pdu); void parse_dl_dcch(uint32_t lcid, byte_buffer_t *pdu); void parse_dl_info_transfer(uint32_t lcid, byte_buffer_t *pdu); diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 856aeedf9..1b2d2607d 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -32,7 +32,7 @@ #include #include // for printing uint64_t #include -#include "srsue/hdr/upper/rrc.h" +#include #include "srslte/asn1/liblte_rrc.h" #include "srslte/common/security.h" #include "srslte/common/bcd_helpers.h" @@ -248,11 +248,14 @@ void rrc::run_thread() { while(running) { cmd_msg_t msg = cmd_q.wait_pop(); switch(msg.command) { - case cmd_msg_t::STOP: - return; + case cmd_msg_t::PDU: + process_pdu(msg.lcid, msg.pdu); + break; case cmd_msg_t::PCCH: process_pcch(msg.pdu); break; + case cmd_msg_t::STOP: + return; } } } @@ -1939,6 +1942,16 @@ void rrc::write_sdu(uint32_t lcid, byte_buffer_t *sdu) { void rrc::write_pdu(uint32_t lcid, byte_buffer_t *pdu) { rrc_log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU", get_rb_name(lcid).c_str()); + // add PDU to command queue + cmd_msg_t msg; + msg.pdu = pdu; + msg.command = cmd_msg_t::PDU; + msg.lcid = lcid; + cmd_q.push(msg); +} + +void rrc::process_pdu(uint32_t lcid, byte_buffer_t *pdu) +{ switch (lcid) { case RB_ID_SRB0: parse_dl_ccch(pdu);