mirror of https://github.com/PentHertz/srsLTE.git
removed common ce_typeenum
This commit is contained in:
parent
372126deac
commit
b506e29b72
|
@ -49,10 +49,14 @@ const char* to_string(dl_sch_lcid v);
|
|||
uint32_t ce_size(dl_sch_lcid v);
|
||||
uint32_t ce_subheader_size(dl_sch_lcid v);
|
||||
uint32_t ce_total_size(dl_sch_lcid v);
|
||||
bool is_mac_ce(dl_sch_lcid v)
|
||||
constexpr bool is_mac_ce(dl_sch_lcid v)
|
||||
{
|
||||
return v > dl_sch_lcid::RESERVED;
|
||||
}
|
||||
constexpr bool is_sdu(dl_sch_lcid v)
|
||||
{
|
||||
return v <= dl_sch_lcid::RESERVED;
|
||||
}
|
||||
|
||||
/* 3GPP 36.321 Table 6.2.1-2 */
|
||||
enum class ul_sch_lcid {
|
||||
|
@ -68,9 +72,14 @@ enum class ul_sch_lcid {
|
|||
PADDING = 0b11111
|
||||
};
|
||||
const char* to_string(ul_sch_lcid v);
|
||||
bool is_mac_ce(ul_sch_lcid v)
|
||||
uint32_t ce_size(ul_sch_lcid v);
|
||||
constexpr bool is_mac_ce(ul_sch_lcid v)
|
||||
{
|
||||
return v >= ul_sch_lcid::RESERVED;
|
||||
return v > ul_sch_lcid::RESERVED;
|
||||
}
|
||||
constexpr bool is_sdu(ul_sch_lcid v)
|
||||
{
|
||||
return v <= ul_sch_lcid::RESERVED;
|
||||
}
|
||||
|
||||
/* 3GPP 36.321 Table 6.2.1-4 */
|
||||
|
@ -82,18 +91,32 @@ enum class mch_lcid {
|
|||
PADDING = 0b11111
|
||||
};
|
||||
const char* to_string(mch_lcid v);
|
||||
constexpr bool is_mac_ce(mch_lcid v)
|
||||
{
|
||||
return v >= mch_lcid::MCH_SCHED_INFO;
|
||||
}
|
||||
constexpr bool is_sdu(mch_lcid v)
|
||||
{
|
||||
return v < mch_lcid::MCH_SCHED_INFO;
|
||||
}
|
||||
|
||||
/* Common LCID type */
|
||||
struct lcid_t {
|
||||
enum class sch_type { dl_sch, ul_sch, mch } type;
|
||||
enum class ch_type { dl_sch, ul_sch, mch } type;
|
||||
union {
|
||||
uint32_t lcid;
|
||||
dl_sch_lcid dl_sch;
|
||||
ul_sch_lcid ul_sch;
|
||||
mch_lcid mch;
|
||||
};
|
||||
lcid_t(ch_type t, uint32_t lcid_) : type(t), lcid(lcid_) {}
|
||||
lcid_t(dl_sch_lcid lcid_) : type(ch_type::dl_sch), dl_sch(lcid_) {}
|
||||
lcid_t(ul_sch_lcid lcid_) : type(ch_type::ul_sch), ul_sch(lcid_) {}
|
||||
lcid_t(mch_lcid lcid_) : type(ch_type::mch), mch(lcid_) {}
|
||||
const char* to_string() const;
|
||||
bool is_sch() const { return type == sch_type::dl_sch or type == sch_type::ul_sch; }
|
||||
bool is_sch() const { return type == ch_type::dl_sch or type == ch_type::ul_sch; }
|
||||
bool is_sdu() const;
|
||||
bool operator==(lcid_t t) const { return type == t.type and lcid == t.lcid; }
|
||||
};
|
||||
|
||||
template <class SubH>
|
||||
|
@ -269,40 +292,18 @@ public:
|
|||
|
||||
virtual ~sch_subh() {}
|
||||
|
||||
/* 3GPP 36.321 (R.10) Combined Tables 6.2.1-1, 6.2.1-2, 6.2.1-4 */
|
||||
typedef enum {
|
||||
/* Values of LCID for DL-SCH */
|
||||
SCELL_ACTIVATION = 0b11011,
|
||||
CON_RES_ID = 0b11100,
|
||||
TA_CMD = 0b11101,
|
||||
DRX_CMD = 0b11110,
|
||||
|
||||
/* Values of LCID for UL-SCH */
|
||||
PHR_REPORT_EXT = 0b11001,
|
||||
PHR_REPORT = 0b11010,
|
||||
CRNTI = 0b11011,
|
||||
TRUNC_BSR = 0b11100,
|
||||
SHORT_BSR = 0b11101,
|
||||
LONG_BSR = 0b11110,
|
||||
|
||||
/* Values of LCID for MCH */
|
||||
MTCH_MAX_LCID = 0b11100,
|
||||
MCH_SCHED_INFO = 0b11110,
|
||||
|
||||
/*MTCH STOP Value*/
|
||||
MTCH_STOP_EMPTY = 0b11111111111,
|
||||
/* Common */
|
||||
PADDING = 0b11111,
|
||||
SDU = 0b00000
|
||||
} cetype;
|
||||
|
||||
// Size of MAC CEs
|
||||
const static int MAC_CE_CONTRES_LEN = 6;
|
||||
const static uint32_t MTCH_STOP_EMPTY = 0b11111111111;
|
||||
const static uint32_t SDU = 0b00000;
|
||||
|
||||
// Reading functions
|
||||
bool is_sdu();
|
||||
bool is_var_len_ce();
|
||||
cetype ce_type();
|
||||
uint32_t lcid_value() { return lcid; }
|
||||
ul_sch_lcid ul_sch_ce_type();
|
||||
dl_sch_lcid dl_sch_ce_type();
|
||||
mch_lcid mch_ce_type();
|
||||
uint32_t size_plus_header();
|
||||
void set_payload_size(uint32_t size);
|
||||
|
||||
|
@ -330,7 +331,7 @@ public:
|
|||
int set_sdu(uint32_t lcid, uint32_t nof_bytes, uint8_t* payload);
|
||||
int set_sdu(uint32_t lcid, uint32_t requested_bytes, read_pdu_interface* sdu_itf);
|
||||
bool set_c_rnti(uint16_t crnti);
|
||||
bool set_bsr(uint32_t buff_size[4], sch_subh::cetype format);
|
||||
bool set_bsr(uint32_t buff_size[4], ul_sch_lcid format);
|
||||
bool set_con_res_id(uint64_t con_res_id);
|
||||
bool set_ta_cmd(uint8_t ta_cmd);
|
||||
bool set_scell_activation_cmd(const std::array<bool, SRSLTE_MAX_CARRIERS>& active_scell_idxs);
|
||||
|
|
|
@ -118,6 +118,24 @@ const char* to_string(ul_sch_lcid v)
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t ce_size(ul_sch_lcid v)
|
||||
{
|
||||
switch (v) {
|
||||
case ul_sch_lcid::PHR_REPORT:
|
||||
return 1;
|
||||
case ul_sch_lcid::CRNTI:
|
||||
return 2;
|
||||
case ul_sch_lcid::TRUNC_BSR:
|
||||
return 1;
|
||||
case ul_sch_lcid::SHORT_BSR:
|
||||
return 1;
|
||||
case ul_sch_lcid::LONG_BSR:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const char* to_string(mch_lcid v)
|
||||
{
|
||||
switch (v) {
|
||||
|
@ -135,17 +153,31 @@ const char* to_string(mch_lcid v)
|
|||
const char* lcid_t::to_string() const
|
||||
{
|
||||
switch (type) {
|
||||
case sch_type::dl_sch:
|
||||
case ch_type::dl_sch:
|
||||
return srslte::to_string(dl_sch);
|
||||
case sch_type::ul_sch:
|
||||
case ch_type::ul_sch:
|
||||
return srslte::to_string(ul_sch);
|
||||
case sch_type::mch:
|
||||
case ch_type::mch:
|
||||
return srslte::to_string(mch);
|
||||
default:
|
||||
return "unrecognized lcid type\n";
|
||||
}
|
||||
}
|
||||
|
||||
bool lcid_t::is_sdu() const
|
||||
{
|
||||
switch (type) {
|
||||
case ch_type::dl_sch:
|
||||
return srslte::is_sdu(dl_sch);
|
||||
case ch_type::ul_sch:
|
||||
return srslte::is_sdu(ul_sch);
|
||||
case ch_type::mch:
|
||||
return srslte::is_sdu(mch);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************
|
||||
* SCH PDU
|
||||
*************************/
|
||||
|
@ -443,15 +475,22 @@ void sch_subh::init()
|
|||
cur_mch_sched_ce = 0;
|
||||
}
|
||||
|
||||
sch_subh::cetype sch_subh::ce_type()
|
||||
ul_sch_lcid sch_subh::ul_sch_ce_type()
|
||||
{
|
||||
if (lcid >= PHR_REPORT && type == SCH_SUBH_TYPE) {
|
||||
return (cetype)lcid;
|
||||
}
|
||||
if (lcid >= MCH_SCHED_INFO && type == MCH_SUBH_TYPE) {
|
||||
return (cetype)lcid;
|
||||
}
|
||||
return (cetype)SDU;
|
||||
auto ret = static_cast<ul_sch_lcid>(lcid);
|
||||
return is_mac_ce(ret) ? ret : static_cast<ul_sch_lcid>(SDU);
|
||||
}
|
||||
|
||||
dl_sch_lcid sch_subh::dl_sch_ce_type()
|
||||
{
|
||||
auto ret = static_cast<dl_sch_lcid>(lcid);
|
||||
return is_mac_ce(ret) ? ret : static_cast<dl_sch_lcid>(SDU);
|
||||
}
|
||||
|
||||
mch_lcid sch_subh::mch_ce_type()
|
||||
{
|
||||
auto ret = static_cast<mch_lcid>(lcid);
|
||||
return is_mac_ce(ret) ? ret : static_cast<mch_lcid>(SDU);
|
||||
}
|
||||
|
||||
void sch_subh::set_payload_size(uint32_t size)
|
||||
|
@ -472,40 +511,18 @@ uint32_t sch_subh::sizeof_ce(uint32_t lcid, bool is_ul)
|
|||
{
|
||||
if (type == SCH_SUBH_TYPE) {
|
||||
if (is_ul) {
|
||||
switch (lcid) {
|
||||
case PHR_REPORT:
|
||||
return 1;
|
||||
case CRNTI:
|
||||
return 2;
|
||||
case TRUNC_BSR:
|
||||
return 1;
|
||||
case SHORT_BSR:
|
||||
return 1;
|
||||
case LONG_BSR:
|
||||
return 3;
|
||||
case PADDING:
|
||||
return 0;
|
||||
}
|
||||
return ce_size(static_cast<ul_sch_lcid>(lcid));
|
||||
} else {
|
||||
switch (lcid) {
|
||||
case CON_RES_ID:
|
||||
return 6;
|
||||
case TA_CMD:
|
||||
return 1;
|
||||
case DRX_CMD:
|
||||
return 0;
|
||||
case PADDING:
|
||||
return 0;
|
||||
case SCELL_ACTIVATION:
|
||||
return 1;
|
||||
}
|
||||
return ce_size(static_cast<dl_sch_lcid>(lcid));
|
||||
}
|
||||
}
|
||||
if (type == MCH_SUBH_TYPE) {
|
||||
switch (lcid) {
|
||||
case MCH_SCHED_INFO:
|
||||
switch (static_cast<mch_lcid>(lcid)) {
|
||||
case mch_lcid::MCH_SCHED_INFO:
|
||||
return nof_mch_sched_ce * 2;
|
||||
case PADDING:
|
||||
case mch_lcid::PADDING:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -514,12 +531,12 @@ uint32_t sch_subh::sizeof_ce(uint32_t lcid, bool is_ul)
|
|||
|
||||
bool sch_subh::is_sdu()
|
||||
{
|
||||
return ce_type() == SDU;
|
||||
return lcid_t{type == MCH_SUBH_TYPE ? lcid_t::ch_type::mch : lcid_t::ch_type::ul_sch, lcid}.is_sdu();
|
||||
}
|
||||
|
||||
bool sch_subh::is_var_len_ce()
|
||||
{
|
||||
return (MCH_SCHED_INFO == ce_type()) && (MCH_SUBH_TYPE == type);
|
||||
return (mch_lcid::MCH_SCHED_INFO == mch_ce_type()) && (MCH_SUBH_TYPE == type);
|
||||
}
|
||||
|
||||
uint16_t sch_subh::get_c_rnti()
|
||||
|
@ -557,7 +574,7 @@ int sch_subh::get_bsr(uint32_t buff_size[4])
|
|||
{
|
||||
if (payload) {
|
||||
uint32_t nonzero_lcg = 0;
|
||||
if (ce_type() == LONG_BSR) {
|
||||
if (ul_sch_ce_type() == ul_sch_lcid::LONG_BSR) {
|
||||
buff_size[0] = (payload[0] & 0xFC) >> 2;
|
||||
buff_size[1] = (payload[0] & 0x03) << 4 | (payload[1] & 0xF0) >> 4;
|
||||
buff_size[2] = (payload[1] & 0x0F) << 4 | (payload[1] & 0xC0) >> 6;
|
||||
|
@ -630,7 +647,7 @@ uint32_t sch_subh::get_payload_size()
|
|||
uint32_t sch_subh::get_header_size(bool is_last)
|
||||
{
|
||||
if (!is_last) {
|
||||
if (is_sdu() || (lcid == MCH_SCHED_INFO && type == MCH_SUBH_TYPE)) {
|
||||
if (is_sdu() || (lcid == (uint32_t)mch_lcid::MCH_SCHED_INFO && type == MCH_SUBH_TYPE)) {
|
||||
return sch_pdu::size_header_sdu(nof_bytes);
|
||||
}
|
||||
return 1; // All others are 1-byte
|
||||
|
@ -646,7 +663,7 @@ uint8_t* sch_subh::get_sdu_ptr()
|
|||
|
||||
void sch_subh::set_padding(uint32_t padding_len)
|
||||
{
|
||||
lcid = PADDING;
|
||||
lcid = (uint32_t)dl_sch_lcid::PADDING;
|
||||
nof_bytes = padding_len;
|
||||
}
|
||||
|
||||
|
@ -660,7 +677,7 @@ void sch_subh::set_padding()
|
|||
set_padding(0);
|
||||
}
|
||||
|
||||
bool sch_subh::set_bsr(uint32_t buff_size[4], sch_subh::cetype format)
|
||||
bool sch_subh::set_bsr(uint32_t buff_size[4], ul_sch_lcid format)
|
||||
{
|
||||
uint32_t nonzero_lcg = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -668,16 +685,16 @@ bool sch_subh::set_bsr(uint32_t buff_size[4], sch_subh::cetype format)
|
|||
nonzero_lcg = i;
|
||||
}
|
||||
}
|
||||
uint32_t ce_size = format == LONG_BSR ? 3 : 1;
|
||||
uint32_t ce_size = format == ul_sch_lcid::LONG_BSR ? 3 : 1;
|
||||
if (((sch_pdu*)parent)->has_space_ce(ce_size)) {
|
||||
if (format == LONG_BSR) {
|
||||
if (format == ul_sch_lcid::LONG_BSR) {
|
||||
w_payload_ce[0] = ((buff_size_table(buff_size[0]) & 0x3f) << 2) | ((buff_size_table(buff_size[1]) & 0x30) >> 4);
|
||||
w_payload_ce[1] = ((buff_size_table(buff_size[1]) & 0xf) << 4) | ((buff_size_table(buff_size[2]) & 0x3c) >> 2);
|
||||
w_payload_ce[2] = ((buff_size_table(buff_size[2]) & 0x3) << 6) | ((buff_size_table(buff_size[3]) & 0x3f));
|
||||
} else {
|
||||
w_payload_ce[0] = (nonzero_lcg & 0x3) << 6 | (buff_size_table(buff_size[nonzero_lcg]) & 0x3f);
|
||||
}
|
||||
lcid = format;
|
||||
lcid = (uint32_t)format;
|
||||
((sch_pdu*)parent)->update_space_ce(ce_size);
|
||||
nof_bytes = ce_size;
|
||||
return true;
|
||||
|
@ -691,7 +708,7 @@ bool sch_subh::set_c_rnti(uint16_t crnti)
|
|||
if (((sch_pdu*)parent)->has_space_ce(2)) {
|
||||
w_payload_ce[0] = (uint8_t)((crnti & 0xff00) >> 8);
|
||||
w_payload_ce[1] = (uint8_t)((crnti & 0x00ff));
|
||||
lcid = CRNTI;
|
||||
lcid = (uint32_t)ul_sch_lcid::CRNTI;
|
||||
((sch_pdu*)parent)->update_space_ce(2);
|
||||
nof_bytes = 2;
|
||||
return true;
|
||||
|
@ -708,7 +725,7 @@ bool sch_subh::set_con_res_id(uint64_t con_res_id)
|
|||
w_payload_ce[3] = (uint8_t)((con_res_id & 0x000000ff0000) >> 16);
|
||||
w_payload_ce[4] = (uint8_t)((con_res_id & 0x00000000ff00) >> 8);
|
||||
w_payload_ce[5] = (uint8_t)((con_res_id & 0x0000000000ff));
|
||||
lcid = CON_RES_ID;
|
||||
lcid = (uint32_t)dl_sch_lcid::CON_RES_ID;
|
||||
((sch_pdu*)parent)->update_space_ce(6);
|
||||
nof_bytes = 6;
|
||||
return true;
|
||||
|
@ -720,7 +737,7 @@ bool sch_subh::set_phr(float phr)
|
|||
{
|
||||
if (((sch_pdu*)parent)->has_space_ce(1)) {
|
||||
w_payload_ce[0] = phr_report_table(phr) & 0x3f;
|
||||
lcid = PHR_REPORT;
|
||||
lcid = (uint32_t)ul_sch_lcid::PHR_REPORT;
|
||||
((sch_pdu*)parent)->update_space_ce(1);
|
||||
nof_bytes = 1;
|
||||
return true;
|
||||
|
@ -733,7 +750,7 @@ bool sch_subh::set_ta_cmd(uint8_t ta_cmd)
|
|||
{
|
||||
if (((sch_pdu*)parent)->has_space_ce(1)) {
|
||||
w_payload_ce[0] = ta_cmd & 0x3f;
|
||||
lcid = TA_CMD;
|
||||
lcid = (uint32_t)dl_sch_lcid::TA_CMD;
|
||||
((sch_pdu*)parent)->update_space_ce(1);
|
||||
nof_bytes = 1;
|
||||
return true;
|
||||
|
@ -753,7 +770,7 @@ bool sch_subh::set_scell_activation_cmd(const std::array<bool, SRSLTE_MAX_CARRIE
|
|||
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;
|
||||
lcid = (uint32_t)dl_sch_lcid::SCELL_ACTIVATION;
|
||||
((sch_pdu*)parent)->update_space_ce(nof_octets);
|
||||
nof_bytes = nof_octets;
|
||||
return true;
|
||||
|
@ -766,7 +783,7 @@ bool sch_subh::set_next_mch_sched_info(uint8_t lcid_, uint16_t mtch_stop)
|
|||
w_payload_ce[nof_mch_sched_ce * 2] = (lcid_ & 0x1F) << 3 | (uint8_t)((mtch_stop_ce & 0x0700) >> 8);
|
||||
w_payload_ce[nof_mch_sched_ce * 2 + 1] = (uint8_t)(mtch_stop_ce & 0xff);
|
||||
nof_mch_sched_ce++;
|
||||
lcid = MCH_SCHED_INFO;
|
||||
lcid = (uint32_t)mch_lcid::MCH_SCHED_INFO;
|
||||
((sch_pdu*)parent)->update_space_ce(2, true);
|
||||
nof_bytes += 2;
|
||||
return true;
|
||||
|
@ -893,47 +910,57 @@ void sch_subh::fprint(FILE* stream)
|
|||
fprintf(stream, "SDU LCHID=%d, SDU nof_bytes=%d\n", lcid, nof_bytes);
|
||||
} else if (type == SCH_SUBH_TYPE) {
|
||||
if (parent->is_ul()) {
|
||||
switch (lcid) {
|
||||
case CRNTI:
|
||||
switch ((ul_sch_lcid)lcid) {
|
||||
case ul_sch_lcid::CRNTI:
|
||||
fprintf(stream, "C-RNTI CE\n");
|
||||
break;
|
||||
case PHR_REPORT:
|
||||
case ul_sch_lcid::PHR_REPORT:
|
||||
fprintf(stream, "PHR\n");
|
||||
break;
|
||||
case TRUNC_BSR:
|
||||
case ul_sch_lcid::TRUNC_BSR:
|
||||
fprintf(stream, "Truncated BSR CE\n");
|
||||
break;
|
||||
case SHORT_BSR:
|
||||
case ul_sch_lcid::SHORT_BSR:
|
||||
fprintf(stream, "Short BSR CE\n");
|
||||
break;
|
||||
case LONG_BSR:
|
||||
case ul_sch_lcid::LONG_BSR:
|
||||
fprintf(stream, "Long BSR CE\n");
|
||||
break;
|
||||
case PADDING:
|
||||
case ul_sch_lcid::PADDING:
|
||||
fprintf(stream, "PADDING\n");
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (lcid) {
|
||||
case CON_RES_ID:
|
||||
switch ((dl_sch_lcid)lcid) {
|
||||
case dl_sch_lcid::CON_RES_ID:
|
||||
fprintf(stream, "Contention Resolution ID CE: 0x%" PRIx64 "\n", get_con_res_id());
|
||||
break;
|
||||
case TA_CMD:
|
||||
case dl_sch_lcid::TA_CMD:
|
||||
fprintf(stream, "Time Advance Command CE: %d\n", get_ta_cmd());
|
||||
break;
|
||||
case DRX_CMD:
|
||||
case dl_sch_lcid::DRX_CMD:
|
||||
fprintf(stream, "DRX Command CE: Not implemented\n");
|
||||
break;
|
||||
case PADDING:
|
||||
case dl_sch_lcid::PADDING:
|
||||
fprintf(stream, "PADDING\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (type == MCH_SUBH_TYPE) {
|
||||
switch (lcid) {
|
||||
case MCH_SCHED_INFO:
|
||||
switch ((mch_lcid)lcid) {
|
||||
case mch_lcid::MCH_SCHED_INFO:
|
||||
fprintf(stream, "MCH Scheduling Info CE\n");
|
||||
break;
|
||||
case PADDING:
|
||||
case mch_lcid::PADDING:
|
||||
fprintf(stream, "PADDING\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -470,7 +470,7 @@ int mac_sch_pdu_pack_test6()
|
|||
// Try to Long BSR CE
|
||||
uint32_t buff_size[4] = {0, 1000, 5000, 19200000};
|
||||
TESTASSERT(pdu.new_subh());
|
||||
TESTASSERT(pdu.get()->set_bsr(buff_size, srslte::sch_subh::LONG_BSR));
|
||||
TESTASSERT(pdu.get()->set_bsr(buff_size, srslte::ul_sch_lcid::LONG_BSR));
|
||||
|
||||
// write PDU
|
||||
pdu.write_packet(srslte::log_ref{"MAC"});
|
||||
|
|
|
@ -264,12 +264,12 @@ int mac::ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_c
|
|||
srslte::rwlock_read_guard lock(rwlock);
|
||||
if (temp_crnti == crnti) {
|
||||
// if RNTI is maintained, Msg3 contained a RRC Setup Request
|
||||
scheduler.dl_mac_buffer_state(crnti, srslte::sch_subh::CON_RES_ID);
|
||||
scheduler.dl_mac_buffer_state(crnti, (uint32_t)srslte::dl_sch_lcid::CON_RES_ID);
|
||||
} else {
|
||||
// C-RNTI corresponds to older user. Handover scenario.
|
||||
phy_h->rem_rnti(crnti);
|
||||
phy_h->add_rnti(crnti, cfg->supported_cc_list[0].enb_cc_idx, false);
|
||||
scheduler.dl_mac_buffer_state(crnti, srslte::sch_subh::CON_RES_ID);
|
||||
scheduler.dl_mac_buffer_state(crnti, (uint32_t)srslte::dl_sch_lcid::CON_RES_ID);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ int mac::ta_info(uint32_t tti, uint16_t rnti, float ta_us)
|
|||
if (ue_db.count(rnti)) {
|
||||
uint32_t nof_ta_count = ue_db[rnti]->set_ta_us(ta_us);
|
||||
if (nof_ta_count) {
|
||||
scheduler.dl_mac_buffer_state(rnti, srslte::sch_subh::TA_CMD, nof_ta_count);
|
||||
scheduler.dl_mac_buffer_state(rnti, (uint32_t)srslte::dl_sch_lcid::TA_CMD, nof_ta_count);
|
||||
}
|
||||
}
|
||||
return SRSLTE_SUCCESS;
|
||||
|
@ -728,7 +728,7 @@ int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res
|
|||
tti);
|
||||
phy_h->set_mch_period_stop(mch.mtch_sched[mch.num_mtch_sched - 1].stop);
|
||||
for (uint32_t i = 0; i < mch.num_mtch_sched; i++) {
|
||||
mch.pdu[i].lcid = srslte::sch_subh::MCH_SCHED_INFO;
|
||||
mch.pdu[i].lcid = (uint32_t)srslte::mch_lcid::MCH_SCHED_INFO;
|
||||
// m1u.mtch_sched[i].lcid = 1+i;
|
||||
}
|
||||
|
||||
|
@ -817,7 +817,7 @@ int mac::get_ul_sched(uint32_t tti_tx_ul, ul_sched_list_t& ul_sched_res_list)
|
|||
for (auto& ue : ue_db) {
|
||||
uint32_t nof_ta_count = ue.second->tick_ta_fsm();
|
||||
if (nof_ta_count) {
|
||||
scheduler.dl_mac_buffer_state(ue.first, srslte::sch_subh::TA_CMD, nof_ta_count);
|
||||
scheduler.dl_mac_buffer_state(ue.first, (uint32_t)srslte::dl_sch_lcid::TA_CMD, nof_ta_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -352,14 +352,14 @@ bool ue::process_ce(srslte::sch_subh* subh)
|
|||
int32_t idx = 0;
|
||||
uint16_t old_rnti = 0;
|
||||
bool is_bsr = false;
|
||||
switch (subh->ce_type()) {
|
||||
case srslte::sch_subh::PHR_REPORT:
|
||||
switch (subh->ul_sch_ce_type()) {
|
||||
case srslte::ul_sch_lcid::PHR_REPORT:
|
||||
phr = subh->get_phr();
|
||||
Info("CE: Received PHR from rnti=0x%x, value=%.0f\n", rnti, phr);
|
||||
sched->ul_phr(rnti, (int)phr);
|
||||
metrics_phr(phr);
|
||||
break;
|
||||
case srslte::sch_subh::CRNTI:
|
||||
case srslte::ul_sch_lcid::CRNTI:
|
||||
old_rnti = subh->get_c_rnti();
|
||||
Info("CE: Received C-RNTI from temp_rnti=0x%x, rnti=0x%x\n", rnti, old_rnti);
|
||||
if (sched->ue_exists(old_rnti)) {
|
||||
|
@ -369,8 +369,8 @@ bool ue::process_ce(srslte::sch_subh* subh)
|
|||
Error("Updating user C-RNTI: rnti=0x%x already released\n", old_rnti);
|
||||
}
|
||||
break;
|
||||
case srslte::sch_subh::TRUNC_BSR:
|
||||
case srslte::sch_subh::SHORT_BSR:
|
||||
case srslte::ul_sch_lcid::TRUNC_BSR:
|
||||
case srslte::ul_sch_lcid::SHORT_BSR:
|
||||
idx = subh->get_bsr(buff_size);
|
||||
if (idx == -1) {
|
||||
Error("Invalid Index Passed to lc groups\n");
|
||||
|
@ -381,13 +381,13 @@ bool ue::process_ce(srslte::sch_subh* subh)
|
|||
sched->ul_bsr(rnti, lc_groups[idx][i], buff_size[idx]);
|
||||
}
|
||||
Info("CE: Received %s BSR rnti=0x%x, lcg=%d, value=%d\n",
|
||||
subh->ce_type() == srslte::sch_subh::SHORT_BSR ? "Short" : "Trunc",
|
||||
subh->ul_sch_ce_type() == srslte::ul_sch_lcid::SHORT_BSR ? "Short" : "Trunc",
|
||||
rnti,
|
||||
idx,
|
||||
buff_size[idx]);
|
||||
is_bsr = true;
|
||||
break;
|
||||
case srslte::sch_subh::LONG_BSR:
|
||||
case srslte::ul_sch_lcid::LONG_BSR:
|
||||
subh->get_bsr(buff_size);
|
||||
for (idx = 0; idx < 4; idx++) {
|
||||
for (uint32_t i = 0; i < lc_groups[idx].size(); i++) {
|
||||
|
@ -402,11 +402,11 @@ bool ue::process_ce(srslte::sch_subh* subh)
|
|||
buff_size[2],
|
||||
buff_size[3]);
|
||||
break;
|
||||
case srslte::sch_subh::PADDING:
|
||||
case srslte::ul_sch_lcid::PADDING:
|
||||
Debug("CE: Received padding for rnti=0x%x\n", rnti);
|
||||
break;
|
||||
default:
|
||||
Error("CE: Invalid lcid=0x%x\n", subh->ce_type());
|
||||
Error("CE: Invalid lcid=0x%x\n", (int)subh->ul_sch_ce_type());
|
||||
break;
|
||||
}
|
||||
return is_bsr;
|
||||
|
@ -443,8 +443,8 @@ void ue::allocate_sdu(srslte::sch_pdu* pdu, uint32_t lcid, uint32_t total_sdu_le
|
|||
|
||||
void ue::allocate_ce(srslte::sch_pdu* pdu, uint32_t lcid)
|
||||
{
|
||||
switch ((srslte::sch_subh::cetype)lcid) {
|
||||
case srslte::sch_subh::TA_CMD:
|
||||
switch ((srslte::dl_sch_lcid)lcid) {
|
||||
case srslte::dl_sch_lcid::TA_CMD:
|
||||
if (pdu->new_subh()) {
|
||||
uint32_t ta_cmd = 31;
|
||||
pending_ta_commands.try_pop(&ta_cmd);
|
||||
|
@ -457,7 +457,7 @@ void ue::allocate_ce(srslte::sch_pdu* pdu, uint32_t lcid)
|
|||
Error("CE: Setting TA CMD CE. No space for a subheader\n");
|
||||
}
|
||||
break;
|
||||
case srslte::sch_subh::CON_RES_ID:
|
||||
case srslte::dl_sch_lcid::CON_RES_ID:
|
||||
if (pdu->new_subh()) {
|
||||
if (pdu->get()->set_con_res_id(conres_id)) {
|
||||
Info("CE: Added Contention Resolution ID=0x%" PRIx64 "\n", conres_id);
|
||||
|
@ -468,7 +468,7 @@ void ue::allocate_ce(srslte::sch_pdu* pdu, uint32_t lcid)
|
|||
Error("CE: Setting Contention Resolution ID CE. No space for a subheader\n");
|
||||
}
|
||||
break;
|
||||
case srslte::sch_subh::SCELL_ACTIVATION:
|
||||
case srslte::dl_sch_lcid::SCELL_ACTIVATION:
|
||||
if (pdu->new_subh()) {
|
||||
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 = {};
|
||||
|
@ -515,7 +515,7 @@ uint8_t* ue::generate_pdu(uint32_t ue_cc_idx,
|
|||
tx_payload_buffer[ue_cc_idx][harq_pid][tb_idx]->clear();
|
||||
mac_msg_dl.init_tx(tx_payload_buffer[ue_cc_idx][harq_pid][tb_idx].get(), grant_size, false);
|
||||
for (uint32_t i = 0; i < nof_pdu_elems; i++) {
|
||||
if (pdu[i].lcid <= srslte::sch_subh::PHR_REPORT) {
|
||||
if (pdu[i].lcid <= (uint32_t)srslte::ul_sch_lcid::PHR_REPORT) {
|
||||
allocate_sdu(&mac_msg_dl, pdu[i].lcid, pdu[i].nbytes);
|
||||
} else {
|
||||
allocate_ce(&mac_msg_dl, pdu[i].lcid);
|
||||
|
@ -543,13 +543,13 @@ uint8_t* ue::generate_mch_pdu(uint32_t harq_pid,
|
|||
mch_mac_msg_dl.init_tx(tx_payload_buffer[0][harq_pid][0].get(), grant_size);
|
||||
|
||||
for (uint32_t i = 0; i < nof_pdu_elems; i++) {
|
||||
if (sched.pdu[i].lcid == srslte::sch_subh::MCH_SCHED_INFO) {
|
||||
if (sched.pdu[i].lcid == (uint32_t)srslte::mch_lcid::MCH_SCHED_INFO) {
|
||||
mch_mac_msg_dl.new_subh();
|
||||
mch_mac_msg_dl.get()->set_next_mch_sched_info(sched.mtch_sched[i].lcid, sched.mtch_sched[i].stop);
|
||||
} else if (sched.pdu[i].lcid == 0) {
|
||||
mch_mac_msg_dl.new_subh();
|
||||
mch_mac_msg_dl.get()->set_sdu(0, sched.pdu[i].nbytes, sched.mcch_payload);
|
||||
} else if (sched.pdu[i].lcid <= srslte::sch_subh::MTCH_MAX_LCID) {
|
||||
} else if (sched.pdu[i].lcid <= (uint32_t)srslte::mch_lcid::MTCH_MAX_LCID) {
|
||||
mch_mac_msg_dl.new_subh();
|
||||
mch_mac_msg_dl.get()->set_sdu(sched.pdu[i].lcid, sched.pdu[i].nbytes, sched.mtch_sched[i].mtch_payload);
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ int user_state_sched_tester::test_ra(uint32_t enb_
|
|||
if (dl_result.data[i].dci.rnti == rnti) {
|
||||
CONDERROR(tic < userinfo.msg3_tic, "Msg4 cannot be scheduled without Msg3 being tx\n");
|
||||
for (uint32_t j = 0; j < dl_result.data[i].nof_pdu_elems[0]; ++j) {
|
||||
if (dl_result.data[i].pdu[0][j].lcid == srslte::sch_subh::CON_RES_ID) {
|
||||
if (dl_result.data[i].pdu[0][j].lcid == (uint32_t)srslte::dl_sch_lcid::CON_RES_ID) {
|
||||
// ConRes found
|
||||
CONDERROR(dl_result.data[i].dci.format != SRSLTE_DCI_FORMAT1, "ConRes must be format1\n");
|
||||
CONDERROR(userinfo.msg4_tic.is_valid(), "Duplicate ConRes CE for the same rnti\n");
|
||||
|
|
|
@ -40,8 +40,7 @@ demux::demux(log_ref log_h_) :
|
|||
phy_h(nullptr),
|
||||
time_alignment_timer(nullptr),
|
||||
mac(nullptr)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void demux::init(phy_interface_mac_common* phy_,
|
||||
rlc_interface_mac* rlc_,
|
||||
|
@ -100,14 +99,14 @@ void demux::push_pdu_temp_crnti(uint8_t* buff, uint32_t nof_bytes)
|
|||
// Look for Contention Resolution UE ID and TA commands
|
||||
is_uecrid_successful = false;
|
||||
while (pending_mac_msg.next()) {
|
||||
switch (pending_mac_msg.get()->ce_type()) {
|
||||
case srslte::sch_subh::CON_RES_ID:
|
||||
switch (pending_mac_msg.get()->dl_sch_ce_type()) {
|
||||
case srslte::dl_sch_lcid::CON_RES_ID:
|
||||
if (!is_uecrid_successful) {
|
||||
Debug("Found Contention Resolution ID CE\n");
|
||||
is_uecrid_successful = mac->contention_resolution_id_rcv(pending_mac_msg.get()->get_con_res_id());
|
||||
}
|
||||
break;
|
||||
case srslte::sch_subh::TA_CMD:
|
||||
case srslte::dl_sch_lcid::TA_CMD:
|
||||
parse_ta_cmd(pending_mac_msg.get());
|
||||
break;
|
||||
default:
|
||||
|
@ -246,7 +245,7 @@ void demux::process_mch_pdu(srslte::mch_pdu* mch_msg)
|
|||
// disgarding headers that have already been processed
|
||||
while (mch_msg->next()) {
|
||||
|
||||
if (srslte::sch_subh::MCH_SCHED_INFO == mch_msg->get()->ce_type()) {
|
||||
if (srslte::mch_lcid::MCH_SCHED_INFO == mch_msg->get()->mch_ce_type()) {
|
||||
uint16_t stop;
|
||||
uint8_t lcid;
|
||||
if (mch_msg->get()->get_next_mch_sched_info(&lcid, &stop)) {
|
||||
|
@ -281,22 +280,22 @@ void demux::mch_start_rx(uint32_t lcid)
|
|||
bool demux::process_ce(srslte::sch_subh* subh)
|
||||
{
|
||||
uint32_t cc_idx = 0;
|
||||
switch (subh->ce_type()) {
|
||||
case srslte::sch_subh::CON_RES_ID:
|
||||
switch (subh->dl_sch_ce_type()) {
|
||||
case srslte::dl_sch_lcid::CON_RES_ID:
|
||||
// Do nothing
|
||||
break;
|
||||
case srslte::sch_subh::TA_CMD:
|
||||
case srslte::dl_sch_lcid::TA_CMD:
|
||||
parse_ta_cmd(subh);
|
||||
break;
|
||||
case srslte::sch_subh::SCELL_ACTIVATION:
|
||||
case srslte::dl_sch_lcid::SCELL_ACTIVATION:
|
||||
cc_idx = (uint32_t)subh->get_activation_deactivation_cmd();
|
||||
phy_h->set_activation_deactivation_scell(cc_idx);
|
||||
mac->reset_harq(cc_idx);
|
||||
break;
|
||||
case srslte::sch_subh::PADDING:
|
||||
case srslte::dl_sch_lcid::PADDING:
|
||||
break;
|
||||
default:
|
||||
Error("MAC CE 0x%x not supported\n", subh->ce_type());
|
||||
Error("MAC CE 0x%x not supported\n", subh->lcid_value());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -396,7 +396,7 @@ void mac::mch_decoded(uint32_t len, bool crc)
|
|||
mch_msg.parse_packet(mch_payload_buffer);
|
||||
while (mch_msg.next()) {
|
||||
for (uint32_t i = 0; i < phy_mbsfn_cfg.nof_mbsfn_services; i++) {
|
||||
if (srslte::sch_subh::MCH_SCHED_INFO == mch_msg.get()->ce_type()) {
|
||||
if (srslte::mch_lcid::MCH_SCHED_INFO == mch_msg.get()->mch_ce_type()) {
|
||||
uint16_t stop;
|
||||
uint8_t lcid;
|
||||
if (mch_msg.get()->get_next_mch_sched_info(&lcid, &stop)) {
|
||||
|
|
|
@ -151,16 +151,16 @@ void mux::print_logical_channel_state(const std::string& info)
|
|||
log_h->debug("%s\n", logline.c_str());
|
||||
}
|
||||
|
||||
srslte::sch_subh::cetype bsr_format_convert(bsr_proc::bsr_format_t format)
|
||||
srslte::ul_sch_lcid bsr_format_convert(bsr_proc::bsr_format_t format)
|
||||
{
|
||||
switch (format) {
|
||||
case bsr_proc::LONG_BSR:
|
||||
return srslte::sch_subh::LONG_BSR;
|
||||
return srslte::ul_sch_lcid::LONG_BSR;
|
||||
case bsr_proc::TRUNC_BSR:
|
||||
return srslte::sch_subh::TRUNC_BSR;
|
||||
return srslte::ul_sch_lcid::TRUNC_BSR;
|
||||
case bsr_proc::SHORT_BSR:
|
||||
default:
|
||||
return srslte::sch_subh::SHORT_BSR;
|
||||
return srslte::ul_sch_lcid::SHORT_BSR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -640,30 +640,30 @@ public:
|
|||
int32_t idx = 0;
|
||||
uint16_t old_rnti = 0;
|
||||
bool is_bsr = false;
|
||||
switch (subh->ce_type()) {
|
||||
case srslte::sch_subh::PHR_REPORT:
|
||||
switch (subh->ul_sch_ce_type()) {
|
||||
case srslte::ul_sch_lcid::PHR_REPORT:
|
||||
phr = subh->get_phr();
|
||||
ss_mac_log->info("CE: Received PHR from rnti=0x%x, value=%.0f\n", rnti, phr);
|
||||
break;
|
||||
case srslte::sch_subh::CRNTI:
|
||||
case srslte::ul_sch_lcid::CRNTI:
|
||||
old_rnti = subh->get_c_rnti();
|
||||
ss_mac_log->info("CE: Received C-RNTI from temp_rnti=0x%x, rnti=0x%x\n", rnti, old_rnti);
|
||||
break;
|
||||
case srslte::sch_subh::TRUNC_BSR:
|
||||
case srslte::sch_subh::SHORT_BSR:
|
||||
case srslte::ul_sch_lcid::TRUNC_BSR:
|
||||
case srslte::ul_sch_lcid::SHORT_BSR:
|
||||
idx = subh->get_bsr(buff_size);
|
||||
if (idx == -1) {
|
||||
ss_mac_log->error("Invalid Index Passed to lc groups\n");
|
||||
break;
|
||||
}
|
||||
ss_mac_log->info("CE: Received %s BSR rnti=0x%x, lcg=%d, value=%d\n",
|
||||
subh->ce_type() == srslte::sch_subh::SHORT_BSR ? "Short" : "Trunc",
|
||||
subh->ul_sch_ce_type() == srslte::ul_sch_lcid::SHORT_BSR ? "Short" : "Trunc",
|
||||
rnti,
|
||||
idx,
|
||||
buff_size[idx]);
|
||||
is_bsr = true;
|
||||
break;
|
||||
case srslte::sch_subh::LONG_BSR:
|
||||
case srslte::ul_sch_lcid::LONG_BSR:
|
||||
subh->get_bsr(buff_size);
|
||||
is_bsr = true;
|
||||
ss_mac_log->info("CE: Received Long BSR rnti=0x%x, value=%d,%d,%d,%d\n",
|
||||
|
@ -673,11 +673,11 @@ public:
|
|||
buff_size[2],
|
||||
buff_size[3]);
|
||||
break;
|
||||
case srslte::sch_subh::PADDING:
|
||||
case srslte::ul_sch_lcid::PADDING:
|
||||
ss_mac_log->debug("CE: Received padding for rnti=0x%x\n", rnti);
|
||||
break;
|
||||
default:
|
||||
ss_mac_log->error("CE: Invalid lcid=0x%x\n", subh->ce_type());
|
||||
ss_mac_log->error("CE: Invalid lcid=0x%x\n", subh->lcid_value());
|
||||
break;
|
||||
}
|
||||
return is_bsr;
|
||||
|
|
Loading…
Reference in New Issue