lib,rlc_am_nr: use std:vector for nacks in rlc_am_nr_status_pdu_t

- Also create tx_status a member to avoid frequent allocations
for each created PDU.

- Remove unused member nack_range from rlc_am_nr_status_pdu_t.
master
Robert Falkenberg 3 years ago
parent 0cf052e31d
commit 5bb6cdec1e

@ -149,10 +149,11 @@ private:
struct rlc_am_nr_tx_state_t st = {};
std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> > tx_window;
// Queues and buffers
// Queues, buffers and container
std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> > retx_queue;
uint32_t sdu_under_segmentation_sn = INVALID_RLC_SN; // SN of the SDU currently being segmented.
pdcp_sn_vector_t notify_info_vec;
rlc_am_nr_status_pdu_t tx_status;
// Helper constants
uint32_t min_hdr_size = 2;

@ -78,13 +78,23 @@ struct rlc_amd_tx_sdu_nr_t {
};
///< AM NR Status PDU header (perhaps merge with LTE version)
typedef struct {
rlc_am_nr_control_pdu_type_t cpt;
uint32_t ack_sn; ///< SN of the next not received RLC Data PDU
uint16_t N_nack; ///< number of NACKs
uint8_t nack_range; ///< number of consecutively lost RLC SDUs starting from and including NACK_SN
rlc_status_nack_t nacks[RLC_AM_NR_MAX_NACKS];
} rlc_am_nr_status_pdu_t;
struct rlc_am_nr_status_pdu_t {
rlc_am_nr_control_pdu_type_t cpt;
uint32_t ack_sn; ///< SN of the next not received RLC Data PDU
uint16_t N_nack; ///< number of NACKs
std::vector<rlc_status_nack_t> nacks;
rlc_am_nr_status_pdu_t() :
cpt(rlc_am_nr_control_pdu_type_t::status_pdu), ack_sn(INVALID_RLC_SN), N_nack(0), nacks(RLC_AM_NR_TYP_NACKS)
{}
void reset()
{
cpt = rlc_am_nr_control_pdu_type_t::status_pdu;
ack_sn = INVALID_RLC_SN;
N_nack = 0;
nacks.clear();
}
};
/****************************************************************************
* Header pack/unpack helper functions for NR

@ -34,7 +34,8 @@ namespace srsran {
#define RLC_MAX_SDU_SIZE ((1 << 11) - 1) // Length of LI field is 11bits
#define RLC_AM_MIN_DATA_PDU_SIZE (3) // AMD PDU with 10 bit SN (length of LI field is 11 bits) (No LI)
#define RLC_AM_NR_MAX_NACKS 2048
#define RLC_AM_NR_TYP_NACKS 512 // Expected number of NACKs in status PDU before expanding space by alloc
#define RLC_AM_NR_MAX_NACKS 2048 // Maximum number of NACKs in status PDU
#define RlcDebug(fmt, ...) logger.debug("%s: " fmt, rb_name, ##__VA_ARGS__)
#define RlcInfo(fmt, ...) logger.info("%s: " fmt, rb_name, ##__VA_ARGS__)

@ -676,8 +676,8 @@ uint32_t rlc_am_nr_tx::get_retx_expected_hdr_len(const rlc_amd_retx_nr_t& retx)
uint32_t rlc_am_nr_tx::build_status_pdu(byte_buffer_t* payload, uint32_t nof_bytes)
{
RlcInfo("generating status PDU. Bytes available:%d", nof_bytes);
rlc_am_nr_status_pdu_t tx_status;
int pdu_len = rx->get_status_pdu(&tx_status, nof_bytes);
tx_status.reset();
int pdu_len = rx->get_status_pdu(&tx_status, nof_bytes);
if (pdu_len == SRSRAN_ERROR) {
RlcDebug("deferred status PDU. Cause: Failed to acquire rx lock");
pdu_len = 0;
@ -1286,6 +1286,8 @@ uint32_t rlc_am_nr_rx::get_status_pdu(rlc_am_nr_status_pdu_t* status, uint32_t m
}
}
// TODO: add check to not exceed status->N_nack >= RLC_AM_NR_MAX_NACKS
// make sure we don't exceed grant size (FIXME)
rlc_am_nr_write_status_pdu(*status, cfg.rx_sn_field_length, &tmp_buf);
// TODO

Loading…
Cancel
Save