Starting to add boiler-plate code to support Discard at RLC.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 7ccc7d1d20
commit a77dd4e959

@ -287,7 +287,8 @@ public:
/* PDCP calls RLC to push an RLC SDU. SDU gets placed into the RLC buffer and MAC pulls /* PDCP calls RLC to push an RLC SDU. SDU gets placed into the RLC buffer and MAC pulls
* RLC PDUs according to TB size. */ * RLC PDUs according to TB size. */
virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = true) = 0; virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = true) = 0;
virtual bool rb_is_um(uint32_t lcid) = 0; virtual void discard_sdu(uint32_t discard_sn) = 0;
virtual bool rb_is_um(uint32_t lcid) = 0;
}; };
//RLC interface for MAC //RLC interface for MAC

@ -134,7 +134,7 @@ public:
private: private:
pdcp_entity_nr* parent; pdcp_entity_nr* parent;
uint32_t sn; uint32_t discard_sn;
}; };
/* /*

@ -80,6 +80,7 @@ public:
// PDCP interface // PDCP interface
void write_sdu(unique_byte_buffer_t sdu, bool blocking = true); void write_sdu(unique_byte_buffer_t sdu, bool blocking = true);
void discard_sdu(uint32_t pdcp_sn);
// MAC interface // MAC interface
bool has_data(); bool has_data();
@ -106,7 +107,8 @@ private:
void stop(); void stop();
void write_sdu(unique_byte_buffer_t sdu, bool blocking); void write_sdu(unique_byte_buffer_t sdu, bool blocking);
int read_pdu(uint8_t *payload, uint32_t nof_bytes); int read_pdu(uint8_t* payload, uint32_t nof_bytes);
void discard_sdu(uint32_t discard_sn);
bool has_data(); bool has_data();
uint32_t get_buffer_state(); uint32_t get_buffer_state();

@ -256,6 +256,7 @@ public:
// PDCP interface // PDCP interface
virtual void write_sdu(unique_byte_buffer_t sdu, bool blocking) = 0; virtual void write_sdu(unique_byte_buffer_t sdu, bool blocking) = 0;
virtual void discard_sdu(uint32_t discard_sn) = 0;
// MAC interface // MAC interface
virtual bool has_data() = 0; virtual bool has_data() = 0;

@ -54,6 +54,7 @@ public:
// PDCP interface // PDCP interface
void write_sdu(unique_byte_buffer_t sdu, bool blocking); void write_sdu(unique_byte_buffer_t sdu, bool blocking);
void discard_sdu(uint32_t discard_sn);
// MAC interface // MAC interface
bool has_data(); bool has_data();

@ -54,6 +54,7 @@ public:
// PDCP interface // PDCP interface
void write_sdu(unique_byte_buffer_t sdu, bool blocking = true); void write_sdu(unique_byte_buffer_t sdu, bool blocking = true);
void discard_sdu(uint32_t discard_sn);
// MAC interface // MAC interface
bool has_data(); bool has_data();
@ -78,6 +79,7 @@ protected:
void reestablish(); void reestablish();
void empty_queue(); void empty_queue();
void write_sdu(unique_byte_buffer_t sdu); void write_sdu(unique_byte_buffer_t sdu);
void discard_sdu(uint32_t discard_sn);
void try_write_sdu(unique_byte_buffer_t sdu); void try_write_sdu(unique_byte_buffer_t sdu);
void reset_metrics(); void reset_metrics();
bool has_data(); bool has_data();

@ -122,6 +122,11 @@ void rlc_am_lte::write_sdu(unique_byte_buffer_t sdu, bool blocking)
tx.write_sdu(std::move(sdu), blocking); tx.write_sdu(std::move(sdu), blocking);
} }
void rlc_am_lte::discard_sdu(uint32_t discard_sn)
{
tx.discard_sdu(discard_sn);
}
/**************************************************************************** /****************************************************************************
* MAC interface * MAC interface
***************************************************************************/ ***************************************************************************/
@ -337,8 +342,8 @@ void rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu, bool blockin
tx_sdu_queue.write(std::move(sdu)); tx_sdu_queue.write(std::move(sdu));
} else { } else {
// non-blocking write // non-blocking write
uint8_t* msg_ptr = sdu->msg; uint8_t* msg_ptr = sdu->msg;
uint32_t nof_bytes = sdu->N_bytes; uint32_t nof_bytes = sdu->N_bytes;
std::pair<bool, unique_byte_buffer_t> ret = tx_sdu_queue.try_write(std::move(sdu)); std::pair<bool, unique_byte_buffer_t> ret = tx_sdu_queue.try_write(std::move(sdu));
if (ret.first) { if (ret.first) {
log->info_hex( log->info_hex(
@ -358,6 +363,14 @@ void rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu, bool blockin
} }
} }
void rlc_am_lte::rlc_am_lte_tx::discard_sdu(uint32_t discard_sn)
{
if (!tx_enabled) {
return;
}
log->warning("Discard SDU not implemented yet\n");
}
int rlc_am_lte::rlc_am_lte_tx::read_pdu(uint8_t* payload, uint32_t nof_bytes) int rlc_am_lte::rlc_am_lte_tx::read_pdu(uint8_t* payload, uint32_t nof_bytes)
{ {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);

@ -115,6 +115,14 @@ void rlc_tm::write_sdu(unique_byte_buffer_t sdu, bool blocking)
} }
} }
void rlc_tm::discard_sdu(uint32_t discard_sn)
{
if (!tx_enabled) {
return;
}
log->warning("SDU discard not implemented on RLC TM\n");
}
// MAC interface // MAC interface
bool rlc_tm::has_data() bool rlc_tm::has_data()
{ {

@ -104,6 +104,15 @@ void rlc_um_base::write_sdu(unique_byte_buffer_t sdu, bool blocking)
} }
} }
void rlc_um_base::discard_sdu(uint32_t discard_sn)
{
if (not tx_enabled || not tx) {
log->debug("%s is currently deactivated. Ignoring SDU discard(SN %" PRIu32 ")\n", rb_name.c_str(), discard_sn);
metrics.num_dropped_sdus++;
return;
}
tx->discard_sdu(discard_sn);
}
/**************************************************************************** /****************************************************************************
* MAC interface * MAC interface
***************************************************************************/ ***************************************************************************/

@ -66,6 +66,7 @@ private:
srsenb::rlc_interface_pdcp* rlc; srsenb::rlc_interface_pdcp* rlc;
// rlc_interface_pdcp // rlc_interface_pdcp
void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking); void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking);
void discard_sdu(uint32_t discard_sn);
bool rb_is_um(uint32_t lcid); bool rb_is_um(uint32_t lcid);
}; };

Loading…
Cancel
Save