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/log.h"
#include <bitset>
#include <stdint.h>
#include <stdio.h>
#include <vector>
@ -271,7 +270,7 @@ public:
bool set_bsr(uint32_t buff_size[4], sch_subh::cetype format);
bool set_con_res_id(uint64_t con_res_id);
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);
void set_padding();
void set_padding(uint32_t padding_len);

@ -225,7 +225,8 @@ public:
* @param rnti identifier of the user
* @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 */

@ -277,7 +277,7 @@ public:
/* Custom */
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

@ -628,15 +628,17 @@ 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;
if (not((sch_pdu*)parent)->has_space_ce(nof_octets)) {
return false;
}
// first bit is reserved
active_cc_idxs.set(0, false);
w_payload_ce[0] = (uint8_t)(active_cc_idxs.to_ulong() & 0xffu);
w_payload_ce[0] = 0;
for (uint8_t i = 1; i < SRSLTE_MAX_CARRIERS; ++i) {
w_payload_ce[0] |= (static_cast<uint8_t>(active_scell_idxs[i]) << i);
}
lcid = SCELL_ACTIVATION;
((sch_pdu*)parent)->update_space_ce(nof_octets);
nof_bytes = nof_octets;

@ -26,6 +26,7 @@
#include "srslte/common/pdu.h"
#include "srslte/common/test_common.h"
#include "srslte/interfaces/ue_interfaces.h"
#include <bitset>
#include <iostream>
#include <map>
#include <random>
@ -556,6 +557,8 @@ int mac_sch_pdu_pack_test8()
uint8_t tv[pdu_size] = {0b00011011, (uint8_t)cc_mask.to_ulong()};
// ensure reserved bit
tv[1] &= ~(0x1u);
// limit to max carriers
tv[1] &= ((1u << (uint32_t)SRSLTE_MAX_CARRIERS) - 1u);
byte_buffer_t buffer;
pdu.init_tx(&buffer, pdu_size, true);
@ -567,7 +570,11 @@ int mac_sch_pdu_pack_test8()
// Try SCell activation CE
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
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;
void rem_rnti(uint16_t rnti) 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*/
void

@ -132,7 +132,7 @@ public:
void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) final;
void tpc_inc(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;

@ -183,7 +183,7 @@ void phy::set_mch_period_stop(uint32_t 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
for (uint32_t scell_idx = 1; scell_idx < SRSLTE_MAX_CARRIERS; scell_idx++) {

@ -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]->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
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;
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) {
/* Get PDU if it's a new transmission */

@ -357,11 +357,19 @@ void sched::tpc_dec(uint16_t rnti)
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;
ue_db_access(rnti, [&cfg](sched_ue& ue) { cfg = &ue.get_ue_cfg(); });
return cfg;
std::array<int, SRSLTE_MAX_CARRIERS> ret{};
ret.fill(-1); // -1 for inactive carriers
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;
}
/*******************************************************

@ -460,19 +460,23 @@ void ue::allocate_ce(srslte::sch_pdu* pdu, uint32_t lcid)
break;
case srslte::sch_subh::SCELL_ACTIVATION:
if (pdu->new_subh()) {
const sched_interface::ue_cfg_t* sched_cfg = sched->get_ue_cfg(rnti);
if (sched_cfg->supported_cc_list.size() <= 8) {
std::bitset<8> active_cc_list;
for (uint32_t i = 0; i < sched_cfg->supported_cc_list.size(); ++i) {
active_cc_list.set(i, sched_cfg->supported_cc_list[i].active);
std::array<int, SRSLTE_MAX_CARRIERS> enb_ue_cc_map = sched->get_enb_ue_cc_map(rnti);
std::array<bool, SRSLTE_MAX_CARRIERS> active_scell_list = {};
size_t enb_cc_idx = 0;
for (; enb_cc_idx < enb_ue_cc_map.size(); ++enb_cc_idx) {
if (enb_ue_cc_map[enb_cc_idx] >= 8) {
break;
}
if (enb_ue_cc_map[enb_cc_idx] <= 0) {
// inactive or PCell
continue;
}
active_scell_list[enb_ue_cc_map[enb_cc_idx]] = true;
}
if (pdu->get()->set_scell_activation_cmd(active_cc_list)) {
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_cc_list.size() - 1);
} else {
Error("CE: Setting SCell Activation CE\n");
}
allocate_cc_buffers(active_scell_list.size() - 1);
} else {
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
generator.step_tti();
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);
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].enb_cc_idx = cc_idxs[i];
}
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
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
**********************/
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)
{
sim_args0 = std::move(args);

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

@ -1091,7 +1091,7 @@ public:
dedicated.ul_cfg.pusch.uci_offset.I_offset_ack = 7;
// 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());
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

Loading…
Cancel
Save