Commit c87f8d72 authored by Sriharsha Korada's avatar Sriharsha Korada

Implement QoS aware scheduling algorithm

parent e1eb5cb9
...@@ -1357,6 +1357,7 @@ set (MAC_NR_SRC ...@@ -1357,6 +1357,7 @@ set (MAC_NR_SRC
${NR_GNB_MAC_DIR}/gNB_scheduler.c ${NR_GNB_MAC_DIR}/gNB_scheduler.c
${NR_GNB_MAC_DIR}/gNB_scheduler_bch.c ${NR_GNB_MAC_DIR}/gNB_scheduler_bch.c
${NR_GNB_MAC_DIR}/gNB_scheduler_dlsch.c ${NR_GNB_MAC_DIR}/gNB_scheduler_dlsch.c
${NR_GNB_MAC_DIR}/gNB_qos_aware_scheduler_dlsch.c
${NR_GNB_MAC_DIR}/gNB_scheduler_ulsch.c ${NR_GNB_MAC_DIR}/gNB_scheduler_ulsch.c
${NR_GNB_MAC_DIR}/gNB_scheduler_primitives.c ${NR_GNB_MAC_DIR}/gNB_scheduler_primitives.c
${NR_GNB_MAC_DIR}/gNB_scheduler_phytest.c ${NR_GNB_MAC_DIR}/gNB_scheduler_phytest.c
......
...@@ -111,6 +111,7 @@ typedef enum rlc_mode_e { RLC_MODE_NONE = 0, RLC_MODE_AM = 1, RLC_MODE_UM = 2, R ...@@ -111,6 +111,7 @@ typedef enum rlc_mode_e { RLC_MODE_NONE = 0, RLC_MODE_AM = 1, RLC_MODE_UM = 2, R
*/ */
typedef struct { typedef struct {
rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */ rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */
rlc_buffer_occupancy_t prioritized_bytes_in_buffer;
rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */ rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */
frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */ frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */
sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of
......
...@@ -1709,7 +1709,9 @@ INPUT = \ ...@@ -1709,7 +1709,9 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_qos_aware_scheduler_dlsch.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_qos_aware_scheduler_dlsch.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c \
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n" #define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_QOS_AWARE_SCHED "use scheduler for downlink that performs scheduling based on qos priorities\n"
#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n"
#define CONFIG_HLP_DMAMAP "use DMA memory mapping\n" #define CONFIG_HLP_DMAMAP "use DMA memory mapping\n"
#define CONFIG_HLP_EXCCLK "tells hardware to use a clock reference (0:internal(default), 1:external, 2:gpsdo)\n" #define CONFIG_HLP_EXCCLK "tells hardware to use a clock reference (0:internal(default), 1:external, 2:gpsdo)\n"
......
...@@ -55,6 +55,7 @@ extern "C" ...@@ -55,6 +55,7 @@ extern "C"
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_QOS_AWARE_SCHED "use scheduler for downlink that performs scheduling based on qos priorities\n"
#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n"
#define CONFIG_HLP_SA "run gNB in standalone mode\n" #define CONFIG_HLP_SA "run gNB in standalone mode\n"
#define CONFIG_HLP_SL_MODE "sets the NR sidelink mode (0: not in sidelink mode, 1: in-coverage/gNB, 2: out-of-coverage/no gNB)\n" #define CONFIG_HLP_SL_MODE "sets the NR sidelink mode (0: not in sidelink mode, 1: in-coverage/gNB, 2: out-of-coverage/no gNB)\n"
...@@ -117,6 +118,7 @@ extern "C" ...@@ -117,6 +118,7 @@ extern "C"
#define TP_CONFIG softmodem_params.threadPoolConfig #define TP_CONFIG softmodem_params.threadPoolConfig
#define CONTINUOUS_TX softmodem_params.continuous_tx #define CONTINUOUS_TX softmodem_params.continuous_tx
#define PHY_TEST softmodem_params.phy_test #define PHY_TEST softmodem_params.phy_test
#define QOS_AWARE_SCHEDULER softmodem_params.use_qos_aware_scheduler
#define DO_RA softmodem_params.do_ra #define DO_RA softmodem_params.do_ra
#define SA softmodem_params.sa #define SA softmodem_params.sa
#define SL_MODE softmodem_params.sl_mode #define SL_MODE softmodem_params.sl_mode
...@@ -150,6 +152,7 @@ extern int usrp_tx_thread; ...@@ -150,6 +152,7 @@ extern int usrp_tx_thread;
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, .strptr=&RF_CONFIG_FILE, .defstrval=NULL, TYPE_STRING, 0}, \ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, .strptr=&RF_CONFIG_FILE, .defstrval=NULL, TYPE_STRING, 0}, \
{"thread-pool", CONFIG_HLP_TPOOL, 0, .strptr=&TP_CONFIG, .defstrval="-1,-1,-1,-1,-1,-1,-1,-1", TYPE_STRING, 0}, \ {"thread-pool", CONFIG_HLP_TPOOL, 0, .strptr=&TP_CONFIG, .defstrval="-1,-1,-1,-1,-1,-1,-1,-1", TYPE_STRING, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, .iptr=&PHY_TEST, .defintval=0, TYPE_INT, 0}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, .iptr=&PHY_TEST, .defintval=0, TYPE_INT, 0}, \
{"use-qos-scheduler", CONFIG_HLP_QOS_AWARE_SCHED, PARAMFLAG_BOOL,.iptr=&QOS_AWARE_SCHEDULER, .defintval=1, TYPE_INT, 0}, \
{"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, .iptr=&DO_RA, .defintval=0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, .iptr=&DO_RA, .defintval=0, TYPE_INT, 0}, \
{"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, .iptr=&SA, .defintval=0, TYPE_INT, 0}, \ {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, .iptr=&SA, .defintval=0, TYPE_INT, 0}, \
{"sl-mode", CONFIG_HLP_SL_MODE, 0, .u8ptr=&SL_MODE, .defintval=0, TYPE_UINT8, 0}, \ {"sl-mode", CONFIG_HLP_SL_MODE, 0, .u8ptr=&SL_MODE, .defintval=0, TYPE_UINT8, 0}, \
...@@ -224,6 +227,7 @@ extern int usrp_tx_thread; ...@@ -224,6 +227,7 @@ extern int usrp_tx_thread;
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s3a = { config_checkstr_assign_integer, \ { .s3a = { config_checkstr_assign_integer, \
{"MONOLITHIC", "PNF", "VNF","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \ {"MONOLITHIC", "PNF", "VNF","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \
{NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \ {NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \
...@@ -335,6 +339,7 @@ typedef struct { ...@@ -335,6 +339,7 @@ typedef struct {
int hw_timing_advance; int hw_timing_advance;
uint32_t send_dmrs_sync; uint32_t send_dmrs_sync;
int use_256qam_table; int use_256qam_table;
int use_qos_aware_scheduler;
int chest_time; int chest_time;
int chest_freq; int chest_freq;
uint8_t nfapi; uint8_t nfapi;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
#define _GNU_SOURCE
#include "common/platform_types.h" #include "common/platform_types.h"
#include "common/platform_constants.h" #include "common/platform_constants.h"
#include "common/ran_context.h" #include "common/ran_context.h"
......
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef QOS_AWARE_DLSCH_SCHEDULER
#define QOS_AWARE_DLSCH_SCHEDULER
#include "NR_MAC_gNB/gNB_scheduler_dlsch.h"
#define LC_iterator(BaSe, VaR) \
LCIDsched_t *VaR##pptr = BaSe, *VaR; \
while ((VaR = (VaR##pptr++)))
int lc_comparator(const void *p, const void *q);
int preallocate_numrbs_per_lc(LCIDsched_t *lc_sched, int num_rbs_data, float *remainPRBs);
int nr_find_nb_bytes(int bytes,
int oh_bytes,
uint32_t *tbs,
uint16_t *rbsize,
uint16_t nb_rb_max,
NR_sched_pdsch_t *sched_pdsch,
NR_tda_info_t *tda_info);
int nr_get_num_prioritized_bytes(int max_rbsize, UEsched_t *ue_iterator, LCIDsched_t *lc_sched);
uint8_t rb_allocation_lcid(module_id_t module_id,
frame_t frame,
sub_frame_t slot,
LCIDsched_t *lc_sched,
UEsched_t *ue_sched,
int n_rb_sched,
uint16_t *rballoc_mask);
void fill_lc_sched_list(NR_UE_info_t *UE, frame_t frame, int *lc_currid, int ue_currid, LCIDsched_t *lc_sched);
void qos_aware_scheduler_dl(module_id_t module_id,
frame_t frame,
sub_frame_t slot,
NR_UE_info_t **UE_list,
int max_num_ue,
int n_rb_sched,
uint16_t *rballoc_mask);
#endif
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
/*MAC*/ /*MAC*/
#include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_COMMON/nr_mac.h"
#include "NR_MAC_gNB/nr_mac_gNB.h"
#include "NR_MAC_COMMON/nr_mac_extern.h" #include "NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "LAYER2/RLC/rlc.h" #include "LAYER2/RLC/rlc.h"
#include "LAYER2/NR_MAC_gNB/gNB_qos_aware_scheduler_dlsch.h"
/*NFAPI*/ /*NFAPI*/
#include "nfapi_nr_interface.h" #include "nfapi_nr_interface.h"
...@@ -380,10 +380,7 @@ void abort_nr_dl_harq(NR_UE_info_t* UE, int8_t harq_pid) ...@@ -380,10 +380,7 @@ void abort_nr_dl_harq(NR_UE_info_t* UE, int8_t harq_pid)
} }
static void get_start_stop_allocation(gNB_MAC_INST *mac, void get_start_stop_allocation(gNB_MAC_INST *mac, NR_UE_info_t *UE, int *rbStart, int *rbStop)
NR_UE_info_t *UE,
int *rbStart,
int *rbStop)
{ {
NR_UE_DL_BWP_t *dl_bwp = &UE->current_DL_BWP; NR_UE_DL_BWP_t *dl_bwp = &UE->current_DL_BWP;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
...@@ -407,13 +404,13 @@ static void get_start_stop_allocation(gNB_MAC_INST *mac, ...@@ -407,13 +404,13 @@ static void get_start_stop_allocation(gNB_MAC_INST *mac,
} }
} }
static bool allocate_dl_retransmission(module_id_t module_id, bool allocate_dl_retransmission(module_id_t module_id,
frame_t frame, frame_t frame,
sub_frame_t slot, sub_frame_t slot,
uint16_t *rballoc_mask, uint16_t *rballoc_mask,
int *n_rb_sched, int *n_rb_sched,
NR_UE_info_t *UE, NR_UE_info_t *UE,
int current_harq_pid) int current_harq_pid)
{ {
int CC_id = 0; int CC_id = 0;
...@@ -579,12 +576,6 @@ static bool allocate_dl_retransmission(module_id_t module_id, ...@@ -579,12 +576,6 @@ static bool allocate_dl_retransmission(module_id_t module_id,
return true; return true;
} }
uint32_t pf_tbs[3][29]; // pre-computed, approximate TBS values for PF coefficient
typedef struct UEsched_s {
float coef;
NR_UE_info_t * UE;
} UEsched_t;
static int comparator(const void *p, const void *q) { static int comparator(const void *p, const void *q) {
return ((UEsched_t*)p)->coef < ((UEsched_t*)q)->coef; return ((UEsched_t*)p)->coef < ((UEsched_t*)q)->coef;
} }
...@@ -828,6 +819,8 @@ static void pf_dl(module_id_t module_id, ...@@ -828,6 +819,8 @@ static void pf_dl(module_id_t module_id,
} }
} }
uint32_t pf_tbs[3][29]; // pre-computed, approximate TBS values for PF coefficient
static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot)
{ {
NR_UEs_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UEs_t *UE_info = &RC.nrmac[module_id]->UE_info;
...@@ -858,14 +851,20 @@ static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_ ...@@ -858,14 +851,20 @@ static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
uint16_t rballoc_mask[bwpSize]; uint16_t rballoc_mask[bwpSize];
int n_rb_sched = 0; int n_rb_sched = 0;
LOG_D(NR_MAC, "=================================================================\n");
for (int i = 0; i < bwpSize; i++) { for (int i = 0; i < bwpSize; i++) {
// calculate mask: init with "NOT" vrb_map: // calculate mask: init with "NOT" vrb_map:
// if any RB in vrb_map is blocked (1), the current RBG will be 0 // if any RB in vrb_map is blocked (1), the current RBG will be 0
LOG_D(NR_MAC, "vrb map bit %d\n", vrb_map[i + BWPStart]);
rballoc_mask[i] = (~vrb_map[i+BWPStart])&0x3fff; //bitwise not and 14 symbols rballoc_mask[i] = (~vrb_map[i+BWPStart])&0x3fff; //bitwise not and 14 symbols
// if all the pdsch symbols are free // if all the pdsch symbols are free
if ((rballoc_mask[i]&slbitmap) == slbitmap) { if ((rballoc_mask[i]&slbitmap) == slbitmap) {
LOG_D(NR_MAC,
"rballoc_mask bit = %hu, slbitmap = %hu and finally and operation = %hu\n",
rballoc_mask[i],
slbitmap,
(rballoc_mask[i] & slbitmap));
n_rb_sched++; n_rb_sched++;
} }
} }
...@@ -877,14 +876,28 @@ static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_ ...@@ -877,14 +876,28 @@ static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_
int average_agg_level = 4; // TODO find a better estimation int average_agg_level = 4; // TODO find a better estimation
int max_sched_ues = bw / (average_agg_level * NR_NB_REG_PER_CCE); int max_sched_ues = bw / (average_agg_level * NR_NB_REG_PER_CCE);
/* proportional fair scheduling algorithm */ /* qos based scheduling algorithm */
pf_dl(module_id, LOG_D(NR_MAC,
"frame = %d, slot = %d, number of rbs scheduled are %d, start symbol index = %d and num of symbols = %d in SL_to_bitmap, "
"slbitmap is %hu\n",
frame, frame,
slot, slot,
UE_info->list,
max_sched_ues,
n_rb_sched, n_rb_sched,
rballoc_mask); startSymbolIndex,
nrOfSymbols,
slbitmap);
LOG_D(NR_MAC, "number of rbs scheduled are %d\n", n_rb_sched);
LOG_D(NR_MAC, "slbitmap is %hu\n", slbitmap);
LOG_D(NR_MAC, "\n");
if (get_softmodem_params()->use_qos_aware_scheduler == 0) {
LOG_I(NR_MAC, "Using Proportional Fair scheduler\n");
pf_dl(module_id, frame, slot, UE_info->list, max_sched_ues, n_rb_sched, rballoc_mask);
} else {
LOG_D(NR_MAC, "Using QoS aware scheduler\n");
qos_aware_scheduler_dl(module_id, frame, slot, UE_info->list, max_sched_ues, n_rb_sched, rballoc_mask);
}
} }
nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(int CC_id) { nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(int CC_id) {
...@@ -1270,8 +1283,18 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1270,8 +1283,18 @@ void nr_schedule_ue_spec(module_id_t module_id,
NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf;
/* limit requested number of bytes to what preprocessor specified, or /* limit requested number of bytes to what preprocessor specified, or
* such that TBS is full */ * such that TBS is full */
const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, uint32_t bytes_in_buffer;
bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG)); if (get_softmodem_params()->use_qos_aware_scheduler == 0) {
bytes_in_buffer = sched_ctrl->rlc_status[lcid].bytes_in_buffer;
} else {
AssertFatal(sched_ctrl->rlc_status[lcid].prioritized_bytes_in_buffer <= sched_ctrl->rlc_status[lcid].bytes_in_buffer,
"prioritized bytes are %d which should be less than total bytes %d for lcid %d\n",
sched_ctrl->rlc_status[lcid].prioritized_bytes_in_buffer,
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
lcid);
bytes_in_buffer = sched_ctrl->rlc_status[lcid].prioritized_bytes_in_buffer;
}
const rlc_buffer_occupancy_t ndata = min(bytes_in_buffer, bufEnd - buf - sizeof(NR_MAC_SUBHEADER_LONG));
tbs_size_t len = mac_rlc_data_req(module_id, tbs_size_t len = mac_rlc_data_req(module_id,
rnti, rnti,
module_id, module_id,
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef DLSCH_SCHEDULER_H
#define DLSCH_SCHEDULER_H
#include "NR_MAC_gNB/nr_mac_gNB.h"
typedef struct UEsched_s {
float coef;
NR_UE_info_t *UE;
uint16_t num_rbs_sched; // number of resource blocks scheduled
bool oh_status;
} UEsched_t;
typedef struct LCIDsched_s {
float coef;
NR_UE_info_t *UE;
uint8_t curr_lcid; // to specify the lcid of the current UE after sorting (not an optimum approach)
uint8_t curr_ue; // to keep track of to which UE this lcid belongs to
uint8_t lcid_priority; // calculated lcid priority based on qos flow priorities
uint16_t num_rbs_lcid_allocated; // number of resource blocks allocated for this LCID initially
uint16_t num_rbs_lcid_used;
uint16_t num_rbs_lcid_remain;
float factor;
uint32_t allocated_bytes;
uint32_t remaining_bytes;
uint16_t overhead;
} LCIDsched_t;
#endif
\ No newline at end of file
...@@ -78,6 +78,16 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -78,6 +78,16 @@ void nr_schedule_ue_spec(module_id_t module_id,
/* \brief default FR1 DL preprocessor init routine, returns preprocessor to call */ /* \brief default FR1 DL preprocessor init routine, returns preprocessor to call */
nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(int CC_id); nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(int CC_id);
void get_start_stop_allocation(gNB_MAC_INST *mac, NR_UE_info_t *UE, int *rbStart, int *rbStop);
bool allocate_dl_retransmission(module_id_t module_id,
frame_t frame,
sub_frame_t slot,
uint16_t *rballoc_mask,
int *n_rb_sched,
NR_UE_info_t *UE,
int current_harq_pid);
void schedule_nr_sib1(module_id_t module_idP, void schedule_nr_sib1(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP, sub_frame_t slotP,
......
...@@ -642,6 +642,8 @@ typedef struct { ...@@ -642,6 +642,8 @@ typedef struct {
uint8_t dl_lc_num; uint8_t dl_lc_num;
/// order in which DLSCH scheduler should allocate LCs /// order in which DLSCH scheduler should allocate LCs
uint8_t dl_lc_ids[NR_MAX_NUM_LCID]; uint8_t dl_lc_ids[NR_MAX_NUM_LCID];
// priorities of lcids
uint8_t dl_lc_ids_priorities[NR_MAX_NUM_LCID];
/// Timer for RRC processing procedures /// Timer for RRC processing procedures
uint32_t rrc_processing_timer; uint32_t rrc_processing_timer;
...@@ -649,9 +651,6 @@ typedef struct { ...@@ -649,9 +651,6 @@ typedef struct {
/// sri, ul_ri and tpmi based on SRS /// sri, ul_ri and tpmi based on SRS
nr_srs_feedback_t srs_feedback; nr_srs_feedback_t srs_feedback;
nssai_t dl_lc_nssai[NR_MAX_NUM_LCID]; nssai_t dl_lc_nssai[NR_MAX_NUM_LCID];
// priorities of lcids
uint8_t dl_lc_ids_priorities[NR_MAX_NUM_LCID];
} NR_UE_sched_ctrl_t; } NR_UE_sched_ctrl_t;
typedef struct { typedef struct {
......
...@@ -235,6 +235,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, ...@@ -235,6 +235,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
ret.pdus_in_buffer = 0; ret.pdus_in_buffer = 0;
ret.prioritized_bytes_in_buffer = 0;
/* TODO: creation time may be important (unit: frame, as it seems) */ /* TODO: creation time may be important (unit: frame, as it seems) */
ret.head_sdu_creation_time = 0; ret.head_sdu_creation_time = 0;
ret.head_sdu_remaining_size_to_send = 0; ret.head_sdu_remaining_size_to_send = 0;
......
...@@ -12,7 +12,7 @@ gNBs = ...@@ -12,7 +12,7 @@ gNBs =
// Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1; tracking_area_code = 1;
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }) }); plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }) });
nr_cellid = 12345678L; nr_cellid = 12345678L;
////////// Physical parameters: ////////// Physical parameters:
......
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