RLC UM release timer at stop()

master
Ismael Gomez 7 years ago
parent 3c845b3653
commit 5359c42b46

@ -72,6 +72,7 @@ public:
* timer_id must be lower than MAC_NOF_UPPER_TIMERS * 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; virtual uint32_t get_unique_id() = 0;
}; };

@ -145,7 +145,7 @@ public:
} }
uint32_t get_unique_id() { uint32_t get_unique_id() {
if (nof_used_timers >= nof_timers) { 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; return 0;
} else { } else {
while(used_timers[next_timer]) { while(used_timers[next_timer]) {

@ -78,6 +78,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 reset(); void reset();
void stop();
void empty_queue(); void empty_queue();
rlc_mode_t get_mode(); rlc_mode_t get_mode();

@ -158,6 +158,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 reset() = 0; virtual void reset() = 0;
virtual void stop() = 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;

@ -56,6 +56,7 @@ public:
void configure(srslte_rlc_config_t cnfg); void configure(srslte_rlc_config_t cnfg);
void reset(); void reset();
void stop();
void empty_queue(); void empty_queue();
bool active(); bool active();

@ -48,6 +48,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 reset(); void reset();
void stop();
void empty_queue(); void empty_queue();
rlc_mode_t get_mode(); rlc_mode_t get_mode();

@ -58,6 +58,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 reset(); void reset();
void stop();
void empty_queue(); void empty_queue();
rlc_mode_t get_mode(); rlc_mode_t get_mode();

@ -65,7 +65,10 @@ void rlc::reset_metrics()
void rlc::stop() 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) 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() void rlc_am::reset()
{ {
// Empty tx_sdu_queue before locking the mutex // Empty tx_sdu_queue before locking the mutex

@ -76,6 +76,11 @@ void rlc_entity::reset()
rlc = NULL; rlc = NULL;
} }
void rlc_entity::stop()
{
rlc->stop();
rlc = NULL;
}
void rlc_entity::empty_queue() void rlc_entity::empty_queue()
{ {

@ -66,6 +66,11 @@ void rlc_tm::reset()
empty_queue(); empty_queue();
} }
void rlc_tm::stop()
{
reset();
}
rlc_mode_t rlc_tm::get_mode() rlc_mode_t rlc_tm::get_mode()
{ {
return RLC_MODE_TM; 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() void rlc_um::reset()
{ {

@ -43,6 +43,7 @@ public:
return &t; return &t;
} }
uint32_t get_unique_id(){return 0;} uint32_t get_unique_id(){return 0;}
void free(uint32_t id){}
private: private:
srslte::timers::timer t; srslte::timers::timer t;

@ -47,7 +47,7 @@ public:
{ {
t.step(); t.step();
} }
void free(uint32_t timer_id) {}
private: private:
srslte::timers::timer t; srslte::timers::timer t;
}; };

@ -106,24 +106,14 @@ public:
void timer_expired(uint32_t timer_id); void timer_expired(uint32_t timer_id);
srslte::timers::timer* get(uint32_t timer_id); srslte::timers::timer* get(uint32_t timer_id);
void free(uint32_t timer_id);
u_int32_t get_unique_id(); u_int32_t get_unique_id();
const static int NOF_MAC_TIMERS = 20;
uint32_t get_current_tti(); uint32_t get_current_tti();
void get_metrics(mac_metrics_t metrics[ENB_METRICS_MAX_USERS]); 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: private:
void log_step_ul(uint32_t tti); void log_step_ul(uint32_t tti);
@ -194,11 +184,12 @@ private:
/* Class to run upper-layer timers with normal priority */ /* Class to run upper-layer timers with normal priority */
class upper_timers : public thread { class upper_timers : public thread {
public: 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 tti_clock();
void stop(); void stop();
void reset(); void reset();
srslte::timers::timer* get(uint32_t timer_id); srslte::timers::timer* get(uint32_t timer_id);
void free(uint32_t timer_id);
uint32_t get_unique_id(); uint32_t get_unique_id();
private: private:
void run_thread(); void run_thread();

@ -124,6 +124,11 @@ uint32_t mac::get_unique_id()
return upper_timers_thread.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 */ /* Front-end to upper-layer timers */
srslte::timers::timer* mac::get(uint32_t timer_id) srslte::timers::timer* mac::get(uint32_t timer_id)
{ {
@ -658,9 +663,20 @@ void mac::upper_timers::run_thread()
timers_db.step_all(); 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) 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() uint32_t mac::upper_timers::get_unique_id()

@ -95,6 +95,7 @@ public:
void start_pcap(srslte::mac_pcap* pcap); void start_pcap(srslte::mac_pcap* pcap);
srslte::timers::timer* get(uint32_t timer_id); srslte::timers::timer* get(uint32_t timer_id);
void free(uint32_t timer_id);
u_int32_t get_unique_id(); u_int32_t get_unique_id();
uint32_t get_current_tti(); uint32_t get_current_tti();
@ -164,6 +165,7 @@ private:
public: public:
upper_timers(); upper_timers();
void reset(); void reset();
void free(uint32_t timer_id);
srslte::timers::timer* get(uint32_t timer_id); srslte::timers::timer* get(uint32_t timer_id);
uint32_t get_unique_id(); uint32_t get_unique_id();
private: private:

@ -425,8 +425,13 @@ srslte::timers::timer* mac::get(uint32_t timer_id)
return upper_timers_thread.get(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", 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, metrics.rx_pkts?((float) 100*metrics.rx_errors/metrics.rx_pkts):0.0,
@ -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 * Class that runs a thread to process DL MAC PDUs from
* DEMUX unit * DEMUX unit

Loading…
Cancel
Save