Commit 58dbf7d4 authored by cig's avatar cig

New design UE scheduler

parent 96b57557
...@@ -431,32 +431,24 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { ...@@ -431,32 +431,24 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response;
fapi_nr_config_request_t *cfg = &UE->nrUE_config; fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_tti_rx); int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_tti_rx);
uint8_t ssb_period = UE->nrUE_config.ssb_table.ssb_period; uint8_t gNB_id = 0;
nr_downlink_indication_t dl_indication;
memset((void*)&dl_indication, 0, sizeof(dl_indication));
//program DCI for slot 1
//TODO: all of this has to be moved to the MAC!!!
if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){ if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){
dcireq.module_id = UE->Mod_id;
dcireq.gNB_index = 0;
dcireq.cc_id = 0;
dcireq.frame = proc->frame_rx;
dcireq.slot = proc->nr_tti_rx;
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
// we should have received a DL DCI here, so configure DL accordingly if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
scheduled_response.dl_config = &dcireq.dl_config_req; dl_indication.module_id = UE->Mod_id;
scheduled_response.ul_config = NULL; dl_indication.gNB_index = gNB_id;
scheduled_response.tx_request = NULL; dl_indication.cc_id = UE->CC_id;
scheduled_response.module_id = UE->Mod_id; dl_indication.frame = proc->frame_rx;
scheduled_response.CC_id = 0; dl_indication.slot = proc->nr_tti_rx;
scheduled_response.frame = proc->frame_rx; }
scheduled_response.slot = proc->nr_tti_rx;
nr_ue_scheduled_response(&scheduled_response); nr_ue_scheduler(&dl_indication, NULL);
// Process Rx data for one sub-frame // Process Rx data for one sub-frame
#ifdef UE_SLOT_PARALLELISATION #ifdef UE_SLOT_PARALLELISATION
......
...@@ -84,23 +84,9 @@ NR_UE_MAC_INST_t *get_mac_inst( ...@@ -84,23 +84,9 @@ NR_UE_MAC_INST_t *get_mac_inst(
/**\brief called at each slot, slot length based on numerology. now use u=0, scs=15kHz, slot=1ms /**\brief called at each slot, slot length based on numerology. now use u=0, scs=15kHz, slot=1ms
performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures. performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures.
\param module_id module id \param dl_info DL indication
\param gNB_index corresponding gNB index \param ul_info UL indication*/
\param cc_id component carrier id NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_indication_t *ul_info);
\param rx_frame receive frame number
\param rx_slot receive slot number
\param tx_frame transmit frame number
\param tx_slot transmit slot number*/
NR_UE_L2_STATE_t nr_ue_scheduler(
const module_id_t module_id,
const uint8_t gNB_index,
const int cc_id,
const frame_t rx_frame,
const slot_t rx_slot,
const int32_t ssb_index,
const frame_t tx_frame,
const slot_t tx_slot);
/* \brief Get SR payload (0,1) from UE MAC /* \brief Get SR payload (0,1) from UE MAC
@param Mod_id Instance id of UE in machine @param Mod_id Instance id of UE in machine
......
...@@ -651,23 +651,25 @@ uint32_t get_ssb_frame(uint32_t test){ ...@@ -651,23 +651,25 @@ uint32_t get_ssb_frame(uint32_t test){
// 1. TODO: Call RRC for link status return to PHY // 1. TODO: Call RRC for link status return to PHY
// 2. TODO: Perform SR/BSR procedures for scheduling feedback // 2. TODO: Perform SR/BSR procedures for scheduling feedback
// 3. TODO: Perform PHR procedures // 3. TODO: Perform PHR procedures
NR_UE_L2_STATE_t nr_ue_scheduler(const module_id_t module_id, NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_indication_t *ul_info){
const uint8_t gNB_index,
const int cc_id,
const frame_t rx_frame,
const slot_t rx_slot,
const int32_t ssb_index,
const frame_t tx_frame,
const slot_t tx_slot ){
uint32_t search_space_mask = 0; uint32_t search_space_mask = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
if (dl_info){
module_id_t mod_id = dl_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
int cc_id = dl_info->cc_id;
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
nr_scheduled_response_t scheduled_response;
nr_dcireq_t dcireq;
frame_t rx_frame = dl_info->frame;
slot_t rx_slot = dl_info->slot;
// check type0 from 38.213 13 if we have no CellGroupConfig // check type0 from 38.213 13 if we have no CellGroupConfig
if ( mac->scd == NULL) { // TODO: implementation to be completed
if( ssb_index != -1){ if (mac->scd == NULL) {
if(dl_info->ssb_index != -1){
if(mac->type0_pdcch_ss_mux_pattern == 1){ if(mac->type0_pdcch_ss_mux_pattern == 1){
// 38.213 chapter 13 // 38.213 chapter 13
...@@ -712,16 +714,34 @@ NR_UE_L2_STATE_t nr_ue_scheduler(const module_id_t module_id, ...@@ -712,16 +714,34 @@ NR_UE_L2_STATE_t nr_ue_scheduler(const module_id_t module_id,
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP); dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP);
*/ */
dl_config->number_pdus = dl_config->number_pdus + 1; dl_config->number_pdus = dl_config->number_pdus + 1;
mac->scheduled_response.dl_config = dl_config;
} }
} } else { // get PDCCH configuration(s) from SCGConfig
else { // get PDCCH configuration(s) from SCGConfig // get Coreset and SearchSpace Information from spCellConfigDedicated
// DCI configuration done for BWP 1, Coreset 0, SearchSpace 0
// TBR first thing to do : schedule msg2
// TBR program DCI for slot 1 if PDSCH
// TBR program DCI for slot 7 if RAR DCI PDSCH
// get Coreset and SearchSpace Information from spCellConfigDedicated dcireq.module_id = mod_id;
dcireq.gNB_index = 0;
dcireq.cc_id = 0;
dcireq.frame = rx_frame; // TBR not needed
dcireq.slot = rx_slot;
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
// we should have received a DL DCI here, so configure DL accordingly
scheduled_response.dl_config = &dcireq.dl_config_req;
scheduled_response.ul_config = NULL;
scheduled_response.tx_request = NULL;
scheduled_response.module_id = mod_id;
scheduled_response.CC_id = cc_id;
scheduled_response.frame = rx_frame;
scheduled_response.slot = rx_slot;
nr_ue_scheduled_response(&scheduled_response);
/* /*
if(search_space_mask & type0a_pdcch){ if(search_space_mask & type0a_pdcch){
...@@ -737,14 +757,15 @@ NR_UE_L2_STATE_t nr_ue_scheduler(const module_id_t module_id, ...@@ -737,14 +757,15 @@ NR_UE_L2_STATE_t nr_ue_scheduler(const module_id_t module_id,
} }
*/ */
} }
} else if (ul_info) {
if (mac->RA_contention_resolution_timer_active == 1) { module_id_t mod_id = ul_info->module_id;
ue_contention_resolution(module_id, gNB_index, cc_id, tx_frame); NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
// TODO: expand
// Note: Contention resolution is currently not active
if (mac->RA_contention_resolution_timer_active == 1)
ue_contention_resolution(mod_id, ul_info->gNB_index, ul_info->cc_id, ul_info->frame_tx);
} }
mac->scheduled_response.dl_config = dl_config;
return UE_CONNECTION_OK; return UE_CONNECTION_OK;
} }
......
...@@ -113,14 +113,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ...@@ -113,14 +113,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
mac->dl_config_request.number_pdus = 0; mac->dl_config_request.number_pdus = 0;
// clean previous FAPI messages // clean previous FAPI messages
ret = nr_ue_scheduler(ul_info->module_id, ret = nr_ue_scheduler(NULL, ul_info);
ul_info->gNB_index,
ul_info->cc_id,
ul_info->frame_rx,
ul_info->slot_rx,
ul_info->ssb_index,
ul_info->frame_tx,
ul_info->slot_tx);
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra) if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra)
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx); nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx);
...@@ -313,6 +306,8 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) { ...@@ -313,6 +306,8 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) {
dl_config->slot=UE_mac->dl_config_request.slot; dl_config->slot=UE_mac->dl_config_request.slot;
dl_config->number_pdus=0; dl_config->number_pdus=0;
printf(" UE_mac->dl_config_request.slot %d VS dcireq->slot %d \n", UE_mac->dl_config_request.slot, dcireq->slot);
LOG_D(PHY, "Entering UE DCI configuration frame %d slot %d \n", dcireq->frame, dcireq->slot); LOG_D(PHY, "Entering UE DCI configuration frame %d slot %d \n", dcireq->frame, dcireq->slot);
ue_dci_configuration(UE_mac, dl_config, dcireq->slot); ue_dci_configuration(UE_mac, dl_config, dcireq->slot);
......
...@@ -72,7 +72,8 @@ typedef struct { ...@@ -72,7 +72,8 @@ typedef struct {
/// NR UE FAPI-like P7 message, direction: L1 to L2 /// NR UE FAPI-like P7 message, direction: L1 to L2
/// data reception indication structure /// data reception indication structure
fapi_nr_rx_indication_t *rx_ind; fapi_nr_rx_indication_t *rx_ind;
/// ssb_index, if ssb is not present in current TTI, value set to -1
int ssb_index;
/// dci reception indication structure /// dci reception indication structure
fapi_nr_dci_indication_t *dci_ind; fapi_nr_dci_indication_t *dci_ind;
...@@ -94,8 +95,6 @@ typedef struct { ...@@ -94,8 +95,6 @@ typedef struct {
frame_t frame_tx; frame_t frame_tx;
/// slot tx /// slot tx
uint32_t slot_tx; uint32_t slot_tx;
/// ssb_index, if ssb is not present in current TTI, thie value set to -1
int ssb_index;
/// dci reception indication structure /// dci reception indication structure
fapi_nr_dci_indication_t *dci_ind; fapi_nr_dci_indication_t *dci_ind;
} nr_uplink_indication_t; } nr_uplink_indication_t;
......
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