Merge branch 'tx_enabled_issue' into next

master
Ismael Gomez 7 years ago
commit 653d126319

@ -183,7 +183,7 @@ public:
} }
b->reset(); b->reset();
if (!pool->deallocate(b)) { if (!pool->deallocate(b)) {
fprintf(stderr, "Error deallocating PDU: Addr=0x%lx not found in pool\n", (uint64_t) b); printf("Error deallocating PDU: Addr=0x%lx not found in pool\n", (uint64_t) b);
} }
b = NULL; b = NULL;
} }

@ -163,6 +163,7 @@ public:
srslte::mac_interface_timers *mac_timers_) = 0; srslte::mac_interface_timers *mac_timers_) = 0;
virtual void configure(srslte_rlc_config_t cnfg) = 0; virtual void configure(srslte_rlc_config_t cnfg) = 0;
virtual void stop() = 0; virtual void stop() = 0;
virtual void reestablish() = 0;
virtual void empty_queue() = 0; virtual void empty_queue() = 0;
virtual rlc_mode_t get_mode() = 0; virtual rlc_mode_t get_mode() = 0;

@ -49,6 +49,7 @@ public:
mac_interface_timers *mac_timers); mac_interface_timers *mac_timers);
void configure(srslte_rlc_config_t cnfg); void configure(srslte_rlc_config_t cnfg);
void stop(); void stop();
void reestablish();
void empty_queue(); void empty_queue();
rlc_mode_t get_mode(); rlc_mode_t get_mode();

@ -57,6 +57,7 @@ public:
srsue::rrc_interface_rlc *rrc_, srsue::rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers_); mac_interface_timers *mac_timers_);
void configure(srslte_rlc_config_t cnfg); void configure(srslte_rlc_config_t cnfg);
void reestablish();
void stop(); void stop();
void empty_queue(); void empty_queue();
bool is_mrb(); bool is_mrb();

@ -130,11 +130,7 @@ void rlc::reestablish() {
// defaul lcid=0 is created // defaul lcid=0 is created
void rlc::reset() void rlc::reset()
{ {
for(uint32_t i=0; i<SRSLTE_N_RADIO_BEARERS; i++) { stop();
if(rlc_array[i].active())
rlc_array[i].stop();
}
rlc_array[0].init(RLC_MODE_TM, rlc_log, default_lcid, pdcp, rrc, mac_timers, buffer_size); // SRB0 rlc_array[0].init(RLC_MODE_TM, rlc_log, default_lcid, pdcp, rrc, mac_timers, buffer_size); // SRB0
} }

@ -104,6 +104,12 @@ void rlc_am::empty_queue() {
while(tx_sdu_queue.try_read(&buf)) { while(tx_sdu_queue.try_read(&buf)) {
pool->deallocate(buf); pool->deallocate(buf);
} }
tx_sdu_queue.reset();
}
void rlc_am::reestablish() {
stop();
tx_enabled = true;
} }
void rlc_am::stop() void rlc_am::stop()

@ -87,7 +87,7 @@ void rlc_entity::configure(srslte_rlc_config_t cnfg)
// Reestablishment stops the entity but does not destroy it. Mode will not change // Reestablishment stops the entity but does not destroy it. Mode will not change
void rlc_entity::reestablish() { void rlc_entity::reestablish() {
rlc->stop(); rlc->reestablish();
} }
// A call to stop() stops the entity and clears deletes the instance. Next time this entity can be used for other mode. // A call to stop() stops the entity and clears deletes the instance. Next time this entity can be used for other mode.

@ -68,6 +68,12 @@ void rlc_tm::empty_queue()
while(ul_queue.try_read(&buf)) { while(ul_queue.try_read(&buf)) {
pool->deallocate(buf); pool->deallocate(buf);
} }
ul_queue.reset();
}
void rlc_tm::reestablish() {
stop();
tx_enabled = true;
} }
void rlc_tm::stop() void rlc_tm::stop()

