rlc, nr: notify PDCP about fully acked SDUs

master
Robert Falkenberg 3 years ago
parent e6d976d115
commit 9b44d13471

@ -16,6 +16,7 @@
#include "srsran/common/buffer_pool.h"
#include "srsran/common/common.h"
#include "srsran/common/timers.h"
#include "srsran/interfaces/pdcp_interface_types.h"
#include "srsran/rlc/rlc_am_base.h"
#include "srsran/rlc/rlc_am_data_structs.h"
#include "srsran/rlc/rlc_am_nr_packing.h"
@ -72,7 +73,7 @@ struct rlc_am_nr_tx_state_t {
struct rlc_amd_tx_pdu_nr {
const uint32_t rlc_sn = INVALID_RLC_SN;
const uint32_t pdcp_sn = INVALID_RLC_SN;
uint32_t pdcp_sn = INVALID_RLC_SN;
rlc_am_nr_pdu_header_t header = {};
unique_byte_buffer_t sdu_buf = nullptr;
uint32_t retx_count = 0;
@ -152,6 +153,7 @@ private:
// Queues and buffers
pdu_retx_queue<RLC_AM_WINDOW_SIZE> 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;
// Helper constants
uint32_t min_hdr_size = 2;

@ -163,6 +163,7 @@ uint32_t rlc_am_nr_tx::build_new_pdu(uint8_t* payload, uint32_t nof_bytes)
// insert newly assigned SN into window and use reference for in-place operations
// NOTE: from now on, we can't return from this function anymore before increasing tx_next
rlc_amd_tx_pdu_nr& tx_pdu = tx_window.add_pdu(st.tx_next);
tx_pdu.pdcp_sn = tx_sdu->md.pdcp_sn;
tx_pdu.sdu_buf = srsran::make_byte_buffer();
if (tx_pdu.sdu_buf == nullptr) {
RlcError("Couldn't allocate PDU in %s().", __FUNCTION__);
@ -707,15 +708,21 @@ void rlc_am_nr_tx::handle_control_pdu(uint8_t* payload, uint32_t nof_bytes)
}
for (uint32_t sn = st.tx_next_ack; sn < stop_sn; sn++) {
if (tx_window.has_sn(sn)) {
notify_info_vec.push_back(tx_window[sn].pdcp_sn);
tx_window.remove_pdu(sn);
st.tx_next_ack = sn + 1;
// TODO notify PDCP
} else {
RlcError("Missing ACKed SN from TX window");
break;
}
}
// Notify PDCP
if (not notify_info_vec.empty()) {
parent->pdcp->notify_delivery(parent->lcid, notify_info_vec);
}
notify_info_vec.clear();
// Process N_acks
for (uint32_t nack_idx = 0; nack_idx < status.N_nack; nack_idx++) {
if (st.tx_next_ack <= status.nacks[nack_idx].nack_sn && status.nacks[nack_idx].nack_sn <= st.tx_next) {

@ -258,6 +258,14 @@ int basic_test()
TESTASSERT_EQ(5, st.tx_next_ack);
TESTASSERT_EQ(0, tx1->get_tx_window_size());
// Check PDCP notifications
TESTASSERT_EQ(5, tester.notified_counts.size());
for (uint16_t i = 0; i < tester.sdus.size(); i++) {
TESTASSERT_EQ(1, tester.sdus[i]->N_bytes);
TESTASSERT_EQ(i, *(tester.sdus[i]->msg));
TESTASSERT_EQ(1, tester.notified_counts[i]);
}
// Check statistics
rlc_bearer_metrics_t metrics1 = rlc1.get_metrics();
rlc_bearer_metrics_t metrics2 = rlc2.get_metrics();

Loading…
Cancel
Save