Added function to get control pdu type to the PDCP base class. Shorten logger name in PDCP Status report test.

master
Pedro Alvarez 4 years ago
parent 90113419c2
commit f89b644902

@ -153,6 +153,7 @@ protected:
// Common packing functions // Common packing functions
bool is_control_pdu(const unique_byte_buffer_t& pdu); bool is_control_pdu(const unique_byte_buffer_t& pdu);
pdcp_pdu_type_t get_control_pdu_type(const unique_byte_buffer_t& pdu);
uint32_t read_data_header(const unique_byte_buffer_t& pdu); uint32_t read_data_header(const unique_byte_buffer_t& pdu);
void discard_data_header(const unique_byte_buffer_t& pdu); void discard_data_header(const unique_byte_buffer_t& pdu);
void write_data_header(const srslte::unique_byte_buffer_t& sdu, uint32_t count); void write_data_header(const srslte::unique_byte_buffer_t& sdu, uint32_t count);

@ -219,6 +219,11 @@ bool pdcp_entity_base::is_control_pdu(const unique_byte_buffer_t& pdu)
return ((*(payload) >> 7) & 0x01) == PDCP_DC_FIELD_CONTROL_PDU; return ((*(payload) >> 7) & 0x01) == PDCP_DC_FIELD_CONTROL_PDU;
} }
pdcp_pdu_type_t pdcp_entity_base::get_control_pdu_type(const unique_byte_buffer_t& pdu)
{
return pdcp_pdu_type_t((pdu->msg[0] >> 4U) & 0x03U);
}
uint32_t pdcp_entity_base::read_data_header(const unique_byte_buffer_t& pdu) uint32_t pdcp_entity_base::read_data_header(const unique_byte_buffer_t& pdu)
{ {
// Check PDU is long enough to extract header // Check PDU is long enough to extract header

@ -229,7 +229,7 @@ void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu)
// Handle control PDU // Handle control PDU
void pdcp_entity_lte::handle_control_pdu(unique_byte_buffer_t pdu) void pdcp_entity_lte::handle_control_pdu(unique_byte_buffer_t pdu)
{ {
switch ((pdu->msg[0] >> 4) & 0x03) { switch (get_control_pdu_type(pdu)) {
case PDCP_PDU_TYPE_STATUS_REPORT: case PDCP_PDU_TYPE_STATUS_REPORT:
handle_status_report_pdu(std::move(pdu)); handle_status_report_pdu(std::move(pdu));
break; break;
@ -393,7 +393,7 @@ void pdcp_entity_lte::handle_am_drb_pdu(srslte::unique_byte_buffer_t pdu)
// Section 5.3.1 transmit operation // Section 5.3.1 transmit operation
bool pdcp_entity_lte::send_status_report() bool pdcp_entity_lte::send_status_report()
{ {
// Check wether RCL AM is being used. // Check wether RLC AM is being used.
if (rlc->rb_is_um(lcid)) { if (rlc->rb_is_um(lcid)) {
logger.error("Trying to send PDCP Status Report and RLC is not AM"); logger.error("Trying to send PDCP Status Report and RLC is not AM");
return false; return false;
@ -407,10 +407,14 @@ bool pdcp_entity_lte::send_status_report()
fms = undelivered_sdus_queue.begin()->first; fms = undelivered_sdus_queue.begin()->first;
} }
logger.debug("PDCP Status report: FMS=%d", fms); logger.debug("Status report: FMS=%d", fms);
// Allocate Status Report PDU // Allocate Status Report PDU
unique_byte_buffer_t pdu = make_byte_buffer(); unique_byte_buffer_t pdu = make_byte_buffer();
if (pdu == nullptr) {
logger.error("Error allocating buffer for status report");
return false;
}
// Set control bit and type of PDU // Set control bit and type of PDU
pdu->msg[0] = ((uint8_t)PDCP_DC_FIELD_CONTROL_PDU << 7) | ((uint8_t)PDCP_PDU_TYPE_STATUS_REPORT << 4); pdu->msg[0] = ((uint8_t)PDCP_DC_FIELD_CONTROL_PDU << 7) | ((uint8_t)PDCP_PDU_TYPE_STATUS_REPORT << 4);

@ -171,7 +171,7 @@ int test_rx_status_report(const srslte::pdcp_lte_state_t& init_state, srslog::ba
int run_all_tests() int run_all_tests()
{ {
// Setup log // Setup log
srslog::basic_logger& logger = srslog::fetch_basic_logger("PDCP LTE Test Status Report", false); srslog::basic_logger& logger = srslog::fetch_basic_logger("PDCP", false);
logger.set_level(srslog::basic_levels::debug); logger.set_level(srslog::basic_levels::debug);
logger.set_hex_dump_max_size(128); logger.set_hex_dump_max_size(128);

Loading…
Cancel
Save