Added check for consequetive KOs in MAC. Change set_activity_user to pass activity and max KOs to RRC and trigger RLF timeout.

master
Pedro Alvarez 4 years ago
parent 968c261bec
commit 8194b5ec73

@ -18,9 +18,10 @@
*******************************************************************************/ *******************************************************************************/
#include <chrono> #include <chrono>
#include <cstring>
#include <memory> #include <memory>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string>
#include <sys/time.h> #include <sys/time.h>
/******************************************************************************* /*******************************************************************************

@ -23,6 +23,7 @@ struct mac_args_t {
sched_interface::sched_args_t sched; sched_interface::sched_args_t sched;
int nr_tb_size = -1; int nr_tb_size = -1;
uint32_t max_nof_ues; uint32_t max_nof_ues;
uint32_t max_nof_kos;
}; };
/* Interface PHY -> MAC */ /* Interface PHY -> MAC */

@ -73,7 +73,7 @@ public:
/* Radio Link failure */ /* Radio Link failure */
virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0; virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0;
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0; virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0; virtual void set_activity_user(uint16_t rnti, bool ack_info) = 0;
virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0; virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0;
///< Provide packed SIB to MAC (buffer is managed by RRC) ///< Provide packed SIB to MAC (buffer is managed by RRC)

@ -324,6 +324,7 @@ enable = false
#pregenerate_signals = false #pregenerate_signals = false
#tx_amplitude = 0.6 #tx_amplitude = 0.6
#rrc_inactivity_timer = 30000 #rrc_inactivity_timer = 30000
#max_nof_kos = 256
#max_prach_offset_us = 30 #max_prach_offset_us = 30
#eea_pref_list = EEA0, EEA2, EEA1 #eea_pref_list = EEA0, EEA2, EEA1
#eia_pref_list = EIA2, EIA1, EIA0 #eia_pref_list = EIA2, EIA1, EIA0

@ -139,7 +139,7 @@ public:
generate_mch_pdu(uint32_t harq_pid, sched_interface::dl_pdu_mch_t sched, uint32_t nof_pdu_elems, uint32_t grant_size); generate_mch_pdu(uint32_t harq_pid, sched_interface::dl_pdu_mch_t sched, uint32_t nof_pdu_elems, uint32_t grant_size);
srsran_softbuffer_tx_t* srsran_softbuffer_tx_t*
get_tx_softbuffer(const uint32_t ue_cc_idx, const uint32_t harq_process, const uint32_t tb_idx); get_tx_softbuffer(const uint32_t ue_cc_idx, const uint32_t harq_process, const uint32_t tb_idx);
srsran_softbuffer_rx_t* get_rx_softbuffer(const uint32_t ue_cc_idx, const uint32_t tti); srsran_softbuffer_rx_t* get_rx_softbuffer(const uint32_t ue_cc_idx, const uint32_t tti);
bool process_pdus(); bool process_pdus();
@ -160,6 +160,8 @@ public:
int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_bytes) final; int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_bytes) final;
uint32_t ko_counter = 0;
private: private:
void allocate_sdu(srsran::sch_pdu* pdu, uint32_t lcid, uint32_t sdu_len); void allocate_sdu(srsran::sch_pdu* pdu, uint32_t lcid, uint32_t sdu_len);
bool process_ce(srsran::sch_subh* subh); bool process_ce(srsran::sch_subh* subh);

@ -67,7 +67,7 @@ public:
// rrc_interface_mac // rrc_interface_mac
int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) override; int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) override;
void upd_user(uint16_t new_rnti, uint16_t old_rnti) override; void upd_user(uint16_t new_rnti, uint16_t old_rnti) override;
void set_activity_user(uint16_t rnti) override; void set_activity_user(uint16_t rnti, bool ack_info) override;
bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) override; bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) override;
uint8_t* read_pdu_bcch_dlsch(const uint8_t cc_idx, const uint32_t sib_index) override; uint8_t* read_pdu_bcch_dlsch(const uint8_t cc_idx, const uint32_t sib_index) override;

