extend PDCP interface to allow non-blocking write of SDUs

master
Andre Puschmann 7 years ago
parent 2b86272c5e
commit b8438e9cc3

@ -228,7 +228,7 @@ public:
class pdcp_interface_gw
{
public:
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu, bool blocking) = 0;
virtual bool is_drb_enabled(uint32_t lcid) = 0;
};
@ -238,7 +238,7 @@ class pdcp_interface_rrc
public:
virtual void reestablish() = 0;
virtual void reset() = 0;
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu, bool blocking = true) = 0;
virtual void add_bearer(uint32_t lcid, srslte::srslte_pdcp_config_t cnfg = srslte::srslte_pdcp_config_t()) = 0;
virtual void config_security(uint32_t lcid,
uint8_t *k_enc_,
@ -282,7 +282,7 @@ class rlc_interface_pdcp
public:
/* PDCP calls RLC to push an RLC SDU. SDU gets placed into the RLC buffer and MAC pulls
* RLC PDUs according to TB size. */
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu, bool blocking = true) = 0;
virtual bool rb_is_um(uint32_t lcid) = 0;
};

@ -56,7 +56,7 @@ public:
// RRC interface
void reestablish();
void reset();
void write_sdu(uint32_t lcid, byte_buffer_t *sdu);
void write_sdu(uint32_t lcid, byte_buffer_t *sdu, bool blocking = true);
void write_sdu_mch(uint32_t lcid, byte_buffer_t *sdu);
void add_bearer(uint32_t lcid, srslte_pdcp_config_t cnfg = srslte_pdcp_config_t());
void add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_t cnfg = srslte_pdcp_config_t());

@ -76,7 +76,7 @@ public:
bool is_active();
// RRC interface
void write_sdu(byte_buffer_t *sdu);
void write_sdu(byte_buffer_t *sdu, bool blocking);
void config_security(uint8_t *k_enc_,
uint8_t *k_int_,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,

@ -55,7 +55,7 @@ public:
virtual bool is_active() = 0;
// RRC interface
virtual void write_sdu(byte_buffer_t *sdu) = 0;
virtual void write_sdu(byte_buffer_t *sdu, bool blocking) = 0;
virtual void config_security(uint8_t *k_enc_,
uint8_t *k_int_,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,

@ -63,8 +63,7 @@ public:
void get_metrics(rlc_metrics_t &m);
// PDCP interface
void write_sdu(uint32_t lcid, byte_buffer_t *sdu);
void write_sdu_nb(uint32_t lcid, byte_buffer_t *sdu);
void write_sdu(uint32_t lcid, byte_buffer_t *sdu, bool blocking = true);
void write_sdu_mch(uint32_t lcid, byte_buffer_t *sdu);
bool rb_is_um(uint32_t lcid);

@ -115,11 +115,11 @@ bool pdcp::is_drb_enabled(uint32_t lcid)
return ret;
}
void pdcp::write_sdu(uint32_t lcid, byte_buffer_t *sdu)
void pdcp::write_sdu(uint32_t lcid, byte_buffer_t *sdu, bool blocking)
{
pthread_rwlock_rdlock(&rwlock);
if (valid_lcid(lcid)) {
pdcp_array.at(lcid)->write_sdu(sdu);
pdcp_array.at(lcid)->write_sdu(sdu, blocking);
} else {
pdcp_log->warning("Writing sdu: lcid=%d. Deallocating sdu\n", lcid);
byte_buffer_pool::get_instance()->deallocate(sdu);
@ -131,7 +131,7 @@ void pdcp::write_sdu_mch(uint32_t lcid, byte_buffer_t *sdu)
{
pthread_rwlock_rdlock(&rwlock);
if (valid_mch_lcid(lcid)){
pdcp_array_mrb.at(lcid)->write_sdu(sdu);
pdcp_array_mrb.at(lcid)->write_sdu(sdu, true);
}
pthread_rwlock_unlock(&rwlock);
}
@ -141,13 +141,14 @@ void pdcp::add_bearer(uint32_t lcid, srslte_pdcp_config_t cfg)
if (not valid_lcid(lcid)) {
if (not pdcp_array.insert(pdcp_map_pair_t(lcid, new pdcp_entity())).second) {
pdcp_log->error("Error inserting PDCP entity in to array\n.");
return;
goto unlock_and_exit;
}
pdcp_array.at(lcid)->init(rlc, rrc, gw, pdcp_log, lcid, cfg);
pdcp_log->info("Added bearer %s\n", rrc->get_rb_name(lcid).c_str());
} else {
pdcp_log->warning("Bearer %s already configured. Reconfiguration not supported\n", rrc->get_rb_name(lcid).c_str());
}
unlock_and_exit:
pthread_rwlock_unlock(&rwlock);
}
@ -158,13 +159,14 @@ void pdcp::add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_t cfg)
if (not valid_mch_lcid(lcid)) {
if (not pdcp_array_mrb.insert(pdcp_map_pair_t(lcid, new pdcp_entity())).second) {
pdcp_log->error("Error inserting PDCP entity in to array\n.");
return;
goto unlock_and_exit;
}
pdcp_array_mrb.at(lcid)->init(rlc, rrc, gw, pdcp_log, lcid, cfg);
pdcp_log->info("Added bearer %s\n", rrc->get_rb_name(lcid).c_str());
} else {
pdcp_log->warning("Bearer %s already configured. Reconfiguration not supported\n", rrc->get_rb_name(lcid).c_str());
}
unlock_and_exit:
pthread_rwlock_unlock(&rwlock);
}

