Commit b6f51897 authored by Vaibhav Shrivastava's avatar Vaibhav Shrivastava

Merge branch '3GPP_TTCN_System_Simulator' into 3GPP_5G_Rebased_with_W11

parents 84439d87 f9b083eb
......@@ -109,13 +109,13 @@ if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h")
# for ubuntu 17.10, directories are different
elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h")
include_directories("/usr/include/x86_64-linux-gnu")
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
list(APPEND ATLAS_LIBRARIES cblas)
list(APPEND ATLAS_LIBRARIES atlas)
list(APPEND ATLAS_LIBRARIES lapack)
else()
message("No Blas/Atlas libs found, some targets will fail")
endif()
......@@ -152,7 +152,7 @@ add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of bui
# in case /proc/cpuinfo exists we want to inspect available Intrinsics
# -so not to go always through SIMDE emulation
# -so to avoid AVX512 instructions generation by gcc
# -so to avoid AVX512 instructions generation by gcc
execute_process(COMMAND uname -m OUTPUT_VARIABLE CPUARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "CPUARCH ${CPUARCH}")
if(EXISTS "/proc/cpuinfo")
......@@ -1384,7 +1384,7 @@ set(NR_SDAP_SRC
${OPENAIR2_DIR}/SDAP/nr_sdap/nr_sdap.c
${OPENAIR2_DIR}/SDAP/nr_sdap/nr_sdap_entity.c
)
set(L2_SRC
${PDCP_DIR}/pdcp.c
${PDCP_DIR}/pdcp_fifo.c
......@@ -1697,6 +1697,7 @@ set(SS_SRC
${OPENAIR3_DIR}/SS/ss_gNB_sys_task.c
${OPENAIR3_DIR}/SS/ss_gNB_vtp_task.c
${OPENAIR3_DIR}/SS/ss_gNB_drb_task.c
${OPENAIR3_DIR}/SS/ss_utils.c
)
file(GLOB ss_sidl ${SIDL_CMPLR}/src/*.c)
file(GLOB ss_acp ${SIDL_DIR}/acp/src/*.c)
......
......@@ -131,10 +131,10 @@ extern "C" {
size_t s=t->message_queue.size();
if ( s > t->admin.queue_size )
LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
LOG_D(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
if ( s > 50 )
LOG_I(ITTI,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message));
LOG_D(ITTI,"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;
......@@ -147,7 +147,7 @@ extern "C" {
task_list_t *t=tasks[destination_task_id];
pthread_mutex_lock (&t->queue_cond_lock);
int ret=itti_send_msg_to_task_locked(destination_task_id, destinationInstance, message);
LOG_I(ITTI, "src task:%s dest task:%s msg_name:%s\n",ITTI_MSG_ORIGIN_NAME(message), ITTI_MSG_DESTINATION_NAME(message), ITTI_MSG_NAME(message) );
LOG_D(ITTI, "src task:%s dest task:%s msg_name:%s\n",ITTI_MSG_ORIGIN_NAME(message), ITTI_MSG_DESTINATION_NAME(message), ITTI_MSG_NAME(message) );
while ( t->message_queue.size()>0 && t->admin.func != NULL ) {
if (t->message_queue.size()>1)
LOG_W(ITTI,"queue in no thread mode is %ld\n", t->message_queue.size());
......@@ -240,8 +240,8 @@ extern "C" {
AssertFatal (nb_events >=0,
"epoll_wait failed for task %s, nb fds %d, timeout %lu: %s!\n",
itti_get_task_name(task_id), t->nb_fd_epoll,
t->next_timer != UINT64_MAX ? t->next_timer-current_time : -1,
itti_get_task_name(task_id), t->nb_fd_epoll,
t->next_timer != UINT64_MAX ? t->next_timer-current_time : -1,
strerror(errno));
LOG_D(ITTI,"receive on %d descriptors for %s\n", nb_events, itti_get_task_name(task_id));
......
This diff is collapsed.
......@@ -35,6 +35,20 @@ typedef enum {
NR_PDCP_SRB
} nr_pdcp_entity_type_t;
/**
* 3GPP TS 33.501
* RRC downlink ciphering (encryption) at the gNB shall start after sending the AS security mode command message.
* RRC uplink deciphering (decryption) at the gNB shall start after receiving and successful verification of the AS security mode complete message.
*
* RRC uplink ciphering (encryption) at the UE shall start after sending the AS security mode complete message.
* RRC downlink deciphering (decryption) at the UE shall start after receiving and successful verification of the AS security mode command message.
*/
typedef enum {
NR_PDCP_ENTITY_CIPHERING_OFF = 0,
NR_PDCP_ENTITY_CIPHERING_ON = 1,
NR_PDCP_ENTITY_CIPHERING_SMC = 2, /* A Transient state to skip decryption @ gNB and encryption @ nrUE during SMC procedure */
} nr_pdcp_entity_ciphering_state_t;
typedef struct {
//nr_pdcp_entity_type_t mode;
/* PDU stats */
......@@ -124,7 +138,7 @@ typedef struct nr_pdcp_entity_t {
int t_reordering_start;
/* security */
int has_ciphering;
nr_pdcp_entity_ciphering_state_t has_ciphering;
int has_integrity;
int ciphering_algorithm;
int integrity_algorithm;
......@@ -151,19 +165,6 @@ typedef struct nr_pdcp_entity_t {
int rx_size;
int rx_maxsize;
nr_pdcp_statistics_t stats;
// WARNING: This is a hack!
// 3GPP TS 38.331 (RRC) version 15.3
// Section 5.3.4.3 Reception of the SecurityModeCommand by the UE
// The UE needs to send the Security Mode Complete message. However, the message
// needs to be sent without being ciphered.
// However:
// 1- The Security Mode Command arrives to the UE with the cipher algo (e.g., nea2).
// 2- The UE is configured with the cipher algo.
// 3- The Security Mode Complete message is sent to the itti task queue.
// 4- The ITTI task, forwards the message ciphering (e.g., nea2) it.
// 5- The gNB cannot understand the ciphered Security Mode Complete message.
bool security_mode_completed;
} nr_pdcp_entity_t;
nr_pdcp_entity_t *new_nr_pdcp_entity(
......
......@@ -42,6 +42,9 @@
#include "gnb_config.h"
#include "executables/softmodem-common.h"
// 2DO: REMOVE, FOR DEBUG PURPOSES ONLY
#include "nr_pdcp_security.h"
#define TODO do { \
printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \
exit(1); \
......@@ -795,6 +798,7 @@ rb_found:
memblock = get_free_mem_block(size, __FUNCTION__);
memcpy(memblock->data, buf, size);
LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d\n", __func__, rb_id, size);
LOG_MSG(memblock->data, size, "%s: from RLC to PDCP: ", __FUNCTION__);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
//printf("\n");
enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock);
......@@ -883,9 +887,8 @@ static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity,
exit(1);
srb_found:
LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, srb_id, size);
LOG_MSG(buf, size, "%s: PDCP => RLC: ", __FUNCTION__);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
//printf("\n");
if ((RC.nrrrc == NULL) || (!NODE_IS_CU(node_type))) {
......@@ -1170,12 +1173,15 @@ void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddMo
for (int i = 0; i < srb2add_list->list.count; i++) {
add_srb(enb_flag, rntiMaybeUEid, srb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kRRCenc, kRRCint);
}
} else
} else {
LOG_W(PDCP, "nr_pdcp_add_srbs() with void list\n");
if (kRRCenc)
}
if (kRRCenc) {
free(kRRCenc);
if (kRRCint)
}
if (kRRCint) {
free(kRRCint);
}
}
void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
......@@ -1322,6 +1328,7 @@ void pdcp_config_set_security(
uint8_t *const kRRCint_pP,
uint8_t *const kUPenc_pP)
{
FNIN;
nr_pdcp_ue_t *ue;
nr_pdcp_entity_t *rb;
ue_id_t ue_id = ctxt_pP->rntiMaybeUEid;
......@@ -1345,15 +1352,16 @@ void pdcp_config_set_security(
integrity_algorithm = (security_modeP>>4) & 0xf;
ciphering_algorithm = security_modeP & 0x0f;
rb->set_security(rb, integrity_algorithm, (char *)kRRCint_pP,
ciphering_algorithm, (char *)kRRCenc_pP);
rb->security_mode_completed = false;
LOG_MSG(kRRCint_pP, 16, "%s: (%d) kRRCint_pP: ", __FUNCTION__, integrity_algorithm);
LOG_MSG(kRRCenc_pP, 16, "%s: (%d) kRRCenc_pP: ", __FUNCTION__, ciphering_algorithm);
rb->set_security(rb, integrity_algorithm, kRRCint_pP, ciphering_algorithm, kRRCenc_pP);
} else {
LOG_E(PDCP, "%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
FNOUT;
}
static bool pdcp_data_req_srb(protocol_ctxt_t *ctxt_pP,
......@@ -1600,3 +1608,21 @@ const bool nr_pdcp_get_statistics(ue_id_t ue_id, int srb_flag, int rb_id, nr_pdc
return ret;
}
void nr_pdcp_config_set_smc(ue_id_t crntiMaybeUEid, bool complete)
{
FNIN;
nr_pdcp_ue_t *ue;
nr_pdcp_entity_t *rb;
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, crntiMaybeUEid);
if (ue && ue->srb[0]) {
rb = ue->srb[0];
if (rb->ciphering_algorithm > 0) {
rb->has_ciphering = complete ? NR_PDCP_ENTITY_CIPHERING_ON : NR_PDCP_ENTITY_CIPHERING_SMC;
}
}
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
FNOUT;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _NR_PDCP_SECURITY_H_
#define _NR_PDCP_SECURITY_H_
#define NR_PDCP_DBG
#ifdef NR_PDCP_DBG
#include "LOG/log.h"
#define FNIN LOG_D(PDCP, ">>> %s:%d\n",__FUNCTION__, __LINE__);
#define FNOUT LOG_D(PDCP, "<<< %s:%d\n",__FUNCTION__, __LINE__);
#define LOG_MSG(B, S, ...) LOG_UDUMPMSG(PDCP, B, S, LOG_DUMP_CHAR, __VA_ARGS__);
#else // NR_PDCP_DBG
#define FNIN printf(">>> %s:%d\n", __FUNCTION__, __LINE__);
#define FNOUT printf("<<< %s:%d\n", __FUNCTION__, __LINE__);
#define LOG_MSG(B, S, ...) do {printf(__VA_ARGS__); for (int i = 0; i < S; ++i) printf("%02X", (uint8_t)B[i]); printf("\n"); } while(0);
#endif // NR_PDCP_DBG
#endif /* _NR_PDCP_SECURITY_H_ */
......@@ -989,7 +989,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
PHY_FIND_CELL_IND (message_p).cells[i].rsrp = cell_ind.lte_cell_search_indication.lte_found_cells[i].rsrp;
PHY_FIND_CELL_IND (message_p).cells[i].rsrq = cell_ind.lte_cell_search_indication.lte_found_cells[i].rsrq;
LOG_A(NR_PHY, "Cell No: %d PCI: %d EARFCN: %d RSRP: %d RSRQ: %d \n", PHY_FIND_CELL_IND (message_p).cell_nb,
LOG_D(NR_PHY, "Cell No: %d PCI: %d EARFCN: %d RSRP: %d RSRQ: %d \n", PHY_FIND_CELL_IND (message_p).cell_nb,
PHY_FIND_CELL_IND (message_p).cells[i].cell_id,
PHY_FIND_CELL_IND (message_p).cells[i].earfcn,
PHY_FIND_CELL_IND (message_p).cells[i].rsrp,
......
......@@ -1569,7 +1569,7 @@ rrc_ue_process_securityModeCommand(
if (h_rc == HASH_TABLE_OK) {
LOG_D(RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key);
LOG_D(RRC, "driving kRRCenc, kRRCint and kUPenc from KeNB="
LOG_D(RRC, "deriving kRRCenc, kRRCint and kUPenc from KeNB="
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
......@@ -1672,7 +1672,7 @@ rrc_ue_process_MBMSCountingRequest(
LTE_MBMSCountingResponse_r10_t *MBMSCountingResponse = &ul_dcch_msg.message.choice.c1.choice.mbmsCountingResponse_r10;
MBMSCountingResponse->criticalExtensions.present = LTE_MBMSCountingResponse_r10__criticalExtensions_PR_c1;
MBMSCountingResponse->criticalExtensions.choice.c1.present = LTE_MBMSCountingResponse_r10__criticalExtensions__c1_PR_countingResponse_r10;
MBMSCountingResponse->criticalExtensions.choice.c1.present = LTE_MBMSCountingResponse_r10__criticalExtensions__c1_PR_countingResponse_r10;
LTE_MBMSCountingResponse_r10_IEs_t *MBMSCountingResponse_r10_IEs = &MBMSCountingResponse->criticalExtensions.choice.c1.choice.countingResponse_r10;
MBMSCountingResponse_r10_IEs->mbsfn_AreaIndex_r10 = calloc(1,sizeof(long));
......@@ -3103,7 +3103,7 @@ int decode_SIB1_MBMS( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_in
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag_MBMS = sib1_MBMS->systemInfoValueTag_r14;
/*
if (EPC_MODE_ENABLED)
if (EPC_MODE_ENABLED)
{
int cell_valid = 0;
......@@ -4292,10 +4292,10 @@ int decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) {
}
if (new_sib == 1) {
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt++;
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt == sib1->schedulingInfoList.list.count)
rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE );
LOG_I(RRC,"SIStatus %x, SIcnt %d/%d\n",
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus,
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt,
......
......@@ -37,7 +37,6 @@
#include "nr_rrc_config.h"
#include "nr_rrc_defs.h"
#include "nr_rrc_extern.h"
#include "assertions.h"
#include "common/ran_context.h"
#include "oai_asn1.h"
#include "rrc_gNB_radio_bearers.h"
......@@ -82,6 +81,8 @@
#include "rrc_gNB_GTPV1U.h"
#include "nr_pdcp/nr_pdcp_entity.h"
#include "nr_pdcp/nr_pdcp.h"
#include "pdcp_primitives.h"
#include "pdcp.h"
#include "intertask_interface.h"
......@@ -120,6 +121,13 @@ static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn);
mui_t rrc_gNB_mui = 0;
uint8_t first_rrcreconfiguration = 0;
// temp static storage for AS Security settings to be applied for SRB1 and SRB2
static e_NR_IntegrityProtAlgorithm _int_algo = 0;
static NR_CipheringAlgorithm_t _cip_algo = 0;
static uint8_t _nr_cp_int_key[16] = {0};
static uint8_t _nr_cp_cip_key[16] = {0};
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
......@@ -1615,6 +1623,8 @@ rrc_gNB_process_RRCReconfigurationComplete(
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
#if 0
// TTCN does all the calculations of kgNB and derived RRC keys
/* Derive the keys from kgnb */
if (DRB_configList != NULL) {
nr_derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
......@@ -1632,6 +1642,13 @@ rrc_gNB_process_RRCReconfigurationComplete(
ue_context_pP->ue_context.kgnb,
&kRRCint);
/* Refresh SRBs/DRBs */
#endif
kRRCenc = (uint8_t*)malloc(16);
kRRCint = (uint8_t*)malloc(16);
AssertFatal(kRRCint && kRRCenc, "malloc failed");
memcpy(kRRCenc, _nr_cp_cip_key, 16);
memcpy(kRRCint, _nr_cp_int_key, 16);
LOG_D(NR_RRC, "Configuring PDCP DRBs/SRBs for UE %04x\n", ue_context_pP->ue_context.rnti);
......@@ -1651,7 +1668,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
}
}
nr_pdcp_add_srbs(ctxt_pP->enb_flag, ctxt_pP->rntiMaybeUEid, SRB_configList, (ue_context_pP->ue_context.integrity_algorithm << 4) | ue_context_pP->ue_context.ciphering_algorithm, kRRCenc, kRRCint);
nr_pdcp_add_srbs(ctxt_pP->enb_flag, ctxt_pP->rntiMaybeUEid, SRB_configList, (_int_algo << 4) | _cip_algo, kRRCenc, kRRCint);
nr_pdcp_add_drbs(ctxt_pP->enb_flag,
ctxt_pP->rntiMaybeUEid,
......@@ -2626,7 +2643,7 @@ rrc_gNB_decode_dcch(
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(Rx_sdu), sdu_sizeP,
"[MSG] RRC Connection Reconfiguration Complete\n");
LOG_D(NR_RRC,
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCReconfigurationComplete) ---> RRC_gNB]\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
......@@ -2698,7 +2715,7 @@ rrc_gNB_decode_dcch(
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
"[MSG] RRC SetupComplete\n");
LOG_D(NR_RRC,
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCSetupComplete) ---> RRC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
......@@ -2815,7 +2832,9 @@ rrc_gNB_decode_dcch(
}
/* configure ciphering */
nr_rrc_pdcp_config_security(ctxt_pP, ue_context_p, 1);
// FIXME: Commented for Bug 124092, no need to NGAP key recalculation
// nr_rrc_pdcp_config_security(ctxt_pP, ue_context_p, 1);
nr_pdcp_config_set_smc(ctxt_pP->rntiMaybeUEid, true);
if (RC.ss.mode == SS_GNB)
{
......@@ -4648,6 +4667,36 @@ void *rrc_gnb_task(void *args_p) {
case NGAP_PAGING_IND:
rrc_gNB_process_PAGING_IND(msg_p, msg_name_p, instance);
break;
case RRC_AS_SECURITY_CONFIG_REQ:
{
_int_algo = (e_NR_IntegrityProtAlgorithm)RRC_AS_SECURITY_CONFIG_REQ(msg_p).Integrity.integrity_algorithm;
_cip_algo = (NR_CipheringAlgorithm_t)RRC_AS_SECURITY_CONFIG_REQ(msg_p).Ciphering.ciphering_algorithm;
LOG_I(NR_RRC,"[gNB %ld] Received %s: Int algo: %d, Cip algo: %d \n", instance, msg_name_p, _int_algo, _cip_algo);
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, RRC_AS_SECURITY_CONFIG_REQ(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame, msg_p->ittiMsgHeader.lte_time.slot);
if (_int_algo > 0) {
memcpy(&(_nr_cp_int_key[0]), &(RRC_AS_SECURITY_CONFIG_REQ(msg_p).Integrity.kRRCint[0]), 16);
} else {
memset(&(_nr_cp_int_key[0]), 0, 16);
}
if (_cip_algo > 0) {
memcpy(&(_nr_cp_cip_key[0]), &(RRC_AS_SECURITY_CONFIG_REQ(msg_p).Ciphering.kRRCenc[0]), 16);
} else {
memset(&(_nr_cp_cip_key[0]), 0, 16);
}
int unused = 0;
int rb = 1;
pdcp_config_set_security(&ctxt, NULL, rb, unused, _cip_algo | _int_algo << 4,
&(RRC_AS_SECURITY_CONFIG_REQ(msg_p).Ciphering.kRRCenc[0]),
&(RRC_AS_SECURITY_CONFIG_REQ(msg_p).Integrity.kRRCint[0]),
&RRC_AS_SECURITY_CONFIG_REQ(msg_p).Ciphering.kUPenc);
}
break;
default:
LOG_E(NR_RRC, "[gNB %ld] Received unexpected message %s\n", instance, msg_name_p);
......
......@@ -59,6 +59,7 @@
#include "executables/softmodem-common.h"
#include "plmn_data.h"
#include "pdcp.h"
#include "nr_pdcp/nr_pdcp.h"
#include "UTIL/OSA/osa_defs.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
......@@ -1737,7 +1738,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
nr_derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb,
&kRRCint);
LOG_I(NR_RRC, "driving kRRCenc, kRRCint and kUPenc from KgNB="
LOG_I(NR_RRC, "deriving kRRCenc, kRRCint and kUPenc from KgNB="
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
......@@ -1787,10 +1788,9 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
LOG_D(NR_RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) {
LOG_T(NR_RRC, "%02x.", buffer[i]);
LOG_I(NR_RRC, "%02x.", buffer[i]);
}
LOG_T(NR_RRC, "\n");
LOG_I(NR_RRC, "\n");
rrc_data_req_nr_ue (ctxt_pP,
DCCH,
nr_rrc_mui++,
......@@ -1798,9 +1798,14 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
(enc_rval.encoded + 7) / 8,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
} else
LOG_W(NR_RRC,"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand\n",
securityModeCommand->criticalExtensions.present);
if (NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm != NR_CipheringAlgorithm_nea0) {
LOG_I(NR_RRC, "Calling nr_pdcp_config_set_smc");
nr_pdcp_config_set_smc(ctxt_pP->rntiMaybeUEid, false);
}
} else {
LOG_W(NR_RRC,"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand\n",
securityModeCommand->criticalExtensions.present);
}
}
//-----------------------------------------------------------------------------
......@@ -2251,6 +2256,7 @@ nr_rrc_ue_establish_srb2(
ie->nonCriticalExtension->masterCellGroup);
}
updateKgNB(0, &(NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[0]));
if (ie->radioBearerConfig != NULL) {
LOG_I(NR_RRC, "radio Bearer Configuration is present\n");
nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig);
......@@ -2603,14 +2609,14 @@ nr_rrc_ue_establish_srb2(
case PHY_FIND_CELL_IND:
{
nb_cells = PHY_FIND_CELL_IND(msg_p).cell_nb;
LOG_D(RRC, "Received message %s with reports for %d cells.\n",
LOG_D(RRC, "Received message %s with reports for %d cells.\n",
ITTI_MSG_NAME (msg_p), nb_cells);
for (int i = 0 ; i < nb_cells; i++)
for (int i = 0 ; i < nb_cells; i++)
{
rsrp_cell = PHY_FIND_CELL_IND(msg_p).cells[i].rsrp;
rsrq_cell = PHY_FIND_CELL_IND(msg_p).cells[i].rsrq;
LOG_A (RRC, "PHY_FIND_CELL_IND Cell: %d RSRP: %d RSRQ: %d \n",
LOG_D(RRC, "PHY_FIND_CELL_IND Cell: %d RSRP: %d RSRQ: %d \n",
PHY_FIND_CELL_IND(msg_p).cell_nb, rsrp_cell, rsrq_cell);
}
break;
......
......@@ -50,6 +50,7 @@
#include "acpNrDrb.h"
#include "ss_gNB_context.h"
#include "ss_utils.h"
extern RAN_CONTEXT_t RC;
extern SSConfigContext_t SS_context;
......@@ -66,26 +67,6 @@ enum MsgUserId
MSG_NrDrbProcessToSS_userId,
};
static void bits_copy_from_array(char *dst, int off, const char* src, int len)
{
while (len-- > 0)
{
int bit = *src++ ? 1 : 0;
dst[off / 8] |= bit << (7 - off % 8);
off++;
}
}
static void bits_copy_to_array(char *dst, int off, const char* src, int len)
{
while (len-- > 0)
{
int bit = src[off / 8] & (1 << (7 - off % 8));
*dst++ = bit ? 0x01 : 0x00;
off++;
}
}
static void ss_send_drb_data(ss_drb_pdu_ind_t *pdu_ind)
{
struct NR_DRB_COMMON_IND ind = {};
......
This diff is collapsed.
#include "ss_utils.h"
void bits_copy_from_array(char *dst, int off, const char* src, int len)
{
while (len-- > 0)
{
int bit = *src++ ? 1 : 0;
dst[off / 8] |= bit << (7 - off % 8);
off++;
}
}
void bits_copy_to_array(char *dst, int off, const char* src, int len)
{
while (len-- > 0)
{
int bit = src[off / 8] & (1 << (7 - off % 8));
*dst++ = bit ? 0x01 : 0x00;
off++;
}
}
#ifndef SS_UTILS_H_
#define SS_UTILS_H_
void bits_copy_from_array(char *dst, int off, const char* src, int len);
void bits_copy_to_array(char *dst, int off, const char* src, int len);
#endif // SS_UTILS_H_
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