@ -214,6 +214,7 @@ void parse_args(all_args_t* args, int argc, char* argv[])
("expert.eea_pref_list", bpo::value<string>(&args->general.eea_pref_list)->default_value("EEA0, EEA2, EEA1"), "Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1).") ("expert.eea_pref_list", bpo::value<string>(&args->general.eea_pref_list)->default_value("EEA0, EEA2, EEA1"), "Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1).")
("expert.eia_pref_list", bpo::value<string>(&args->general.eia_pref_list)->default_value("EIA2, EIA1, EIA0"), "Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0).") ("expert.eia_pref_list", bpo::value<string>(&args->general.eia_pref_list)->default_value("EIA2, EIA1, EIA0"), "Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0).")
("expert.max_nof_ues", bpo::value<uint32_t>(&args->stack.mac.max_nof_ues)->default_value(64), "Maximum number of connected UEs") ("expert.max_nof_ues", bpo::value<uint32_t>(&args->stack.mac.max_nof_ues)->default_value(64), "Maximum number of connected UEs")
("expert.max_nof_kos", bpo::value<uint32_t>(&args->stack.mac.max_nof_kos)->default_value(254), "Maximum number of consecutive KOs before triggering the UE's release")
// eMBMS section // eMBMS section
("embms.enable", bpo::value<bool>(&args->stack.embms.enable)->default_value(false), "Enables MBMS in the eNB") ("embms.enable", bpo::value<bool>(&args->stack.embms.enable)->default_value(false), "Enables MBMS in the eNB")

