mux: fix code formatting and simplify UL-CCCH packing

This commit is contained in:
Andre Puschmann 2019-06-25 16:52:45 +02:00
parent 4aaa0473b9
commit a4dab1081e
1 changed files with 35 additions and 42 deletions

View File

@ -48,8 +48,8 @@ void mux::init(rlc_interface_mac *rlc_, srslte::log *log_h_, bsr_interface_mux *
void mux::reset()
{
for (uint32_t i = 0; i < logical_channels.size(); i++) {
logical_channels[i].Bj = 0;
for (auto& channel : logical_channels) {
channel.Bj = 0;
}
msg3_pending = false;
pending_crnti_ce = 0;
@ -72,8 +72,8 @@ void mux::step(const uint32_t tti)
bool mux::is_pending_any_sdu()
{
for (uint32_t i = 0; i < logical_channels.size(); i++) {
if (rlc->has_data(logical_channels[i].lcid)) {
for (auto& channel : logical_channels) {
if (rlc->has_data(channel.lcid)) {
return true;
}
}
@ -214,8 +214,6 @@ uint8_t* mux::pdu_get(srslte::byte_buffer_t* payload, uint32_t pdu_sz)
}
}
// FIXME: IMHO, it should not matter if this is a RAR UL or a normal UL, we fill the grant
if (!is_rar) {
// Update buffer states for all logical channels
for (auto& channel : logical_channels) {
channel.buffer_len = rlc->get_buffer_state(channel.lcid);
@ -226,9 +224,6 @@ uint8_t* mux::pdu_get(srslte::byte_buffer_t* payload, uint32_t pdu_sz)
// data from any Logical Channel, except data from UL-CCCH;
// first only those with positive Bj
for (auto& channel : logical_channels) {
// FIXME: IMHO we should not care if we read from UL-CCCH, the specs say "except" but CCCH has always
// higher priority, so if there is data, it should be allocated
if (channel.lcid != 0) {
int max_sdu_sz = (channel.PBR < 0) ? -1 : channel.Bj; // this can be zero if no PBR has been allocated
if (max_sdu_sz != 0) {
if (sched_sdu(&channel, &sdu_space, max_sdu_sz)) {
@ -236,7 +231,6 @@ uint8_t* mux::pdu_get(srslte::byte_buffer_t* payload, uint32_t pdu_sz)
}
}
}
}
print_logical_channel_state("First round of allocation:");
@ -254,7 +248,6 @@ uint8_t* mux::pdu_get(srslte::byte_buffer_t* payload, uint32_t pdu_sz)
allocate_sdu(channel.lcid, &pdu_msg, channel.sched_len);
}
}
}
if (!regular_bsr) {
// Insert Padding BSR if not inserted Regular/Periodic BSR