Commit b7530528 authored by Konstantinos Alexandris's avatar Konstantinos Alexandris Committed by Robert Schmidt

To be tested: Add code for measurement report based on the neighbouring cells...

To be tested: Add code for measurement report based on the neighbouring cells after x2 setup, ocs/ocn for multiple cells
parent 5dfec716
......@@ -39,6 +39,8 @@ MESSAGE_DEF(X2AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, x2ap_reg
MESSAGE_DEF(X2AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, x2ap_deregistered_enb_ind_t , x2ap_deregistered_enb_ind)
/* handover messages X2AP <-> RRC */
MESSAGE_DEF(X2AP_SETUP_REQ , MESSAGE_PRIORITY_MED, x2ap_setup_req_t , x2ap_setup_req)
MESSAGE_DEF(X2AP_SETUP_RESP , MESSAGE_PRIORITY_MED, x2ap_setup_resp_t , x2ap_setup_resp)
MESSAGE_DEF(X2AP_HANDOVER_REQ , MESSAGE_PRIORITY_MED, x2ap_handover_req_t , x2ap_handover_req)
MESSAGE_DEF(X2AP_HANDOVER_REQ_ACK , MESSAGE_PRIORITY_MED, x2ap_handover_req_ack_t , x2ap_handover_req_ack)
MESSAGE_DEF(X2AP_HANDOVER_CANCEL , MESSAGE_PRIORITY_MED, x2ap_handover_cancel_t , x2ap_handover_cancel)
......
......@@ -29,6 +29,8 @@
// Defines to access message fields.
#define X2AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_req
#define X2AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_setup_req
#define X2AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.x2ap_setup_resp
#define X2AP_HANDOVER_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_req
#define X2AP_HANDOVER_REQ_ACK(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_req_ack
#define X2AP_REGISTER_ENB_CNF(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_cnf
......@@ -41,6 +43,16 @@
// eNB application layer -> X2AP messages
typedef struct x2ap_setup_req_s {
uint32_t Nid_cell[MAX_NUM_CCs];
int num_cc;
} x2ap_setup_req_t;
typedef struct x2ap_setup_resp_s {
uint32_t Nid_cell[MAX_NUM_CCs];
int num_cc;
} x2ap_setup_resp_t;
/* X2AP UE CONTEXT RELEASE */
typedef struct x2ap_ue_context_release_s {
/* used for X2AP->RRC in source and RRC->X2AP in target */
......
......@@ -1586,15 +1586,15 @@ long flexran_get_rrc_ocp(mid_t mod_id, rnti_t rnti) {
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
if (!ue_context_p) return -1;
if (!ue_context_p->ue_context.measurement_info) return -1;
return ue_context_p->ue_context.measurement_info->cellIndividualOffset;
return ue_context_p->ue_context.measurement_info->cellIndividualOffset[0];
}
long flexran_get_rrc_ocn(mid_t mod_id, rnti_t rnti) {
long flexran_get_rrc_ocn(mid_t mod_id, rnti_t rnti, long cell_id) {
if (!rrc_is_present(mod_id)) return -1;
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
if (!ue_context_p) return -1;
if (!ue_context_p->ue_context.measurement_info) return -1;
return ue_context_p->ue_context.measurement_info->cellIndividualOffset;
return ue_context_p->ue_context.measurement_info->cellIndividualOffset[cell_id+1];
}
/* Periodic event */
......
......@@ -550,7 +550,7 @@ long flexran_get_rrc_ofn(mid_t mod_id, rnti_t rnti);
long flexran_get_rrc_ocp(mid_t mod_id, rnti_t rnti);
/* Get ocn offset */
long flexran_get_rrc_ocn(mid_t mod_id, rnti_t rnti);
long flexran_get_rrc_ocn(mid_t mod_id, rnti_t rnti, long cell_id);
/* Get Periodic Event max reported cells */
long flexran_get_rrc_per_event_maxReportCells(mid_t mod_id, rnti_t rnti);
......
......@@ -61,6 +61,8 @@
#define MAX_PAYLOAD 1024 /* maximum payload size*/
#define MAX_NUM_NEIGH_CELLs 6 /* maximum neighbouring cells number */
#define UE_STATE_NOTIFICATION_INTERVAL 50
#define IPV4_ADDR "%u.%u.%u.%u"
......@@ -537,7 +539,7 @@ typedef struct MEASUREMENT_INFO_s {
//TODO: Extend to multiple meas objects for OFP/OFN offsets
long offsetFreq;
//TODO: extend to multiple cells for OCP/OCN offsets
long cellIndividualOffset;
long cellIndividualOffset[MAX_NUM_NEIGH_CELLs+1];
EVENTS_t *events;
} MEASUREMENT_INFO;
......@@ -822,6 +824,11 @@ typedef struct eNB_RRC_INST_s {
/// NR cell id
uint64_t nr_cellid;
// Neighborouring cells id
int num_neigh_cells;
int num_neigh_cells_cc[MAX_NUM_CCs];
uint32_t neigh_cells_id[MAX_NUM_NEIGH_CELLs][MAX_NUM_CCs];
// other RAN parameters
int srb1_timer_poll_retransmit;
int srb1_poll_pdu;
......
......@@ -2942,8 +2942,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
LTE_RSRP_Range_t *rsrp = NULL;
struct LTE_MeasConfig__speedStatePars *Sparams = NULL;
LTE_QuantityConfig_t *quantityConfig = NULL;
struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList
*dedicatedInfoNASList = NULL;
LTE_CellsToAddMod_t *CellToAdd = NULL;
LTE_CellsToAddModList_t *CellsToAddModList = NULL;
struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL;
/* For no gcc warnings */
......@@ -3306,20 +3307,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB
// MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
// (LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
// CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
//
// // Add adjacent cell lists (6 per eNB)
// for (i = 0; i < 6; i++) {
// CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
// CellToAdd->cellIndex = i + 1;
// CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
// CellToAdd->cellIndividualOffset = LTE_Q_OffsetRange_dB0;
// ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
// }
ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
// LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
(LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
if (!ue_context_pP->ue_context.measurement_info) {
ue_context_pP->ue_context.measurement_info = CALLOC(1,sizeof(*(ue_context_pP->ue_context.measurement_info)));
......@@ -3327,7 +3317,20 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
//TODO: Assign proper values
ue_context_pP->ue_context.measurement_info->offsetFreq = 0;
ue_context_pP->ue_context.measurement_info->cellIndividualOffset = LTE_Q_OffsetRange_dB0;
ue_context_pP->ue_context.measurement_info->cellIndividualOffset[0] = 0;
/* TODO: Extend to multiple carriers */
// Add adjacent cell lists (max 6 per eNB)
for (i = 0; i < RC.rrc[ctxt_pP->module_id]->num_neigh_cells; i++) {
CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
CellToAdd->cellIndex = i + 1;
CellToAdd->physCellId = RC.rrc[ctxt_pP->module_id]->neigh_cells_id[i][0];//get_adjacent_cell_id(ctxt_pP->module_id, i);
CellToAdd->cellIndividualOffset = LTE_Q_OffsetRange_dB0;
ue_context_pP->ue_context.measurement_info->cellIndividualOffset[i+1] = CellToAdd->cellIndividualOffset;
ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
}
ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
// LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
if (!ue_context_pP->ue_context.measurement_info->events) {
ue_context_pP->ue_context.measurement_info->events = CALLOC(1,sizeof(*(ue_context_pP->ue_context.measurement_info->events)));
......@@ -4398,6 +4401,50 @@ rrc_eNB_generate_HandoverPreparationInformation(
*_size = ho_size;
}
void rrc_eNB_process_x2_setup_request(int mod_id, x2ap_setup_req_t *m) {
RC.rrc[mod_id]->num_neigh_cells ++;
if (RC.rrc[mod_id]->num_neigh_cells > MAX_NUM_NEIGH_CELLs) {
LOG_E(RRC, "Error: number of neighbouring cells is exceeded \n");
return;
}
if (m->num_cc > MAX_NUM_CCs) {
LOG_E(RRC, "Error: number of neighbouring cells carriers is exceeded \n");
return;
}
RC.rrc[mod_id]->num_neigh_cells_cc[RC.rrc[mod_id]->num_neigh_cells-1] = m->num_cc;
for (int i=0; i<m->num_cc; i++) {
RC.rrc[mod_id]->neigh_cells_id[RC.rrc[mod_id]->num_neigh_cells-1][i] = m->Nid_cell[i];
}
}
void rrc_eNB_process_x2_setup_response(int mod_id, x2ap_setup_resp_t *m) {
RC.rrc[mod_id]->num_neigh_cells ++;
if (RC.rrc[mod_id]->num_neigh_cells > MAX_NUM_NEIGH_CELLs) {
LOG_E(RRC, "Error: number of neighbouring cells is exceeded \n");
return;
}
if (m->num_cc > MAX_NUM_CCs) {
LOG_E(RRC, "Error: number of neighbouring cells carriers is exceeded \n");
return;
}
RC.rrc[mod_id]->num_neigh_cells_cc[RC.rrc[mod_id]->num_neigh_cells-1] = m->num_cc;
for (int i=0; i<m->num_cc; i++) {
RC.rrc[mod_id]->neigh_cells_id[RC.rrc[mod_id]->num_neigh_cells-1][i] = m->Nid_cell[i];
}
}
void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_req_t *m) {
struct rrc_eNB_ue_context_s *ue_context_target_p = NULL;
/* TODO: get proper UE rnti */
......@@ -4705,8 +4752,8 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
LTE_QuantityConfig_t *quantityConfig = NULL;
LTE_MobilityControlInfo_t *mobilityInfo = NULL;
LTE_SecurityConfigHO_t *securityConfigHO = NULL;
//CellsToAddMod_t *CellToAdd = NULL;
//CellsToAddModList_t *CellsToAddModList = NULL;
LTE_CellsToAddMod_t *CellToAdd = NULL;
LTE_CellsToAddModList_t *CellsToAddModList = NULL;
struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL;
/* for no gcc warnings */
......@@ -5297,7 +5344,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
MeasId5->measObjectId = 1;
MeasId5->reportConfigId = 6;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
// rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
// LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
// Add one EUTRA Measurement Object
MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
......@@ -5317,19 +5364,9 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB
//MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
//(CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
//CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
// Add adjacent cell lists (6 per eNB)
//for (i = 0; i < 6; i++) {
//CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
//CellToAdd->cellIndex = 1;//i + 1;
//CellToAdd->physCellId = 1;//get_adjacent_cell_id(ctxt_pP->module_id, i);
//CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
//ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
//}
ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
// rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
(LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
if (!ue_context_pP->ue_context.measurement_info) {
ue_context_pP->ue_context.measurement_info = CALLOC(1,sizeof(*(ue_context_pP->ue_context.measurement_info)));
......@@ -5337,7 +5374,20 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
//TODO: Assign proper values
ue_context_pP->ue_context.measurement_info->offsetFreq = 0;
ue_context_pP->ue_context.measurement_info->cellIndividualOffset = LTE_Q_OffsetRange_dB0;
ue_context_pP->ue_context.measurement_info->cellIndividualOffset[0] = 0;
/* TODO: Extend to multiple carriers */
// Add adjacent cell lists (max 6 per eNB)
for (i = 0; i < RC.rrc[ctxt_pP->module_id]->num_neigh_cells; i++) {
CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
CellToAdd->cellIndex = i + 1;
CellToAdd->physCellId = RC.rrc[ctxt_pP->module_id]->neigh_cells_id[i][0];//get_adjacent_cell_id(ctxt_pP->module_id, i);
CellToAdd->cellIndividualOffset = LTE_Q_OffsetRange_dB0;
ue_context_pP->ue_context.measurement_info->cellIndividualOffset[i+1] = CellToAdd->cellIndividualOffset;
ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
}
ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
// LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
if (!ue_context_pP->ue_context.measurement_info->events) {
ue_context_pP->ue_context.measurement_info->events = CALLOC(1,sizeof(*(ue_context_pP->ue_context.measurement_info->events)));
......@@ -8291,6 +8341,14 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK(msg_p, msg_name_p, instance);
break;
case X2AP_SETUP_REQ:
rrc_eNB_process_x2_setup_request(instance, &X2AP_SETUP_REQ(msg_p));
break;
case X2AP_SETUP_RESP:
rrc_eNB_process_x2_setup_response(instance, &X2AP_SETUP_RESP(msg_p));
break;
case X2AP_HANDOVER_REQ:
LOG_I(RRC, "[eNB %d] target eNB Receives X2 HO Req %s\n", instance, msg_name_p);
rrc_eNB_process_handoverPreparationInformation(instance, &X2AP_HANDOVER_REQ(msg_p));
......
......@@ -357,6 +357,9 @@ void *rrc_enb_task(void *args_p);
\param void *args_p Pointer on arguments to start the task. */
void *rrc_ue_task(void *args_p);
void rrc_eNB_process_x2_setup_request(int mod_id, x2ap_setup_req_t *m);
void rrc_eNB_process_x2_setup_response(int mod_id, x2ap_setup_resp_t *m);
void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_req_t *m);
......
......@@ -291,6 +291,7 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *x2ap_eNB_data;
MessageDef *msg;
uint32_t eNB_id = 0;
DevAssert (pdu != NULL);
......@@ -391,17 +392,25 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1;
}
msg = itti_alloc_new_message(TASK_X2AP, X2AP_SETUP_REQ);
X2AP_SETUP_REQ(msg).num_cc = ie->value.choice.ServedCells.list.count;
if (ie->value.choice.ServedCells.list.count > 0) {
x2ap_eNB_data->num_cc = ie->value.choice.ServedCells.list.count;
for (int i=0; i<ie->value.choice.ServedCells.list.count;i++) {
servedCellMember = (ServedCells__Member *)ie->value.choice.ServedCells.list.array[i];
x2ap_eNB_data->Nid_cell[i] = servedCellMember->servedCellInfo.pCI;
X2AP_SETUP_REQ(msg).Nid_cell[i] = x2ap_eNB_data->Nid_cell[i];
}
}
instance_p = x2ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data);
}
......@@ -418,6 +427,7 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance,
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *x2ap_eNB_data;
MessageDef *msg;
uint32_t eNB_id = 0;
DevAssert (pdu != NULL);
......@@ -500,11 +510,16 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance,
return -1;
}
msg = itti_alloc_new_message(TASK_X2AP, X2AP_SETUP_RESP);
X2AP_SETUP_RESP(msg).num_cc = ie->value.choice.ServedCells.list.count;
if (ie->value.choice.ServedCells.list.count > 0) {
x2ap_eNB_data->num_cc = ie->value.choice.ServedCells.list.count;
for (int i=0; i<ie->value.choice.ServedCells.list.count;i++) {
servedCellMember = (ServedCells__Member *)ie->value.choice.ServedCells.list.array[i];
x2ap_eNB_data->Nid_cell[i] = servedCellMember->servedCellInfo.pCI;
X2AP_SETUP_RESP(msg).Nid_cell[i] = x2ap_eNB_data->Nid_cell[i];
}
}
......@@ -521,6 +536,8 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance,
instance_p->x2_target_enb_associated_nb ++;
x2ap_handle_x2_setup_message(instance_p, x2ap_eNB_data, 0);
itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
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