change scell activation interface to use arrays. Added a method to the scheduler to get the current set of activated carriers

master
Francisco Paisana 5 years ago committed by Andre Puschmann
parent c42cb92784
commit 7548402632

@ -24,7 +24,6 @@
#include "srslte/common/interfaces_common.h" #include "srslte/common/interfaces_common.h"
#include "srslte/common/log.h" #include "srslte/common/log.h"
#include <bitset>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <vector> #include <vector>
@ -271,7 +270,7 @@ public:
bool set_bsr(uint32_t buff_size[4], sch_subh::cetype format); bool set_bsr(uint32_t buff_size[4], sch_subh::cetype format);
bool set_con_res_id(uint64_t con_res_id); bool set_con_res_id(uint64_t con_res_id);
bool set_ta_cmd(uint8_t ta_cmd); bool set_ta_cmd(uint8_t ta_cmd);
bool set_scell_activation_cmd(std::bitset<8> active_cc_idxs); bool set_scell_activation_cmd(const std::array<bool, SRSLTE_MAX_CARRIERS>& active_scell_idxs);
bool set_phr(float phr); bool set_phr(float phr);
void set_padding(); void set_padding();
void set_padding(uint32_t padding_len); void set_padding(uint32_t padding_len);

@ -225,7 +225,8 @@ public:
* @param rnti identifier of the user * @param rnti identifier of the user
* @param activation vector with the activate/deactivate. * @param activation vector with the activate/deactivate.
*/ */
virtual void set_activation_deactivation_scell(uint16_t rnti, bool activation[SRSLTE_MAX_CARRIERS]) = 0; virtual void set_activation_deactivation_scell(uint16_t rnti,
const std::array<bool, SRSLTE_MAX_CARRIERS>& activation) = 0;
}; };
/* Interface RRC -> PHY */ /* Interface RRC -> PHY */

@ -103,10 +103,10 @@ public:
}; };
struct ue_bearer_cfg_t { struct ue_bearer_cfg_t {
int priority = 0; int priority = 0;
int bsd = 0; int bsd = 0;
int pbr = 0; int pbr = 0;
int group = 0; int group = 0;
enum { IDLE = 0, UL, DL, BOTH } direction = IDLE; enum { IDLE = 0, UL, DL, BOTH } direction = IDLE;
}; };
@ -276,8 +276,8 @@ public:
virtual int ul_sched(uint32_t tti, uint32_t enb_cc_idx, ul_sched_res_t& sched_result) = 0; virtual int ul_sched(uint32_t tti, uint32_t enb_cc_idx, ul_sched_res_t& sched_result) = 0;
/* Custom */ /* Custom */
virtual void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0; virtual void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0;
virtual const ue_cfg_t* get_ue_cfg(uint16_t rnti) = 0; virtual std::array<int, SRSLTE_MAX_CARRIERS> get_enb_ue_cc_map(uint16_t rnti) = 0;
}; };
} // namespace srsenb } // namespace srsenb

