Commit ee04e470 authored by Anton Kozhemiachenko's avatar Anton Kozhemiachenko Committed by Jerome PERALDI

bug#123699 (issue#108): NR TC_7.1.2.2.1 - DRB support

parent 08c12e1c
...@@ -225,7 +225,8 @@ SSConfig = ( ...@@ -225,7 +225,8 @@ SSConfig = (
Srb_port = 7778; #Port Number for System Simulator Srb Port Srb_port = 7778; #Port Number for System Simulator Srb Port
Vng_port = 7779; #Port Number for System Simulator VNG Port Vng_port = 7779; #Port Number for System Simulator VNG Port
Vtp_port = 7780; #Port Number for System Simulator VTP Port Vtp_port = 7780; #Port Number for System Simulator VTP Port
SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test Drb_port = 7781; #Port Number for System Simulator DRB Port
SSMode = 2; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
} }
); );
......
...@@ -124,7 +124,7 @@ if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h") ...@@ -124,7 +124,7 @@ if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h")
if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7 if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7
list(APPEND ATLAS_LIBRARIES tatlas) list(APPEND ATLAS_LIBRARIES tatlas)
else() elseif(EXISTS "/usr/lib/libatlas.so" OR EXISTS "/usr/lib64/libatlas.so" OR EXISTS "/usr/lib/atlas/libatlas.so" OR EXISTS "/usr/lib64/atlas/libatlas.so" OR EXISTS "/usr/lib/x86_64-linux-gnu/libatlas.so")
list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu
endif() endif()
...@@ -2093,6 +2093,7 @@ set(SS_SRC ...@@ -2093,6 +2093,7 @@ set(SS_SRC
${OPENAIR3_DIR}/SS/ss_gNB_port_man_task.c ${OPENAIR3_DIR}/SS/ss_gNB_port_man_task.c
${OPENAIR3_DIR}/SS/ss_gNB_sys_task.c ${OPENAIR3_DIR}/SS/ss_gNB_sys_task.c
${OPENAIR3_DIR}/SS/ss_gNB_vtp_task.c ${OPENAIR3_DIR}/SS/ss_gNB_vtp_task.c
${OPENAIR3_DIR}/SS/ss_gNB_drb_task.c
) )
file(GLOB ss_sidl ${SIDL_CMPLR}/src/*.c) file(GLOB ss_sidl ${SIDL_CMPLR}/src/*.c)
file(GLOB ss_acp ${SIDL_DIR}/acp/src/*.c) file(GLOB ss_acp ${SIDL_DIR}/acp/src/*.c)
...@@ -2351,6 +2352,9 @@ set(libnrnas_emm_msg_OBJS ...@@ -2351,6 +2352,9 @@ set(libnrnas_emm_msg_OBJS
${NAS_SRC}COMMON/EMM/MSG/FGSNASSecurityModeComplete.c ${NAS_SRC}COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
${NAS_SRC}COMMON/EMM/MSG/RegistrationComplete.c ${NAS_SRC}COMMON/EMM/MSG/RegistrationComplete.c
${NAS_SRC}COMMON/EMM/MSG/FGSUplinkNasTransport.c ${NAS_SRC}COMMON/EMM/MSG/FGSUplinkNasTransport.c
${NAS_SRC}COMMON/EMM/MSG/FGSServiceRequest.c
${NAS_SRC}COMMON/EMM/MSG/ActivateTestModeComplete.c
${NAS_SRC}COMMON/EMM/MSG/CloseUeTestLoopComplete.c
${NAS_SRC}COMMON/ESM/MSG/PduSessionEstablishRequest.c ${NAS_SRC}COMMON/ESM/MSG/PduSessionEstablishRequest.c
) )
......
...@@ -84,6 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -84,6 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "ss_gNB_port_man_task.h" #include "ss_gNB_port_man_task.h"
#include "ss_gNB_srb_task.h" #include "ss_gNB_srb_task.h"
#include "udp_eNB_task.h" #include "udp_eNB_task.h"
#include "ss_gNB_drb_task.h"
#include "ss_gNB_vtp_task.h" #include "ss_gNB_vtp_task.h"
...@@ -386,6 +387,11 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -386,6 +387,11 @@ int create_gNB_tasks(uint32_t gnb_nb) {
} }
if(itti_create_task(TASK_SS_DRB, ss_gNB_drb_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SS DRB failed\n");
return -1;
}
if(itti_create_task(TASK_VTP, ss_gNB_vtp_task, NULL) < 0) { if(itti_create_task(TASK_VTP, ss_gNB_vtp_task, NULL) < 0) {
LOG_E(SCTP, "Create task for TASK_VTP failed\n"); LOG_E(SCTP, "Create task for TASK_VTP failed\n");
return -1; return -1;
......
...@@ -732,6 +732,7 @@ void RCconfig_nr_ssparam(void) { ...@@ -732,6 +732,7 @@ void RCconfig_nr_ssparam(void) {
RC.ss.Srbport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SRBPORT_IDX].iptr); RC.ss.Srbport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SRBPORT_IDX].iptr);
RC.ss.Vngport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VNGPORT_IDX].iptr); RC.ss.Vngport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VNGPORT_IDX].iptr);
RC.ss.Vtpport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VTPPORT_IDX].iptr); RC.ss.Vtpport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VTPPORT_IDX].iptr);
RC.ss.Drbport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_DRBPORT_IDX].iptr);
RC.ss.mode = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_MODE_IDX].iptr); RC.ss.mode = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_MODE_IDX].iptr);
RC.ss.SysportNR = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SYSPORT_IDX].iptr); RC.ss.SysportNR = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SYSPORT_IDX].iptr);
} }
......
...@@ -238,6 +238,7 @@ typedef enum { ...@@ -238,6 +238,7 @@ typedef enum {
#define GNB_CONFIG_SS_SRBPORT "Srb_port" #define GNB_CONFIG_SS_SRBPORT "Srb_port"
#define GNB_CONFIG_SS_VNGPORT "Vng_port" #define GNB_CONFIG_SS_VNGPORT "Vng_port"
#define GNB_CONFIG_SS_VTPPORT "Vtp_port" #define GNB_CONFIG_SS_VTPPORT "Vtp_port"
#define GNB_CONFIG_SS_DRBPORT "Drb_port"
#define GNB_CONFIG_SS_MODE "SSMode" #define GNB_CONFIG_SS_MODE "SSMode"
#define GNB_CONFIG_SS_HOSTIP_IDX 0 #define GNB_CONFIG_SS_HOSTIP_IDX 0
...@@ -245,7 +246,8 @@ typedef enum { ...@@ -245,7 +246,8 @@ typedef enum {
#define GNB_CONFIG_SS_SRBPORT_IDX 2 #define GNB_CONFIG_SS_SRBPORT_IDX 2
#define GNB_CONFIG_SS_VNGPORT_IDX 3 #define GNB_CONFIG_SS_VNGPORT_IDX 3
#define GNB_CONFIG_SS_VTPPORT_IDX 4 #define GNB_CONFIG_SS_VTPPORT_IDX 4
#define GNB_CONFIG_SS_MODE_IDX 5 #define GNB_CONFIG_SS_DRBPORT_IDX 5
#define GNB_CONFIG_SS_MODE_IDX 6
#define GNB_SSPARAMS_DESC { \ #define GNB_SSPARAMS_DESC { \
{GNB_CONFIG_SS_HOSTIP , NULL, 0, uptr:NULL, defstrval:"0.0.0.0", TYPE_STRING, 0}, \ {GNB_CONFIG_SS_HOSTIP , NULL, 0, uptr:NULL, defstrval:"0.0.0.0", TYPE_STRING, 0}, \
...@@ -253,6 +255,7 @@ typedef enum { ...@@ -253,6 +255,7 @@ typedef enum {
{GNB_CONFIG_SS_SRBPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \ {GNB_CONFIG_SS_SRBPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_VNGPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \ {GNB_CONFIG_SS_VNGPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_VTPPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \ {GNB_CONFIG_SS_VTPPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_DRBPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_MODE , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \ {GNB_CONFIG_SS_MODE , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
} }
......
...@@ -577,7 +577,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -577,7 +577,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
NR_BWP_UplinkDedicated_t *ibwp; NR_BWP_UplinkDedicated_t *ibwp;
int scs,abwp_start,abwp_size,startSymbolAndLength,mappingtype; int scs,abwp_start,abwp_size,startSymbolAndLength,mappingtype;
NR_PUSCH_Config_t *pusch_Config=NULL; NR_PUSCH_Config_t *pusch_Config=NULL;
if (mac->cg && ubwp &&
if (mac->cg &&
mac->cg->spCellConfig && mac->cg->spCellConfig &&
mac->cg->spCellConfig->spCellConfigDedicated && mac->cg->spCellConfig->spCellConfigDedicated &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
...@@ -585,6 +586,14 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -585,6 +586,14 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
ibwp = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; ibwp = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
pusch_Config = ibwp->pusch_Config->choice.setup; pusch_Config = ibwp->pusch_Config->choice.setup;
}
if (mac->cg && ubwp &&
mac->cg->spCellConfig &&
mac->cg->spCellConfig->spCellConfigDedicated &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) {
startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength; startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength;
mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType; mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType;
......
...@@ -409,6 +409,9 @@ int nr_process_mac_pdu(module_id_t module_idP, ...@@ -409,6 +409,9 @@ int nr_process_mac_pdu(module_id_t module_idP,
mac_subheader_len = 2; mac_subheader_len = 2;
} }
if (pdu_len < mac_subheader_len + mac_ce_len + mac_sdu_len)
return 0;
rnti_t crnti = UE_info->rnti[UE_id]; rnti_t crnti = UE_info->rnti[UE_id];
int UE_idx = UE_id; int UE_idx = UE_id;
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
...@@ -470,6 +473,9 @@ int nr_process_mac_pdu(module_id_t module_idP, ...@@ -470,6 +473,9 @@ int nr_process_mac_pdu(module_id_t module_idP,
mac_sdu_len = 6; mac_sdu_len = 6;
} }
if (pdu_len < mac_subheader_len + mac_ce_len + mac_sdu_len)
return 0;
nr_mac_rrc_data_ind(module_idP, nr_mac_rrc_data_ind(module_idP,
CC_id, CC_id,
frameP, frameP,
......
...@@ -399,6 +399,30 @@ tbs_size_t mac_rlc_data_req (const module_id_t, const rnti_t, con ...@@ -399,6 +399,30 @@ tbs_size_t mac_rlc_data_req (const module_id_t, const rnti_t, con
,const uint32_t sourceL2Id ,const uint32_t sourceL2Id
,const uint32_t destinationL2Id ,const uint32_t destinationL2Id
); );
/*! \fn rlc_op_status_t enqueue_mac_rlc_data_req (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sduP)
* \brief Interface with higher layers, map request to the RLC corresponding to the radio bearer.
* \param[in] ctxtP Running context.
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
* \param[in] rb_idP Radio bearer identifier.
* \param[in] muiP Message Unit identifier.
* \param[in] confirmP Boolean, is confirmation requested.
* \param[in] sdu_sizeP Size of SDU in bytes.
* \param[in] sduP SDU.
* \return A status about the processing, OK or error code.
*/
rlc_op_status_t enqueue_mac_rlc_data_req (
const protocol_ctxt_t *const,
const srb_flag_t,
const MBMS_flag_t,
const rb_id_t,
const mui_t,
const confirm_t,
const sdu_size_t,
mem_block_t *const,
const uint32_t *const,
const uint32_t *const
);
/*! \fn void mac_rlc_data_ind (const module_id_t mod_idP, const rnti_t rntiP, const frame_t frameP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, uint32_t frameP, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs) /*! \fn void mac_rlc_data_ind (const module_id_t mod_idP, const rnti_t rntiP, const frame_t frameP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, uint32_t frameP, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs)
* \brief Interface with MAC layer, deserialize the transport blocks sent by MAC, then map data indication to the RLC instance corresponding to the radio bearer identifier. * \brief Interface with MAC layer, deserialize the transport blocks sent by MAC, then map data indication to the RLC instance corresponding to the radio bearer identifier.
......
...@@ -1031,7 +1031,7 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -1031,7 +1031,7 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
exit(1); exit(1);
} }
if (drb_id != 1) { if (drb_id != 1 && drb_id != 2) {
LOG_E(PDCP, "%s:%d:%s: fatal, bad drb id %d\n", LOG_E(PDCP, "%s:%d:%s: fatal, bad drb id %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id); __FILE__, __LINE__, __FUNCTION__, drb_id);
exit(1); exit(1);
...@@ -1065,6 +1065,10 @@ static void add_drb(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -1065,6 +1065,10 @@ static void add_drb(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
unsigned char *ciphering_key, unsigned char *ciphering_key,
unsigned char *integrity_key) unsigned char *integrity_key)
{ {
if (rlc_Config == NULL) {
LOG_E(PDCP, "%s:%d:%s: fatal: NULL RLC config\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
switch (rlc_Config->present) { switch (rlc_Config->present) {
case NR_RLC_Config_PR_am: case NR_RLC_Config_PR_am:
add_drb_am(is_gnb, rnti, s, ciphering_algorithm, integrity_algorithm, add_drb_am(is_gnb, rnti, s, ciphering_algorithm, integrity_algorithm,
...@@ -1101,6 +1105,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req( ...@@ -1101,6 +1105,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
{ {
int rnti = ctxt_pP->rnti; int rnti = ctxt_pP->rnti;
int i; int i;
int j;
if (//ctxt_pP->enb_flag != 1 || if (//ctxt_pP->enb_flag != 1 ||
ctxt_pP->module_id != 0 || ctxt_pP->module_id != 0 ||
...@@ -1130,10 +1135,20 @@ boolean_t nr_rrc_pdcp_config_asn1_req( ...@@ -1130,10 +1135,20 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
if (drb2add_list != NULL) { if (drb2add_list != NULL) {
for (i = 0; i < drb2add_list->list.count; i++) { for (i = 0; i < drb2add_list->list.count; i++) {
add_drb(ctxt_pP->enb_flag, rnti, drb2add_list->list.array[i], if (rlc_bearer2add_list != NULL) {
rlc_bearer2add_list->list.array[i]->rlc_Config, for (j = 0; j < rlc_bearer2add_list->list.count; j++){
security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, if (rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){
kUPenc, kUPint); if (rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){
if (drb2add_list->list.array[i]->drb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.drb_Identity){
add_drb(ctxt_pP->enb_flag, rnti, drb2add_list->list.array[i],
rlc_bearer2add_list->list.array[j]->rlc_Config,
security_modeP & 0x0f, (security_modeP >> 4) & 0x0f,
kUPenc, kUPint);
}
}
}
}
}
} }
} }
......
...@@ -87,6 +87,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_am( ...@@ -87,6 +87,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_am(
ret->common.reestablishment = nr_rlc_entity_am_reestablishment; ret->common.reestablishment = nr_rlc_entity_am_reestablishment;
ret->common.delete = nr_rlc_entity_am_delete; ret->common.delete = nr_rlc_entity_am_delete;
ret->common.deliver_pdu = nr_rlc_entity_am_deliver_pdu;
ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu = deliver_sdu;
ret->common.deliver_sdu_data = deliver_sdu_data; ret->common.deliver_sdu_data = deliver_sdu_data;
ret->common.sdu_successful_delivery = sdu_successful_delivery; ret->common.sdu_successful_delivery = sdu_successful_delivery;
...@@ -137,6 +139,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_um( ...@@ -137,6 +139,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_um(
ret->common.reestablishment = nr_rlc_entity_um_reestablishment; ret->common.reestablishment = nr_rlc_entity_um_reestablishment;
ret->common.delete = nr_rlc_entity_um_delete; ret->common.delete = nr_rlc_entity_um_delete;
ret->common.deliver_pdu = nr_rlc_entity_um_deliver_pdu;
ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu = deliver_sdu;
ret->common.deliver_sdu_data = deliver_sdu_data; ret->common.deliver_sdu_data = deliver_sdu_data;
...@@ -168,6 +172,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm( ...@@ -168,6 +172,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm(
ret->common.reestablishment = nr_rlc_entity_tm_reestablishment; ret->common.reestablishment = nr_rlc_entity_tm_reestablishment;
ret->common.delete = nr_rlc_entity_tm_delete; ret->common.delete = nr_rlc_entity_tm_delete;
/* ret->common.deliver_pdu = nr_rlc_entity_tm_deliver_pdu; */
ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu = deliver_sdu;
ret->common.deliver_sdu_data = deliver_sdu_data; ret->common.deliver_sdu_data = deliver_sdu_data;
......
...@@ -53,6 +53,9 @@ typedef struct nr_rlc_entity_t { ...@@ -53,6 +53,9 @@ typedef struct nr_rlc_entity_t {
void (*delete)(struct nr_rlc_entity_t *entity); void (*delete)(struct nr_rlc_entity_t *entity);
/* put RLC PDU into the queue to be sent to MAC directly */
int (*deliver_pdu)(struct nr_rlc_entity_t *entity, char *buffer, int size);
/* callbacks provided to the RLC module */ /* callbacks provided to the RLC module */
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_rlc_entity_t *entity, void (*deliver_sdu)(void *deliver_sdu_data, struct nr_rlc_entity_t *entity,
char *buf, int size); char *buf, int size);
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#include "nr_rlc_pdu.h" #include "nr_rlc_pdu.h"
#include "LOG/log.h" #include "LOG/log.h"
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
/* for a given SDU/SDU segment, computes the corresponding PDU header size */ /* for a given SDU/SDU segment, computes the corresponding PDU header size */
static int compute_pdu_header_size(nr_rlc_entity_am_t *entity, static int compute_pdu_header_size(nr_rlc_entity_am_t *entity,
...@@ -80,6 +83,11 @@ static int sn_compare_tx(void *_entity, int a, int b) ...@@ -80,6 +83,11 @@ static int sn_compare_tx(void *_entity, int a, int b)
return modulus_tx(entity, a) - modulus_tx(entity, b); return modulus_tx(entity, a) - modulus_tx(entity, b);
} }
static int sn_compare_full_tx(void *_entity, int a, int b)
{
return 0;
}
static int segment_already_received(nr_rlc_entity_am_t *entity, static int segment_already_received(nr_rlc_entity_am_t *entity,
int sn, int so, int size) int sn, int so, int size)
{ {
...@@ -1562,6 +1570,40 @@ nr_rlc_entity_buffer_status_t nr_rlc_entity_am_buffer_status( ...@@ -1562,6 +1570,40 @@ nr_rlc_entity_buffer_status_t nr_rlc_entity_am_buffer_status(
return ret; return ret;
} }
static int generate_tx_full_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size)
{
nr_rlc_pdu_t *pdu;
int ret;
int pdu_header_size;
int sdu_size;
pdu = entity->tx_extra_list;
/* AMD SN12 header length */
pdu_header_size = 2;
sdu_size = pdu->size - pdu_header_size;
if (pdu->size > size) {
LOG_E(RLC, "%s:%d:%s: buffer is small\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
/* update buffer status */
entity->common.bstatus.tx_size -= pdu->size;
/* deliver */
memcpy(buffer, pdu->data, pdu->size);
entity->tx_size -= sdu_size;
entity->tx_extra_list = pdu->next;
ret = pdu->size;
nr_rlc_free_pdu(pdu);
return ret;
}
int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity, int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity,
char *buffer, int size, nr_rlc_pkt_info_t *rlc_info) char *buffer, int size, nr_rlc_pkt_info_t *rlc_info)
...@@ -1586,11 +1628,54 @@ int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity, ...@@ -1586,11 +1628,54 @@ int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity,
return ret; return ret;
} }
if (RC.ss.mode > SS_GNB) {
if (entity->tx_extra_list != NULL) {
ret = generate_tx_full_pdu(entity, buffer, size);
rlc_info->pduLength = ret;
return ret;
}
}
ret = generate_tx_pdu(entity, buffer, size); ret = generate_tx_pdu(entity, buffer, size);
rlc_info->pduLength = ret; rlc_info->pduLength = ret;
return ret; return ret;
} }
void nr_rlc_entity_am_deliver_pdu(nr_rlc_entity_t *_entity, char *buffer, int size)
{
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
nr_rlc_pdu_t *pdu;
int pdu_header_size;
int sdu_size;
/* AMD SN12 header length */
pdu_header_size = 2;
sdu_size = size - pdu_header_size;
if (sdu_size > NR_SDU_MAX) {
LOG_E(RLC, "%s:%d:%s: fatal: SDU size too big (%d bytes)\n",
__FILE__, __LINE__, __FUNCTION__, sdu_size);
exit(1);
}
if (entity->tx_size + sdu_size > entity->tx_maxsize) {
LOG_W(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n",
__FILE__, __LINE__, __FUNCTION__);
return;
}
entity->tx_size += sdu_size;
/* PDU contains full RLC PDU with header */
pdu = nr_rlc_new_pdu(0, 0, 1, 1, buffer, size);
entity->tx_extra_list = nr_rlc_pdu_list_add(sn_compare_full_tx, entity,
entity->tx_extra_list, pdu);
/* update buffer status */
entity->common.bstatus.tx_size += size;
}
/*************************************************************************/ /*************************************************************************/
/* SDU RX functions */ /* SDU RX functions */
/*************************************************************************/ /*************************************************************************/
...@@ -1834,6 +1919,7 @@ void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id) ...@@ -1834,6 +1919,7 @@ void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id)
static void clear_entity(nr_rlc_entity_am_t *entity) static void clear_entity(nr_rlc_entity_am_t *entity)
{ {
nr_rlc_pdu_t *cur_rx; nr_rlc_pdu_t *cur_rx;
nr_rlc_pdu_t *cur_tx;
entity->rx_next = 0; entity->rx_next = 0;
entity->rx_next_status_trigger = 0; entity->rx_next_status_trigger = 0;
...@@ -1886,6 +1972,14 @@ static void clear_entity(nr_rlc_entity_am_t *entity) ...@@ -1886,6 +1972,14 @@ static void clear_entity(nr_rlc_entity_am_t *entity)
entity->common.bstatus.tx_size = 0; entity->common.bstatus.tx_size = 0;
entity->common.bstatus.retx_size = 0; entity->common.bstatus.retx_size = 0;
cur_tx = entity->tx_extra_list;
while (cur_tx != NULL) {
nr_rlc_pdu_t *p = cur_tx;
cur_tx = cur_tx->next;
nr_rlc_free_pdu(p);
}
entity->tx_extra_list = NULL;
} }
void nr_rlc_entity_am_reestablishment(nr_rlc_entity_t *_entity) void nr_rlc_entity_am_reestablishment(nr_rlc_entity_t *_entity)
......
...@@ -82,6 +82,9 @@ typedef struct { ...@@ -82,6 +82,9 @@ typedef struct {
int tx_size; int tx_size;
int tx_maxsize; int tx_maxsize;
/* TTCN DRB support: contains the RLC PDU list to be sent to MAC directly */
nr_rlc_pdu_t *tx_extra_list;
nr_rlc_sdu_segment_t *wait_list; nr_rlc_sdu_segment_t *wait_list;
nr_rlc_sdu_segment_t *wait_end; nr_rlc_sdu_segment_t *wait_end;
...@@ -105,4 +108,6 @@ void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id); ...@@ -105,4 +108,6 @@ void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id);
void nr_rlc_entity_am_reestablishment(nr_rlc_entity_t *_entity); void nr_rlc_entity_am_reestablishment(nr_rlc_entity_t *_entity);
void nr_rlc_entity_am_delete(nr_rlc_entity_t *entity); void nr_rlc_entity_am_delete(nr_rlc_entity_t *entity);
void nr_rlc_entity_am_deliver_pdu(nr_rlc_entity_t *entity, char *buffer, int size);
#endif /* _NR_RLC_ENTITY_AM_H_ */ #endif /* _NR_RLC_ENTITY_AM_H_ */
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "nr_rlc_entity.h" #include "nr_rlc_entity.h"
#include "nr_rlc_sdu.h" #include "nr_rlc_sdu.h"
#include "nr_rlc_pdu.h"
typedef struct { typedef struct {
nr_rlc_entity_t common; nr_rlc_entity_t common;
...@@ -36,6 +37,9 @@ typedef struct { ...@@ -36,6 +37,9 @@ typedef struct {
nr_rlc_sdu_segment_t *tx_end; nr_rlc_sdu_segment_t *tx_end;
int tx_size; int tx_size;
int tx_maxsize; int tx_maxsize;
/* TTCN DRB support: contains the RLC PDU list to be sent to MAC directly */
nr_rlc_pdu_t *tx_extra_list;
} nr_rlc_entity_tm_t; } nr_rlc_entity_tm_t;
void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *entity, void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *entity,
...@@ -52,4 +56,6 @@ void nr_rlc_entity_tm_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id); ...@@ -52,4 +56,6 @@ void nr_rlc_entity_tm_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id);
void nr_rlc_entity_tm_reestablishment(nr_rlc_entity_t *_entity); void nr_rlc_entity_tm_reestablishment(nr_rlc_entity_t *_entity);
void nr_rlc_entity_tm_delete(nr_rlc_entity_t *entity); void nr_rlc_entity_tm_delete(nr_rlc_entity_t *entity);
void nr_rlc_entity_tm_deliver_pdu(nr_rlc_entity_t *entity, char *buffer, int size);
#endif /* _NR_RLC_ENTITY_TM_H_ */ #endif /* _NR_RLC_ENTITY_TM_H_ */
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#include "nr_rlc_pdu.h" #include "nr_rlc_pdu.h"
#include "LOG/log.h" #include "LOG/log.h"
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
/* for a given SDU/SDU segment, computes the corresponding PDU header size */ /* for a given SDU/SDU segment, computes the corresponding PDU header size */
static int compute_pdu_header_size(nr_rlc_entity_um_t *entity, static int compute_pdu_header_size(nr_rlc_entity_um_t *entity,
...@@ -60,6 +63,11 @@ static int sn_compare_rx(void *_entity, int a, int b) ...@@ -60,6 +63,11 @@ static int sn_compare_rx(void *_entity, int a, int b)
return modulus_rx(entity, a) - modulus_rx(entity, b); return modulus_rx(entity, a) - modulus_rx(entity, b);
} }
static int sn_compare_full_tx(void *_entity, int a, int b)
{
return 0;
}
/* checks that all the bytes of the SDU sn have been received (but SDU /* checks that all the bytes of the SDU sn have been received (but SDU
* has not been already processed) * has not been already processed)
*/ */
...@@ -514,18 +522,99 @@ nr_rlc_entity_buffer_status_t nr_rlc_entity_um_buffer_status( ...@@ -514,18 +522,99 @@ nr_rlc_entity_buffer_status_t nr_rlc_entity_um_buffer_status(
return ret; return ret;
} }
static int generate_tx_full_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
{
nr_rlc_pdu_t *pdu;
int ret;
int pdu_header_size;
int sdu_size;
pdu = entity->tx_extra_list;
/* UMD NoSN header length */
pdu_header_size = 1;
sdu_size = pdu->size - pdu_header_size;
if (pdu->size > size) {
LOG_E(RLC, "%s:%d:%s: buffer is small\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
/* update buffer status */
entity->common.bstatus.tx_size -= pdu->size;
/* deliver */
memcpy(buffer, pdu->data, pdu->size);
entity->tx_size -= sdu_size;
entity->tx_extra_list = pdu->next;
ret = pdu->size;
nr_rlc_free_pdu(pdu);
return ret;
}
int nr_rlc_entity_um_generate_pdu(nr_rlc_entity_t *_entity, int nr_rlc_entity_um_generate_pdu(nr_rlc_entity_t *_entity,
char *buffer, int size, nr_rlc_pkt_info_t *rlc_info) char *buffer, int size, nr_rlc_pkt_info_t *rlc_info)
{ {
nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity; nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity;
int ret;
int ret = generate_tx_pdu(entity, buffer, size); if (RC.ss.mode > SS_GNB) {
if (entity->tx_extra_list != NULL) {
ret = generate_tx_full_pdu(entity, buffer, size);
rlc_info->rlcMode = 2; /** UM Mode */
rlc_info->sequenceNumberLength = entity->sn_field_length;
rlc_info->pduLength = ret;
return ret;
}
}
ret = generate_tx_pdu(entity, buffer, size);
rlc_info->rlcMode = 2; /** UM Mode */ rlc_info->rlcMode = 2; /** UM Mode */
rlc_info->sequenceNumberLength = entity->sn_field_length; rlc_info->sequenceNumberLength = entity->sn_field_length;
rlc_info->pduLength = ret; rlc_info->pduLength = ret;
return ret; return ret;
} }
void nr_rlc_entity_um_deliver_pdu(nr_rlc_entity_t *_entity, char *buffer, int size)
{
nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity;
nr_rlc_pdu_t *pdu;
int pdu_header_size;
int sdu_size;
/* UMD NoSN header length */
pdu_header_size = 1;
sdu_size = size - pdu_header_size;
if (sdu_size > NR_SDU_MAX) {
LOG_E(RLC, "%s:%d:%s: fatal: SDU size too big (%d bytes)\n",
__FILE__, __LINE__, __FUNCTION__, sdu_size);
exit(1);
}
if (entity->tx_size + sdu_size > entity->tx_maxsize) {
LOG_W(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n",
__FILE__, __LINE__, __FUNCTION__);
return;
}
entity->tx_size += sdu_size;
/* PDU contains full RLC PDU with header */
pdu = nr_rlc_new_pdu(0, 0, 1, 1, buffer, size);
entity->tx_extra_list = nr_rlc_pdu_list_add(sn_compare_full_tx, entity,
entity->tx_extra_list, pdu);
/* update buffer status */
entity->common.bstatus.tx_size += size;
}
/*************************************************************************/ /*************************************************************************/
/* SDU RX functions */ /* SDU RX functions */
/*************************************************************************/ /*************************************************************************/
...@@ -663,6 +752,7 @@ void nr_rlc_entity_um_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id) ...@@ -663,6 +752,7 @@ void nr_rlc_entity_um_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id)
static void clear_entity(nr_rlc_entity_um_t *entity) static void clear_entity(nr_rlc_entity_um_t *entity)
{ {
nr_rlc_pdu_t *cur_rx; nr_rlc_pdu_t *cur_rx;
nr_rlc_pdu_t *cur_tx;
entity->rx_next_highest = 0; entity->rx_next_highest = 0;
entity->rx_next_reassembly = 0; entity->rx_next_reassembly = 0;
...@@ -691,6 +781,14 @@ static void clear_entity(nr_rlc_entity_um_t *entity) ...@@ -691,6 +781,14 @@ static void clear_entity(nr_rlc_entity_um_t *entity)
entity->tx_size = 0; entity->tx_size = 0;
entity->common.bstatus.tx_size = 0; entity->common.bstatus.tx_size = 0;
cur_tx = entity->tx_extra_list;
while (cur_tx != NULL) {
nr_rlc_pdu_t *p = cur_tx;
cur_tx = cur_tx->next;
nr_rlc_free_pdu(p);
}
entity->tx_extra_list = NULL;
} }
void nr_rlc_entity_um_reestablishment(nr_rlc_entity_t *_entity) void nr_rlc_entity_um_reestablishment(nr_rlc_entity_t *_entity)
......
...@@ -60,6 +60,9 @@ typedef struct { ...@@ -60,6 +60,9 @@ typedef struct {
nr_rlc_sdu_segment_t *tx_end; nr_rlc_sdu_segment_t *tx_end;
int tx_size; int tx_size;
int tx_maxsize; int tx_maxsize;
/* TTCN DRB support: contains the RLC PDU list to be sent to MAC directly */
nr_rlc_pdu_t *tx_extra_list;
} nr_rlc_entity_um_t; } nr_rlc_entity_um_t;
void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *entity, void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *entity,
...@@ -76,4 +79,6 @@ void nr_rlc_entity_um_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id); ...@@ -76,4 +79,6 @@ void nr_rlc_entity_um_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id);
void nr_rlc_entity_um_reestablishment(nr_rlc_entity_t *_entity); void nr_rlc_entity_um_reestablishment(nr_rlc_entity_t *_entity);
void nr_rlc_entity_um_delete(nr_rlc_entity_t *entity); void nr_rlc_entity_um_delete(nr_rlc_entity_t *entity);
void nr_rlc_entity_um_deliver_pdu(nr_rlc_entity_t *entity, char *buffer, int size);
#endif /* _NR_RLC_ENTITY_UM_H_ */ #endif /* _NR_RLC_ENTITY_UM_H_ */
...@@ -437,6 +437,58 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, ...@@ -437,6 +437,58 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
rlc_op_status_t enqueue_mac_rlc_data_req(
const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
confirm_t confirmP,
sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP,
const uint32_t *const sourceL2Id,
const uint32_t *const destinationL2Id
)
{
int rnti = ctxt_pP->rnti;
nr_rlc_ue_t *ue;
nr_rlc_entity_t *rb;
LOG_D(RLC, "%s rnti %d srb_flag %d rb_id %ld mui %d confirm %d sdu_size %d MBMS_flag %d\n",
__FUNCTION__, rnti, srb_flagP, rb_idP, muiP, confirmP, sdu_sizeP,
MBMS_flagP);
if (ctxt_pP->enb_flag)
T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id),
T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
rb = NULL;
if (srb_flagP) {
if (rb_idP >= 1 && rb_idP <= 2)
rb = ue->srb[rb_idP - 1];
} else {
if (rb_idP >= 1 && rb_idP <= 5)
rb = ue->drb[rb_idP - 1];
}
if (rb != NULL) {
rb->deliver_pdu(rb, (char *)sdu_pP->data, sdu_sizeP);
} else {
LOG_E(RLC, "%s:%d:%s: fatal: SDU sent to unknown RB\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
free_mem_block(sdu_pP, __func__);
return RLC_OP_STATUS_OK;
}
int rlc_module_init(int enb_flag) int rlc_module_init(int enb_flag)
{ {
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
...@@ -732,26 +784,30 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig ...@@ -732,26 +784,30 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig
exit(1); exit(1);
} }
switch (r->present) { if (r) {
case NR_RLC_Config_PR_am: { switch (r->present) {
struct NR_RLC_Config__am *am; case NR_RLC_Config_PR_am: {
am = r->choice.am; struct NR_RLC_Config__am *am;
t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly); am = r->choice.am;
t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit); t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly);
t_poll_retransmit = decode_t_poll_retransmit(am->ul_AM_RLC.t_PollRetransmit); t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit);
poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU); t_poll_retransmit = decode_t_poll_retransmit(am->ul_AM_RLC.t_PollRetransmit);
poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte); poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU);
max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold); poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte);
if (*am->dl_AM_RLC.sn_FieldLength != *am->ul_AM_RLC.sn_FieldLength) { max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold);
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); if (*am->dl_AM_RLC.sn_FieldLength != *am->ul_AM_RLC.sn_FieldLength) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength);
break;
}
default:
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength); } else {
break; /* TODO: TTCN sends empty RLC config for SRB, need to use default values */
}
default:
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
} }
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
...@@ -803,7 +859,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ ...@@ -803,7 +859,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
int sn_field_length; int sn_field_length;
if (!(drb_id >= 1 && drb_id <= 5)) { if (!(drb_id >= 1 && drb_id <= 5)) {
LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n", LOG_E(RLC, "%s:%d:%s: fatal, bad drb id %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id); __FILE__, __LINE__, __FUNCTION__, drb_id);
exit(1); exit(1);
} }
...@@ -880,7 +936,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ ...@@ -880,7 +936,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
int t_reassembly; int t_reassembly;
if (!(drb_id >= 1 && drb_id <= 5)) { if (!(drb_id >= 1 && drb_id <= 5)) {
LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n", LOG_E(RLC, "%s:%d:%s: fatal, bad drb id %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id); __FILE__, __LINE__, __FUNCTION__, drb_id);
exit(1); exit(1);
} }
...@@ -928,7 +984,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ ...@@ -928,7 +984,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
sn_field_length); sn_field_length);
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_um); nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_um);
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_I(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
......
...@@ -40,6 +40,8 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, ...@@ -40,6 +40,8 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
NR_BandNR_t *nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t)); NR_BandNR_t *nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t));
nr_bandnr->bandNR = band; nr_bandnr->bandNR = band;
nr_bandnr->multipleTCI = CALLOC(1, sizeof(long));
*nr_bandnr->multipleTCI = NR_BandNR__multipleTCI_supported;
ASN_SEQUENCE_ADD(&cap->rf_Parameters.supportedBandListNR.list, ASN_SEQUENCE_ADD(&cap->rf_Parameters.supportedBandListNR.list,
nr_bandnr); nr_bandnr);
if (mcs_table == 1) { if (mcs_table == 1) {
......
This diff is collapsed.
...@@ -162,10 +162,10 @@ rrc_data_req_nr_ue( ...@@ -162,10 +162,10 @@ rrc_data_req_nr_ue(
MessageDef *message_p; MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_UE, TASK_PDCP_UE, sdu_sizeP); message_buffer = itti_malloc (TASK_RRC_NRUE, TASK_PDCP_UE, sdu_sizeP);
LOG_D(RRC,"Sending RRC message for SRB %ld, sdu_size %d\n",rb_idP, sdu_sizeP); LOG_D(RRC,"Sending RRC message for SRB %ld, sdu_size %d\n",rb_idP, sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message ( TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); message_p = itti_alloc_new_message ( TASK_RRC_NRUE, 0, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag; RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
......
...@@ -94,6 +94,8 @@ static const char nr_nas_attach_req_imsi[] = { ...@@ -94,6 +94,8 @@ static const char nr_nas_attach_req_imsi[] = {
0x01, 0x27, 0x11, 0x01, 0x27, 0x11,
}; };
static size_t nr_rrc_ue_RRCSetupRequest_count = 0;
extern void pdcp_config_set_security( extern void pdcp_config_set_security(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
pdcp_t *const pdcp_pP, pdcp_t *const pdcp_pP,
...@@ -1023,7 +1025,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ...@@ -1023,7 +1025,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index
if (new_sib == 1) { if (new_sib == 1) {
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt++; NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt++;
if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count) if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count)
nr_rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE ); nr_rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR );
LOG_I(NR_RRC,"SIStatus %x, SIcnt %d/%d\n", LOG_I(NR_RRC,"SIStatus %x, SIcnt %d/%d\n",
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus, NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus,
...@@ -1036,7 +1038,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ...@@ -1036,7 +1038,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index
// NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt++; // NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt++;
// if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->schedulingInfoList.list.count) // if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->schedulingInfoList.list.count)
// rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE ); // rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR );
// LOG_I(NR_RRC, "SIStatus %x, SIcnt %d/%d\n", // LOG_I(NR_RRC, "SIStatus %x, SIcnt %d/%d\n",
// NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus, // NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus,
...@@ -1258,7 +1260,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, ...@@ -1258,7 +1260,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
if (nr_rrc_get_sub_state(module_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR) { if (nr_rrc_get_sub_state(module_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR) {
//if ( (NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data != NULL) || (!AMF_MODE_ENABLED)) { //if ( (NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data != NULL) || (!AMF_MODE_ENABLED)) {
nr_rrc_ue_generate_RRCSetupRequest(module_id, 0); nr_rrc_ue_generate_RRCSetupRequest(module_id, 0);
nr_rrc_set_sub_state( module_id, RRC_SUB_STATE_IDLE_CONNECTING ); nr_rrc_set_sub_state( module_id, RRC_SUB_STATE_IDLE_CONNECTING_NR );
//} //}
} }
...@@ -1386,7 +1388,11 @@ static void rrc_ue_generate_RRCSetupComplete( ...@@ -1386,7 +1388,11 @@ static void rrc_ue_generate_RRCSetupComplete(
#else #else
if (get_softmodem_params()->sa) { if (get_softmodem_params()->sa) {
as_nas_info_t initialNasMsg; as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id); if (nr_rrc_ue_RRCSetupRequest_count > 1) {
generateServiceRequest(&initialNasMsg, ctxt_pP->module_id);
} else {
generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id);
}
nas_msg = (char*)initialNasMsg.data; nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length; nas_msg_length = initialNasMsg.length;
} else { } else {
...@@ -1491,8 +1497,8 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ...@@ -1491,8 +1497,8 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, nr_rrc_ue_process_RadioBearerConfig(ctxt_pP,
gNB_index, gNB_index,
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED_NR);
nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED_NR);
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti; NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti;
rrc_ue_generate_RRCSetupComplete( rrc_ue_generate_RRCSetupComplete(
ctxt_pP, ctxt_pP,
...@@ -1814,6 +1820,8 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ...@@ -1814,6 +1820,8 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
/*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff; /*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff;
UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */ UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */
nr_rrc_ue_RRCSetupRequest_count++;
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
...@@ -2380,16 +2388,40 @@ nr_rrc_ue_establish_srb2( ...@@ -2380,16 +2388,40 @@ nr_rrc_ue_establish_srb2(
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND);
if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) &&
(dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = if (dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq != NULL) {
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer =
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5;
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType =
} NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency;
}
}
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); /* simulate power OFF, to be able to send RRCSetupRequest to TTCN again */
break; LOG_W(NR_RRC, "todo, sleep before removing UE\n");
sleep(3);
NR_UE_MAC_INST_t *mac = get_mac_inst(ctxt_pP->module_id);
mac->ra.ra_state = RA_UE_IDLE;
nr_rrc_set_state( ctxt_pP->module_id, RRC_STATE_IDLE_NR );
nr_rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_NR );
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_indexP].Tx_buffer.payload_size = 0;
rrc_rlc_remove_ue(ctxt_pP);
pdcp_remove_UE(ctxt_pP);
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = NULL;
NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_indexP] = NULL;
NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_indexP] = NULL;
NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_indexP][0] = NULL;
NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_indexP][1] = NULL;
NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_indexP][2] = NULL;
break;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", ctxt_pP->module_id,gNB_indexP); LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", ctxt_pP->module_id,gNB_indexP);
nr_rrc_ue_process_ueCapabilityEnquiry( nr_rrc_ue_process_ueCapabilityEnquiry(
...@@ -2704,7 +2736,9 @@ nr_rrc_ue_process_ueCapabilityEnquiry( ...@@ -2704,7 +2736,9 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t)); UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
NR_BandNR_t *nr_bandnr; NR_BandNR_t *nr_bandnr;
nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t)); nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t));
nr_bandnr->bandNR = 1; nr_bandnr->bandNR = 78;
nr_bandnr->multipleTCI = CALLOC(1, sizeof(long));
*nr_bandnr->multipleTCI = NR_BandNR__multipleTCI_supported;
ASN_SEQUENCE_ADD(&UE_Capability_nr->rf_Parameters.supportedBandListNR.list, ASN_SEQUENCE_ADD(&UE_Capability_nr->rf_Parameters.supportedBandListNR.list,
nr_bandnr); nr_bandnr);
} }
...@@ -2932,7 +2966,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) ...@@ -2932,7 +2966,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len)
LOG_D(NR_RRC, "Received NR band information: %ld.\n", LOG_D(NR_RRC, "Received NR band information: %ld.\n",
nr_freq_band_list->list.array[i]->choice.bandInformationNR->bandNR); nr_freq_band_list->list.array[i]->choice.bandInformationNR->bandNR);
} }
MessageDef *dummy_msg = itti_alloc_new_message(TASK_RRC_NSA_UE, 0, UE_CAPABILITY_DUMMY); MessageDef *dummy_msg = itti_alloc_new_message(TASK_RRC_NSA_NRUE, 0, UE_CAPABILITY_DUMMY);
LOG_D(NR_RRC, "We are calling nsa_sendmsg_to_lte_ue to send a UE_CAPABILITY_DUMMY\n"); LOG_D(NR_RRC, "We are calling nsa_sendmsg_to_lte_ue to send a UE_CAPABILITY_DUMMY\n");
nsa_sendmsg_to_lte_ue(dummy_msg, sizeof(dummy_msg), UE_CAPABILITY_DUMMY); nsa_sendmsg_to_lte_ue(dummy_msg, sizeof(dummy_msg), UE_CAPABILITY_DUMMY);
LOG_A(NR_RRC, "Sent initial NRUE Capability response to LTE UE\n"); LOG_A(NR_RRC, "Sent initial NRUE Capability response to LTE UE\n");
......
/*
* 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
*/
/*! \file ActivateTestModeComplete.c
\brief test mode procedures for eNB/gNB
\author
\email:
\date 2022
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "nas_log.h"
#include "ActivateTestModeComplete.h"
int encode_activate_test_mode_complete(activate_test_mode_complete_msg *activate_test_mode_complete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
/* *(buffer + encoded) = activate_test_mode_complete->protocoldiscriminator; */
/* encoded++; */
/* *(buffer + encoded) = activate_test_mode_complete->messagetype; */
/* encoded++; */
return encoded;
}
/*
* 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
*/
/*! \file ActivateTestModeComplete.h
\brief test mode procedures for eNB/gNB
\author
\email:
\date 2022
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "SpareHalfOctet.h"
#include "MessageType.h"
#ifndef ACTIVATE_TEST_MODE_COMPLETE_H_
#define ACTIVATE_TEST_MODE_COMPLETE_H_
typedef struct activate_test_mode_complete_msg_tag {
/* Mandatory fields */
ExtendedProtocolDiscriminator protocoldiscriminator; // LTE: skipIndicator + protocolDiscriminator
SecurityHeaderType securityheadertype:4; // LTE: missing
SpareHalfOctet sparehalfoctet:4; // LTE: missing
MessageType messagetype;
/* Optional fields */
} activate_test_mode_complete_msg;
int encode_activate_test_mode_complete(activate_test_mode_complete_msg *activate_test_mode_complete, uint8_t *buffer, uint32_t len);
#endif /* ! defined(ACTIVATE_TEST_MODE_COMPLETE_H_) */
/*
* 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
*/
/*! \file CloseUeTestLoopComplete.c
\brief test mode procedures for eNB/gNB
\author
\email:
\date 2022
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "nas_log.h"
#include "CloseUeTestLoopComplete.h"
int encode_close_ue_test_loop_complete(close_ue_test_loop_complete_msg *close_ue_test_loop_complete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
/* *(buffer + encoded) = close_ue_test_loop_complete->protocoldiscriminator; */
/* encoded++; */
/* *(buffer + encoded) = close_ue_test_loop_complete->messagetype; */
/* encoded++; */
return encoded;
}
/*
* 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
*/
/*! \file CloseUeTestLoopComplete.h
\brief test mode procedures for eNB/gNB
\author
\email:
\date 2022
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "SpareHalfOctet.h"
#include "MessageType.h"
#ifndef CLOSE_UE_TEST_LOOP_COMPLETE_H_
#define CLOSE_UE_TEST_LOOP_COMPLETE_H_
typedef struct close_ue_test_loop_complete_msg_tag {
/* Mandatory fields */
ExtendedProtocolDiscriminator protocoldiscriminator; // LTE: skipIndicator + protocolDiscriminator
SecurityHeaderType securityheadertype:4; // LTE: missing
SpareHalfOctet sparehalfoctet:4; // LTE: missing
MessageType messagetype;
/* Optional fields */
} close_ue_test_loop_complete_msg;
int encode_close_ue_test_loop_complete(close_ue_test_loop_complete_msg *close_ue_test_loop_complete, uint8_t *buffer, uint32_t len);
#endif /* ! defined(CLOSE_UE_TEST_LOOP_COMPLETE_H_) */
/*
* 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
*/
/*! \file FGSServiceRequest.c
\brief service request procedures for gNB
\author
\email:
\date 2022
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "nas_log.h"
#include "FGSServiceRequest.h"
int encode_fgs_service_request(fgs_service_request_msg *fgs_service_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
*(buffer + encoded) = ((encode_u8_service_type(&fgs_service_request->servicetype) & 0x0f) << 4) | (encode_u8_nas_key_set_identifier(&fgs_service_request->naskeysetidentifier) & 0x0f);
encoded++;
if ((encode_result =
encode_5gs_mobile_identity(&fgs_service_request->fgsmobileidentity, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((fgs_service_request->presencemask & FGS_SERVICE_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT)
== FGS_SERVICE_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT) {
if ((encode_result = encode_fgc_nas_message_container(&fgs_service_request->fgsnasmessagecontainer,
FGS_SERVICE_REQUEST_NAS_MESSAGE_CONTAINER_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
// TODO, Encoding optional fields
return encoded;
}
/*
* 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
*/
/*! \file FGSServiceRequest.h
\brief service request procedures for gNB
\author
\email:
\date 2022
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "SpareHalfOctet.h"
#include "MessageType.h"
#include "ServiceType.h"
#include "NasKeySetIdentifier.h"
#include "FGSMobileIdentity.h"
#include "FGCNasMessageContainer.h"
#ifndef FGS_SERVICE_REQUEST_H_
#define FGS_SERVICE_REQUEST_H_
# define FGS_SERVICE_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT (1<<3)
typedef enum fgs_service_request_iei_tag {
FGS_SERVICE_REQUEST_NAS_MESSAGE_CONTAINER_IEI = 0x71, /* 0x71 = 113 */
} fgs_service_request_iei;
typedef struct fgs_service_request_msg_tag {
/* Mandatory fields */
ExtendedProtocolDiscriminator protocoldiscriminator;
SecurityHeaderType securityheadertype:4;
SpareHalfOctet sparehalfoctet:4;
MessageType messagetype;
ServiceType servicetype;
NasKeySetIdentifier naskeysetidentifier;
FGSMobileIdentity fgsmobileidentity;
/* Optional fields */
uint32_t presencemask;
FGCNasMessageContainer fgsnasmessagecontainer;
} fgs_service_request_msg;
int encode_fgs_service_request(fgs_service_request_msg *fgs_service_request, uint8_t *buffer, uint32_t len);
#endif /* ! defined(FGS_SERVICE_REQUEST_H_) */
This diff is collapsed.
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
#include "RegistrationComplete.h" #include "RegistrationComplete.h"
#include "as_message.h" #include "as_message.h"
#include "FGSUplinkNasTransport.h" #include "FGSUplinkNasTransport.h"
#include "FGSServiceRequest.h"
#include "ActivateTestModeComplete.h"
#include "CloseUeTestLoopComplete.h"
#define PLAIN_5GS_MSG 0b0000 #define PLAIN_5GS_MSG 0b0000
#define INTEGRITY_PROTECTED 0b0001 #define INTEGRITY_PROTECTED 0b0001
...@@ -49,6 +52,7 @@ ...@@ -49,6 +52,7 @@
#define REGISTRATION_REQUEST 0b01000001 /* 65 = 0x41 */ #define REGISTRATION_REQUEST 0b01000001 /* 65 = 0x41 */
#define REGISTRATION_ACCEPT 0b01000010 /* 66 = 0x42 */ #define REGISTRATION_ACCEPT 0b01000010 /* 66 = 0x42 */
#define REGISTRATION_COMPLETE 0b01000011 /* 67 = 0x43 */ #define REGISTRATION_COMPLETE 0b01000011 /* 67 = 0x43 */
#define FGS_SERVICE_REQUEST 0b01001100 /* 76 = 0x4c */
#define FGS_AUTHENTICATION_REQUEST 0b01010110 /* 86 = 0x56 */ #define FGS_AUTHENTICATION_REQUEST 0b01010110 /* 86 = 0x56 */
#define FGS_AUTHENTICATION_RESPONSE 0b01010111 /* 87 = 0x57 */ #define FGS_AUTHENTICATION_RESPONSE 0b01010111 /* 87 = 0x57 */
#define FGS_IDENTITY_REQUEST 0b01011011 /* 91 = 0x5b */ #define FGS_IDENTITY_REQUEST 0b01011011 /* 91 = 0x5b */
...@@ -58,6 +62,12 @@ ...@@ -58,6 +62,12 @@
#define FGS_UPLINK_NAS_TRANSPORT 0b01100111 /* 103= 0x67 */ #define FGS_UPLINK_NAS_TRANSPORT 0b01100111 /* 103= 0x67 */
#define FGS_DOWNLINK_NAS_TRANSPORT 0b01101000 /* 104= 0x68 */ #define FGS_DOWNLINK_NAS_TRANSPORT 0b01101000 /* 104= 0x68 */
#define TEST_PD 0b00001111 /* skipIndicator=0000, protocolDiscriminator=1111 */
#define ACTIVATE_TEST_MODE 0b10000100 /* 132 = 0x84 */
#define ACTIVATE_TEST_MODE_COMPLETE 0b10000101 /* 133 = 0x85 */
#define NR_CLOSE_UE_TEST_LOOP 0b10000000 /* 128 = 0x80 */
#define CLOSE_UE_TEST_LOOP_COMPLETE 0b10000001 /* 129 = 0x81 */
// message type for 5GS session management // message type for 5GS session management
#define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001 /* 193= 0xc1 */ #define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001 /* 193= 0xc1 */
#define FGS_PDU_SESSION_ESTABLISHMENT_ACC 0b11000010 /* 194= 0xc2 */ #define FGS_PDU_SESSION_ESTABLISHMENT_ACC 0b11000010 /* 194= 0xc2 */
...@@ -112,6 +122,9 @@ typedef union { ...@@ -112,6 +122,9 @@ typedef union {
fgs_security_mode_complete_msg fgs_security_mode_complete; fgs_security_mode_complete_msg fgs_security_mode_complete;
registration_complete_msg registration_complete; registration_complete_msg registration_complete;
fgs_uplink_nas_transport_msg uplink_nas_transport; fgs_uplink_nas_transport_msg uplink_nas_transport;
activate_test_mode_complete_msg activate_test_mode_complete;
close_ue_test_loop_complete_msg close_ue_test_loop_complete;
fgs_service_request_msg fgs_service_request;
} MM_msg; } MM_msg;
...@@ -160,6 +173,7 @@ typedef struct { ...@@ -160,6 +173,7 @@ typedef struct {
} dl_nas_transport_t; } dl_nas_transport_t;
void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id); void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id);
void generateServiceRequest(as_nas_info_t *initialNasMsg, int Mod_id);
void *nas_nrue_task(void *args_p); void *nas_nrue_task(void *args_p);
#endif /* __NR_NAS_MSG_SIM_H__*/ #endif /* __NR_NAS_MSG_SIM_H__*/
......
This diff is collapsed.
#ifndef SS_GNB_DRB_TASK_H_
#define SS_GNB_DRB_TASK_H_
void ss_gNB_drb_init(void);
void *ss_gNB_drb_process_itti_msg(void *);
void *ss_gNB_drb_task(void *arg);
#endif /* SS_GNB_DRB_TASK_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