Continue to add discard_sdu to RLC interfaces.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent ca7c865ce8
commit 2e7ddef038

@ -179,6 +179,7 @@ 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(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0; virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0;
virtual void discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t sn) = 0;
virtual bool rb_is_um(uint16_t rnti, uint32_t lcid) = 0; virtual bool rb_is_um(uint16_t rnti, uint32_t lcid) = 0;
}; };
@ -299,7 +300,8 @@ public:
LIBLTE_S1AP_RRC_ESTABLISHMENT_CAUSE_ENUM cause, LIBLTE_S1AP_RRC_ESTABLISHMENT_CAUSE_ENUM cause,
srslte::unique_byte_buffer_t pdu, srslte::unique_byte_buffer_t pdu,
uint32_t m_tmsi, uint32_t m_tmsi,
uint8_t mmec) = 0; uint8_t mmec) = 0;
virtual void write_pdu(uint16_t rnti, srslte::unique_byte_buffer_t pdu) = 0; virtual void write_pdu(uint16_t rnti, srslte::unique_byte_buffer_t pdu) = 0;
virtual bool user_exists(uint16_t rnti) = 0; virtual bool user_exists(uint16_t rnti) = 0;
virtual bool user_release(uint16_t rnti, LIBLTE_S1AP_CAUSERADIONETWORK_ENUM cause_radio) = 0; virtual bool user_release(uint16_t rnti, LIBLTE_S1AP_CAUSERADIONETWORK_ENUM cause_radio) = 0;

@ -287,7 +287,7 @@ 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 void discard_sdu(uint32_t discard_sn) = 0; virtual void discard_sdu(uint32_t lcid, uint32_t discard_sn) = 0;
virtual bool rb_is_um(uint32_t lcid) = 0; virtual bool rb_is_um(uint32_t lcid) = 0;
}; };

@ -37,10 +37,7 @@ namespace srslte {
* Single interface for RLC layer - contains separate RLC entities for * Single interface for RLC layer - contains separate RLC entities for
* each bearer. * each bearer.
***************************************************************************/ ***************************************************************************/
class rlc class rlc : public srsue::rlc_interface_mac, public srsue::rlc_interface_pdcp, public srsue::rlc_interface_rrc
:public srsue::rlc_interface_mac
,public srsue::rlc_interface_pdcp
,public srsue::rlc_interface_rrc
{ {
public: public:
rlc(log* rlc_log_); rlc(log* rlc_log_);
@ -57,6 +54,7 @@ public:
void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu, bool blocking = true); void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu, bool blocking = true);
void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu); void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu);
bool rb_is_um(uint32_t lcid); bool rb_is_um(uint32_t lcid);
void discard_sdu(uint32_t lcid, uint32_t discard_sn);
// MAC interface // MAC interface
bool has_data(const uint32_t lcid); bool has_data(const uint32_t lcid);

@ -248,11 +248,11 @@ public:
} }
} }
virtual rlc_mode_t get_mode() = 0; virtual rlc_mode_t get_mode() = 0;
virtual uint32_t get_bearer() = 0; virtual uint32_t get_bearer() = 0;
virtual rlc_bearer_metrics_t get_metrics() = 0; virtual rlc_bearer_metrics_t get_metrics() = 0;
virtual void reset_metrics() = 0; virtual void reset_metrics() = 0;
// 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;

@ -366,7 +366,7 @@ void pdcp_entity_nr::discard_callback::operator()(uint32_t timer_id)
parent->log->debug("Discard timer expired for PDU with SN = %d\n", discard_sn); parent->log->debug("Discard timer expired for PDU with SN = %d\n", discard_sn);
// Notify the RLC of the discard. It's the RLC to actually discard, if no segment was transmitted yet. // Notify the RLC of the discard. It's the RLC to actually discard, if no segment was transmitted yet.
parent->rlc->discard_sdu(discard_sn); parent->rlc->discard_sdu(parent->lcid, discard_sn);
return; return;
} }

@ -235,6 +235,17 @@ bool rlc::rb_is_um(uint32_t lcid)
return ret; return ret;
} }
void rlc::discard_sdu(uint32_t lcid, uint32_t discard_sn)
{
pthread_rwlock_rdlock(&rwlock);
if (valid_lcid(lcid)) {
rlc_array.at(lcid)->discard_sdu(discard_sn);
} else {
rlc_log->warning("RLC LCID %d doesn't exist. Ignoring discard SDU\n", lcid);
}
pthread_rwlock_unlock(&rwlock);
}
/******************************************************************************* /*******************************************************************************
MAC interface MAC interface
*******************************************************************************/ *******************************************************************************/