@ -122,6 +122,7 @@ void rlc_um::empty_queue() {
while(tx_sdu_queue.try_read(&buf)) { while(tx_sdu_queue.try_read(&buf)) {
pool->deallocate(buf); pool->deallocate(buf);
} }
tx_sdu_queue.reset();
} }
bool rlc_um::is_mrb() bool rlc_um::is_mrb()
@ -129,6 +130,11 @@ bool rlc_um::is_mrb()
return cfg.is_mrb; return cfg.is_mrb;
} }
void rlc_um::reestablish() {
stop();
tx_enabled = true;
}
void rlc_um::stop() void rlc_um::stop()
{ {
// Empty tx_sdu_queue before locking the mutex // Empty tx_sdu_queue before locking the mutex

@ -152,6 +152,8 @@ private:
srslte::log *log_h; srslte::log *log_h;
rrc_interface_mac *rrc; rrc_interface_mac *rrc;
pthread_rwlock_t rwlock;
cell_cfg_t cfg; cell_cfg_t cfg;
sched_args_t sched_cfg; sched_args_t sched_cfg;

@ -205,6 +205,20 @@ bool enb::init(all_args_t *args_)
fprintf(stderr, "Error parsing DRB configuration\n"); fprintf(stderr, "Error parsing DRB configuration\n");
return false; return false;
} }
uint32_t prach_freq_offset = rrc_cfg.sibs[1].sib.sib2.rr_config_common_sib.prach_cnfg.prach_cnfg_info.prach_freq_offset;
if (prach_freq_offset + 6 > cell_cfg.nof_prb) {
fprintf(stderr, "Invalid PRACH configuration: frequency offset=%d outside bandwidth limits\n", prach_freq_offset);
return false;
}
if (prach_freq_offset < rrc_cfg.cqi_cfg.nof_prb || prach_freq_offset < rrc_cfg.sr_cfg.nof_prb ) {
fprintf(stderr, "Invalid PRACH configuration: frequency offset=%d lower than CQI offset: %d or SR offset: %d\n",
prach_freq_offset, rrc_cfg.cqi_cfg.nof_prb, rrc_cfg.sr_cfg.nof_prb);
return false;
}
rrc_cfg.inactivity_timeout_ms = args->expert.rrc_inactivity_timer; rrc_cfg.inactivity_timeout_ms = args->expert.rrc_inactivity_timer;
rrc_cfg.enable_mbsfn = args->expert.enable_mbsfn; rrc_cfg.enable_mbsfn = args->expert.enable_mbsfn;

