|
|
|
@ -85,12 +85,18 @@ public:
|
|
|
|
|
void write_pdu_bcch_bch(byte_buffer_t *sdu) {}
|
|
|
|
|
void write_pdu_bcch_dlsch(byte_buffer_t *sdu) {}
|
|
|
|
|
void write_pdu_pcch(byte_buffer_t *sdu) {}
|
|
|
|
|
void write_pdu_mch(uint32_t lcid, srslte::byte_buffer_t *sdu)
|
|
|
|
|
{
|
|
|
|
|
assert(lcid == 3);
|
|
|
|
|
sdus[n_sdus++] = sdu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RRC interface
|
|
|
|
|
void max_retx_attempted(){}
|
|
|
|
|
std::string get_rb_name(uint32_t lcid) { return std::string(""); }
|
|
|
|
|
void set_expected_sdu_len(uint32_t len) { expected_sdu_len = len; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte_buffer_t *sdus[MAX_NBUFS];
|
|
|
|
|
int n_sdus;
|
|
|
|
|
uint32_t expected_sdu_len;
|
|
|
|
@ -235,6 +241,70 @@ void loss_test()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void basic_mbsfn_test()
|
|
|
|
|
{
|
|
|
|
|
srslte::log_filter log1("RLC_UM_1");
|
|
|
|
|
srslte::log_filter log2("RLC_UM_2");
|
|
|
|
|
log1.set_level(srslte::LOG_LEVEL_DEBUG);
|
|
|
|
|
log2.set_level(srslte::LOG_LEVEL_DEBUG);
|
|
|
|
|
log1.set_hex_limit(-1);
|
|
|
|
|
log2.set_hex_limit(-1);
|
|
|
|
|
rlc_um_tester tester;
|
|
|
|
|
mac_dummy_timers timers;
|
|
|
|
|
|
|
|
|
|
rlc_um rlc1;
|
|
|
|
|
rlc_um rlc2;
|
|
|
|
|
|
|
|
|
|
int len;
|
|
|
|
|
|
|
|
|
|
log1.set_level(srslte::LOG_LEVEL_DEBUG);
|
|
|
|
|
log2.set_level(srslte::LOG_LEVEL_DEBUG);
|
|
|
|
|
|
|
|
|
|
bool is_mrb = true;
|
|
|
|
|
rlc1.init(&log1, 3, &tester, &tester, &timers, is_mrb);
|
|
|
|
|
rlc2.init(&log2, 3, &tester, &tester, &timers, is_mrb);
|
|
|
|
|
|
|
|
|
|
//rlc1.configure(&cnfg); //MRB RLC is default configured
|
|
|
|
|
//rlc2.configure(&cnfg); //MRB RLC is default configured
|
|
|
|
|
|
|
|
|
|
// Push 5 SDUs into RLC1
|
|
|
|
|
byte_buffer_t sdu_bufs[NBUFS*2];
|
|
|
|
|
for(int i=0;i<NBUFS;i++)
|
|
|
|
|
{
|
|
|
|
|
*sdu_bufs[i].msg = i; // Write the index into the buffer
|
|
|
|
|
sdu_bufs[i].N_bytes = 1; // Give each buffer a size of 1 byte
|
|
|
|
|
rlc1.write_sdu(&sdu_bufs[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(13 == rlc1.get_buffer_state());
|
|
|
|
|
|
|
|
|
|
// Read 5 PDUs from RLC1 (1 byte each)
|
|
|
|
|
byte_buffer_t pdu_bufs[NBUFS*2];
|
|
|
|
|
for(int i=0;i<NBUFS;i++)
|
|
|
|
|
{
|
|
|
|
|
len = rlc1.read_pdu(pdu_bufs[i].msg, 3); // 2 bytes for header + payload
|
|
|
|
|
pdu_bufs[i].N_bytes = len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(0 == rlc1.get_buffer_state());
|
|
|
|
|
|
|
|
|
|
// Write 5 PDUs into RLC2
|
|
|
|
|
for(int i=0;i<NBUFS;i++)
|
|
|
|
|
{
|
|
|
|
|
rlc2.write_pdu(pdu_bufs[i].msg, pdu_bufs[i].N_bytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(0 == rlc2.get_buffer_state());
|
|
|
|
|
|
|
|
|
|
assert(NBUFS == tester.n_sdus);
|
|
|
|
|
for(int i=0; i<tester.n_sdus; i++)
|
|
|
|
|
{
|
|
|
|
|
assert(tester.sdus[i]->N_bytes == 1);
|
|
|
|
|
assert(*(tester.sdus[i]->msg) == i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This test checks the reassembly routines when a PDU
|
|
|
|
|
// is lost that contains the beginning of SDU segment.
|
|
|
|
|
// The PDU that contains the end of this SDU _also_ contains
|
|
|
|
@ -460,13 +530,14 @@ void reassmble_test2()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
basic_test();
|
|
|
|
|
byte_buffer_pool::get_instance()->cleanup();
|
|
|
|
|
|
|
|
|
|
loss_test();
|
|
|
|
|
byte_buffer_pool::get_instance()->cleanup();
|
|
|
|
|
basic_mbsfn_test();
|
|
|
|
|
byte_buffer_pool::get_instance()->cleanup();
|
|
|
|
|
|
|
|
|
|
reassmble_test();
|
|
|
|
|
byte_buffer_pool::get_instance()->cleanup();
|
|
|
|
|