Commit 7d1d8744 authored by laurent's avatar laurent

continue 5G SA NAS messages

parent 9a72b0c5
......@@ -2266,6 +2266,11 @@ set (SHLIB_LOADER_SOURCES
${OPENAIR_DIR}/common/utils/load_module_shlib.c
)
add_library(LIB_5GNAS_GNB
${NAS_SRC}/gNB/network_process_nas.c
${NAS_SRC}/NR_UE/ue_process_nas.c
)
# Make lfds as a own source code (even if it is a outside library)
# For better intergration with compilation flags & structure of cmake
###################################################################
......
......@@ -377,7 +377,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0)
nr_ulmix_slots++;
if (slot_txP== 0 && (UE_list->fiveG_connected[UE_id] || get_softmodem_params()->phy_test)) {
if (slot_txP== 0 && (UE_list->UEcontext[UE_id].fiveG_connected || get_softmodem_params()->phy_test)) {
for (int k=0; k<nr_ulmix_slots; k++) {
memset((void *) &UE_list->UE_sched_ctrl[UE_id].sched_pucch[k],
0,
......@@ -449,7 +449,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if (get_softmodem_params()->phy_test == 0)
nr_schedule_RA(module_idP, frame_txP, slot_txP);
else
UE_list->fiveG_connected[UE_id] = true;
UE_list->UEcontext[UE_id].fiveG_connected = true;
// Phytest scheduling
......@@ -471,7 +471,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
}
}
if (UE_list->fiveG_connected[UE_id] && (is_xlsch_in_slot(*dlsch_in_slot_bitmap,slot_txP%num_slots_per_tdd))) {
if (UE_list->UEcontext[UE_id].fiveG_connected && (is_xlsch_in_slot(*dlsch_in_slot_bitmap,slot_txP%num_slots_per_tdd))) {
ue_sched_ctl->current_harq_pid = slot_txP % num_slots_per_tdd;
nr_update_pucch_scheduling(module_idP, UE_id, frame_txP, slot_txP, num_slots_per_tdd,&pucch_sched);
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP, &UE_list->UE_sched_ctrl[UE_id].sched_pucch[pucch_sched], NULL);
......@@ -490,7 +490,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) {
if (get_softmodem_params()->phy_test == 0) {
if (UE_list->fiveG_connected[UE_id])
if (UE_list->UEcontext[UE_id].fiveG_connected)
nr_schedule_pucch(module_idP, UE_id, frame_rxP, slot_rxP);
schedule_nr_prach(module_idP, (frame_rxP+1)&1023, slot_rxP);
nr_schedule_reception_msg3(module_idP, 0, frame_rxP, slot_rxP);
......
......@@ -268,7 +268,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
}
}
if (pr_found)
UE_list->fiveG_connected[UE_id] = false;
UE_list->UEcontext[UE_id].fiveG_connected = false;
else {
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated for UE_id %d\n",
module_idP, preamble_index, UE_id);
......
......@@ -303,7 +303,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
if (UE_list->active[i] == TRUE) {
if (UE_list->tc_rnti[i] == current_rnti) {
// for now the only thing we are doing is set the UE as 5G connected
UE_list->fiveG_connected[i] = true;
UE_list->UEcontext[i].fiveG_connected = true;
LOG_I(MAC, "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly and UE_id %d is now 5G connected\n",
gnb_mod_idP, current_rnti, i);
}
......
......@@ -68,6 +68,9 @@
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "NR_TAG.h"
#include <openair3/NAS/COMMON/NR_NAS_defs.h>
/* Defs */
#define MAX_NUM_BWP 2
#define MAX_NUM_CORESET 2
......@@ -278,6 +281,10 @@ typedef struct NR_preamble_ue {
uint8_t *preamble_list;
} NR_preamble_ue;
typedef struct {
boolean_t fiveG_connected;
} NRUEcontext_t;
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
typedef struct {
DLSCH_PDU DLSCH_pdu[4][MAX_MOBILES_PER_GNB];
......@@ -290,7 +297,7 @@ typedef struct {
int avail;
int num_UEs;
boolean_t active[MAX_MOBILES_PER_GNB];
boolean_t fiveG_connected[MAX_MOBILES_PER_GNB];
NRUEcontext_t UEcontext[MAX_MOBILES_PER_GNB];
rnti_t rnti[MAX_MOBILES_PER_GNB];
rnti_t tc_rnti[MAX_MOBILES_PER_GNB];
NR_preamble_ue preambles[MAX_MOBILES_PER_GNB];
......
......@@ -200,6 +200,10 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits
mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15;
/*
* The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables
* the reverse allocation is in nr_ue_decode_mib()
*/
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
......@@ -265,10 +269,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
gNB_RrcConfigurationReq *configuration
) {
asn_enc_rval_t enc_rval;
NR_BCCH_DL_SCH_Message_t *sib1_message ;
struct NR_SIB1 *sib1 ;
int i;
struct NR_PLMN_IdentityInfo nr_plmn_info;
// TODO : Add support for more than one PLMN
//int num_plmn = configuration->num_plmn;
......@@ -276,31 +276,29 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
struct NR_PLMN_Identity nr_plmn[num_plmn];
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
memset(nr_plmn,0,sizeof(nr_plmn));
memset(nr_mcc_digit,0,sizeof(nr_mcc_digit));
memset(nr_mnc_digit,0,sizeof(nr_mnc_digit));
// struct NR_UAC_BarringInfoSet nr_uac_BarringInfoSet;
sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
memset(sib1_message,0,sizeof(NR_BCCH_DL_SCH_Message_t));
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
carrier->siblock1 = sib1_message;
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
sib1_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
memset(sib1_message->message.choice.c1,0,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
sib1_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1));
sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
memset(sib1,0,sizeof(struct NR_SIB1));
struct NR_SIB1 *sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
memset(sib1->cellSelectionInfo,0,sizeof(struct NR_SIB1__cellSelectionInfo));
sib1->cellSelectionInfo->q_RxLevMin = -50;
memset(&nr_plmn_info.plmn_IdentityList,0,sizeof(struct NR_PLMN_IdentityInfo__plmn_IdentityList));
asn_set_empty(&nr_plmn_info.plmn_IdentityList.list);
memset(&nr_plmn_info,0,sizeof(struct NR_PLMN_IdentityInfo));
memset(nr_plmn,0,num_plmn*sizeof(struct NR_PLMN_Identity));
for (i = 0; i < num_plmn; ++i) {
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
asn_set_empty(&nr_plmn_info->plmn_IdentityList.list);
for (int i = 0; i < num_plmn; ++i) {
nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
memset(nr_plmn[i].mcc,0,sizeof(struct NR_MCC));
asn_set_empty(&nr_plmn[i].mcc->list);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
......@@ -308,26 +306,23 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
memset(&nr_plmn[i].mnc,0,sizeof(NR_MNC_t));
nr_plmn[i].mnc.list.size=0;
nr_plmn[i].mnc.list.count=0;
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
ASN_SEQUENCE_ADD(&nr_plmn_info.plmn_IdentityList.list, &nr_plmn[i]);
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
}//end plmn loop
nr_plmn_info.cellIdentity.buf = MALLOC(8);
memset(nr_plmn_info.cellIdentity.buf,0,8);
nr_plmn_info.cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
nr_plmn_info.cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
nr_plmn_info.cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
nr_plmn_info.cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
nr_plmn_info.cellIdentity.size= 4;
nr_plmn_info.cellIdentity.bits_unused= 4;
nr_plmn_info.cellReservedForOperatorUse = 0;
memset(&sib1->cellAccessRelatedInfo,0,sizeof(NR_CellAccessRelatedInfo_t));
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, &nr_plmn_info);
nr_plmn_info->cellIdentity.buf = CALLOC(1,8);
nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
nr_plmn_info->cellIdentity.size= 4;
nr_plmn_info->cellIdentity.bits_unused= 4;
nr_plmn_info->cellReservedForOperatorUse = 0;
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info);
#if 0
sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo));
memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo));
......
......@@ -196,6 +196,23 @@ typedef enum {
FOREACH_CAUSE_SECU(CAUSE_ENUM)
} cause_secu_id_t;
//TS 24.501 sub layer states for UE
// for network side, only 5GMMderegistered, 5GMMderegistered_initiated, 5GMMregistered, 5GMMservice_request_initiated are valid
typedef enum {
SGMMnull,
SGMMderegistered,
SGMMderegistered_initiated,
SGMMregistered,
SGMMregistered_initiated,
SGMMservice_request_initiated,
} SGMM_UE_states;
typedef struct {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
} SGScommonHeader_t;
typedef struct {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
......@@ -212,3 +229,19 @@ typedef struct {
} Identityresponse_t;
typedef struct {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
int ngKSI:4;
int spare:4;
int ABBALen:8;
} authenticationrequestHeader_t;
typedef struct {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
} authenticationresponseHeader_t;
//AUTHENTICATION RESULT
typedef struct {
} nr_user_nas_t;
#include <openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h>
#include <openair3/NAS/NR_UE/nr_user_def.h>
void SGSabortNet(void *msg, nr_user_nas_t *UE) {
}
/*
*Message reception
*/
void SGSauthenticationReq(void *msg, nr_user_nas_t *UE) {
}
void SGSidentityReq(void *msg, nr_user_nas_t *UE) {
}
void SGSsecurityModeCommand(void *msg, nr_user_nas_t *UE) {
}
void UEprocessNAS(void *msg,nr_user_nas_t *UE) {
SGScommonHeader_t *header=(SGScommonHeader_t *) msg;
if ( header->sh > 4 )
SGSabortNet(msg, UE);
else {
switch (header->epd) {
SGSmobilitymanagementmessages:
switch (header->mt) {
Authenticationrequest:
SGSauthenticationReq(msg, UE);
break;
Identityrequest:
SGSidentityReq(msg, UE);
break;
Securitymodecommand:
SGSsecurityModeCommand(msg, UE);
break;
default:
SGSabortNet(msg, UE);
}
break;
SGSsessionmanagementmessages:
SGSabortNet(msg, UE);
break;
default:
SGSabortNet(msg, UE);
}
}
}
/*
* Messages emission
*/
void identityResponse(void *msg, nr_user_nas_t *UE) {
}
void authenticationResponse(void *msg,nr_user_nas_t *UE) {
}
void securityModeComplete(void *msg, nr_user_nas_t *UE) {
}
void registrationComplete(void *msg, nr_user_nas_t *UE) {
}
#include <openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h>
void SGSabortUE(void *msg, NRUEcontext_t *UE) {
}
/*
*Message reception
*/
void SGSregistrationReq(void *msg, NRUEcontext_t *UE) {
}
void SGSderegistrationUEReq(void *msg, NRUEcontext_t *UE) {
}
void SGSauthenticationResp(void *msg, NRUEcontext_t *UE) {
}
void SGSidentityResp(void *msg, NRUEcontext_t *UE) {
}
void SGSsecurityModeComplete(void *msg, NRUEcontext_t *UE) {
}
void SGSregistrationComplete(void *msg, NRUEcontext_t *UE) {
}
void processNAS(void *msg, NRUEcontext_t *UE) {
SGScommonHeader_t *header=(SGScommonHeader_t *) msg;
if ( header->sh > 4 )
SGSabortUE(msg, UE);
else {
switch (header->epd) {
SGSmobilitymanagementmessages:
switch (header->mt) {
Registrationrequest:
SGSregistrationReq(msg, UE);
break;
DeregistrationrequestUEoriginating:
SGSderegistrationUEReq(msg, UE);
break;
Authenticationresponse:
SGSauthenticationResp(msg, UE);
break;
Identityresponse:
SGSidentityResp(msg, UE);
break;
Securitymodecomplete:
SGSsecurityModeComplete(msg, UE);
break;
Registrationcomplete:
SGSregistrationComplete(msg, UE);
break;
default:
SGSabortUE(msg, UE);
}
break;
SGSsessionmanagementmessages:
SGSabortUE(msg, UE);
break;
default:
SGSabortUE(msg, UE);
}
}
}
/*
* Messages emission
*/
void identityRequest(void *msg, NRUEcontext_t *UE) {
}
void authenticationRequest(void *msg, NRUEcontext_t *UE) {
}
void securityModeCommand(void *msg, NRUEcontext_t *UE) {
}
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