Commit 93f42683 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/NR_improve_UE_state_machine' into integration_2023_w11b

parents 6fdb4495 bc73e73c
......@@ -352,8 +352,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
mac->scc_SIB->tdd_UL_DL_ConfigurationCommon,
ul_info.slot_tx, mac->frame_type)) {
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler() from %s\n", ul_info.slot_tx, __FUNCTION__);
nr_ue_scheduler(NULL, &ul_info);
nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx);
nr_ue_ul_scheduler(&ul_info);
nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, NULL);
}
if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) {
......
......@@ -510,9 +510,9 @@ int main( int argc, char **argv ) {
nr_band);
}
else{
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
DevAssert(mac->if_module != NULL && mac->if_module->phy_config_request != NULL);
mac->if_module->phy_config_request(&mac->phy_config);
mac->phy_config_request_sent = true;
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config,
......
......@@ -421,7 +421,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
for (int i = 0; i < ul_config->number_pdus; ++i){
AssertFatal(ul_config->ul_config_list[i].pdu_type <= FAPI_NR_UL_CONFIG_TYPES,"pdu_type %d out of bounds\n",ul_config->ul_config_list[i].pdu_type);
LOG_D(PHY, "In %s i %d: processing %s PDU of %d total UL PDUs (ul_config %p) \n", __FUNCTION__, i, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config);
LOG_D(PHY, "[%d.%d] i %d: processing %s PDU of %d total UL PDUs (ul_config %p) \n",
scheduled_response->frame, slot, i, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config);
uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type, current_harq_pid, gNB_id = 0;
/* PRACH */
......@@ -447,7 +448,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
LOG_D(PHY, "In %s i %d: copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n", __FUNCTION__, i, pusch_config_pdu->nrOfLayers,pusch_config_pdu->num_dmrs_cdm_grps_no_data);
memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t));
if (scheduled_response->tx_request) {
for (int j=0; j<scheduled_response->tx_request->number_of_pdus; j++) {
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j];
......@@ -541,17 +541,10 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
return 0;
}
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config)
{
fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config;
if(phy_config != NULL)
memcpy(nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t));
return 0;
}
......@@ -852,6 +852,7 @@ int main(int argc, char **argv)
UE->chest_time = chest_type[1];
UE_mac->if_module = nr_ue_if_module_init(0);
UE_mac->state = UE_CONNECTED;
unsigned int available_bits=0;
unsigned char *estimated_output_bit;
......
......@@ -684,6 +684,7 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
UL_BWP->initial_BWPStart = mac->scc ? NRRIV2PRBOFFSET(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) :
NRRIV2PRBOFFSET(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
}
......@@ -732,6 +733,7 @@ int nr_rrc_mac_config_req_ue(module_id_t module_id,
build_ssb_to_ro_map(mac);//->scc, mac->phy_config.config_req.cell_config.frame_duplex_type);
if (!get_softmodem_params()->emulate_l1)
mac->if_module->phy_config_request(&mac->phy_config);
mac->phy_config_request_sent = true;
}
if(scell_group_config != NULL ){
mac->cg = scell_group_config;
......
......@@ -159,10 +159,11 @@
/*!\brief UE layer 2 status */
typedef enum {
UE_CONNECTION_OK = 0,
UE_CONNECTION_LOST,
UE_PHY_RESYNCH,
UE_PHY_HO_PRACH
UE_NOT_SYNC = 0,
UE_SYNC,
UE_PERFORMING_RA,
UE_WAIT_TX_ACK_MSG4,
UE_CONNECTED
} NR_UE_L2_STATE_t;
typedef enum {
......@@ -380,7 +381,7 @@ typedef struct {
/*!\brief Top level UE MAC structure */
typedef struct {
NR_UE_L2_STATE_t state;
NR_ServingCellConfigCommon_t *scc;
NR_ServingCellConfigCommonSIB_t *scc_SIB;
NR_CellGroupConfig_t *cg;
......@@ -406,6 +407,7 @@ typedef struct {
NR_ControlResourceSet_t *coreset[MAX_NUM_BWP_UE][FAPI_NR_MAX_CORESET_PER_BWP];
NR_SearchSpace_t *SSpace[MAX_NUM_BWP_UE][FAPI_NR_MAX_SS];
bool phy_config_request_sent;
frame_type_t frame_type;
/// Type0-PDCCH seach space
......
......@@ -120,7 +120,8 @@ NR_UE_MAC_INST_t *get_mac_inst(
performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures.
\param dl_info DL indication
\param ul_info UL indication*/
NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_indication_t *ul_info);
void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info);
void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info);
/**\brief fill nr_scheduled_response struct instance
@param nr_scheduled_response_t * pointer to scheduled_response instance to fill
......
......@@ -53,6 +53,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST);
nr_ue_mac_inst->first_sync_frame = -1;
nr_ue_mac_inst->sib1_decoded = false;
nr_ue_mac_inst->phy_config_request_sent = false;
nr_ue_mac_inst->state = UE_NOT_SYNC;
for (int j=0;j<NB_NR_UE_MAC_INST;j++) {
nr_ue_init_mac(j);
......
......@@ -141,7 +141,7 @@ void init_RA(module_id_t mod_id,
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
mac->state = UE_PERFORMING_RA;
RA_config_t *ra = &mac->ra;
ra->RA_active = 1;
ra->ra_PreambleIndex = -1;
......@@ -734,8 +734,8 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
int CC_id,
frame_t frame,
uint8_t gNB_id,
int nr_slot_tx){
int nr_slot_tx)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
RA_config_t *ra = &mac->ra;
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = ra->rach_ConfigDedicated;
......@@ -1007,27 +1007,21 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){
RA_config_t *ra = &mac->ra;
if (ra->cfra) {
LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received.\n", mod_id, frame, slot);
mac->state = UE_CONNECTED;
ra->RA_window_cnt = -1;
} else {
LOG_A(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CB-RA: Contention Resolution is successful.\n", mod_id, frame, slot);
ra->RA_contention_resolution_timer_active = 0;
mac->crnti = ra->t_crnti;
ra->t_crnti = 0;
LOG_D(MAC, "In %s: [UE %d][%d.%d] CB-RA: cleared contention resolution timer...\n", __FUNCTION__, mod_id, frame, slot);
mac->state = UE_WAIT_TX_ACK_MSG4;
}
LOG_D(MAC, "In %s: [UE %d] clearing RA_active flag...\n", __FUNCTION__, mod_id);
ra->RA_active = 0;
ra->ra_state = RA_SUCCEEDED;
}
// Handling failure of RA procedure @ MAC layer
......
......@@ -268,7 +268,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
uint8_t bwp_id = mac->current_DL_BWP.bwp_id;
//NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
NR_BWP_DownlinkDedicated_t *bwpd = (bwp_id>0) ? mac->DLbwp[bwp_id-1]->bwp_Dedicated : mac->cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP;
NR_BWP_DownlinkDedicated_t *bwpd = (bwp_id>0) ? mac->DLbwp[bwp_id-1]->bwp_Dedicated : (mac->cg ? mac->cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL);
NR_BWP_DownlinkCommon_t *bwp_Common = (bwp_id>0) ? mac->DLbwp[bwp_id-1]->bwp_Common : &mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP;
LOG_D(NR_MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti);
......@@ -376,7 +376,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
// this is an USS
if (ss->searchSpaceType->choice.ue_Specific &&
ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1 &&
(ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) &&
mac->state == UE_CONNECTED &&
mac->crnti > 0) {
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
......@@ -417,6 +417,6 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
} // for ss_id
}
else {
AssertFatal(1==0,"Handle DCI searching when CellGroup without dedicated BWP\n");
LOG_E(MAC,"Cannot handle DCI without dedicated BWP\n");
}
}
......@@ -319,6 +319,11 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
mac->dl_config_request.sfn = frame;
mac->dl_config_request.slot = ssb_start_symbol/14;
if(get_softmodem_params()->phy_test)
mac->state = UE_CONNECTED;
else if(mac->state == UE_NOT_SYNC)
mac->state = UE_SYNC;
return 0;
}
......
......@@ -764,8 +764,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
}
// Periodic SRS scheduling
bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slot) {
bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slot)
{
bool srs_scheduled = false;
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
......@@ -886,10 +886,8 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo
// 1. TODO: Call RRC for link status return to PHY
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
// 3. TODO: Perform PHR procedures
NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_indication_t *ul_info){
if (dl_info){
void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info)
{
module_id_t mod_id = dl_info->module_id;
uint32_t gNB_index = dl_info->gNB_index;
int cc_id = dl_info->cc_id;
......@@ -902,7 +900,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
nr_scheduled_response_t scheduled_response;
nr_dcireq_t dcireq;
if(mac->cg != NULL){ // we have a cg
if(mac->state == UE_CONNECTED) {
dcireq.module_id = mod_id;
dcireq.gNB_index = gNB_index;
......@@ -923,7 +921,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
mac->if_module->scheduled_response(&scheduled_response);
}
}
else {
else if (mac->state == UE_PERFORMING_RA) {
// this is for Msg2/Msg4
if (mac->ra.ra_state >= WAIT_RAR) {
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
......@@ -939,13 +937,13 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
mac->if_module->scheduled_response(&scheduled_response);
}
}
else
{
dl_config->number_pdus = 0;
}
}
} else if (ul_info) {
}
void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
{
int cc_id = ul_info->cc_id;
frame_t frame_tx = ul_info->frame_tx;
slot_t slot_tx = ul_info->slot_tx;
......@@ -956,27 +954,29 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
RA_config_t *ra = &mac->ra;
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx);
if (!ul_config) {
if (!ul_config)
LOG_E(NR_MAC, "mac->ul_config is null!\n");
}
if(mac->state < UE_CONNECTED) {
nr_ue_get_rach(mod_id, cc_id, frame_tx, gNB_index, slot_tx);
nr_ue_prach_scheduler(mod_id, frame_tx, slot_tx);
}
// Periodic SRS scheduling
if(mac->state == UE_CONNECTED)
nr_ue_periodic_srs_scheduling(mod_id, frame_tx, slot_tx);
// Schedule ULSCH only if the current frame and slot match those in ul_config_req
// AND if a UL grant (UL DCI or Msg3) has been received (as indicated by num_pdus)
if (ul_config){
if (ul_config) {
pthread_mutex_lock(&ul_config->mutex_ul_config);
if ((ul_info->slot_tx == ul_config->slot && ul_info->frame_tx == ul_config->sfn) && ul_config->number_pdus > 0){
LOG_D(NR_MAC, "In %s:[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n", __FUNCTION__, frame_tx, slot_tx, ul_config->number_pdus, ul_config->sfn, ul_config->slot);
LOG_D(NR_MAC, "[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n", frame_tx, slot_tx, ul_config->number_pdus, ul_config->sfn, ul_config->slot);
uint8_t ulsch_input_buffer_array[NFAPI_MAX_NUM_UL_PDU][MAX_ULSCH_PAYLOAD_BYTES];
nr_scheduled_response_t scheduled_response;
fapi_nr_tx_request_t tx_req;
//tx_req.slot = slot_tx;
//tx_req.sfn = frame_tx;
tx_req.slot = slot_tx;
tx_req.sfn = frame_tx;
tx_req.number_of_pdus = 0;
......@@ -1007,9 +1007,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
} else {
if ((mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator ||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id]==1) &&
((get_softmodem_params()->phy_test == 1) ||
(ra->ra_state == RA_SUCCEEDED) ||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] == 1) &&
(mac->state == UE_CONNECTED ||
(ra->ra_state == WAIT_RAR && ra->cfra))){
// Getting IP traffic to be transmitted
......@@ -1042,7 +1041,6 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
}
}
pthread_mutex_unlock(&ul_config->mutex_ul_config); // avoid double lock
fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, frame_tx, slot_tx, ul_info->phy_data);
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
LOG_D(NR_MAC,"3# scheduled_response transmitted,%d, %d\n", frame_tx, slot_tx);
......@@ -1052,18 +1050,6 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
}
pthread_mutex_unlock(&ul_config->mutex_ul_config);
}
}
if (dl_info) {
return (UE_CONNECTION_OK);
}
module_id_t mod_id = ul_info->module_id;
frame_t txFrameP = ul_info->frame_tx;
slot_t txSlotP = ul_info->slot_tx;
// Handle the SR/BSR procedures per subframe
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
uint8_t gNB_indexP=0;
// Call BSR procedure as described in Section 5.4.5 in 38.321
......@@ -1079,21 +1065,22 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
}
//Check whether Regular BSR is triggered
if (nr_update_bsr(mod_id, txFrameP, txSlotP, gNB_indexP) == true) {
if (nr_update_bsr(mod_id, frame_tx, slot_tx, gNB_index) == true) {
// call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures
// outlined in Sections 5.4.4 an 5.4.5 of 38.321
mac->scheduling_info.SR_pending = 1;
// Regular BSR trigger
mac->BSR_reporting_active |= NR_BSR_TRIGGER_REGULAR;
LOG_D(NR_MAC, "[UE %d][BSR] Regular BSR Triggered Frame %d slot %d SR for PUSCH is pending\n",
mod_id, txFrameP, txSlotP);
mod_id, frame_tx, slot_tx);
}
return UE_CONNECTION_OK;
if(mac->state >= UE_PERFORMING_RA)
nr_ue_pucch_scheduler(mod_id,frame_tx, slot_tx, ul_info->phy_data);
}
bool
nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t gNB_index) {
bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t gNB_index)
{
mac_rlc_status_resp_t rlc_status;
bool bsr_regular_triggered = false;
uint8_t lcid;
......@@ -2111,7 +2098,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, vo
uint16_t rnti = mac->crnti; //FIXME not sure this is valid for all pucch instances
// SR
if (trigger_periodic_scheduling_request(mac, &pucch, frameP, slotP)) {
if (mac->state == UE_CONNECTED && trigger_periodic_scheduling_request(mac, &pucch, frameP, slotP)) {
O_SR = 1;
/* sr_payload = 1 means that this is a positive SR, sr_payload = 0 means that it is a negative SR */
pucch.sr_payload = nr_ue_get_SR(module_idP,
......@@ -2120,7 +2107,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, vo
}
// CSI
if (mac->ra.ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test == 1)
if (mac->state == UE_CONNECTED)
O_CSI = nr_get_csi_measurements(mac, frameP, slotP, &pucch);
// ACKNACK
......@@ -2170,15 +2157,14 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, vo
fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, phy_data);
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
mac->if_module->scheduled_response(&scheduled_response);
if(mac->state == UE_WAIT_TX_ACK_MSG4)
mac->state = UE_CONNECTED;
}
}
void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) {
if (mac->ra.ra_state != RA_SUCCEEDED && get_softmodem_params()->phy_test == 0)
return;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
if (!current_UL_BWP->csi_MeasConfig)
......@@ -2233,9 +2219,6 @@ void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) {
void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
if (mac->ra.ra_state != RA_SUCCEEDED && get_softmodem_params()->phy_test == 0)
return;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
if (!current_UL_BWP->csi_MeasConfig)
......
......@@ -736,7 +736,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
NR_UL_TIME_ALIGNMENT_t ul_time_alignment;
memset(&ul_time_alignment, 0, sizeof(ul_time_alignment));
fill_dci_from_dl_config(&mac->dl_info, &mac->dl_config_request);
nr_ue_scheduler(&mac->dl_info, NULL);
nr_ue_dl_scheduler(&mac->dl_info);
nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment);
if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort();
......@@ -756,8 +756,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
mac->scc_SIB->tdd_UL_DL_ConfigurationCommon,
ul_info.slot_tx,
mac->frame_type) && mac->ra.ra_state != RA_SUCCEEDED) {
nr_ue_scheduler(NULL, &ul_info);
nr_ue_prach_scheduler(ul_info.module_id, ul_info.frame_tx, ul_info.slot_tx);
nr_ue_ul_scheduler(&ul_info);
}
}
}
......@@ -1115,36 +1114,17 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac
}
}
int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
NR_UE_L2_STATE_t ret=0;
int nr_ue_ul_indication(nr_uplink_indication_t *ul_info)
{
module_id_t module_id = ul_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon;
LOG_T(NR_MAC, "In %s():%d not calling scheduler mac->ra.ra_state = %d\n",
__FUNCTION__, __LINE__, mac->ra.ra_state);
ret = nr_ue_scheduler(NULL, ul_info);
if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type)) {
nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->phy_data);
if (!get_softmodem_params()->phy_test)
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx);
}
switch(ret){
case UE_CONNECTION_OK:
break;
case UE_CONNECTION_LOST:
break;
case UE_PHY_RESYNCH:
break;
case UE_PHY_HO_PRACH:
break;
default:
break;
}
NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon;
if (mac->phy_config_request_sent && is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type))
nr_ue_ul_scheduler(ul_info);
return 0;
}
......@@ -1157,11 +1137,11 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
if ((!dl_info->dci_ind && !dl_info->rx_ind)) {
// UL indication to schedule DCI reception
nr_ue_scheduler(dl_info, NULL);
if (mac->phy_config_request_sent)
nr_ue_dl_scheduler(dl_info);
} else {
// UL indication after reception of DCI or DL PDU
if (dl_info && dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) {
LOG_T(MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n");
for (int i = 0; i < dl_info->dci_ind->number_of_dcis; i++) {
LOG_T(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis);
......
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