fix RRCConnectionReestablishment issue when multiple RRCConnectionReestablishment happen
This commit is contained in:
@@ -814,40 +814,81 @@ int gtpv1u_update_s1u_tunnel(
|
||||
const rnti_t prior_rnti
|
||||
)
|
||||
{
|
||||
|
||||
/* Local tunnel end-point identifier */
|
||||
teid_t s1u_teid = 0;
|
||||
gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL;
|
||||
gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL;
|
||||
gtpv1u_ue_data_t *gtpv1u_ue_data_new_p = NULL;
|
||||
//MessageDef *message_p = NULL;
|
||||
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
|
||||
int i;
|
||||
ebi_t eps_bearer_id = 0;
|
||||
int i,j;
|
||||
uint8_t bearers_num = 0,bearers_total = 0;
|
||||
|
||||
//-----------------------
|
||||
// PDCP->GTPV1U mapping
|
||||
//-----------------------
|
||||
hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, prior_rnti, (void **)>pv1u_ue_data_p);
|
||||
AssertFatal(hash_rc == HASH_TABLE_OK, "Error get ue_mapping(rnti=%x) from GTPV1U hashtable error\n", prior_rnti);
|
||||
if(hash_rc != HASH_TABLE_OK){
|
||||
LOG_E(GTPU,"Error get ue_mapping(rnti=%x) from GTPV1U hashtable error\n", prior_rnti);
|
||||
return -1;
|
||||
}
|
||||
|
||||
gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->rnti;
|
||||
hash_rc = hashtable_insert(RC.gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_p);
|
||||
gtpv1u_ue_data_new_p = calloc (1, sizeof(gtpv1u_ue_data_t));
|
||||
memcpy(gtpv1u_ue_data_new_p,gtpv1u_ue_data_p,sizeof(gtpv1u_ue_data_t));
|
||||
gtpv1u_ue_data_new_p->ue_id = create_tunnel_req_pP->rnti;
|
||||
|
||||
hash_rc = hashtable_insert(RC.gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_new_p);
|
||||
AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable");
|
||||
LOG_I(GTPU, "inserting ue_mapping(rnti=%x) in GTPV1U hashtable\n",
|
||||
create_tunnel_req_pP->rnti);
|
||||
|
||||
hash_rc = hashtable_remove(RC.gtpv1u_data_g->ue_mapping, prior_rnti);
|
||||
LOG_I(GTPU, "hashtable_remove ue_mapping(rnti=%x) in GTPV1U hashtable\n",
|
||||
prior_rnti);
|
||||
//-----------------------
|
||||
// GTPV1U->PDCP mapping
|
||||
//-----------------------
|
||||
for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) {
|
||||
eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i];
|
||||
s1u_teid = gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB;
|
||||
hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, s1u_teid, (void**)>pv1u_teid_data_p);
|
||||
AssertFatal(hash_rc == HASH_TABLE_OK, "Error get teid mapping(s1u_teid=%u) from GTPV1U hashtable", s1u_teid);
|
||||
bearers_total =gtpv1u_ue_data_new_p->num_bearers;
|
||||
for(j = 0;j<GTPV1U_MAX_BEARERS_ID;j++){
|
||||
|
||||
gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti;
|
||||
gtpv1u_teid_data_p->eps_bearer_id = eps_bearer_id;
|
||||
if(gtpv1u_ue_data_new_p->bearers[j].state != BEARER_IN_CONFIG)
|
||||
continue;
|
||||
|
||||
bearers_num++;
|
||||
for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) {
|
||||
if(j == (create_tunnel_req_pP->eps_bearer_id[i]-GTPV1U_BEARER_OFFSET))
|
||||
break;
|
||||
}
|
||||
if(i < create_tunnel_req_pP->num_tunnels){
|
||||
s1u_teid = gtpv1u_ue_data_new_p->bearers[j].teid_eNB;
|
||||
hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, s1u_teid, (void**)>pv1u_teid_data_p);
|
||||
if (hash_rc == HASH_TABLE_OK) {
|
||||
gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti;
|
||||
gtpv1u_teid_data_p->eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i];
|
||||
|
||||
LOG_I(GTPU, "updata teid_mapping te_id %u (prior_rnti %x rnti %x) in GTPV1U hashtable\n",
|
||||
s1u_teid,prior_rnti,create_tunnel_req_pP->rnti);
|
||||
}else{
|
||||
LOG_W(GTPU, "Error get teid mapping(s1u_teid=%u) from GTPV1U hashtable", s1u_teid);
|
||||
}
|
||||
}else{
|
||||
s1u_teid = gtpv1u_ue_data_new_p->bearers[j].teid_eNB;
|
||||
hash_rc = hashtable_remove(RC.gtpv1u_data_g->teid_mapping, s1u_teid);
|
||||
|
||||
if (hash_rc != HASH_TABLE_OK) {
|
||||
LOG_D(GTPU, "Removed user rnti %x , enb S1U teid %u not found\n", prior_rnti, s1u_teid);
|
||||
}
|
||||
gtpv1u_ue_data_new_p->bearers[j].state = BEARER_DOWN;
|
||||
gtpv1u_ue_data_new_p->num_bearers--;
|
||||
LOG_I(GTPU, "delete teid_mapping te_id %u (rnti%x) bearer_id %d in GTPV1U hashtable\n",
|
||||
s1u_teid,prior_rnti,j+GTPV1U_BEARER_OFFSET);;
|
||||
}
|
||||
if(bearers_num > bearers_total)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user