changed interface sync-stack to allow tti jumps > 1

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent fb967d17a2
commit d3f49d0e3c

@ -199,7 +199,6 @@ public:
plmn_search_completed(const rrc_interface_nas::found_plmn_t found_plmns[rrc_interface_nas::MAX_FOUND_PLMNS], plmn_search_completed(const rrc_interface_nas::found_plmn_t found_plmns[rrc_interface_nas::MAX_FOUND_PLMNS],
int nof_plmns) = 0; int nof_plmns) = 0;
virtual bool connection_request_completed(bool outcome) = 0; virtual bool connection_request_completed(bool outcome) = 0;
virtual void run_tti(uint32_t tti) = 0;
}; };
// NAS interface for UE // NAS interface for UE
@ -386,9 +385,6 @@ public:
/* Communicate the number of mbsfn services available */ /* Communicate the number of mbsfn services available */
virtual void set_mbsfn_config(uint32_t nof_mbsfn_services) = 0; virtual void set_mbsfn_config(uint32_t nof_mbsfn_services) = 0;
/* Indicate new TTI */
virtual void run_tti(const uint32_t tti) = 0;
}; };
/* Interface RRC -> MAC shared between different RATs */ /* Interface RRC -> MAC shared between different RATs */
@ -622,6 +618,9 @@ public:
// Combined interface for PHY to access stack (MAC and RRC) // Combined interface for PHY to access stack (MAC and RRC)
class stack_interface_phy_lte : public mac_interface_phy_lte, public rrc_interface_phy_lte class stack_interface_phy_lte : public mac_interface_phy_lte, public rrc_interface_phy_lte
{ {
public:
/* Indicate new TTI */
virtual void run_tti(const uint32_t tti, const uint32_t tti_jump) = 0;
}; };
// Combined interface for stack (MAC and RRC) to access PHY // Combined interface for stack (MAC and RRC) to access PHY

@ -325,7 +325,7 @@ public:
// MAC interface // MAC interface
void ho_ra_completed(bool ra_successful); void ho_ra_completed(bool ra_successful);
void release_pucch_srs(); void release_pucch_srs();
void run_tti(uint32_t tti); void run_tti();
void ra_problem(); void ra_problem();
// GW interface // GW interface

@ -45,7 +45,7 @@ public:
void init(rrc* rrc_ptr); void init(rrc* rrc_ptr);
void reset(); void reset();
bool parse_meas_config(const rrc_conn_recfg_r8_ies_s* meas_config, bool is_ho_reest = false, uint32_t src_earfcn = 0); bool parse_meas_config(const rrc_conn_recfg_r8_ies_s* meas_config, bool is_ho_reest = false, uint32_t src_earfcn = 0);
void run_tti(const uint32_t tti); void run_tti();
void update_phy(); void update_phy();
float rsrp_filter(const float new_value, const float avg_value); float rsrp_filter(const float new_value, const float avg_value);
float rsrq_filter(const float new_value, const float avg_value); float rsrq_filter(const float new_value, const float avg_value);

