Commit 5dc6712c authored by zhenghuangkun's avatar zhenghuangkun

Add InitialUEMessage And InitialContextSetupRequest Message

parent c8b67cb1
dev 1 256_QAM_demod 512-dataplane-bug-in-l2nfapi_nos1 FR2_NSA Fix_SA_SIB1 NR-PHY-MAC-IF-multi-UE NRPRACH_highSpeed_saankhya NRUE_usedlschparallel NR_10MHz NR_2port_CSIRS NR_CSIRS_tomerge NR_DLUL_PF NR_DLUL_PF_4UL NR_DLUL_PF_rebased NR_DL_MIMO NR_F1C_F1U_extensions NR_FAPI_beamindex_SSB_RO NR_FAPI_beamindex_SSB_RO_SEMPROJ NR_FDD_FIX NR_FR2_RA NR_FR2_RRC_SSB NR_FR2_initsync_fixes NR_MAC_Multi_Rach_GlobalEdge NR_MAC_Multi_Rach_GlobalEdge-old NR_MAC_SSB NR_MAC_TCI_UCI_GlobalEdge NR_MCS_BLER NR_PUCCH_MultiUE NR_RA_cleanup NR_SA_F1AP_5GRECORDS NR_SA_F1AP_5GRECORDS-USIM NR_SA_F1AP_5GRECORDS-wf-0623 NR_SA_F1AP_5GRECORDS_lts NR_SA_F1AP_RFSIMULATOR NR_SA_F1AP_RFSIMULATOR2 NR_SA_F1AP_RFSIMULATOR2_SRB NR_SA_F1AP_RFSIMULATOR3 NR_SA_F1AP_RFSIMULATOR3_tmp NR_SA_F1AP_RFSIMULATOR3_wf NR_SA_F1AP_RFSIMULATOR_w5GCN NR_SA_F1AP_dev NR_SA_NGAP_RRC NR_SA_NGAP_RRC_wk42 NR_SA_itti_sim_wk48 NR_SA_itti_sim_wk48_hs NR_SA_itti_sim_wk48_hs1 NR_SA_w5GCN_new_gtpu NR_SCHED_HARQ NR_SCHED_PDCCH_PUCCH_HARQ NR_SCHED_PDCCH_PUCCH_HARQ_rebased NR_SCHED_fixes NR_SRB_Config NR_UE_CONFIG_REQ_FIXES NR_UE_PUCCH_bugfixes NR_UE_SA NR_UE_dlsch_bugfix NR_UE_rework_test NR_UE_reworking_UCI_procedures NR_UL_SCFDMA_100MHz NR_UL_scheduler NR_UL_scheduler_rebased NR_Wireshark NR_beam_simulation NR_cleanup_PUCCH_resources NR_gNB_initial_MIB_fix NR_multiplexing_HARQ_CSI_PUCCH NR_phytest_bugfixes NR_reworking_UL_antennaports NR_scheduling_CSIRS NR_scheduling_request NR_scheduling_request2 NR_scheduling_request3 PBCHNRTCFIX RFquality Saankhya_NRPRACH_HighSpeed Test_SA_5GREC add-dmrs-test add-ru-docker-image avxllr bandwidth-testing benetel_config_file_fix benetel_dpdk20 benetel_driver_uldl_pf_merge benetel_driver_update benetel_fixes bsr-fix bugfix-free-ra-process bugfix-nr-pdcp-sn-size bugfix-nr-t-reordering bugfix-x2-SgNBAdditionRequest bugfix_gnb_rt_stats_html bupt-sa-merge ci-deploy-asterix ci-deploy-docker-compose ci-fix-module-ul-iperf ci-new-docker-pipeline ci-reduce-nb-vms ci-test ci_benetel_longrun_limits ci_benetel_test ci_fix_iperf_for_module ci_hotfix_module_ue_ip_address ci_improve_module_ctl ci_nsa_benetel ci_nsa_fixes ci_nsa_pipes_improve ci_nsa_test_integration_2021_wk19 ci_nsa_traces ci_nsa_uplink ci_phytest ci_quectel_support ci_sa_rfsim_test ci_solve_ul_for_module ci_test_5GREC ci_test_nsa_fix_quectel_nic ci_test_nsa_on_develop ci_test_ra_fr2 ci_testinfra_as_code ci_vm_resource_fix cleanup_softmodem_main constant_power debug-UL-5GRECORDS debug_UL_signal detached-w16-test develop develop-CBRA-v3 develop-CCE develop-NR_SA_F1AP_5GRECORDS develop-NR_SA_F1AP_5GRECORDS-abs develop-NR_SA_F1AP_5GRECORDS-hs develop-NR_SA_F1AP_5GRECORDS-hs1 develop-NR_SA_F1AP_5GRECORDS-lts develop-NR_SA_F1AP_5GRECORDS-lts-wf develop-NR_SA_F1AP_5GRECORDS-v3 develop-NR_SA_F1AP_5GRECORDS_100M develop-NR_SA_F1AP_5GRECORDS_LDPC_FPGA develop-NR_SA_F1AP_5GRECORDS_lfq_0607 develop-SA-CBRA develop-SA-CBRA-CUDU develop-SA-CBRA-Msg5 develop-SA-CBRA-lts develop-SA-CBRA-ulsch-lts develop-SA-RA develop-SnT develop-aw2sori develop-oriecpriupdates develop-sib1 develop-sib1-local develop-sib1-lts develop-sib1-update develop-sib1-update-test1 develop-sib1-update-ue develop-wf-du develop_stable disable_CSI_measrep dlsch_parallel docker-improvements-2021-april docker-no-cache-option dongzhanyi-zte-develop1 enhance-rfsim episys-merge episys/nsa_baseline episys/nsa_development fedora-gen-kernel-fix fft_bench_hotfix fix-check fix-compile fix-nr-pdcp-timer fix-nr-rlc-range-nack fix-physim-deploy fix-quectel fix-realtime fix-retransmission-rbg fix-x2-without-gnb fix_NR_DLUL_PF fix_NR_DLUL_PF_benchmark fix_coreset_dmrs_idx fix_do_ra_data fix_nr_ulsim fix_rb_corruption fix_reestablishment fixes-CE-RLC-PDU-size fixgtpu flexran-repair-mme-mgmt flexran-rtc-repo-is-public git-dashboard gnb-freerun-txru gnb-n300-fixes gnb-only-test gnb-realtime-hotfix gnb-realtime-quickfix gnb-threadpool hack-bch-no-sched-sf-0 hack-exit-gnb-when-no-enb-nsa integ-w13-test-rt-issue integration_2020_wk15 integration_2020_wk48 integration_2020_wk48_2 integration_2020_wk49 integration_2020_wk50 integration_2020_wk50_1 integration_2020_wk51 integration_2020_wk51_2 integration_2021_wk02 integration_2021_wk02_wMR988 integration_2021_wk04 integration_2021_wk05 integration_2021_wk06 integration_2021_wk06_MR978 integration_2021_wk06_b integration_2021_wk06_c integration_2021_wk08 integration_2021_wk08_2 integration_2021_wk08_MR963 integration_2021_wk09 integration_2021_wk09_b integration_2021_wk10 integration_2021_wk10_b integration_2021_wk11 integration_2021_wk12 integration_2021_wk12_b integration_2021_wk13_a integration_2021_wk13_b integration_2021_wk13_b_fix_tdas integration_2021_wk13_b_fixed integration_2021_wk13_c integration_2021_wk14_a integration_2021_wk15_a integration_2021_wk16 integration_2021_wk17_a integration_2021_wk17_b integration_2021_wk18_a integration_2021_wk18_b integration_2021_wk19 integration_2021_wk20_a integration_2021_wk22 integration_2021_wk23 integration_2021_wk27 integration_w5GC_CBRA_test inter-RRU-final itti-enhancement ldpc_offload_t1 ldpc_short_codeword_fixes lte-ulsch-bugfix lte_uplink_improvement migrate-cpp-check-container migrate-vm-pipeline-to-bionic minor-fix-doc-basic-sim mosaic5g-oai-ran msg4_phy_0303_lfq multiple_ssb_sib1_bugfix nasmesh_kernel_5.8 new-gtpu nfapi_nr_arch_mod nfapi_nr_develop nfapi_nr_develop_new ngap-dlul ngap-w48-merge2 ngap-wf ngap-wf-1120 ngap-wf-1120-srb ngap-wf-1120-srb-gtp ngap-wf-1120-srb-gtp-hs ngap-wf-1120-srb-gtp-hs1 ngap-wf-1120-srb-gtp-hs2 ngap-wf-1120-srb-gtp-yhz ngap-wf-1203-yunsdr ngap-wf-liuyu ngap_lfq_1120 ngap_merge nr-bsr-fix nr-dl-mimo-2layer nr-dmrs-fixes nr-pdcp-benchmarking nr-pdcp-improvements nr-pdcp-nea2-security nr-pdcp-nia2-integrity nr-pdcp-small-bugfixes nr-pdcp-srb-integrity nr-ra-fix nr-stats-print nrPBCHTCFix nrPbchTcFix nrUE nrUE-hs nrUE-upper-layer nr_bsr nr_dl_pf nr_dl_ul_ptrs nr_improve_chanest nr_power_measurement_fixes nr_ue_pdcp_fix nr_ul_pf nr_ul_scfdma oairu oairu-dockerfile-support openxg/develop phy-asan-fixes physim-build-deploy physim-deploy-handle-error-cases prb_based_dl_channel_estimation ptrs_rrc_config pusch-retrans-fix-ue recursive-cmake remove_nos1_hack_pdcp rh-ci-add-ue-parallelization rh_ci_add_runtime_stats rh_ci_add_uldlharq_stats rh_ci_gsheet_rt_monitoring rh_ci_nsa2jenkins rh_ci_nsa_test_n310 rh_ci_phy_test_improve rh_ci_ra_fr2 rh_ci_test_benetel rh_ci_test_nsa rh_ci_test_nsa_wk16 rh_ci_test_nsa_wk17_b rh_ci_test_nsa_wk17b rh_ci_test_rfsim_sa rh_ci_ue_parallel rh_fr1_newjenkins rh_gnb_compile_fix rh_wk50_debug rlc-v2-bugfix-status-reporting rlc-v2-tick rohan_ulsim2RxFix s1-subnormal_rewrite s1_subnormal s1_subnormal-robert sa-demo sa-demo-hs sa-merge-rrc-srb sa-msg4 sa-msg4-rrc sa-msg4-rrc-yihz sa-msg4-rrc-yihz-hs sa_rrc_yihz sanitize-address sanitize-v1 sanitize-v1-tmp sarma_pvnp_oai scs_60_iisc sim-channels small-config-change small_nr_bugfixes t-gnb-tracer test-5GREC test-nsa-benetel test-panos test_nsa_gtpu_fix test_rt-fix_phy-test ue-dci-false-detection ue-fixes ue-pdsch-pusch-parallel ue-race-fix ue_beam_selection usrp_stop_cleanly usrp_x400 wf-sa-rrc wf_testc wireshark-T-hack-ueid wireshark-log-scheduling-requests wk11-with-phytest x2_handle_sctp_shutdown xiangwab xiangwan xw2 yihongzheng_srb 2021.wk14_a 2021.wk13_d 2021.wk13_c 2021.w27 2021.w26 2021.w25 2021.w24 2021.w23 2021.w22 2021.w20 2021.w19 2021.w18_b 2021.w18_a 2021.w17_b 2021.w16 2021.w15 2021.w14 2021.w13_a 2021.w12 2021.w11 2021.w10 2021.w09 2021.w08 2021.w06 2021.w05 2021.w04 2021.w02 2020.w51_2 2020.w51 2020.w50 2020.w49 2020.w48_2 2020.w48 benetel_gnb_rel_2.0 benetel_gnb_rel_1.0 benetel_enb_rel_2.0 benetel_enb_rel_1.0
No related merge requests found
......@@ -195,6 +195,12 @@ typedef struct fiveg_s_tmsi_s {
uint32_t m_tmsi;
} fiveg_s_tmsi_t;
typedef struct ngap_tai_plmn_identity_s {
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
} ngap_plmn_identity_t;
typedef struct ngap_ue_paging_identity_s {
fiveg_s_tmsi_t s_tmsi;
} ngap_ue_paging_identity_t;
......@@ -218,6 +224,10 @@ typedef struct ngap_nas_pdu_s {
uint32_t length;
} ngap_nas_pdu_t, ngap_ue_radio_cap_t;
typedef struct ngap_mobility_restriction_s{
ngap_plmn_identity_t serving_plmn;
}ngap_mobility_restriction_t;
typedef enum pdu_session_type_e {
PDUSessionType_ipv4 = 0,
PDUSessionType_ipv6 = 1,
......@@ -550,13 +560,16 @@ typedef struct ngap_initial_context_setup_req_s {
uint8_t nb_of_pdusessions;
/* list of pdusession to be setup by RRC layers */
pdusession_t pdusession_param[NGAP_MAX_PDUSESSION];
/* Mobility Restriction List */
uint8_t mobility_restriction_flag;
ngap_mobility_restriction_t mobility_restriction;
/* Nas Pdu */
uint8_t nas_pdu_flag;
ngap_nas_pdu_t nas_pdu;
} ngap_initial_context_setup_req_t;
typedef struct ngap_tai_plmn_identity_s {
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
} ngap_plmn_identity_t;
typedef struct ngap_paging_ind_s {
/* UE identity index value.
......
......@@ -343,8 +343,7 @@ void RCconfig_nr_flexran()
if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) {
// Calculate a default gNB ID
if (EPC_MODE_ENABLED)
//gnb_id = i + (ngap_generate_gNB_id () & 0xFFFF8);
gnb_id = i + (ngap_generate_gNB_id () & 0xFFFF8);
gnb_id = i + (ngap_generate_gNB_id () & 0xFFFFFF8);
else
gnb_id = i;
} else {
......@@ -571,9 +570,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
// Calculate a default gNB ID
if (EPC_MODE_ENABLED) {
uint32_t hash;
//hash = ngap_generate_gNB_id ();
hash = ngap_generate_gNB_id ();
gnb_id = i + (hash & 0xFFFF8);
gnb_id = i + (hash & 0xFFFFFF8);
} else {
gnb_id = i;
}
......@@ -789,9 +787,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
if (EPC_MODE_ENABLED) {
uint32_t hash;
//hash = ngap_generate_gNB_id ();
hash = ngap_generate_gNB_id ();
gnb_id = k + (hash & 0xFFFF8);
gnb_id = k + (hash & 0xFFFFFF8);
} else {
gnb_id = k;
}
......@@ -1039,9 +1036,8 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
// Calculate a default eNB ID
if (EPC_MODE_ENABLED) {
uint32_t hash;
//hash = ngap_generate_gNB_id ();
hash = ngap_generate_gNB_id ();
gnb_id = k + (hash & 0xFFFF8);
gnb_id = k + (hash & 0xFFFFFF8);
} else {
gnb_id = k;
}
......
......@@ -126,11 +126,14 @@ struct served_guami_s {
};
/* NSSAI element */
typedef struct ngap_gNB_NSSAI_s{
struct slice_support_s{
uint8_t sST;
uint8_t sD_flag;
uint8_t sD[3];
}ngap_gNB_NSSAI_t, slice_support_s;
/* Next slice element */
STAILQ_ENTRY(slice_support_s) next;
};
/* plmn support element */
......@@ -206,6 +209,12 @@ typedef struct ngap_gNB_amf_data_s {
struct ngap_gNB_instance_s *ngap_gNB_instance;
} ngap_gNB_amf_data_t;
typedef struct ngap_gNB_NSSAI_s{
uint8_t sST;
uint8_t sD_flag;
uint8_t sD[3];
}ngap_gNB_NSSAI_t;
typedef struct ngap_gNB_instance_s {
/* Next ngap gNB association.
* Only used for virtual mode.
......
......@@ -49,6 +49,10 @@
#include "assertions.h"
#include "conversions.h"
#include "msc.h"
#include "NGAP_PDUSessionResourceSetupRequestTransfer.h"
#include "NGAP_PDUSessionResourceSetupItemCxtReq.h"
#include "NGAP_QosFlowSetupRequestItem.h"
#include "NGAP_AllowedNSSAI-Item.h"
static
int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id,
......@@ -297,7 +301,6 @@ static
int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id,
uint32_t stream,
NGAP_NGAP_PDU_t *pdu) {
#if 0
NGAP_NGSetupResponse_t *container;
NGAP_NGSetupResponseIEs_t *ie;
ngap_gNB_amf_data_t *amf_desc_p;
......@@ -447,7 +450,7 @@ int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id,
amf_desc_p->state = NGAP_GNB_STATE_CONNECTED;
amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb ++;
ngap_handle_ng_setup_message(amf_desc_p, 0);
#endif
return 0;
}
......@@ -794,7 +797,7 @@ static
int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream,
NGAP_NGAP_PDU_t *pdu) {
#if 0
int i;
ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL;
......@@ -802,7 +805,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_InitialContextSetupRequest_t *container;
NGAP_InitialContextSetupRequestIEs_t *ie;
NGAP_RAN_UE_NGAP_ID_t ran_ue_ngap_id;
NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
uint64_t amf_ue_ngap_id;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.InitialContextSetupRequest;
......@@ -817,7 +820,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID;
asn_INTEGER2ulong(&(ie->value.choice.AMF_UE_NGAP_ID), &amf_ue_ngap_id);
} else {
return -1;
}
......@@ -849,6 +852,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
ue_desc_p->rx_stream = stream;
ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id;
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_INITIAL_CONTEXT_SETUP_REQ);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
ue_desc_p->ue_initial_id = 0;
......@@ -873,10 +877,6 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_ProtocolIE_ID_id_GUAMI, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
ie->value.choice.GUAMI.pLMNIdentity
ie->value.choice.GUAMI.aMFRegionID
ie->value.choice.GUAMI.aMFSetID
ie->value.choice.GUAMI.aMFPointer
TBCD_TO_MCC_MNC(&ie->value.choice.GUAMI.pLMNIdentity, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mcc,
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mnc, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mnc_len);
......@@ -1065,17 +1065,50 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
return -1;
}
/* id-MobilityRestrictionList */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_SecurityKey, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
memcpy(&NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key,
ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size);
itti_send_msg_to_task(TASK_RRC_GNB, ue_desc_p->gNB_instance->instance, message_p);
} else {/* ie != NULL */
return -1;
}
#endif
/* id-NAS-PDU */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_MobilityRestrictionList, false);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_MobilityRestrictionList_t *mobility_rest_list_p = NULL;
mobility_rest_list_p = &ie->value.choice.MobilityRestrictionList;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).mobility_restriction_flag = 1;
TBCD_TO_MCC_MNC(&mobility_rest_list_p->servingPLMN,
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).mobility_restriction.serving_plmn.mcc,
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).mobility_restriction.serving_plmn.mnc,
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).mobility_restriction.serving_plmn.mnc_digit_length);
}
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_NAS_PDU, false);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
if(ie->value.choice.NAS_PDU.size > 0) {
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nas_pdu_flag = 1;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nas_pdu.buffer = malloc(sizeof(uint8_t) * ie->value.choice.NAS_PDU.size);
memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nas_pdu.buffer,
ie->value.choice.NAS_PDU.buf, ie->value.choice.NAS_PDU.size);
}
}
itti_send_msg_to_task(TASK_RRC_GNB, ue_desc_p->gNB_instance->instance, message_p);
return 0;
}
......
......@@ -53,7 +53,6 @@ int ngap_gNB_handle_nas_first_req(
instance_t instance, ngap_nas_first_req_t *ngap_nas_first_req_p)
//------------------------------------------------------------------------------
{
#if 0
ngap_gNB_instance_t *instance_p = NULL;
struct ngap_gNB_amf_data_s *amf_desc_p = NULL;
struct ngap_gNB_ue_context_s *ue_desc_p = NULL;
......@@ -315,7 +314,7 @@ int ngap_gNB_handle_nas_first_req(
/* Send encoded message over sctp */
ngap_gNB_itti_send_sctp_data_req(instance_p->instance, amf_desc_p->assoc_id,
buffer, length, ue_desc_p->tx_stream);
#endif
return 0;
}
......@@ -656,7 +655,7 @@ int ngap_gNB_initial_ctxt_resp(
if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p,
initial_ctxt_resp_p->gNB_ue_ngap_id)) == NULL) {
/* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */
NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%06x\n",
NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%08x\n",
initial_ctxt_resp_p->gNB_ue_ngap_id);
return -1;
}
......@@ -688,10 +687,10 @@ int ngap_gNB_initial_ctxt_resp(
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID;
ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_GNB_UE_NGAP_ID;
ie->value.choice.GNB_UE_NGAP_ID = initial_ctxt_resp_p->gNB_ue_ngap_id;
ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_RAN_UE_NGAP_ID;
ie->value.choice.RAN_UE_NGAP_ID = initial_ctxt_resp_p->gNB_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_t));
......
......@@ -339,7 +339,7 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL;
uint8_t current_capacity = 0;
#if 0
RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) {
struct served_guami_s *guami_p = NULL;
......@@ -366,8 +366,8 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
/* Looking for AMF guami matching the one provided by NAS */
STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
struct served_group_id_s *group_id_p = NULL;
struct amf_code_s *amf_code_p = NULL;
struct served_region_id_s *region_id_p = NULL;
struct amf_set_id_s *amf_set_id_p = NULL;
struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
......@@ -376,13 +376,13 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
break;
}
}
STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) {
if (amf_code_p->amf_code == guami.amf_code) {
STAILQ_FOREACH(amf_set_id_p, &guami_p->amf_set_ids, next) {
if (amf_set_id_p->amf_set_id == guami.amf_set_id) {
break;
}
}
STAILQ_FOREACH(group_id_p, &guami_p->served_group_ids, next) {
if (group_id_p->amf_group_id == guami.amf_group_id) {
STAILQ_FOREACH(region_id_p, &guami_p->served_region_ids, next) {
if (region_id_p->amf_region_id == guami.amf_region_id) {
break;
}
}
......@@ -391,8 +391,8 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
* the AMF is knwown and the association is ready.
* Return the reference to the AMF to use it for this UE.
*/
if ((group_id_p != NULL) &&
(amf_code_p != NULL) &&
if ((region_id_p != NULL) &&
(amf_set_id_p != NULL) &&
(served_plmn_p != NULL)) {
return amf_data_p;
}
......@@ -404,6 +404,6 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
* In case the list of known AMF is empty, simply return NULL, that way the RRC
* layer should know about it and reject RRC connectivity.
*/
#endif
return amf_highest_capacity_p;
}
......@@ -47,15 +47,15 @@ typedef struct ngap_gNB_ue_context_s {
RB_ENTRY(ngap_gNB_ue_context_s) entries;
/* Uniquely identifies the UE between AMF and gNB within the gNB.
* This id is encoded on 24bits.
* This id is encoded on 32bits.
*/
unsigned gNB_ue_ngap_id:24;
uint32_t gNB_ue_ngap_id;
/* UE id for initial connection to NGAP */
uint16_t ue_initial_id;
/* Uniquely identifies the UE within AMF. Encoded on 32 bits. */
uint32_t amf_ue_ngap_id;
uint64_t amf_ue_ngap_id:40;
/* Stream used for this particular UE */
int32_t tx_stream;
......
......@@ -506,11 +506,12 @@ do { \
#define MACRO_GNB_ID_TO_BIT_STRING(mACRO, bITsTRING) \
do { \
(bITsTRING)->buf = calloc(3, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = ((mACRO) >> 12); \
(bITsTRING)->buf[1] = (mACRO) >> 4; \
(bITsTRING)->buf[2] = ((mACRO) & 0x0f) << 4; \
(bITsTRING)->size = 3; \
(bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = ((mACRO) >> 20); \
(bITsTRING)->buf[1] = (mACRO) >> 12; \
(bITsTRING)->buf[3] = (mACRO) >> 4; \
(bITsTRING)->buf[4] = ((mACRO) & 0x0f) << 4; \
(bITsTRING)->size = 4; \
(bITsTRING)->bits_unused = 4; \
} while(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