@ -62,11 +62,16 @@ sched::sched() : bc_aggr_level(0), rar_aggr_level(0), avail_rbg(0), P(0), start_
bzero(rar_locations[i], sizeof(sched_ue::sched_dci_cce_t) * 10); bzero(rar_locations[i], sizeof(sched_ue::sched_dci_cce_t) * 10);
} }
reset(); reset();
pthread_rwlock_init(&rwlock, NULL);
} }
sched::~sched() sched::~sched()
{ {
srslte_regs_free(&regs); srslte_regs_free(&regs);
pthread_rwlock_wrlock(&rwlock);
pthread_rwlock_unlock(&rwlock);
pthread_rwlock_destroy(&rwlock);
} }
void sched::init(rrc_interface_mac *rrc_, srslte::log* log) void sched::init(rrc_interface_mac *rrc_, srslte::log* log)
@ -86,8 +91,10 @@ int sched::reset()
bzero(pending_msg3, sizeof(pending_msg3_t)*10); bzero(pending_msg3, sizeof(pending_msg3_t)*10);
bzero(pending_rar, sizeof(sched_rar_t)*SCHED_MAX_PENDING_RAR); bzero(pending_rar, sizeof(sched_rar_t)*SCHED_MAX_PENDING_RAR);
bzero(pending_sibs, sizeof(sched_sib_t)*MAX_SIBS); bzero(pending_sibs, sizeof(sched_sib_t)*MAX_SIBS);
ue_db.clear();
configured = false; configured = false;
pthread_rwlock_wrlock(&rwlock);
ue_db.clear();
pthread_rwlock_unlock(&rwlock);
return 0; return 0;
} }
@ -152,9 +159,11 @@ int sched::cell_cfg(sched_interface::cell_cfg_t* cell_cfg)
int sched::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t *ue_cfg) int sched::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t *ue_cfg)
{ {
// Add or config user // Add or config user
pthread_rwlock_rdlock(&rwlock);
ue_db[rnti].set_cfg(rnti, ue_cfg, &cfg, &regs, log_h); ue_db[rnti].set_cfg(rnti, ue_cfg, &cfg, &regs, log_h);
ue_db[rnti].set_max_mcs(sched_cfg.pusch_max_mcs, sched_cfg.pdsch_max_mcs); ue_db[rnti].set_max_mcs(sched_cfg.pusch_max_mcs, sched_cfg.pdsch_max_mcs);
ue_db[rnti].set_fixed_mcs(sched_cfg.pusch_mcs, sched_cfg.pdsch_mcs); ue_db[rnti].set_fixed_mcs(sched_cfg.pusch_mcs, sched_cfg.pdsch_mcs);
pthread_rwlock_unlock(&rwlock);
return 0; return 0;
} }
@ -162,167 +171,198 @@ int sched::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t *ue_cfg)
int sched::ue_rem(uint16_t rnti) int sched::ue_rem(uint16_t rnti)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_wrlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db.erase(rnti); ue_db.erase(rnti);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
bool sched::ue_exists(uint16_t rnti) bool sched::ue_exists(uint16_t rnti)
{ {
return (ue_db.count(rnti) == 1); pthread_rwlock_rdlock(&rwlock);
bool ret = (ue_db.count(rnti) == 1);
pthread_rwlock_unlock(&rwlock);
return ret;
} }
void sched::phy_config_enabled(uint16_t rnti, bool enabled) void sched::phy_config_enabled(uint16_t rnti, bool enabled)
{ {
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].phy_config_enabled(current_tti, enabled); ue_db[rnti].phy_config_enabled(current_tti, enabled);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
} }
pthread_rwlock_unlock(&rwlock);
} }
int sched::bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t *cfg) int sched::bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t *cfg)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_bearer_cfg(lc_id, cfg); ue_db[rnti].set_bearer_cfg(lc_id, cfg);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::bearer_ue_rem(uint16_t rnti, uint32_t lc_id) int sched::bearer_ue_rem(uint16_t rnti, uint32_t lc_id)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].rem_bearer(lc_id); ue_db[rnti].rem_bearer(lc_id);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
uint32_t sched::get_dl_buffer(uint16_t rnti) uint32_t sched::get_dl_buffer(uint16_t rnti)
{ {
uint32_t ret = 0; uint32_t ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ret = ue_db[rnti].get_pending_dl_new_data(current_tti); ret = ue_db[rnti].get_pending_dl_new_data(current_tti);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
uint32_t sched::get_ul_buffer(uint16_t rnti) uint32_t sched::get_ul_buffer(uint16_t rnti)
{ {
uint32_t ret = 0; uint32_t ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ret = ue_db[rnti].get_pending_ul_new_data(current_tti); ret = ue_db[rnti].get_pending_ul_new_data(current_tti);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::dl_rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) int sched::dl_rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].dl_buffer_state(lc_id, tx_queue, retx_queue); ue_db[rnti].dl_buffer_state(lc_id, tx_queue, retx_queue);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::dl_mac_buffer_state(uint16_t rnti, uint32_t ce_code) int sched::dl_mac_buffer_state(uint16_t rnti, uint32_t ce_code)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].mac_buffer_state(ce_code); ue_db[rnti].mac_buffer_state(ce_code);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::dl_ant_info(uint16_t rnti, LIBLTE_RRC_ANTENNA_INFO_DEDICATED_STRUCT *dl_ant_info) { int sched::dl_ant_info(uint16_t rnti, LIBLTE_RRC_ANTENNA_INFO_DEDICATED_STRUCT *dl_ant_info) {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_dl_ant_info(dl_ant_info); ue_db[rnti].set_dl_ant_info(dl_ant_info);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::dl_ack_info(uint32_t tti, uint16_t rnti, uint32_t tb_idx, bool ack) int sched::dl_ack_info(uint32_t tti, uint16_t rnti, uint32_t tb_idx, bool ack)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ret = ue_db[rnti].set_ack_info(tti, tb_idx, ack); ret = ue_db[rnti].set_ack_info(tti, tb_idx, ack);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::ul_crc_info(uint32_t tti, uint16_t rnti, bool crc) int sched::ul_crc_info(uint32_t tti, uint16_t rnti, bool crc)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_ul_crc(tti, crc); ue_db[rnti].set_ul_crc(tti, crc);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::dl_ri_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value) int sched::dl_ri_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_dl_ri(tti, cqi_value); ue_db[rnti].set_dl_ri(tti, cqi_value);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::dl_pmi_info(uint32_t tti, uint16_t rnti, uint32_t pmi_value) int sched::dl_pmi_info(uint32_t tti, uint16_t rnti, uint32_t pmi_value)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_dl_pmi(tti, pmi_value); ue_db[rnti].set_dl_pmi(tti, pmi_value);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::dl_cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value) int sched::dl_cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_dl_cqi(tti, cqi_value); ue_db[rnti].set_dl_cqi(tti, cqi_value);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
@ -345,79 +385,93 @@ int sched::dl_rach_info(uint32_t tti, uint32_t ra_id, uint16_t rnti, uint32_t es
int sched::ul_cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi, uint32_t ul_ch_code) int sched::ul_cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi, uint32_t ul_ch_code)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_ul_cqi(tti, cqi, ul_ch_code); ue_db[rnti].set_ul_cqi(tti, cqi, ul_ch_code);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::ul_bsr(uint16_t rnti, uint32_t lcid, uint32_t bsr, bool set_value) int sched::ul_bsr(uint16_t rnti, uint32_t lcid, uint32_t bsr, bool set_value)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].ul_buffer_state(lcid, bsr, set_value); ue_db[rnti].ul_buffer_state(lcid, bsr, set_value);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::ul_recv_len(uint16_t rnti, uint32_t lcid, uint32_t len) int sched::ul_recv_len(uint16_t rnti, uint32_t lcid, uint32_t len)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].ul_recv_len(lcid, len); ue_db[rnti].ul_recv_len(lcid, len);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::ul_phr(uint16_t rnti, int phr) int sched::ul_phr(uint16_t rnti, int phr)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].ul_phr(phr); ue_db[rnti].ul_phr(phr);
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
int sched::ul_sr_info(uint32_t tti, uint16_t rnti) int sched::ul_sr_info(uint32_t tti, uint16_t rnti)
{ {
int ret = 0; int ret = 0;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].set_sr();; ue_db[rnti].set_sr();;
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
ret = -1; ret = -1;
} }
pthread_rwlock_unlock(&rwlock);
return ret; return ret;
} }
void sched::tpc_inc(uint16_t rnti) void sched::tpc_inc(uint16_t rnti)
{ {
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].tpc_inc(); ue_db[rnti].tpc_inc();
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
} }
pthread_rwlock_unlock(&rwlock);
} }
void sched::tpc_dec(uint16_t rnti) void sched::tpc_dec(uint16_t rnti)
{ {
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) { if (ue_db.count(rnti)) {
ue_db[rnti].tpc_dec(); ue_db[rnti].tpc_dec();
} else { } else {
Error("User rnti=0x%x not found\n", rnti); Error("User rnti=0x%x not found\n", rnti);
} }
pthread_rwlock_unlock(&rwlock);
} }
/******************************************************* /*******************************************************
@ -714,6 +768,8 @@ int sched::dl_sched(uint32_t tti, sched_interface::dl_sched_res_t* sched_result)
rar_aggr_level = 2; rar_aggr_level = 2;
bzero(sched_result, sizeof(sched_interface::dl_sched_res_t)); bzero(sched_result, sizeof(sched_interface::dl_sched_res_t));
pthread_rwlock_rdlock(&rwlock);
/* Schedule Broadcast data */ /* Schedule Broadcast data */
sched_result->nof_bc_elems += dl_sched_bc(sched_result->bc); sched_result->nof_bc_elems += dl_sched_bc(sched_result->bc);
@ -723,6 +779,8 @@ int sched::dl_sched(uint32_t tti, sched_interface::dl_sched_res_t* sched_result)
/* Schedule pending RLC data */ /* Schedule pending RLC data */
sched_result->nof_data_elems += dl_sched_data(sched_result->data); sched_result->nof_data_elems += dl_sched_data(sched_result->data);
pthread_rwlock_unlock(&rwlock);
/* Set CFI */ /* Set CFI */
sched_result->cfi = current_cfi; sched_result->cfi = current_cfi;
@ -733,10 +791,16 @@ int sched::dl_sched(uint32_t tti, sched_interface::dl_sched_res_t* sched_result)
int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched_result) int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched_result)
{ {
typedef std::map<uint16_t, sched_ue>::iterator it_t; typedef std::map<uint16_t, sched_ue>::iterator it_t;
if (!configured) { if (!configured) {
return 0; return 0;
} }
if (cfg.prach_freq_offset + 6 > cfg.cell.nof_prb) {
fprintf(stderr, "Invalid PRACH configuration: frequency offset=%d outside bandwidth limits\n", cfg.prach_freq_offset);
return -1;
}
/* If dl_sched() not yet called this tti (this tti is +4ms advanced), reset CCE state */ /* If dl_sched() not yet called this tti (this tti is +4ms advanced), reset CCE state */
if (TTI_TX(current_tti) != tti) { if (TTI_TX(current_tti) != tti) {
bzero(used_cce, MAX_CCE*sizeof(bool)); bzero(used_cce, MAX_CCE*sizeof(bool));
@ -757,6 +821,8 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
bzero(sched_result, sizeof(sched_interface::ul_sched_res_t)); bzero(sched_result, sizeof(sched_interface::ul_sched_res_t));
ul_metric->reset_allocation(cfg.cell.nof_prb); ul_metric->reset_allocation(cfg.cell.nof_prb);
pthread_rwlock_rdlock(&rwlock);
// Get HARQ process for this TTI // Get HARQ process for this TTI
for(it_t iter=ue_db.begin(); iter!=ue_db.end(); ++iter) { for(it_t iter=ue_db.begin(); iter!=ue_db.end(); ++iter) {
sched_ue *user = (sched_ue*) &iter->second; sched_ue *user = (sched_ue*) &iter->second;
@ -819,10 +885,6 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
ul_harq_proc::ul_alloc_t prach = {cfg.prach_freq_offset, 6}; ul_harq_proc::ul_alloc_t prach = {cfg.prach_freq_offset, 6};
if(!ul_metric->update_allocation(prach)) { if(!ul_metric->update_allocation(prach)) {
log_h->warning("SCHED: Failed to allocate PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L); log_h->warning("SCHED: Failed to allocate PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L);
if (prach.RB_start + prach.L > cfg.cell.nof_prb) {
fprintf(stderr, "Invalid PRACH configuration: frequency offset=%d outside bandwidth limits\n", cfg.prach_freq_offset);
return -1;
}
} }
else { else {
log_h->debug("SCHED: Allocated PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L); log_h->debug("SCHED: Allocated PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L);
@ -931,6 +993,8 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
user->get_ul_harq(current_tti)->reset_pending_data(); user->get_ul_harq(current_tti)->reset_pending_data();
} }
pthread_rwlock_unlock(&rwlock);
sched_result->nof_dci_elems = nof_dci_elems; sched_result->nof_dci_elems = nof_dci_elems;
sched_result->nof_phich_elems = nof_phich_elems; sched_result->nof_phich_elems = nof_phich_elems;

@ -227,7 +227,7 @@ private:
if (grant->has_cqi_request && grant->phy_grant.ul.mcs.tbs == 0) { if (grant->has_cqi_request && grant->phy_grant.ul.mcs.tbs == 0) {
/* Only CQI reporting (without SCH) */ /* Only CQI reporting (without SCH) */
memcpy(&action->phy_grant.ul, &grant->phy_grant.ul, sizeof(srslte_ra_ul_grant_t)); memcpy(&action->phy_grant.ul, &grant->phy_grant.ul, sizeof(srslte_ra_ul_grant_t));
memcpy(&cur_grant, grant, sizeof(Tgrant)); //memcpy(&cur_grant, grant, sizeof(Tgrant));
action->tx_enabled = true; action->tx_enabled = true;
action->rnti = grant->rnti; action->rnti = grant->rnti;
} else if ((!(grant->rnti_type == SRSLTE_RNTI_TEMP) && grant->ndi[0] != get_ndi() && harq_feedback) || } else if ((!(grant->rnti_type == SRSLTE_RNTI_TEMP) && grant->ndi[0] != get_ndi() && harq_feedback) ||

@ -250,7 +250,6 @@ bool nas::rrc_connect() {
} }
} else { } else {
nas_log->error("Could not establish RRC connection\n"); nas_log->error("Could not establish RRC connection\n");
pool->deallocate(dedicatedInfoNAS);
} }
return false; return false;
} }

@ -526,6 +526,12 @@ bool rrc::connection_request(LIBLTE_RRC_CON_REQ_EST_CAUSE_ENUM cause,
} }
} }
if (!ret) {
rrc_log->warning("Could not estblish connection. Deallocating dedicatedInfoNAS PDU\n");
pool->deallocate(this->dedicatedInfoNAS);
this->dedicatedInfoNAS = NULL;
}
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
return ret; return ret;
} }

Loading…
Cancel
Save