@ -292,10 +292,17 @@ int mac::ack_info(uint32_t tti_rx, uint16_t rnti, uint32_t enb_cc_idx, uint32_t
ue_db[rnti]->metrics_tx(ack, nof_bytes); ue_db[rnti]->metrics_tx(ack, nof_bytes);
if (ack) { if (ack) {
ue_db[rnti]->ko_counter = 0;
if (nof_bytes > 64) { // do not count RLC status messages only if (nof_bytes > 64) { // do not count RLC status messages only
rrc_h->set_activity_user(rnti); rrc_h->set_activity_user(rnti, true);
logger.info("DL activity rnti=0x%x, n_bytes=%d", rnti, nof_bytes); logger.info("DL activity rnti=0x%x, n_bytes=%d", rnti, nof_bytes);
} }
} else {
ue_db[rnti]->ko_counter++;
if (ue_db[rnti]->ko_counter > args.max_nof_kos) {
rrc_h->set_activity_user(rnti, false);
logger.info("DL max KOs reached rnti=0x%x, n_bytes=%d", rnti, nof_bytes);
}
} }
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
@ -830,9 +837,9 @@ int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res
int requested_bytes = (mcs_data.tbs / 8 > (int)mch.mtch_sched[mtch_index].lcid_buffer_size) int requested_bytes = (mcs_data.tbs / 8 > (int)mch.mtch_sched[mtch_index].lcid_buffer_size)
? (mch.mtch_sched[mtch_index].lcid_buffer_size) ? (mch.mtch_sched[mtch_index].lcid_buffer_size)
: ((mcs_data.tbs / 8) - 2); : ((mcs_data.tbs / 8) - 2);
int bytes_received = ue_db[SRSRAN_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes); int bytes_received = ue_db[SRSRAN_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes);
mch.pdu[0].lcid = current_lcid; mch.pdu[0].lcid = current_lcid;
mch.pdu[0].nbytes = bytes_received; mch.pdu[0].nbytes = bytes_received;
mch.mtch_sched[0].mtch_payload = mtch_payload_buffer; mch.mtch_sched[0].mtch_payload = mtch_payload_buffer;
dl_sched_res->pdsch[0].dci.rnti = SRSRAN_MRNTI; dl_sched_res->pdsch[0].dci.rnti = SRSRAN_MRNTI;
if (bytes_received) { if (bytes_received) {

@ -373,7 +373,7 @@ void ue::process_pdu(uint8_t* pdu, uint32_t nof_bytes, srsran::pdu_queue::channe
// Indicate RRC about successful activity if valid RLC message is received // Indicate RRC about successful activity if valid RLC message is received
if (mac_msg_ul.get()->get_payload_size() > 64) { // do not count RLC status messages only if (mac_msg_ul.get()->get_payload_size() > 64) { // do not count RLC status messages only
rrc->set_activity_user(rnti); rrc->set_activity_user(rnti, true);
logger.debug("UL activity rnti=0x%x, n_bytes=%d", rnti, nof_bytes); logger.debug("UL activity rnti=0x%x, n_bytes=%d", rnti, nof_bytes);
} }
@ -423,10 +423,8 @@ void ue::deallocate_pdu(uint32_t tti, uint32_t ue_cc_idx)
{ {
std::unique_lock<std::mutex> lock(rx_buffers_mutex); std::unique_lock<std::mutex> lock(rx_buffers_mutex);
if (not cc_buffers[ue_cc_idx].get_rx_used_buffers().try_deallocate_pdu(tti_point(tti))) { if (not cc_buffers[ue_cc_idx].get_rx_used_buffers().try_deallocate_pdu(tti_point(tti))) {
logger.warning("UE buffers: Null RX PDU pointer in deallocate_pdu for rnti=0x%x tti=%d cc_idx=%d", logger.warning(
rnti, "UE buffers: Null RX PDU pointer in deallocate_pdu for rnti=0x%x tti=%d cc_idx=%d", rnti, tti, ue_cc_idx);
tti,
ue_cc_idx);
} }
} }
@ -434,8 +432,7 @@ void ue::push_pdu(uint32_t tti, uint32_t ue_cc_idx, uint32_t len)
{ {
std::unique_lock<std::mutex> lock(rx_buffers_mutex); std::unique_lock<std::mutex> lock(rx_buffers_mutex);
if (not cc_buffers[ue_cc_idx].get_rx_used_buffers().push_pdu(tti_point(tti), len)) { if (not cc_buffers[ue_cc_idx].get_rx_used_buffers().push_pdu(tti_point(tti), len)) {
logger.warning( logger.warning("UE buffers: Failed to push RX PDU for rnti=0x%x tti=%d cc_idx=%d", rnti, tti, ue_cc_idx);
"UE buffers: Failed to push RX PDU for rnti=0x%x tti=%d cc_idx=%d", rnti, tti, ue_cc_idx);
} }
} }

@ -131,9 +131,15 @@ uint8_t* rrc::read_pdu_bcch_dlsch(const uint8_t cc_idx, const uint32_t sib_index
return nullptr; return nullptr;
} }
void rrc::set_activity_user(uint16_t rnti) void rrc::set_activity_user(uint16_t rnti, bool ack_info)
{ {
rrc_pdu p = {rnti, LCID_ACT_USER, nullptr}; rrc_pdu p;
if (ack_info) {
p = {rnti, LCID_ACT_USER, nullptr};
} else {
p = {rnti, LCID_RTX_USER, nullptr};
}
if (not rx_pdu_queue.try_push(std::move(p))) { if (not rx_pdu_queue.try_push(std::move(p))) {
logger.error("Failed to push UE activity command to RRC queue"); logger.error("Failed to push UE activity command to RRC queue");
} }

@ -103,7 +103,6 @@ void rrc::ue::set_activity()
{ {
// re-start activity timer with current timeout value // re-start activity timer with current timeout value
activity_timer.run(); activity_timer.run();
if (parent) { if (parent) {
parent->logger.debug("Activity registered for rnti=0x%x (timeout_value=%dms)", rnti, activity_timer.duration()); parent->logger.debug("Activity registered for rnti=0x%x (timeout_value=%dms)", rnti, activity_timer.duration());
} }

@ -34,7 +34,7 @@ struct rrc_dummy : public rrc_interface_mac {
public: public:
int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) { return SRSRAN_SUCCESS; } int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) { return SRSRAN_SUCCESS; }
void upd_user(uint16_t new_rnti, uint16_t old_rnti) {} void upd_user(uint16_t new_rnti, uint16_t old_rnti) {}
void set_activity_user(uint16_t rnti) {} void set_activity_user(uint16_t rnti, bool ack_info) {}
bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) { return false; } bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) { return false; }
uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) { return nullptr; } uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) { return nullptr; }
}; };

Loading…
Cancel
Save