diff --git a/lib/include/srslte/common/buffer_pool.h b/lib/include/srslte/common/buffer_pool.h index c8cb1624a..85d94f962 100644 --- a/lib/include/srslte/common/buffer_pool.h +++ b/lib/include/srslte/common/buffer_pool.h @@ -198,7 +198,7 @@ public: if(!b) { return; } - b->reset(); + b->clear(); if (!pool->deallocate(b)) { if (log) { #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED diff --git a/lib/include/srslte/common/common.h b/lib/include/srslte/common/common.h index 2374fd969..3d2e17ff7 100644 --- a/lib/include/srslte/common/common.h +++ b/lib/include/srslte/common/common.h @@ -153,7 +153,7 @@ public: memcpy(msg, buf.msg, N_bytes); return *this; } - void reset() + void clear() { msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; N_bytes = 0; @@ -229,7 +229,7 @@ struct bit_buffer_t{ memcpy(msg, buf.msg, N_bits); return *this; } - void reset() + void clear() { msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; N_bits = 0; diff --git a/lib/src/upper/rlc_um.cc b/lib/src/upper/rlc_um.cc index 70052cbb0..efb53cb71 100644 --- a/lib/src/upper/rlc_um.cc +++ b/lib/src/upper/rlc_um.cc @@ -683,7 +683,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() if(rx_window.end() == rx_window.find(vr_ur)) { log->debug("SN=%d not in rx_window. Reset received SDU\n", vr_ur); - rx_sdu->reset(); + rx_sdu->clear(); }else{ // Handle any SDU segments for(uint32_t i=0; imsg += len; rx_window[vr_ur].buf->N_bytes -= len; - rx_sdu->reset(); + rx_sdu->clear(); break; } @@ -706,7 +706,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() rx_window[vr_ur].buf->N_bytes -= len; if((pdu_lost && !rlc_um_start_aligned(rx_window[vr_ur].header.fi)) || (vr_ur != ((vr_ur_in_rx_sdu+1)%cfg.rx_mod))) { log->warning("Dropping remainder of lost PDU (lower edge middle segments, vr_ur=%d, vr_ur_in_rx_sdu=%d)\n", vr_ur, vr_ur_in_rx_sdu); - rx_sdu->reset(); + rx_sdu->clear(); } else { log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d, i=%d (lower edge middle segments)", get_rb_name(), vr_ur, i); rx_sdu->set_timestamp(); @@ -736,7 +736,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() { if(pdu_lost && !rlc_um_start_aligned(rx_window[vr_ur].header.fi)) { log->warning("Dropping remainder of lost PDU (lower edge last segments)\n"); - rx_sdu->reset(); + rx_sdu->clear(); } else { log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d (lower edge last segments)", get_rb_name(), vr_ur); rx_sdu->set_timestamp(); @@ -769,7 +769,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() if (not pdu_belongs_to_rx_sdu()) { log->warning("PDU SN=%d lost, stop reassambling SDU (vr_ur_in_rx_sdu=%d)\n", vr_ur_in_rx_sdu+1, vr_ur_in_rx_sdu); pdu_lost = false; // Reset flag to not prevent reassembling of further segments - rx_sdu->reset(); + rx_sdu->clear(); } // Handle any SDU segments @@ -788,7 +788,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() // Advance data pointers and continue with next segment rx_window[vr_ur].buf->msg += len; rx_window[vr_ur].buf->N_bytes -= len; - rx_sdu->reset(); + rx_sdu->clear(); // Reset flag, it is safe to process all remaining segments of this PDU pdu_lost = false; @@ -798,7 +798,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() // Check available space in SDU if ((uint32_t)len > rx_sdu->get_tailroom()) { log->error("Dropping PDU %d due to buffer mis-alignment (current segment len %d B, received %d B)\n", vr_ur, rx_sdu->N_bytes, len); - rx_sdu->reset(); + rx_sdu->clear(); goto clean_up_rx_window; } @@ -842,7 +842,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() // Handle last segment if (rx_sdu->N_bytes == 0 && rx_window[vr_ur].header.N_li == 0 && !rlc_um_start_aligned(rx_window[vr_ur].header.fi)) { log->warning("Dropping PDU %d due to lost start segment\n", vr_ur); - rx_sdu->reset(); + rx_sdu->clear(); goto clean_up_rx_window; } @@ -862,7 +862,7 @@ void rlc_um::rlc_um_rx::reassemble_rx_sdus() if(rlc_um_end_aligned(rx_window[vr_ur].header.fi)) { if(pdu_lost && !rlc_um_start_aligned(rx_window[vr_ur].header.fi)) { log->warning("Dropping remainder of lost PDU (update vr_ur last segments)\n"); - rx_sdu->reset(); + rx_sdu->clear(); } else { log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d (update vr_ur last segments)", get_rb_name(), vr_ur); rx_sdu->set_timestamp(); @@ -945,7 +945,7 @@ void rlc_um::rlc_um_rx::timer_expired(uint32_t timeout_id) pdu_lost = true; if (rx_sdu != NULL) { - rx_sdu->reset(); + rx_sdu->clear(); } while(RX_MOD_BASE(vr_ur) < RX_MOD_BASE(vr_ux)) { diff --git a/lib/test/upper/rlc_am_control_test.cc b/lib/test/upper/rlc_am_control_test.cc index 2eb9a3a4c..1f24a7594 100644 --- a/lib/test/upper/rlc_am_control_test.cc +++ b/lib/test/upper/rlc_am_control_test.cc @@ -45,8 +45,8 @@ int main(int argc, char **argv) { for(uint32_t i=0;ireset(); + pdu->clear(); gtpu_log->debug("Waiting for read...\n"); int n = 0; do{ @@ -389,7 +389,7 @@ void gtpu::mch_thread::run_thread() while(run_enable) { - pdu->reset(); + pdu->clear(); do{ n = recvfrom(m1u_sd, pdu->msg, SRSENB_MAX_BUFFER_SIZE_BYTES - SRSENB_BUFFER_HEADER_OFFSET, 0, (struct sockaddr *) &src_addr, &addrlen); } while (n == -1 && errno == EAGAIN); diff --git a/srsenb/src/upper/rrc.cc b/srsenb/src/upper/rrc.cc index 954dbcdf7..991ae4290 100644 --- a/srsenb/src/upper/rrc.cc +++ b/srsenb/src/upper/rrc.cc @@ -263,7 +263,7 @@ void rrc::write_dl_info(uint16_t rnti, srslte::unique_byte_buffer_t sdu) memcpy(msg_c1->dl_info_transfer().crit_exts.c1().dl_info_transfer_r8().ded_info_type.ded_info_nas().data(), sdu->msg, sdu->N_bytes); - sdu->reset(); + sdu->clear(); users[rnti].send_dl_dcch(&dl_dcch_msg, std::move(sdu)); } else { @@ -483,7 +483,7 @@ bool rrc::is_paging_opportunity(uint32_t tti, uint32_t *payload_len) pthread_mutex_unlock(&paging_mutex); if (paging_rec->paging_record_list.size() > 0) { - byte_buf_paging.reset(); + byte_buf_paging.clear(); asn1::bit_ref bref(byte_buf_paging.msg, byte_buf_paging.get_tailroom()); pcch_msg.pack(bref); byte_buf_paging.N_bytes = (uint32_t)bref.distance_bytes(); @@ -1047,7 +1047,7 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu) parent->log_rrc_message(rb_id_text[lcid], Rx, pdu.get(), ul_dcch_msg); // reuse PDU - pdu->reset(); // FIXME: name collision with byte_buffer reset + pdu->clear(); // FIXME: name collision with byte_buffer reset transaction_id = 0; @@ -1642,7 +1642,7 @@ void rrc::ue::send_connection_reconf_upd(srslte::unique_byte_buffer_t pdu) sr_get(&phy_cfg->sched_request_cfg.setup().sr_cfg_idx, &phy_cfg->sched_request_cfg.setup().sr_pucch_res_idx); - pdu->reset(); + pdu->clear(); send_dl_dcch(&dl_dcch_msg, std::move(pdu)); @@ -1776,7 +1776,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) } // Reuse same PDU - pdu->reset(); + pdu->clear(); send_dl_dcch(&dl_dcch_msg, std::move(pdu)); diff --git a/srsenb/src/upper/s1ap.cc b/srsenb/src/upper/s1ap.cc index 59a53d958..266838947 100644 --- a/srsenb/src/upper/s1ap.cc +++ b/srsenb/src/upper/s1ap.cc @@ -111,7 +111,7 @@ void s1ap::run_thread() // S1AP rx loop while(running) { - pdu->reset(); + pdu->clear(); pdu->N_bytes = recv(socket_fd, pdu->msg, sz, 0); if(pdu->N_bytes <= 0) { diff --git a/srsepc/src/mbms-gw/mbms-gw.cc b/srsepc/src/mbms-gw/mbms-gw.cc index f19296cac..46ae9f71c 100644 --- a/srsepc/src/mbms-gw/mbms-gw.cc +++ b/srsepc/src/mbms-gw/mbms-gw.cc @@ -263,7 +263,7 @@ mbms_gw::run_thread() uint8_t seq = 0; while(m_running) { - msg->reset(); + msg->clear(); int n; do{ n = read(m_sgi_mb_if, msg->msg, SRSLTE_MAX_BUFFER_SIZE_BYTES); diff --git a/srsepc/src/mme/mme.cc b/srsepc/src/mme/mme.cc index bbdf1e1a5..266165cf4 100644 --- a/srsepc/src/mme/mme.cc +++ b/srsepc/src/mme/mme.cc @@ -124,7 +124,7 @@ void mme::run_thread() int s11 = m_mme_gtpc->get_s11(); while (m_running) { - pdu->reset(); + pdu->clear(); int max_fd = std::max(s1mme, s11); FD_ZERO(&m_set); diff --git a/srsepc/src/spgw/spgw.cc b/srsepc/src/spgw/spgw.cc index e9a11bbc1..1da9dbf37 100644 --- a/srsepc/src/spgw/spgw.cc +++ b/srsepc/src/spgw/spgw.cc @@ -131,8 +131,8 @@ void spgw::run_thread() max_fd = std::max(max_fd, s11); while (m_running) { - s1u_msg->reset(); - s11_msg->reset(); + s1u_msg->clear(); + s11_msg->clear(); FD_ZERO(&set); FD_SET(s1u, &set); diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index ff918cccd..e3cd8fbf3 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -836,7 +836,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) liblte_mme_pack_activate_default_eps_bearer_context_accept_msg(&act_def_eps_bearer_context_accept, &attach_complete.esm_msg); - pdu->reset(); + pdu->clear(); liblte_mme_pack_attach_complete_msg(&attach_complete, LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED, ctxt.tx_count, @@ -1044,7 +1044,7 @@ void nas::parse_security_mode_command(uint32_t lcid, unique_byte_buffer_t pdu) } // Send response - pdu->reset(); + pdu->clear(); liblte_mme_pack_security_mode_complete_msg( &sec_mode_comp, LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED_WITH_NEW_EPS_SECURITY_CONTEXT,