adding fixes and tests for eMBMS

This commit is contained in:
yagoda 2019-07-12 16:27:13 +02:00 committed by Andre Puschmann
parent 424876c5e4
commit 408400bee6
6 changed files with 73 additions and 14 deletions

View File

@ -398,6 +398,8 @@ private:
last_sdu_idx = -1;
reset();
for (uint32_t i = 0; i < max_subheaders; i++) {
mch_subh subh;
subheaders[i] = subh;
subheaders[i].parent = this;
subheaders[i].init();
}

View File

@ -249,8 +249,6 @@ int srslte_chest_dl_set_mbsfn_area_id(srslte_chest_dl_t* q, uint16_t mbsfn_area_
if(srslte_refsignal_mbsfn_init(q->mbsfn_refs[mbsfn_area_id], q->cell.nof_prb)) {
return SRSLTE_ERROR;
}
}
if(q->mbsfn_refs[mbsfn_area_id]) {
if(srslte_refsignal_mbsfn_set_cell(q->mbsfn_refs[mbsfn_area_id], q->cell, mbsfn_area_id)) {
return SRSLTE_ERROR;
}

View File

@ -516,6 +516,59 @@ int mac_sch_pdu_pack_error_test()
return SRSLTE_SUCCESS;
}
int mac_mch_pdu_pack_test1() {
static uint8_t tv[] = {0x3e, 0x02, 0x20, 0x05, 0x21, 0x0a, 0x1f, 0x0f,
0xff, 0x01, 0x02, 0x03, 0x04, 0x05, 0x02, 0x04,
0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
srslte::log_filter mac_log("MAC");
mac_log.set_level(srslte::LOG_LEVEL_DEBUG);
mac_log.set_hex_limit(100000);
const uint32_t pdu_size = 30;
srslte::mch_pdu mch_pdu(10, &mac_log);
byte_buffer_t buffer;
mch_pdu.init_tx(&buffer, pdu_size, true);
TESTASSERT(mch_pdu.rem_size() == pdu_size);
TESTASSERT(mch_pdu.get_pdu_len() == pdu_size);
TESTASSERT(mch_pdu.get_sdu_space() == pdu_size - 1);
TESTASSERT(mch_pdu.get_current_sdu_ptr() == buffer.msg);
// Add first subheader and SDU
TESTASSERT(mch_pdu.new_subh());
TESTASSERT(mch_pdu.get()->set_next_mch_sched_info(1, 0));
// Add second SCH
TESTASSERT(mch_pdu.new_subh());
uint8_t sdu[5] = {1, 2, 3, 4, 5};
TESTASSERT(mch_pdu.get()->set_sdu(0, 5, sdu) == 5);
TESTASSERT(mch_pdu.new_subh());
uint8_t sdu1[10] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
mch_pdu.get()->set_sdu(1, 10, sdu1);
// write PDU
TESTASSERT(mch_pdu.write_packet(&mac_log) == buffer.msg);
// log
mac_log.info_hex(buffer.msg, buffer.N_bytes, "MAC PDU (%d B):\n",
buffer.N_bytes);
#if HAVE_PCAP
pcap_handle->write_ul_crnti(buffer.msg, buffer.N_bytes, 0x1001, true, 1);
#endif
// compare with TV
TESTASSERT(memcmp(buffer.msg, tv, sizeof(buffer.N_bytes)) == 0);
#if HAVE_PCAP
pcap_handle->write_ul_crnti(tv, sizeof(tv), 0x1001, true, 1);
#endif
return SRSLTE_SUCCESS;
}
// Parsing a corrupted MAC PDU and making sure the PDU is reset and not further processed
int mac_sch_pdu_unpack_test1()
{
@ -596,6 +649,11 @@ int main(int argc, char** argv)
fprintf(stderr, "mac_sch_pdu_pack_error_test failed.\n");
return SRSLTE_ERROR;
}
if (mac_mch_pdu_pack_test1()) {
fprintf(stderr, "mac_mch_pdu_pack_test1 failed.\n");
return SRSLTE_ERROR;
}
if (mac_sch_pdu_unpack_test1()) {
fprintf(stderr, "mac_sch_pdu_unpack_test1 failed.\n");

View File

@ -576,7 +576,7 @@ sched::sched() : bc_aggr_level(0), rar_aggr_level(0), P(0), si_n_rbg(0), rar_n_r
bzero(&sched_cfg, sizeof(sched_cfg));
bzero(&common_locations, sizeof(common_locations));
bzero(&pdsch_re, sizeof(pdsch_re));
tti_dl_mask.resize(10, 1);
tti_dl_mask.resize(10, 0);
for (int i = 0; i < 3; i++) {
bzero(rar_locations[i], sizeof(sched_ue::sched_dci_cce_t) * 10);
@ -1057,7 +1057,7 @@ sched::tti_sched_t* sched::new_tti(uint32_t tti_rx)
generate_phich(tti_sched);
/* Schedule DL */
if (tti_dl_mask[tti_rx % tti_dl_mask.size()] > 0) {
if (tti_dl_mask[tti_sched->get_tti_tx_dl() % tti_dl_mask.size()] == 0) {
generate_dl_sched(tti_sched);
}

View File

@ -349,11 +349,7 @@ public:
private:
typedef struct {
enum {
PDU,
PCCH,
STOP
} command;
enum { PDU, PCCH, STOP, MBMS_START } command;
srslte::unique_byte_buffer_t pdu;
uint16_t lcid;
} cmd_msg_t;

View File

@ -214,6 +214,13 @@ void rrc::run_thread() {
case cmd_msg_t::PCCH:
process_pcch(std::move(msg.pdu));
break;
case cmd_msg_t::MBMS_START:
if (args.mbms_service_id >= 0) {
rrc_log->info("Attempting to auto-start MBMS service %d\n",
args.mbms_service_id);
mbms_service_start(args.mbms_service_id, args.mbms_service_port);
}
break;
case cmd_msg_t::STOP:
return;
}
@ -2116,11 +2123,9 @@ void rrc::write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
serving_cell->has_mcch = true;
phy->set_config_mbsfn_mcch(&serving_cell->mcch);
log_rrc_message("MCH", Rx, pdu.get(), serving_cell->mcch);
if (args.mbms_service_id >= 0) {
rrc_log->info("Attempting to auto-start MBMS service %d\n", args.mbms_service_id);
mbms_service_start(args.mbms_service_id, args.mbms_service_port);
}
cmd_msg_t msg;
msg.command = cmd_msg_t::MBMS_START;
cmd_q.push(std::move(msg));
}
}
}