Commit c5073d52 authored by Robert Schmidt's avatar Robert Schmidt

Scheduler: sort second bearer before first one

parent 0f1c3172
...@@ -370,10 +370,12 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo ...@@ -370,10 +370,12 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
if (rlc_bearer2release_list) { if (rlc_bearer2release_list) {
for (int i = 0; i < rlc_bearer2release_list->list.count; i++) { for (int i = 0; i < rlc_bearer2release_list->list.count; i++) {
for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) {
if (sched_ctrl->dl_lc_ids[idx] == *rlc_bearer2release_list->list.array[i]) { const int lcid = *rlc_bearer2release_list->list.array[i];
if (sched_ctrl->dl_lc_ids[idx] == lcid) {
const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1; const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1;
memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs); memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs);
sched_ctrl->dl_lc_num--; sched_ctrl->dl_lc_num--;
LOG_I(NR_MAC, "remove LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid);
break; break;
} }
} }
...@@ -383,7 +385,7 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo ...@@ -383,7 +385,7 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
if (rlc_bearer2add_list) { if (rlc_bearer2add_list) {
// keep lcids // keep lcids
for (int i = 0; i < rlc_bearer2add_list->list.count; i++) { for (int i = 0; i < rlc_bearer2add_list->list.count; i++) {
const int lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity; const uint8_t lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity;
bool found = false; bool found = false;
for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) {
if (sched_ctrl->dl_lc_ids[idx] == lcid) { if (sched_ctrl->dl_lc_ids[idx] == lcid) {
...@@ -393,9 +395,19 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo ...@@ -393,9 +395,19 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
} }
if (!found) { if (!found) {
/* we assume that the first two are SRB bearers, and we add before
* other DRB */
uint8_t i = 0;
/* go beyond all SRBs */
while (i < sched_ctrl->dl_lc_num && sched_ctrl->dl_lc_ids[i] < 4)
i++;
uint8_t remaining_lcs = sched_ctrl->dl_lc_num - i;
memmove(&sched_ctrl->dl_lc_ids[i + 1], &sched_ctrl->dl_lc_ids[i], sizeof(sched_ctrl->dl_lc_ids[i]) * remaining_lcs);
sched_ctrl->dl_lc_ids[i] = lcid;
sched_ctrl->dl_lc_num++; sched_ctrl->dl_lc_num++;
sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid;
LOG_D(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid); LOG_I(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid);
} }
} }
} }
......
...@@ -330,7 +330,7 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram ...@@ -330,7 +330,7 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram
const int lcid = sched_ctrl->dl_lc_ids[i]; const int lcid = sched_ctrl->dl_lc_ids[i];
const uint16_t rnti = UE->rnti; const uint16_t rnti = UE->rnti;
LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid); LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid);
if (lcid == DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) { if (lcid >= DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) {
continue; continue;
} }
start_meas(&RC.nrmac[module_id]->rlc_status_ind); start_meas(&RC.nrmac[module_id]->rlc_status_ind);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment