Merge remote-tracking branch 'origin/NR_UE_contention_resolution_timer' into integration_2024_w08
This commit is contained in:
+6
-3
@@ -533,20 +533,23 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void processSlotTX(void *arg) {
|
void processSlotTX(void *arg)
|
||||||
|
{
|
||||||
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
|
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
|
||||||
const UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
const UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
||||||
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
||||||
nr_phy_data_tx_t phy_data = {0};
|
nr_phy_data_tx_t phy_data = {0};
|
||||||
|
|
||||||
|
if (UE->if_inst)
|
||||||
|
UE->if_inst->slot_indication(UE->Mod_id);
|
||||||
|
|
||||||
LOG_D(PHY,
|
LOG_D(PHY,
|
||||||
"SlotTx %d.%d => slot type %d, wait: %d \n",
|
"SlotTx %d.%d => slot type %d, wait: %d \n",
|
||||||
proc->frame_tx,
|
proc->frame_tx,
|
||||||
proc->nr_slot_tx,
|
proc->nr_slot_tx,
|
||||||
proc->tx_slot_type,
|
proc->tx_slot_type,
|
||||||
rxtxD->tx_wait_for_dlsch);
|
rxtxD->tx_wait_for_dlsch);
|
||||||
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT){
|
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT) {
|
||||||
if (rxtxD->tx_wait_for_dlsch)
|
if (rxtxD->tx_wait_for_dlsch)
|
||||||
LOG_D(PHY, "enter wait for tx, slot %d, nb events to wait %d; ", proc->nr_slot_tx, rxtxD->tx_wait_for_dlsch);
|
LOG_D(PHY, "enter wait for tx, slot %d, nb events to wait %d; ", proc->nr_slot_tx, rxtxD->tx_wait_for_dlsch);
|
||||||
// wait for rx slots to send indication (if any) that DLSCH decoding is finished
|
// wait for rx slots to send indication (if any) that DLSCH decoding is finished
|
||||||
|
|||||||
@@ -322,10 +322,8 @@ typedef struct {
|
|||||||
/// Msg3 buffer
|
/// Msg3 buffer
|
||||||
uint8_t *Msg3_buffer;
|
uint8_t *Msg3_buffer;
|
||||||
|
|
||||||
/// Random-access Contention Resolution Timer active flag
|
/// Random-access Contention Resolution Timer
|
||||||
uint8_t RA_contention_resolution_timer_active;
|
NR_timer_t contention_resolution_timer;
|
||||||
int RA_contention_resolution_target_frame;
|
|
||||||
int RA_contention_resolution_target_slot;
|
|
||||||
/// Transmitted UE Contention Resolution Identifier
|
/// Transmitted UE Contention Resolution Identifier
|
||||||
uint8_t cont_res_id[6];
|
uint8_t cont_res_id[6];
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,7 @@
|
|||||||
void nr_ue_init_mac(NR_UE_MAC_INST_t *mac);
|
void nr_ue_init_mac(NR_UE_MAC_INST_t *mac);
|
||||||
|
|
||||||
void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data);
|
void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data);
|
||||||
|
void update_mac_timers(NR_UE_MAC_INST_t *mac);
|
||||||
|
|
||||||
/**\brief apply default configuration values in nr_mac instance
|
/**\brief apply default configuration values in nr_mac instance
|
||||||
\param mac mac instance */
|
\param mac mac instance */
|
||||||
|
|||||||
@@ -592,22 +592,14 @@ void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, s
|
|||||||
RA_config_t *ra = &mac->ra;
|
RA_config_t *ra = &mac->ra;
|
||||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP->rach_ConfigCommon;
|
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP->rach_ConfigCommon;
|
||||||
long mu = mac->current_UL_BWP->scs;
|
long mu = mac->current_UL_BWP->scs;
|
||||||
int subframes_per_slot = nr_slots_per_frame[mu]/10;
|
int subframes_per_slot = nr_slots_per_frame[mu] / 10;
|
||||||
|
|
||||||
// start contention resolution timer (cnt in slots)
|
// start contention resolution timer
|
||||||
int RA_contention_resolution_timer_subframes = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1)<<3;
|
int RA_contention_resolution_timer_subframes = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) << 3;
|
||||||
|
// timer step 1 slot and timer target given by ra_ContentionResolutionTimer
|
||||||
|
nr_timer_setup(&ra->contention_resolution_timer, RA_contention_resolution_timer_subframes * subframes_per_slot, 1);
|
||||||
|
nr_timer_start(&ra->contention_resolution_timer);
|
||||||
|
|
||||||
ra->RA_contention_resolution_target_frame = (frameP + (RA_contention_resolution_timer_subframes/10)) % MAX_FRAME_NUMBER;
|
|
||||||
ra->RA_contention_resolution_target_slot = (slotP + (RA_contention_resolution_timer_subframes * subframes_per_slot)) % nr_slots_per_frame[mu];
|
|
||||||
|
|
||||||
LOG_D(MAC,"[UE %d] CB-RA: contention resolution timer set in frame.slot %d.%d and expiring in %d.%d\n",
|
|
||||||
mac->ue_id,
|
|
||||||
frameP,
|
|
||||||
slotP,
|
|
||||||
ra->RA_contention_resolution_target_frame,
|
|
||||||
ra->RA_contention_resolution_target_slot);
|
|
||||||
|
|
||||||
ra->RA_contention_resolution_timer_active = 1;
|
|
||||||
ra->ra_state = WAIT_CONTENTION_RESOLUTION;
|
ra->ra_state = WAIT_CONTENTION_RESOLUTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -770,7 +762,7 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ra->RA_contention_resolution_timer_active) {
|
if (is_nr_timer_active(ra->contention_resolution_timer)) {
|
||||||
nr_ue_contention_resolution(mac, CC_id, frame, nr_slot_tx, prach_resources);
|
nr_ue_contention_resolution(mac, CC_id, frame, nr_slot_tx, prach_resources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -826,16 +818,12 @@ void nr_ue_contention_resolution(NR_UE_MAC_INST_t *mac, int cc_id, frame_t frame
|
|||||||
{
|
{
|
||||||
RA_config_t *ra = &mac->ra;
|
RA_config_t *ra = &mac->ra;
|
||||||
|
|
||||||
if (ra->RA_contention_resolution_timer_active == 1) {
|
if (nr_timer_expired(ra->contention_resolution_timer)) {
|
||||||
if (frame >= ra->RA_contention_resolution_target_frame &&
|
ra->t_crnti = 0;
|
||||||
slot >= ra->RA_contention_resolution_target_slot) {
|
nr_timer_stop(&ra->contention_resolution_timer);
|
||||||
ra->t_crnti = 0;
|
// Signal PHY to quit RA procedure
|
||||||
ra->RA_active = 0;
|
LOG_E(MAC, "[UE %d] CB-RA: Contention resolution timer has expired, RA procedure has failed...\n", mac->ue_id);
|
||||||
ra->RA_contention_resolution_timer_active = 0;
|
nr_ra_failed(mac, cc_id, prach_resources, frame, slot);
|
||||||
// Signal PHY to quit RA procedure
|
|
||||||
LOG_E(MAC, "[UE %d] CB-RA: Contention resolution timer has expired, RA procedure has failed...\n", mac->ue_id);
|
|
||||||
nr_ra_failed(mac, cc_id, prach_resources, frame, slot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,7 +840,7 @@ void nr_ra_succeeded(NR_UE_MAC_INST_t *mac, const uint8_t gNB_index, const frame
|
|||||||
ra->RA_window_cnt = -1;
|
ra->RA_window_cnt = -1;
|
||||||
} else {
|
} else {
|
||||||
LOG_A(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CB-RA: Contention Resolution is successful.\n", mac->ue_id, frame, slot);
|
LOG_A(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CB-RA: Contention Resolution is successful.\n", mac->ue_id, frame, slot);
|
||||||
ra->RA_contention_resolution_timer_active = 0;
|
nr_timer_stop(&ra->contention_resolution_timer);
|
||||||
mac->crnti = ra->t_crnti;
|
mac->crnti = ra->t_crnti;
|
||||||
ra->t_crnti = 0;
|
ra->t_crnti = 0;
|
||||||
LOG_D(MAC, "[UE %d][%d.%d] CB-RA: cleared contention resolution timer...\n", mac->ue_id, frame, slot);
|
LOG_D(MAC, "[UE %d][%d.%d] CB-RA: cleared contention resolution timer...\n", mac->ue_id, frame, slot);
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ fapi_nr_ul_config_request_pdu_t *lockGet_ul_config(NR_UE_MAC_INST_t *mac, frame_
|
|||||||
return pdu;
|
return pdu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void update_mac_timers(NR_UE_MAC_INST_t *mac)
|
||||||
|
{
|
||||||
|
nr_timer_tick(&mac->ra.contention_resolution_timer);
|
||||||
|
}
|
||||||
|
|
||||||
void remove_ul_config_last_item(fapi_nr_ul_config_request_pdu_t *pdu)
|
void remove_ul_config_last_item(fapi_nr_ul_config_request_pdu_t *pdu)
|
||||||
{
|
{
|
||||||
pdu->privateNBpdus--;
|
pdu->privateNBpdus--;
|
||||||
|
|||||||
@@ -1278,6 +1278,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
|
|||||||
return ret2;
|
return ret2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nr_ue_slot_indication(uint8_t mod_id)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&mac_IF_mutex);
|
||||||
|
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||||
|
update_mac_timers(mac);
|
||||||
|
pthread_mutex_unlock(&mac_IF_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id)
|
nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id)
|
||||||
{
|
{
|
||||||
if (nr_ue_if_module_inst[module_id] == NULL) {
|
if (nr_ue_if_module_inst[module_id] == NULL) {
|
||||||
@@ -1295,6 +1303,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id)
|
|||||||
nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response;
|
nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response;
|
||||||
nr_ue_if_module_inst[module_id]->dl_indication = nr_ue_dl_indication;
|
nr_ue_if_module_inst[module_id]->dl_indication = nr_ue_dl_indication;
|
||||||
nr_ue_if_module_inst[module_id]->ul_indication = nr_ue_ul_indication;
|
nr_ue_if_module_inst[module_id]->ul_indication = nr_ue_ul_indication;
|
||||||
|
nr_ue_if_module_inst[module_id]->slot_indication = nr_ue_slot_indication;
|
||||||
}
|
}
|
||||||
pthread_mutex_init(&mac_IF_mutex, NULL);
|
pthread_mutex_init(&mac_IF_mutex, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info);
|
|||||||
*/
|
*/
|
||||||
typedef int (nr_ue_ul_indication_f)(nr_uplink_indication_t *ul_info);
|
typedef int (nr_ue_ul_indication_f)(nr_uplink_indication_t *ul_info);
|
||||||
|
|
||||||
|
typedef void (nr_ue_slot_indication_f)(uint8_t mod_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic type of an application-defined callback to return various
|
* Generic type of an application-defined callback to return various
|
||||||
@@ -263,6 +264,7 @@ typedef struct nr_ue_if_module_s {
|
|||||||
nr_ue_dl_indication_f *dl_indication;
|
nr_ue_dl_indication_f *dl_indication;
|
||||||
nr_ue_ul_indication_f *ul_indication;
|
nr_ue_ul_indication_f *ul_indication;
|
||||||
nr_ue_sl_indication_f *sl_indication;
|
nr_ue_sl_indication_f *sl_indication;
|
||||||
|
nr_ue_slot_indication_f *slot_indication;
|
||||||
uint32_t cc_mask;
|
uint32_t cc_mask;
|
||||||
uint32_t current_frame;
|
uint32_t current_frame;
|
||||||
uint32_t current_slot;
|
uint32_t current_slot;
|
||||||
|
|||||||
Reference in New Issue
Block a user