Add rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND and rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE
This commit is contained in:
@@ -551,6 +551,83 @@ gtpv1u_create_ngu_tunnel(
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int gtpv1u_delete_ngu_tunnel(
|
||||
const instance_t instanceP,
|
||||
const gtpv1u_gnb_delete_tunnel_req_t *const req_pP) {
|
||||
NwGtpv1uUlpApiT stack_req;
|
||||
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
|
||||
MessageDef *message_p = NULL;
|
||||
nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL;
|
||||
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
|
||||
teid_t teid_gNB = 0;
|
||||
int pdusession_index = 0;
|
||||
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_GNB_DELETE_TUNNEL_RESP);
|
||||
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti = req_pP->rnti;
|
||||
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status = 0;
|
||||
hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, req_pP->rnti, (void **)>pv1u_ue_data_p);
|
||||
|
||||
if (hash_rc == HASH_TABLE_OK) {
|
||||
for (pdusession_index = 0; pdusession_index < req_pP->num_pdusession; pdusession_index++) {
|
||||
teid_gNB = gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB;
|
||||
LOG_D(GTPU, "Rx GTPV1U_ENB_DELETE_TUNNEL user rnti %x eNB S1U teid %u eps bearer id %u\n",
|
||||
req_pP->rnti, teid_gNB, req_pP->pdusession_id[pdusession_index]);
|
||||
{
|
||||
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
|
||||
stack_req.apiType = NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT;
|
||||
LOG_D(GTPU, "gtpv1u_delete_ngu_tunnel pdusession %u %u\n",
|
||||
req_pP->pdusession_id[pdusession_index],
|
||||
teid_gNB);
|
||||
stack_req.apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle =
|
||||
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB_stack_session;
|
||||
rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req);
|
||||
LOG_D(GTPU, ".\n");
|
||||
}
|
||||
|
||||
if (rc != NW_GTPV1U_OK) {
|
||||
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status |= 0xFF;
|
||||
LOG_E(GTPU, "NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT failed");
|
||||
}
|
||||
|
||||
//-----------------------
|
||||
// PDCP->GTPV1U mapping
|
||||
//-----------------------
|
||||
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].state = BEARER_DOWN;
|
||||
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB = 0;
|
||||
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_upf = 0;
|
||||
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].upf_ip_addr = 0;
|
||||
gtpv1u_ue_data_p->num_bearers -= 1;
|
||||
|
||||
if (gtpv1u_ue_data_p->num_bearers == 0) {
|
||||
hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->ue_mapping, req_pP->rnti);
|
||||
LOG_D(GTPU, "Removed user rnti %x,no more bearers configured\n", req_pP->rnti);
|
||||
}
|
||||
|
||||
//-----------------------
|
||||
// GTPV1U->PDCP mapping
|
||||
//-----------------------
|
||||
hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->teid_mapping, teid_gNB);
|
||||
|
||||
if (hash_rc != HASH_TABLE_OK) {
|
||||
LOG_D(GTPU, "Removed user rnti %x , gNB NGU teid %u not found\n", req_pP->rnti, teid_gNB);
|
||||
}
|
||||
}
|
||||
}// else silently do nothing
|
||||
|
||||
LOG_D(GTPU, "Tx GTPV1U_GNB_DELETE_TUNNEL_RESP user rnti %x gNB NGU teid %u status %u\n",
|
||||
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti,
|
||||
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).gnb_NGu_teid,
|
||||
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status);
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_GTPU_GNB,
|
||||
MSC_RRC_GNB,
|
||||
NULL,0,
|
||||
"0 GTPV1U_GNB_DELETE_TUNNEL_RESP rnti %x teid %x",
|
||||
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti,
|
||||
teid_gNB);
|
||||
return itti_send_msg_to_task(TASK_RRC_GNB, instanceP, message_p);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static int gtpv1u_gNB_send_init_udp(const Gtpv1uNGReq *req) {
|
||||
// Create and alloc new message
|
||||
@@ -603,6 +680,10 @@ void *gtpv1u_gNB_process_itti_msg(void *notUsed) {
|
||||
gtpv1u_ng_req(instance, &received_message_p->ittiMsg.gtpv1uNGReq);
|
||||
break;
|
||||
|
||||
case GTPV1U_GNB_DELETE_TUNNEL_REQ:
|
||||
gtpv1u_delete_ngu_tunnel(instance, &received_message_p->ittiMsg.NRGtpv1uDeleteTunnelReq);
|
||||
break;
|
||||
|
||||
case TERMINATE_MESSAGE: {
|
||||
if (RC.nr_gtpv1u_data_g->ue_mapping != NULL) {
|
||||
hashtable_destroy (&(RC.nr_gtpv1u_data_g->ue_mapping));
|
||||
|
||||
@@ -1754,7 +1754,7 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
|
||||
|
||||
return 0;
|
||||
}
|
||||
// handle e-rab release command and send it to rrc_end
|
||||
// handle pdu session release command and send it to rrc_end
|
||||
static
|
||||
int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
@@ -1772,7 +1772,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
|
||||
container = &pdu->choice.initiatingMessage->value.choice.PDUSessionResourceReleaseCommand;
|
||||
|
||||
if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
|
||||
NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing AMF context\n", assoc_id);
|
||||
NGAP_ERROR("[SCTP %d] Received pdu session release command for non existing AMF context\n", assoc_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1805,11 +1805,11 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
|
||||
}
|
||||
|
||||
/* Initial context request = UE-related procedure -> stream != 0 */
|
||||
if (stream == 0) {
|
||||
NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n",
|
||||
assoc_id, stream);
|
||||
return -1;
|
||||
}
|
||||
// if (stream == 0) {
|
||||
// NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n",
|
||||
// assoc_id, stream);
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
ue_desc_p->rx_stream = stream;
|
||||
|
||||
@@ -1818,7 +1818,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
|
||||
(uint64_t)ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id);
|
||||
}
|
||||
|
||||
NGAP_DEBUG("[SCTP %d] Received E-RAB release command for gNB_UE_NGAP_ID %lu amf_ue_ngap_id %lu\n",
|
||||
NGAP_DEBUG("[SCTP %d] Received pdu session release command for gNB_UE_NGAP_ID %lu amf_ue_ngap_id %lu\n",
|
||||
assoc_id, gnb_ue_ngap_id, amf_ue_ngap_id);
|
||||
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_RELEASE_COMMAND);
|
||||
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = gnb_ue_ngap_id;
|
||||
@@ -1850,7 +1850,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
|
||||
item_p = (NGAP_PDUSessionResourceToReleaseItemRelCmd_t *)ie->value.choice.PDUSessionResourceToReleaseListRelCmd.list.array[i];
|
||||
|
||||
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].pdusession_id = item_p->pDUSessionID;
|
||||
NGAP_DEBUG("[SCTP] Received E-RAB release command for pDUSessionID id %ld\n", item_p->pDUSessionID);
|
||||
NGAP_DEBUG("[SCTP] Received pdu session release command for pDUSessionID id %ld\n", item_p->pDUSessionID);
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user