rlc: fix class member initialization

uninitialized member detected by coverity, now converted all default
initialization to be done in class definition
This commit is contained in:
Andre Puschmann 2019-06-12 12:51:49 +02:00
parent b32254c5e2
commit acbe7fabe4
6 changed files with 78 additions and 125 deletions

View File

@ -139,23 +139,22 @@ private:
bool poll_required();
bool do_status();
rlc_am *parent;
byte_buffer_pool *pool;
srslte::log *log;
rlc_am* parent = nullptr;
byte_buffer_pool* pool = nullptr;
srslte::log* log = nullptr;
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte_rlc_am_config_t cfg;
srslte_rlc_am_config_t cfg = {};
// TX SDU buffers
rlc_tx_queue tx_sdu_queue;
unique_byte_buffer_t tx_sdu;
;
bool tx_enabled;
bool tx_enabled = false;
/****************************************************************************
* State variables and counters
@ -163,14 +162,14 @@ private:
***************************************************************************/
// Tx state variables
uint32_t vt_a; // ACK state. SN of next PDU in sequence to be ACKed. Low edge of tx window.
uint32_t vt_ms; // Max send state. High edge of tx window. vt_a + window_size.
uint32_t vt_s; // Send state. SN to be assigned for next PDU.
uint32_t poll_sn; // Poll send state. SN of most recent PDU txed with poll bit set.
uint32_t vt_a = 0; // ACK state. SN of next PDU in sequence to be ACKed. Low edge of tx window.
uint32_t vt_ms = RLC_AM_WINDOW_SIZE; // Max send state. High edge of tx window. vt_a + window_size.
uint32_t vt_s = 0; // Send state. SN to be assigned for next PDU.
uint32_t poll_sn = 0; // Poll send state. SN of most recent PDU txed with poll bit set.
// Tx counters
uint32_t pdu_without_poll;
uint32_t byte_without_poll;
uint32_t pdu_without_poll = 0;
uint32_t byte_without_poll = 0;
rlc_status_pdu_t tx_status;
@ -179,11 +178,11 @@ private:
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte::timers::timer *poll_retx_timer;
uint32_t poll_retx_timer_id;
srslte::timers::timer* poll_retx_timer = nullptr;
uint32_t poll_retx_timer_id = 0;
srslte::timers::timer *status_prohibit_timer;
uint32_t status_prohibit_timer_id;
srslte::timers::timer* status_prohibit_timer = nullptr;
uint32_t status_prohibit_timer_id = 0;
// Tx windows
std::map<uint32_t, rlc_amd_tx_pdu_t> tx_window;
@ -193,7 +192,7 @@ private:
pthread_mutex_t mutex;
// Metrics
uint32_t num_tx_bytes;
uint32_t num_tx_bytes = 0;
};
// Receiver sub-class
@ -230,15 +229,15 @@ private:
void print_rx_segments();
bool add_segment_and_check(rlc_amd_rx_pdu_segments_t *pdu, rlc_amd_rx_pdu_t *segment);
rlc_am *parent;
byte_buffer_pool *pool;
srslte::log *log;
rlc_am* parent = nullptr;
byte_buffer_pool* pool = nullptr;
srslte::log* log = nullptr;
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte_rlc_am_config_t cfg;
srslte_rlc_am_config_t cfg = {};
// RX SDU buffers
unique_byte_buffer_t rx_sdu;
@ -249,11 +248,11 @@ private:
***************************************************************************/
// Rx state variables
uint32_t vr_r; // Receive state. SN following last in-sequence received PDU. Low edge of rx window
uint32_t vr_mr; // Max acceptable receive state. High edge of rx window. vr_r + window size.
uint32_t vr_x; // t_reordering state. SN following PDU which triggered t_reordering.
uint32_t vr_ms; // Max status tx state. Highest possible value of SN for ACK_SN in status PDU.
uint32_t vr_h; // Highest rx state. SN following PDU with highest SN among rxed PDUs.
uint32_t vr_r = 0; // Receive state. SN following last in-sequence received PDU. Low edge of rx window
uint32_t vr_mr = RLC_AM_WINDOW_SIZE; // Max acceptable receive state. High edge of rx window. vr_r + window size.
uint32_t vr_x = 0; // t_reordering state. SN following PDU which triggered t_reordering.
uint32_t vr_ms = 0; // Max status tx state. Highest possible value of SN for ACK_SN in status PDU.
uint32_t vr_h = 0; // Highest rx state. SN following PDU with highest SN among rxed PDUs.
// Mutexes
pthread_mutex_t mutex;
@ -263,28 +262,28 @@ private:
std::map<uint32_t, rlc_amd_rx_pdu_segments_t> rx_segments;
// Metrics
uint32_t num_rx_bytes;
uint32_t num_rx_bytes = 0;
bool poll_received;
bool do_status;
bool poll_received = false;
bool do_status = false;
/****************************************************************************
* Timers
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte::timers::timer *reordering_timer;
uint32_t reordering_timer_id;
srslte::timers::timer* reordering_timer = nullptr;
uint32_t reordering_timer_id = 0;
};
// Common variables needed/provided by parent class
srsue::rrc_interface_rlc *rrc;
srslte::log *log;
srsue::pdcp_interface_rlc *pdcp;
mac_interface_timers *mac_timers;
uint32_t lcid;
srslte_rlc_config_t cfg;
bool has_configuration;
srsue::rrc_interface_rlc* rrc = nullptr;
srslte::log* log = nullptr;
srsue::pdcp_interface_rlc* pdcp = nullptr;
mac_interface_timers* mac_timers = nullptr;
uint32_t lcid = 0;
srslte_rlc_config_t cfg = {};
bool has_configuration = false;
std::string rb_name;
static const int poll_periodicity = 8; // After how many data PDUs a status PDU shall be requested

View File

@ -64,17 +64,16 @@ public:
void write_pdu(uint8_t *payload, uint32_t nof_bytes);
private:
byte_buffer_pool* pool = nullptr;
srslte::log* log = nullptr;
uint32_t lcid = 0;
srsue::pdcp_interface_rlc* pdcp = nullptr;
srsue::rrc_interface_rlc* rrc = nullptr;
byte_buffer_pool *pool;
srslte::log *log;
uint32_t lcid;
srsue::pdcp_interface_rlc *pdcp;
srsue::rrc_interface_rlc *rrc;
bool tx_enabled = true;
bool tx_enabled;
uint32_t num_tx_bytes;
uint32_t num_rx_bytes;
uint32_t num_tx_bytes = 0;
uint32_t num_rx_bytes = 0;
// Thread-safe queues for MAC messages
rlc_tx_queue ul_queue;

View File

@ -94,15 +94,15 @@ private:
uint32_t get_buffer_state();
private:
byte_buffer_pool *pool;
srslte::log *log;
byte_buffer_pool* pool = nullptr;
srslte::log* log = nullptr;
std::string rb_name;
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte_rlc_um_config_t cfg;
srslte_rlc_um_config_t cfg = {};
// TX SDU buffers
rlc_tx_queue tx_sdu_queue;
@ -112,14 +112,14 @@ private:
* State variables and counters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
uint32_t vt_us; // Send state. SN to be assigned for next PDU.
uint32_t vt_us = 0; // Send state. SN to be assigned for next PDU.
// Mutexes
pthread_mutex_t mutex;
bool tx_enabled;
bool tx_enabled = false;
uint32_t num_tx_bytes;
uint32_t num_tx_bytes = 0;
// helper functions
void debug_state();
@ -151,48 +151,48 @@ private:
private:
void reset();
byte_buffer_pool *pool;
srslte::log *log;
mac_interface_timers *mac_timers;
byte_buffer_pool* pool = nullptr;
srslte::log* log = nullptr;
mac_interface_timers* mac_timers = nullptr;
std::string rb_name;
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte_rlc_um_config_t cfg;
srslte_rlc_um_config_t cfg = {};
// Rx window
std::map<uint32_t, rlc_umd_pdu_t> rx_window;
// RX SDU buffers
unique_byte_buffer_t rx_sdu;
uint32_t vr_ur_in_rx_sdu;
uint32_t vr_ur_in_rx_sdu = 0;
// Rx state variables and counter
uint32_t vr_ur; // Receive state. SN of earliest PDU still considered for reordering.
uint32_t vr_ux; // t_reordering state. SN following PDU which triggered t_reordering.
uint32_t vr_uh; // Highest rx state. SN following PDU with highest SN among rxed PDUs.
bool pdu_lost;
uint32_t vr_ur = 0; // Receive state. SN of earliest PDU still considered for reordering.
uint32_t vr_ux = 0; // t_reordering state. SN following PDU which triggered t_reordering.
uint32_t vr_uh = 0; // Highest rx state. SN following PDU with highest SN among rxed PDUs.
bool pdu_lost = false;
uint32_t num_rx_bytes;
uint32_t num_rx_bytes = 0;
// Upper layer handles and variables
srsue::pdcp_interface_rlc *pdcp;
srsue::rrc_interface_rlc *rrc;
uint32_t lcid;
srsue::pdcp_interface_rlc* pdcp = nullptr;
srsue::rrc_interface_rlc* rrc = nullptr;
uint32_t lcid = 0;
// Mutexes
pthread_mutex_t mutex;
bool rx_enabled;
bool rx_enabled = false;
/****************************************************************************
* Timers
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte::timers::timer *reordering_timer;
uint32_t reordering_timer_id;
srslte::timers::timer* reordering_timer = nullptr;
uint32_t reordering_timer_id = 0;
// helper functions
void debug_state();
@ -200,13 +200,13 @@ private:
};
// Common variables needed by parent class
srsue::rrc_interface_rlc *rrc;
srslte::log *log;
uint32_t lcid;
srslte_rlc_config_t cfg;
bool has_configuration;
srsue::rrc_interface_rlc* rrc = nullptr;
srslte::log* log = nullptr;
uint32_t lcid = 0;
srslte_rlc_config_t cfg = {};
bool has_configuration = false;
std::string rb_name;
byte_buffer_pool *pool;
byte_buffer_pool* pool = nullptr;
std::string get_rb_name(srsue::rrc_interface_rlc *rrc, uint32_t lcid, bool is_mrb);

View File

@ -42,8 +42,6 @@ rlc_am::rlc_am(srslte::log* log_,
pdcp(pdcp_),
mac_timers(mac_timers_),
lcid(lcid_),
cfg(),
has_configuration(false),
tx(this),
rx(this)
{
@ -183,22 +181,8 @@ void rlc_am::write_pdu(uint8_t *payload, uint32_t nof_bytes)
rlc_am::rlc_am_tx::rlc_am_tx(rlc_am* parent_) :
parent(parent_),
poll_retx_timer(nullptr),
poll_retx_timer_id(0),
status_prohibit_timer(nullptr),
status_prohibit_timer_id(0),
vt_a(0),
vt_ms(RLC_AM_WINDOW_SIZE),
vt_s(0),
poll_sn(0),
num_tx_bytes(0),
pdu_without_poll(0),
byte_without_poll(0),
log(parent_->log),
cfg(),
tx_status(),
pool(byte_buffer_pool::get_instance()),
tx_enabled(false)
pool(byte_buffer_pool::get_instance())
{
poll_retx_timer_id = parent->mac_timers->timer_get_unique_id();
poll_retx_timer = parent->mac_timers->timer_get(poll_retx_timer_id);
@ -1155,18 +1139,7 @@ bool rlc_am::rlc_am_tx::retx_queue_has_sn(uint32_t sn)
rlc_am::rlc_am_rx::rlc_am_rx(rlc_am* parent_) :
parent(parent_),
pool(byte_buffer_pool::get_instance()),
log(parent_->log),
cfg(),
reordering_timer(nullptr),
reordering_timer_id(0),
vr_r(0),
vr_mr(RLC_AM_WINDOW_SIZE),
vr_x(0),
vr_ms(0),
vr_h(0),
num_rx_bytes(0),
poll_received(false),
do_status(false)
log(parent_->log)
{
reordering_timer_id = parent->mac_timers->timer_get_unique_id();
reordering_timer = parent->mac_timers->timer_get(reordering_timer_id);

View File

@ -30,13 +30,10 @@ rlc_tm::rlc_tm(srslte::log* log_,
srslte::mac_interface_timers* mac_timers_,
uint32_t queue_len_) :
ul_queue(queue_len_),
tx_enabled(true),
log(log_),
pdcp(pdcp_),
rrc(rrc_),
lcid(lcid_),
num_tx_bytes(0),
num_rx_bytes(0)
lcid(lcid_)
{
pool = byte_buffer_pool::get_instance();
}

View File

@ -41,7 +41,6 @@ rlc_um::rlc_um(srslte::log* log_,
tx(log_),
rx(log_, lcid_, pdcp_, rrc_, mac_timers_)
{
bzero(&cfg, sizeof(srslte_rlc_um_config_t));
}
// Warning: must call stop() to properly deallocate all buffers
@ -222,12 +221,7 @@ std::string rlc_um::get_rb_name(srsue::rrc_interface_rlc *rrc, uint32_t lcid, bo
* Tx subclass implementation
***************************************************************************/
rlc_um::rlc_um_tx::rlc_um_tx(srslte::log* log_) :
pool(byte_buffer_pool::get_instance()),
log(log_),
vt_us(0),
tx_enabled(false),
num_tx_bytes(0)
rlc_um::rlc_um_tx::rlc_um_tx(srslte::log* log_) : pool(byte_buffer_pool::get_instance()), log(log_)
{
pthread_mutex_init(&mutex, NULL);
}
@ -508,21 +502,12 @@ rlc_um::rlc_um_rx::rlc_um_rx(srslte::log* log_,
srsue::pdcp_interface_rlc* pdcp_,
srsue::rrc_interface_rlc* rrc_,
srslte::mac_interface_timers* mac_timers_) :
reordering_timer(nullptr),
reordering_timer_id(0),
pool(byte_buffer_pool::get_instance()),
log(log_),
pdcp(pdcp_),
rrc(rrc_),
vr_ur(0),
vr_ux(0),
vr_uh(0),
vr_ur_in_rx_sdu(0),
pdu_lost(false),
mac_timers(mac_timers_),
lcid(lcid_),
num_rx_bytes(0),
rx_enabled(false)
lcid(lcid_)
{
reordering_timer_id = mac_timers->timer_get_unique_id();
reordering_timer = mac_timers->timer_get(reordering_timer_id);