@ -108,8 +108,8 @@ bool pdcp_entity::is_active()
return active;
}
// RRC interface
void pdcp_entity::write_sdu(byte_buffer_t *sdu)
// GW/RRC interface
void pdcp_entity::write_sdu(byte_buffer_t *sdu, bool blocking)
{
log->info_hex(sdu->msg, sdu->N_bytes,
"TX %s SDU, SN: %d, do_integrity = %s, do_encryption = %s",
@ -141,7 +141,7 @@ void pdcp_entity::write_sdu(byte_buffer_t *sdu)
}
tx_count++;
rlc->write_sdu(lcid, sdu);
rlc->write_sdu(lcid, sdu, blocking);
}
void pdcp_entity::config_security(uint8_t *k_enc_,

@ -165,12 +165,15 @@ void rlc::reestablish()
void rlc::reset()
{
pthread_rwlock_wrlock(&rwlock);
for (rlc_map_t::iterator it = rlc_array.begin(); it != rlc_array.end(); ++it) {
it->second->stop();
delete(it->second);
}
rlc_array.clear();
for (rlc_map_t::iterator it = rlc_array_mrb.begin(); it != rlc_array_mrb.end(); ++it) {
it->second->stop();
delete(it->second);
}
rlc_array_mrb.clear();
@ -195,24 +198,15 @@ void rlc::empty_queue()
PDCP interface
*******************************************************************************/
void rlc::write_sdu(uint32_t lcid, byte_buffer_t *sdu)
void rlc::write_sdu(uint32_t lcid, byte_buffer_t *sdu, bool blocking)
{
pthread_rwlock_rdlock(&rwlock);
if (valid_lcid(lcid)) {
rlc_array.at(lcid)->write_sdu(sdu);
} else {
rlc_log->warning("Writing SDU: lcid=%d. Deallocating sdu\n", lcid);
byte_buffer_pool::get_instance()->deallocate(sdu);
}
pthread_rwlock_unlock(&rwlock);
}
void rlc::write_sdu_nb(uint32_t lcid, byte_buffer_t *sdu)
{
pthread_rwlock_rdlock(&rwlock);
if (valid_lcid(lcid)) {
rlc_array.at(lcid)->write_sdu_nb(sdu);
if (blocking) {
rlc_array.at(lcid)->write_sdu(sdu);
} else {
rlc_array.at(lcid)->write_sdu_nb(sdu);
}
} else {
rlc_log->warning("Writing SDU: lcid=%d. Deallocating sdu\n", lcid);
byte_buffer_pool::get_instance()->deallocate(sdu);
@ -220,7 +214,6 @@ void rlc::write_sdu_nb(uint32_t lcid, byte_buffer_t *sdu)
pthread_rwlock_unlock(&rwlock);
}
void rlc::write_sdu_mch(uint32_t lcid, byte_buffer_t *sdu)
{
pthread_rwlock_rdlock(&rwlock);
@ -429,7 +422,7 @@ void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
break;
default:
rlc_log->error("Cannot add RLC entity - invalid mode\n");
return;
goto unlock_and_exit;
}
if (rlc_entity) {

@ -105,11 +105,13 @@ bool rlc_am::configure(srslte_rlc_config_t cfg_)
void rlc_am::empty_queue() {
// Drop all messages in TX SDU queue
pthread_mutex_lock(&mutex);
byte_buffer_t *buf;
while(tx_sdu_queue.try_read(&buf)) {
pool->deallocate(buf);
}
tx_sdu_queue.reset();
pthread_mutex_unlock(&mutex);
}
void rlc_am::reestablish() {

Loading…
Cancel
Save