fix rlc_stress_test, stop RLC instances and remove hard thread canceling

master
Andre Puschmann 6 years ago
parent 1160dac54f
commit a20a8b18ad

@ -113,7 +113,6 @@ public:
fail_rate = fail_rate_; fail_rate = fail_rate_;
opp_sdu_ratio = opp_sdu_ratio_; opp_sdu_ratio = opp_sdu_ratio_;
run_enable = true; run_enable = true;
running = false;
pdu_tx_delay_usec = pdu_tx_delay_usec_; pdu_tx_delay_usec = pdu_tx_delay_usec_;
pcap = pcap_; pcap = pcap_;
is_dl = is_dl_; is_dl = is_dl_;
@ -123,21 +122,12 @@ public:
void stop() void stop()
{ {
run_enable = false; run_enable = false;
int cnt=0;
while(running && cnt<100) {
usleep(10000);
cnt++;
}
if(running) {
thread_cancel();
}
wait_thread_finish(); wait_thread_finish();
} }
private: private:
void run_thread() void run_thread()
{ {
running = true;
byte_buffer_t *pdu = byte_buffer_pool::get_instance()->allocate("mac_reader::run_thread"); byte_buffer_t *pdu = byte_buffer_pool::get_instance()->allocate("mac_reader::run_thread");
if (!pdu) { if (!pdu) {
printf("Fatal Error: Could not allocate PDU in mac_reader::run_thread\n"); printf("Fatal Error: Could not allocate PDU in mac_reader::run_thread\n");
@ -163,7 +153,6 @@ private:
} }
} }
} }
running = false;
byte_buffer_pool::get_instance()->deallocate(pdu); byte_buffer_pool::get_instance()->deallocate(pdu);
} }
@ -175,9 +164,7 @@ private:
rlc_pcap *pcap; rlc_pcap *pcap;
uint32_t lcid; uint32_t lcid;
bool is_dl; bool is_dl;
bool run_enable; bool run_enable;
bool running;
}; };
class mac_dummy class mac_dummy
@ -227,7 +214,6 @@ public:
rlc_tester(rlc_interface_pdcp *rlc_, std::string name_, uint32_t sdu_gen_delay_usec_, uint32_t lcid_){ rlc_tester(rlc_interface_pdcp *rlc_, std::string name_, uint32_t sdu_gen_delay_usec_, uint32_t lcid_){
rlc = rlc_; rlc = rlc_;
run_enable = true; run_enable = true;
running = false;
rx_pdus = 0; rx_pdus = 0;
name = name_; name = name_;
sdu_gen_delay_usec = sdu_gen_delay_usec_; sdu_gen_delay_usec = sdu_gen_delay_usec_;
@ -237,14 +223,6 @@ public:
void stop() void stop()
{ {
run_enable = false; run_enable = false;
int cnt=0;
while(running && cnt<100) {
usleep(10000);
cnt++;
}
if(running) {
thread_cancel();
}
wait_thread_finish(); wait_thread_finish();
} }
@ -275,7 +253,6 @@ private:
void run_thread() void run_thread()
{ {
uint8_t sn = 0; uint8_t sn = 0;
running = true;
while(run_enable) { while(run_enable) {
byte_buffer_t *pdu = byte_buffer_pool::get_instance()->allocate("rlc_tester::run_thread"); byte_buffer_t *pdu = byte_buffer_pool::get_instance()->allocate("rlc_tester::run_thread");
if (!pdu) { if (!pdu) {
@ -292,11 +269,9 @@ private:
rlc->write_sdu(lcid, pdu); rlc->write_sdu(lcid, pdu);
if (sdu_gen_delay_usec) usleep(sdu_gen_delay_usec); if (sdu_gen_delay_usec) usleep(sdu_gen_delay_usec);
} }
running = false;
} }
bool run_enable; bool run_enable;
bool running;
long rx_pdus; long rx_pdus;
uint32_t lcid; uint32_t lcid;
@ -381,6 +356,10 @@ void stress_test(stress_test_args_t args)
usleep(1e6); usleep(1e6);
} }
// Stop RLC instances first to release blocking writers
rlc1.stop();
rlc2.stop();
tester1.stop(); tester1.stop();
tester2.stop(); tester2.stop();
mac.stop(); mac.stop();

Loading…
Cancel
Save