Commit c9906d1a authored by masayuki.harada's avatar masayuki.harada

Merge remote-tracking branch 'remotes/oai/NR_SA_F1AP_RFSIMULATOR3' into NR_SA_F1AP_RFSIMULATOR3_Lo

# Conflicts:
#	openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
#	openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
parents c273a9d3 d6763661
......@@ -49,7 +49,7 @@ extern unsigned char NB_gNB_INST;
extern RAN_CONTEXT_t RC;
#define GNB_REGISTER_RETRY_DELAY 10
#if 0
/*------------------------------------------------------------------------------*/
static void configure_nr_rrc(uint32_t gnb_id)
{
......@@ -68,7 +68,7 @@ static void configure_nr_rrc(uint32_t gnb_id)
}
else AssertFatal(0,"NRRRC context for gNB %d not allocated\n",gnb_id);
}
#endif
/*------------------------------------------------------------------------------*/
......
......@@ -78,6 +78,7 @@
#include "NR_EUTRA-MBSFN-SubframeConfig.h"
#include "RRC/NR/MESSAGES/asn1_msg.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h"
extern uint16_t sf_ahead;
int macrlc_has_f1 = 0;
......@@ -631,7 +632,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
int num_gnbs = 0;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
int32_t gnb_id = 0;
int k;
int k = 0;
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
////////// Identification parameters
paramdef_t GNBParams[] = GNBPARAMS_DESC;
......
......@@ -39,6 +39,7 @@
#include "PHY/defs_UE.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "executables/softmodem-common.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h"
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
......@@ -56,7 +57,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
// if (IS_SOFTMODEM_NOS1){
if (1) {
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
pdcp_layer_init();
nr_pdcp_layer_init_ue();
nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
}
......
/*
* 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 <stdint.h>
#ifndef _NR_PDCP_H_
#define _NR_PDCP_H_
void pdcp_layer_init_for_CU(void);
void nr_pdcp_layer_init_ue(void);
void nr_DRB_preconfiguration(uint16_t crnti);
#endif /* _NR_PDCP_H_ */
......@@ -27,14 +27,14 @@
typedef struct nr_pdcp_entity_t {
/* functions provided by the PDCP module */
void (*recv_pdu)(protocol_ctxt_t *ctxt_pP,struct nr_pdcp_entity_t *entity, char *buffer, int size);
void (*recv_pdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size);
void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id);
void (*delete)(struct nr_pdcp_entity_t *entity);
void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key);
/* callbacks provided to the PDCP module */
void (*deliver_sdu)(protocol_ctxt_t *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size);
void *deliver_sdu_data;
void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity,
......
......@@ -26,7 +26,7 @@
#include <string.h>
#include "common/utils/LOG/log.h"
void nr_pdcp_entity_drb_am_recv_pdu( protocol_ctxt_t *ctxt_pP , nr_pdcp_entity_t *_entity, char *buffer, int size)
void nr_pdcp_entity_drb_am_recv_pdu( nr_pdcp_entity_t *_entity, char *buffer, int size)
{
nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity;
int sn;
......
......@@ -33,7 +33,7 @@ typedef struct {
int discard_timer; /* unit: ms, -1 means infinity */
} nr_pdcp_entity_drb_am_t;
void nr_pdcp_entity_drb_am_recv_pdu(protocol_ctxt_t *ctxt_pP,nr_pdcp_entity_t *entity, char *buffer, int size);
void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *entity, char *buffer, int size);
void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id);
void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *entity, char *key);
......
......@@ -25,12 +25,12 @@
#include <stdlib.h>
#include <string.h>
void nr_pdcp_entity_srb_recv_pdu(protocol_ctxt_t *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size)
void nr_pdcp_entity_srb_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size)
{
nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity;
if (size < 2) abort();
entity->common.deliver_sdu(ctxt_pP, entity->common.deliver_sdu_data,
entity->common.deliver_sdu(entity->common.deliver_sdu_data,
(nr_pdcp_entity_t *)entity, buffer+2, size-6);
}
......
......@@ -29,7 +29,7 @@ typedef struct {
int srb_id;
} nr_pdcp_entity_srb_t;
void nr_pdcp_entity_srb_recv_pdu(protocol_ctxt_t *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size);
void nr_pdcp_entity_srb_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size);
void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size, int sdu_id);
void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key);
void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity);
......
......@@ -33,6 +33,7 @@
/* from OAI */
#include "pdcp.h"
#include "nr_pdcp.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#define TODO do { \
......@@ -100,8 +101,7 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_srb_bearer2add_list,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_drb_bearer2add_list);
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
//------------------------------------------------------------------------------
void
......@@ -109,7 +109,7 @@ nr_rrc_data_ind(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t Srb_id,
const sdu_size_t sdu_sizeP,
const uint8_t *const buffer_pP
const char *const buffer_pP
)
//------------------------------------------------------------------------------
{
......@@ -140,7 +140,7 @@ nr_rrc_data_ind_ccch(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t Srb_id,
const sdu_size_t sdu_sizeP,
const uint8_t *const buffer_pP
const char *const buffer_pP
)
//------------------------------------------------------------------------------
{
......@@ -297,7 +297,7 @@ static void *enb_tun_read_thread(void *_)
int rnti;
protocol_ctxt_t ctxt;
int lc_id = 4;
int rb_id = 1;
pthread_setname_np( pthread_self(),"enb_tun_read");
while (1) {
......@@ -331,7 +331,7 @@ static void *enb_tun_read_thread(void *_)
}
if (proto_agent_flag == 1) {
pdcp_data_req(&ctxt, SRB_FLAG_NO, lc_id, RLC_MUI_UNDEFINED,
pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
}
......@@ -348,7 +348,7 @@ static void *ue_tun_read_thread(void *_)
int rnti;
protocol_ctxt_t ctxt;
int lc_id = 4;
int rb_id = 1;
pthread_setname_np( pthread_self(),"ue_tun_read");
while (1) {
len = read(nas_sock_fd[0], &rx_buf, NL_MAX_PAYLOAD);
......@@ -376,7 +376,7 @@ static void *ue_tun_read_thread(void *_)
ctxt.rnti = rnti;
pdcp_data_req(&ctxt, SRB_FLAG_NO, lc_id, RLC_MUI_UNDEFINED,
pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
}
......@@ -417,7 +417,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP)
return 0;
}
void pdcp_layer_init(void)
void pdcp_layer_init()
{
/* hack: be sure to initialize only once */
static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
......@@ -435,6 +435,24 @@ void pdcp_layer_init(void)
init_nr_rlc_data_req_queue();
}
void nr_pdcp_layer_init_ue()
{
/* hack: be sure to initialize only once */
static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
static int initialized = 0;
if (pthread_mutex_lock(&m) != 0) abort();
if (initialized) {
if (pthread_mutex_unlock(&m) != 0) abort();
return;
}
initialized = 1;
if (pthread_mutex_unlock(&m) != 0) abort();
nr_pdcp_ue_manager = new_nr_pdcp_ue_manager(0);
init_nr_rlc_data_req_queue();
}
void pdcp_layer_init_for_CU(void)
{
/* hack: be sure to initialize only once */
......@@ -508,7 +526,7 @@ uint64_t pdcp_module_init(uint64_t _pdcp_optmask)
return pdcp_optmask ;
}
static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t *entity,
static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
char *buf, int size)
{
extern int nas_sock_fd[];
......@@ -519,7 +537,7 @@ static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t
int rb_id = 0;
int i;
if (1) { //(IS_SOFTMODEM_NOS1){
if (ENB_NAS_USE_TUN_BIT || UE_NAS_USE_TUN_BIT){
len = write(nas_sock_fd[0], buf, size);
if (len != size) {
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
......@@ -605,25 +623,49 @@ rb_found:
enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock, NULL, NULL);
}
static int ccch_or_dcch = 0;
static void deliver_sdu_srb(protocol_ctxt_t *ctxt_pP, void *_ue, nr_pdcp_entity_t *entity,
static int ccch_or_dcch = 0; //since msg3 and msg4 is not ok, send ccch through dcch.
static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity,
char *buf, int size)
{
/* Implementation to be added */
nr_pdcp_ue_t *ue = _ue;
int srb_id;
int i;
protocol_ctxt_t ctxt;
for (i = 0; i < 2; i++) {
if (entity == ue->srb[i]) {
srb_id = i+1;
goto rb_found;
}
}
LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for ue %d\n",
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
exit(1);
rb_found:
ctxt.module_id = 0;
ctxt.enb_flag = nr_pdcp_manager_get_enb_flag(nr_pdcp_ue_manager);
ctxt.instance = 0;
ctxt.frame = 0;
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.configured = 1;
ctxt.brOption = 0;
ctxt.rnti = ue->rnti;
// nr_pdcp_ue_t *ue = _ue;
// MessageDef *message_p;
// uint8_t *gtpu_buffer_p;
// int srb_id;
if (ccch_or_dcch == 0) {
nr_rrc_data_ind_ccch( ctxt_pP, 1, size, (uint8_t *)buf);
nr_rrc_data_ind_ccch( &ctxt, srb_id, size, buf);
ccch_or_dcch = 1;
} else {
nr_rrc_data_ind( ctxt_pP, 1, size, (uint8_t *)buf);
nr_rrc_data_ind( &ctxt, srb_id, size, buf);
}
return;
}
static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity,
char *buf, int size, int sdu_id)
{
......@@ -790,7 +832,7 @@ boolean_t pdcp_data_ind(
}
if (rb != NULL) {
rb->recv_pdu(ctxt_pP,rb, (char *)sdu_buffer->data, sdu_buffer_size);
rb->recv_pdu(rb, (char *)sdu_buffer->data, sdu_buffer_size);
} else {
LOG_E(PDCP, "%s:%d:%s: fatal: no RB found (rb_id %ld, srb_flag %d)\n",
__FILE__, __LINE__, __FUNCTION__, rb_id, srb_flagP);
......@@ -816,7 +858,6 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
break;
switch (ITTI_MSG_ID(msg_p)) {
case RRC_DCCH_DATA_REQ:
LOG_I(PDCP, "Received message %s\n", ITTI_MSG_NAME(msg_p));
PROTOCOL_CTXT_SET_BY_MODULE_ID(
&ctxt,
RRC_DCCH_DATA_REQ(msg_p).module_id,
......@@ -826,7 +867,7 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
0,
RRC_DCCH_DATA_REQ(msg_p).eNB_index);
result = pdcp_data_req(&ctxt,
SRB_FLAG_YES,//not used, use lcid to check
SRB_FLAG_YES,
RRC_DCCH_DATA_REQ(msg_p).rb_id,
RRC_DCCH_DATA_REQ(msg_p).muip,
RRC_DCCH_DATA_REQ(msg_p).confirmp,
......@@ -854,8 +895,6 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s)
int srb_id = s->srb_Identity;
printf("\n\n################# rnti %d add srb %d\n\n\n", rnti, srb_id);
if (srb_id > 3) {
LOG_E(PDCP, "%s:%d:%s: fatal, bad srb id %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id);
......@@ -871,7 +910,7 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s)
pdcp_srb = new_nr_pdcp_entity_srb(1, srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue);
nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb);
LOG_I(PDCP, "%s:%d:%s: added srb %d to ue %d\n",
LOG_I(PDCP, "%s:%d:%s: added srb %d to ue 0x%x\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
}
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
......@@ -918,7 +957,7 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
ciphering_key, integrity_key);
nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb);
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
}
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
......@@ -946,7 +985,7 @@ static void add_drb(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}
LOG_I(PDCP, "%s:%s:%d: added DRB for UE RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
LOG_I(PDCP, "%s:%s:%d: added DRB for UE RNTI 0x%x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
}
boolean_t nr_rrc_pdcp_config_asn1_req(
......@@ -1036,8 +1075,7 @@ void nr_DRB_preconfiguration(uint16_t crnti)
{
NR_RadioBearerConfig_t *rbconfig = NULL;
struct NR_CellGroupConfig__rlc_BearerToAddModList *Rlc_DRB_Bearer_ToAdd_list = NULL;
struct NR_CellGroupConfig__rlc_BearerToAddModList *Rlc_SRB_Bearer_ToAdd_list = NULL;
struct NR_CellGroupConfig__rlc_BearerToAddModList *Rlc_Bearer_ToAdd_list = NULL;
protocol_ctxt_t ctxt;
//fill_default_rbconfig(rb_config, 5, 1);
rbconfig = calloc(1, sizeof(*rbconfig));
......@@ -1049,9 +1087,6 @@ void nr_DRB_preconfiguration(uint16_t crnti)
srb_ToAddMod->discardOnPDCP = NULL;
srb_ToAddMod->pdcp_Config = NULL;
ASN_SEQUENCE_ADD(&rbconfig->srb_ToAddModList->list,srb_ToAddMod);
// srb_ToAddMod = calloc(1,sizeof(*srb_ToAddMod));
// srb_ToAddMod->srb_Identity = 2;
// ASN_SEQUENCE_ADD(&rbconfig->srb_ToAddModList->list,srb_ToAddMod);
rbconfig->srb3_ToRelease = NULL;
rbconfig->drb_ToAddModList = calloc(1,sizeof(*rbconfig->drb_ToAddModList));
......@@ -1100,16 +1135,17 @@ void nr_DRB_preconfiguration(uint16_t crnti)
nr_rlc_bearer_init(RLC_SRB_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity);
nr_drb_config(RLC_SRB_BearerConfig->rlc_Config, NR_RLC_Config_PR_am);
nr_rlc_bearer_init_ul_spec(RLC_SRB_BearerConfig->mac_LogicalChannelConfig);
Rlc_SRB_Bearer_ToAdd_list = calloc(1,sizeof(*Rlc_SRB_Bearer_ToAdd_list));
ASN_SEQUENCE_ADD(&Rlc_SRB_Bearer_ToAdd_list->list, RLC_SRB_BearerConfig);
/*Adding DRB RLC configuration to the corresponding list*/
NR_RLC_BearerConfig_t *RLC_DRB_BearerConfig = calloc(1,sizeof(*RLC_DRB_BearerConfig));
nr_rlc_bearer_init(RLC_DRB_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity);
nr_drb_config(RLC_DRB_BearerConfig->rlc_Config, NR_RLC_Config_PR_am);
nr_rlc_bearer_init_ul_spec(RLC_DRB_BearerConfig->mac_LogicalChannelConfig);
Rlc_DRB_Bearer_ToAdd_list = calloc(1,sizeof(*Rlc_DRB_Bearer_ToAdd_list));
ASN_SEQUENCE_ADD(&Rlc_DRB_Bearer_ToAdd_list->list, RLC_DRB_BearerConfig);
Rlc_Bearer_ToAdd_list = calloc(1,sizeof(*Rlc_Bearer_ToAdd_list));
ASN_SEQUENCE_ADD(&Rlc_Bearer_ToAdd_list->list, RLC_SRB_BearerConfig);
ASN_SEQUENCE_ADD(&Rlc_Bearer_ToAdd_list->list, RLC_DRB_BearerConfig);
if (ENB_NAS_USE_TUN){
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_YES, crnti, 0, 0, 0);
......@@ -1140,8 +1176,7 @@ void nr_DRB_preconfiguration(uint16_t crnti)
rbconfig->drb_ToAddModList,
rbconfig->drb_ToReleaseList,
(LTE_PMCH_InfoList_r9_t *) NULL,
Rlc_SRB_Bearer_ToAdd_list,
Rlc_DRB_Bearer_ToAdd_list);
Rlc_Bearer_ToAdd_list);
}
LOG_D(PDCP, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti);
......@@ -1232,7 +1267,7 @@ static boolean_t pdcp_data_req_srb(
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, 0x1234);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
if (rb_id < 1 || rb_id > 3)
rb = NULL;
......@@ -1285,7 +1320,7 @@ static boolean_t pdcp_data_req_drb(
rb = ue->drb[rb_id - 1];
if (rb == NULL) {
LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n",
LOG_E(PDCP, "%s:%d:%s: no DRB found (rnti %d, rb_id %ld)\n",
__FILE__, __LINE__, __FUNCTION__, rnti, rb_id);
return 0;
}
......@@ -1313,12 +1348,10 @@ boolean_t pdcp_data_req(
)
{
if (srb_flagP) {
return pdcp_data_req_srb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size,
sdu_buffer);
return pdcp_data_req_srb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer);
}else{
return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer);
}
// use rbid to check drb or srb.
return pdcp_data_req_drb(ctxt_pP, rb_id - 3, muiP, confirmP, sdu_buffer_size,
sdu_buffer);
}
void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind)
......
......@@ -85,7 +85,7 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, int rnti)
if (m->ue_list[i]->rnti == rnti)
return m->ue_list[i];
LOG_D(PDCP, "%s:%d:%s: new UE %d\n", __FILE__, __LINE__, __FUNCTION__, rnti);
LOG_D(PDCP, "%s:%d:%s: new UE 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
m->ue_count++;
m->ue_list = realloc(m->ue_list, sizeof(nr_pdcp_ue_t *) * m->ue_count);
......
......@@ -447,7 +447,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
exit(1);
rb_found:
LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d \n",
LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d",
__FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size);
memblock = get_free_mem_block(size, __func__);
......@@ -637,7 +637,7 @@ rb_found:
#endif
}
static void add_srb_am(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
static void add_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
nr_rlc_entity_t *nr_rlc_am;
nr_rlc_ue_t *ue;
......@@ -645,6 +645,7 @@ static void add_srb_am(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int srb_id = s->srb_Identity;
int channel_id = rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group;
int t_status_prohibit;
......@@ -655,12 +656,18 @@ static void add_srb_am(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_
int t_reassembly;
int sn_field_length;
if (srb_id > 3) {
if (srb_id != 1 && srb_id != 2) {
LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id);
exit(1);
}
if (channel_id != srb_id) {
LOG_E(RLC, "%s:%d:%s: todo, remove this limitation\n",
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
/* TODO: accept other values? */
......@@ -694,7 +701,7 @@ static void add_srb_am(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->srb[srb_id-1] != NULL) {
LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI 0x%x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} else {
/* hack: hardcode values for NR */
t_poll_retransmit = 45;
......@@ -715,26 +722,11 @@ static void add_srb_am(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_
sn_field_length);
nr_rlc_ue_add_srb_rlc_entity(ue, srb_id, nr_rlc_am);
LOG_D(RLC, "%s:%d:%s: added srb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
LOG_I(RLC, "%s:%d:%s: added srb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void add_srb(int rnti, struct NR_SRB_ToAddMod *s, struct NR_RLC_BearerConfig *rlc_BearerConfig)
{
switch (rlc_BearerConfig->rlc_Config->present) {
case NR_RLC_Config_PR_am:
add_srb_am(rnti, s, rlc_BearerConfig);
break;
/*Missing case for RLC TM corresponding to SRB0 */
default:
LOG_E(RLC, "%s:%d:%s: fatal: unhandled SRB type\n",
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}
LOG_I(RLC, "%s:%s:%d: added SRB to UE with RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
}
static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
nr_rlc_entity_t *nr_rlc_am;
......@@ -812,7 +804,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
sn_field_length);
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_am);
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(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);
}
......@@ -880,7 +872,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
sn_field_length);
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 %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(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);
}
......@@ -899,7 +891,7 @@ static void add_drb(int rnti, struct NR_DRB_ToAddMod *s, struct NR_RLC_BearerCon
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}
LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI 0x%x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
}
/* Dummy function due to dependency from LTE libraries */
......@@ -919,11 +911,10 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_srb_bearer2add_list,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_drb_bearer2add_list)
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list)
{
int rnti = ctxt_pP->rnti;
int i;
int i,j;
if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*||
ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 ||
......@@ -946,15 +937,30 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
if (srb2add_listP != NULL) {
for (i = 0; i < srb2add_listP->list.count; i++) {
if(rlc_srb_bearer2add_list != NULL)
add_srb(rnti, srb2add_listP->list.array[i], rlc_srb_bearer2add_list->list.array[i]);
for(j = 0; j < rlc_bearer2add_list->list.count; j++){
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity){
if(srb2add_listP->list.array[i]->srb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.srb_Identity){
add_srb(rnti, srb2add_listP->list.array[i], rlc_bearer2add_list->list.array[j]);
}
}
}
}
if (drb2add_listP != NULL) {
}
}
if ((drb2add_listP != NULL) && (rlc_bearer2add_list != NULL)) {
for (i = 0; i < drb2add_listP->list.count; i++) {
if(rlc_drb_bearer2add_list != NULL)
add_drb(rnti, drb2add_listP->list.array[i], rlc_drb_bearer2add_list->list.array[i]);
for(j = 0; j < rlc_bearer2add_list->list.count; j++){
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){
if(drb2add_listP->list.array[i]->drb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.drb_Identity){
add_drb(rnti, drb2add_listP->list.array[i], rlc_bearer2add_list->list.array[j]);
}
}
}
}
}
}
......
......@@ -85,7 +85,7 @@ nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int rnti)
if (m->ue_list[i]->rnti == rnti)
return m->ue_list[i];
LOG_D(RLC, "%s:%d:%s: new UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
LOG_D(RLC, "%s:%d:%s: new UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
m->ue_count++;
m->ue_list = realloc(m->ue_list, sizeof(nr_rlc_ue_t *) * m->ue_count);
......
......@@ -25,10 +25,10 @@ gNBs =
local_s_if_name = "lo";
remote_s_address = "127.0.0.3";
local_s_address = "127.0.0.4";
local_s_portc = 38472; #501;
remote_s_portc = 57113; #500;
local_s_portd = 2152; #601;
remote_s_portd = 2152; #600;
local_s_portc = 501;
remote_s_portc = 500;
local_s_portd = 601;
remote_s_portd = 600;
////////// Physical parameters:
......
......@@ -230,12 +230,12 @@ MACRLCs = (
tr_s_preference = "local_L1";
tr_n_preference = "f1";
local_n_if_name = "lo";
remote_n_address = "127.0.0.4"; #"127.0.0.4"; "192.168.12.75";
local_n_address = "127.0.0.3"; #"127.0.0.3"; "192.168.12.188";
local_n_portc = 57113; #500
remote_n_portc = 38472; #501;
local_n_portd = 2152;#600;
remote_n_portd = 2152; #601;
remote_n_address = "127.0.0.4";
local_n_address = "127.0.0.3";
local_n_portc = 500;
remote_n_portc = 501;
local_n_portd = 600;
remote_n_portd = 601;
}
);
......
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