Commit 18a68387 authored by Robert Schmidt's avatar Robert Schmidt

Transfer Initial UL RRC Message through internal F1

parent a126cd12
......@@ -304,6 +304,7 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_BM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PHY_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RLC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_ENB_NB_IoT, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PDCP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
......
......@@ -62,7 +62,6 @@
#define F1AP_MAX_NO_OF_TNL_ASSOCIATIONS 32
#define F1AP_MAX_NO_UE_ID 1024
#define F1AP_MAX_DU2CU_RRC_LENGTH 1024
typedef struct f1ap_net_ip_address_s {
unsigned ipv4:1;
......@@ -310,7 +309,7 @@ typedef struct f1ap_initial_ul_rrc_message_s {
uint16_t crnti;
uint8_t *rrc_container;
int rrc_container_length;
char du2cu_rrc_container[F1AP_MAX_DU2CU_RRC_LENGTH];
uint8_t *du2cu_rrc_container;
int du2cu_rrc_container_length;
} f1ap_initial_ul_rrc_message_t;
......
......@@ -79,56 +79,60 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_C_RNTI, true);
rnti = ie->value.choice.C_RNTI;
/* RRC Container */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_InitialULRRCMessageTransferIEs_t *rrccont;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, rrccont, container,
F1AP_ProtocolIE_ID_id_RRCContainer, true);
AssertFatal(ie!=NULL,"RRCContainer is missing\n");
// create an ITTI message and copy SDU
if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) {
message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND);
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
ccch_sdu_len = ie->value.choice.RRCContainer.size;
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len);
} else {
message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND);
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
ccch_sdu_len = ie->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len);
}
AssertFatal(rrccont!=NULL,"RRCContainer is missing\n");
LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, ie->value.choice.RRCContainer.size);
/* DUtoCURRCContainer */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_InitialULRRCMessageTransferIEs_t *du2cu;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, du2cu, container,
F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, false);
if (ie) {
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t));
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = ie->value.choice.DUtoCURRCContainer.size;
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(ie->value.choice.DUtoCURRCContainer.size);
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf,
ie->value.choice.DUtoCURRCContainer.buf,
ie->value.choice.DUtoCURRCContainer.size);
}
int f1ap_uid = f1ap_add_ue(CUtype, instance, rnti);
if (f1ap_uid < 0 ) {
LOG_E(F1AP, "Failed to add UE \n");
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1;
}
// create an ITTI message and copy SDU
if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) {
message_p = itti_alloc_new_message (TASK_CU_F1, 0, F1AP_INITIAL_UL_RRC_MESSAGE);
f1ap_initial_ul_rrc_message_t *ul_rrc = &F1AP_INITIAL_UL_RRC_MESSAGE(message_p);
ul_rrc->nr_cellid = nr_cellid; // CU instance
ul_rrc->crnti = rnti;
ul_rrc->rrc_container_length = rrccont->value.choice.RRCContainer.size;
ul_rrc->rrc_container = malloc(ul_rrc->rrc_container_length);
memcpy(ul_rrc->rrc_container, rrccont->value.choice.RRCContainer.buf, ul_rrc->rrc_container_length);
AssertFatal(du2cu != NULL, "no masterCellGroup in initial UL RRC message\n");
ul_rrc->du2cu_rrc_container_length = du2cu->value.choice.DUtoCURRCContainer.size;
ul_rrc->du2cu_rrc_container = malloc(ul_rrc->du2cu_rrc_container_length);
memcpy(ul_rrc->du2cu_rrc_container, du2cu->value.choice.DUtoCURRCContainer.buf, ul_rrc->du2cu_rrc_container_length);
itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p);
} else {
message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND);
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
ccch_sdu_len = rrccont->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, rrccont->value.choice.RRCContainer.buf,
ccch_sdu_len);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
NR_RRC_MAC_CCCH_DATA_IND (message_p).nr_cellid = nr_cellid; // CU instance
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
if (du2cu) {
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t));
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = du2cu->value.choice.DUtoCURRCContainer.size;
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(du2cu->value.choice.DUtoCURRCContainer.size);
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf,
du2cu->value.choice.DUtoCURRCContainer.buf,
du2cu->value.choice.DUtoCURRCContainer.size);
}
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p);
}
//getCxt(true,ITTI_MSG_DESTINATION_ID(message_p))->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
NR_RRC_MAC_CCCH_DATA_IND (message_p).nr_cellid = nr_cellid; // CU instance
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
itti_send_msg_to_task (f1ap_req(true,ITTI_MSG_DESTINATION_ID(message_p))->cell_type==CELL_MACRO_GNB?TASK_RRC_GNB:TASK_RRC_ENB, instance, message_p);
return 0;
}
......
......@@ -749,7 +749,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP,
rnti_t rntiP,
const uint8_t *sduP,
sdu_size_t sdu_lenP,
const char *sdu2P,
const uint8_t *sdu2P,
sdu_size_t sdu2_lenP) {
F1AP_F1AP_PDU_t pdu= {0};
F1AP_InitialULRRCMessageTransfer_t *out;
......@@ -808,7 +808,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP,
ie5->criticality = F1AP_Criticality_reject;
ie5->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
OCTET_STRING_fromBuf(&ie5->value.choice.DUtoCURRCContainer,
sdu2P,
(const char *)sdu2P,
sdu2_lenP);
}
/* mandatory */
......
......@@ -50,7 +50,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP,
rnti_t rntiP,
const uint8_t *sduP,
sdu_size_t sdu_lenP,
const char *sdu2P,
const uint8_t *sdu2P,
sdu_size_t sdu2_lenP);
#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */
......@@ -44,9 +44,12 @@
#include "OCG.h"
#include "OCG_extern.h"
/* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */
#include "RRC/LTE/rrc_extern.h"
#include "RRC/NR/nr_rrc_extern.h"
#include "RRC/NR/rrc_gNB_UE_context.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "RRC/NR/MESSAGES/asn1_msg.h"
#include "intertask_interface.h"
......@@ -2136,7 +2139,7 @@ int rnti_to_remove[10];
volatile int rnti_to_remove_count;
pthread_mutex_t rnti_to_remove_mutex = PTHREAD_MUTEX_INITIALIZER;
void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr)
void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia)
{
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
destroy_nr_list(&sched_ctrl->available_dl_harq);
......@@ -2145,6 +2148,7 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr)
destroy_nr_list(&sched_ctrl->available_ul_harq);
destroy_nr_list(&sched_ctrl->feedback_ul_harq);
destroy_nr_list(&sched_ctrl->retrans_ul_harq);
uid_linear_allocator_free(uia, UE->uid);
LOG_I(NR_MAC, "Remove NR rnti 0x%04x\n", UE->rnti);
const rnti_t rnti = UE->rnti;
free(UE);
......@@ -2439,6 +2443,7 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
}
UE->rnti = rntiP;
UE->uid = uid_linear_allocator_new(&UE_info->uid_allocator);
UE->CellGroup = CellGroup;
if (CellGroup)
......@@ -2492,7 +2497,7 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
}
if (i == MAX_MOBILES_PER_GNB) {
LOG_E(NR_MAC,"Try to add UE %04x but the list is full\n", rntiP);
delete_nr_ue_data(UE, nr_mac->common_channels);
delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator);
pthread_mutex_unlock(&UE_info->mutex);
return NULL;
}
......@@ -2596,7 +2601,7 @@ void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti)
memcpy(UE_info->list, newUEs, sizeof(UE_info->list));
pthread_mutex_unlock(&UE_info->mutex);
delete_nr_ue_data(UE, nr_mac->common_channels);
delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator);
}
void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti) {
......@@ -2979,3 +2984,52 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCom
req->Slot = i;
}
}
void send_initial_ul_rrc_message(module_id_t module_id,
int CC_id,
const NR_UE_info_t *UE,
rb_id_t srb_id,
const uint8_t *sdu,
sdu_size_t sdu_len) {
const gNB_MAC_INST *mac = RC.nrmac[module_id];
const rnti_t rnti = UE->rnti;
LOG_W(MAC,
"[RAPROC] Received SDU for CCCH on SRB %ld length %d for UE %04x\n",
srb_id, sdu_len, rnti);
/* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */
if (NODE_IS_DU(RC.nrrrc[module_id]->node_type)) {
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_id]);
ue_context_p->ue_id_rnti = rnti;
ue_context_p->ue_context.rnti = rnti;
ue_context_p->ue_context.random_ue_identity = rnti;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_id]->rrc_ue_head, ue_context_p);
}
const NR_ServingCellConfigCommon_t *scc = RC.nrrrc[module_id]->carrier.servingcellconfigcommon;
const NR_ServingCellConfig_t *sccd = RC.nrrrc[module_id]->configuration.scd;
NR_CellGroupConfig_t cellGroupConfig = {0};
fill_initial_cellGroupConfig(UE->uid, &cellGroupConfig, scc, sccd, &RC.nrrrc[module_id]->configuration);
uint8_t du2cu_rrc_container[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
&cellGroupConfig,
du2cu_rrc_container,
sizeof(du2cu_rrc_container));
AssertFatal(enc_rval.encoded > 0,
"Could not encode cellGroupConfig for UE %04x, failed element %s\n",
rnti,
enc_rval.failed_type->name);
const f1ap_initial_ul_rrc_message_t ul_rrc_msg = {
/* TODO: add mcc, mnc, cell_id, ..., is not available at MAC yet */
.crnti = rnti,
.rrc_container = (uint8_t *) sdu,
.rrc_container_length = sdu_len,
.du2cu_rrc_container = (uint8_t *) du2cu_rrc_container,
.du2cu_rrc_container_length = (enc_rval.encoded + 7) / 8
};
mac->mac_rrc.initial_ul_rrc_message_transfer(module_id, &ul_rrc_msg);
}
......@@ -312,16 +312,12 @@ int nr_process_mac_pdu( instance_t module_idP,
mac_len = 6;
}
nr_mac_rrc_data_ind(module_idP,
CC_id,
frameP,
0,
0,
UE->rnti,
CCCH,
pduP + mac_subheader_len,
mac_len,
0);
send_initial_ul_rrc_message(module_idP,
CC_id,
UE,
CCCH,
pduP + mac_subheader_len,
mac_len);
break;
case UL_SCH_LCID_DTCH ... (UL_SCH_LCID_DTCH + 28):
......
......@@ -502,6 +502,13 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl);
void send_initial_ul_rrc_message(module_id_t module_id,
int CC_id,
const NR_UE_info_t *UE,
rb_id_t srb_id,
const uint8_t *sdu,
sdu_size_t sdu_len);
void abort_nr_dl_harq(NR_UE_info_t* UE, int8_t harq_pid);
#endif /*__LAYER2_NR_MAC_PROTO_H__*/
......@@ -25,8 +25,22 @@
static void initial_ul_rrc_message_transfer_direct(module_id_t module_id, const f1ap_initial_ul_rrc_message_t *ul_rrc)
{
/* TODO ITTI message for NR_RRC_MAC_IND? */
AssertFatal(0 == 1, "not implemented\n");
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE);
/* copy all fields, but reallocate rrc_containers! */
f1ap_initial_ul_rrc_message_t *f1ap_msg = &F1AP_INITIAL_UL_RRC_MESSAGE(msg);
*f1ap_msg = *ul_rrc;
f1ap_msg->rrc_container = malloc(ul_rrc->rrc_container_length);
DevAssert(f1ap_msg->rrc_container);
memcpy(f1ap_msg->rrc_container, ul_rrc->rrc_container, ul_rrc->rrc_container_length);
f1ap_msg->rrc_container_length = ul_rrc->rrc_container_length;
f1ap_msg->du2cu_rrc_container = malloc(ul_rrc->du2cu_rrc_container_length);
DevAssert(f1ap_msg->du2cu_rrc_container);
memcpy(f1ap_msg->du2cu_rrc_container, ul_rrc->du2cu_rrc_container, ul_rrc->du2cu_rrc_container_length);
f1ap_msg->du2cu_rrc_container_length = ul_rrc->du2cu_rrc_container_length;
itti_send_msg_to_task(TASK_RRC_GNB, module_id, msg);
}
void mac_rrc_ul_direct_init(struct nr_mac_rrc_ul_if_s *mac_rrc)
......
......@@ -25,7 +25,22 @@
static void initial_ul_rrc_message_transfer_f1ap(module_id_t module_id, const f1ap_initial_ul_rrc_message_t *ul_rrc)
{
AssertFatal(0 == 1, "not implemented\n");
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE);
/* copy all fields, but reallocate rrc_containers! */
f1ap_initial_ul_rrc_message_t *f1ap_msg = &F1AP_INITIAL_UL_RRC_MESSAGE(msg);
*f1ap_msg = *ul_rrc;
f1ap_msg->rrc_container = malloc(ul_rrc->rrc_container_length);
DevAssert(f1ap_msg->rrc_container);
memcpy(f1ap_msg->rrc_container, ul_rrc->rrc_container, ul_rrc->rrc_container_length);
f1ap_msg->rrc_container_length = ul_rrc->rrc_container_length;
f1ap_msg->du2cu_rrc_container = malloc(ul_rrc->du2cu_rrc_container_length);
DevAssert(f1ap_msg->du2cu_rrc_container);
memcpy(f1ap_msg->du2cu_rrc_container, ul_rrc->du2cu_rrc_container, ul_rrc->du2cu_rrc_container_length);
f1ap_msg->du2cu_rrc_container_length = ul_rrc->du2cu_rrc_container_length;
itti_send_msg_to_task(TASK_DU_F1, module_id, msg);
}
void mac_rrc_ul_f1ap_init(struct nr_mac_rrc_ul_if_s *mac_rrc)
......
......@@ -228,6 +228,7 @@ void mac_top_init_gNB(ngran_node_t node_type)
RC.nrmac[i]->first_MIB = true;
pthread_mutex_init(&RC.nrmac[i]->UE_info.mutex, NULL);
uid_linear_allocator_init(&RC.nrmac[i]->UE_info.uid_allocator);
if (get_softmodem_params()->phy_test) {
RC.nrmac[i]->pre_processor_dl = nr_preprocessor_phytest;
......
......@@ -46,6 +46,7 @@
#include "targets/ARCH/COMMON/common_lib.h"
#include "COMMON/platform_constants.h"
#include "common/ran_context.h"
#include "collection/linear_alloc.h"
/* RRC */
#include "NR_BCCH-BCH-Message.h"
......@@ -694,6 +695,7 @@ typedef struct nr_mac_rrc_ul_if_s {
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
typedef struct {
rnti_t rnti;
uid_t uid; // unique ID of this UE
/// scheduling control info
nr_csi_report_t csi_report_template[MAX_CSI_REPORTCONFIG];
NR_UE_sched_ctrl_t UE_sched_ctrl;
......@@ -720,6 +722,7 @@ typedef struct {
pthread_mutex_t mutex;
NR_UE_info_t *list[MAX_MOBILES_PER_GNB+1];
bool sched_csirs;
uid_allocator_t uid_allocator;
} NR_UEs_t;
#define UE_iterator(BaSe, VaR) NR_UE_info_t ** VaR##pptr=BaSe, *VaR; while ((VaR=*(VaR##pptr++)))
......
......@@ -202,74 +202,6 @@ int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP,
return 0;
}
int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
const int UE_id,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const bool brOption) {
if (NODE_IS_DU(RC.nrrrc[module_idP]->node_type)) {
LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n",
module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
// Generate DUtoCURRCContainer
// call do_RRCSetup like full procedure and extract masterCellGroup
NR_CellGroupConfig_t cellGroupConfig;
NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon;
NR_ServingCellConfig_t *servingcellconfigdedicated = RC.nrrrc[module_idP]->configuration.scd;
memset(&cellGroupConfig,0,sizeof(cellGroupConfig));
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]);
ue_context_p->ue_id_rnti = rntiP;
ue_context_p->ue_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p);
fill_initial_cellGroupConfig(ue_context_p->local_uid,&cellGroupConfig,scc,servingcellconfigdedicated,&RC.nrrrc[module_idP]->configuration);
MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP);
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)&cellGroupConfig,
msg->du2cu_rrc_container,
F1AP_MAX_DU2CU_RRC_LENGTH);
if (enc_rval.encoded == -1) {
LOG_E(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name);
exit(-1);
}
/* do ITTI message */
msg->du2cu_rrc_container_length = (enc_rval.encoded+7)/8;
msg->crnti=rntiP;
msg->rrc_container=(uint8_t*) (msg+1); // Made extra room after the struct with itti_alloc_msg_sized()
memcpy(msg->rrc_container, sduP, sdu_lenP);
msg->rrc_container_length=sdu_lenP;
itti_send_msg_to_task(TASK_DU_F1, 0, tmp);
return 0;
}
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0);
if((srb_idP & RAB_OFFSET) == CCCH) {
LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
ctxt.brOption = brOption;
if (sdu_lenP > 0) {
nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, NULL, CC_id);
}
}
return 0;
}
void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
......
......@@ -986,8 +986,8 @@ uint8_t do_RRCReject(uint8_t Mod_id,
void fill_default_downlinkBWP(NR_BWP_Downlink_t *bwp,
int bwp_loop,
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_ServingCellConfigCommon_t *scc,
const gNB_RrcConfigurationReq *configuration) {
/// BWP common configuration
......@@ -1133,8 +1133,8 @@ void fill_default_downlinkBWP(NR_BWP_Downlink_t *bwp,
void fill_default_uplinkBWP(NR_BWP_Uplink_t *ubwp,
int bwp_loop,
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_ServingCellConfigCommon_t *scc,
const gNB_RrcConfigurationReq *configuration,
int uid) {
......@@ -1330,13 +1330,11 @@ void fill_default_uplinkBWP(NR_BWP_Uplink_t *ubwp,
}
void fill_initial_SpCellConfig(int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration) {
NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig;
NR_SpCellConfig_t *SpCellConfig,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration)
{
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
......@@ -1915,8 +1913,8 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
void fill_initial_cellGroupConfig(int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration)
{
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL;
......@@ -1970,20 +1968,21 @@ void fill_initial_cellGroupConfig(int uid,
cellGroupConfig->spCellConfig = calloc(1,sizeof(*cellGroupConfig->spCellConfig));
fill_initial_SpCellConfig(uid,cellGroupConfig,scc,servingcellconfigdedicated,configuration);
fill_initial_SpCellConfig(uid,cellGroupConfig->spCellConfig,scc,servingcellconfigdedicated,configuration);
cellGroupConfig->sCellToAddModList = NULL;
cellGroupConfig->sCellToReleaseList = NULL;
}
//------------------------------------------------------------------------------
int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t *const buffer,
const uint8_t transaction_id,
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration)
int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t *const buffer,
const uint8_t transaction_id,
const uint8_t *masterCellGroup,
int masterCellGroup_len,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration)
//------------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
......@@ -1993,7 +1992,6 @@ int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
NR_SRB_ToAddMod_t *SRB1_config = NULL;
NR_PDCP_Config_t *pdcp_Config = NULL;
NR_CellGroupConfig_t *cellGroupConfig = NULL;
char masterCellGroup_buf[3000];
AssertFatal(ue_context_pP != NULL,"ue_context_p is null\n");
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
......@@ -2036,38 +2034,14 @@ int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
ie->radioBearerConfig.securityConfig = NULL;
/****************************** masterCellGroup ******************************/
/* TODO */
if (masterCellGroup_from_DU) {
memcpy(&ie->masterCellGroup,masterCellGroup_from_DU,sizeof(*masterCellGroup_from_DU));
// decode masterCellGroup OCTET_STRING received from DU and place in ue context
uper_decode(NULL,
&asn_DEF_NR_CellGroupConfig, //might be added prefix later
(void **)&cellGroupConfig,
(uint8_t *)masterCellGroup_from_DU->buf,
masterCellGroup_from_DU->size, 0, 0);
}
else {
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_initial_cellGroupConfig(ue_context_pP->local_uid,cellGroupConfig,scc,servingcellconfigdedicated,configuration);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)cellGroupConfig,
masterCellGroup_buf,
3000);
if(enc_rval.encoded == -1) {
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) {
LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n");
return -1;
}
}
DevAssert(masterCellGroup && masterCellGroup_len > 0);
ie->masterCellGroup.buf = malloc(masterCellGroup_len);
AssertFatal(ie->masterCellGroup.buf != NULL, "could not allocate memory for masterCellGroup\n");
memcpy(ie->masterCellGroup.buf, masterCellGroup, masterCellGroup_len);
ie->masterCellGroup.size = masterCellGroup_len;
// decode masterCellGroup OCTET_STRING received from DU and place in ue context
uper_decode(NULL, &asn_DEF_NR_CellGroupConfig, (void **)&cellGroupConfig, masterCellGroup, masterCellGroup_len, 0, 0);
ue_p->masterCellGroup = cellGroupConfig;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
......
......@@ -100,15 +100,15 @@ uint8_t do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer);
void fill_initial_SpCellConfig(int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_SpCellConfig_t *SpCellConfig,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration);
void fill_initial_cellGroupConfig(int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration);
void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
......@@ -124,13 +124,14 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
uint8_t nb_bearers_to_setup,
long *priority);
int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t *const buffer,
const uint8_t transaction_id,
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration);
int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t *const buffer,
const uint8_t transaction_id,
const uint8_t *masterCellGroup,
int masterCellGroup_len,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration);
uint8_t do_NR_SecurityModeCommand(
const protocol_ctxt_t *const ctxt_pP,
......
......@@ -71,7 +71,7 @@ void rrc_coreset_config(NR_ControlResourceSet_t *coreset,
coreset->pdcch_DMRS_ScramblingID = NULL;
}
uint64_t get_ssb_bitmap(NR_ServingCellConfigCommon_t *scc) {
uint64_t get_ssb_bitmap(const NR_ServingCellConfigCommon_t *scc) {
uint64_t bitmap=0;
switch (scc->ssb_PositionsInBurst->present) {
case 1 :
......@@ -138,7 +138,7 @@ void set_csirs_periodicity(NR_NZP_CSI_RS_Resource_t *nzpcsi0, int uid, int nb_sl
}
}
void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
void config_csirs(const NR_ServingCellConfigCommon_t *servingcellconfigcommon,
NR_CSI_MeasConfig_t *csi_MeasConfig,
int uid,
int num_dl_antenna_ports,
......@@ -495,7 +495,7 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
phy_Parameters->phy_ParametersFRX_Diff->pucch_F0_2WithoutFH = NULL;
}
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc,
void nr_rrc_config_dl_tda(const NR_ServingCellConfigCommon_t *scc,
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList,
int curr_bwp) {
......@@ -716,9 +716,9 @@ void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs) {
ASN_SEQUENCE_ADD(&pucch_Config->spatialRelationInfoToAddModList->list,pucchspatial);
}
void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig,
NR_ServingCellConfigCommon_t *scc) {
static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig,
const NR_ServingCellConfigCommon_t *scc)
{
const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
int sr_slot = 1; // in FDD SR in slot 1
if(tdd)
......@@ -760,7 +760,7 @@ void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequ
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl640 = sr_slot;
}
void scheduling_request_config(NR_ServingCellConfigCommon_t *scc,
void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc,
NR_PUCCH_Config_t *pucch_Config) {
// format with <=2 bits in pucch resource set 0
......@@ -784,7 +784,7 @@ void set_dl_mcs_table(int scs,
NR_UE_NR_Capability_t *cap,
NR_SpCellConfig_t *SpCellConfig,
NR_BWP_DownlinkDedicated_t *bwp_Dedicated,
NR_ServingCellConfigCommon_t *scc) {
const NR_ServingCellConfigCommon_t *scc) {
if (cap == NULL){
bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL;
......
......@@ -111,12 +111,12 @@ typedef struct physicalcellgroup_s{
long RNTI_Value[MAX_NUM_CCs];
}physicalcellgroup_t;
uint64_t get_ssb_bitmap(NR_ServingCellConfigCommon_t *scc);
uint64_t get_ssb_bitmap(const NR_ServingCellConfigCommon_t *scc);
void rrc_coreset_config(NR_ControlResourceSet_t *coreset,
int bwp_id,
int curr_bwp,
uint64_t ssb_bitmap);
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc,
void nr_rrc_config_dl_tda(const NR_ServingCellConfigCommon_t *scc,
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList,
int curr_bwp);
void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay);
......@@ -124,9 +124,9 @@ void config_pucch_resset0(NR_PUCCH_Config_t *pucch_Config, int uid, int curr_bwp
void config_pucch_resset1(NR_PUCCH_Config_t *pucch_Config, NR_UE_NR_Capability_t *uecap);
void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time);
void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs);
void scheduling_request_config(NR_ServingCellConfigCommon_t *scc,
void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc,
NR_PUCCH_Config_t *pucch_Config);
void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
void config_csirs(const NR_ServingCellConfigCommon_t *servingcellconfigcommon,
NR_CSI_MeasConfig_t *csi_MeasConfig,
int uid,
int num_dl_antenna_ports,
......@@ -142,7 +142,7 @@ void set_dl_mcs_table(int scs,
NR_UE_NR_Capability_t *cap,
NR_SpCellConfig_t *SpCellConfig,
NR_BWP_DownlinkDedicated_t *bwp_Dedicated,
NR_ServingCellConfigCommon_t *scc);
const NR_ServingCellConfigCommon_t *scc);
void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
NR_ServingCellConfigCommon_t *scc,
int numerology,
......
......@@ -108,9 +108,9 @@ void
rrc_gNB_generate_RRCSetup(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
const int CC_id);
const uint8_t *masterCellGroup,
int masterCellGroup_len,
NR_ServingCellConfigCommon_t *scc);
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
......@@ -174,17 +174,6 @@ int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP,
const int dl_bwp_id,
const int ul_bwp_id);
int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
const int UE_id,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const bool brOption);
int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP,
protocol_ctxt_t *const ctxt_pP,
const int dl_bwp_id,
......@@ -193,8 +182,8 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
const uint8_t *buffer,
int buffer_length,
OCTET_STRING_t *du_to_cu_rrc_container,
const int CC_id);
const uint8_t *du_to_cu_rrc_container,
int du_to_cu_rrc_container_length);
void
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
......
This diff is collapsed.
......@@ -82,9 +82,9 @@ void fix_servingcellconfigdedicated(NR_ServingCellConfig_t *scd) {
void fill_default_nsa_downlinkBWP(NR_BWP_Downlink_t *bwp,
long bwp_loop,
NR_CellGroupConfig_t *secondaryCellGroup,
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_ServingCellConfigCommon_t *servingcellconfigcommon,
const NR_CellGroupConfig_t *secondaryCellGroup,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_ServingCellConfigCommon_t *servingcellconfigcommon,
const gNB_RrcConfigurationReq *configuration,
NR_UE_NR_Capability_t *uecap,
int dl_antenna_ports,
......
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