Commit 9eac7254 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/simplify-f1-rrc-msg-transfer' into integration_2023_w12

parents e5954f2d 5b8674cc
......@@ -315,7 +315,7 @@ Still on DL (gNB side), PDCP push incoming data into RLC by calling: rlc_data_re
For UL, the low layer push data into rlc by: mac_rlc_data_ind()
Then, rlc push it to pdcp by calling pdcp_data_ind() from a complex rlc internal call back (deliver_sdu())
When adding a UE, external code have to call nr_rrc_rlc_config_asn1_req(), to remove it: rrc_rlc_remove_ue()
When adding a UE, external code have to call `add_rlc_srb()` and/or `add_rlc_drb()`, to remove it: `rrc_rlc_remove_ue()`
Inside UE, channels called drd or srb can be created: ??? and deleted: rrc_rlc_config_req()
nr_rlc_tick() must be called periodically to manage the internal timers
......
......@@ -99,14 +99,9 @@ void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChann
abort();
}
rlc_op_status_t nr_rrc_rlc_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
const NR_SRB_ToAddModList_t *const srb2add_listP,
const NR_DRB_ToAddModList_t *const drb2add_listP,
const NR_DRB_ToReleaseList_t *const drb2release_listP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list)
void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
abort();
return 0;
}
int nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(const protocol_ctxt_t *const ctxt_pP, const gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_p, int offset)
......
......@@ -81,5 +81,3 @@ MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeP
// eNB: RLC -> RRC messages
MESSAGE_DEF(RLC_SDU_INDICATION, MESSAGE_PRIORITY_MED, RlcSduIndication, rlc_sdu_indication)
MESSAGE_DEF(NR_DU_RRC_DL_INDICATION, MESSAGE_PRIORITY_MED, NRDuDlReq_t, nr_du_dl_req)
......@@ -139,19 +139,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
.rnti = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id),
.srb_id = srb_id
};
int rc = dl_rrc_message(instance, &dl_rrc);
if (rc == 0)
return 0; /* has been handled, otherwise continue below */
// decode RRC Container and act on the message type
AssertFatal(srb_id<3,"illegal srb_id\n");
MessageDef *msg = itti_alloc_new_message(TASK_DU_F1, 0, NR_DU_RRC_DL_INDICATION);
NRDuDlReq_t *req=&NRDuDlReq(msg);
req->rnti=f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id);
req->srb_id=srb_id;
req->buf= get_free_mem_block( ie->value.choice.RRCContainer.size, __func__);
memcpy(req->buf->data, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size);
itti_send_msg_to_task(TASK_RRC_GNB, instance, msg);
dl_rrc_message(instance, &dl_rrc);
return 0;
}
......
......@@ -2908,30 +2908,16 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCom
}
}
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) {
const gNB_MAC_INST *mac = RC.nrmac[module_id];
LOG_W(MAC,
"[RAPROC] Received SDU for CCCH length %d for UE %04x\n",
sdu_len, rnti);
/* 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))
rrc_gNB_create_ue_context(rnti, RC.nrrrc[module_id], rnti);
void send_initial_ul_rrc_message(gNB_MAC_INST *mac, int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *rawUE)
{
LOG_W(MAC, "[RAPROC] Received SDU for CCCH length %d for UE %04x\n", sdu_len, rnti);
const NR_ServingCellConfigCommon_t *scc = RC.nrrrc[module_id]->carrier.servingcellconfigcommon;
const NR_ServingCellConfig_t *sccd = RC.nrrrc[module_id]->configuration.scd;
NR_CellGroupConfig_t cellGroupConfig = {0};
fill_initial_cellGroupConfig(uid, &cellGroupConfig, scc, sccd, &RC.nrrrc[module_id]->configuration);
NR_UE_info_t *UE = (NR_UE_info_t *)rawUE;
uint8_t du2cu_rrc_container[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
&cellGroupConfig,
UE->CellGroup,
du2cu_rrc_container,
sizeof(du2cu_rrc_container));
AssertFatal(enc_rval.encoded > 0,
......@@ -2947,5 +2933,48 @@ void send_initial_ul_rrc_message(module_id_t module_id,
.du2cu_rrc_container = (uint8_t *) du2cu_rrc_container,
.du2cu_rrc_container_length = (enc_rval.encoded + 7) / 8
};
mac->mac_rrc.initial_ul_rrc_message_transfer(module_id, &ul_rrc_msg);
mac->mac_rrc.initial_ul_rrc_message_transfer(0, &ul_rrc_msg);
}
void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
{
/* create this UE's initial CellGroup */
/* Note: relying on the RRC is a hack, as we are in the DU; there should be
* no RRC, remove in the future */
module_id_t mod_id = 0;
gNB_RRC_INST *rrc = RC.nrrrc[mod_id];
const NR_ServingCellConfigCommon_t *scc = rrc->carrier.servingcellconfigcommon;
const NR_ServingCellConfig_t *sccd = rrc->configuration.scd;
NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(*cellGroupConfig));
AssertFatal(cellGroupConfig != NULL, "out of memory\n");
fill_initial_cellGroupConfig(UE->uid, cellGroupConfig, scc, sccd, &rrc->configuration);
uint8_t du2cu_rrc_container[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
cellGroupConfig,
du2cu_rrc_container,
sizeof(du2cu_rrc_container));
AssertFatal(enc_rval.encoded > 0,
"Could not encode cellGroupConfig for UE %04x, failed element %s\n",
UE->rnti,
enc_rval.failed_type->name);
UE->CellGroup = cellGroupConfig;
nr_mac_update_cellgroup(mac, UE->rnti, cellGroupConfig);
/* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */
if (NODE_IS_DU(rrc->node_type)) {
rrc_gNB_ue_context_t *ue = rrc_gNB_create_ue_context(UE->rnti, rrc, UE->rnti);
ue->ue_context.masterCellGroup = cellGroupConfig;
}
/* activate SRB0 */
nr_rlc_activate_srb0(UE->rnti, mac, UE, send_initial_ul_rrc_message);
/* the cellGroup sent to CU specifies there is SRB1, so create it */
DevAssert(cellGroupConfig->rlc_BearerToAddModList->list.count == 1);
const NR_RLC_BearerConfig_t *bearer = cellGroupConfig->rlc_BearerToAddModList->list.array[0];
DevAssert(bearer->servedRadioBearer->choice.srb_Identity == 1);
nr_rlc_add_srb(UE->rnti, DCCH, bearer);
}
......@@ -372,8 +372,9 @@ int nr_process_mac_pdu(instance_t module_idP,
mac_len = 6;
}
nr_rlc_activate_srb0(UE->rnti, module_idP, CC_id, UE->uid, send_initial_ul_rrc_message);
LOG_W(MAC, "[RAPROC] Received SDU for CCCH length %d for UE %04x\n", mac_len, UE->rnti);
prepare_initial_ul_rrc_message(RC.nrmac[module_idP], UE);
mac_rlc_data_ind(module_idP,
UE->rnti,
module_idP,
......
......@@ -486,12 +486,8 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl);
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 prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE);
void send_initial_ul_rrc_message(gNB_MAC_INST *mac, int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *rawUE);
void abort_nr_dl_harq(NR_UE_info_t* UE, int8_t harq_pid);
......
......@@ -29,96 +29,10 @@
#include "NR_DL-CCCH-Message.h"
#include "NR_CellGroupConfig.h"
int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t *dl_rrc, NR_RRCSetup_t *rrcSetup);
int dl_rrc_message(module_id_t module_id, const f1ap_dl_rrc_message_t *dl_rrc)
{
/* dispatch message to dl_rrc_message_rrcSetup() and others, similar to as is
* done in the DU (should be the same here) */
LOG_D(NR_MAC, "DL RRC Message Transfer with %d bytes for RNTI %04x SRB %d\n", dl_rrc->rrc_container_length, dl_rrc->rnti, dl_rrc->srb_id);
if (dl_rrc->srb_id == CCCH) { // SRB 0
NR_DL_CCCH_Message_t *dl_ccch_msg = NULL;
asn_dec_rval_t dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_CCCH_Message,
(void **) &dl_ccch_msg,
dl_rrc->rrc_container,
dl_rrc->rrc_container_length,
0,
0);
AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n");
switch (dl_ccch_msg->message.choice.c1->present) {
case NR_DL_CCCH_MessageType__c1_PR_NOTHING:
LOG_W(NR_MAC, "Received NOTHING on DL-CCCH-Message\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_rrcReject:
LOG_D(NR_MAC, "DL-CCCH/SRB0, received rrcReject for RNTI %04x\n", dl_rrc->rnti);
AssertFatal(0, "rrcReject not implemented yet\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_rrcSetup:
LOG_D(NR_MAC, "DL-CCCH/SRB0, received rrcSetup for RNTI %04x\n", dl_rrc->rnti);
return dl_rrc_message_rrcSetup(module_id, dl_rrc, dl_ccch_msg->message.choice.c1->choice.rrcSetup);
break;
case NR_DL_CCCH_MessageType__c1_PR_spare2:
LOG_W(NR_MAC, "DL-CCCH/SRB0, received spare2\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_spare1:
LOG_W(NR_MAC, "DL-CCCH/SRB0, received spare1\n");
break;
default:
AssertFatal(0 == 1, "Unknown DL-CCCH/SRB0 message %d\n", dl_ccch_msg->message.choice.c1->present);
break;
}
return 0;
} else if (dl_rrc->srb_id == DCCH) { // SRB 1
nr_rlc_srb_recv_sdu(dl_rrc->rnti, DCCH, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
return 0;
} else if (dl_rrc->srb_id == DCCH1) { // SRB 2
nr_rlc_srb_recv_sdu(dl_rrc->rnti, DCCH1, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
return 0;
}
return -1; /* not handled yet */
}
int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t *dl_rrc, NR_RRCSetup_t *rrcSetup)
{
DevAssert(rrcSetup != NULL);
NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup;
AssertFatal(rrcSetup_ies->masterCellGroup.buf != NULL,"masterCellGroup is NULL\n");
NR_CellGroupConfig_t *cellGroup = NULL;
asn_dec_rval_t dec_rval = uper_decode(NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&cellGroup,
rrcSetup_ies->masterCellGroup.buf,
rrcSetup_ies->masterCellGroup.size,
0,
0);
AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n");
/* there might be a memory leak for the cell group if we call this multiple
* times. */
nr_mac_update_cellgroup(RC.nrmac[module_id], dl_rrc->rnti, cellGroup);
/* TODO: drop the RRC context */
gNB_RRC_INST *rrc = RC.nrrrc[module_id];
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, dl_rrc->rnti);
gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
ue_p->SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList;
ue_p->masterCellGroup = cellGroup;
nr_rlc_srb_recv_sdu(dl_rrc->rnti, CCCH, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
protocol_ctxt_t ctxt = {.module_id = module_id, .rntiMaybeUEid = dl_rrc->rnti};
nr_rrc_rlc_config_asn1_req(&ctxt,
ue_context_p->ue_context.SRB_configList,
NULL,
NULL,
cellGroup->rlc_BearerToAddModList);
LOG_I(NR_MAC, "DL RRC Message Transfer with %d bytes for RNTI %04x SRB %d\n", dl_rrc->rrc_container_length, dl_rrc->rnti, dl_rrc->srb_id);
nr_rlc_srb_recv_sdu(dl_rrc->rnti, dl_rrc->srb_id, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
return 0;
}
......@@ -184,13 +184,6 @@ rlc_op_status_t rrc_rlc_config_req(const protocol_ctxt_t *const, const srb_flag_
*/
rlc_op_status_t rrc_rlc_data_req (const protocol_ctxt_t *const, const MBMS_flag_t, const rb_id_t, mui_t, confirm_t, sdu_size_t, char *);
/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (const protocol_ctxt_t* const ctxtP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (const protocol_ctxt_t* const ctxtP, const rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
* \brief This function is called by RRC to register its DATA-INDICATE and DATA-CONFIRM handlers to RLC layer.
* \param[in] rrc_data_indP Pointer on RRC data indicate function.
* \param[in] rrc_data_confP Pointer on RRC data confirm callback function.
*/
void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP);
//-----------------------------------------------------------------------------
// PUBLIC INTERFACE WITH MAC
//-----------------------------------------------------------------------------
......
......@@ -1121,7 +1121,7 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid)
nr_pdcp_add_drbs(ctxt.enb_flag, ctxt.rntiMaybeUEid, 0, rbconfig->drb_ToAddModList, 0, NULL, NULL, Rlc_Bearer_ToAdd_list);
nr_rrc_rlc_config_asn1_req(&ctxt, (NR_SRB_ToAddModList_t *)NULL, rbconfig->drb_ToAddModList, rbconfig->drb_ToReleaseList, Rlc_Bearer_ToAdd_list);
nr_rlc_add_drb(ctxt.rntiMaybeUEid, drb_ToAddMod->drb_Identity, RLC_BearerConfig);
LOG_D(PDCP, "%s:%d: done RRC PDCP/RLC ASN1 request for UE ID/RNTI %ld\n", __FUNCTION__, __LINE__, ctxt.rntiMaybeUEid);
}
......
......@@ -683,14 +683,13 @@ rb_found:
#endif
}
static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
nr_rlc_entity_t *nr_rlc_am;
nr_rlc_ue_t *ue;
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;
......@@ -774,14 +773,13 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
nr_rlc_entity_t *nr_rlc_am;
nr_rlc_ue_t *ue;
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int drb_id = s->drb_Identity;
int channel_id = rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group;
......@@ -856,14 +854,13 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
nr_rlc_entity_t *nr_rlc_um;
nr_rlc_ue_t *ue;
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int drb_id = s->drb_Identity;
int channel_id = rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group;
......@@ -924,14 +921,14 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void add_drb(int rnti, struct NR_DRB_ToAddMod *s, struct NR_RLC_BearerConfig *rlc_BearerConfig)
void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
switch (rlc_BearerConfig->rlc_Config->present) {
case NR_RLC_Config_PR_am:
add_drb_am(rnti, s, rlc_BearerConfig);
add_drb_am(rnti, drb_id, rlc_BearerConfig);
break;
case NR_RLC_Config_PR_um_Bi_Directional:
add_drb_um(rnti, s, rlc_BearerConfig);
add_drb_um(rnti, drb_id, rlc_BearerConfig);
break;
default:
LOG_E(RLC, "%s:%d:%s: fatal: unhandled DRB type\n",
......@@ -953,96 +950,32 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
return 0;
}
rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list)
{
int rnti = ctxt_pP->rntiMaybeUEid;
int i;
int j;
if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*||
ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 ||
ctxt_pP->brOption != 0 */) {
LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d)\n", __FUNCTION__,
ctxt_pP->enb_flag , ctxt_pP->module_id, ctxt_pP->instance,
ctxt_pP->eNB_index, ctxt_pP->brOption);
exit(1);
}
if (drb2release_listP != NULL) {
LOG_E(RLC, "%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__);
//exit(1);
}
if (srb2add_listP != NULL) {
for (i = 0; i < srb2add_listP->list.count; i++) {
if (rlc_bearer2add_list != NULL) {
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_rlc_srb(rnti, srb2add_listP->list.array[i], rlc_bearer2add_list->list.array[j]);
LOG_D(RLC, "Add srb %ld\n", srb2add_listP->list.array[i]->srb_Identity);
}
}
}
}
}
}
}
if ((drb2add_listP != NULL) && (rlc_bearer2add_list != NULL)) {
for (i = 0; i < drb2add_listP->list.count; i++) {
if (rlc_bearer2add_list != NULL) {
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]);
}
}
}
}
}
}
}
return RLC_OP_STATUS_OK;
}
struct srb0_data {
int module_id;
int CC_id;
struct gNB_MAC_INST_s *mac;
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 *rawUE;
void (*send_initial_ul_rrc_message)(struct gNB_MAC_INST_s *mac,
int rnti,
const uint8_t *sdu,
sdu_size_t sdu_len,
void *rawUE);
};
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);
s0->send_initial_ul_rrc_message(s0->mac, s0->rnti, (unsigned char *)buf,
size, s0->rawUE);
}
void nr_rlc_activate_srb0(int rnti, int module_id, int cc_id, int uid,
void nr_rlc_activate_srb0(int rnti, struct gNB_MAC_INST_s *mac, void *rawUE,
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))
struct gNB_MAC_INST_s *mac,
int rnti,
const uint8_t *sdu,
sdu_size_t sdu_len,
void *rawUE))
{
nr_rlc_entity_t *nr_rlc_tm;
nr_rlc_ue_t *ue;
......@@ -1051,10 +984,9 @@ void nr_rlc_activate_srb0(int rnti, int module_id, int cc_id, int uid,
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->mac = mac;
srb0_data->rnti = rnti;
srb0_data->uid = uid;
srb0_data->rawUE = rawUE;
srb0_data->send_initial_ul_rrc_message = send_initial_ul_rrc_message;
nr_rlc_manager_lock(nr_rlc_ue_manager);
......@@ -1132,11 +1064,6 @@ rlc_op_status_t rrc_rlc_config_req (
return RLC_OP_STATUS_OK;
}
void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP)
{
/* nothing to do */
}
void nr_rlc_remove_ue(int rnti)
{
LOG_W(RLC, "remove UE %x\n", rnti);
......
......@@ -36,9 +36,6 @@
#include "NR_CellGroupConfig.h"
#include "openair2/RRC/NR/nr_rrc_proto.h"
/* from OAI */
#include "pdcp.h"
struct NR_RLC_Config;
struct NR_LogicalChannelConfig;
......@@ -48,6 +45,9 @@ 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_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig);
void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig);
void nr_rlc_remove_ue(int rnti);
int nr_rlc_get_available_tx_space(
......@@ -61,11 +61,11 @@ void nr_rlc_activate_avg_time_to_tx(
void nr_rlc_srb_recv_sdu(const int rnti, const logical_chan_id_t channel_id, unsigned char *buf, int size);
void nr_rlc_activate_srb0(int rnti, int module_id, int cc_id, int uid,
struct gNB_MAC_INST_s;
void nr_rlc_activate_srb0(int rnti, struct gNB_MAC_INST_s *mac, void *rawUE,
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));
struct gNB_MAC_INST_s *mac,
int rnti,
const uint8_t *sdu,
sdu_size_t sdu_len,
void *rawUE));
......@@ -976,11 +976,6 @@ rlc_op_status_t rrc_rlc_config_req (
return RLC_OP_STATUS_OK;
}
void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP)
{
/* nothing to do */
}
rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
{
LOG_D(RLC, "%s:%d:%s: remove UE %ld\n", __FILE__, __LINE__, __FUNCTION__, x->rntiMaybeUEid);
......
......@@ -56,7 +56,6 @@ rrc_init_global_param(
)
//-----------------------------------------------------------------------------
{
rrc_rlc_register_rrc (rrc_data_ind, NULL); //register with rlc
DCCH_LCHAN_DESC.transport_block_size = 4;
DCCH_LCHAN_DESC.max_transport_blocks = 16;
DCCH_LCHAN_DESC.Delay_class = 1;
......
......@@ -50,8 +50,6 @@ extern mui_t rrc_gNB_mui;
//-----------------------------------------------------------------------------
void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan)
{
rrc_rlc_register_rrc (rrc_data_ind, NULL); //register with rlc
chan->transport_block_size = 4;
chan->max_transport_blocks = 16;
chan->Delay_class = 1;
......
......@@ -280,7 +280,6 @@ typedef struct gNB_RRC_UE_s {
NR_DRB_ToReleaseList_t *DRB_Release_configList2[NR_RRC_TRANSACTION_IDENTIFIER_NUMBER];
uint8_t DRB_active[NGAP_MAX_DRBS_PER_UE];
NR_SRB_INFO SI;
NR_SRB_INFO_TABLE_ENTRY Srb[maxSRBs]; // 3gpp max is 3 SRBs, number 1..3, we waste the entry 0 for code simplicity
NR_MeasConfig_t *measConfig;
NR_HANDOVER_INFO *handover_info;
......@@ -435,7 +434,6 @@ typedef struct {
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
NR_ServingCellConfig_t *servingcellconfig;
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
NR_SRB_INFO SI;
int p_gNB;
} rrc_gNB_carrier_data_t;
......
......@@ -177,12 +177,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
rrc_gNB_ue_context_t *ue_context_pP,
NR_CellGroupConfig_t *cell_groupConfig_from_DU);
rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
void bearer_context_setup_direct(e1ap_bearer_setup_req_t *req,
instance_t instance);
......
This diff is collapsed.
......@@ -622,29 +622,11 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu
/*
* switch UL or DL NAS message without RRC piggybacked to SRB2 if active.
*/
switch (RC.nrrrc[ctxt.module_id]->node_type) {
case ngran_gNB_CU:
case ngran_gNB_CUCP:
case ngran_gNB: {
long srb_id;
if (UE->Srb[2].Active)
srb_id = UE->Srb[2].Srb_info.Srb_id;
else
srb_id = UE->Srb[1].Srb_info.Srb_id;
AssertFatal(srb_id > 0 && srb_id < maxSRBs, "");
/* Transfer data to PDCP */
nr_rrc_data_req(&ctxt, srb_id, (*rrc_gNB_mui)++, SDU_CONFIRM_NO, length, buffer, PDCP_TRANSMISSION_MODE_CONTROL);
free(buffer); // nr_rrc_data_req do a second malloc and copy
} break;
case ngran_gNB_DU:
// nothing to do for DU
break;
default:
LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt.module_id]->node_type);
}
return (0);
AssertFatal(!NODE_IS_DU(RC.nrrrc[ctxt.module_id]->node_type), "illegal node type DU: receiving NGAP messages at this node\n");
/* Transfer data to PDCP */
rb_id_t srb_id = UE->Srb[2].Active ? DCCH1 : DCCH;
nr_rrc_data_req(&ctxt, srb_id, (*rrc_gNB_mui)++, SDU_CONFIRM_NO, length, buffer, PDCP_TRANSMISSION_MODE_CONTROL);
return 0;
}
//------------------------------------------------------------------------------
......
......@@ -33,9 +33,11 @@
#include "NR_UE-NR-Capability.h"
//#include "NR_UE-CapabilityRAT-ContainerList.h"
#include "LTE_UE-CapabilityRAT-ContainerList.h"
#include "NR_CellGroupConfig.h"
#include "NR_CG-Config.h"
//#include "NR_SRB-ToAddModList.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h"
#include "executables/softmodem-common.h"
#include "executables/nr-softmodem.h"
......@@ -109,6 +111,7 @@ RB_PROTOTYPE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries,
void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m)
{
AssertFatal(!get_softmodem_params()->sa, "%s() cannot be called in SA mode, it is intrinsically for NSA\n", __func__);
// generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331)
rrc_gNB_carrier_data_t *carrier=&rrc->carrier;
const gNB_RrcConfigurationReq *configuration = &rrc->configuration;
......@@ -351,11 +354,25 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a
ctxt.subframe,
ctxt.eNB_index);
nr_pdcp_add_drbs(
ctxt.enb_flag, ctxt.rntiMaybeUEid, 0, UE->rb_config->drb_ToAddModList, (UE->integrity_algorithm << 4) | UE->ciphering_algorithm, kUPenc, kUPint, UE->secondaryCellGroup->rlc_BearerToAddModList);
nr_rrc_rlc_config_asn1_req(
&ctxt, get_softmodem_params()->sa ? UE->rb_config->srb_ToAddModList : NULL, UE->rb_config->drb_ToAddModList, UE->rb_config->drb_ToReleaseList, UE->secondaryCellGroup->rlc_BearerToAddModList);
nr_pdcp_add_drbs(ctxt.enb_flag,
ctxt.rntiMaybeUEid,
0,
ue_context_p->ue_context.rb_config->drb_ToAddModList,
(ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm,
kUPenc,
kUPint,
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList);
// assume only a single bearer
const NR_DRB_ToAddModList_t *drb_list = ue_context_p->ue_context.rb_config->drb_ToAddModList;
DevAssert(drb_list->list.count == 1);
const NR_DRB_ToAddMod_t *drb = drb_list->list.array[0];
const struct NR_CellGroupConfig__rlc_BearerToAddModList *bearer_list =
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList;
const NR_RLC_BearerConfig_t *bearer = bearer_list->list.array[0];
DevAssert(bearer_list->list.count == 1);
DevAssert(drb->drb_Identity == bearer->servedRadioBearer->choice.drb_Identity);
nr_rlc_add_drb(ctxt.rntiMaybeUEid, drb->drb_Identity, bearer);
LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %lx\n", __FUNCTION__, __LINE__, ctxt.rntiMaybeUEid);
}
......
......@@ -54,6 +54,7 @@
#include "intertask_interface.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "nr-uesoftmodem.h"
#include "executables/softmodem-common.h"
#include "plmn_data.h"
......@@ -179,6 +180,46 @@ static int nr_rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_NR_t subS
return (0);
}
static void nr_rrc_addmod_srbs(int rnti,
const NR_SRB_ToAddModList_t *srb_list,
const struct NR_CellGroupConfig__rlc_BearerToAddModList *bearer_list)
{
if (srb_list == NULL || bearer_list == NULL)
return;
for (int i = 0; i < srb_list->list.count; i++) {
const NR_SRB_ToAddMod_t *srb = srb_list->list.array[i];
for (int j = 0; j < bearer_list->list.count; j++) {
const NR_RLC_BearerConfig_t *bearer = bearer_list->list.array[j];
if (bearer->servedRadioBearer != NULL
&& bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity
&& srb->srb_Identity == bearer->servedRadioBearer->choice.srb_Identity) {
nr_rlc_add_srb(rnti, srb->srb_Identity, bearer);
}
}
}
}
static void nr_rrc_addmod_drbs(int rnti,
const NR_DRB_ToAddModList_t *drb_list,
const struct NR_CellGroupConfig__rlc_BearerToAddModList *bearer_list)
{
if (drb_list == NULL || bearer_list == NULL)
return;
for (int i = 0; i < drb_list->list.count; i++) {
const NR_DRB_ToAddMod_t *drb = drb_list->list.array[i];
for (int j = 0; j < bearer_list->list.count; j++) {
const NR_RLC_BearerConfig_t *bearer = bearer_list->list.array[j];
if (bearer->servedRadioBearer != NULL
&& bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity
&& drb->drb_Identity == bearer->servedRadioBearer->choice.drb_Identity) {
nr_rlc_add_drb(rnti, drb->drb_Identity, bearer);
}
}
}
}
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
const uint8_t *buffer,
......@@ -1947,35 +1988,31 @@ nr_rrc_ue_establish_srb2(
}
}
NR_UE_RRC_INST_t *ue_rrc = &NR_UE_rrc_inst[ctxt_pP->module_id];
if (radioBearerConfig->srb_ToAddModList != NULL) {
if (radioBearerConfig->securityConfig != NULL) {
if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) {
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm = radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm;
NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm = *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm;
ue_rrc->cipheringAlgorithm = radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm;
ue_rrc->integrityProtAlgorithm = *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm;
}
}
uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL;
nr_derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
nr_derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
nr_derive_key_rrc_enc(ue_rrc->cipheringAlgorithm, ue_rrc->kgnb, &kRRCenc);
nr_derive_key_rrc_int(ue_rrc->integrityProtAlgorithm, ue_rrc->kgnb, &kRRCint);
// Refresh SRBs
nr_pdcp_add_srbs(ctxt_pP->enb_flag,
ctxt_pP->rntiMaybeUEid,
radioBearerConfig->srb_ToAddModList,
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
ue_rrc->cipheringAlgorithm | (ue_rrc->integrityProtAlgorithm << 4),
kRRCenc,
kRRCint);
// Refresh SRBs
nr_rrc_rlc_config_asn1_req(ctxt_pP,
radioBearerConfig->srb_ToAddModList,
NULL,
NULL,
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList
);
nr_rrc_addmod_srbs(ctxt_pP->rntiMaybeUEid,
radioBearerConfig->srb_ToAddModList,
ue_rrc->cell_group_config->rlc_BearerToAddModList);
for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) {
SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity;
......@@ -2054,22 +2091,24 @@ nr_rrc_ue_establish_srb2(
uint8_t *kUPenc = NULL;
uint8_t *kUPint = NULL;
nr_derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc);
nr_derive_key_up_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPint);
NR_UE_RRC_INST_t *ue_rrc = &NR_UE_rrc_inst[ctxt_pP->module_id];
nr_derive_key_up_enc(ue_rrc->cipheringAlgorithm, ue_rrc->kgnb, &kUPenc);
nr_derive_key_up_int(ue_rrc->integrityProtAlgorithm, ue_rrc->kgnb, &kUPint);
// Refresh DRBs
// Refresh DRBs
nr_pdcp_add_drbs(ctxt_pP->enb_flag,
ctxt_pP->rntiMaybeUEid,
0,
radioBearerConfig->drb_ToAddModList,
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
ue_rrc->cipheringAlgorithm | (ue_rrc->integrityProtAlgorithm << 4),
kUPenc,
kUPint,
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
ue_rrc->cell_group_config->rlc_BearerToAddModList);
// Refresh DRBs
nr_rrc_rlc_config_asn1_req(ctxt_pP, NULL, radioBearerConfig->drb_ToAddModList, NULL, NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
nr_rrc_addmod_drbs(ctxt_pP->rntiMaybeUEid,
radioBearerConfig->drb_ToAddModList,
ue_rrc->cell_group_config->rlc_BearerToAddModList);
} // drb_ToAddModList //
if (radioBearerConfig->drb_ToReleaseList != NULL) {
......
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