|
|
@ -63,14 +63,15 @@ srsran::unique_byte_buffer_t mux_nr::get_pdu(uint32_t max_pdu_len)
|
|
|
|
tx_pdu.init_tx(phy_tx_pdu.get(), max_pdu_len, true);
|
|
|
|
tx_pdu.init_tx(phy_tx_pdu.get(), max_pdu_len, true);
|
|
|
|
|
|
|
|
|
|
|
|
if (msg3_is_pending()) {
|
|
|
|
if (msg3_is_pending()) {
|
|
|
|
// If Msg3 is pending, pack it
|
|
|
|
// only C-RNTI or CCCH SDU can be transmitted in Msg3
|
|
|
|
// Use the CRNTI which is provided in the RRC reconfiguration (only for DC mode maybe other)
|
|
|
|
if (mac.has_crnti()) {
|
|
|
|
tx_pdu.add_crnti_ce(mac.get_crnti());
|
|
|
|
tx_pdu.add_crnti_ce(mac.get_crnti());
|
|
|
|
tx_pdu.add_sbsr_ce(mac.generate_sbsr());
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: add CCCH check
|
|
|
|
msg3_transmitted();
|
|
|
|
msg3_transmitted();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Pack normal UL data PDU
|
|
|
|
// Pack normal UL data PDU
|
|
|
|
int32_t remaining_len = tx_pdu.get_remaing_len(); // local variable to reserv space for CEs
|
|
|
|
int32_t remaining_len = tx_pdu.get_remaing_len(); // local variable to reserve space for CEs
|
|
|
|
|
|
|
|
|
|
|
|
if (add_bsr_ce == sbsr_ce) {
|
|
|
|
if (add_bsr_ce == sbsr_ce) {
|
|
|
|
// reserve space for SBSR
|
|
|
|
// reserve space for SBSR
|
|
|
@ -115,16 +116,26 @@ srsran::unique_byte_buffer_t mux_nr::get_pdu(uint32_t max_pdu_len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Second add fixed-sized MAC CEs (e.g. SBSR)
|
|
|
|
// check if
|
|
|
|
if (add_bsr_ce == sbsr_ce) {
|
|
|
|
if (add_bsr_ce == no_bsr) {
|
|
|
|
tx_pdu.add_sbsr_ce(mac.generate_sbsr());
|
|
|
|
// tell BSR proc we still have space in PDU and let it decide to create a padding BSR
|
|
|
|
add_bsr_ce = no_bsr;
|
|
|
|
mac.set_padding_bytes(tx_pdu.get_remaing_len());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Lastly, add variable-sized MAC CEs
|
|
|
|
// Second add fixed-sized MAC CEs (e.g. SBSR)
|
|
|
|
|
|
|
|
if (add_bsr_ce == sbsr_ce) {
|
|
|
|
|
|
|
|
tx_pdu.add_sbsr_ce(mac.generate_sbsr());
|
|
|
|
|
|
|
|
add_bsr_ce = no_bsr;
|
|
|
|
|
|
|
|
} else if (add_bsr_ce == lbsr_ce) {
|
|
|
|
|
|
|
|
// TODO: implement LBSR support
|
|
|
|
|
|
|
|
tx_pdu.add_sbsr_ce(mac.generate_sbsr());
|
|
|
|
|
|
|
|
add_bsr_ce = no_bsr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Lastly, add variable-sized MAC CEs
|
|
|
|
|
|
|
|
|
|
|
|
// Pack PDU
|
|
|
|
// Pack PDU
|
|
|
|
tx_pdu.pack();
|
|
|
|
tx_pdu.pack();
|
|
|
|
|
|
|
|
|
|
|
|