UE MAC: in phy-test/do-ra, fill TB randomly
Commitd641a76196("fix BSR report malformed, add SHORT BSR when it can") removed code to fill the remainder of a TB, if it is not filled with data from RLC, with random data when using phy-test or do-ra modes. This random data filling is intentional, as it might prove useful for demos or when debugging (e.g., to see used spectrum instead of 0, etc.). Reintroduce the functionality, but unlike the original code, make it dependent on the mode, not RFsim. See also discussion in #888. Fixup:d641a76196
This commit is contained in:
@@ -3588,7 +3588,20 @@ static uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
|
||||
LOG_D(NR_MAC, "Filling remainder %d bytes to the UL PDU \n", remain);
|
||||
*(NR_MAC_SUBHEADER_FIXED *)mac_ce_info.cur_ptr = (NR_MAC_SUBHEADER_FIXED){.R = 0, .LCID = UL_SCH_LCID_PADDING};
|
||||
mac_ce_info.cur_ptr++;
|
||||
memset(mac_ce_info.cur_ptr, 0, mac_ce_info.pdu_end - mac_ce_info.cur_ptr);
|
||||
if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) {
|
||||
uint8_t *buf = mac_ce_info.cur_ptr;
|
||||
uint8_t *end = mac_ce_info.pdu_end;
|
||||
for (; buf < end && ((intptr_t)buf) % 4; buf++)
|
||||
*buf = lrand48() & 0xff;
|
||||
for (; buf < end - 3; buf += 4) {
|
||||
uint32_t *buf32 = (uint32_t *)buf;
|
||||
*buf32 = lrand48();
|
||||
}
|
||||
for (; buf < end; buf++)
|
||||
*buf = lrand48() & 0xff;
|
||||
} else {
|
||||
memset(mac_ce_info.cur_ptr, 0, mac_ce_info.pdu_end - mac_ce_info.cur_ptr);
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_MAC_PAYLOAD_DEBUG
|
||||
LOG_I(NR_MAC, "MAC PDU %d bytes \n", mac_ce_p->cur_ptr - ulsch_buffer);
|
||||
|
||||
Reference in New Issue
Block a user