Commit 66e31967 authored by matzakos's avatar matzakos

Merge remote-tracking branch 'origin/NR_SA_F1AP_5GRECORDS' into NR_F1C_F1U_extensions

parents 32c682a7 aa983739
......@@ -997,7 +997,6 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
add_boolean_option(ITTI_SIM False "enable itti simulator")
add_boolean_option(RFSIM_NAS False "enable rfsim nas")
########################
# Include order
##########################
......@@ -2443,108 +2442,6 @@ set (libnas_utils_OBJS
${NAS_SRC}COMMON/UTIL/OctetString.c
)
if(NAS_UE)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c
${NAS_SRC}UE/API/USER/at_response.c
${NAS_SRC}UE/API/USER/user_api.c
${NAS_SRC}UE/API/USER/user_indication.c
${NAS_SRC}UE/API/USIM/aka_functions.c
${NAS_SRC}UE/API/USIM/usim_api.c
)
set(libnas_ue_emm_OBJS
${NAS_SRC}UE/EMM/Attach.c
${NAS_SRC}UE/EMM/Authentication.c
${NAS_SRC}UE/EMM/Detach.c
${NAS_SRC}UE/EMM/emm_main.c
${NAS_SRC}UE/EMM/EmmStatusHdl.c
${NAS_SRC}UE/EMM/Identification.c
${NAS_SRC}UE/EMM/IdleMode.c
${NAS_SRC}UE/EMM/LowerLayer.c
${NAS_SRC}UE/EMM/SecurityModeControl.c
${NAS_SRC}UE/EMM/ServiceRequestHdl.c
${NAS_SRC}UE/EMM/TrackingAreaUpdate.c
)
set(libnas_ue_emm_sap_OBJS
${NAS_SRC}UE/EMM/SAP/emm_as.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
${NAS_SRC}UE/EMM/SAP/emm_esm.c
${NAS_SRC}UE/EMM/SAP/emm_fsm.c
${NAS_SRC}UE/EMM/SAP/EmmNull.c
${NAS_SRC}UE/EMM/SAP/emm_recv.c
${NAS_SRC}UE/EMM/SAP/emm_reg.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
${NAS_SRC}UE/EMM/SAP/EmmRegistered.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
${NAS_SRC}UE/EMM/SAP/emm_sap.c
${NAS_SRC}UE/EMM/SAP/emm_send.c
${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
)
set (libnas_ue_esm_OBJS
${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c
${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c
${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c
${NAS_SRC}UE/ESM/esm_ebr.c
${NAS_SRC}UE/ESM/esm_ebr_context.c
${NAS_SRC}UE/ESM/esm_ip.c
${NAS_SRC}UE/ESM/esm_main.c
${NAS_SRC}UE/ESM/esm_pt.c
${NAS_SRC}UE/ESM/EsmStatusHdl.c
${NAS_SRC}UE/ESM/PdnConnectivity.c
${NAS_SRC}UE/ESM/PdnDisconnect.c
)
set(libnas_ue_esm_sap_OBJS
${NAS_SRC}UE/ESM/SAP/esm_recv.c
${NAS_SRC}UE/ESM/SAP/esm_send.c
${NAS_SRC}UE/ESM/SAP/esm_sap.c
)
add_library(LIB_NAS_UE
${NAS_SRC}UE/nas_itti_messaging.c
${NAS_SRC}UE/nas_network.c
${NAS_SRC}UE/nas_parser.c
${NAS_SRC}UE/nas_proc.c
${NAS_SRC}UE/nas_user.c
${libnas_api_OBJS}
${libnas_ue_api_OBJS}
${libnas_emm_msg_OBJS}
${libnas_esm_msg_OBJS}
${libnas_ies_OBJS}
${libnas_utils_OBJS}
${libnas_ue_emm_OBJS}
${libnas_ue_emm_sap_OBJS}
${libnas_ue_esm_OBJS}
${libnas_ue_esm_sap_OBJS}
)
add_dependencies(LIB_NAS_UE rrc_flag)
set(NAS_UE_LIB LIB_NAS_UE)
include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
include_directories(${NAS_SRC}UE/API/USIM)
include_directories(${NAS_SRC}UE/EMM)
include_directories(${NAS_SRC}UE/EMM/SAP)
include_directories(${NAS_SRC}UE/ESM)
include_directories(${NAS_SRC}UE/ESM/SAP)
endif()
#if(ITTI_SIM OR RFSIM_NAS)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c
......@@ -2662,6 +2559,27 @@ endif()
add_dependencies(LIB_NAS_SIMUE rrc_flag)
set(NAS_SIM_LIB LIB_NAS_SIMUE)
add_library(LIB_NAS_UE
${NAS_SRC}UE/nas_itti_messaging.c
${NAS_SRC}UE/nas_network.c
${NAS_SRC}UE/nas_parser.c
${NAS_SRC}UE/nas_proc.c
${NAS_SRC}UE/nas_user.c
${libnas_api_OBJS}
${libnas_ue_api_OBJS}
${libnas_emm_msg_OBJS}
${libnas_esm_msg_OBJS}
${libnas_ies_OBJS}
${libnas_utils_OBJS}
${libnas_ue_emm_OBJS}
${libnas_ue_emm_sap_OBJS}
${libnas_ue_esm_OBJS}
${libnas_ue_esm_sap_OBJS}
)
add_dependencies(LIB_NAS_UE rrc_flag)
set(NAS_UE_LIB LIB_NAS_UE)
include_directories(${NAS_SRC}NR_UE)
include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
......@@ -2670,7 +2588,6 @@ endif()
include_directories(${NAS_SRC}UE/EMM/SAP)
include_directories(${NAS_SRC}UE/ESM)
include_directories(${NAS_SRC}UE/ESM/SAP)
#endif()
# nbiot
add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16")
......
......@@ -68,7 +68,6 @@ USRP_REC_PLAY="False"
BUILD_ECLIPSE=0
NR="False"
ITTI_SIM="False"
RFSIM_NAS="False"
SANITIZE_ADDRESS="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
trap handle_ctrl_c INT
......@@ -264,7 +263,6 @@ function main() {
nrUE=1
NR="True"
rfsimNas=1
RFSIM_NAS="True"
echo_info "Will compile NR UE"
shift;;
--mu)
......@@ -619,7 +617,6 @@ function main() {
echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file
echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$build_dir/build
......
......@@ -136,7 +136,7 @@ extern "C" {
LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
if ( s > 50 )
LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1);
LOG_I(TMR,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message));
t->message_queue.insert(t->message_queue.begin(), message);
eventfd_t sem_counter = 1;
......
......@@ -86,6 +86,7 @@
#include "T.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include <nfapi/oai_integration/nfapi_pnf.h>
#include <openair1/PHY/NR_TRANSPORT/nr_ulsch.h>
//#define DEBUG_THREADS 1
//#define USRP_DEBUG 1
......
......@@ -87,9 +87,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h"
#endif
extern const char *duplex_mode[];
THREAD_STRUCT thread_struct;
......@@ -193,12 +191,10 @@ int create_tasks_nrue(uint32_t ue_nb) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for NAS UE failed\n");
return -1;
}
#endif
}
itti_wait_ready(0);
......
......@@ -65,22 +65,6 @@
#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
#define MAX_NUM_RE (14*1200)
#if !defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xffff
#define SI_RNTI_MBMS (rnti_t)0xfff9
#endif
#if !defined(M_RNTI)
#define M_RNTI (rnti_t)0xfffd
#endif
#if !defined(P_RNTI)
#define P_RNTI (rnti_t)0xfffe
#endif
#if !defined(CBA_RNTI)
#define CBA_RNTI (rnti_t)0xfff4
#endif
#if !defined(C_RNTI)
#define C_RNTI (rnti_t)0x1234
#endif
// These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211
//1 layer
#define PMI_2A_11 0
......
......@@ -44,6 +44,7 @@
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/LOG/log.h"
#include <syscall.h>
#include <openair2/UTIL/OPT/opt.h>
//#define DEBUG_DLSCH_CODING
//#define DEBUG_DLSCH_FREE 1
......@@ -266,6 +267,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
A = rel15->TBSize[0]<<3;
if ( dlsch->rnti != SI_RNTI )
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, dlsch->rnti, frame, slot,0, 0);
NR_gNB_SCH_STATS_t *stats=NULL;
int first_free=-1;
......
......@@ -91,6 +91,7 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB);
void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB);
void clear_pusch_stats(PHY_VARS_gNB *gNB);
NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch);
......@@ -1218,7 +1218,6 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
rel15_ul);
nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol);
int num_symb = rel15_ul->nr_of_symbols;
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
if (symbol == rel15_ul->start_symbol_index) {
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]=0;
......
......@@ -66,7 +66,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
uint8_t Mod_id, fd_occasion, preamble_index, restricted_set, not_found;
uint16_t rootSequenceIndex, prach_fmt_id, NCS, *prach_root_sequence_map, preamble_offset = 0;
uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx;
uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start=INT16_MAX, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx;
int16_t prach_tmp[98304*2*4] __attribute__((aligned(32)));
int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu;
......
......@@ -567,7 +567,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
int occ_Index = 0;
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack;
int BWPsize,BWPstart;
int BWPsize,BWPstart=INT_MAX;
if (select_pucch_resource(ue, mac, gNB_id, N_UCI, pucch_resource_indicator, &initial_pucch_id, &pucch_resource_set,
&pucch_resource_id, harq_status) == TRUE) {
/* use of initial pucch configuration provided by system information 1 */
......@@ -1290,8 +1290,8 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
if (resource_set_found == TRUE) {
if (pucch_resource_indicator < MAX_PUCCH_RESOURCE_INDICATOR) {
// Verify that the value of pucch_resource_indicator is valid
struct NR_PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList;
struct NR_PUCCH_Config__resourceToAddModList *resourceToAddModList;
struct NR_PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList=NULL;
struct NR_PUCCH_Config__resourceToAddModList *resourceToAddModList=NULL;
if (bwp_id > 0 && mac->ULbwp[bwp_id-1]) {
AssertFatal(mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList!=NULL,"mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList is null\n");
resourceSetToAddModList = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList;
......
......@@ -299,7 +299,7 @@ typedef struct f1ap_initial_ul_rrc_message_s {
uint16_t crnti;
uint8_t *rrc_container;
int rrc_container_length;
uint8_t *du2cu_rrc_container;
int8_t *du2cu_rrc_container;
int du2cu_rrc_container_length;
} f1ap_initial_ul_rrc_message_t;
......
......@@ -195,21 +195,13 @@ typedef uint8_t mme_code_t;
typedef uint32_t m_tmsi_t;
//Random UE identity length = 40 bits
#if ! defined(NOT_A_RANDOM_UE_IDENTITY)
#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF
#endif
#if ! defined(NOT_A_RNTI)
#define NOT_A_RNTI (rnti_t)0
#endif
#if ! defined(M_RNTI)
#define M_RNTI (rnti_t)0xFFFD
#endif
#if ! defined(P_RNTI)
#define P_RNTI (rnti_t)0xFFFE
#endif
#if ! defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xFFFF
#endif
#define CBA_RNTI (rnti_t)0xfff4
#define OAI_C_RNTI (rnti_t)0x1234
typedef enum config_action_e {
CONFIG_ACTION_NULL = 0,
CONFIG_ACTION_ADD = 1,
......
......@@ -38,13 +38,6 @@
#include "common/ran_context.h"
#include "openair3/UTILS/conversions.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
// a compile error
#undef C_RNTI
// Bing Kai: create CU and DU context, and put all the information there.
uint64_t du_ue_f1ap_id = 0;
uint32_t f1ap_assoc_id = 0;
......
......@@ -56,13 +56,6 @@
#include "intertask_interface.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
// a compile error
#undef C_RNTI
extern f1ap_setup_req_t *f1ap_du_data;
extern RAN_CONTEXT_t RC;
extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
......@@ -799,7 +792,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
rnti_t rntiP,
const uint8_t *sduP,
sdu_size_t sdu_lenP,
const uint8_t *sdu2P,
const int8_t *sdu2P,
sdu_size_t sdu2_lenP) {
F1AP_F1AP_PDU_t pdu;
F1AP_InitialULRRCMessageTransfer_t *out;
......
......@@ -50,7 +50,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
rnti_t rntiP,
const uint8_t *sduP,
sdu_size_t sdu_lenP,
const uint8_t *sdu2P,
const int8_t *sdu2P,
sdu_size_t sdu2_lenP);
#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */
......@@ -190,7 +190,7 @@ void *F1AP_DU_task(void *arg) {
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti,
msg->rrc_container,
msg->rrc_container_length,
msg->du2cu_rrc_container,
(char*)msg->du2cu_rrc_container,
msg->du2cu_rrc_container_length
);
break;
......
......@@ -41,13 +41,6 @@
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
// a compile error
#undef C_RNTI
extern f1ap_setup_req_t *f1ap_du_data;
extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
extern RAN_CONTEXT_t RC;
......
......@@ -46,6 +46,7 @@
#include "f1ap_cu_task.h"
#include "f1ap_du_task.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include <openair2/LAYER2/nr_pdcp/nr_pdcp.h>
extern unsigned char NB_gNB_INST;
extern RAN_CONTEXT_t RC;
......
......@@ -169,4 +169,9 @@ uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP,
int rnti_type,
uint8_t configuredGrant);
void nr_mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) ;
#endif
......@@ -1012,7 +1012,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
//Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2)
//in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should
//have a valid LCID (nr_process_mac_pdu function)
ulsch_input_buffer[0] = 0x31;
ulsch_input_buffer[0] = UL_SCH_LCID_PADDING;
for (int i = 1; i < TBS_bytes; i++) {
ulsch_input_buffer[i] = (unsigned char) rand();
......@@ -1914,6 +1914,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
} // if is_nr_UL_slot
}
#define MAX_LCID 8 //Fixme: also defined in LCID table
uint8_t
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
sub_frame_t subframe, uint8_t eNB_index,
......@@ -1921,16 +1922,15 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t total_rlc_pdu_header_len = 0;
int16_t buflen_remain = 0;
uint8_t lcid = 0;
uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
uint16_t sdu_lengths[MAX_LCID] = { 0 };
uint8_t sdu_lcids[MAX_LCID] = { 0 };
uint16_t payload_offset = 0, num_sdus = 0;
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
uint16_t sdu_length_total = 0;
//unsigned short post_padding = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
0, lcid_buffer_occupancy_new = 0;
rlc_buffer_occupancy_t lcid_buffer_occupancy_new = 0;
LOG_D(NR_MAC,
"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
module_idP, frameP, subframe, buflen);
......@@ -1940,13 +1940,10 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
// Check for DCCH first
// TO DO: Multiplex in the order defined by the logical channel prioritization
for (lcid = UL_SCH_LCID_SRB1;
lcid < NR_MAX_NUM_LCID; lcid++) {
lcid_buffer_occupancy_old = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid);
lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
if(lcid_buffer_occupancy_new){
lcid < MAX_LCID; lcid++) {
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid);
if(lcid_buffer_occupancy_new) {
buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
LOG_I(NR_MAC,
......@@ -1956,7 +1953,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
buflen, sdu_length_total,
total_rlc_pdu_header_len, buflen_remain); // ,nr_ue_mac_inst->scheduling_info.BSR_bytes[nr_ue_mac_inst->scheduling_info.LCGID[lcid]]
while(buflen_remain > 0 && lcid_buffer_occupancy_new){
while(buflen_remain > 0 && lcid_buffer_occupancy_new){
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
mac->crnti,
......@@ -1984,20 +1981,13 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
}
/* Get updated BO after multiplexing this PDU */
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,
mac->crnti,
eNB_index,
frameP,
subframe,
ENB_FLAG_NO,
lcid);
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,mac->crnti,eNB_index,frameP, subframe, ENB_FLAG_NO, lcid);
buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
}
}
}
}
}
// Generate ULSCH PDU
if (num_sdus>0) {
payload_offset = nr_generate_ulsch_pdu(ulsch_sdus,
......@@ -2012,9 +2002,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
0, // long_bsr
0, // post_padding
buflen); // TBS in bytes
}
else
return 0;
} else
return 0;
// Padding: fill remainder of ULSCH with 0
if (buflen - payload_offset > 0){
......
......@@ -1138,7 +1138,6 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
if (ra->Msg4_frame == frameP && ra->Msg4_slot == slotP ) {
......@@ -1301,7 +1300,6 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
// look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially
// important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them
const int bwpid = bwp ? bwp->bwp_Id : 0;
const int coresetid = coreset->controlResourceSetId;
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid];
if (!pdcch_pdu_rel15) {
......
......@@ -1881,7 +1881,7 @@ void get_pdsch_to_harq_feedback(int Mod_idP,
if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)
ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
NR_SearchSpace_t *ss;
NR_SearchSpace_t *ss=NULL;
// common search type uses DCI format 1_0
if (ss_type == NR_SearchSpace__searchSpaceType_PR_common) {
......
......@@ -32,6 +32,8 @@
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "executables/softmodem-common.h"
#include "common/utils/nr/nr_common.h"
#include <openair2/UTIL/OPT/opt.h>
//38.321 Table 6.1.3.1-1
const uint32_t NR_SHORT_BSR_TABLE[32] = {
......@@ -83,6 +85,9 @@ void nr_process_mac_pdu(
LOG_E(NR_MAC, "%s() UE_id == -1\n",__func__);
return;
}
if ( pduP[0] != UL_SCH_LCID_PADDING )
trace_NRpdu(DIRECTION_UPLINK, pduP, mac_pdu_len ,UE_id, WS_C_RNTI, rnti, frameP, 0,0, 0);
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
// For both DL/UL-SCH
// Except:
......
......@@ -66,8 +66,9 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
header_size = 3;
}
/* SRBs always have MAC-I, even if integrity is not active */
if (entity->has_integrity
|| entity->type == NR_PDCP_SRB) {
if ( // FIXME: DRB creation is with integrity, but we don't receive it
// entity->has_integrity ||
entity->type == NR_PDCP_SRB) {
integrity_size = 4;
} else {
integrity_size = 0;
......
......@@ -38,7 +38,6 @@
#include "common/ran_context.h"
#include "NR_UL-CCCH-Message.h"
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
#include "openair2/LAYER2/PROTO_AGENT/proto_agent.h"
......@@ -426,7 +425,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
int is_enb;
/* is it SRB? */
for (i = 0; i < 2; i++) {
for (i = 0; i < sizeofArray(ue->srb); i++) {
if (entity == ue->srb[i]) {
is_srb = 1;
rb_id = i+1;
......@@ -435,7 +434,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
}
/* maybe DRB? */
for (i = 0; i < 5; i++) {
for (i = 0; i < sizeofArray(ue->drb) ; i++) {
if (entity == ue->drb[i]) {
is_srb = 0;
rb_id = i+1;
......
......@@ -49,8 +49,6 @@
#include "intertask_interface.h"
#include "flexran_agent_extern.h"
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
//#include "f1ap_du_rrc_message_transfer.h"
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
extern RAN_CONTEXT_t RC;
......
......@@ -249,7 +249,7 @@ boolean_t gtpv_data_req_new (
return result;
} else { /* It is from from epc message */
/* in the source enb, UE in RRC_HO_EXECUTION mode */
MessageDef *msg;
//MessageDef *msg;
// ?????
return true;
}
......
......@@ -44,7 +44,7 @@
#include "NR_BCCH-BCH-Message.h"
#include "rrc_gNB_UE_context.h"
#include <openair2/RRC/NR/MESSAGES/asn1_msg.h>
#include <openair2/UTIL/OPT/opt.h>
#include <openair2/F1AP/f1ap_du_rrc_message_transfer.h>
extern RAN_CONTEXT_t RC;
......@@ -208,7 +208,6 @@ nr_rrc_data_req(
message_p);
LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n");
//trace_NRpdu(DIRECTION_DOWNLINK, message_buffer, sdu_sizeP, 0, WS_M_RNTI, ctxt_pP->rnti, ctxt_pP->frame, ctxt_pP->subframe,0, 0);
/* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads
* Ideally, PDCP would not neet to be triggered like this but react to ITTI
* messages automatically */
......
......@@ -1034,7 +1034,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
AssertFatal(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing==NR_SubcarrierSpacing_kHz30,
"SCS != 30kHz\n");
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity==NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5,
"TDD period != 5ms : %d\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
"TDD period != 5ms : %ld\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = 10*((rnti>>1)&3) + (rnti&2);
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
......
......@@ -356,7 +356,7 @@ typedef struct gNB_RRC_UE_s {
/* list of e_rab to be setup by RRC layers */
/* list of pdu session to be setup by RRC layers */
e_rab_param_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
pdu_session_param_t pdusession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION];
pdu_session_param_t pduSession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION];
//release e_rabs
uint8_t nb_release_of_e_rabs;
e_rab_failed_t e_rabs_release_failed[S1AP_MAX_E_RAB];
......
This diff is collapsed.
This diff is collapsed.
......@@ -135,7 +135,7 @@ rrc_gNB_allocate_new_UE_context(
for(int i = 0; i < NB_RB_MAX; i++) {
new_p->ue_context.e_rab[i].xid = -1;
new_p->ue_context.pdusession[i].xid = -1;
new_p->ue_context.pduSession[i].xid = -1;
new_p->ue_context.modify_e_rab[i].xid = -1;
}
......
......@@ -69,9 +69,7 @@
#include "SIMULATION/TOOLS/sim.h" // for taus
#include <executables/softmodem-common.h>
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h"
#endif
NR_UE_RRC_INST_t *NR_UE_rrc_inst;
/* NAS Attach request with IMSI */
......@@ -1349,14 +1347,21 @@ static void rrc_ue_generate_RRCSetupComplete(
AssertFatal(1==0,"2 > csi_MeasConfig is not null\n");
if (AMF_MODE_ENABLED) {
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#if defined(ITTI_SIM)
as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg);
generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id);
nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length;
#else
nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
if (get_softmodem_params()->sa) {
as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id);
nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length;
} else {
nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
}
#endif
} else {
nas_msg = nr_nas_attach_req_imsi;
......@@ -2298,7 +2303,6 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
if (Srb_id != 1) {
LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n",
ctxt_pP->module_id, ctxt_pP->frame, Srb_id);
return -1;
} else {
LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id);
}
......
......@@ -441,6 +441,10 @@ static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType,
tmp16 = htons(subframe); // frame counter : this will give an expert info as wireshark expects SF and not F
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
if (direction == 0 ) { //ulink
frameBuffer[frameOffset++] = MAC_NR_PHR_TYPE2_OTHERCELL_TAG;
frameBuffer[frameOffset++] = 0;
}
/***************************************/
/* Now write the MAC PDU */
......
......@@ -194,23 +194,23 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_t *buffer)
{
uint32_t encoded = 0;
*(buffer + encoded) = 0x00 | (suci->supiformat << 4) | (suci->typeofidentity);
*(buffer + encoded) = (suci->supiformat << 4) | (suci->typeofidentity);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->mccdigit2 & 0xf) << 4) |
*(buffer + encoded) = ((suci->mccdigit2 & 0xf) << 4) |
(suci->mccdigit1 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->mncdigit3 & 0xf) << 4) |
*(buffer + encoded) = ((suci->mncdigit3 & 0xf) << 4) |
(suci->mccdigit3 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->mncdigit2 & 0xf) << 4) |
*(buffer + encoded) = ((suci->mncdigit2 & 0xf) << 4) |
(suci->mncdigit1 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->routingindicatordigit2 & 0xf) << 4) |
*(buffer + encoded) = ((suci->routingindicatordigit2 & 0xf) << 4) |
(suci->routingindicatordigit1 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->routingindicatordigit4 & 0xf) << 4) |
*(buffer + encoded) = ((suci->routingindicatordigit4 & 0xf) << 4) |
(suci->routingindicatordigit3 & 0xf);
encoded++;
......@@ -220,8 +220,15 @@ static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_
*(buffer + encoded) = suci->homenetworkpki;
encoded++;
IES_ENCODE_U32(buffer, encoded, suci->schemeoutput);
char *ptr=suci->schemeoutput;
while ( ptr < suci->schemeoutput+strlen(suci->schemeoutput) ) {
buffer[encoded]=((*(ptr+1)-'0')<<4) | (*(ptr) -'0');
encoded++;
ptr+=2;
}
if (strlen(suci->schemeoutput)%2 == 1)
buffer[encoded++]=((*(ptr-1)-'0')) | 0xF0;
return encoded;
}
......
......@@ -64,7 +64,7 @@ typedef struct {
uint8_t spare6:1;
uint8_t protectionschemeId:4;
uint8_t homenetworkpki;
uint32_t schemeoutput;
char schemeoutput[32];
} Suci5GSMobileIdentity_t;
typedef struct {
......
......@@ -387,5 +387,6 @@ void processNAS(void *msg, NRUEcontext_t *UE);
int identityRequest(void **msg, NRUEcontext_t *UE);
int authenticationRequest(void **msg, NRUEcontext_t *UE);
int securityModeCommand(void **msg, NRUEcontext_t *UE);
void servingNetworkName(uint8_t *msg, char * imsiStr, int nmc_size);
#endif
This diff is collapsed.
......@@ -56,6 +56,7 @@
#define FGS_SECURITY_MODE_COMMAND 0b01011101 /* 93 = 0x5d */
#define FGS_SECURITY_MODE_COMPLETE 0b01011110 /* 94 = 0x5e */
#define FGS_UPLINK_NAS_TRANSPORT 0b01100111 /* 103= 0x67 */
#define FGS_DOWNLINK_NAS_TRANSPORT 0b01101000 /* 104= 0x68 */
// message type for 5GS session management
#define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001 /* 193= 0xc1 */
......@@ -115,9 +116,7 @@ typedef union {
fgs_nas_message_plain_t plain;
} fgs_nas_message_t;
void generateRegistrationRequest(as_nas_info_t *initialNasMsg);
void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype);
void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf);
void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id);
void generateSecurityModeComplete(as_nas_info_t *initialNasMsg);
void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer);
void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg);
......
......@@ -20,9 +20,11 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <ctype.h>
#include <openair3/UICC/usim_interface.h>
#include <openair3/NAS/COMMON/milenage.h>
extern uint16_t NB_UE_INST;
#define UICC_SECTION "uicc"
#define UICC_CONFIG_HELP_OPTIONS " list of comma separated options to interface a simulated (real UICC to be developped). Available options: \n"\
......@@ -34,18 +36,20 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define UICC_PARAMS_DESC {\
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"", TYPE_STRING, 0 },\
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"2089900007487", TYPE_STRING, 0 },\
{"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"", TYPE_STRING, 0 },\
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"", TYPE_STRING, 0 },\
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 },\
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 },\
{"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\
{"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\
};
static uicc_t** uiccArray=NULL;
const char *hexTable="0123456789abcdef";
static inline uint8_t mkDigit(unsigned char in) {
for (int i=0; i<16; i++)
if (in==hexTable[i])
if (tolower(in)==hexTable[i])
return i;
LOG_E(SIM,"Impossible hexa input: %c\n",in);
return 0;
......@@ -65,7 +69,7 @@ uicc_t *init_uicc(char *sectionName) {
// we can read the IMSI from the USIM
// key, OPc, sqn, amf don't need to be read from the true USIM
int ret = config_get( uicc_params,sizeof(uicc_params)/sizeof(paramdef_t),sectionName);
AssertFatal(ret >= 0, "configuration couldn't be performed");
AssertFatal(ret >= 0, "configuration couldn't be performed for uicc name: %s", sectionName);
LOG_I(SIM, "UICC simulation: IMSI=%s, Ki=%s, OPc=%s\n", uicc->imsiStr, uicc->keyStr, uicc->opcStr);
to_hex(uicc->keyStr,uicc->key, sizeof(uicc->key) );
to_hex(uicc->opcStr,uicc->opc, sizeof(uicc->opc) );
......@@ -90,3 +94,15 @@ void uicc_milenage_generate(uint8_t *autn, uicc_t *uicc) {
log_dump(SIM,autn,sizeof(autn), LOG_DUMP_CHAR,"milenage output autn:");
}
uicc_t * checkUicc(int Mod_id) {
AssertFatal(Mod_id < NB_UE_INST, "Mod_id must be less than NB_UE_INST. Mod_id:%d NB_UE_INST:%d", Mod_id,NB_UE_INST);
if(uiccArray==NULL){
uiccArray=(uicc_t **)calloc(1,sizeof(uicc_t*)*NB_UE_INST);
}
if (!uiccArray[Mod_id]) {
char uiccName[64];
sprintf(uiccName,"uicc%d", Mod_id);
uiccArray[Mod_id]=(void*)init_uicc(uiccName);
}
return (uicc_t*) uiccArray[Mod_id];
}
......@@ -66,6 +66,8 @@ typedef struct {
/*
* Read the configuration file, section name variable to be able to manage several UICC
*/
uicc_t *checkUicc(int Mod_id);
uicc_t *init_uicc(char *sectionName);
void uicc_milenage_generate(uint8_t * autn, uicc_t *uicc);
uicc_t * checkUicc(int Mod_id);
#endif
......@@ -409,7 +409,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid
inst->te2ue_mapping[incoming_teid].rnti=rnti;
inst->te2ue_mapping[incoming_teid].rb_id= outgoing_teid;
inst->te2ue_mapping[incoming_teid].rb_id= bearer_id;
inst->te2ue_mapping[incoming_teid].callBack=callBack;
......@@ -441,10 +441,15 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid
tmp->outgoing_port=port;
tmp->teid_outgoing= outgoing_teid;
pthread_mutex_unlock(&globGtp.gtp_lock);
LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d\n",
char ip4[INET_ADDRSTRLEN];
char ip6[INET6_ADDRSTRLEN];
LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d to remote IPv4: %s, IPv6 %s\n",
rnti,
tmp->teid_incoming,
tmp->teid_outgoing);
tmp->teid_outgoing,
inet_ntop(AF_INET,(void*)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ),
inet_ntop(AF_INET6,(void*)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN));
return incoming_teid;
}
......@@ -540,6 +545,7 @@ int gtpv1u_update_ngu_tunnel(
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
const rnti_t prior_rnti
) {
AssertFatal( false, "to be developped\n");
return GTPNOK;
}
......
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