@ -628,16 +628,18 @@ bool sch_subh::set_ta_cmd(uint8_t ta_cmd)
} }
} }
bool sch_subh::set_scell_activation_cmd(std::bitset<8> active_cc_idxs) bool sch_subh::set_scell_activation_cmd(const std::array<bool, SRSLTE_MAX_CARRIERS>& active_scell_idxs)
{ {
const uint32_t nof_octets = 1; const uint32_t nof_octets = 1;
if (not((sch_pdu*)parent)->has_space_ce(nof_octets)) { if (not((sch_pdu*)parent)->has_space_ce(nof_octets)) {
return false; return false;
} }
// first bit is reserved // first bit is reserved
active_cc_idxs.set(0, false); w_payload_ce[0] = 0;
w_payload_ce[0] = (uint8_t)(active_cc_idxs.to_ulong() & 0xffu); for (uint8_t i = 1; i < SRSLTE_MAX_CARRIERS; ++i) {
lcid = SCELL_ACTIVATION; w_payload_ce[0] |= (static_cast<uint8_t>(active_scell_idxs[i]) << i);
}
lcid = SCELL_ACTIVATION;
((sch_pdu*)parent)->update_space_ce(nof_octets); ((sch_pdu*)parent)->update_space_ce(nof_octets);
nof_bytes = nof_octets; nof_bytes = nof_octets;
return true; return true;

@ -26,6 +26,7 @@
#include "srslte/common/pdu.h" #include "srslte/common/pdu.h"
#include "srslte/common/test_common.h" #include "srslte/common/test_common.h"
#include "srslte/interfaces/ue_interfaces.h" #include "srslte/interfaces/ue_interfaces.h"
#include <bitset>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <random> #include <random>
@ -556,6 +557,8 @@ int mac_sch_pdu_pack_test8()
uint8_t tv[pdu_size] = {0b00011011, (uint8_t)cc_mask.to_ulong()}; uint8_t tv[pdu_size] = {0b00011011, (uint8_t)cc_mask.to_ulong()};
// ensure reserved bit // ensure reserved bit
tv[1] &= ~(0x1u); tv[1] &= ~(0x1u);
// limit to max carriers
tv[1] &= ((1u << (uint32_t)SRSLTE_MAX_CARRIERS) - 1u);
byte_buffer_t buffer; byte_buffer_t buffer;
pdu.init_tx(&buffer, pdu_size, true); pdu.init_tx(&buffer, pdu_size, true);
@ -567,7 +570,11 @@ int mac_sch_pdu_pack_test8()
// Try SCell activation CE // Try SCell activation CE
TESTASSERT(pdu.new_subh()); TESTASSERT(pdu.new_subh());
TESTASSERT(pdu.get()->set_scell_activation_cmd(cc_mask)); std::array<bool, SRSLTE_MAX_CARRIERS> cc_activ_list = {};
for (uint8_t i = 1; i < SRSLTE_MAX_CARRIERS; ++i) {
cc_activ_list[i] = cc_mask.test(i);
}
TESTASSERT(pdu.get()->set_scell_activation_cmd(cc_activ_list));
// write PDU // write PDU
pdu.write_packet(log_h.get()); pdu.write_packet(log_h.get());

@ -54,7 +54,8 @@ public:
int add_rnti(uint16_t rnti, uint32_t pcell_index, bool is_temporal) override; int add_rnti(uint16_t rnti, uint32_t pcell_index, bool is_temporal) override;
void rem_rnti(uint16_t rnti) final; void rem_rnti(uint16_t rnti) final;
void set_mch_period_stop(uint32_t stop) final; void set_mch_period_stop(uint32_t stop) final;
void set_activation_deactivation_scell(uint16_t rnti, bool activation[SRSLTE_MAX_CARRIERS]) override; void set_activation_deactivation_scell(uint16_t rnti,
const std::array<bool, SRSLTE_MAX_CARRIERS>& activation) override;
/*RRC-PHY interface*/ /*RRC-PHY interface*/
void void

@ -129,10 +129,10 @@ public:
/* Custom functions /* Custom functions
*/ */
void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) final; void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) final;
void tpc_inc(uint16_t rnti); void tpc_inc(uint16_t rnti);
void tpc_dec(uint16_t rnti); void tpc_dec(uint16_t rnti);
const ue_cfg_t* get_ue_cfg(uint16_t rnti) final; std::array<int, SRSLTE_MAX_CARRIERS> get_enb_ue_cc_map(uint16_t rnti) final;
class carrier_sched; class carrier_sched;

