mirror of https://github.com/PentHertz/srsLTE.git
changed srsran_warning to srsran_expect. Applied new macro to rlc am
This commit is contained in:
parent
b5692037a2
commit
dd336c53ea
|
@ -32,11 +32,11 @@
|
|||
|
||||
#ifdef STOP_ON_WARNING
|
||||
|
||||
#define srsran_warning(condition, fmt, ...) srsran_assert(condition, fmt, ##__VA_ARGS__)
|
||||
#define srsran_expect(condition, fmt, ...) srsran_assert(condition, fmt, ##__VA_ARGS__)
|
||||
|
||||
#else // STOP_ON_WARNING
|
||||
|
||||
#define srsran_warning(condition, fmt, ...) \
|
||||
#define srsran_expect(condition, fmt, ...) \
|
||||
do { \
|
||||
if (srsran_unlikely(not(condition))) { \
|
||||
srslog::fetch_basic_logger("ALL").warning("%s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
|
||||
|
@ -51,7 +51,7 @@
|
|||
do { \
|
||||
} while (0)
|
||||
|
||||
#define srsran_warning(condition, fmt, ...) \
|
||||
#define srsran_expect(condition, fmt, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "srsran/adt/interval.h"
|
||||
#include "srsran/common/common.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/srslog/srslog.h"
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
@ -23,16 +24,13 @@ namespace srsran {
|
|||
|
||||
struct tti_point {
|
||||
constexpr tti_point() = default;
|
||||
explicit tti_point(uint32_t tti_val_) : tti_val(tti_val_ % 10240u)
|
||||
explicit tti_point(uint32_t tti_val_) : tti_val(tti_val_ % 10240U)
|
||||
{
|
||||
if (tti_val_ > std::numeric_limits<uint32_t>::max() / 2) {
|
||||
// there was a overflow at tti initialization
|
||||
uint32_t diff = std::numeric_limits<uint32_t>::max() - tti_val_;
|
||||
if (diff < 10240) {
|
||||
tti_val = 10240 - diff - 1;
|
||||
} else {
|
||||
srslog::fetch_basic_logger("COMMON").error("Invalid TTI point assigned");
|
||||
}
|
||||
srsran_expect(diff < 10240, "Invalid TTI point assigned");
|
||||
tti_val = 10240 - diff - 1;
|
||||
}
|
||||
}
|
||||
void reset() { tti_val = std::numeric_limits<uint32_t>::max(); }
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "srsran/adt/circular_array.h"
|
||||
#include "srsran/common/buffer_pool.h"
|
||||
#include "srsran/common/common.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/common/task_scheduler.h"
|
||||
#include "srsran/common/timeout.h"
|
||||
#include "srsran/interfaces/pdcp_interface_types.h"
|
||||
|
@ -75,7 +76,7 @@ struct rlc_ringbuffer_t {
|
|||
rlc_ringbuffer_t() { clear(); }
|
||||
T& add_pdu(size_t sn)
|
||||
{
|
||||
assert(not has_sn(sn));
|
||||
srsran_expect(not has_sn(sn), "The same SN=%d should not be added twice", sn);
|
||||
window[sn].rlc_sn = sn;
|
||||
active_flag[sn] = true;
|
||||
count++;
|
||||
|
@ -83,14 +84,14 @@ struct rlc_ringbuffer_t {
|
|||
}
|
||||
void remove_pdu(size_t sn)
|
||||
{
|
||||
assert(active_flag[sn]);
|
||||
srsran_expect(has_sn(sn), "The removed SN=%d is not in the window", sn);
|
||||
window[sn] = {};
|
||||
active_flag[sn] = false;
|
||||
count--;
|
||||
}
|
||||
T& operator[](size_t sn)
|
||||
{
|
||||
assert(has_sn(sn));
|
||||
srsran_expect(has_sn(sn), "The accessed SN=%d is not in the window", sn);
|
||||
return window[sn];
|
||||
}
|
||||
size_t size() const { return count; }
|
||||
|
|
|
@ -820,7 +820,7 @@ int rlc_am_lte::rlc_am_lte_tx::build_segment(uint8_t* payload, uint32_t nof_byte
|
|||
}
|
||||
|
||||
// Santity check we don't pack beyond the provided buffer
|
||||
assert(head_len + (retx.so_end - retx.so_start) <= nof_bytes);
|
||||
srsran_expect(head_len + (retx.so_end - retx.so_start) <= nof_bytes, "The provided buffer was overflown.");
|
||||
|
||||
// Update retx_queue
|
||||
if (tx_window[retx.sn].buf->N_bytes == retx.so_end) {
|
||||
|
@ -1129,7 +1129,7 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no
|
|||
auto& pdu = tx_window[i];
|
||||
if (!retx_queue.has_sn(i)) {
|
||||
rlc_amd_retx_t& retx = retx_queue.push();
|
||||
assert(tx_window[i].rlc_sn == i);
|
||||
srsran_expect(tx_window[i].rlc_sn == i, "Incorrect RLC SN=%d!=%d being accessed", tx_window[i].rlc_sn, i);
|
||||
retx.sn = i;
|
||||
retx.is_segment = false;
|
||||
retx.so_start = 0;
|
||||
|
|
|
@ -512,7 +512,7 @@ int main(int argc, char* argv[])
|
|||
// Start the log backend.
|
||||
srslog::init();
|
||||
|
||||
srslog::fetch_basic_logger("COMMON").set_level(srslog::basic_levels::info);
|
||||
srslog::fetch_basic_logger("ALL").set_level(srslog::basic_levels::warning);
|
||||
srsran::log_args(argc, argv, "ENB");
|
||||
|
||||
srsran::check_scaling_governor(args.rf.device_name);
|
||||
|
|
|
@ -663,6 +663,7 @@ int main(int argc, char* argv[])
|
|||
// Start the log backend.
|
||||
srslog::init();
|
||||
|
||||
srslog::fetch_basic_logger("ALL").set_level(srslog::basic_levels::warning);
|
||||
srsran::log_args(argc, argv, "UE");
|
||||
|
||||
srsran::check_scaling_governor(args.rf.device_name);
|
||||
|
|
Loading…
Reference in New Issue