Commit 5406a453 authored by luis_pereira87's avatar luis_pereira87

Release RNTI of LTE PHY when RA does not succeed

parent 9068db43
...@@ -61,12 +61,17 @@ int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { ...@@ -61,12 +61,17 @@ int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
if (eNB->dlsch[i][0] == NULL) continue; if (eNB->dlsch[i][0] == NULL) continue;
LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index); LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
if (type == SEARCH_EXIST_RA) {
if (eNB->dlsch[i][0]->rnti==rnti) return i;
} else {
if ((eNB->dlsch[i][0]->harq_mask >0) && if ((eNB->dlsch[i][0]->harq_mask >0) &&
(eNB->dlsch[i][0]->rnti==rnti)) return i; (eNB->dlsch[i][0]->rnti==rnti)) return i;
else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
} }
if (type == SEARCH_EXIST) }
if (type == SEARCH_EXIST_RA || type == SEARCH_EXIST)
return -1; return -1;
if (first_free_index != -1) if (first_free_index != -1)
...@@ -83,12 +88,16 @@ int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { ...@@ -83,12 +88,16 @@ int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
for (int i=0; i<NUMBER_OF_ULSCH_MAX; i++) { for (int i=0; i<NUMBER_OF_ULSCH_MAX; i++) {
if (eNB->ulsch[i]==NULL) continue; if (eNB->ulsch[i]==NULL) continue;
if (type == SEARCH_EXIST_RA) {
if (eNB->ulsch[i]->rnti == rnti) return i;
} else {
if ((eNB->ulsch[i]->harq_mask >0) && if ((eNB->ulsch[i]->harq_mask >0) &&
(eNB->ulsch[i]->rnti==rnti)) return i; (eNB->ulsch[i]->rnti==rnti)) return i;
else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
} }
}
if (type == SEARCH_EXIST) if (type == SEARCH_EXIST_RA || type == SEARCH_EXIST)
return -1; return -1;
if (first_free_index != -1) if (first_free_index != -1)
......
...@@ -93,7 +93,8 @@ ...@@ -93,7 +93,8 @@
#define PMI_2A_R1_1j 2 #define PMI_2A_R1_1j 2
typedef enum { SEARCH_EXIST=0, typedef enum { SEARCH_EXIST=0,
SEARCH_EXIST_OR_FREE SEARCH_EXIST_OR_FREE,
SEARCH_EXIST_RA
} find_type_t; } find_type_t;
typedef enum { typedef enum {
......
...@@ -314,6 +314,11 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -314,6 +314,11 @@ rx_sdu(const module_id_t enb_mod_idP,
} }
if (no_sig || sduP == NULL) { // we've got an error on Msg3 if (no_sig || sduP == NULL) { // we've got an error on Msg3
if(no_sig) {
LOG_W(MAC,"No signal in Msg3\n");
}
LOG_D(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n", LOG_D(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",
enb_mod_idP, enb_mod_idP,
CC_idP, CC_idP,
...@@ -322,6 +327,20 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -322,6 +327,20 @@ rx_sdu(const module_id_t enb_mod_idP,
(int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx); (int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) { if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
// Release RNTI of LTE PHY when RA does not succeed
UE_free_list_t *free_list = NULL;
pthread_mutex_lock(&lock_ue_freelist);
free_list = &mac->UE_free_list;
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = current_rnti;
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = 1;
free_list->UE_free_ctrl[free_list->tail_freelist].raFlag = 1;
free_list->num_UEs++;
mac->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[mac->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = current_rnti;
mac->UE_release_req.ue_release_request_body.number_of_TLVs++;
free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1);
pthread_mutex_unlock(&lock_ue_freelist);
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
nfapi_hi_dci0_request_t *hi_dci0_req = NULL; nfapi_hi_dci0_request_t *hi_dci0_req = NULL;
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP], subframeP); uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP], subframeP);
......
...@@ -1192,6 +1192,8 @@ typedef struct { ...@@ -1192,6 +1192,8 @@ typedef struct {
rnti_t rnti; rnti_t rnti;
///remove UE context flag ///remove UE context flag
boolean_t removeContextFlg; boolean_t removeContextFlg;
///remove RA flag
boolean_t raFlag;
} UE_free_ctrl_t; } UE_free_ctrl_t;
/*! \brief REMOVE UE list used by eNB to order UEs/CC for deleting*/ /*! \brief REMOVE UE list used by eNB to order UEs/CC for deleting*/
typedef struct { typedef struct {
......
...@@ -997,6 +997,7 @@ void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag) { ...@@ -997,6 +997,7 @@ void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag) {
free_list = &eNB_MAC->UE_free_list; free_list = &eNB_MAC->UE_free_list;
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti; free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti;
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag; free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag;
free_list->UE_free_ctrl[free_list->tail_freelist].raFlag = 0;
free_list->num_UEs++; free_list->num_UEs++;
eNB_MAC->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = rnti; eNB_MAC->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = rnti;
eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++; eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++;
...@@ -1046,12 +1047,12 @@ void release_UE_in_freeList(module_id_t mod_id) { ...@@ -1046,12 +1047,12 @@ void release_UE_in_freeList(module_id_t mod_id) {
eNB_PHY = RC.eNB[mod_id][CC_id]; eNB_PHY = RC.eNB[mod_id][CC_id];
int id; int id;
// clean ULSCH entries for rnti // clean ULSCH entries for rnti
id = find_ulsch(rnti,eNB_PHY,SEARCH_EXIST); id = find_ulsch(rnti,eNB_PHY,eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
if (id>=0) clean_eNb_ulsch(eNB_PHY->ulsch[id]); if (id>=0) clean_eNb_ulsch(eNB_PHY->ulsch[id]);
// clean DLSCH entries for rnti // clean DLSCH entries for rnti
id = find_dlsch(rnti,eNB_PHY,SEARCH_EXIST); id = find_dlsch(rnti,eNB_PHY,eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
if (id>=0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]); if (id>=0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]);
......
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