lib,rlc_am_nr: consider size of all pending retx in buffer state

This commit is contained in:
Robert Falkenberg 2022-04-22 10:29:57 +02:00
parent ced6cf6e40
commit d66c76b374
3 changed files with 21 additions and 8 deletions

View File

@ -370,6 +370,9 @@ public:
virtual bool empty() const = 0;
virtual bool full() const = 0;
virtual T& operator[](size_t idx) = 0;
virtual const T& operator[](size_t idx) const = 0;
virtual bool has_sn(uint32_t sn) const = 0;
virtual bool has_sn(uint32_t sn, uint32_t so) const = 0;
};
@ -396,6 +399,18 @@ public:
return buffer[rpos];
}
T& operator[](size_t idx) override
{
srsran_assert(idx < size(), "Out-of-bounds access to element idx=%zd", idx);
return buffer[(rpos + idx) % WINDOW_SIZE];
}
const T& operator[](size_t idx) const override
{
srsran_assert(idx < size(), "Out-of-bounds access to element idx=%zd", idx);
return buffer[(rpos + idx) % WINDOW_SIZE];
}
void clear() override
{
wpos = 0;

View File

@ -968,8 +968,9 @@ void rlc_am_nr_tx::get_buffer_state(uint32_t& n_bytes_new, uint32_t& n_bytes_pri
}
// Bytes needed for retx
if (not retx_queue->empty()) {
rlc_amd_retx_nr_t& retx = retx_queue->front();
size_t n_retx = retx_queue->size();
for (size_t i = 0; i < n_retx; i++) {
rlc_amd_retx_nr_t& retx = (*retx_queue)[i];
RlcDebug("buffer state - retx - SN=%d, Segment: %s, %d:%d",
retx.sn,
retx.is_segment ? "true" : "false",
@ -979,8 +980,7 @@ void rlc_am_nr_tx::get_buffer_state(uint32_t& n_bytes_new, uint32_t& n_bytes_pri
int req_bytes = retx.segment_length;
int hdr_req_bytes = (retx.is_segment && retx.current_so != 0) ? max_hdr_size : min_hdr_size;
if (req_bytes <= 0) {
RlcError("in get_buffer_state(): Removing retx with SN=%d from queue", retx.sn);
retx_queue->pop();
RlcError("buffer state - retx - invalid length=%d for SN=%d", req_bytes, retx.sn);
} else {
n_bytes_prio += (req_bytes + hdr_req_bytes);
RlcDebug("buffer state - retx: %d bytes", n_bytes_prio);

View File

@ -1367,8 +1367,7 @@ int segment_retx_and_loose_segments_test(rlc_am_nr_sn_size_t sn_size)
rlc1.write_pdu(status_buf.msg, status_buf.N_bytes);
// Check there are two Retx segments (a first one and a continued one)
TESTASSERT_EQ(pdu_size_first, rlc1.get_buffer_state()); // Fixme: get_buffer_state()
// TESTASSERT_EQ(pdu_size_first + pdu_size_continued, rlc1.get_buffer_state()); // Should be this
TESTASSERT_EQ(pdu_size_first + pdu_size_continued, rlc1.get_buffer_state());
}
{
@ -1656,8 +1655,7 @@ int retx_segment_test(rlc_am_nr_sn_size_t sn_size)
rlc1.write_pdu(status_buf.msg, status_buf.N_bytes);
// Check there are 3 Retx segments (a first one and two continued ones)
TESTASSERT_EQ(pdu_size_first, rlc1.get_buffer_state()); // Fixme: get_buffer_state()
// TESTASSERT_EQ(pdu_size_first + 2 * pdu_size_continued, rlc1.get_buffer_state()); // Should be this
TESTASSERT_EQ(pdu_size_first + 2 * pdu_size_continued, rlc1.get_buffer_state());
}
{