@ -270,6 +270,11 @@ void rlc_um_base::rlc_um_base_tx::try_write_sdu(unique_byte_buffer_t sdu)
} }
} }
void rlc_um_base::rlc_um_base_tx::discard_sdu(uint32_t discard_sn)
{
log->warning("RLC UM: Discard SDU not implemented yet.\n");
}
int rlc_um_base::rlc_um_base_tx::build_data_pdu(uint8_t* payload, uint32_t nof_bytes) int rlc_um_base::rlc_um_base_tx::build_data_pdu(uint8_t* payload, uint32_t nof_bytes)
{ {
unique_byte_buffer_t pdu; unique_byte_buffer_t pdu;

@ -86,8 +86,14 @@ public:
last_pdcp_pdu.swap(sdu); last_pdcp_pdu.swap(sdu);
rx_count++; rx_count++;
} }
void discard_sdu(uint32_t lcid, uint32_t discard_sn)
{
log->info("Notifing RLC to discard SDU (SN=%" PRIu32 ")\n", discard_sn);
discard_count++;
}
uint64_t rx_count = 0; uint64_t rx_count = 0;
uint64_t discard_count = 0;
private: private:
srslte::log* log; srslte::log* log;

@ -66,7 +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); void discard_sdu(uint32_t lcid, uint32_t discard_sn);
bool rb_is_um(uint32_t lcid); bool rb_is_um(uint32_t lcid);
}; };

@ -56,9 +56,10 @@ public:
// rlc_interface_pdcp // rlc_interface_pdcp
void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu); void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu);
bool rb_is_um(uint16_t rnti, uint32_t lcid); void discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t discard_sn);
bool rb_is_um(uint16_t rnti, uint32_t lcid);
std::string get_rb_name(uint32_t lcid); std::string get_rb_name(uint32_t lcid);
// rlc_interface_mac // rlc_interface_mac
int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t *payload, uint32_t nof_bytes); int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t *payload, uint32_t nof_bytes);
void read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t *payload); void read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t *payload);

@ -170,6 +170,11 @@ void pdcp::user_interface_rlc::write_sdu(uint32_t lcid, srslte::unique_byte_buff
rlc->write_sdu(rnti, lcid, std::move(sdu)); rlc->write_sdu(rnti, lcid, std::move(sdu));
} }
void pdcp::user_interface_rlc::discard_sdu(uint32_t lcid, uint32_t discard_sn)
{
rlc->discard_sdu(lcid, discard_sn);
}
bool pdcp::user_interface_rlc::rb_is_um(uint32_t lcid) bool pdcp::user_interface_rlc::rb_is_um(uint32_t lcid)
{ {
return rlc->rb_is_um(rnti, lcid); return rlc->rb_is_um(rnti, lcid);

@ -198,6 +198,26 @@ void rlc::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t s
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
} }
void rlc::discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t discard_sn)
{
uint32_t tx_queue;
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) {
users[rnti].rlc->discard_sdu(lcid, discard_sn);
tx_queue = users[rnti].rlc->get_buffer_state(lcid);
}
// In the eNodeB, there is no polling for buffer state from the scheduler, thus
// communicate buffer state every time a new SDU is discarded
uint32_t retx_queue = 0;
mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
log_h->info("Buffer state: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue);
}
pthread_rwlock_unlock(&rwlock);
}
bool rlc::rb_is_um(uint16_t rnti, uint32_t lcid) { bool rlc::rb_is_um(uint16_t rnti, uint32_t lcid) {
bool ret = false; bool ret = false;
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);

@ -852,6 +852,8 @@ public:
ue->new_tb(dl_grant, (const uint8_t*)mac_pdu_ptr); ue->new_tb(dl_grant, (const uint8_t*)mac_pdu_ptr);
} }
void discard_sdu(uint32_t lcid, uint32_t sn) {}
bool rb_is_um(uint32_t lcid) { return false; } bool rb_is_um(uint32_t lcid) { return false; }
int set_as_security(const uint32_t lcid, int set_as_security(const uint32_t lcid,

Loading…
Cancel
Save