Format to dynamically handle default DL SCHED algo
This commit is contained in:
@@ -1274,6 +1274,19 @@ typedef struct {
|
|||||||
int length;
|
int length;
|
||||||
} contig_rbs_t;
|
} contig_rbs_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* definition of a scheduling algorithm implementation used in the
|
||||||
|
* default scheduler
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
char *name;
|
||||||
|
void *(*setup)(void);
|
||||||
|
void (*unset)(void **);
|
||||||
|
int (*run)(
|
||||||
|
module_id_t, int, int, int, UE_list_t *, int, int, uint8_t *, void *);
|
||||||
|
void *data;
|
||||||
|
} default_sched_dl_algo_t;
|
||||||
|
|
||||||
/*! \brief eNB common channels */
|
/*! \brief eNB common channels */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int physCellId;
|
int physCellId;
|
||||||
@@ -1432,6 +1445,8 @@ typedef struct eNB_MAC_INST_s {
|
|||||||
UE_free_list_t UE_free_list;
|
UE_free_list_t UE_free_list;
|
||||||
/// for scheduling selection
|
/// for scheduling selection
|
||||||
SCHEDULER_MODES scheduler_mode;
|
SCHEDULER_MODES scheduler_mode;
|
||||||
|
/// scheduling algorithm used in default scheduler
|
||||||
|
default_sched_dl_algo_t dl_algo;
|
||||||
|
|
||||||
int32_t puSch10xSnr;
|
int32_t puSch10xSnr;
|
||||||
int32_t puCch10xSnr;
|
int32_t puCch10xSnr;
|
||||||
|
|||||||
@@ -128,7 +128,11 @@ void mac_top_init_eNB(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mac[i]->if_inst = IF_Module_init(i);
|
mac[i]->if_inst = IF_Module_init(i);
|
||||||
|
char *s = "round_robin_dl";
|
||||||
|
void *d = dlsym(NULL, s);
|
||||||
|
AssertFatal(d, "%s(): no scheduler algo '%s' found\n", __func__, s);
|
||||||
|
mac[i]->dl_algo = *(default_sched_dl_algo_t *) d;
|
||||||
|
mac[i]->dl_algo.data = mac[i]->dl_algo.setup();
|
||||||
init_UE_info(&mac[i]->UE_info);
|
init_UE_info(&mac[i]->UE_info);
|
||||||
init_slice_info(&mac[i]->slice_info);
|
init_slice_info(&mac[i]->slice_info);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,15 +69,26 @@ int get_rbg_size_last(module_id_t Mod_id, int CC_id) {
|
|||||||
return RBGsize;
|
return RBGsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int g_start_ue_dl = -1;
|
void *rr_dl_setup(void) {
|
||||||
int round_robin_dl(module_id_t Mod_id,
|
void *data = malloc(sizeof(int));
|
||||||
int CC_id,
|
*(int *) data = 0;
|
||||||
int frame,
|
AssertFatal(data, "could not allocate data in %s()\n", __func__);
|
||||||
int subframe,
|
return data;
|
||||||
UE_list_t *UE_list,
|
}
|
||||||
int max_num_ue,
|
void rr_dl_unset(void **data) {
|
||||||
int n_rbg_sched,
|
if (*data)
|
||||||
uint8_t *rbgalloc_mask) {
|
free(*data);
|
||||||
|
*data = NULL;
|
||||||
|
}
|
||||||
|
int rr_dl_run(module_id_t Mod_id,
|
||||||
|
int CC_id,
|
||||||
|
int frame,
|
||||||
|
int subframe,
|
||||||
|
UE_list_t *UE_list,
|
||||||
|
int max_num_ue,
|
||||||
|
int n_rbg_sched,
|
||||||
|
uint8_t *rbgalloc_mask,
|
||||||
|
void *data) {
|
||||||
DevAssert(UE_list->head >= 0);
|
DevAssert(UE_list->head >= 0);
|
||||||
DevAssert(n_rbg_sched > 0);
|
DevAssert(n_rbg_sched > 0);
|
||||||
const int N_RBG = to_rbg(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
|
const int N_RBG = to_rbg(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
|
||||||
@@ -91,10 +102,10 @@ int round_robin_dl(module_id_t Mod_id,
|
|||||||
|
|
||||||
/* just start with the UE after the one we had last time. If it does not
|
/* just start with the UE after the one we had last time. If it does not
|
||||||
* exist, this will start at the head */
|
* exist, this will start at the head */
|
||||||
int g_start_ue_dl = data;
|
int *start_ue = data;
|
||||||
g_start_ue_dl = next_ue_list_looped(UE_list, g_start_ue_dl);
|
*start_ue = next_ue_list_looped(UE_list, *start_ue);
|
||||||
|
|
||||||
int UE_id = g_start_ue_dl;
|
int UE_id = *start_ue;
|
||||||
UE_list_t UE_sched;
|
UE_list_t UE_sched;
|
||||||
int *cur_UE = &UE_sched.head;
|
int *cur_UE = &UE_sched.head;
|
||||||
// Allocate retransmissions, and mark UEs with new transmissions
|
// Allocate retransmissions, and mark UEs with new transmissions
|
||||||
@@ -163,7 +174,7 @@ int round_robin_dl(module_id_t Mod_id,
|
|||||||
|
|
||||||
skip_ue:
|
skip_ue:
|
||||||
UE_id = next_ue_list_looped(UE_list, UE_id);
|
UE_id = next_ue_list_looped(UE_list, UE_id);
|
||||||
} while (UE_id != g_start_ue_dl);
|
} while (UE_id != *start_ue);
|
||||||
*cur_UE = -1; // mark end
|
*cur_UE = -1; // mark end
|
||||||
|
|
||||||
if (UE_sched.head < 0)
|
if (UE_sched.head < 0)
|
||||||
@@ -217,6 +228,14 @@ skip_ue:
|
|||||||
|
|
||||||
return n_rbg_sched;
|
return n_rbg_sched;
|
||||||
}
|
}
|
||||||
|
default_sched_dl_algo_t round_robin_dl = {
|
||||||
|
.name = "round_robin_dl",
|
||||||
|
.setup = rr_dl_setup,
|
||||||
|
.unset = rr_dl_unset,
|
||||||
|
.run = rr_dl_run,
|
||||||
|
.data = NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// This function stores the downlink buffer for all the logical channels
|
// This function stores the downlink buffer for all the logical channels
|
||||||
void
|
void
|
||||||
@@ -306,8 +325,9 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
|
|||||||
int CC_id,
|
int CC_id,
|
||||||
frame_t frameP,
|
frame_t frameP,
|
||||||
sub_frame_t subframeP) {
|
sub_frame_t subframeP) {
|
||||||
UE_info_t *UE_info = &RC.mac[Mod_id]->UE_info;
|
eNB_MAC_INST *mac = RC.mac[Mod_id];
|
||||||
const int N_RBG = to_rbg(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
|
UE_info_t *UE_info = &mac->UE_info;
|
||||||
|
const int N_RBG = to_rbg(mac->common_channels[CC_id].mib->message.dl_Bandwidth);
|
||||||
const int RBGsize = get_min_rb_unit(Mod_id, CC_id);
|
const int RBGsize = get_min_rb_unit(Mod_id, CC_id);
|
||||||
|
|
||||||
store_dlsch_buffer(Mod_id, CC_id, frameP, subframeP);
|
store_dlsch_buffer(Mod_id, CC_id, frameP, subframeP);
|
||||||
@@ -364,7 +384,7 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
|
|||||||
if (UE_to_sched.head < 0)
|
if (UE_to_sched.head < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t *vrb_map = RC.mac[Mod_id]->common_channels[CC_id].vrb_map;
|
uint8_t *vrb_map = mac->common_channels[CC_id].vrb_map;
|
||||||
uint8_t rbgalloc_mask[N_RBG_MAX];
|
uint8_t rbgalloc_mask[N_RBG_MAX];
|
||||||
int n_rbg_sched = 0;
|
int n_rbg_sched = 0;
|
||||||
for (int i = 0; i < N_RBG; i++) {
|
for (int i = 0; i < N_RBG; i++) {
|
||||||
@@ -376,14 +396,15 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
|
|||||||
n_rbg_sched += rbgalloc_mask[i];
|
n_rbg_sched += rbgalloc_mask[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
round_robin_dl(Mod_id,
|
mac->dl_algo.run(Mod_id,
|
||||||
CC_id,
|
CC_id,
|
||||||
frameP,
|
frameP,
|
||||||
subframeP,
|
subframeP,
|
||||||
&UE_to_sched,
|
&UE_to_sched,
|
||||||
4, // max_num_ue
|
4, // max_num_ue
|
||||||
n_rbg_sched,
|
n_rbg_sched,
|
||||||
rbgalloc_mask);
|
rbgalloc_mask,
|
||||||
|
mac->dl_algo.data);
|
||||||
|
|
||||||
// the following block is meant for validation of the pre-processor to check
|
// the following block is meant for validation of the pre-processor to check
|
||||||
// whether all UE allocations are non-overlapping and is not necessary for
|
// whether all UE allocations are non-overlapping and is not necessary for
|
||||||
|
|||||||
Reference in New Issue
Block a user