@ -68,12 +68,12 @@ public:
int init(const stack_args_t& args_, srslte::logger* logger_); int init(const stack_args_t& args_, srslte::logger* logger_);
int init(const stack_args_t& args_, srslte::logger* logger_, phy_interface_stack_lte* phy_, gw_interface_stack* gw_); int init(const stack_args_t& args_, srslte::logger* logger_, phy_interface_stack_lte* phy_, gw_interface_stack* gw_);
bool switch_on() final; bool switch_on() final;
bool switch_off(); bool switch_off() final;
bool enable_data(); bool enable_data();
bool disable_data(); bool disable_data();
void stop(); void stop() final;
bool get_metrics(stack_metrics_t* metrics); bool get_metrics(stack_metrics_t* metrics) final;
bool is_rrc_connected(); bool is_rrc_connected();
// RRC interface for PHY // RRC interface for PHY
@ -82,33 +82,36 @@ public:
void new_cell_meas(const std::vector<phy_meas_t>& meas) override { rrc.new_cell_meas(meas); } void new_cell_meas(const std::vector<phy_meas_t>& meas) override { rrc.new_cell_meas(meas); }
// MAC Interface for PHY // MAC Interface for PHY
uint16_t get_dl_sched_rnti(uint32_t tti) { return mac.get_dl_sched_rnti(tti); } uint16_t get_dl_sched_rnti(uint32_t tti) final { return mac.get_dl_sched_rnti(tti); }
uint16_t get_ul_sched_rnti(uint32_t tti) { return mac.get_ul_sched_rnti(tti); } uint16_t get_ul_sched_rnti(uint32_t tti) final { return mac.get_ul_sched_rnti(tti); }
void new_grant_ul(uint32_t cc_idx, mac_grant_ul_t grant, tb_action_ul_t* action) void new_grant_ul(uint32_t cc_idx, mac_grant_ul_t grant, tb_action_ul_t* action) final
{ {
mac.new_grant_ul(cc_idx, grant, action); mac.new_grant_ul(cc_idx, grant, action);
} }
void new_grant_dl(uint32_t cc_idx, mac_grant_dl_t grant, tb_action_dl_t* action) void new_grant_dl(uint32_t cc_idx, mac_grant_dl_t grant, tb_action_dl_t* action) final
{ {
mac.new_grant_dl(cc_idx, grant, action); mac.new_grant_dl(cc_idx, grant, action);
} }
void tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSLTE_MAX_CODEWORDS]) void tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSLTE_MAX_CODEWORDS]) final
{ {
mac.tb_decoded(cc_idx, grant, ack); mac.tb_decoded(cc_idx, grant, ack);
} }
void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len) { mac.bch_decoded_ok(cc_idx, payload, len); } void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len) final
{
mac.bch_decoded_ok(cc_idx, payload, len);
}
void mch_decoded(uint32_t len, bool crc) { mac.mch_decoded(len, crc); } void mch_decoded(uint32_t len, bool crc) final { mac.mch_decoded(len, crc); }
void new_mch_dl(srslte_pdsch_grant_t phy_grant, tb_action_dl_t* action) { mac.new_mch_dl(phy_grant, action); } void new_mch_dl(srslte_pdsch_grant_t phy_grant, tb_action_dl_t* action) final { mac.new_mch_dl(phy_grant, action); }
void set_mbsfn_config(uint32_t nof_mbsfn_services) { mac.set_mbsfn_config(nof_mbsfn_services); } void set_mbsfn_config(uint32_t nof_mbsfn_services) final { mac.set_mbsfn_config(nof_mbsfn_services); }
void run_tti(uint32_t tti) final; void run_tti(uint32_t tti, uint32_t tti_jump) final;
// Interface for GW // Interface for GW
void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking) final; void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking) final;
@ -129,7 +132,8 @@ public:
private: private:
void run_thread() final; void run_thread() final;
void run_tti_impl(uint32_t tti); void run_tti_impl(uint32_t tti, uint32_t tti_jump);
void calc_tti_stats(const uint32_t duration_us);;
void stop_impl(); void stop_impl();
const uint32_t TTI_STAT_PERIOD = 1024; const uint32_t TTI_STAT_PERIOD = 1024;

@ -43,7 +43,7 @@ public:
nas(srslte::timer_handler* timers_); nas(srslte::timer_handler* timers_);
void init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, const nas_args_t& args_); void init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, const nas_args_t& args_);
void stop(); void stop();
void run_tti(uint32_t tti) final; void run_tti();
void get_metrics(nas_metrics_t* m); void get_metrics(nas_metrics_t* m);
emm_state_t get_state(); emm_state_t get_state();

