Commit daa1b689 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Add slice support to scheduler

Loop over active slices per UE and allocate RBs based on slice policy
parent 0f574c35
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#define NR_NB_REG_PER_CCE 6 #define NR_NB_REG_PER_CCE 6
#define NR_NB_SC_PER_RB 12 #define NR_NB_SC_PER_RB 12
#define NR_MAX_NUM_LCID 32 #define NR_MAX_NUM_LCID 32
#define NR_MAX_NUM_SLICES 8
typedef enum { typedef enum {
nr_FR1 = 0, nr_FR1 = 0,
......
...@@ -96,7 +96,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -96,7 +96,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
rbStart += rbSize; rbStart += rbSize;
} }
sched_ctrl->num_total_bytes = 0; sched_ctrl->sliceInfo[0].num_total_bytes = 0;
sched_ctrl->dl_lc_num = 1; sched_ctrl->dl_lc_num = 1;
const int lcid = DL_SCH_LCID_DTCH; const int lcid = DL_SCH_LCID_DTCH;
sched_ctrl->dl_lc[sched_ctrl->dl_lc_num - 1].id = lcid; sched_ctrl->dl_lc[sched_ctrl->dl_lc_num - 1].id = lcid;
...@@ -113,7 +113,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -113,7 +113,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
lcid, lcid,
0, 0,
0); 0);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; sched_ctrl->sliceInfo[0].num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
int CCEIndex = get_cce_index(RC.nrmac[module_id], int CCEIndex = get_cce_index(RC.nrmac[module_id],
CC_id, slot, UE->rnti, CC_id, slot, UE->rnti,
......
...@@ -232,13 +232,24 @@ static NR_CellGroupConfig_t *clone_CellGroupConfig(const NR_CellGroupConfig_t *o ...@@ -232,13 +232,24 @@ static NR_CellGroupConfig_t *clone_CellGroupConfig(const NR_CellGroupConfig_t *o
return cloned; return cloned;
} }
static int get_idx_from_lcid(const NR_UE_sched_ctrl_t *sched_ctrl, int lcid)
{
for (int i = 0; i < sched_ctrl->dl_lc_num; i++) {
if (sched_ctrl->dl_lc[i].id == lcid)
return i;
}
return -1;
}
static void set_nssaiConfig(const int drb_len, const f1ap_drb_to_be_setup_t *req_drbs, NR_UE_sched_ctrl_t *sched_ctrl) static void set_nssaiConfig(const int drb_len, const f1ap_drb_to_be_setup_t *req_drbs, NR_UE_sched_ctrl_t *sched_ctrl)
{ {
for (int i = 0; i < drb_len; i++) { for (int i = 0; i < drb_len; i++) {
const f1ap_drb_to_be_setup_t *drb = &req_drbs[i]; const f1ap_drb_to_be_setup_t *drb = &req_drbs[i];
long lcid = get_lcid_from_drbid(drb->drb_id); long lcid = get_lcid_from_drbid(drb->drb_id);
sched_ctrl->dl_lc[lcid].nssai = drb->nssai; int lcid_idx = get_idx_from_lcid(sched_ctrl, lcid);
DevAssert(lcid_idx > -1);
sched_ctrl->dl_lc[lcid_idx].nssai = drb->nssai;
LOG_I(NR_MAC, "Setting NSSAI sst: %d, sd: %d for DRB: %ld\n", drb->nssai.sst, drb->nssai.sd, drb->drb_id); LOG_I(NR_MAC, "Setting NSSAI sst: %d, sd: %d for DRB: %ld\n", drb->nssai.sst, drb->nssai.sd, drb->drb_id);
} }
} }
......
...@@ -541,6 +541,25 @@ typedef struct { ...@@ -541,6 +541,25 @@ typedef struct {
nssai_t nssai; nssai_t nssai;
} NR_LC_info_t; } NR_LC_info_t;
/*! \brief Slice information used by the scheduler */
typedef struct {
int numSharedPrbs;
int numPrioritizedPrbs;
int numDedicatedPrbs;
nssai_t nssai;
} NR_slice_sched_t;
typedef struct {
/// the index of slice from slice config stored in gNB_MAC_INST
int sliceIdx;
/// LCs in this slice
uint8_t numLcids;
uint8_t lcid[NR_MAX_NUM_LCID];
/// total amount of data awaiting for this UE for each slice
uint32_t num_total_bytes;
uint16_t dl_pdus_total;
} NR_UE_slice_info_t;
/*! \brief scheduling control information set through an API */ /*! \brief scheduling control information set through an API */
#define MAX_CSI_REPORTS 48 #define MAX_CSI_REPORTS 48
typedef struct { typedef struct {
...@@ -585,12 +604,16 @@ typedef struct { ...@@ -585,12 +604,16 @@ typedef struct {
frame_t last_ul_frame; frame_t last_ul_frame;
sub_frame_t last_ul_slot; sub_frame_t last_ul_slot;
/// total amount of data awaiting for this UE /// UE slice specific info
uint32_t num_total_bytes; int numSlices;
uint16_t dl_pdus_total; int curSchedSliceIdx;
NR_UE_slice_info_t sliceInfo[NR_MAX_NUM_SLICES];
/// per-LC status data /// per-LC status data
mac_rlc_status_resp_t rlc_status[NR_MAX_NUM_LCID]; mac_rlc_status_resp_t rlc_status[NR_MAX_NUM_LCID];
uint32_t num_total_bytes;
uint16_t dl_pdus_total;
/// Estimation of HARQ from BLER /// Estimation of HARQ from BLER
NR_bler_stats_t dl_bler_stats; NR_bler_stats_t dl_bler_stats;
NR_bler_stats_t ul_bler_stats; NR_bler_stats_t ul_bler_stats;
...@@ -852,6 +875,9 @@ typedef struct gNB_MAC_INST_s { ...@@ -852,6 +875,9 @@ typedef struct gNB_MAC_INST_s {
pthread_mutex_t sched_lock; pthread_mutex_t sched_lock;
/// store slice config. First slice is always default slice
NR_slice_sched_t sliceConfig[NR_MAX_NUM_SLICES];
} gNB_MAC_INST; } gNB_MAC_INST;
#endif /*__LAYER2_NR_MAC_GNB_H__ */ #endif /*__LAYER2_NR_MAC_GNB_H__ */
......
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