From de669d214acf5bc6d238488bebdebfdc1ac24644 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 14 Jan 2021 10:43:28 +0000 Subject: [PATCH] Fix test header and queue_capacity check in RLC notifications. Also, remove unecessary nullptr initializaion and fixup some newlines. --- lib/include/srslte/upper/rlc_am_lte.h | 2 +- lib/src/upper/rlc_am_lte.cc | 2 +- lib/test/upper/rlc_am_notify_pdcp_test.cc | 29 +++++++---------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/lib/include/srslte/upper/rlc_am_lte.h b/lib/include/srslte/upper/rlc_am_lte.h index a7c444917..abb1acf47 100644 --- a/lib/include/srslte/upper/rlc_am_lte.h +++ b/lib/include/srslte/upper/rlc_am_lte.h @@ -152,7 +152,7 @@ private: // TX SDU buffers byte_buffer_queue tx_sdu_queue; - unique_byte_buffer_t tx_sdu = nullptr; + unique_byte_buffer_t tx_sdu; bool tx_enabled = false; diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 2a34ce32a..9e3edd528 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -384,7 +384,7 @@ int rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu) if (info_count != 0) { log->error("PDCP SDU info alreay exists\n"); return SRSLTE_ERROR; - } else if (info_count > pdcp_info_queue_capacity) { + } else if (undelivered_sdu_info_queue.size() >= pdcp_info_queue_capacity) { log->error("PDCP SDU info exceeds maximum queue capacity\n"); return SRSLTE_ERROR; } diff --git a/lib/test/upper/rlc_am_notify_pdcp_test.cc b/lib/test/upper/rlc_am_notify_pdcp_test.cc index 519583ec3..6c63ed249 100644 --- a/lib/test/upper/rlc_am_notify_pdcp_test.cc +++ b/lib/test/upper/rlc_am_notify_pdcp_test.cc @@ -1,21 +1,12 @@ -/* - * Copyright 2013-2020 Software Radio Systems Limited +/** * - * This file is part of srsLTE. + * \section COPYRIGHT * - * srsLTE is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. + * Copyright 2013-2021 Software Radio Systems Limited * - * srsLTE is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * A copy of the GNU Affero General Public License can be found in - * the LICENSE file in the top-level directory of this distribution - * and at http://www.gnu.org/licenses/. + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. * */ @@ -59,7 +50,6 @@ class rrc_tester : public srsue::rrc_interface_rlc // Simple test of a single TX PDU and an imediate ACK int simple_sdu_notify_test() { - srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); pdcp_tester pdcp; rrc_tester rrc; @@ -110,7 +100,6 @@ int simple_sdu_notify_test() // Both PDUs are ACKed in the same status PDU. int two_pdus_notify_test() { - srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); pdcp_tester pdcp; rrc_tester rrc; @@ -174,7 +163,6 @@ int two_pdus_notify_test() // The PDU is ACKed imediatly. int two_sdus_notify_test() { - srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); pdcp_tester pdcp; rrc_tester rrc; @@ -236,7 +224,6 @@ int two_sdus_notify_test() // The PDU is ACKed imediatly. int three_sdus_notify_test() { - srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); pdcp_tester pdcp; rrc_tester rrc; @@ -306,10 +293,10 @@ int three_sdus_notify_test() return SRSLTE_SUCCESS; } + // Test notification of an RTXED SDU. int rtxed_sdu_notify_test() { - srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); pdcp_tester pdcp; rrc_tester rrc; @@ -444,7 +431,6 @@ int two_sdus_out_of_order_ack_notify_test() // Test out-of-order ack of a single SDU transmitted over 2 PDUs. int two_pdus_out_of_order_ack_notify_test() { - srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); pdcp_tester pdcp; rrc_tester rrc; @@ -502,6 +488,7 @@ int two_pdus_out_of_order_ack_notify_test() return SRSLTE_SUCCESS; } + int main(int argc, char** argv) { srslte::byte_buffer_pool::get_instance();