@ -183,7 +183,7 @@ void phy::set_mch_period_stop(uint32_t stop)
workers_common.set_mch_period_stop(stop); workers_common.set_mch_period_stop(stop);
} }
void phy::set_activation_deactivation_scell(uint16_t rnti, bool activation[SRSLTE_MAX_CARRIERS]) void phy::set_activation_deactivation_scell(uint16_t rnti, const std::array<bool, SRSLTE_MAX_CARRIERS>& activation)
{ {
// Iterate all elements except 0 that is reserved for primary cell // Iterate all elements except 0 that is reserved for primary cell
for (uint32_t scell_idx = 1; scell_idx < SRSLTE_MAX_CARRIERS; scell_idx++) { for (uint32_t scell_idx = 1; scell_idx < SRSLTE_MAX_CARRIERS; scell_idx++) {

@ -67,7 +67,7 @@ bool mac::init(const mac_args_t& args_,
stack = stack_; stack = stack_;
log_h = log_h_; log_h = log_h_;
args = args_; args = args_;
cells = cells_; cells = cells_;
stack_task_queue = stack->get_task_queue(); stack_task_queue = stack->get_task_queue();
@ -323,7 +323,12 @@ int mac::crc_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, uint32_t nof
ue_db[rnti]->set_tti(tti); ue_db[rnti]->set_tti(tti);
ue_db[rnti]->metrics_rx(crc, nof_bytes); ue_db[rnti]->metrics_rx(crc, nof_bytes);
uint32_t ue_cc_idx = 0; // FIXME: mapping between eNB->UE CC idx std::array<int, SRSLTE_MAX_CARRIERS> enb_ue_cc_map = scheduler.get_enb_ue_cc_map(rnti);
if (enb_ue_cc_map[enb_cc_idx] < 0) {
Error("User rnti=0x%x is not activated for carrier %d\n", rnti, enb_cc_idx);
return ret;
}
uint32_t ue_cc_idx = enb_ue_cc_map[enb_cc_idx];
// push the pdu through the queue if received correctly // push the pdu through the queue if received correctly
if (crc) { if (crc) {
@ -528,7 +533,8 @@ int mac::get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res_list)
dl_sched_res->pdsch[n].dci = sched_result.data[i].dci; dl_sched_res->pdsch[n].dci = sched_result.data[i].dci;
for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) { for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) {
dl_sched_res->pdsch[n].softbuffer_tx[tb] = ue_db[rnti]->get_tx_softbuffer(sched_result.data[i].dci.ue_cc_idx, sched_result.data[i].dci.pid, tb); dl_sched_res->pdsch[n].softbuffer_tx[tb] =
ue_db[rnti]->get_tx_softbuffer(sched_result.data[i].dci.ue_cc_idx, sched_result.data[i].dci.pid, tb);
if (sched_result.data[i].nof_pdu_elems[tb] > 0) { if (sched_result.data[i].nof_pdu_elems[tb] > 0) {
/* Get PDU if it's a new transmission */ /* Get PDU if it's a new transmission */
@ -784,7 +790,7 @@ int mac::get_ul_sched(uint32_t tti, ul_sched_list_t& ul_sched_res_list)
// Copy DCI grants // Copy DCI grants
phy_ul_sched_res->nof_grants = 0; phy_ul_sched_res->nof_grants = 0;
int n = 0; int n = 0;
for (uint32_t i = 0; i < sched_result.nof_dci_elems; i++) { for (uint32_t i = 0; i < sched_result.nof_dci_elems; i++) {
if (sched_result.pusch[i].tbs > 0) { if (sched_result.pusch[i].tbs > 0) {

@ -357,11 +357,19 @@ void sched::tpc_dec(uint16_t rnti)
ue_db_access(rnti, [](sched_ue& ue) { ue.tpc_dec(); }); ue_db_access(rnti, [](sched_ue& ue) { ue.tpc_dec(); });
} }
const sched::ue_cfg_t* sched::get_ue_cfg(uint16_t rnti) std::array<int, SRSLTE_MAX_CARRIERS> sched::get_enb_ue_cc_map(uint16_t rnti)
{ {
const ue_cfg_t* cfg = nullptr; std::array<int, SRSLTE_MAX_CARRIERS> ret{};
ue_db_access(rnti, [&cfg](sched_ue& ue) { cfg = &ue.get_ue_cfg(); }); ret.fill(-1); // -1 for inactive carriers
return cfg; ue_db_access(rnti, [this, &ret](sched_ue& ue) {
for (size_t enb_cc_idx = 0; enb_cc_idx < carrier_schedulers.size(); ++enb_cc_idx) {
auto p = ue.get_cell_index(enb_cc_idx);
if (p.second < SRSLTE_MAX_CARRIERS) {
ret[enb_cc_idx] = p.second;
}
}
});
return ret;
} }
/******************************************************* /*******************************************************

@ -174,7 +174,7 @@ uint8_t* ue::request_buffer(const uint32_t ue_cc_idx, const uint32_t tti, const
uint8_t* ret = nullptr; uint8_t* ret = nullptr;
if (len > 0) { if (len > 0) {
if (!pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc)) { if (!pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc)) {
ret = pdus.request(len); ret = pdus.request(len);
pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc) = ret; pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc) = ret;
} else { } else {
log_h->console("Error requesting buffer for pid %d, not pushed yet\n", tti % nof_rx_harq_proc); log_h->console("Error requesting buffer for pid %d, not pushed yet\n", tti % nof_rx_harq_proc);
@ -460,19 +460,23 @@ void ue::allocate_ce(srslte::sch_pdu* pdu, uint32_t lcid)
break; break;
case srslte::sch_subh::SCELL_ACTIVATION: case srslte::sch_subh::SCELL_ACTIVATION:
if (pdu->new_subh()) { if (pdu->new_subh()) {
const sched_interface::ue_cfg_t* sched_cfg = sched->get_ue_cfg(rnti); std::array<int, SRSLTE_MAX_CARRIERS> enb_ue_cc_map = sched->get_enb_ue_cc_map(rnti);
if (sched_cfg->supported_cc_list.size() <= 8) { std::array<bool, SRSLTE_MAX_CARRIERS> active_scell_list = {};
std::bitset<8> active_cc_list; size_t enb_cc_idx = 0;
for (uint32_t i = 0; i < sched_cfg->supported_cc_list.size(); ++i) { for (; enb_cc_idx < enb_ue_cc_map.size(); ++enb_cc_idx) {
active_cc_list.set(i, sched_cfg->supported_cc_list[i].active); if (enb_ue_cc_map[enb_cc_idx] >= 8) {
break;
} }
if (pdu->get()->set_scell_activation_cmd(active_cc_list)) { if (enb_ue_cc_map[enb_cc_idx] <= 0) {
Info("CE: Added SCell Activation CE.\n"); // inactive or PCell
// Allocate and initialize Rx/Tx softbuffers for new carriers (exclude PCell) continue;
allocate_cc_buffers(active_cc_list.size() - 1);
} else {
Error("CE: Setting SCell Activation CE\n");
} }
active_scell_list[enb_ue_cc_map[enb_cc_idx]] = true;
}
if (enb_cc_idx == enb_ue_cc_map.size() and pdu->get()->set_scell_activation_cmd(active_scell_list)) {
Info("CE: Added SCell Activation CE.\n");
// Allocate and initialize Rx/Tx softbuffers for new carriers (exclude PCell)
allocate_cc_buffers(active_scell_list.size() - 1);
} else { } else {
Error("CE: Setting SCell Activation CE\n"); Error("CE: Setting SCell Activation CE\n");
} }

@ -162,13 +162,17 @@ int test_scell_activation(test_scell_activation_params params)
// Event: Reconf Complete. Activate SCells. Check if CE correctly transmitted // Event: Reconf Complete. Activate SCells. Check if CE correctly transmitted
generator.step_tti(); generator.step_tti();
user = generator.user_reconf(rnti1); user = generator.user_reconf(rnti1);
*user->ue_cfg = *tester.get_ue_cfg(rnti1); // use current cfg as starting point, and add more supported ccs *user->ue_cfg = *tester.get_current_ue_cfg(rnti1); // use current cfg as starting point, and add more supported ccs
user->ue_cfg->supported_cc_list.resize(nof_ccs); user->ue_cfg->supported_cc_list.resize(nof_ccs);
for (uint32_t i = 0; i < user->ue_cfg->supported_cc_list.size(); ++i) { for (uint32_t i = 0; i < user->ue_cfg->supported_cc_list.size(); ++i) {
user->ue_cfg->supported_cc_list[i].active = true; user->ue_cfg->supported_cc_list[i].active = true;
user->ue_cfg->supported_cc_list[i].enb_cc_idx = cc_idxs[i]; user->ue_cfg->supported_cc_list[i].enb_cc_idx = cc_idxs[i];
} }
tester.test_next_ttis(generator.tti_events); tester.test_next_ttis(generator.tti_events);
auto activ_list = tester.get_enb_ue_cc_map(rnti1);
for (uint32_t i = 0; i < cc_idxs.size(); ++i) {
TESTASSERT(activ_list[i] >= 0);
}
// TEST: When a DL newtx takes place, it should also encode the CE // TEST: When a DL newtx takes place, it should also encode the CE
for (uint32_t i = 0; i < 100; ++i) { for (uint32_t i = 0; i < 100; ++i) {

@ -615,6 +615,15 @@ sched_result_stats::user_stats* sched_result_stats::get_user(uint16_t rnti)
* Common Sched Tester * Common Sched Tester
**********************/ **********************/
const sched::ue_cfg_t* common_sched_tester::get_current_ue_cfg(uint16_t rnti) const
{
auto it = ue_db.find(rnti);
if (it == ue_db.end()) {
return nullptr;
}
return &it->second.get_ue_cfg();
}
int common_sched_tester::sim_cfg(sim_sched_args args) int common_sched_tester::sim_cfg(sim_sched_args args)
{ {
sim_args0 = std::move(args); sim_args0 = std::move(args);

@ -175,6 +175,8 @@ public:
~common_sched_tester() override = default; ~common_sched_tester() override = default;
const ue_cfg_t* get_current_ue_cfg(uint16_t rnti) const;
int sim_cfg(sim_sched_args args); int sim_cfg(sim_sched_args args);
virtual int add_user(uint16_t rnti, const ue_cfg_t& ue_cfg_); virtual int add_user(uint16_t rnti, const ue_cfg_t& ue_cfg_);
virtual void rem_user(uint16_t rnti); virtual void rem_user(uint16_t rnti);

@ -1091,7 +1091,7 @@ public:
dedicated.ul_cfg.pusch.uci_offset.I_offset_ack = 7; dedicated.ul_cfg.pusch.uci_offset.I_offset_ack = 7;
// Configure UE PHY // Configure UE PHY
bool activation[SRSLTE_MAX_CARRIERS] = {}; ///< Activation/Deactivation vector std::array<bool, SRSLTE_MAX_CARRIERS> activation = {}; ///< Activation/Deactivation vector
phy_rrc_cfg.resize(args.ue_cell_list.size()); phy_rrc_cfg.resize(args.ue_cell_list.size());
for (uint32_t i = 0; i < args.ue_cell_list.size(); i++) { for (uint32_t i = 0; i < args.ue_cell_list.size(); i++) {
phy_rrc_cfg[i].enb_cc_idx = args.ue_cell_list[i]; ///< First element is PCell phy_rrc_cfg[i].enb_cc_idx = args.ue_cell_list[i]; ///< First element is PCell

Loading…
Cancel
Save