Commit 181481c9 authored by hscuser's avatar hscuser Committed by jperaldi

Helper function and changes to structure

parent 3fa8ff7d
......@@ -2085,6 +2085,7 @@ set(SS_SRC
${OPENAIR3_DIR}/SS/ss_gNB_srb_task.c
${OPENAIR3_DIR}/SS/ss_gNB_port_man_task.c
${OPENAIR3_DIR}/SS/ss_gNB_sys_task.c
${OPENAIR3_DIR}/SS/ss_eNB_multicell_helper.c
)
file(GLOB ss_sidl ${SIDL_CMPLR}/src/*.c)
file(GLOB ss_acp ${SIDL_DIR}/acp/src/*.c)
......
......@@ -57,6 +57,7 @@ typedef struct SSCellConfigContext_s{
uint16_t curr_attn;
uint16_t cellId;
int16_t maxRefPower;
bool cell_configured_flag;
//TO DO: Need to remove one of the following cellId
EUTRA_CellId_Type ttcn_cell_id;
uint16_t eutra_cellId;
......
/*
* 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
*/
#include <pthread.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
#include "assertions.h"
#include "common/utils/system.h"
#include "queue.h"
#include "sctp_common.h"
#include "intertask_interface.h"
#include "common/ran_context.h"
#include "ss_eNB_context.h"
#include "ss_eNB_multicell_helper.h"
int set_cell_index(uint16_t cell_id, SSCellConfigContext_t SSCell_list[]){
for(int i = 0; i < 8; i++){
if(SSCell_list[i].cell_configured_flag == false){
SSCell_list[i].cellId = cell_id;
SSCell_list[i].cell_configured_flag = true;
return i;
}
else if(SSCell_list[i].cell_configured_flag == true){
if(SSCell_list[i].cellId == cell_id) return i;
}
}
return -1;
}
/*
* 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 MULTICELL_HELPER_H
#define MULTICELL_HELPER_H
#include "ss_eNB_context.h"
int set_cell_index(uint16_t, SSCellConfigContext_t[]);
#endif
......@@ -52,6 +52,7 @@
#include "acpSys.h"
#include "ss_eNB_sys_task.h"
#include "ss_eNB_context.h"
#include "ss_eNB_multicell_helper.h"
#include "udp_eNB_task.h"
#include "ss_eNB_proxy_iface.h"
......@@ -274,7 +275,7 @@ static void ss_task_sys_handle_timing_info(ss_set_timinfo_t *tinfo)
* corrected. Does not impact TC_6_1_2_2.
*
*/
int sys_add_reconfig_cell(struct CellConfigInfo_Type *AddOrReconfigure)
int sys_add_reconfig_cell(struct CellConfigInfo_Type *AddOrReconfigure, int obtained_cell_index)
{
CellConfigReq_t *cellConfig;
......@@ -314,7 +315,7 @@ int sys_add_reconfig_cell(struct CellConfigInfo_Type *AddOrReconfigure)
int band = AddOrReconfigure->Basic.v.StaticCellInfo.v.Common.EutraBand;
RRC_CONFIGURATION_REQ(msg_p).eutra_band[num_CC] = band;
RRC_CONFIGURATION_REQ(msg_p).Nid_cell[num_CC] = AddOrReconfigure->Basic.v.StaticCellInfo.v.Common.PhysicalCellId;
SS_context.SSCell_list[0].cellId = AddOrReconfigure->Basic.v.StaticCellInfo.v.Common.PhysicalCellId;
SS_context.SSCell_list[obtained_cell_index].cellId = AddOrReconfigure->Basic.v.StaticCellInfo.v.Common.PhysicalCellId;
/** TODO: Not filled now */
/** eNB Cell ID: AddOrReconfigure->Basic.v.StaticCellInfo.v.Common.eNB_CellId.v */
......@@ -328,12 +329,12 @@ int sys_add_reconfig_cell(struct CellConfigInfo_Type *AddOrReconfigure)
uint32_t ul_Freq = from_earfcn(band, AddOrReconfigure->Basic.v.StaticCellInfo.v.Uplink.v.Earfcn);
int ul_Freq_off = ul_Freq - dl_Freq;
RRC_CONFIGURATION_REQ(msg_p).uplink_frequency_offset[num_CC] = (unsigned int)ul_Freq_off;
SS_context.SSCell_list[0].ul_earfcn = AddOrReconfigure->Basic.v.StaticCellInfo.v.Uplink.v.Earfcn;
SS_context.SSCell_list[0].ul_freq = ul_Freq;
SS_context.SSCell_list[obtained_cell_index].ul_earfcn = AddOrReconfigure->Basic.v.StaticCellInfo.v.Uplink.v.Earfcn;
SS_context.SSCell_list[obtained_cell_index].ul_freq = ul_Freq;
}
// Updated the SS context for the frequency related configuration
SS_context.SSCell_list[0].dl_earfcn = AddOrReconfigure->Basic.v.StaticCellInfo.v.Downlink.Earfcn;
SS_context.SSCell_list[0].dl_freq = dl_Freq;
SS_context.SSCell_list[obtained_cell_index].dl_earfcn = AddOrReconfigure->Basic.v.StaticCellInfo.v.Downlink.Earfcn;
SS_context.SSCell_list[obtained_cell_index].dl_freq = dl_Freq;
switch (AddOrReconfigure->Basic.v.StaticCellInfo.v.Downlink.Bandwidth)
{
......@@ -496,7 +497,7 @@ int sys_add_reconfig_cell(struct CellConfigInfo_Type *AddOrReconfigure)
else
{
RRC_CONFIGURATION_REQ(msg_p).RlcPduCCCH_Present = false;
if(SS_context.SSCell_list[0].State == SS_STATE_NOT_CONFIGURED)
if(SS_context.SSCell_list[obtained_cell_index].State == SS_STATE_NOT_CONFIGURED)
RC.ss.CBRA_flag = TRUE;
}
}
......@@ -517,7 +518,7 @@ int sys_add_reconfig_cell(struct CellConfigInfo_Type *AddOrReconfigure)
/** Handle Initial Cell power, Sending to Proxy */
if (AddOrReconfigure->Basic.v.InitialCellPower.d == true)
{
SS_context.SSCell_list[0].maxRefPower = AddOrReconfigure->Basic.v.InitialCellPower.v.MaxReferencePower;
SS_context.SSCell_list[obtained_cell_index].maxRefPower = AddOrReconfigure->Basic.v.InitialCellPower.v.MaxReferencePower;
switch (AddOrReconfigure->Basic.v.InitialCellPower.v.Attenuation.d)
{
case Attenuation_Type_Value:
......@@ -645,20 +646,19 @@ static void send_sys_cnf(enum ConfirmationResult_Type_Sel resType,
* newState: The next state for the SYS State machine
*
*/
int sys_handle_cell_config_req(struct CellConfigRequest_Type *Cell)
int sys_handle_cell_config_req(struct CellConfigRequest_Type *Cell, int obtained_cell_index)
{
int status = false;
int returnState = SS_context.SSCell_list[0].State;
int returnState = SS_context.SSCell_list[obtained_cell_index].State;
enum SystemConfirm_Type_Sel cnfType = SystemConfirm_Type_Cell;
enum ConfirmationResult_Type_Sel resType = ConfirmationResult_Type_Success;
bool resVal = TRUE;
switch (Cell->d)
{
case CellConfigRequest_Type_AddOrReconfigure:
LOG_A(ENB_SS, "[SYS] CellConfigRequest_Type_AddOrReconfigure receivied\n");
status = sys_add_reconfig_cell(&(Cell->v.AddOrReconfigure));
status = sys_add_reconfig_cell(&(Cell->v.AddOrReconfigure), obtained_cell_index);
if (status)
{
/** TODO Signal to main thread */
......@@ -666,7 +666,7 @@ int sys_handle_cell_config_req(struct CellConfigRequest_Type *Cell)
cell_config_done_indication();
}
//TODO Change it later to move to cell configuration
if ( SS_context.SSCell_list[0].State == SS_STATE_NOT_CONFIGURED)
if ( SS_context.SSCell_list[obtained_cell_index].State == SS_STATE_NOT_CONFIGURED)
{
returnState = SS_STATE_CELL_CONFIGURED;
}
......@@ -1637,25 +1637,28 @@ static void sys_handle_as_security_req(struct AS_Security_Type *ASSecurity)
*/
static void ss_task_sys_handle_req(struct SYSTEM_CTRL_REQ *req, ss_set_timinfo_t *tinfo)
{
int enterState = SS_context.SSCell_list[0].State;
int exitState = SS_context.SSCell_list[0].State;
if(req->Common.CellId)
SS_context.SSCell_list[0].eutra_cellId = req->Common.CellId;
int obtained_cell_index;
if(req->Common.CellId){
obtained_cell_index = set_cell_index(req->Common.CellId, SS_context.SSCell_list);
SS_context.SSCell_list[obtained_cell_index].eutra_cellId = req->Common.CellId;
}
int enterState = SS_context.SSCell_list[obtained_cell_index].State;
int exitState = SS_context.SSCell_list[obtained_cell_index].State;
LOG_A(ENB_SS, "[SYS] Current SS_STATE %d received SystemRequest_Type %d eutra_cellId %d cnf_flag %d\n",
SS_context.SSCell_list[0].State, req->Request.d, SS_context.SSCell_list[0].eutra_cellId, req->Common.ControlInfo.CnfFlag);
switch (SS_context.SSCell_list[0].State)
SS_context.SSCell_list[obtained_cell_index].State, req->Request.d, SS_context.SSCell_list[obtained_cell_index].eutra_cellId, req->Common.ControlInfo.CnfFlag);
switch (SS_context.SSCell_list[obtained_cell_index].State)
{
case SS_STATE_NOT_CONFIGURED:
if (req->Request.d == SystemRequest_Type_Cell)
{
LOG_A(ENB_SS, "[SYS] SystemRequest_Type_Cell received\n");
exitState = sys_handle_cell_config_req(&(req->Request.v.Cell));
SS_context.SSCell_list[0].State = exitState;
exitState = sys_handle_cell_config_req(&(req->Request.v.Cell), obtained_cell_index);
SS_context.SSCell_list[obtained_cell_index].State = exitState;
}
else
{
LOG_A(ENB_SS, "[SYS] Error ! SS_STATE %d Invalid SystemRequest_Type %d received\n",
SS_context.SSCell_list[0].State, req->Request.d);
SS_context.SSCell_list[obtained_cell_index].State, req->Request.d);
}
break;
case SS_STATE_CELL_CONFIGURED:
......@@ -1663,12 +1666,12 @@ static void ss_task_sys_handle_req(struct SYSTEM_CTRL_REQ *req, ss_set_timinfo_t
{
LOG_A(ENB_SS, "[SYS] SystemRequest_Type_RadioBearerList received\n");
exitState = sys_handle_radiobearer_list(&(req->Request.v.RadioBearerList));
SS_context.SSCell_list[0].State = exitState;
SS_context.SSCell_list[obtained_cell_index].State = exitState;
}
else
{
LOG_A(ENB_SS, "[SYS] Error ! SS_STATE %d Invalid SystemRequest_Type %d received\n",
SS_context.SSCell_list[0].State, req->Request.d);
SS_context.SSCell_list[obtained_cell_index].State, req->Request.d);
}
break;
case SS_STATE_CELL_BROADCASTING:
......@@ -1679,8 +1682,8 @@ static void ss_task_sys_handle_req(struct SYSTEM_CTRL_REQ *req, ss_set_timinfo_t
{
case SystemRequest_Type_Cell:
LOG_A(ENB_SS, "[SYS] SystemRequest_Type_Cell received\n");
exitState = sys_handle_cell_config_req(&(req->Request.v.Cell));
SS_context.SSCell_list[0].State = exitState;
exitState = sys_handle_cell_config_req(&(req->Request.v.Cell), obtained_cell_index);
SS_context.SSCell_list[obtained_cell_index].State = exitState;
break;
case SystemRequest_Type_RadioBearerList:
LOG_A(ENB_SS, "[SYS] SystemRequest_Type_RadioBearerList received in SS_STATE_CELL_ACTIVE state\n");
......
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