mac_pdu: unpack and print BSR index as well as BSR value in bytes

before the BSR was extracted but the actual index (between 0 and 63)
was not stored but directly converted into bytes.

for log parsing and debugging it is easier to follow the index
value. this patch therefore adds both values to the log message
and extends the API accordingly.
This commit is contained in:
Andre Puschmann 2020-08-20 14:30:03 +02:00
parent 55336665b9
commit 5e40bfe72c
4 changed files with 33 additions and 30 deletions

View File

@ -322,7 +322,7 @@ public:
uint8_t get_ta_cmd();
uint8_t get_activation_deactivation_cmd();
float get_phr();
int get_bsr(uint32_t buff_size[4]);
int get_bsr(uint32_t buff_size_idx[4], uint32_t buff_size_bytes[4]);
bool get_next_mch_sched_info(uint8_t* lcid, uint16_t* mtch_stop);

View File

@ -570,25 +570,25 @@ float sch_subh::get_phr()
}
}
int sch_subh::get_bsr(uint32_t buff_size[4])
int sch_subh::get_bsr(uint32_t buff_size_idx[4], uint32_t buff_size_bytes[4])
{
if (payload) {
uint32_t nonzero_lcg = 0;
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;
buff_size[3] = (payload[2] & 0x3F);
buff_size_idx[0] = (payload[0] & 0xFC) >> 2;
buff_size_idx[1] = (payload[0] & 0x03) << 4 | (payload[1] & 0xF0) >> 4;
buff_size_idx[2] = (payload[1] & 0x0F) << 4 | (payload[1] & 0xC0) >> 6;
buff_size_idx[3] = (payload[2] & 0x3F);
} else {
nonzero_lcg = (payload[0] & 0xc0) >> 6;
buff_size[nonzero_lcg % 4] = payload[0] & 0x3f;
buff_size_idx[nonzero_lcg % 4] = payload[0] & 0x3f;
}
for (int i = 0; i < 4; i++) {
if (buff_size[i]) {
if (buff_size[i] < 63) {
buff_size[i] = btable[1 + buff_size[i]];
if (buff_size_idx[i] > 0) {
if (buff_size_idx[i] < 63) {
buff_size_bytes[i] = btable[1 + buff_size_idx[i]];
} else {
buff_size[i] = btable[63];
buff_size_bytes[i] = btable[63];
}
}
}

View File

@ -332,7 +332,8 @@ void ue::push_pdu(const uint32_t ue_cc_idx, const uint32_t tti, uint32_t len)
bool ue::process_ce(srslte::sch_subh* subh)
{
uint32_t buff_size[4] = {0, 0, 0, 0};
uint32_t buff_size_idx[4] = {};
uint32_t buff_size_bytes[4] = {};
float phr = 0;
int32_t idx = 0;
uint16_t old_rnti = 0;
@ -356,32 +357,33 @@ bool ue::process_ce(srslte::sch_subh* subh)
break;
case srslte::ul_sch_lcid::TRUNC_BSR:
case srslte::ul_sch_lcid::SHORT_BSR:
idx = subh->get_bsr(buff_size);
idx = subh->get_bsr(buff_size_idx, buff_size_bytes);
if (idx == -1) {
Error("Invalid Index Passed to lc groups\n");
break;
}
// Indicate BSR to scheduler
sched->ul_bsr(rnti, idx, buff_size[idx]);
Info("CE: Received %s BSR rnti=0x%x, lcg=%d, value=%d\n",
sched->ul_bsr(rnti, idx, buff_size_bytes[idx]);
Info("CE: Received %s BSR rnti=0x%x, lcg=%d, value=%d (%d B)\n",
subh->ul_sch_ce_type() == srslte::ul_sch_lcid::SHORT_BSR ? "Short" : "Trunc",
rnti,
idx,
buff_size[idx]);
buff_size_idx[idx],
buff_size_bytes[idx]);
is_bsr = true;
break;
case srslte::ul_sch_lcid::LONG_BSR:
subh->get_bsr(buff_size);
subh->get_bsr(buff_size_idx, buff_size_bytes);
for (idx = 0; idx < sched_interface::MAX_LC_GROUP; ++idx) {
sched->ul_bsr(rnti, idx, buff_size[idx]);
sched->ul_bsr(rnti, idx, buff_size_bytes[idx]);
}
is_bsr = true;
Info("CE: Received Long BSR rnti=0x%x, value=%d,%d,%d,%d\n",
rnti,
buff_size[0],
buff_size[1],
buff_size[2],
buff_size[3]);
buff_size_idx[0],
buff_size_idx[1],
buff_size_idx[2],
buff_size_idx[3]);
break;
case srslte::ul_sch_lcid::PADDING:
Debug("CE: Received padding for rnti=0x%x\n", rnti);

View File

@ -639,7 +639,8 @@ bool ttcn3_syssim::process_ce(srslte::sch_subh* subh)
{
uint16_t rnti = dl_rnti;
uint32_t buff_size[4] = {0, 0, 0, 0};
uint32_t buff_size_idx[4] = {};
uint32_t buff_size_bytes[4] = {};
float phr = 0;
int32_t idx = 0;
uint16_t old_rnti = 0;
@ -655,7 +656,7 @@ bool ttcn3_syssim::process_ce(srslte::sch_subh* subh)
break;
case srslte::ul_sch_lcid::TRUNC_BSR:
case srslte::ul_sch_lcid::SHORT_BSR:
idx = subh->get_bsr(buff_size);
idx = subh->get_bsr(buff_size_idx, buff_size_bytes);
if (idx == -1) {
ss_mac_log->error("Invalid Index Passed to lc groups\n");
break;
@ -664,18 +665,18 @@ bool ttcn3_syssim::process_ce(srslte::sch_subh* subh)
subh->ul_sch_ce_type() == srslte::ul_sch_lcid::SHORT_BSR ? "Short" : "Trunc",
rnti,
idx,
buff_size[idx]);
buff_size_idx[idx]);
is_bsr = true;
break;
case srslte::ul_sch_lcid::LONG_BSR:
subh->get_bsr(buff_size);
subh->get_bsr(buff_size_idx, buff_size_bytes);
is_bsr = true;
ss_mac_log->info("CE: Received Long BSR rnti=0x%x, value=%d,%d,%d,%d\n",
rnti,
buff_size[0],
buff_size[1],
buff_size[2],
buff_size[3]);
buff_size_idx[0],
buff_size_idx[1],
buff_size_idx[2],
buff_size_idx[3]);
break;
case srslte::ul_sch_lcid::PADDING:
ss_mac_log->debug("CE: Received padding for rnti=0x%x\n", rnti);