Commit cb0bb5f8 authored by rmagueta's avatar rmagueta

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

parents 0bd675b3 8383843e
......@@ -857,13 +857,6 @@ if(!IS_SOFTMODEM_NOS1)
printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n");
}
if (nfapi_mode != 1 && nfapi_mode != 2) {
printf("Not NFAPI mode - call init_eNB_afterRU()\n");
init_eNB_afterRU();
} else {
printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n");
}
printf("ALL RUs ready - ALL gNBs ready\n");
// connect the TX/RX buffers
printf("Sending sync to all threads\n");
......
......@@ -1109,6 +1109,8 @@ int RCconfig_nr_gtpu(void ) {
IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" );
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up);
GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U;
strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address);
sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", gnb_port_for_NGU);
} else {// TODO SA
message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ);
AssertFatal(message!=NULL,"");
......@@ -1116,8 +1118,6 @@ int RCconfig_nr_gtpu(void ) {
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up);
GTPV1U_GNB_NG_REQ(message).gnb_port_for_NGu_up = gnb_port_for_NGU;
}
strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address);
sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", gnb_port_for_NGU);
itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
} else
LOG_E(GTPU,"invalid address for NGU\n");
......
......@@ -101,7 +101,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
entity->integrity(entity->integrity_context, integrity,
buffer, size - integrity_size,
entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1);
if (memcmp(integrity, buffer, 4) != 0) {
if (memcmp(integrity, buffer + size - integrity_size, 4) != 0) {
LOG_E(PDCP, "discard NR PDU, integrity failed\n");
return;
}
......@@ -212,6 +212,7 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
header_size + size + integrity_size, sdu_id);
}
/* may be called several times, take care to clean previous settings */
static void nr_pdcp_entity_set_security(nr_pdcp_entity_t *entity,
int integrity_algorithm,
char *integrity_key,
......@@ -226,6 +227,46 @@ static void nr_pdcp_entity_set_security(nr_pdcp_entity_t *entity,
memcpy(entity->integrity_key, integrity_key, 16);
if (ciphering_key != NULL)
memcpy(entity->ciphering_key, ciphering_key, 16);
if (integrity_algorithm == 0) {
entity->has_integrity = 0;
if (entity->free_integrity != NULL)
entity->free_integrity(entity->integrity_context);
entity->free_integrity = NULL;
}
if (integrity_algorithm != 0 && integrity_algorithm != -1) {
if (integrity_algorithm != 2) {
LOG_E(PDCP, "FATAL: only nia2 supported for the moment\n");
exit(1);
}
entity->has_integrity = 1;
if (entity->free_integrity != NULL)
entity->free_integrity(entity->integrity_context);
entity->integrity_context = nr_pdcp_integrity_nia2_init(entity->integrity_key);
entity->integrity = nr_pdcp_integrity_nia2_integrity;
entity->free_integrity = nr_pdcp_integrity_nia2_free_integrity;
}
if (ciphering_algorithm == 0) {
entity->has_ciphering = 0;
if (entity->free_security != NULL)
entity->free_security(entity->security_context);
entity->free_security = NULL;
}
if (ciphering_algorithm != 0 && ciphering_algorithm != -1) {
if (ciphering_algorithm != 2) {
LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n");
exit(1);
}
entity->has_ciphering = 1;
if (entity->free_security != NULL)
entity->free_security(entity->security_context);
entity->security_context = nr_pdcp_security_nea2_init(entity->ciphering_key);
entity->cipher = nr_pdcp_security_nea2_cipher;
entity->free_security = nr_pdcp_security_nea2_free_security;
}
}
static void check_t_reordering(nr_pdcp_entity_t *entity)
......@@ -339,34 +380,11 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
ret->sn_max = (1 << sn_size) - 1;
ret->window_size = 1 << (sn_size - 1);
if (ciphering_key != NULL && ciphering_algorithm != 0) {
if (ciphering_algorithm != 2) {
LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n");
exit(1);
}
ret->has_ciphering = 1;
ret->ciphering_algorithm = ciphering_algorithm;
memcpy(ret->ciphering_key, ciphering_key, 16);
ret->security_context = nr_pdcp_security_nea2_init(ciphering_key);
ret->cipher = nr_pdcp_security_nea2_cipher;
ret->free_security = nr_pdcp_security_nea2_free_security;
}
ret->is_gnb = is_gnb;
if (integrity_key != NULL && integrity_algorithm != 0) {
if (integrity_algorithm != 2) {
LOG_E(PDCP, "FATAL: only nia2 supported for the moment\n");
exit(1);
}
ret->has_integrity = 1;
ret->integrity_algorithm = integrity_algorithm;
memcpy(ret->integrity_key, integrity_key, 16);
ret->integrity_context = nr_pdcp_integrity_nia2_init(integrity_key);
ret->integrity = nr_pdcp_integrity_nia2_integrity;
ret->free_integrity = nr_pdcp_integrity_nia2_free_integrity;
}
nr_pdcp_entity_set_security(ret,
integrity_algorithm, (char *)integrity_key,
ciphering_algorithm, (char *)ciphering_key);
return ret;
}
......@@ -45,7 +45,7 @@ static void compute_t(unsigned char *t, uint32_t count, int bearer,
t[1] = (count >> 16) & 255;
t[2] = (count >> 8) & 255;
t[3] = (count ) & 255;
t[4] = (bearer << 3) | (direction << 2);
t[4] = ((bearer-1) << 3) | (direction << 2);
memset(&t[5], 0, 8-5);
}
......@@ -63,6 +63,7 @@ void nr_pdcp_integrity_nia2_integrity(void *integrity_context,
* (which is identical to 128-NIA2, see 33.501 D.3.1.3) */
compute_t(t, count, bearer, direction);
CMAC_Init(ctx, NULL, 0, NULL, NULL);
CMAC_Update(ctx, t, 8);
CMAC_Update(ctx, buffer, length);
CMAC_Final(ctx, mac, &maclen);
......
......@@ -70,6 +70,7 @@
#include "NR_RRCReconfigurationComplete-IEs.h"
#include "NR_DLInformationTransfer.h"
#include "NR_RRCReestablishmentRequest.h"
#include "NR_UE-CapabilityRequestFilterNR.h"
#include "PHY/defs_nr_common.h"
#if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h"
......@@ -1076,7 +1077,8 @@ void fill_initial_SpCellConfig(rnti_t rnti,
ASN_SEQUENCE_ADD(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list,
ss2);
SpCellConfig->spCellConfigDedicated->tag_Id=0;
}
void fill_initial_cellGroupConfig(rnti_t rnti,
......@@ -1127,6 +1129,10 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
logicalChannelGroup = CALLOC(1, sizeof(long));
*logicalChannelGroup = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID));
*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
//}
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
......@@ -1135,11 +1141,27 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
cellGroupConfig->rlc_BearerToReleaseList = NULL;
/* mac CellGroup Config */
if (0) {
mac_CellGroupConfig = calloc(1, sizeof(NR_MAC_CellGroupConfig_t));
if (1) {
mac_CellGroupConfig = calloc(1, sizeof(*mac_CellGroupConfig));
mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig));
mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList));
struct NR_SchedulingRequestToAddMod *schedulingrequestlist;
schedulingrequestlist = CALLOC(1,sizeof(*schedulingrequestlist));
schedulingrequestlist->schedulingRequestId = 0;
schedulingrequestlist->sr_ProhibitTimer = CALLOC(1,sizeof(*schedulingrequestlist->sr_ProhibitTimer));
*(schedulingrequestlist->sr_ProhibitTimer) = 0;
schedulingrequestlist->sr_TransMax = 0;
ASN_SEQUENCE_ADD(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist);
mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config));
mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10;
mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80;
mac_CellGroupConfig->tag_Config = calloc(1, sizeof(*mac_CellGroupConfig->tag_Config));
mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL;
mac_CellGroupConfig->tag_Config->tag_ToAddModList = calloc(1,sizeof(*mac_CellGroupConfig->tag_Config->tag_ToAddModList));
struct NR_TAG *tag=calloc(1,sizeof(*tag));
tag->tag_Id = 0;
tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity;
ASN_SEQUENCE_ADD(&mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag);
mac_CellGroupConfig->phr_Config = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config));
mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup;
mac_CellGroupConfig->phr_Config->choice.setup = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config->choice.setup));
......@@ -1243,7 +1265,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
NULL,
(void *)cellGroupConfig,
masterCellGroup_buf,
100);
1000);
if(enc_rval.encoded == -1) {
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
......@@ -1264,7 +1286,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
NULL,
(void *)&dl_ccch_msg,
buffer,
100);
1000);
if(enc_rval.encoded == -1) {
LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
......@@ -1346,6 +1368,11 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
const uint8_t Transaction_id)
//------------------------------------------------------------------------------
{
NR_UE_CapabilityRequestFilterNR_t *sa_band_filter;
NR_FreqBandList_t *sa_band_list;
NR_FreqBandInformation_t *sa_band_info;
NR_FreqBandInformationNR_t *sa_band_infoNR;
NR_DL_DCCH_Message_t dl_dcch_msg;
NR_UE_CapabilityRAT_Request_t *ue_capabilityrat_request;
......@@ -1362,6 +1389,35 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
memset(ue_capabilityrat_request,0,sizeof(NR_UE_CapabilityRAT_Request_t));
ue_capabilityrat_request->rat_Type = NR_RAT_Type_nr;
sa_band_infoNR = (NR_FreqBandInformationNR_t*)calloc(1,sizeof(NR_FreqBandInformationNR_t));
sa_band_infoNR->bandNR = 78;
sa_band_info = (NR_FreqBandInformation_t*)calloc(1,sizeof(NR_FreqBandInformation_t));
sa_band_info->present = NR_FreqBandInformation_PR_bandInformationNR;
sa_band_info->choice.bandInformationNR = sa_band_infoNR;
sa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
ASN_SEQUENCE_ADD(&sa_band_list->list, sa_band_info);
sa_band_filter = (NR_UE_CapabilityRequestFilterNR_t*)calloc(1,sizeof(NR_UE_CapabilityRequestFilterNR_t));
sa_band_filter->frequencyBandListFilter = sa_band_list;
OCTET_STRING_t req_freq;
unsigned char req_freq_buf[1024];
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_CapabilityRequestFilterNR,
NULL,
(void *)sa_band_filter,
req_freq_buf,
1024);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UE_CapabilityRequestFilterNR, (void *)sa_band_filter);
}
req_freq.buf = req_freq_buf;
req_freq.size = (enc_rval.encoded+7)/8;
ue_capabilityrat_request->capabilityRequestFilter = &req_freq;
ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list,
ue_capabilityrat_request);
......@@ -1508,7 +1564,7 @@ uint16_t do_RRCReconfiguration(
NULL,
(void *)&dl_dcch_msg,
buffer,
100);
1000);
if(enc_rval.encoded == -1) {
LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
......
......@@ -193,3 +193,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
uint8_t xid,
uint32_t nas_length,
uint8_t *nas_buffer);
void
rrc_gNB_generate_dedicatedRRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP);
......@@ -707,13 +707,13 @@ rrc_gNB_generate_defaultRRCReconfiguration(
{
uint8_t buffer[RRC_BUF_SIZE];
uint16_t size;
NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
/*NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
NR_DRB_ToAddModList_t **DRB_configList = NULL;
NR_DRB_ToAddModList_t **DRB_configList2 = NULL;
NR_SRB_ToAddMod_t *SRB2_config = NULL;
NR_DRB_ToAddMod_t *DRB_config = NULL;
NR_SDAP_Config_t *sdap_config = NULL;
NR_SDAP_Config_t *sdap_config = NULL;*/
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList = NULL;
NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL;
......@@ -722,7 +722,7 @@ rrc_gNB_generate_defaultRRCReconfiguration(
/******************** Radio Bearer Config ********************/
/* Configure SRB2 */
SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid];
/*SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid];
if (*SRB_configList2) {
free(*SRB_configList2);
}
......@@ -731,10 +731,10 @@ rrc_gNB_generate_defaultRRCReconfiguration(
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = 2;
ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);*/
/* Configure DRB */
DRB_configList = &ue_context_pP->ue_context.DRB_configList;
/*DRB_configList = &ue_context_pP->ue_context.DRB_configList;
if (*DRB_configList) {
free(*DRB_configList);
}
......@@ -780,7 +780,7 @@ rrc_gNB_generate_defaultRRCReconfiguration(
DRB_config->pdcp_Config->ext1 = NULL;
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);*/
dedicatedNAS_MessageList = CALLOC(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList));
......@@ -802,8 +802,8 @@ rrc_gNB_generate_defaultRRCReconfiguration(
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCReconfiguration(ctxt_pP, buffer,
xid,
*SRB_configList2,
*DRB_configList,
NULL,//*SRB_configList2,
NULL,//*DRB_configList,
NULL,
NULL,
NULL,
......@@ -885,6 +885,227 @@ rrc_gNB_generate_defaultRRCReconfiguration(
}
}
//-----------------------------------------------------------------------------
void
rrc_gNB_generate_dedicatedRRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP
)
//-----------------------------------------------------------------------------
{
NR_DRB_ToAddMod_t *DRB_config = NULL;
NR_SRB_ToAddMod_t *SRB2_config = NULL;
NR_SDAP_Config_t *sdap_config = NULL;
NR_DRB_ToAddModList_t **DRB_configList = NULL;
NR_DRB_ToAddModList_t **DRB_configList2 = NULL;
NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList = NULL;
NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL;
uint8_t buffer[RRC_BUF_SIZE];
uint16_t size;
int qos_flow_index = 0;
NR_QFI_t qfi = 0;
int pdu_sessions_done = 0;
int i;
uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
/* Configure SRB2 */
SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid];
if (*SRB_configList2) {
free(*SRB_configList2);
}
*SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
memset(*SRB_configList2, 0, sizeof(**SRB_configList2));
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = 2;
ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
DRB_configList = &ue_context_pP->ue_context.DRB_configList;
if (*DRB_configList) {
free(*DRB_configList);
}
*DRB_configList = CALLOC(1, sizeof(**DRB_configList));
memset(*DRB_configList, 0, sizeof(**DRB_configList));
DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[xid];
if (*DRB_configList2) {
free(*DRB_configList2);
}
*DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
memset(*DRB_configList2, 0, sizeof(**DRB_configList2));
dedicatedNAS_MessageList = CALLOC(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList));
for (i = 0; i < ue_context_pP->ue_context.setup_pdu_sessions; i++) {
if (pdu_sessions_done >= ue_context_pP->ue_context.nb_of_pdusessions) {
break;
}
if (ue_context_pP->ue_context.pdusession[i].status >= PDU_SESSION_STATUS_DONE) {
continue;
}
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->drb_Identity = i+1;
DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation));
DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config;
// sdap_Config
sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t));
memset(sdap_config, 0, sizeof(NR_SDAP_Config_t));
sdap_config->pdu_Session = ue_context_pP->ue_context.pdusession[i].param.pdusession_id;
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_present;
sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_present;
sdap_config->defaultDRB = TRUE;
sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
memset(sdap_config->mappedQoS_FlowsToAdd, 0, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[i].param.nb_qos; qos_flow_index++) {
qfi = ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].qfi;
ASN_SEQUENCE_ADD(&sdap_config->mappedQoS_FlowsToAdd->list, &qfi);
}
sdap_config->mappedQoS_FlowsToRelease = NULL;
DRB_config->cnAssociation->choice.sdap_Config = sdap_config;
// pdcp_Config
DRB_config->reestablishPDCP = NULL;
DRB_config->recoverPDCP = NULL;
DRB_config->pdcp_Config = calloc(1, sizeof(*DRB_config->pdcp_Config));
DRB_config->pdcp_Config->drb = calloc(1,sizeof(*DRB_config->pdcp_Config->drb));
DRB_config->pdcp_Config->drb->discardTimer = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->discardTimer));
*DRB_config->pdcp_Config->drb->discardTimer = NR_PDCP_Config__drb__discardTimer_infinity;
DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL));
*DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits;
DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL));
*DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits;
DRB_config->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed;
DRB_config->pdcp_Config->drb->headerCompression.choice.notUsed = 0;
DRB_config->pdcp_Config->drb->integrityProtection = NULL;
DRB_config->pdcp_Config->drb->statusReportRequired = NULL;
DRB_config->pdcp_Config->drb->outOfOrderDelivery = NULL;
DRB_config->pdcp_Config->moreThanOneRLC = NULL;
DRB_config->pdcp_Config->t_Reordering = calloc(1, sizeof(*DRB_config->pdcp_Config->t_Reordering));
*DRB_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms750;
DRB_config->pdcp_Config->ext1 = NULL;
// Reference TS23501 Table 5.7.4-1: Standardized 5QI to QoS characteristics mapping
for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[i].param.nb_qos; qos_flow_index++) {
switch (ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].fiveQI) {
case 1: //100ms
case 2: //150ms
case 3: //50ms
case 4: //300ms
case 5: //100ms
case 6: //300ms
case 7: //100ms
case 8: //300ms
case 9: //300ms Video (Buffered Streaming)TCP-based (e.g., www, e-mail, chat, ftp, p2p file sharing, progressive video, etc.)
// TODO
break;
default:
LOG_E(NR_RRC,"not supported 5qi %d\n", ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].fiveQI);
ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_FAILED;
ue_context_pP->ue_context.pdusession[i].xid = xid;
pdu_sessions_done++;
free(DRB_config);
continue;
}
}
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_DONE;
ue_context_pP->ue_context.pdusession[i].xid = xid;
if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) {
dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t));
memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t));
OCTET_STRING_fromBuf(dedicatedNAS_Message,
(char *)ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer,
ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length);
ASN_SEQUENCE_ADD(&dedicatedNAS_MessageList->list, dedicatedNAS_Message);
LOG_I(NR_RRC,"add NAS info with size %d (pdusession id %d)\n",ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length, i);
} else {
// TODO
LOG_E(NR_RRC,"no NAS info (pdusession id %d)\n", i);
}
}
/* If list is empty free the list and reset the address */
if (dedicatedNAS_MessageList->list.count == 0) {
free(dedicatedNAS_MessageList);
dedicatedNAS_MessageList = NULL;
}
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCReconfiguration(ctxt_pP, buffer,
xid,
*SRB_configList2,
*DRB_configList,
NULL,
NULL,
NULL,
NULL,
dedicatedNAS_MessageList,
NULL);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n");
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) {
if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) {
/* Free the NAS PDU buffer and invalidate it */
free(ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer);
ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer = NULL;
}
}
LOG_I(NR_RRC,
"[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCReconfiguration (bytes %d, UE RNTI %x)\n",
ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
LOG_D(NR_RRC,
"[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_gNB_mui, ctxt_pP->module_id, DCCH);
MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
buffer,
size,
MSC_AS_TIME_FMT" dedicated RRCReconfiguration UE %x MUI %d size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti,
rrc_gNB_mui,
size);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size);
memcpy (message_buffer, buffer, size);
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else
nr_rrc_data_req(
ctxt_pP,
DCCH,
rrc_gNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
#endif
}
//-----------------------------------------------------------------------------
void
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
......
......@@ -1058,8 +1058,9 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
ue_context_p->ue_context.setup_pdu_sessions += nb_pdusessions_tosetup;
// TEST
ue_context_p->ue_context.pdusession[0].status = PDU_SESSION_STATUS_DONE;
rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(&ctxt, ue_context_p, 0);
// ue_context_p->ue_context.pdusession[0].status = PDU_SESSION_STATUS_DONE;
// rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(&ctxt, ue_context_p, 0);
rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p);
return(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