|
|
@ -443,13 +443,13 @@ int mac_sch_pdu_pack_test5()
|
|
|
|
mac_log->info_hex(buffer.msg, buffer.N_bytes, "MAC PDU (%d B):\n", buffer.N_bytes);
|
|
|
|
mac_log->info_hex(buffer.msg, buffer.N_bytes, "MAC PDU (%d B):\n", buffer.N_bytes);
|
|
|
|
|
|
|
|
|
|
|
|
#if HAVE_PCAP
|
|
|
|
#if HAVE_PCAP
|
|
|
|
pcap_handle->write_ul_crnti(buffer.msg, buffer.N_bytes, 0x1001, true, 1);
|
|
|
|
pcap_handle->write_ul_crnti(buffer.msg, buffer.N_bytes, 0x1001, true, 1, 0);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Test for BSR CE
|
|
|
|
// Test for Long BSR CE
|
|
|
|
int mac_sch_pdu_pack_test6()
|
|
|
|
int mac_sch_pdu_pack_test6()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
srslte::log_ref mac_log("MAC");
|
|
|
|
srslte::log_ref mac_log("MAC");
|
|
|
@ -577,7 +577,90 @@ int mac_sch_pdu_pack_test8()
|
|
|
|
log_h->info_hex(buffer.msg, buffer.N_bytes, "MAC PDU with SCell Activation CE (%d B):\n", buffer.N_bytes);
|
|
|
|
log_h->info_hex(buffer.msg, buffer.N_bytes, "MAC PDU with SCell Activation CE (%d B):\n", buffer.N_bytes);
|
|
|
|
|
|
|
|
|
|
|
|
#if HAVE_PCAP
|
|
|
|
#if HAVE_PCAP
|
|
|
|
pcap_handle->write_dl_crnti(tv, sizeof(tv), 0x1001, true, 1);
|
|
|
|
pcap_handle->write_dl_crnti(tv, sizeof(tv), 0x1001, true, 1, 0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test for Short BSR CE
|
|
|
|
|
|
|
|
int mac_sch_pdu_pack_test9()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
srslte::log_ref mac_log("MAC");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t pdu_size = 3;
|
|
|
|
|
|
|
|
srslte::sch_pdu pdu(10, srslte::log_ref{"MAC"});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t tv[pdu_size] = {0x3f, 0x1d, 0x0a};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte_buffer_t buffer;
|
|
|
|
|
|
|
|
pdu.init_tx(&buffer, pdu_size, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TESTASSERT(pdu.rem_size() == pdu_size);
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get_pdu_len() == pdu_size);
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get_sdu_space() == pdu_size - 1);
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get_current_sdu_ptr() == buffer.msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Try to add short BSR CE
|
|
|
|
|
|
|
|
uint32_t buff_size[4] = {36, 0, 0, 0};
|
|
|
|
|
|
|
|
TESTASSERT(pdu.new_subh());
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get()->set_bsr(buff_size, srslte::ul_sch_lcid::SHORT_BSR));
|
|
|
|
|
|
|
|
TESTASSERT(pdu.new_subh() == false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// write PDU
|
|
|
|
|
|
|
|
pdu.write_packet(srslte::log_ref{"MAC"});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// compare with tv
|
|
|
|
|
|
|
|
TESTASSERT(memcmp(buffer.msg, tv, buffer.N_bytes) == 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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, 0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test for Short BSR CE + PHR CE
|
|
|
|
|
|
|
|
int mac_sch_pdu_pack_test10()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
srslte::log_ref mac_log("MAC");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t pdu_size = 4;
|
|
|
|
|
|
|
|
srslte::sch_pdu pdu(10, srslte::log_ref{"MAC"});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t tv[pdu_size] = {0x3d, 0x1a, 0x20, 0x21};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte_buffer_t buffer;
|
|
|
|
|
|
|
|
pdu.init_tx(&buffer, pdu_size, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TESTASSERT(pdu.rem_size() == pdu_size);
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get_pdu_len() == pdu_size);
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get_sdu_space() == pdu_size - 1);
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get_current_sdu_ptr() == buffer.msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Try to add short BSR CE
|
|
|
|
|
|
|
|
uint32_t buff_size[4] = {1132, 0, 0, 0};
|
|
|
|
|
|
|
|
TESTASSERT(pdu.new_subh());
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get()->set_bsr(buff_size, srslte::ul_sch_lcid::SHORT_BSR));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Try to add PHR CE
|
|
|
|
|
|
|
|
TESTASSERT(pdu.new_subh());
|
|
|
|
|
|
|
|
TESTASSERT(pdu.get()->set_phr(10.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// write PDU
|
|
|
|
|
|
|
|
pdu.write_packet(srslte::log_ref{"MAC"});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// compare with tv
|
|
|
|
|
|
|
|
TESTASSERT(memcmp(buffer.msg, tv, buffer.N_bytes) == 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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, 0);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
@ -763,82 +846,28 @@ int main(int argc, char** argv)
|
|
|
|
mac_log->set_level(srslte::LOG_LEVEL_DEBUG);
|
|
|
|
mac_log->set_level(srslte::LOG_LEVEL_DEBUG);
|
|
|
|
mac_log->set_hex_limit(100000);
|
|
|
|
mac_log->set_hex_limit(100000);
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_rar_pdu_unpack_test1()) {
|
|
|
|
TESTASSERT(mac_rar_pdu_unpack_test1() == SRSLTE_SUCCESS);
|
|
|
|
fprintf(stderr, "mac_rar_pdu_unpack_test1 failed.\n");
|
|
|
|
TESTASSERT(mac_rar_pdu_unpack_test2() == SRSLTE_SUCCESS);
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
TESTASSERT(mac_rar_pdu_pack_test1() == SRSLTE_SUCCESS);
|
|
|
|
}
|
|
|
|
TESTASSERT(mac_rar_pdu_pack_test2() == SRSLTE_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_rar_pdu_unpack_test2()) {
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test1() == SRSLTE_SUCCESS);
|
|
|
|
fprintf(stderr, "mac_rar_pdu_unpack_test2 failed.\n");
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test2() == SRSLTE_SUCCESS);
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test3() == SRSLTE_SUCCESS);
|
|
|
|
}
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test4() == SRSLTE_SUCCESS);
|
|
|
|
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test5() == SRSLTE_SUCCESS);
|
|
|
|
if (mac_rar_pdu_pack_test1()) {
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test6() == SRSLTE_SUCCESS);
|
|
|
|
fprintf(stderr, "mac_rar_pdu_pack_test1 failed.\n");
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test7() == SRSLTE_SUCCESS);
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test8() == SRSLTE_SUCCESS);
|
|
|
|
}
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test9() == SRSLTE_SUCCESS);
|
|
|
|
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test10() == SRSLTE_SUCCESS);
|
|
|
|
if (mac_rar_pdu_pack_test2()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_rar_pdu_pack_test2 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_test1()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_sch_pdu_pack_test1 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_test2()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_sch_pdu_pack_test2 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_test3()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_sch_pdu_pack_test3 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_test4()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_sch_pdu_pack_test4 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_test5()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_sch_pdu_pack_test5 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_test6()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_sch_pdu_pack_test6 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_test7()) {
|
|
|
|
|
|
|
|
fprintf(stderr, "mac_sch_pdu_pack_test7 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_pack_error_test()) {
|
|
|
|
|
|
|
|
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()) {
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_error_test() == SRSLTE_SUCCESS);
|
|
|
|
fprintf(stderr, "mac_sch_pdu_unpack_test1 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mac_sch_pdu_unpack_test2()) {
|
|
|
|
TESTASSERT(mac_mch_pdu_pack_test1() == SRSLTE_SUCCESS);
|
|
|
|
fprintf(stderr, "mac_sch_pdu_unpack_test2 failed.\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TESTASSERT(mac_sch_pdu_pack_test8() == SRSLTE_SUCCESS);
|
|
|
|
TESTASSERT(mac_sch_pdu_unpack_test1() == SRSLTE_SUCCESS);
|
|
|
|
|
|
|
|
TESTASSERT(mac_sch_pdu_unpack_test2() == SRSLTE_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
TESTASSERT(mac_slsch_pdu_unpack_test1() == SRSLTE_SUCCESS);
|
|
|
|
TESTASSERT(mac_slsch_pdu_unpack_test1() == SRSLTE_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|