diff --git a/lib/include/srslte/common/common.h b/lib/include/srslte/common/common.h index d8e64b523..d1f2f770f 100644 --- a/lib/include/srslte/common/common.h +++ b/lib/include/srslte/common/common.h @@ -38,17 +38,17 @@ DEFINES *******************************************************************************/ -#define SRSUE_UE_CATEGORY 4 +#define SRSLTE_UE_CATEGORY 4 -#define SRSUE_N_SRB 3 -#define SRSUE_N_DRB 8 -#define SRSUE_N_RADIO_BEARERS 11 +#define SRSLTE_N_SRB 3 +#define SRSLTE_N_DRB 8 +#define SRSLTE_N_RADIO_BEARERS 11 // Cat 3 UE - Max number of DL-SCH transport block bits received within a TTI // 3GPP 36.306 Table 4.1.1 -#define SRSUE_MAX_BUFFER_SIZE_BITS 102048 -#define SRSUE_MAX_BUFFER_SIZE_BYTES 12756 -#define SRSUE_BUFFER_HEADER_OFFSET 1024 +#define SRSLTE_MAX_BUFFER_SIZE_BITS 102048 +#define SRSLTE_MAX_BUFFER_SIZE_BYTES 12756 +#define SRSLTE_BUFFER_HEADER_OFFSET 1024 #define SRSLTE_BUFFER_POOL_LOG_ENABLED @@ -118,7 +118,7 @@ static const char rb_id_text[RB_ID_N_ITEMS][20] = { "SRB0", class byte_buffer_t{ public: uint32_t N_bytes; - uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BYTES]; + uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES]; uint8_t *msg; #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED char debug_name[128]; @@ -127,7 +127,7 @@ public: byte_buffer_t():N_bytes(0) { timestamp_is_set = false; - msg = &buffer[SRSUE_BUFFER_HEADER_OFFSET]; + msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; next = NULL; } byte_buffer_t(const byte_buffer_t& buf) @@ -146,7 +146,7 @@ public: } void reset() { - msg = &buffer[SRSUE_BUFFER_HEADER_OFFSET]; + msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; N_bytes = 0; timestamp_is_set = false; } @@ -190,7 +190,7 @@ private: struct bit_buffer_t{ uint32_t N_bits; - uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BITS]; + uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BITS]; uint8_t *msg; #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED char debug_name[128]; @@ -198,7 +198,7 @@ struct bit_buffer_t{ bit_buffer_t():N_bits(0) { - msg = &buffer[SRSUE_BUFFER_HEADER_OFFSET]; + msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; } bit_buffer_t(const bit_buffer_t& buf){ N_bits = buf.N_bits; @@ -214,7 +214,7 @@ struct bit_buffer_t{ } void reset() { - msg = &buffer[SRSUE_BUFFER_HEADER_OFFSET]; + msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; N_bits = 0; timestamp_is_set = false; } diff --git a/lib/include/srslte/upper/pdcp.h b/lib/include/srslte/upper/pdcp.h index e1d7b4639..090f8f045 100644 --- a/lib/include/srslte/upper/pdcp.h +++ b/lib/include/srslte/upper/pdcp.h @@ -67,7 +67,7 @@ public: private: log *pdcp_log; - pdcp_entity pdcp_array[SRSUE_N_RADIO_BEARERS]; + pdcp_entity pdcp_array[SRSLTE_N_RADIO_BEARERS]; srsue::rlc_interface_pdcp *rlc; srsue::rrc_interface_pdcp *rrc; diff --git a/lib/include/srslte/upper/rlc.h b/lib/include/srslte/upper/rlc.h index 780af9c11..9d7f7ff39 100644 --- a/lib/include/srslte/upper/rlc.h +++ b/lib/include/srslte/upper/rlc.h @@ -86,10 +86,10 @@ private: srsue::rrc_interface_rlc *rrc; srslte::mac_interface_timers *mac_timers; srsue::ue_interface *ue; - srslte::rlc_entity rlc_array[SRSUE_N_RADIO_BEARERS]; + srslte::rlc_entity rlc_array[SRSLTE_N_RADIO_BEARERS]; - long ul_tput_bytes[SRSUE_N_RADIO_BEARERS]; - long dl_tput_bytes[SRSUE_N_RADIO_BEARERS]; + long ul_tput_bytes[SRSLTE_N_RADIO_BEARERS]; + long dl_tput_bytes[SRSLTE_N_RADIO_BEARERS]; struct timeval metrics_time[3]; bool valid_lcid(uint32_t lcid); diff --git a/lib/src/upper/gw.cc b/lib/src/upper/gw.cc index 490840f89..beb003c51 100644 --- a/lib/src/upper/gw.cc +++ b/lib/src/upper/gw.cc @@ -229,8 +229,8 @@ void gw::run_thread() running = true; while(run_enable) { - if (SRSUE_MAX_BUFFER_SIZE_BYTES-SRSUE_BUFFER_HEADER_OFFSET > idx) { - N_bytes = read(tun_fd, &pdu->msg[idx], SRSUE_MAX_BUFFER_SIZE_BYTES-SRSUE_BUFFER_HEADER_OFFSET - idx); + if (SRSLTE_MAX_BUFFER_SIZE_BYTES-SRSLTE_BUFFER_HEADER_OFFSET > idx) { + N_bytes = read(tun_fd, &pdu->msg[idx], SRSLTE_MAX_BUFFER_SIZE_BYTES-SRSLTE_BUFFER_HEADER_OFFSET - idx); } else { gw_log->error("GW pdu buffer full - gw receive thread exiting.\n"); gw_log->console("GW pdu buffer full - gw receive thread exiting.\n"); diff --git a/lib/src/upper/pdcp.cc b/lib/src/upper/pdcp.cc index c1ebd7463..e729118ce 100644 --- a/lib/src/upper/pdcp.cc +++ b/lib/src/upper/pdcp.cc @@ -48,7 +48,7 @@ void pdcp::stop() void pdcp::reset() { - for(uint32_t i=0;i= SRSUE_N_RADIO_BEARERS) { - pdcp_log->error("Radio bearer id must be in [0:%d] - %d\n", SRSUE_N_RADIO_BEARERS, lcid); + if(lcid < 0 || lcid >= SRSLTE_N_RADIO_BEARERS) { + pdcp_log->error("Radio bearer id must be in [0:%d] - %d\n", SRSLTE_N_RADIO_BEARERS, lcid); return; } if (!pdcp_array[lcid].is_active()) { @@ -116,8 +116,8 @@ void pdcp::write_pdu_pcch(byte_buffer_t *sdu) *******************************************************************************/ bool pdcp::valid_lcid(uint32_t lcid) { - if(lcid < 0 || lcid >= SRSUE_N_RADIO_BEARERS) { - pdcp_log->error("Radio bearer id must be in [0:%d] - %d", SRSUE_N_RADIO_BEARERS, lcid); + if(lcid < 0 || lcid >= SRSLTE_N_RADIO_BEARERS) { + pdcp_log->error("Radio bearer id must be in [0:%d] - %d", SRSLTE_N_RADIO_BEARERS, lcid); return false; } if(!pdcp_array[lcid].is_active()) { diff --git a/lib/src/upper/rlc.cc b/lib/src/upper/rlc.cc index 0213d98d7..becb15c37 100644 --- a/lib/src/upper/rlc.cc +++ b/lib/src/upper/rlc.cc @@ -57,8 +57,8 @@ void rlc::init(srsue::pdcp_interface_rlc *pdcp_, void rlc::reset_metrics() { - bzero(dl_tput_bytes, sizeof(long)*SRSUE_N_RADIO_BEARERS); - bzero(ul_tput_bytes, sizeof(long)*SRSUE_N_RADIO_BEARERS); + bzero(dl_tput_bytes, sizeof(long)*SRSLTE_N_RADIO_BEARERS); + bzero(ul_tput_bytes, sizeof(long)*SRSLTE_N_RADIO_BEARERS); } void rlc::stop() @@ -75,7 +75,7 @@ void rlc::get_metrics(rlc_metrics_t &m) m.dl_tput_mbps = 0; m.ul_tput_mbps = 0; - for (int i=0;i= SRSUE_N_RADIO_BEARERS) { - rlc_log->error("Radio bearer id must be in [0:%d] - %d\n", SRSUE_N_RADIO_BEARERS, lcid); + if(lcid < 0 || lcid >= SRSLTE_N_RADIO_BEARERS) { + rlc_log->error("Radio bearer id must be in [0:%d] - %d\n", SRSLTE_N_RADIO_BEARERS, lcid); return; } @@ -249,7 +249,7 @@ void rlc::add_bearer(uint32_t lcid, LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg) *******************************************************************************/ bool rlc::valid_lcid(uint32_t lcid) { - if(lcid < 0 || lcid >= SRSUE_N_RADIO_BEARERS) { + if(lcid < 0 || lcid >= SRSLTE_N_RADIO_BEARERS) { return false; } if(!rlc_array[lcid].active()) { diff --git a/srsenb/src/upper/rlc.cc b/srsenb/src/upper/rlc.cc index 08ca42157..1af7a76de 100644 --- a/srsenb/src/upper/rlc.cc +++ b/srsenb/src/upper/rlc.cc @@ -84,7 +84,7 @@ void rlc::clear_buffer(uint16_t rnti) if (users.count(rnti)) { log_h->info("Clearing buffer rnti=0x%x\n", rnti); users[rnti].rlc->reset(); - for (int i=0;irlc_buffer_state(rnti, i, 0, 0); } } diff --git a/srsenb/src/upper/s1ap.cc b/srsenb/src/upper/s1ap.cc index bbc7797d1..032a6018f 100644 --- a/srsenb/src/upper/s1ap.cc +++ b/srsenb/src/upper/s1ap.cc @@ -89,7 +89,7 @@ void s1ap::run_thread() { srslte::byte_buffer_t *pdu = pool_allocate; - uint32_t sz = SRSUE_MAX_BUFFER_SIZE_BYTES - SRSUE_BUFFER_HEADER_OFFSET; + uint32_t sz = SRSLTE_MAX_BUFFER_SIZE_BYTES - SRSLTE_BUFFER_HEADER_OFFSET; running = true; // Connect to MME diff --git a/srsenb/test/upper/ip_test.cc b/srsenb/test/upper/ip_test.cc index f0bbf7fc2..f2ec84f64 100644 --- a/srsenb/test/upper/ip_test.cc +++ b/srsenb/test/upper/ip_test.cc @@ -281,7 +281,7 @@ private: while(running) { if (tun_fd > 0) { pdu->msg[0] = 0x0; - N_bytes = read(tun_fd, &pdu->msg[idx], SRSUE_MAX_BUFFER_SIZE_BYTES-SRSUE_BUFFER_HEADER_OFFSET - idx); + N_bytes = read(tun_fd, &pdu->msg[idx], SRSLTE_MAX_BUFFER_SIZE_BYTES-SRSLTE_BUFFER_HEADER_OFFSET - idx); } if(N_bytes > 0) { diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 643cfaf86..a1805a1e9 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -79,7 +79,7 @@ void rrc::init(phy_interface_rrc *phy_, pthread_mutex_init(&mutex, NULL); - ue_category = SRSUE_UE_CATEGORY; + ue_category = SRSLTE_UE_CATEGORY; transaction_id = 0; @@ -318,7 +318,7 @@ void rrc::write_pdu_bcch_dlsch(byte_buffer_t *pdu) void rrc::write_pdu_pcch(byte_buffer_t *pdu) { - if (pdu->N_bytes > 0 && pdu->N_bytes < SRSUE_MAX_BUFFER_SIZE_BITS) { + if (pdu->N_bytes > 0 && pdu->N_bytes < SRSLTE_MAX_BUFFER_SIZE_BITS) { rrc_log->info_hex(pdu->msg, pdu->N_bytes, "PCCH message received %d bytes\n", pdu->N_bytes); rrc_log->info("PCCH message Stack latency: %ld us\n", pdu->get_latency_us()); rrc_log->console("PCCH message received %d bytes\n", pdu->N_bytes); diff --git a/srsue/test/upper/ip_test.cc b/srsue/test/upper/ip_test.cc index f38b6bcd0..a26f273a8 100644 --- a/srsue/test/upper/ip_test.cc +++ b/srsue/test/upper/ip_test.cc @@ -369,7 +369,7 @@ private: log_h->info("TUN/TAP reader thread running\n"); while(running) { - N_bytes = read(tun_fd, &pdu->msg[idx], SRSUE_MAX_BUFFER_SIZE_BYTES-SRSUE_BUFFER_HEADER_OFFSET - idx); + N_bytes = read(tun_fd, &pdu->msg[idx], SRSLTE_MAX_BUFFER_SIZE_BYTES-SRSLTE_BUFFER_HEADER_OFFSET - idx); if(N_bytes > 0 && read_enable) { pdu->N_bytes = idx + N_bytes;