Commit cff0675e authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/srb0-use-rlc' into integration_2022_wk48

parents d3ac2bf1 3cd4b3c3
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
#include "UTIL/OPT/opt.h" #include "UTIL/OPT/opt.h"
#include "SIMULATION/TOOLS/sim.h" // for taus #include "SIMULATION/TOOLS/sim.h" // for taus
/* rlc */
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include <executables/softmodem-common.h> #include <executables/softmodem-common.h>
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
extern const uint8_t nr_slots_per_frame[5]; extern const uint8_t nr_slots_per_frame[5];
...@@ -1418,9 +1421,19 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1418,9 +1421,19 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
int current_harq_pid = sched_ctrl->retrans_dl_harq.head; int current_harq_pid = sched_ctrl->retrans_dl_harq.head;
if (ra->msg3_dcch_dtch == false && current_harq_pid < 0) { if (ra->msg3_dcch_dtch == false && current_harq_pid < 0) {
mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, NULL); /* need to wait until RRCSetup is ready */
if (mac_sdu_length <= 0) mac_rlc_status_resp_t srb0_status = mac_rlc_status_ind(module_idP,
return; // need to wait until RRCSetup is encoded ra->rnti,
module_idP,
frameP,
slotP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
0 /* lcid 0 */,
0,
0);
if (srb0_status.bytes_in_buffer == 0) return;
mac_sdu_length = srb0_status.bytes_in_buffer;
} }
long BWPStart = 0; long BWPStart = 0;
...@@ -1559,7 +1572,17 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1559,7 +1572,17 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length); LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length);
uint8_t buffer[CCCH_SDU_SIZE]; uint8_t buffer[CCCH_SDU_SIZE];
uint8_t mac_subheader_len = sizeof(NR_MAC_SUBHEADER_SHORT); uint8_t mac_subheader_len = sizeof(NR_MAC_SUBHEADER_SHORT);
uint16_t mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, buffer); mac_sdu_length = mac_rlc_data_req(module_idP,
ra->rnti,
module_idP,
frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
CCCH,
CCCH_SDU_SIZE,
(char *)buffer,
0,
0);
if (mac_sdu_length < 256) { if (mac_sdu_length < 256) {
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0; ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0;
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->F = 0; ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->F = 0;
......
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
#include "OCG.h" #include "OCG.h"
#include "OCG_extern.h" #include "OCG_extern.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
/* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */ /* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */
#include "RRC/LTE/rrc_extern.h" #include "RRC/LTE/rrc_extern.h"
#include "RRC/NR/nr_rrc_extern.h" #include "RRC/NR/nr_rrc_extern.h"
...@@ -2700,28 +2702,30 @@ void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { ...@@ -2700,28 +2702,30 @@ void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) {
void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti) void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti)
{ {
NR_UEs_t *UE_info = &nr_mac->UE_info; nr_rlc_remove_ue(rnti);
pthread_mutex_lock(&UE_info->mutex);
UE_iterator(UE_info->list, UE) { NR_UEs_t *UE_info = &nr_mac->UE_info;
if (UE->rnti==rnti) pthread_mutex_lock(&UE_info->mutex);
break; UE_iterator(UE_info->list, UE) {
} if (UE->rnti==rnti)
break;
if (!UE) { }
LOG_W(NR_MAC,"Call to del rnti %04x, but not existing\n", rnti);
pthread_mutex_unlock(&UE_info->mutex); if (!UE) {
return; LOG_W(NR_MAC,"Call to del rnti %04x, but not existing\n", rnti);
} pthread_mutex_unlock(&UE_info->mutex);
return;
NR_UE_info_t * newUEs[MAX_MOBILES_PER_GNB+1]={0}; }
int newListIdx=0;
for (int i=0; i<MAX_MOBILES_PER_GNB; i++) NR_UE_info_t * newUEs[MAX_MOBILES_PER_GNB+1]={0};
if(UE_info->list[i] && UE_info->list[i]->rnti != rnti) int newListIdx=0;
newUEs[newListIdx++]=UE_info->list[i]; for (int i=0; i<MAX_MOBILES_PER_GNB; i++)
memcpy(UE_info->list, newUEs, sizeof(UE_info->list)); if(UE_info->list[i] && UE_info->list[i]->rnti != rnti)
pthread_mutex_unlock(&UE_info->mutex); newUEs[newListIdx++]=UE_info->list[i];
memcpy(UE_info->list, newUEs, sizeof(UE_info->list));
delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator); pthread_mutex_unlock(&UE_info->mutex);
delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator);
} }
void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti) { void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti) {
...@@ -3097,15 +3101,14 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCom ...@@ -3097,15 +3101,14 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCom
void send_initial_ul_rrc_message(module_id_t module_id, void send_initial_ul_rrc_message(module_id_t module_id,
int CC_id, int CC_id,
const NR_UE_info_t *UE, int rnti,
rb_id_t srb_id, int uid,
const uint8_t *sdu, const uint8_t *sdu,
sdu_size_t sdu_len) { sdu_size_t sdu_len) {
const gNB_MAC_INST *mac = RC.nrmac[module_id]; const gNB_MAC_INST *mac = RC.nrmac[module_id];
const rnti_t rnti = UE->rnti;
LOG_W(MAC, LOG_W(MAC,
"[RAPROC] Received SDU for CCCH on SRB %ld length %d for UE %04x\n", "[RAPROC] Received SDU for CCCH length %d for UE %04x\n",
srb_id, sdu_len, rnti); sdu_len, rnti);
/* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */ /* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */
if (NODE_IS_DU(RC.nrrrc[module_id]->node_type)) { if (NODE_IS_DU(RC.nrrrc[module_id]->node_type)) {
...@@ -3113,14 +3116,13 @@ void send_initial_ul_rrc_message(module_id_t module_id, ...@@ -3113,14 +3116,13 @@ void send_initial_ul_rrc_message(module_id_t module_id,
ue_context_p->ue_id_rnti = rnti; ue_context_p->ue_id_rnti = rnti;
ue_context_p->ue_context.rnti = rnti; ue_context_p->ue_context.rnti = rnti;
ue_context_p->ue_context.random_ue_identity = rnti; ue_context_p->ue_context.random_ue_identity = rnti;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_id]->rrc_ue_head, ue_context_p); RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_id]->rrc_ue_head, ue_context_p);
} }
const NR_ServingCellConfigCommon_t *scc = RC.nrrrc[module_id]->carrier.servingcellconfigcommon; const NR_ServingCellConfigCommon_t *scc = RC.nrrrc[module_id]->carrier.servingcellconfigcommon;
const NR_ServingCellConfig_t *sccd = RC.nrrrc[module_id]->configuration.scd; const NR_ServingCellConfig_t *sccd = RC.nrrrc[module_id]->configuration.scd;
NR_CellGroupConfig_t cellGroupConfig = {0}; NR_CellGroupConfig_t cellGroupConfig = {0};
fill_initial_cellGroupConfig(UE->uid, &cellGroupConfig, scc, sccd, &RC.nrrrc[module_id]->configuration); fill_initial_cellGroupConfig(uid, &cellGroupConfig, scc, sccd, &RC.nrrrc[module_id]->configuration);
uint8_t du2cu_rrc_container[1024]; uint8_t du2cu_rrc_container[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "utils.h" #include "utils.h"
#include <openair2/UTIL/OPT/opt.h> #include <openair2/UTIL/OPT/opt.h>
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
//#define SRS_IND_DEBUG //#define SRS_IND_DEBUG
...@@ -363,12 +364,19 @@ int nr_process_mac_pdu(instance_t module_idP, ...@@ -363,12 +364,19 @@ int nr_process_mac_pdu(instance_t module_idP,
mac_len = 6; mac_len = 6;
} }
send_initial_ul_rrc_message(module_idP, nr_rlc_activate_srb0(UE->rnti, module_idP, CC_id, UE->uid, send_initial_ul_rrc_message);
CC_id,
UE, mac_rlc_data_ind(module_idP,
CCCH, UE->rnti,
pduP + mac_subheader_len, module_idP,
mac_len); frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
0,
(char *) (pduP + mac_subheader_len),
mac_len,
1,
NULL);
break; break;
case UL_SCH_LCID_DTCH ... (UL_SCH_LCID_DTCH + 28): case UL_SCH_LCID_DTCH ... (UL_SCH_LCID_DTCH + 28):
......
...@@ -510,8 +510,8 @@ void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sche ...@@ -510,8 +510,8 @@ void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sche
void send_initial_ul_rrc_message(module_id_t module_id, void send_initial_ul_rrc_message(module_id_t module_id,
int CC_id, int CC_id,
const NR_UE_info_t *UE, int rnti,
rb_id_t srb_id, int uid,
const uint8_t *sdu, const uint8_t *sdu,
sdu_size_t sdu_len); sdu_size_t sdu_len);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "mac_proto.h" #include "mac_proto.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "NR_RRCSetup.h" #include "NR_RRCSetup.h"
#include "NR_DL-CCCH-Message.h" #include "NR_DL-CCCH-Message.h"
...@@ -111,13 +112,10 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t * ...@@ -111,13 +112,10 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t *
gNB_RRC_INST *rrc = RC.nrrrc[module_id]; gNB_RRC_INST *rrc = RC.nrrrc[module_id];
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, dl_rrc->rnti); struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, dl_rrc->rnti);
gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList; ue_p->SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList;
ue_context_p->ue_context.masterCellGroup = cellGroup; ue_p->masterCellGroup = cellGroup;
/* TODO: this should pass through RLC and NOT the RRC with a shared buffer */ nr_rlc_srb0_recv_sdu(dl_rrc->rnti, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n");
memcpy(ue_p->Srb0.Tx_buffer.Payload, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
ue_p->Srb0.Tx_buffer.payload_size = dl_rrc->rrc_container_length;
protocol_ctxt_t ctxt = { .module_id = module_id, .rnti = dl_rrc->rnti }; protocol_ctxt_t ctxt = { .module_id = module_id, .rnti = dl_rrc->rnti };
nr_rrc_rlc_config_asn1_req(&ctxt, nr_rrc_rlc_config_asn1_req(&ctxt,
......
...@@ -164,9 +164,10 @@ void mac_rlc_data_ind ( ...@@ -164,9 +164,10 @@ void mac_rlc_data_ind (
LOG_I(RLC, "RLC instance for the given UE was not found \n"); LOG_I(RLC, "RLC instance for the given UE was not found \n");
switch (channel_idP) { switch (channel_idP) {
case 1 ... 3: rb = ue->srb[channel_idP - 1]; break; case 0: rb = ue->srb0; break;
case 1 ... 3: rb = ue->srb[channel_idP - 1]; break;
case 4 ... 32: rb = ue->drb[channel_idP - 4]; break; case 4 ... 32: rb = ue->drb[channel_idP - 4]; break;
default: rb = NULL; break; default: rb = NULL; break;
} }
if (rb != NULL) { if (rb != NULL) {
...@@ -205,7 +206,8 @@ tbs_size_t mac_rlc_data_req( ...@@ -205,7 +206,8 @@ tbs_size_t mac_rlc_data_req(
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP);
switch (channel_idP) { switch (channel_idP) {
case 1 ... 3: rb = ue->srb[channel_idP - 1]; break; case 0: rb = ue->srb0; break;
case 1 ... 3: rb = ue->srb[channel_idP - 1]; break;
case 4 ... 32: rb = ue->drb[channel_idP - 4]; break; case 4 ... 32: rb = ue->drb[channel_idP - 4]; break;
default: default:
rb = NULL; rb = NULL;
...@@ -253,9 +255,10 @@ mac_rlc_status_resp_t mac_rlc_status_ind( ...@@ -253,9 +255,10 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP);
switch (channel_idP) { switch (channel_idP) {
case 1 ... 3: rb = ue->srb[channel_idP - 1]; break; case 0: rb = ue->srb0; break;
case 1 ... 3: rb = ue->srb[channel_idP - 1]; break;
case 4 ... NGAP_MAX_DRBS_PER_UE: rb = ue->drb[channel_idP - 4]; break; case 4 ... NGAP_MAX_DRBS_PER_UE: rb = ue->drb[channel_idP - 4]; break;
default: rb = NULL; break; default: rb = NULL; break;
} }
if (rb != NULL) { if (rb != NULL) {
...@@ -271,7 +274,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( ...@@ -271,7 +274,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
+ buf_stat.retx_size + buf_stat.retx_size
+ buf_stat.tx_size; + buf_stat.tx_size;
} else { } else {
if (!(frameP%128)) //to suppress this warning message if (!(frameP%128) || channel_idP == 0) //to suppress this warning message
LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP);
ret.bytes_in_buffer = 0; ret.bytes_in_buffer = 0;
} }
...@@ -1017,6 +1020,66 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt ...@@ -1017,6 +1020,66 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
struct srb0_data {
int module_id;
int CC_id;
int rnti;
int uid;
void (*send_initial_ul_rrc_message)(module_id_t module_id,
int CC_id,
int rnti,
int uid,
const uint8_t *sdu,
sdu_size_t sdu_len);
};
void deliver_sdu_srb0(void *deliver_sdu_data, struct nr_rlc_entity_t *entity,
char *buf, int size)
{
struct srb0_data *s0 = (struct srb0_data *)deliver_sdu_data;
s0->send_initial_ul_rrc_message(s0->module_id, s0->CC_id, s0->rnti, s0->uid,
(unsigned char *)buf, size);
}
void nr_rlc_activate_srb0(int rnti, int module_id, int cc_id, int uid,
void (*send_initial_ul_rrc_message)(
module_id_t module_id,
int CC_id,
int rnti,
int uid,
const uint8_t *sdu,
sdu_size_t sdu_len))
{
nr_rlc_entity_t *nr_rlc_tm;
nr_rlc_ue_t *ue;
struct srb0_data *srb0_data;
srb0_data = calloc(1, sizeof(struct srb0_data));
AssertFatal(srb0_data != NULL, "out of memory\n");
srb0_data->module_id = module_id;
srb0_data->CC_id = cc_id;
srb0_data->rnti = rnti;
srb0_data->uid = uid;
srb0_data->send_initial_ul_rrc_message = send_initial_ul_rrc_message;
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->srb0 != NULL) {
LOG_W(RLC, "SRB0 already exists for UE with RNTI 0x%x, do nothing\n", rnti);
free(srb0_data);
nr_rlc_manager_unlock(nr_rlc_ue_manager);
return;
}
nr_rlc_tm = new_nr_rlc_entity_tm(10000,
deliver_sdu_srb0, srb0_data);
nr_rlc_ue_add_srb_rlc_entity(ue, 0, nr_rlc_tm);
LOG_I(RLC, "activated srb0 for UE with RNTI 0x%x\n", rnti);
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
rlc_op_status_t rrc_rlc_config_req ( rlc_op_status_t rrc_rlc_config_req (
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP, const srb_flag_t srb_flagP,
...@@ -1081,13 +1144,17 @@ void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t r ...@@ -1081,13 +1144,17 @@ void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t r
/* nothing to do */ /* nothing to do */
} }
rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x) void nr_rlc_remove_ue(int rnti)
{ {
LOG_D(RLC, "%s:%d:%s: remove UE %d\n", __FILE__, __LINE__, __FUNCTION__, x->rnti); LOG_W(RLC, "remove UE %x\n", rnti);
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_manager_remove_ue(nr_rlc_ue_manager, x->rnti); nr_rlc_manager_remove_ue(nr_rlc_ue_manager, rnti);
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
{
nr_rlc_remove_ue(x->rnti);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
...@@ -1173,3 +1240,22 @@ const bool nr_rlc_get_statistics( ...@@ -1173,3 +1240,22 @@ const bool nr_rlc_get_statistics(
return ret; return ret;
} }
void nr_rlc_srb0_recv_sdu(int rnti, unsigned char *buf, int size)
{
nr_rlc_ue_t *ue;
nr_rlc_entity_t *rb;
T(T_ENB_RLC_DL, T_INT(0), T_INT(rnti), T_INT(0), T_INT(size));
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
rb = ue->srb0;
AssertFatal(rb != NULL, "SDU sent to unknown RB rnti %d srb0\n", rnti);
rb->set_time(rb, nr_rlc_current_time);
rb->recv_sdu(rb, (char *)buf, size, -1);
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
...@@ -48,6 +48,8 @@ void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config ...@@ -48,6 +48,8 @@ void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config
void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChannelConfig); void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChannelConfig);
void nr_rlc_remove_ue(int rnti);
int nr_rlc_get_available_tx_space( int nr_rlc_get_available_tx_space(
const rnti_t rntiP, const rnti_t rntiP,
const logical_chan_id_t channel_idP); const logical_chan_id_t channel_idP);
...@@ -56,3 +58,14 @@ void nr_rlc_activate_avg_time_to_tx( ...@@ -56,3 +58,14 @@ void nr_rlc_activate_avg_time_to_tx(
const rnti_t rnti, const rnti_t rnti,
const logical_chan_id_t channel_id, const logical_chan_id_t channel_id,
const bool is_on); const bool is_on);
void nr_rlc_srb0_recv_sdu(int rnti, unsigned char *buf, int size);
void nr_rlc_activate_srb0(int rnti, int module_id, int cc_id, int uid,
void (*send_initial_ul_rrc_message)(
module_id_t module_id,
int CC_id,
int rnti,
int uid,
const uint8_t *sdu,
sdu_size_t sdu_len));
...@@ -117,7 +117,7 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti) ...@@ -117,7 +117,7 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti)
break; break;
if (i == m->ue_count) { if (i == m->ue_count) {
LOG_W(RLC, "%s:%d:%s: warning: ue %d not found\n", LOG_W(RLC, "%s:%d:%s: warning: ue %x not found\n",
__FILE__, __LINE__, __FUNCTION__, __FILE__, __LINE__, __FUNCTION__,
rnti); rnti);
return; return;
...@@ -125,11 +125,17 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti) ...@@ -125,11 +125,17 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti)
ue = m->ue_list[i]; ue = m->ue_list[i];
for (j = 0; j < 2; j++) if (ue->srb0 != NULL) {
/* deliver_sdu_data for srb0 is allocated, needs a free() */
free(ue->srb0->deliver_sdu_data);
ue->srb0->delete(ue->srb0);
}
for (j = 0; j < 3; j++)
if (ue->srb[j] != NULL) if (ue->srb[j] != NULL)
ue->srb[j]->delete(ue->srb[j]); ue->srb[j]->delete(ue->srb[j]);
for (j = 0; j < 5; j++) for (j = 0; j < MAX_DRBS_PER_UE; j++)
if (ue->drb[j] != NULL) if (ue->drb[j] != NULL)
ue->drb[j]->delete(ue->drb[j]); ue->drb[j]->delete(ue->drb[j]);
...@@ -154,11 +160,23 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti) ...@@ -154,11 +160,23 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti)
/* must be called with lock acquired */ /* must be called with lock acquired */
void nr_rlc_ue_add_srb_rlc_entity(nr_rlc_ue_t *ue, int srb_id, nr_rlc_entity_t *entity) void nr_rlc_ue_add_srb_rlc_entity(nr_rlc_ue_t *ue, int srb_id, nr_rlc_entity_t *entity)
{ {
if (srb_id < 1 || srb_id > 2) { if (srb_id < 0 || srb_id > 3) {
LOG_E(RLC, "%s:%d:%s: fatal, bad srb id\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(RLC, "%s:%d:%s: fatal, bad srb id\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
/* special case: srb0 */
if (srb_id == 0) {
if (ue->srb0 != NULL) {
LOG_E(RLC, "fatal, srb0 already present\n");
exit(1);
}
ue->srb0 = entity;
return;
}
srb_id--; srb_id--;
if (ue->srb[srb_id] != NULL) { if (ue->srb[srb_id] != NULL) {
...@@ -173,7 +191,7 @@ void nr_rlc_ue_add_srb_rlc_entity(nr_rlc_ue_t *ue, int srb_id, nr_rlc_entity_t * ...@@ -173,7 +191,7 @@ void nr_rlc_ue_add_srb_rlc_entity(nr_rlc_ue_t *ue, int srb_id, nr_rlc_entity_t *
/* must be called with lock acquired */ /* must be called with lock acquired */
void nr_rlc_ue_add_drb_rlc_entity(nr_rlc_ue_t *ue, int drb_id, nr_rlc_entity_t *entity) void nr_rlc_ue_add_drb_rlc_entity(nr_rlc_ue_t *ue, int drb_id, nr_rlc_entity_t *entity)
{ {
if (drb_id < 1 || drb_id > 5) { if (drb_id < 1 || drb_id > MAX_DRBS_PER_UE) {
LOG_E(RLC, "%s:%d:%s: fatal, bad drb id\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(RLC, "%s:%d:%s: fatal, bad drb id\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
......
...@@ -28,6 +28,7 @@ typedef void nr_rlc_ue_manager_t; ...@@ -28,6 +28,7 @@ typedef void nr_rlc_ue_manager_t;
typedef struct nr_rlc_ue_t { typedef struct nr_rlc_ue_t {
int rnti; int rnti;
nr_rlc_entity_t *srb0;
nr_rlc_entity_t *srb[3]; nr_rlc_entity_t *srb[3];
nr_rlc_entity_t *drb[MAX_DRBS_PER_UE]; nr_rlc_entity_t *drb[MAX_DRBS_PER_UE];
} nr_rlc_ue_t; } nr_rlc_ue_t;
......
...@@ -161,29 +161,7 @@ uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -161,29 +161,7 @@ uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
// CCCH // CCCH
if ((Srb_id & RAB_OFFSET) == CCCH) { if ((Srb_id & RAB_OFFSET) == CCCH) {
LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); AssertFatal(0, "CCCH is managed by rlc of srb 0, not anymore by mac_rrc_nr_data_req\n");
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_idP], rnti);
LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id);
if (ue_context_p == NULL) {
if(buffer_pP != NULL)
LOG_E(NR_RRC,"[gNB %d] Frame %d CCCH request but no ue_context\n", Mod_idP, frameP);
return 0;
}
uint16_t payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size;
if (buffer_pP == NULL)
return payload_size;
// check if data is there for MAC
if (payload_size > 0) {
char *payload_pP = ue_context_p->ue_context.Srb0.Tx_buffer.Payload;
LOG_D(NR_RRC,"[gNB %d] CCCH has %d bytes (dest: %p, src %p)\n", Mod_idP, payload_size, buffer_pP, payload_pP);
// Fill buffer
memcpy((void *)buffer_pP, (void*)payload_pP, payload_size);
ue_context_p->ue_context.Srb0.Tx_buffer.payload_size = 0;
}
return payload_size;
} }
return 0; return 0;
......
...@@ -726,11 +726,11 @@ void do_SpCellConfig(gNB_RRC_INST *rrc, ...@@ -726,11 +726,11 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t do_RRCReject(uint8_t Mod_id, int do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer) uint8_t *const buffer)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
asn_enc_rval_t enc_rval;; asn_enc_rval_t enc_rval;
NR_DL_CCCH_Message_t dl_ccch_msg; NR_DL_CCCH_Message_t dl_ccch_msg;
NR_RRCReject_t *rrcReject; NR_RRCReject_t *rrcReject;
NR_RejectWaitTime_t waitTime = 1; NR_RejectWaitTime_t waitTime = 1;
...@@ -767,7 +767,7 @@ uint8_t do_RRCReject(uint8_t Mod_id, ...@@ -767,7 +767,7 @@ uint8_t do_RRCReject(uint8_t Mod_id,
LOG_D(NR_RRC,"RRCReject Encoded %zd bits (%zd bytes)\n", LOG_D(NR_RRC,"RRCReject Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8); enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return (enc_rval.encoded + 7) / 8;
} }
void fill_initial_SpCellConfig(int uid, void fill_initial_SpCellConfig(int uid,
......
...@@ -72,8 +72,8 @@ uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, ...@@ -72,8 +72,8 @@ uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier,
void do_SpCellConfig(gNB_RRC_INST *rrc, void do_SpCellConfig(gNB_RRC_INST *rrc,
struct NR_SpCellConfig *spconfig); struct NR_SpCellConfig *spconfig);
uint8_t do_RRCReject(uint8_t Mod_id, int do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer); uint8_t *const buffer);
void fill_initial_SpCellConfig(int uid, void fill_initial_SpCellConfig(int uid,
NR_SpCellConfig_t *SpCellConfig, NR_SpCellConfig_t *SpCellConfig,
......
...@@ -286,7 +286,6 @@ typedef struct gNB_RRC_UE_s { ...@@ -286,7 +286,6 @@ typedef struct gNB_RRC_UE_s {
uint8_t DRB_active[NGAP_MAX_DRBS_PER_UE]; uint8_t DRB_active[NGAP_MAX_DRBS_PER_UE];
NR_SRB_INFO SI; NR_SRB_INFO SI;
NR_SRB_INFO Srb0;
NR_SRB_INFO_TABLE_ENTRY Srb1; NR_SRB_INFO_TABLE_ENTRY Srb1;
NR_SRB_INFO_TABLE_ENTRY Srb2; NR_SRB_INFO_TABLE_ENTRY Srb2;
NR_MeasConfig_t *measConfig; NR_MeasConfig_t *measConfig;
...@@ -452,7 +451,6 @@ typedef struct { ...@@ -452,7 +451,6 @@ typedef struct {
NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1; NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1;
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
NR_SRB_INFO SI; NR_SRB_INFO SI;
NR_SRB_INFO Srb0;
int p_gNB; int p_gNB;
} rrc_gNB_carrier_data_t; } rrc_gNB_carrier_data_t;
......
...@@ -138,8 +138,6 @@ void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) { ...@@ -138,8 +138,6 @@ void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) {
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP)); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.SI, BCCH, 1); rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.SI, BCCH, 1);
RC.nrrrc[ctxt_pP->module_id]->carrier.SI.Active = 1; RC.nrrrc[ctxt_pP->module_id]->carrier.SI.Active = 1;
rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.Srb0, CCCH, 1);
RC.nrrrc[ctxt_pP->module_id]->carrier.Srb0.Active = 1;
} }
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
...@@ -229,7 +227,6 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu ...@@ -229,7 +227,6 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
AssertFatal(configuration!=NULL,"configuration input is null\n"); AssertFatal(configuration!=NULL,"configuration input is null\n");
rrc->module_id = gnb_mod_idP; rrc->module_id = gnb_mod_idP;
rrc->Nb_ue = 0; rrc->Nb_ue = 0;
rrc->carrier.Srb0.Active = 0;
rrc_gNB_mac_rrc_init(rrc); rrc_gNB_mac_rrc_init(rrc);
uid_linear_allocator_init(&rrc->uid_allocator); uid_linear_allocator_init(&rrc->uid_allocator);
RB_INIT(&rrc->rrc_ue_head); RB_INIT(&rrc->rrc_ue_head);
...@@ -355,19 +352,22 @@ rrc_gNB_generate_RRCSetup( ...@@ -355,19 +352,22 @@ rrc_gNB_generate_RRCSetup(
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
unsigned char buf[1024];
const NR_ServingCellConfig_t *sccd = rrc->configuration.scd; const NR_ServingCellConfig_t *sccd = rrc->configuration.scd;
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, int size = do_RRCSetup(ue_context_pP,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload, buf,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
masterCellGroup, masterCellGroup,
masterCellGroup_len, masterCellGroup_len,
scc, scc,
sccd, sccd,
&rrc->configuration); &rrc->configuration);
AssertFatal(size > 0, "do_RRCSetup failed\n");
AssertFatal(size <= 1024, "memory corruption\n");
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload), (char *)buf,
ue_p->Srb0.Tx_buffer.payload_size, size,
"[MSG] RRC Setup\n"); "[MSG] RRC Setup\n");
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
...@@ -380,8 +380,8 @@ rrc_gNB_generate_RRCSetup( ...@@ -380,8 +380,8 @@ rrc_gNB_generate_RRCSetup(
f1ap_dl_rrc_message_t dl_rrc = { f1ap_dl_rrc_message_t dl_rrc = {
.old_gNB_DU_ue_id = 0xFFFFFF, .old_gNB_DU_ue_id = 0xFFFFFF,
.rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload, .rrc_container = buf,
.rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size, .rrc_container_length = size,
.rnti = ue_p->rnti, .rnti = ue_p->rnti,
.srb_id = CCCH .srb_id = CCCH
}; };
...@@ -405,22 +405,23 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( ...@@ -405,22 +405,23 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
ue_context_pP = rrc_gNB_get_next_free_ue_context(ctxt_pP, rrc_instance_p, 0); ue_context_pP = rrc_gNB_get_next_free_ue_context(ctxt_pP, rrc_instance_p, 0);
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
int16_t ret = do_RRCSetup(ue_context_pP, unsigned char buf[1024];
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload, int size = do_RRCSetup(ue_context_pP,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), buf,
NULL, rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
0, NULL,
scc, 0,
sccd, scc,
&rrc_instance_p->configuration); sccd,
&rrc_instance_p->configuration);
AssertFatal(ret>0,"Error generating RRCSetup for RRCReestablishmentRequest\n"); AssertFatal(size > 0, "do_RRCSetup failed\n");
AssertFatal(size <= 1024, "memory corruption\n");
ue_p->Srb0.Tx_buffer.payload_size = ret; AssertFatal(size>0,"Error generating RRCSetup for RRCReestablishmentRequest\n");
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload), (char *)buf,
ue_p->Srb0.Tx_buffer.payload_size, size,
"[MSG] RRC Setup\n"); "[MSG] RRC Setup\n");
LOG_D(NR_RRC, LOG_D(NR_RRC,
...@@ -442,13 +443,22 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( ...@@ -442,13 +443,22 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
LOG_I(NR_RRC, LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_p->Srb0.Tx_buffer.payload_size); size);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP->ue_context.ue_release_timer = 1; ue_context_pP->ue_context.ue_release_timer = 1;
// remove UE after 10 frames after RRCConnectionRelease is triggered // remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP->ue_context.ue_release_timer_thres = 1000; ue_context_pP->ue_context.ue_release_timer_thres = 1000;
/* init timers */ /* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
f1ap_dl_rrc_message_t dl_rrc = {
.old_gNB_DU_ue_id = 0xFFFFFF,
.rrc_container = buf,
.rrc_container_length = size,
.rnti = ue_p->rnti,
.srb_id = CCCH
};
rrc_instance_p->mac_rrc.dl_rrc_message_transfer(ctxt_pP->module_id, &dl_rrc);
} }
void void
...@@ -458,53 +468,35 @@ rrc_gNB_generate_RRCReject( ...@@ -458,53 +468,35 @@ rrc_gNB_generate_RRCReject(
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n"); LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n");
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
MessageDef *message_p;
ue_p->Srb0.Tx_buffer.payload_size = do_RRCReject(ctxt_pP->module_id, unsigned char buf[1024];
(uint8_t *)ue_p->Srb0.Tx_buffer.Payload); int size = do_RRCReject(ctxt_pP->module_id, buf);
AssertFatal(size > 0, "do_RRCReject failed\n");
AssertFatal(size <= 1024, "memory corruption\n");
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload), (char *)buf,
ue_p->Srb0.Tx_buffer.payload_size, size,
"[MSG] RRCReject \n"); "[MSG] RRCReject \n");
LOG_I(NR_RRC, LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_p->Srb0.Tx_buffer.payload_size); size);
switch (RC.nrrrc[ctxt_pP->module_id]->node_type) {
case ngran_gNB_CU:
// create an ITTI message
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload;
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
break;
case ngran_gNB_DU: f1ap_dl_rrc_message_t dl_rrc = {
// nothing to do for DU .gNB_CU_ue_id = 0,
AssertFatal(1==0,"nothing to do for DU\n"); .gNB_DU_ue_id = 0,
break; .old_gNB_DU_ue_id = 0xFFFFFF,
.rrc_container = buf,
case ngran_gNB: .rrc_container_length = size,
{ .rnti = ue_p->rnti,
// NOTE: there was ITTI_SIM which has been removed. This case is maybe .srb_id = CCCH,
// not necessary anymore .execute_duplication = 1,
// rrc_mac_config_req_gNB .RAT_frequency_priority_information.en_dc = 0
} };
break; rrc->mac_rrc.dl_rrc_message_transfer(ctxt_pP->module_id, &dl_rrc);
default :
LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type);
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -1472,15 +1464,17 @@ rrc_gNB_generate_RRCReestablishment( ...@@ -1472,15 +1464,17 @@ rrc_gNB_generate_RRCReestablishment(
gNB_RRC_UE_t *ue_context = NULL; gNB_RRC_UE_t *ue_context = NULL;
module_id_t module_id = ctxt_pP->module_id; module_id_t module_id = ctxt_pP->module_id;
// uint16_t rnti = ctxt_pP->rnti; // uint16_t rnti = ctxt_pP->rnti;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
SRB_configList = &(ue_context_pP->ue_context.SRB_configList); SRB_configList = &(ue_context_pP->ue_context.SRB_configList);
//carrier = &(RC.nrrrc[ctxt_pP->module_id]->carrier); //carrier = &(RC.nrrrc[ctxt_pP->module_id]->carrier);
ue_context = &(ue_context_pP->ue_context); ue_context = &(ue_context_pP->ue_context);
ue_context->Srb0.Tx_buffer.payload_size = do_RRCReestablishment(ctxt_pP, unsigned char buf[1024];
int size = do_RRCReestablishment(ctxt_pP,
ue_context_pP, ue_context_pP,
CC_id, CC_id,
(uint8_t *) ue_context->Srb0.Tx_buffer.Payload, buf,
sizeof(ue_context->Srb0.Tx_buffer.Payload), sizeof(buf),
//(uint8_t) carrier->p_gNB, // at this point we do not have the UE capability information, so it can only be TM1 or TM2 //(uint8_t) carrier->p_gNB, // at this point we do not have the UE capability information, so it can only be TM1 or TM2
rrc_gNB_get_next_transaction_identifier(module_id), rrc_gNB_get_next_transaction_identifier(module_id),
SRB_configList SRB_configList
...@@ -1503,7 +1497,7 @@ rrc_gNB_generate_RRCReestablishment( ...@@ -1503,7 +1497,7 @@ rrc_gNB_generate_RRCReestablishment(
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_context->Srb0.Tx_buffer.payload_size); size);
#if(0) #if(0)
/* TODO : It may be needed if gNB goes into full stack working. */ /* TODO : It may be needed if gNB goes into full stack working. */
UE = find_nr_UE(module_id, rnti); UE = find_nr_UE(module_id, rnti);
...@@ -1518,6 +1512,16 @@ rrc_gNB_generate_RRCReestablishment( ...@@ -1518,6 +1512,16 @@ rrc_gNB_generate_RRCReestablishment(
rnti); rnti);
} }
#endif #endif
/* correct? specs say RRCReestablishment goes through srb1... */
f1ap_dl_rrc_message_t dl_rrc = {
.old_gNB_DU_ue_id = 0xFFFFFF,
.rrc_container = buf,
.rrc_container_length = size,
.rnti = ue_context->rnti,
.srb_id = CCCH
};
rrc->mac_rrc.dl_rrc_message_transfer(ctxt_pP->module_id, &dl_rrc);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -1916,12 +1920,6 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, ...@@ -1916,12 +1920,6 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
} }
ue_context_p = rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value); ue_context_p = rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value);
ue_context_p->ue_context.Srb0.Srb_id = 0;
ue_context_p->ue_context.Srb0.Active = 1;
memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload,
buffer,
buffer_length);
ue_context_p->ue_context.Srb0.Rx_buffer.payload_size = buffer_length;
} else if (NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1 == rrcSetupRequest->ue_Identity.present) { } else if (NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1 == rrcSetupRequest->ue_Identity.present) {
/* TODO */ /* TODO */
/* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */ /* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
......
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