@ -883,12 +883,14 @@ int sync::radio_recv_fnc(srslte::rf_buffer_t& data, uint32_t nsamples, srslte_ti
srslte_timestamp_copy(&radio_ts, rx_time); srslte_timestamp_copy(&radio_ts, rx_time);
// Advance stack in time // Advance stack in time
while (srslte_timestamp_compare(rx_time, &tti_ts) > 0) { if (srslte_timestamp_compare(rx_time, &tti_ts) > 0) {
uint32_t tti_jump = ceil((srslte_timestamp_real(rx_time) - srslte_timestamp_real(&tti_ts)) / 1.0e-3);
// Run stack // Run stack
stack->run_tti(tti); stack->run_tti(tti, tti_jump);
// Increase one millisecond // Increase by the number of tti jumps detected
srslte_timestamp_add(&tti_ts, 0, 1.0e-3f); srslte_timestamp_add(&tti_ts, 0, tti_jump * 1.0e-3f);
} }
if (channel_emulator && rx_time) { if (channel_emulator && rx_time) {

@ -219,14 +219,12 @@ bool rrc::have_drb()
* RRC State Machine * RRC State Machine
* *
*/ */
void rrc::run_tti(uint32_t tti) void rrc::run_tti()
{ {
if (!initiated) { if (!initiated) {
return; return;
} }
rrc_log->step(tti);
if (simulate_rlf) { if (simulate_rlf) {
radio_link_failure(); radio_link_failure();
simulate_rlf = false; simulate_rlf = false;
@ -259,7 +257,7 @@ void rrc::run_tti(uint32_t tti)
} }
break; break;
case RRC_STATE_CONNECTED: case RRC_STATE_CONNECTED:
measurements->run_tti(tti); measurements->run_tti();
break; break;
default: default:
break; break;

@ -103,7 +103,7 @@ bool rrc::rrc_meas::parse_meas_config(const rrc_conn_recfg_r8_ies_s* mob_reconf_
return ret; return ret;
} }
void rrc::rrc_meas::run_tti(const uint32_t tti) void rrc::rrc_meas::run_tti()
{ {
std::lock_guard<std::mutex> lock(meas_cfg_mutex); std::lock_guard<std::mutex> lock(meas_cfg_mutex);

@ -298,22 +298,25 @@ void ue_stack_lte::out_of_sync()
pending_tasks.push(sync_queue_id, [this]() { rrc.out_of_sync(); }); pending_tasks.push(sync_queue_id, [this]() { rrc.out_of_sync(); });
} }
void ue_stack_lte::run_tti(uint32_t tti) void ue_stack_lte::run_tti(uint32_t tti, uint32_t tti_jump)
{ {
pending_tasks.push(sync_queue_id, [this, tti]() { run_tti_impl(tti); }); pending_tasks.push(sync_queue_id, [this, tti, tti_jump]() { run_tti_impl(tti, tti_jump); });
} }
void ue_stack_lte::run_tti_impl(uint32_t tti) void ue_stack_lte::run_tti_impl(uint32_t tti, uint32_t tti_jump)
{ {
if (args.have_tti_time_stats) { if (args.have_tti_time_stats) {
tti_tprof.start(); tti_tprof.start();
} }
// perform tasks in this TTI // perform tasks in this TTI
mac.run_tti(tti); for (uint32_t i = 0; i < tti_jump; ++i) {
rrc.run_tti(tti); uint32_t next_tti = TTI_SUB(tti, (tti_jump - i - 1));
nas.run_tti(tti); mac.run_tti(next_tti);
rrc.run_tti();
nas.run_tti();
timers.step_all(); timers.step_all();
}
if (args.have_tti_time_stats) { if (args.have_tti_time_stats) {
std::chrono::nanoseconds dur = tti_tprof.stop(); std::chrono::nanoseconds dur = tti_tprof.stop();

@ -310,7 +310,7 @@ emm_state_t nas::get_state()
return state; return state;
} }
void nas::run_tti(uint32_t tti) void nas::run_tti()
{ {
callbacks.run(); callbacks.run();
} }

@ -108,7 +108,7 @@ private:
void mch_decoded(uint32_t len, bool crc) override {} void mch_decoded(uint32_t len, bool crc) override {}
void new_mch_dl(srslte_pdsch_grant_t phy_grant, tb_action_dl_t* action) override {} void new_mch_dl(srslte_pdsch_grant_t phy_grant, tb_action_dl_t* action) override {}
void set_mbsfn_config(uint32_t nof_mbsfn_services) override {} void set_mbsfn_config(uint32_t nof_mbsfn_services) override {}
void run_tti(const uint32_t tti) override void run_tti(const uint32_t tti, const uint32_t tti_jump) override
{ {
notify_run_tti(); notify_run_tti();
log_h.info("Run TTI %d\n", tti); log_h.info("Run TTI %d\n", tti);

@ -403,7 +403,7 @@ void lte_ttcn3_phy::run_tti()
sr_tx_tti = current_tti; sr_tx_tti = current_tti;
} }
stack->run_tti(current_tti); stack->run_tti(current_tti, 1);
} }
void lte_ttcn3_phy::set_cells_to_meas(uint32_t earfcn, const std::set<uint32_t>& pci) {} void lte_ttcn3_phy::set_cells_to_meas(uint32_t earfcn, const std::set<uint32_t>& pci) {}

@ -162,9 +162,8 @@ public:
void run_thread() void run_thread()
{ {
running = true; running = true;
uint32_t counter = 0;
while (running) { while (running) {
nas->run_tti(counter++); nas->run_tti();
} }
} }
void stop() void stop()

@ -181,7 +181,7 @@ public:
void run_tti(uint32_t tti_) void run_tti(uint32_t tti_)
{ {
timers->step_all(); timers->step_all();
rrc::run_tti(tti_); rrc::run_tti();
} }
// Set RRC in state RRC_CONNECTED // Set RRC in state RRC_CONNECTED

Loading…
Cancel
Save