mirror of https://github.com/PentHertz/srsLTE.git
RLC UM release timer at stop()
This commit is contained in:
parent
3c845b3653
commit
5359c42b46
|
@ -71,7 +71,8 @@ public:
|
|||
/* Timer services with ms resolution.
|
||||
* timer_id must be lower than MAC_NOF_UPPER_TIMERS
|
||||
*/
|
||||
virtual timers::timer* get(uint32_t timer_id) = 0;
|
||||
virtual timers::timer* get(uint32_t timer_id) = 0;
|
||||
virtual void free(uint32_t timer_id) = 0;
|
||||
virtual uint32_t get_unique_id() = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public:
|
|||
}
|
||||
uint32_t get_unique_id() {
|
||||
if (nof_used_timers >= nof_timers) {
|
||||
fprintf(stderr, "Error getting uinque timer id: no more timers available\n");
|
||||
fprintf(stderr, "Error getting unique timer id: no more timers available\n");
|
||||
return 0;
|
||||
} else {
|
||||
while(used_timers[next_timer]) {
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
mac_interface_timers *mac_timers);
|
||||
void configure(srslte_rlc_config_t cnfg);
|
||||
void reset();
|
||||
void stop();
|
||||
void empty_queue();
|
||||
|
||||
rlc_mode_t get_mode();
|
||||
|
|
|
@ -158,6 +158,7 @@ public:
|
|||
srslte::mac_interface_timers *mac_timers_) = 0;
|
||||
virtual void configure(srslte_rlc_config_t cnfg) = 0;
|
||||
virtual void reset() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void empty_queue() = 0;
|
||||
|
||||
virtual rlc_mode_t get_mode() = 0;
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
|
||||
void configure(srslte_rlc_config_t cnfg);
|
||||
void reset();
|
||||
void stop();
|
||||
void empty_queue();
|
||||
bool active();
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
mac_interface_timers *mac_timers);
|
||||
void configure(srslte_rlc_config_t cnfg);
|
||||
void reset();
|
||||
void stop();
|
||||
void empty_queue();
|
||||
|
||||
rlc_mode_t get_mode();
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
mac_interface_timers *mac_timers_);
|
||||
void configure(srslte_rlc_config_t cnfg);
|
||||
void reset();
|
||||
void stop();
|
||||
void empty_queue();
|
||||
|
||||
rlc_mode_t get_mode();
|
||||
|
|
|
@ -65,7 +65,10 @@ void rlc::reset_metrics()
|
|||
|
||||
void rlc::stop()
|
||||
{
|
||||
reset();
|
||||
for(uint32_t i=0; i<SRSLTE_N_RADIO_BEARERS; i++) {
|
||||
if(rlc_array[i].active())
|
||||
rlc_array[i].stop();
|
||||
}
|
||||
}
|
||||
|
||||
void rlc::get_metrics(rlc_metrics_t &m)
|
||||
|
|
|
@ -93,6 +93,12 @@ void rlc_am::empty_queue() {
|
|||
}
|
||||
}
|
||||
|
||||
void rlc_am::stop()
|
||||
{
|
||||
reset();
|
||||
pthread_mutex_destroy(&mutex);
|
||||
}
|
||||
|
||||
void rlc_am::reset()
|
||||
{
|
||||
// Empty tx_sdu_queue before locking the mutex
|
||||
|
|
|
@ -76,6 +76,11 @@ void rlc_entity::reset()
|
|||
rlc = NULL;
|
||||
}
|
||||
|
||||
void rlc_entity::stop()
|
||||
{
|
||||
rlc->stop();
|
||||
rlc = NULL;
|
||||
}
|
||||
|
||||
void rlc_entity::empty_queue()
|
||||
{
|
||||
|
|
|
@ -66,6 +66,11 @@ void rlc_tm::reset()
|
|||
empty_queue();
|
||||
}
|
||||
|
||||
void rlc_tm::stop()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
rlc_mode_t rlc_tm::get_mode()
|
||||
{
|
||||
return RLC_MODE_TM;
|
||||
|
|
|
@ -102,6 +102,12 @@ void rlc_um::empty_queue() {
|
|||
}
|
||||
}
|
||||
|
||||
void rlc_um::stop()
|
||||
{
|
||||
reset();
|
||||
mac_timers->free(reordering_timeout_id);
|
||||
}
|
||||
|
||||
void rlc_um::reset()
|
||||
{
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
return &t;
|
||||
}
|
||||
uint32_t get_unique_id(){return 0;}
|
||||
void free(uint32_t id){}
|
||||
|
||||
private:
|
||||
srslte::timers::timer t;
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
{
|
||||
t.step();
|
||||
}
|
||||
|
||||
void free(uint32_t timer_id) {}
|
||||
private:
|
||||
srslte::timers::timer t;
|
||||
};
|
||||
|
|
|
@ -106,24 +106,14 @@ public:
|
|||
void timer_expired(uint32_t timer_id);
|
||||
|
||||
srslte::timers::timer* get(uint32_t timer_id);
|
||||
void free(uint32_t timer_id);
|
||||
u_int32_t get_unique_id();
|
||||
|
||||
|
||||
const static int NOF_MAC_TIMERS = 20;
|
||||
|
||||
uint32_t get_current_tti();
|
||||
void get_metrics(mac_metrics_t metrics[ENB_METRICS_MAX_USERS]);
|
||||
|
||||
enum {
|
||||
HARQ_RTT,
|
||||
TIME_ALIGNMENT,
|
||||
CONTENTION_TIMER,
|
||||
BSR_TIMER_PERIODIC,
|
||||
BSR_TIMER_RETX,
|
||||
PHR_TIMER_PERIODIC,
|
||||
PHR_TIMER_PROHIBIT,
|
||||
NOF_MAC_TIMERS
|
||||
} mac_timers_t;
|
||||
|
||||
static const int MAC_NOF_UPPER_TIMERS = 20;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void log_step_ul(uint32_t tti);
|
||||
|
@ -194,12 +184,13 @@ private:
|
|||
/* Class to run upper-layer timers with normal priority */
|
||||
class upper_timers : public thread {
|
||||
public:
|
||||
upper_timers() : timers_db(MAC_NOF_UPPER_TIMERS),ttisync(10240) {start();}
|
||||
upper_timers() : timers_db(NOF_MAC_TIMERS),ttisync(10240) {start();}
|
||||
void tti_clock();
|
||||
void stop();
|
||||
void reset();
|
||||
srslte::timers::timer* get(uint32_t timer_id);
|
||||
uint32_t get_unique_id();
|
||||
void free(uint32_t timer_id);
|
||||
uint32_t get_unique_id();
|
||||
private:
|
||||
void run_thread();
|
||||
srslte::timers timers_db;
|
||||
|
|
|
@ -124,6 +124,11 @@ uint32_t mac::get_unique_id()
|
|||
return upper_timers_thread.get_unique_id();
|
||||
}
|
||||
|
||||
void mac::free(uint32_t timer_id)
|
||||
{
|
||||
upper_timers_thread.free(timer_id);
|
||||
}
|
||||
|
||||
/* Front-end to upper-layer timers */
|
||||
srslte::timers::timer* mac::get(uint32_t timer_id)
|
||||
{
|
||||
|
@ -658,9 +663,20 @@ void mac::upper_timers::run_thread()
|
|||
timers_db.step_all();
|
||||
}
|
||||
}
|
||||
|
||||
void mac::upper_timers::free(uint32_t timer_id)
|
||||
{
|
||||
timers_db.release_id(timer_id);
|
||||
}
|
||||
|
||||
srslte::timers::timer* mac::upper_timers::get(uint32_t timer_id)
|
||||
{
|
||||
return timers_db.get(timer_id%MAC_NOF_UPPER_TIMERS);
|
||||
if (timer_id < NOF_MAC_TIMERS) {
|
||||
return timers_db.get(timer_id);
|
||||
} else {
|
||||
fprintf(stderr, "Error requested invalid timer id=%d\n", timer_id);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t mac::upper_timers::get_unique_id()
|
||||
|
|
|
@ -93,14 +93,15 @@ public:
|
|||
|
||||
void timer_expired(uint32_t timer_id);
|
||||
void start_pcap(srslte::mac_pcap* pcap);
|
||||
|
||||
|
||||
srslte::timers::timer* get(uint32_t timer_id);
|
||||
void free(uint32_t timer_id);
|
||||
u_int32_t get_unique_id();
|
||||
|
||||
|
||||
uint32_t get_current_tti();
|
||||
|
||||
static const int MAC_NOF_UPPER_TIMERS = 20;
|
||||
|
||||
static const int MAC_NOF_UPPER_TIMERS = 20;
|
||||
|
||||
private:
|
||||
void run_thread();
|
||||
|
||||
|
@ -161,16 +162,17 @@ private:
|
|||
|
||||
/* Class to run upper-layer timers with normal priority */
|
||||
class upper_timers : public periodic_thread {
|
||||
public:
|
||||
public:
|
||||
upper_timers();
|
||||
void reset();
|
||||
void free(uint32_t timer_id);
|
||||
srslte::timers::timer* get(uint32_t timer_id);
|
||||
uint32_t get_unique_id();
|
||||
private:
|
||||
void run_period();
|
||||
srslte::timers timers_db;
|
||||
};
|
||||
upper_timers upper_timers_thread;
|
||||
upper_timers upper_timers_thread;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ void mac::stop()
|
|||
|
||||
void mac::start_pcap(srslte::mac_pcap* pcap_)
|
||||
{
|
||||
pcap = pcap_;
|
||||
pcap = pcap_;
|
||||
dl_harq.start_pcap(pcap);
|
||||
ul_harq.start_pcap(pcap);
|
||||
ra_procedure.start_pcap(pcap);
|
||||
|
@ -113,28 +113,28 @@ void mac::reconfiguration()
|
|||
void mac::reset()
|
||||
{
|
||||
bzero(&metrics, sizeof(mac_metrics_t));
|
||||
|
||||
|
||||
Info("Resetting MAC\n");
|
||||
|
||||
|
||||
timers_db.stop_all();
|
||||
upper_timers_thread.reset();
|
||||
|
||||
|
||||
ul_harq.reset_ndi();
|
||||
|
||||
|
||||
mux_unit.msg3_flush();
|
||||
mux_unit.reset();
|
||||
|
||||
ra_procedure.reset();
|
||||
|
||||
ra_procedure.reset();
|
||||
sr_procedure.reset();
|
||||
bsr_procedure.reset();
|
||||
phr_procedure.reset();
|
||||
|
||||
|
||||
dl_harq.reset();
|
||||
phy_h->pdcch_dl_search_reset();
|
||||
phy_h->pdcch_ul_search_reset();
|
||||
|
||||
|
||||
is_first_ul_grant = true;
|
||||
|
||||
|
||||
bzero(&uernti, sizeof(ue_rnti_t));
|
||||
}
|
||||
|
||||
|
@ -158,13 +158,13 @@ void mac::run_thread() {
|
|||
|
||||
log_h->step(tti);
|
||||
timers_db.step_all();
|
||||
|
||||
// Step all procedures
|
||||
|
||||
// Step all procedures
|
||||
bsr_procedure.step(tti);
|
||||
phr_procedure.step(tti);
|
||||
|
||||
// Check if BSR procedure need to start SR
|
||||
|
||||
|
||||
// Check if BSR procedure need to start SR
|
||||
|
||||
if (bsr_procedure.need_to_send_sr(tti)) {
|
||||
Debug("Starting SR procedure by BSR request, PHY TTI=%d\n", tti);
|
||||
sr_procedure.start();
|
||||
|
@ -175,13 +175,13 @@ void mac::run_thread() {
|
|||
}
|
||||
sr_procedure.step(tti);
|
||||
|
||||
// Check SR if we need to start RA
|
||||
// Check SR if we need to start RA
|
||||
if (sr_procedure.need_random_access()) {
|
||||
ra_procedure.start_mac_order();
|
||||
}
|
||||
ra_procedure.step(tti);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mac::bcch_start_rx()
|
||||
|
@ -197,7 +197,7 @@ void mac::bcch_start_rx(int si_window_start, int si_window_length)
|
|||
} else {
|
||||
phy_h->pdcch_dl_search(SRSLTE_RNTI_SI, SRSLTE_SIRNTI, si_window_start);
|
||||
}
|
||||
Info("SCHED: Searching for DL grant for SI-RNTI window_st=%d, window_len=%d\n", si_window_start, si_window_length);
|
||||
Info("SCHED: Searching for DL grant for SI-RNTI window_st=%d, window_len=%d\n", si_window_start, si_window_length);
|
||||
}
|
||||
|
||||
void mac::bcch_stop_rx()
|
||||
|
@ -208,7 +208,7 @@ void mac::bcch_stop_rx()
|
|||
void mac::pcch_start_rx()
|
||||
{
|
||||
phy_h->pdcch_dl_search(SRSLTE_RNTI_PCH, SRSLTE_PRNTI);
|
||||
Info("SCHED: Searching for DL grant for P-RNTI\n");
|
||||
Info("SCHED: Searching for DL grant for P-RNTI\n");
|
||||
}
|
||||
|
||||
void mac::pcch_stop_rx()
|
||||
|
@ -224,9 +224,9 @@ void mac::tti_clock(uint32_t tti)
|
|||
|
||||
void mac::bch_decoded_ok(uint8_t* payload, uint32_t len)
|
||||
{
|
||||
// Send MIB to RLC
|
||||
// Send MIB to RLC
|
||||
rlc_h->write_pdu_bcch_bch(payload, len);
|
||||
|
||||
|
||||
if (pcap) {
|
||||
pcap->write_dl_bch(payload, len, true, phy_h->get_current_tti());
|
||||
}
|
||||
|
@ -234,9 +234,9 @@ void mac::bch_decoded_ok(uint8_t* payload, uint32_t len)
|
|||
|
||||
void mac::pch_decoded_ok(uint32_t len)
|
||||
{
|
||||
// Send PCH payload to RLC
|
||||
// Send PCH payload to RLC
|
||||
rlc_h->write_pdu_pcch(pch_payload_buffer, len);
|
||||
|
||||
|
||||
if (pcap) {
|
||||
pcap->write_dl_pch(pch_payload_buffer, len, true, phy_h->get_current_tti());
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ void mac::new_grant_dl(mac_interface_phy::mac_grant_t grant, mac_interface_phy::
|
|||
} else if (grant.rnti_type == SRSLTE_RNTI_PCH) {
|
||||
|
||||
memcpy(&action->phy_grant, &grant.phy_grant, sizeof(srslte_phy_grant_t));
|
||||
action->generate_ack = false;
|
||||
action->generate_ack = false;
|
||||
action->decode_enabled[0] = true;
|
||||
srslte_softbuffer_rx_reset_cb(&pch_softbuffer, 1);
|
||||
action->payload_ptr[0] = pch_payload_buffer;
|
||||
|
@ -281,7 +281,7 @@ void mac::new_grant_dl(mac_interface_phy::mac_grant_t grant, mac_interface_phy::
|
|||
} else {
|
||||
// If PDCCH for C-RNTI and RA procedure in Contention Resolution, notify it
|
||||
if (grant.rnti_type == SRSLTE_RNTI_USER && ra_procedure.is_contention_resolution()) {
|
||||
ra_procedure.pdcch_to_crnti(false);
|
||||
ra_procedure.pdcch_to_crnti(false);
|
||||
}
|
||||
dl_harq.new_grant_dl(grant, action);
|
||||
}
|
||||
|
@ -296,11 +296,11 @@ void mac::new_grant_ul(mac_interface_phy::mac_grant_t grant, mac_interface_phy::
|
|||
{
|
||||
/* Start PHR Periodic timer on first UL grant */
|
||||
if (is_first_ul_grant) {
|
||||
is_first_ul_grant = false;
|
||||
is_first_ul_grant = false;
|
||||
timers_db.get(PHR_TIMER_PERIODIC)->run();
|
||||
}
|
||||
if (grant.rnti_type == SRSLTE_RNTI_USER && ra_procedure.is_contention_resolution()) {
|
||||
ra_procedure.pdcch_to_crnti(true);
|
||||
ra_procedure.pdcch_to_crnti(true);
|
||||
}
|
||||
ul_harq.new_grant_ul(grant, action);
|
||||
metrics.tx_pkts++;
|
||||
|
@ -353,13 +353,13 @@ void mac::timer_expired(uint32_t timer_id)
|
|||
case TIME_ALIGNMENT:
|
||||
timeAlignmentTimerExpire();
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Function called on expiry of TimeAlignmentTimer */
|
||||
void mac::timeAlignmentTimerExpire()
|
||||
void mac::timeAlignmentTimerExpire()
|
||||
{
|
||||
printf("timeAlignmentTimer has expired value=%d ms\n", timers_db.get(TIME_ALIGNMENT)->get_timeout());
|
||||
rrc_h->release_pucch_srs();
|
||||
|
@ -374,7 +374,7 @@ void mac::get_rntis(ue_rnti_t* rntis)
|
|||
|
||||
void mac::set_contention_id(uint64_t uecri)
|
||||
{
|
||||
uernti.contention_id = uecri;
|
||||
uernti.contention_id = uecri;
|
||||
}
|
||||
|
||||
void mac::get_config(mac_cfg_t* mac_cfg)
|
||||
|
@ -407,7 +407,7 @@ void mac::set_config_sr(LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT* sr_cfg)
|
|||
|
||||
void mac::setup_lcid(uint32_t lcid, uint32_t lcg, uint32_t priority, int PBR_x_tti, uint32_t BSD)
|
||||
{
|
||||
Info("Logical Channel Setup: LCID=%d, LCG=%d, priority=%d, PBR=%d, BSd=%d\n",
|
||||
Info("Logical Channel Setup: LCID=%d, LCG=%d, priority=%d, PBR=%d, BSd=%d\n",
|
||||
lcid, lcg, priority, PBR_x_tti, BSD);
|
||||
mux_unit.set_priority(lcid, priority, PBR_x_tti, BSD);
|
||||
bsr_procedure.setup_lcg(lcid, lcg);
|
||||
|
@ -425,8 +425,13 @@ srslte::timers::timer* mac::get(uint32_t timer_id)
|
|||
return upper_timers_thread.get(timer_id);
|
||||
}
|
||||
|
||||
void mac::free(uint32_t timer_id)
|
||||
{
|
||||
upper_timers_thread.free(timer_id);
|
||||
}
|
||||
|
||||
void mac::get_metrics(mac_metrics_t &m)
|
||||
|
||||
void mac::get_metrics(mac_metrics_t &m)
|
||||
{
|
||||
Info("DL retx: %.2f \%%, perpkt: %.2f, UL retx: %.2f \%% perpkt: %.2f\n",
|
||||
metrics.rx_pkts?((float) 100*metrics.rx_errors/metrics.rx_pkts):0.0,
|
||||
|
@ -442,20 +447,20 @@ void mac::get_metrics(mac_metrics_t &m)
|
|||
|
||||
/********************************************************
|
||||
*
|
||||
* Class to run upper-layer timers with normal priority
|
||||
* Class to run upper-layer timers with normal priority
|
||||
*
|
||||
*******************************************************/
|
||||
|
||||
mac::upper_timers::upper_timers() : timers_db(MAC_NOF_UPPER_TIMERS)
|
||||
mac::upper_timers::upper_timers() : timers_db(MAC_NOF_UPPER_TIMERS)
|
||||
{
|
||||
start_periodic(1000, MAC_MAIN_THREAD_PRIO+1);
|
||||
start_periodic(1000, MAC_MAIN_THREAD_PRIO+1);
|
||||
}
|
||||
|
||||
void mac::upper_timers::run_period()
|
||||
{
|
||||
timers_db.step_all();
|
||||
}
|
||||
|
||||
|
||||
srslte::timers::timer* mac::upper_timers::get(uint32_t timer_id)
|
||||
{
|
||||
return timers_db.get(timer_id%MAC_NOF_UPPER_TIMERS);
|
||||
|
@ -472,9 +477,15 @@ void mac::upper_timers::reset()
|
|||
}
|
||||
|
||||
|
||||
void mac::upper_timers::free(uint32_t timer_id)
|
||||
{
|
||||
timers_db.release_id(timer_id);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************
|
||||
|
||||
|
||||
/********************************************************
|
||||
*
|
||||
* Class that runs a thread to process DL MAC PDUs from
|
||||
* DEMUX unit
|
||||
|
|
Loading…
Reference in New Issue